wikibase-sdk
Advanced tools
Comparing version 9.2.1 to 9.2.2
import type { EntityId, EntityPageTitle, Guid, GuidAltSyntax, NonNestedEntityId, NumericId, PropertyClaimsId } from '../types/entity.js'; | ||
import type { Url } from '../types/options.js'; | ||
import type { Url } from '../utils/build_url.js'; | ||
export declare const isNumericId: (id: string) => id is `${number}`; | ||
@@ -4,0 +4,0 @@ export declare const isEntityId: (id: string) => id is EntityId; |
@@ -1,3 +0,4 @@ | ||
import type { Url, WmLanguageCode } from '../types/options.js'; | ||
import type { WmLanguageCode } from '../types/options.js'; | ||
import type { Site } from '../types/sitelinks.js'; | ||
import type { Url } from '../utils/build_url.js'; | ||
export interface GetSitelinkUrlOptions { | ||
@@ -4,0 +5,0 @@ site: Site; |
@@ -1,3 +0,3 @@ | ||
import type { Url, UrlResultFormat } from '../types/options.js'; | ||
import type { BuildUrlFunction } from '../utils/build_url.js'; | ||
import type { UrlResultFormat } from '../types/options.js'; | ||
import type { BuildUrlFunction, Url } from '../utils/build_url.js'; | ||
export interface CirrusSearchPagesOptions { | ||
@@ -4,0 +4,0 @@ search?: string; |
@@ -1,4 +0,4 @@ | ||
import type { Props, Url, UrlResultFormat, WmLanguageCode } from '../types/options.js'; | ||
import type { Props, UrlResultFormat, WmLanguageCode } from '../types/options.js'; | ||
import type { Site } from '../types/sitelinks.js'; | ||
import type { BuildUrlFunction } from '../utils/build_url.js'; | ||
import type { BuildUrlFunction, Url } from '../utils/build_url.js'; | ||
export interface GetEntitiesFromSitelinksOptions { | ||
@@ -5,0 +5,0 @@ titles: string | string[]; |
import type { EntityId } from '../types/entity.js'; | ||
import type { Props, Url, UrlResultFormat, WmLanguageCode } from '../types/options.js'; | ||
import type { BuildUrlFunction } from '../utils/build_url.js'; | ||
import type { Props, UrlResultFormat, WmLanguageCode } from '../types/options.js'; | ||
import type { BuildUrlFunction, Url } from '../utils/build_url.js'; | ||
export interface GetEntitiesOptions { | ||
@@ -5,0 +5,0 @@ ids: EntityId | EntityId[]; |
import type { EntityId, RevisionId } from '../types/entity.js'; | ||
import type { Url } from '../types/options.js'; | ||
import type { Url } from '../utils/build_url.js'; | ||
export interface GetEntityRevisionOptions { | ||
@@ -4,0 +4,0 @@ id: EntityId; |
import type { GetEntitiesOptions } from './get_entities.js'; | ||
import type { EntityId } from '../types/entity.js'; | ||
import type { Url } from '../types/options.js'; | ||
import type { BuildUrlFunction } from '../utils/build_url.js'; | ||
import type { BuildUrlFunction, Url } from '../utils/build_url.js'; | ||
export interface GetManyEntitiesOptions extends GetEntitiesOptions { | ||
@@ -6,0 +5,0 @@ ids: EntityId[]; |
import type { PropertyId } from '../types/entity.js'; | ||
import type { Url } from '../types/options.js'; | ||
import type { Url } from '../utils/build_url.js'; | ||
export interface GetReverseClaimsOptions { | ||
@@ -4,0 +4,0 @@ properties: PropertyId | PropertyId[]; |
import type { EntityType } from '../types/entity.js'; | ||
import type { Url, UrlResultFormat } from '../types/options.js'; | ||
import type { BuildUrlFunction } from '../utils/build_url.js'; | ||
import type { UrlResultFormat } from '../types/options.js'; | ||
import type { BuildUrlFunction, Url } from '../utils/build_url.js'; | ||
export interface SearchEntitiesOptions { | ||
@@ -5,0 +5,0 @@ search: string; |
@@ -1,3 +0,3 @@ | ||
import type { Url } from '../types/options.js'; | ||
import type { Url } from '../utils/build_url.js'; | ||
export declare function sparqlQueryFactory(sparqlEndpoint: Url): (sparql: string) => Url; | ||
//# sourceMappingURL=sparql_query.d.ts.map |
@@ -59,3 +59,3 @@ import type { Claims, DataType } from './claim.js'; | ||
export interface MediaInfo extends EntityInfo { | ||
id: MediaInfo; | ||
id: MediaInfoId; | ||
type: 'mediainfo'; | ||
@@ -62,0 +62,0 @@ labels?: Labels; |
@@ -11,4 +11,2 @@ import type { SimplifySnaksOptions } from './simplify_claims.js'; | ||
export type WmLanguageCode = typeof languages[number]; | ||
export type ApiQueryParameters = Record<string, string | number | true>; | ||
export type Url = string; | ||
export interface SimplifyEntityOptions extends SimplifySnaksOptions, SimplifySitelinkOptions { | ||
@@ -15,0 +13,0 @@ } |
import type { ItemId } from './entity.js'; | ||
import type { Url } from './options.js'; | ||
import type { sites } from '../helpers/sitelinks_sites.js'; | ||
import type { specialSites } from '../helpers/special_sites.js'; | ||
import type { Url } from '../utils/build_url.js'; | ||
type ValueOf<T> = T[keyof T]; | ||
@@ -6,0 +6,0 @@ type SpecialSiteName = ValueOf<typeof specialSites>; |
@@ -1,4 +0,7 @@ | ||
import type { ApiQueryParameters, Url } from '../types/options.js'; | ||
type ApiQueryValue = string | number | true; | ||
export type ApiQueryParameters = Record<string, ApiQueryValue>; | ||
export type Url = string; | ||
export type BuildUrlFunction = <T extends string>(options: Readonly<Partial<Record<T, ApiQueryValue>>>) => Url; | ||
export declare function buildUrlFactory(instanceApiEndpoint: Url): BuildUrlFunction; | ||
export type BuildUrlFunction = (options: ApiQueryParameters) => Url; | ||
export {}; | ||
//# sourceMappingURL=build_url.d.ts.map |
const isBrowser = typeof location !== 'undefined' && typeof document !== 'undefined'; | ||
export function buildUrlFactory(instanceApiEndpoint) { | ||
return function (queryObj) { | ||
return queryObj => { | ||
// Request CORS headers if the request is made from a browser | ||
// See https://www.wikidata.org/w/api.php ('origin' parameter) | ||
if (isBrowser) | ||
queryObj.origin = '*'; | ||
queryObj = Object.assign(Object.assign({}, queryObj), { origin: '*' }); | ||
const queryEntries = Object.entries(queryObj) | ||
@@ -9,0 +9,0 @@ // Remove null or undefined parameters |
@@ -16,3 +16,4 @@ import * as helpers from './helpers/helpers.js'; | ||
import { sparqlQueryFactory } from './queries/sparql_query.js'; | ||
import type { InstanceConfig, Url } from './types/options.js'; | ||
import { type Url } from './utils/build_url.js'; | ||
import type { InstanceConfig } from './types/options.js'; | ||
declare const common: { | ||
@@ -19,0 +20,0 @@ readonly wikibaseTimeToDateObject: typeof timeHelpers.wikibaseTimeToDateObject; |
{ | ||
"name": "wikibase-sdk", | ||
"version": "9.2.1", | ||
"version": "9.2.2", | ||
"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
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
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
266658
3510