wikibase-sdk
Advanced tools
Comparing version 9.1.0 to 9.1.1
@@ -1,2 +0,2 @@ | ||
import type { Claim, Claims, PropertyClaims, PropertyQualifiers, Qualifier, Qualifiers } from '../types/claim.js'; | ||
import type { Claim, Claims, PropertyClaims, PropertyQualifiers, Qualifier, Qualifiers, Reference } from '../types/claim.js'; | ||
import type { SimplifiedClaim, SimplifiedClaims, SimplifiedPropertyClaims, SimplifySnakOptions, SimplifySnaksOptions } from '../types/simplify_claims.js'; | ||
@@ -9,4 +9,4 @@ export declare function simplifyClaims(claims: Claims, options?: SimplifySnaksOptions): SimplifiedClaims; | ||
export declare function simplifyQualifier(qualifier: Qualifier, options?: SimplifySnakOptions): any; | ||
export declare function simplifyReferences(references: any, options: any): any; | ||
export declare function simplifyReferenceRecord(refRecord: any, options: any): any; | ||
export declare function simplifyReferences(references: readonly Reference[], options?: any): any[]; | ||
export declare function simplifyReferenceRecord(refRecord: Reference, options?: any): any; | ||
//# sourceMappingURL=simplify_claims.d.ts.map |
@@ -141,6 +141,6 @@ import { uniq } from '../utils/utils.js'; | ||
} | ||
export function simplifyReferences(references, options) { | ||
export function simplifyReferences(references, options = {}) { | ||
return references.map(refRecord => simplifyReferenceRecord(refRecord, options)); | ||
} | ||
export function simplifyReferenceRecord(refRecord, options) { | ||
export function simplifyReferenceRecord(refRecord, options = {}) { | ||
const subSnaksOptions = getSubSnakOptions(options); | ||
@@ -147,0 +147,0 @@ const snaks = simplifySnaks(refRecord.snaks, subSnaksOptions); |
@@ -1,2 +0,16 @@ | ||
import * as simplify from './simplify.js'; | ||
import { simplifyClaims } from './simplify_claims.js'; | ||
import { simplifyForms } from './simplify_forms.js'; | ||
import { simplifySenses } from './simplify_senses.js'; | ||
import { simplifySitelinks } from './simplify_sitelinks.js'; | ||
import { simplifyAliases, simplifyDescriptions, simplifyLabels, simplifyLemmas } from './simplify_text_attributes.js'; | ||
const simplify = { | ||
labels: simplifyLabels, | ||
descriptions: simplifyDescriptions, | ||
aliases: simplifyAliases, | ||
claims: simplifyClaims, | ||
sitelinks: simplifySitelinks, | ||
lemmas: simplifyLemmas, | ||
forms: simplifyForms, | ||
senses: simplifySenses, | ||
}; | ||
export const simplifyEntity = (entity, options = {}) => { | ||
@@ -3,0 +17,0 @@ const { type } = entity; |
import type { Form, SimplifiedForm } from '../types/lexeme.js'; | ||
import type { SimplifyClaimsOptions } from '../types/simplify_claims.js'; | ||
export declare const simplifyForm: (form: Form, options?: SimplifyClaimsOptions) => SimplifiedForm; | ||
export declare const simplifyForms: (forms: any, options: any) => any; | ||
export declare const simplifyForms: (forms: readonly Form[], options?: SimplifyClaimsOptions) => SimplifiedForm[]; | ||
//# sourceMappingURL=simplify_forms.d.ts.map |
@@ -15,3 +15,3 @@ import { isFormId } from './helpers.js'; | ||
}; | ||
export const simplifyForms = (forms, options) => forms.map(form => simplifyForm(form, options)); | ||
export const simplifyForms = (forms, options = {}) => forms.map(form => simplifyForm(form, options)); | ||
//# sourceMappingURL=simplify_forms.js.map |
@@ -6,3 +6,3 @@ import { isEntityId, isEntityPageTitle, isPropertyId, isRevisionId } from './helpers.js'; | ||
if (!testFn(value)) | ||
throw new Error(`invalid ${name}: ${value}`); | ||
throw new Error(`invalid ${name}: ${value} (type: ${typeOf(value)})`); | ||
}; | ||
@@ -14,2 +14,19 @@ } | ||
export const revisionId = validate('revision id', isRevisionId); | ||
function typeOf(value) { | ||
// just handling what differes from typeof | ||
const type = typeof value; | ||
if (type === 'object') { | ||
if (value === null) | ||
return 'null'; | ||
if (value instanceof Array) | ||
return 'array'; | ||
if (value instanceof Promise) | ||
return 'promise'; | ||
} | ||
if (type === 'number') { | ||
if (Number.isNaN(value)) | ||
return 'NaN'; | ||
} | ||
return type; | ||
} | ||
//# sourceMappingURL=validate.js.map |
import type { Claims, DataType } from './claim.js'; | ||
import type { Forms, Senses, SimplifiedForms, SimplifiedSenses } from './lexeme.js'; | ||
import type { Form, Sense, SimplifiedForms, SimplifiedSenses } from './lexeme.js'; | ||
import type { SimplifiedClaims } from './simplify_claims.js'; | ||
@@ -49,5 +49,6 @@ import type { SimplifiedSitelinks, Sitelinks } from './sitelinks.js'; | ||
language: ItemId; | ||
claims?: Claims; | ||
lemmas?: Lemmas; | ||
forms?: Forms; | ||
senses?: Senses; | ||
forms?: Form[]; | ||
senses?: Sense[]; | ||
} | ||
@@ -91,2 +92,3 @@ export interface EntityInfo { | ||
language: ItemId; | ||
claims?: SimplifiedClaims; | ||
lemmas?: SimplifiedLemmas; | ||
@@ -93,0 +95,0 @@ forms?: SimplifiedForms; |
@@ -5,4 +5,2 @@ import type { Claims } from './claim.js'; | ||
import type { Glosses, Representations, SimplifiedGlosses, SimplifiedRepresentations } from './terms.js'; | ||
export type Forms = Record<PropertyId, Form[]>; | ||
export type Senses = Record<PropertyId, Sense[]>; | ||
export interface Form { | ||
@@ -9,0 +7,0 @@ id: FormId; |
{ | ||
"name": "wikibase-sdk", | ||
"version": "9.1.0", | ||
"version": "9.1.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "utils functions to query a Wikibase instance and simplify its results", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
240175
3432