@twin.org/data-json-ld 0.0.3-next.20 → 0.0.3-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -130,7 +130,9 @@ export class JsonLdProcessor {
|
|
|
130
130
|
});
|
|
131
131
|
if (!Is.empty(overrideContext)) {
|
|
132
132
|
// Remove the override context from the compacted document
|
|
133
|
-
compacted["@context"] = JsonLdProcessor.removeContexts(compacted["@context"], [
|
|
133
|
+
compacted["@context"] = JsonLdProcessor.removeContexts(compacted["@context"], [
|
|
134
|
+
overrideContext
|
|
135
|
+
]);
|
|
134
136
|
}
|
|
135
137
|
return compacted;
|
|
136
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonLdProcessor.js","sourceRoot":"","sources":["../../../src/utils/jsonLdProcessor.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAExF,OAAO,EACN,WAAW,EACX,YAAY,EACZ,WAAW,EACX,eAAe,EACf,UAAU,EACV,cAAc,EACd,SAAS,EACT,MAAM,eAAe,CAAC;AACvB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAO5B;;GAEG;AACH,MAAM,OAAO,eAAe;IAC3B;;;OAGG;IACI,MAAM,CAAU,UAAU,qBAA6B;IAE9D;;;OAGG;IACK,MAAM,CAAU,yBAAyB,GAAG,CAAC,CAAC;IAEtD;;;OAGG;IACI,MAAM,CAAC,iBAAiB,CAAC,cAAqD;QACpF,WAAW,CAAC,GAAG,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,iBAAiB;QAC9B,IAAI,cAAc,GACjB,WAAW,CAAC,GAAG,CAAwC,sBAAsB,CAAC,CAAC;QAChF,IAAI,CAAC,EAAE,C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AAG,CAAC,CAAC;QAC5F,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseError, GeneralError, Is, ObjectHelper, SharedStore } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tFetchHelper,\n\tHeaderHelper,\n\tHeaderTypes,\n\tHttpLinkRelType,\n\tHttpMethod,\n\tHttpStatusCode,\n\tMimeTypes\n} from \"@twin.org/web\";\nimport jsonLd from \"jsonld\";\nimport type { JsonLd, RemoteDocument, Url } from \"jsonld/jsonld-spec.js\";\nimport type { IJsonLdContextDefinition } from \"../models/IJsonLdContextDefinition.js\";\nimport type { IJsonLdContextDefinitionElement } from \"../models/IJsonLdContextDefinitionElement.js\";\nimport type { IJsonLdContextDefinitionRoot } from \"../models/IJsonLdContextDefinitionRoot.js\";\nimport type { IJsonLdNodeObject } from \"../models/IJsonLdNodeObject.js\";\n\n/**\n * JSON-LD Processor.\n */\nexport class JsonLdProcessor {\n\t/**\n\t * The class name.\n\t * @internal\n\t */\n\tpublic static readonly CLASS_NAME = nameof<JsonLdProcessor>();\n\n\t/**\n\t * Maximum number of HTTP Link-header discovery hops (namespace URL → context document).\n\t * @internal\n\t */\n\tprivate static readonly _MAX_LINK_DISCOVERY_DEPTH = 1;\n\n\t/**\n\t * The document loader to use.\n\t * @param documentLoader The document loader to use.\n\t */\n\tpublic static setDocumentLoader(documentLoader: (url: Url) => Promise<RemoteDocument>): void {\n\t\tSharedStore.set(\"jsonLdDocumentLoader\", documentLoader);\n\t}\n\n\t/**\n\t * The document loader to use for retrieving JSON-LD documents.\n\t * @returns The document loader.\n\t */\n\tpublic static getDocumentLoader(): (url: Url) => Promise<RemoteDocument> {\n\t\tlet documentLoader =\n\t\t\tSharedStore.get<(url: Url) => Promise<RemoteDocument>>(\"jsonLdDocumentLoader\");\n\t\tif (!Is.function(documentLoader)) {\n\t\t\tdocumentLoader = async (url: string) => JsonLdProcessor.documentLoader(url);\n\t\t}\n\t\treturn documentLoader;\n\t}\n\n\t/**\n\t * Set the cache time limit for documents.\n\t * @param cacheLimitMs The cache limit in milliseconds.\n\t */\n\tpublic static setCacheLimit(cacheLimitMs: number): void {\n\t\tSharedStore.set(\"jsonLdDocumentCacheLimit\", cacheLimitMs);\n\t}\n\n\t/**\n\t * Get the cache limit for documents.\n\t * @returns The document loader.\n\t */\n\tpublic static getCacheLimit(): number {\n\t\tlet cacheLimitMs = SharedStore.get<number>(\"jsonLdDocumentCacheLimit\");\n\t\tif (Is.empty(cacheLimitMs)) {\n\t\t\tcacheLimitMs = 3600000;\n\t\t\tSharedStore.set(\"jsonLdDocumentCacheLimit\", cacheLimitMs);\n\t\t}\n\t\treturn cacheLimitMs;\n\t}\n\n\t/**\n\t * Replace the global redirect list (use {@link JsonLdProcessor.addRedirect} to append without replacing).\n\t * Redirects run before any HTTP GET or `Link` discovery; use them for stable overrides, tests, or hosts that do not expose a suitable `Link` header.\n\t * @param redirects The redirects to use.\n\t */\n\tpublic static setRedirects(\n\t\tredirects: {\n\t\t\tfrom: RegExp;\n\t\t\tto: string;\n\t\t}[]\n\t): void {\n\t\tSharedStore.set(\"jsonLdRedirects\", redirects);\n\t}\n\n\t/**\n\t * Get the global redirects for JSON-LD.\n\t * @returns The registered redirects.\n\t */\n\tpublic static getRedirects(): {\n\t\tfrom: RegExp;\n\t\tto: string;\n\t}[] {\n\t\tlet redirects = SharedStore.get<\n\t\t\t{\n\t\t\t\tfrom: RegExp;\n\t\t\t\tto: string;\n\t\t\t}[]\n\t\t>(\"jsonLdRedirects\");\n\t\tif (Is.empty(redirects)) {\n\t\t\tredirects = [];\n\t\t\tSharedStore.set(\"jsonLdRedirects\", redirects);\n\t\t}\n\t\treturn redirects;\n\t}\n\n\t/**\n\t * Append a redirect rule (ignored if the same `RegExp.source` is already registered).\n\t * Optional when the vocabulary URL supports HTTP `Link` discovery (`rel` includes `alternate`, `type` is `application/ld+json`) via the default document loader.\n\t * Standards packages often expose `registerRedirects()` helpers that call this method; those are optional for the same reason.\n\t * @param from The URL to redirect from.\n\t * @param to The URL to redirect to.\n\t */\n\tpublic static addRedirect(from: RegExp, to: string): void {\n\t\tconst redirects = JsonLdProcessor.getRedirects();\n\t\tif (!redirects.some(r => r.from.source === from.source)) {\n\t\t\tredirects.push({ from, to });\n\t\t}\n\t}\n\n\t/**\n\t * Compact a document according to a particular context.\n\t * @param document The JSON-LD document to compact.\n\t * @param context The context to compact the document to, if not provided will use the one in the document.\n\t * @param options The options for compacting the document.\n\t * @param options.itemListOverride Whether to override the itemListElement context with a set, defaults to true.\n\t * @returns The compacted JSON-LD document.\n\t */\n\tpublic static async compact<T>(\n\t\tdocument: T,\n\t\tcontext?: IJsonLdContextDefinitionRoot,\n\t\toptions?: { itemListOverride: boolean }\n\t): Promise<T> {\n\t\ttry {\n\t\t\tif (Is.object<IJsonLdNodeObject>(document)) {\n\t\t\t\t// If the user didn't provide a context, use the one from the document\n\t\t\t\tif (Is.empty(context) && !Is.empty(document[\"@context\"])) {\n\t\t\t\t\tcontext = document[\"@context\"];\n\t\t\t\t}\n\n\t\t\t\tconst overrideListElementOption = options?.itemListOverride ?? true;\n\t\t\t\tlet overrideContext: IJsonLdContextDefinitionElement | undefined;\n\n\t\t\t\tif (overrideListElementOption) {\n\t\t\t\t\t// The compactArrays flag doesn't work with the current version of jsonld.js\n\t\t\t\t\t// For list results we standardise on ItemList and itemListElement\n\t\t\t\t\t// so we modify the schema.org type for itemListElement to be a set which bypasses the issue\n\t\t\t\t\t// https://github.com/digitalbazaar/jsonld.js/issues/247\n\t\t\t\t\toverrideContext = {\n\t\t\t\t\t\titemListElement: {\n\t\t\t\t\t\t\t\"@id\": \"http://schema.org/itemListElement\",\n\t\t\t\t\t\t\t\"@container\": \"@set\",\n\t\t\t\t\t\t\t\"@protected\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tif (Is.object(context) && \"@context\" in context) {\n\t\t\t\t\t\t// If the context is an object, we need to merge it with the override context\n\t\t\t\t\t\tcontext = JsonLdProcessor.combineContexts(\n\t\t\t\t\t\t\tcontext[\"@context\"] as IJsonLdContextDefinitionRoot,\n\t\t\t\t\t\t\toverrideContext\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If the context is a string or an array, we need to merge it with the override context\n\t\t\t\t\t\tcontext = JsonLdProcessor.combineContexts(context, overrideContext);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst compacted = await jsonLd.compact(\n\t\t\t\t\tObjectHelper.removeEmptyProperties(document),\n\t\t\t\t\tcontext as IJsonLdContextDefinition,\n\t\t\t\t\t{\n\t\t\t\t\t\tdocumentLoader: JsonLdProcessor.getDocumentLoader()\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tif (!Is.empty(overrideContext)) {\n\t\t\t\t\t// Remove the override context from the compacted document\n\t\t\t\t\tcompacted[\"@context\"] = JsonLdProcessor.removeContexts(\n\t\t\t\t\t\tcompacted[\"@context\"] as IJsonLdContextDefinitionRoot,\n\t\t\t\t\t\t[overrideContext]\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn compacted as T;\n\t\t\t}\n\t\t\treturn document;\n\t\t} catch (err) {\n\t\t\tJsonLdProcessor.handleCommonErrors(err);\n\n\t\t\tthrow new GeneralError(JsonLdProcessor.CLASS_NAME, \"compact\", undefined, err);\n\t\t}\n\t}\n\n\t/**\n\t * Expand a document, removing its context.\n\t * @param compacted The compacted JSON-LD document to expand.\n\t * @returns The expanded JSON-LD document.\n\t */\n\tpublic static async expand<T>(compacted: T): Promise<IJsonLdNodeObject[]> {\n\t\ttry {\n\t\t\tif (Is.object<IJsonLdNodeObject>(compacted)) {\n\t\t\t\tconst expanded = await jsonLd.expand(ObjectHelper.removeEmptyProperties(compacted), {\n\t\t\t\t\tdocumentLoader: JsonLdProcessor.getDocumentLoader()\n\t\t\t\t});\n\t\t\t\treturn expanded;\n\t\t\t}\n\t\t\treturn [];\n\t\t} catch (err) {\n\t\t\tJsonLdProcessor.handleCommonErrors(err);\n\n\t\t\tthrow new GeneralError(JsonLdProcessor.CLASS_NAME, \"expand\", undefined, err);\n\t\t}\n\t}\n\n\t/**\n\t * Canonize a document.\n\t * @param document The document to canonize.\n\t * @param options The options for canonization.\n\t * @param options.algorithm The algorithm to use for canonization, defaults to URDNA2015.\n\t * @returns The canonized document.\n\t */\n\tpublic static async canonize<T extends IJsonLdNodeObject>(\n\t\tdocument: T,\n\t\toptions?: {\n\t\t\talgorithm?: \"URDNA2015\" | \"URGNA2012\" | undefined;\n\t\t}\n\t): Promise<string> {\n\t\ttry {\n\t\t\tconst normalized = await jsonLd.canonize(ObjectHelper.removeEmptyProperties(document), {\n\t\t\t\talgorithm: options?.algorithm ?? \"URDNA2015\",\n\t\t\t\tformat: \"application/n-quads\",\n\t\t\t\tdocumentLoader: JsonLdProcessor.getDocumentLoader()\n\t\t\t});\n\t\t\treturn normalized;\n\t\t} catch (err) {\n\t\t\tJsonLdProcessor.handleCommonErrors(err);\n\n\t\t\tthrow new GeneralError(JsonLdProcessor.CLASS_NAME, \"canonize\", undefined, err);\n\t\t}\n\t}\n\n\t/**\n\t * Combine contexts.\n\t * @param context1 The first JSON-LD context to combine.\n\t * @param context2 The second JSON-LD context to combine.\n\t * @returns The combined context.\n\t */\n\tpublic static combineContexts(\n\t\tcontext1: IJsonLdContextDefinitionRoot | undefined,\n\t\tcontext2: IJsonLdContextDefinitionRoot | undefined\n\t): IJsonLdContextDefinitionRoot | undefined {\n\t\tconst combinedContext: IJsonLdContextDefinitionRoot = [];\n\n\t\tif (Is.string(context1)) {\n\t\t\tif (!combinedContext.includes(context1)) {\n\t\t\t\tcombinedContext.push(context1);\n\t\t\t}\n\t\t} else if (Is.array(context1)) {\n\t\t\tfor (const context of context1) {\n\t\t\t\tconst hasMatch = combinedContext.some(c => ObjectHelper.equal(c, context));\n\t\t\t\tif (!hasMatch) {\n\t\t\t\t\tcombinedContext.push(context);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (Is.object(context1)) {\n\t\t\tconst hasMatch = combinedContext.some(c => ObjectHelper.equal(c, context1));\n\t\t\tif (!hasMatch) {\n\t\t\t\tcombinedContext.push(context1);\n\t\t\t}\n\t\t}\n\n\t\tif (Is.string(context2)) {\n\t\t\tif (!combinedContext.includes(context2)) {\n\t\t\t\tcombinedContext.push(context2);\n\t\t\t}\n\t\t} else if (Is.array(context2)) {\n\t\t\tfor (const context of context2) {\n\t\t\t\tconst hasMatch = combinedContext.some(c => ObjectHelper.equal(c, context));\n\t\t\t\tif (!hasMatch) {\n\t\t\t\t\tcombinedContext.push(context);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (Is.object(context2)) {\n\t\t\tconst hasMatch = combinedContext.some(c => ObjectHelper.equal(c, context2));\n\t\t\tif (!hasMatch) {\n\t\t\t\tcombinedContext.push(context2);\n\t\t\t}\n\t\t}\n\n\t\tif (combinedContext.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (combinedContext.length === 1) {\n\t\t\treturn combinedContext[0];\n\t\t}\n\n\t\treturn combinedContext;\n\t}\n\n\t/**\n\t * Gather all the contexts from the element and it's children.\n\t * @param element The element to gather the contexts from.\n\t * @param initial The initial context.\n\t * @returns The combined contexts.\n\t */\n\tpublic static gatherContexts<T>(\n\t\telement: T,\n\t\tinitial?: IJsonLdContextDefinitionRoot\n\t): IJsonLdContextDefinitionRoot | undefined {\n\t\tlet combinedContexts: IJsonLdContextDefinitionRoot | undefined = initial;\n\n\t\tif (Is.object<IJsonLdNodeObject>(element)) {\n\t\t\tif (!Is.empty(element[\"@context\"])) {\n\t\t\t\tcombinedContexts = JsonLdProcessor.combineContexts(\n\t\t\t\t\tinitial,\n\t\t\t\t\telement[\"@context\"] as IJsonLdContextDefinitionRoot\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfor (const prop of Object.keys(element)) {\n\t\t\t\tconst value = element[prop];\n\t\t\t\tif (Is.object(value)) {\n\t\t\t\t\tcombinedContexts = JsonLdProcessor.gatherContexts(\n\t\t\t\t\t\tvalue as IJsonLdNodeObject,\n\t\t\t\t\t\tcombinedContexts\n\t\t\t\t\t);\n\t\t\t\t} else if (Is.array(value)) {\n\t\t\t\t\tfor (const item of value) {\n\t\t\t\t\t\tif (Is.object(item)) {\n\t\t\t\t\t\t\tcombinedContexts = JsonLdProcessor.gatherContexts(\n\t\t\t\t\t\t\t\titem as IJsonLdNodeObject,\n\t\t\t\t\t\t\t\tcombinedContexts\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn combinedContexts;\n\t}\n\n\t/**\n\t * Remove all the contexts that match the pattern.\n\t * @param context The context to remove the entries from.\n\t * @param match The element to try and match.\n\t * @returns The updated contexts.\n\t */\n\tpublic static removeContexts(\n\t\tcontext: IJsonLdContextDefinitionRoot | undefined,\n\t\tmatch?: IJsonLdContextDefinitionElement[]\n\t): IJsonLdContextDefinitionRoot | undefined {\n\t\tif (!Is.arrayValue(match)) {\n\t\t\treturn context;\n\t\t}\n\n\t\tlet finalContext: IJsonLdContextDefinitionRoot | undefined;\n\t\tif (Is.string(context)) {\n\t\t\tfor (const m of match) {\n\t\t\t\tif (context === m) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (Is.array(context)) {\n\t\t\tfor (const item of context) {\n\t\t\t\tconst hasMatch = match.some(m => ObjectHelper.equal(m, item));\n\t\t\t\tif (!hasMatch) {\n\t\t\t\t\tfinalContext ??= [];\n\t\t\t\t\tif (Is.array(finalContext)) {\n\t\t\t\t\t\tfinalContext.push(item);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (Is.object(context)) {\n\t\t\tconst hasMatch = match.some(m => ObjectHelper.equal(m, context));\n\t\t\tif (!hasMatch) {\n\t\t\t\tfinalContext = context;\n\t\t\t}\n\t\t}\n\n\t\treturn Is.arrayValue(finalContext) && finalContext.length === 1\n\t\t\t? finalContext[0]\n\t\t\t: finalContext;\n\t}\n\n\t/**\n\t * Add a context directly to the document loader cache.\n\t * @param url The url the ld context is for.\n\t * @param ldContext The context to add.\n\t * @returns Nothing.\n\t */\n\tpublic static async documentCacheAdd(url: string, ldContext: unknown): Promise<void> {\n\t\tawait FetchHelper.setCacheEntry(url, ldContext);\n\t}\n\n\t/**\n\t * Remove a context from the document loader cache.\n\t * @param url The url the ld context is for.\n\t * @returns Nothing.\n\t */\n\tpublic static async documentCacheRemove(url: string): Promise<void> {\n\t\tFetchHelper.removeCacheEntry(url);\n\t}\n\n\t/**\n\t * Document loader which uses a caching mechanism.\n\t * @param url The document url to load.\n\t * @returns The document.\n\t * @internal\n\t */\n\tprivate static async documentLoader(url: Url): Promise<RemoteDocument> {\n\t\tconst redirects = JsonLdProcessor.getRedirects();\n\t\tfor (const redirect of redirects) {\n\t\t\tif (redirect.from.test(url)) {\n\t\t\t\turl = redirect.to;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn JsonLdProcessor.fetchRemoteJsonLdDocument(url, 0);\n\t}\n\n\t/**\n\t * True when FetchHelper failed to decode JSON from the response (e.g. HTML or plain text).\n\t * @param err The error from fetchJson.\n\t * @internal\n\t */\n\tprivate static isFetchJsonDecodeFailure(err: unknown): boolean {\n\t\t// Raw JSON.parse / response.json() failures (FetchHelper may rethrow as FetchError with cause,\n\t\t// or propagate SyntaxError when error-response body is not JSON).\n\t\tconst error = BaseError.fromError(err);\n\t\tif (error.name === \"SyntaxError\" || error.cause?.name === \"SyntaxError\") {\n\t\t\treturn true;\n\t\t}\n\t\treturn error.message.includes(\"decodingJSON\") || error.message.includes(\"is not valid JSON\");\n\t}\n\n\t/**\n\t * Use HTTP Link (rel=alternate, type=application/ld+json) to discover a JSON-LD context URL.\n\t * @param sourceUrl URL that did not yield JSON (e.g. vocabulary namespace HTML page).\n\t * @returns Absolute context document URL, or undefined.\n\t * @internal\n\t */\n\tprivate static async tryDiscoverAlternateJsonLdContextUrl(\n\t\tsourceUrl: string\n\t): Promise<string | undefined> {\n\t\tconst fetchOpts = {\n\t\t\ttimeoutMs: 30_000,\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: `${MimeTypes.JsonLd},${MimeTypes.Json};q=0.9,*/*;q=0.8`\n\t\t\t}\n\t\t};\n\n\t\tlet response = await FetchHelper.fetch(\n\t\t\tJsonLdProcessor.CLASS_NAME,\n\t\t\tsourceUrl,\n\t\t\tHttpMethod.HEAD,\n\t\t\tundefined,\n\t\t\tfetchOpts\n\t\t);\n\n\t\tif (\n\t\t\tresponse.status === HttpStatusCode.methodNotAllowed ||\n\t\t\tresponse.status === HttpStatusCode.notImplemented\n\t\t) {\n\t\t\tresponse = await FetchHelper.fetch(\n\t\t\t\tJsonLdProcessor.CLASS_NAME,\n\t\t\t\tsourceUrl,\n\t\t\t\tHttpMethod.GET,\n\t\t\t\tundefined,\n\t\t\t\tfetchOpts\n\t\t\t);\n\t\t\tawait response.arrayBuffer();\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst linkHeader = response.headers.get(HeaderTypes.Link);\n\t\tif (Is.empty(linkHeader)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// response.url is \"\" for many mocked/synthetic Responses; Is.empty(\"\") is false, but\n\t\t// new URL(absoluteHref, \"\") throws — use a non-empty resolved URL as base only.\n\t\tconst baseUrl = Is.stringValue(response.url) ? response.url : sourceUrl;\n\n\t\tconst alternateLinkHeaders = HeaderHelper.extractLinkHeaderRelations(\n\t\t\tlinkHeader,\n\t\t\tHttpLinkRelType.alternate\n\t\t);\n\n\t\tif (Is.arrayValue(alternateLinkHeaders)) {\n\t\t\tfor (const alternateLinkHeader of alternateLinkHeaders) {\n\t\t\t\tif (alternateLinkHeader.params?.type === MimeTypes.JsonLd) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn new URL(alternateLinkHeader.url, baseUrl).href;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Malformed URL for this segment; try the next Link segment.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Fetch a remote JSON-LD document, with Accept fallbacks and optional Link-header discovery.\n\t * @param url Resolved document URL.\n\t * @param linkDiscoveryDepth Current discovery recursion depth.\n\t * @internal\n\t */\n\tprivate static async fetchRemoteJsonLdDocument(\n\t\turl: string,\n\t\tlinkDiscoveryDepth: number\n\t): Promise<RemoteDocument> {\n\t\tconst cacheTtlMs = JsonLdProcessor.getCacheLimit();\n\t\tconst fetchJsonLdOptions = {\n\t\t\tcacheTtlMs,\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t}\n\t\t};\n\t\tconst fetchJsonOptions = {\n\t\t\tcacheTtlMs,\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: MimeTypes.Json\n\t\t\t}\n\t\t};\n\n\t\ttry {\n\t\t\tconst document = await FetchHelper.fetchJson<never, JsonLd>(\n\t\t\t\tJsonLdProcessor.CLASS_NAME,\n\t\t\t\turl,\n\t\t\t\tHttpMethod.GET,\n\t\t\t\tundefined,\n\t\t\t\tfetchJsonLdOptions\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tdocumentUrl: url,\n\t\t\t\tdocument\n\t\t\t};\n\t\t} catch (errLd) {\n\t\t\tif (JsonLdProcessor.isFetchJsonDecodeFailure(errLd)) {\n\t\t\t\ttry {\n\t\t\t\t\tconst document = await FetchHelper.fetchJson<never, JsonLd>(\n\t\t\t\t\t\tJsonLdProcessor.CLASS_NAME,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\tHttpMethod.GET,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tfetchJsonOptions\n\t\t\t\t\t);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdocumentUrl: url,\n\t\t\t\t\t\tdocument\n\t\t\t\t\t};\n\t\t\t\t} catch (errJson) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tlinkDiscoveryDepth < JsonLdProcessor._MAX_LINK_DISCOVERY_DEPTH &&\n\t\t\t\t\t\tJsonLdProcessor.isFetchJsonDecodeFailure(errJson)\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst discovered = await JsonLdProcessor.tryDiscoverAlternateJsonLdContextUrl(url);\n\t\t\t\t\t\tif (Is.stringValue(discovered) && discovered !== url) {\n\t\t\t\t\t\t\treturn JsonLdProcessor.fetchRemoteJsonLdDocument(discovered, linkDiscoveryDepth + 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthrow errJson;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow errLd;\n\t\t}\n\t}\n\n\t/**\n\t * Handle common errors.\n\t * @param err The error to handle.\n\t * @internal\n\t */\n\tprivate static handleCommonErrors(err: unknown): void {\n\t\tif (\n\t\t\tIs.object<{ name: string; details?: { url?: string } }>(err) &&\n\t\t\terr.name === \"jsonld.InvalidUrl\"\n\t\t) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tJsonLdProcessor.CLASS_NAME,\n\t\t\t\t\"invalidUrl\",\n\t\t\t\t{ url: err.details?.url },\n\t\t\t\terr\n\t\t\t);\n\t\t} else if (\n\t\t\tIs.object<{ name: string; details?: { code: string } & { [id: string]: unknown } }>(err) &&\n\t\t\terr.name.startsWith(\"jsonld.\")\n\t\t) {\n\t\t\tconst { code, ...other } = err.details ?? {};\n\t\t\tthrow new GeneralError(JsonLdProcessor.CLASS_NAME, \"jsonLdError\", { code, ...other }, err);\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"jsonLdProcessor.js","sourceRoot":"","sources":["../../../src/utils/jsonLdProcessor.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EA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ACK,MAAM,CAAC,kBAAkB,CAAC,GAAY;QAC7C,IACC,EAAE,CAAC,MAAM,CAA+C,GAAG,CAAC;YAC5D,GAAG,CAAC,IAAI,KAAK,mBAAmB,EAC/B,CAAC;YACF,MAAM,IAAI,YAAY,CACrB,eAAe,CAAC,UAAU,EAC1B,YAAY,EACZ,EAAE,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,EACzB,GAAG,CACH,CAAC;QACH,CAAC;aAAM,IACN,EAAE,CAAC,MAAM,CAA2E,GAAG,CAAC;YACxF,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAC7B,CAAC;YACF,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,GAAG,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;YAC7C,MAAM,IAAI,YAAY,CAAC,eAAe,CAAC,UAAU,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,CAAC,CAAC;QAC5F,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseError, GeneralError, Is, ObjectHelper, SharedStore } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tFetchHelper,\n\tHeaderHelper,\n\tHeaderTypes,\n\tHttpLinkRelType,\n\tHttpMethod,\n\tHttpStatusCode,\n\tMimeTypes\n} from \"@twin.org/web\";\nimport jsonLd from \"jsonld\";\nimport type { JsonLd, RemoteDocument, Url } from \"jsonld/jsonld-spec.js\";\nimport type { IJsonLdContextDefinition } from \"../models/IJsonLdContextDefinition.js\";\nimport type { IJsonLdContextDefinitionElement } from \"../models/IJsonLdContextDefinitionElement.js\";\nimport type { IJsonLdContextDefinitionRoot } from \"../models/IJsonLdContextDefinitionRoot.js\";\nimport type { IJsonLdNodeObject } from \"../models/IJsonLdNodeObject.js\";\n\n/**\n * JSON-LD Processor.\n */\nexport class JsonLdProcessor {\n\t/**\n\t * The class name.\n\t * @internal\n\t */\n\tpublic static readonly CLASS_NAME = nameof<JsonLdProcessor>();\n\n\t/**\n\t * Maximum number of HTTP Link-header discovery hops (namespace URL → context document).\n\t * @internal\n\t */\n\tprivate static readonly _MAX_LINK_DISCOVERY_DEPTH = 1;\n\n\t/**\n\t * The document loader to use.\n\t * @param documentLoader The document loader to use.\n\t */\n\tpublic static setDocumentLoader(documentLoader: (url: Url) => Promise<RemoteDocument>): void {\n\t\tSharedStore.set(\"jsonLdDocumentLoader\", documentLoader);\n\t}\n\n\t/**\n\t * The document loader to use for retrieving JSON-LD documents.\n\t * @returns The document loader.\n\t */\n\tpublic static getDocumentLoader(): (url: Url) => Promise<RemoteDocument> {\n\t\tlet documentLoader =\n\t\t\tSharedStore.get<(url: Url) => Promise<RemoteDocument>>(\"jsonLdDocumentLoader\");\n\t\tif (!Is.function(documentLoader)) {\n\t\t\tdocumentLoader = async (url: string) => JsonLdProcessor.documentLoader(url);\n\t\t}\n\t\treturn documentLoader;\n\t}\n\n\t/**\n\t * Set the cache time limit for documents.\n\t * @param cacheLimitMs The cache limit in milliseconds.\n\t */\n\tpublic static setCacheLimit(cacheLimitMs: number): void {\n\t\tSharedStore.set(\"jsonLdDocumentCacheLimit\", cacheLimitMs);\n\t}\n\n\t/**\n\t * Get the cache limit for documents.\n\t * @returns The document loader.\n\t */\n\tpublic static getCacheLimit(): number {\n\t\tlet cacheLimitMs = SharedStore.get<number>(\"jsonLdDocumentCacheLimit\");\n\t\tif (Is.empty(cacheLimitMs)) {\n\t\t\tcacheLimitMs = 3600000;\n\t\t\tSharedStore.set(\"jsonLdDocumentCacheLimit\", cacheLimitMs);\n\t\t}\n\t\treturn cacheLimitMs;\n\t}\n\n\t/**\n\t * Replace the global redirect list (use {@link JsonLdProcessor.addRedirect} to append without replacing).\n\t * Redirects run before any HTTP GET or `Link` discovery; use them for stable overrides, tests, or hosts that do not expose a suitable `Link` header.\n\t * @param redirects The redirects to use.\n\t */\n\tpublic static setRedirects(\n\t\tredirects: {\n\t\t\tfrom: RegExp;\n\t\t\tto: string;\n\t\t}[]\n\t): void {\n\t\tSharedStore.set(\"jsonLdRedirects\", redirects);\n\t}\n\n\t/**\n\t * Get the global redirects for JSON-LD.\n\t * @returns The registered redirects.\n\t */\n\tpublic static getRedirects(): {\n\t\tfrom: RegExp;\n\t\tto: string;\n\t}[] {\n\t\tlet redirects = SharedStore.get<\n\t\t\t{\n\t\t\t\tfrom: RegExp;\n\t\t\t\tto: string;\n\t\t\t}[]\n\t\t>(\"jsonLdRedirects\");\n\t\tif (Is.empty(redirects)) {\n\t\t\tredirects = [];\n\t\t\tSharedStore.set(\"jsonLdRedirects\", redirects);\n\t\t}\n\t\treturn redirects;\n\t}\n\n\t/**\n\t * Append a redirect rule (ignored if the same `RegExp.source` is already registered).\n\t * Optional when the vocabulary URL supports HTTP `Link` discovery (`rel` includes `alternate`, `type` is `application/ld+json`) via the default document loader.\n\t * Standards packages often expose `registerRedirects()` helpers that call this method; those are optional for the same reason.\n\t * @param from The URL to redirect from.\n\t * @param to The URL to redirect to.\n\t */\n\tpublic static addRedirect(from: RegExp, to: string): void {\n\t\tconst redirects = JsonLdProcessor.getRedirects();\n\t\tif (!redirects.some(r => r.from.source === from.source)) {\n\t\t\tredirects.push({ from, to });\n\t\t}\n\t}\n\n\t/**\n\t * Compact a document according to a particular context.\n\t * @param document The JSON-LD document to compact.\n\t * @param context The context to compact the document to, if not provided will use the one in the document.\n\t * @param options The options for compacting the document.\n\t * @param options.itemListOverride Whether to override the itemListElement context with a set, defaults to true.\n\t * @returns The compacted JSON-LD document.\n\t */\n\tpublic static async compact<T>(\n\t\tdocument: T,\n\t\tcontext?: IJsonLdContextDefinitionRoot,\n\t\toptions?: { itemListOverride: boolean }\n\t): Promise<T> {\n\t\ttry {\n\t\t\tif (Is.object<IJsonLdNodeObject>(document)) {\n\t\t\t\t// If the user didn't provide a context, use the one from the document\n\t\t\t\tif (Is.empty(context) && !Is.empty(document[\"@context\"])) {\n\t\t\t\t\tcontext = document[\"@context\"];\n\t\t\t\t}\n\n\t\t\t\tconst overrideListElementOption = options?.itemListOverride ?? true;\n\t\t\t\tlet overrideContext: IJsonLdContextDefinitionElement | undefined;\n\n\t\t\t\tif (overrideListElementOption) {\n\t\t\t\t\t// The compactArrays flag doesn't work with the current version of jsonld.js\n\t\t\t\t\t// For list results we standardise on ItemList and itemListElement\n\t\t\t\t\t// so we modify the schema.org type for itemListElement to be a set which bypasses the issue\n\t\t\t\t\t// https://github.com/digitalbazaar/jsonld.js/issues/247\n\t\t\t\t\toverrideContext = {\n\t\t\t\t\t\titemListElement: {\n\t\t\t\t\t\t\t\"@id\": \"http://schema.org/itemListElement\",\n\t\t\t\t\t\t\t\"@container\": \"@set\",\n\t\t\t\t\t\t\t\"@protected\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tif (Is.object(context) && \"@context\" in context) {\n\t\t\t\t\t\t// If the context is an object, we need to merge it with the override context\n\t\t\t\t\t\tcontext = JsonLdProcessor.combineContexts(\n\t\t\t\t\t\t\tcontext[\"@context\"] as IJsonLdContextDefinitionRoot,\n\t\t\t\t\t\t\toverrideContext\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If the context is a string or an array, we need to merge it with the override context\n\t\t\t\t\t\tcontext = JsonLdProcessor.combineContexts(context, overrideContext);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst compacted = await jsonLd.compact(\n\t\t\t\t\tObjectHelper.removeEmptyProperties(document),\n\t\t\t\t\tcontext as IJsonLdContextDefinition,\n\t\t\t\t\t{\n\t\t\t\t\t\tdocumentLoader: JsonLdProcessor.getDocumentLoader()\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tif (!Is.empty(overrideContext)) {\n\t\t\t\t\t// Remove the override context from the compacted document\n\t\t\t\t\tcompacted[\"@context\"] = JsonLdProcessor.removeContexts(compacted[\"@context\"], [\n\t\t\t\t\t\toverrideContext\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\treturn compacted as T;\n\t\t\t}\n\t\t\treturn document;\n\t\t} catch (err) {\n\t\t\tJsonLdProcessor.handleCommonErrors(err);\n\n\t\t\tthrow new GeneralError(JsonLdProcessor.CLASS_NAME, \"compact\", undefined, err);\n\t\t}\n\t}\n\n\t/**\n\t * Expand a document, removing its context.\n\t * @param compacted The compacted JSON-LD document to expand.\n\t * @returns The expanded JSON-LD document.\n\t */\n\tpublic static async expand<T>(compacted: T): Promise<IJsonLdNodeObject[]> {\n\t\ttry {\n\t\t\tif (Is.object<IJsonLdNodeObject>(compacted)) {\n\t\t\t\tconst expanded = await jsonLd.expand(ObjectHelper.removeEmptyProperties(compacted), {\n\t\t\t\t\tdocumentLoader: JsonLdProcessor.getDocumentLoader()\n\t\t\t\t});\n\t\t\t\treturn expanded;\n\t\t\t}\n\t\t\treturn [];\n\t\t} catch (err) {\n\t\t\tJsonLdProcessor.handleCommonErrors(err);\n\n\t\t\tthrow new GeneralError(JsonLdProcessor.CLASS_NAME, \"expand\", undefined, err);\n\t\t}\n\t}\n\n\t/**\n\t * Canonize a document.\n\t * @param document The document to canonize.\n\t * @param options The options for canonization.\n\t * @param options.algorithm The algorithm to use for canonization, defaults to URDNA2015.\n\t * @returns The canonized document.\n\t */\n\tpublic static async canonize<T extends IJsonLdNodeObject>(\n\t\tdocument: T,\n\t\toptions?: {\n\t\t\talgorithm?: \"URDNA2015\" | \"URGNA2012\" | undefined;\n\t\t}\n\t): Promise<string> {\n\t\ttry {\n\t\t\tconst normalized = await jsonLd.canonize(ObjectHelper.removeEmptyProperties(document), {\n\t\t\t\talgorithm: options?.algorithm ?? \"URDNA2015\",\n\t\t\t\tformat: \"application/n-quads\",\n\t\t\t\tdocumentLoader: JsonLdProcessor.getDocumentLoader()\n\t\t\t});\n\t\t\treturn normalized;\n\t\t} catch (err) {\n\t\t\tJsonLdProcessor.handleCommonErrors(err);\n\n\t\t\tthrow new GeneralError(JsonLdProcessor.CLASS_NAME, \"canonize\", undefined, err);\n\t\t}\n\t}\n\n\t/**\n\t * Combine contexts.\n\t * @param context1 The first JSON-LD context to combine.\n\t * @param context2 The second JSON-LD context to combine.\n\t * @returns The combined context.\n\t */\n\tpublic static combineContexts(\n\t\tcontext1: IJsonLdContextDefinitionRoot | undefined,\n\t\tcontext2: IJsonLdContextDefinitionRoot | undefined\n\t): IJsonLdContextDefinitionRoot | undefined {\n\t\tconst combinedContext: IJsonLdContextDefinitionRoot = [];\n\n\t\tif (Is.string(context1)) {\n\t\t\tif (!combinedContext.includes(context1)) {\n\t\t\t\tcombinedContext.push(context1);\n\t\t\t}\n\t\t} else if (Is.array(context1)) {\n\t\t\tfor (const context of context1) {\n\t\t\t\tconst hasMatch = combinedContext.some(c => ObjectHelper.equal(c, context));\n\t\t\t\tif (!hasMatch) {\n\t\t\t\t\tcombinedContext.push(context);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (Is.object(context1)) {\n\t\t\tconst hasMatch = combinedContext.some(c => ObjectHelper.equal(c, context1));\n\t\t\tif (!hasMatch) {\n\t\t\t\tcombinedContext.push(context1);\n\t\t\t}\n\t\t}\n\n\t\tif (Is.string(context2)) {\n\t\t\tif (!combinedContext.includes(context2)) {\n\t\t\t\tcombinedContext.push(context2);\n\t\t\t}\n\t\t} else if (Is.array(context2)) {\n\t\t\tfor (const context of context2) {\n\t\t\t\tconst hasMatch = combinedContext.some(c => ObjectHelper.equal(c, context));\n\t\t\t\tif (!hasMatch) {\n\t\t\t\t\tcombinedContext.push(context);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (Is.object(context2)) {\n\t\t\tconst hasMatch = combinedContext.some(c => ObjectHelper.equal(c, context2));\n\t\t\tif (!hasMatch) {\n\t\t\t\tcombinedContext.push(context2);\n\t\t\t}\n\t\t}\n\n\t\tif (combinedContext.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif (combinedContext.length === 1) {\n\t\t\treturn combinedContext[0];\n\t\t}\n\n\t\treturn combinedContext;\n\t}\n\n\t/**\n\t * Gather all the contexts from the element and it's children.\n\t * @param element The element to gather the contexts from.\n\t * @param initial The initial context.\n\t * @returns The combined contexts.\n\t */\n\tpublic static gatherContexts<T>(\n\t\telement: T,\n\t\tinitial?: IJsonLdContextDefinitionRoot\n\t): IJsonLdContextDefinitionRoot | undefined {\n\t\tlet combinedContexts: IJsonLdContextDefinitionRoot | undefined = initial;\n\n\t\tif (Is.object<IJsonLdNodeObject>(element)) {\n\t\t\tif (!Is.empty(element[\"@context\"])) {\n\t\t\t\tcombinedContexts = JsonLdProcessor.combineContexts(initial, element[\"@context\"]);\n\t\t\t}\n\n\t\t\tfor (const prop of Object.keys(element)) {\n\t\t\t\tconst value = element[prop];\n\t\t\t\tif (Is.object(value)) {\n\t\t\t\t\tcombinedContexts = JsonLdProcessor.gatherContexts(\n\t\t\t\t\t\tvalue as IJsonLdNodeObject,\n\t\t\t\t\t\tcombinedContexts\n\t\t\t\t\t);\n\t\t\t\t} else if (Is.array(value)) {\n\t\t\t\t\tfor (const item of value) {\n\t\t\t\t\t\tif (Is.object(item)) {\n\t\t\t\t\t\t\tcombinedContexts = JsonLdProcessor.gatherContexts(\n\t\t\t\t\t\t\t\titem as IJsonLdNodeObject,\n\t\t\t\t\t\t\t\tcombinedContexts\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn combinedContexts;\n\t}\n\n\t/**\n\t * Remove all the contexts that match the pattern.\n\t * @param context The context to remove the entries from.\n\t * @param match The element to try and match.\n\t * @returns The updated contexts.\n\t */\n\tpublic static removeContexts(\n\t\tcontext: IJsonLdContextDefinitionRoot | undefined,\n\t\tmatch?: IJsonLdContextDefinitionElement[]\n\t): IJsonLdContextDefinitionRoot | undefined {\n\t\tif (!Is.arrayValue(match)) {\n\t\t\treturn context;\n\t\t}\n\n\t\tlet finalContext: IJsonLdContextDefinitionRoot | undefined;\n\t\tif (Is.string(context)) {\n\t\t\tfor (const m of match) {\n\t\t\t\tif (context === m) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (Is.array(context)) {\n\t\t\tfor (const item of context) {\n\t\t\t\tconst hasMatch = match.some(m => ObjectHelper.equal(m, item));\n\t\t\t\tif (!hasMatch) {\n\t\t\t\t\tfinalContext ??= [];\n\t\t\t\t\tif (Is.array(finalContext)) {\n\t\t\t\t\t\tfinalContext.push(item);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (Is.object(context)) {\n\t\t\tconst hasMatch = match.some(m => ObjectHelper.equal(m, context));\n\t\t\tif (!hasMatch) {\n\t\t\t\tfinalContext = context;\n\t\t\t}\n\t\t}\n\n\t\treturn Is.arrayValue(finalContext) && finalContext.length === 1\n\t\t\t? finalContext[0]\n\t\t\t: finalContext;\n\t}\n\n\t/**\n\t * Add a context directly to the document loader cache.\n\t * @param url The url the ld context is for.\n\t * @param ldContext The context to add.\n\t * @returns Nothing.\n\t */\n\tpublic static async documentCacheAdd(url: string, ldContext: unknown): Promise<void> {\n\t\tawait FetchHelper.setCacheEntry(url, ldContext);\n\t}\n\n\t/**\n\t * Remove a context from the document loader cache.\n\t * @param url The url the ld context is for.\n\t * @returns Nothing.\n\t */\n\tpublic static async documentCacheRemove(url: string): Promise<void> {\n\t\tFetchHelper.removeCacheEntry(url);\n\t}\n\n\t/**\n\t * Document loader which uses a caching mechanism.\n\t * @param url The document url to load.\n\t * @returns The document.\n\t * @internal\n\t */\n\tprivate static async documentLoader(url: Url): Promise<RemoteDocument> {\n\t\tconst redirects = JsonLdProcessor.getRedirects();\n\t\tfor (const redirect of redirects) {\n\t\t\tif (redirect.from.test(url)) {\n\t\t\t\turl = redirect.to;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn JsonLdProcessor.fetchRemoteJsonLdDocument(url, 0);\n\t}\n\n\t/**\n\t * True when FetchHelper failed to decode JSON from the response (e.g. HTML or plain text).\n\t * @param err The error from fetchJson.\n\t * @internal\n\t */\n\tprivate static isFetchJsonDecodeFailure(err: unknown): boolean {\n\t\t// Raw JSON.parse / response.json() failures (FetchHelper may rethrow as FetchError with cause,\n\t\t// or propagate SyntaxError when error-response body is not JSON).\n\t\tconst error = BaseError.fromError(err);\n\t\tif (error.name === \"SyntaxError\" || error.cause?.name === \"SyntaxError\") {\n\t\t\treturn true;\n\t\t}\n\t\treturn error.message.includes(\"decodingJSON\") || error.message.includes(\"is not valid JSON\");\n\t}\n\n\t/**\n\t * Use HTTP Link (rel=alternate, type=application/ld+json) to discover a JSON-LD context URL.\n\t * @param sourceUrl URL that did not yield JSON (e.g. vocabulary namespace HTML page).\n\t * @returns Absolute context document URL, or undefined.\n\t * @internal\n\t */\n\tprivate static async tryDiscoverAlternateJsonLdContextUrl(\n\t\tsourceUrl: string\n\t): Promise<string | undefined> {\n\t\tconst fetchOpts = {\n\t\t\ttimeoutMs: 30_000,\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: `${MimeTypes.JsonLd},${MimeTypes.Json};q=0.9,*/*;q=0.8`\n\t\t\t}\n\t\t};\n\n\t\tlet response = await FetchHelper.fetch(\n\t\t\tJsonLdProcessor.CLASS_NAME,\n\t\t\tsourceUrl,\n\t\t\tHttpMethod.HEAD,\n\t\t\tundefined,\n\t\t\tfetchOpts\n\t\t);\n\n\t\tif (\n\t\t\tresponse.status === HttpStatusCode.methodNotAllowed ||\n\t\t\tresponse.status === HttpStatusCode.notImplemented\n\t\t) {\n\t\t\tresponse = await FetchHelper.fetch(\n\t\t\t\tJsonLdProcessor.CLASS_NAME,\n\t\t\t\tsourceUrl,\n\t\t\t\tHttpMethod.GET,\n\t\t\t\tundefined,\n\t\t\t\tfetchOpts\n\t\t\t);\n\t\t\tawait response.arrayBuffer();\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst linkHeader = response.headers.get(HeaderTypes.Link);\n\t\tif (Is.empty(linkHeader)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// response.url is \"\" for many mocked/synthetic Responses; Is.empty(\"\") is false, but\n\t\t// new URL(absoluteHref, \"\") throws — use a non-empty resolved URL as base only.\n\t\tconst baseUrl = Is.stringValue(response.url) ? response.url : sourceUrl;\n\n\t\tconst alternateLinkHeaders = HeaderHelper.extractLinkHeaderRelations(\n\t\t\tlinkHeader,\n\t\t\tHttpLinkRelType.alternate\n\t\t);\n\n\t\tif (Is.arrayValue(alternateLinkHeaders)) {\n\t\t\tfor (const alternateLinkHeader of alternateLinkHeaders) {\n\t\t\t\tif (alternateLinkHeader.params?.type === MimeTypes.JsonLd) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn new URL(alternateLinkHeader.url, baseUrl).href;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Malformed URL for this segment; try the next Link segment.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Fetch a remote JSON-LD document, with Accept fallbacks and optional Link-header discovery.\n\t * @param url Resolved document URL.\n\t * @param linkDiscoveryDepth Current discovery recursion depth.\n\t * @internal\n\t */\n\tprivate static async fetchRemoteJsonLdDocument(\n\t\turl: string,\n\t\tlinkDiscoveryDepth: number\n\t): Promise<RemoteDocument> {\n\t\tconst cacheTtlMs = JsonLdProcessor.getCacheLimit();\n\t\tconst fetchJsonLdOptions = {\n\t\t\tcacheTtlMs,\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t}\n\t\t};\n\t\tconst fetchJsonOptions = {\n\t\t\tcacheTtlMs,\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: MimeTypes.Json\n\t\t\t}\n\t\t};\n\n\t\ttry {\n\t\t\tconst document = await FetchHelper.fetchJson<never, JsonLd>(\n\t\t\t\tJsonLdProcessor.CLASS_NAME,\n\t\t\t\turl,\n\t\t\t\tHttpMethod.GET,\n\t\t\t\tundefined,\n\t\t\t\tfetchJsonLdOptions\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tdocumentUrl: url,\n\t\t\t\tdocument\n\t\t\t};\n\t\t} catch (errLd) {\n\t\t\tif (JsonLdProcessor.isFetchJsonDecodeFailure(errLd)) {\n\t\t\t\ttry {\n\t\t\t\t\tconst document = await FetchHelper.fetchJson<never, JsonLd>(\n\t\t\t\t\t\tJsonLdProcessor.CLASS_NAME,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\tHttpMethod.GET,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tfetchJsonOptions\n\t\t\t\t\t);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdocumentUrl: url,\n\t\t\t\t\t\tdocument\n\t\t\t\t\t};\n\t\t\t\t} catch (errJson) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tlinkDiscoveryDepth < JsonLdProcessor._MAX_LINK_DISCOVERY_DEPTH &&\n\t\t\t\t\t\tJsonLdProcessor.isFetchJsonDecodeFailure(errJson)\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst discovered = await JsonLdProcessor.tryDiscoverAlternateJsonLdContextUrl(url);\n\t\t\t\t\t\tif (Is.stringValue(discovered) && discovered !== url) {\n\t\t\t\t\t\t\treturn JsonLdProcessor.fetchRemoteJsonLdDocument(discovered, linkDiscoveryDepth + 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthrow errJson;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow errLd;\n\t\t}\n\t}\n\n\t/**\n\t * Handle common errors.\n\t * @param err The error to handle.\n\t * @internal\n\t */\n\tprivate static handleCommonErrors(err: unknown): void {\n\t\tif (\n\t\t\tIs.object<{ name: string; details?: { url?: string } }>(err) &&\n\t\t\terr.name === \"jsonld.InvalidUrl\"\n\t\t) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tJsonLdProcessor.CLASS_NAME,\n\t\t\t\t\"invalidUrl\",\n\t\t\t\t{ url: err.details?.url },\n\t\t\t\terr\n\t\t\t);\n\t\t} else if (\n\t\t\tIs.object<{ name: string; details?: { code: string } & { [id: string]: unknown } }>(err) &&\n\t\t\terr.name.startsWith(\"jsonld.\")\n\t\t) {\n\t\t\tconst { code, ...other } = err.details ?? {};\n\t\t\tthrow new GeneralError(JsonLdProcessor.CLASS_NAME, \"jsonLdError\", { code, ...other }, err);\n\t\t}\n\t}\n}\n"]}
|
package/docs/changelog.md
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.0.3-next.
|
|
3
|
+
## [0.0.3-next.21](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.20...data-json-ld-v0.0.3-next.21) (2026-05-11)
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
### Features
|
|
7
7
|
|
|
8
|
-
*
|
|
8
|
+
* typescript 6 update ([44cbfe8](https://github.com/iotaledger/twin-data/commit/44cbfe87256282b9928134b2bbed1d3c6ee15acb))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/data-core bumped from 0.0.3-next.20 to 0.0.3-next.21
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.20](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.19...data-json-ld-v0.0.3-next.20) (2026-03-24)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* discover JSON-LD context via HTTP Link ([#62](https://github.com/iotaledger/twin-data/issues/62)) ([5545864](https://github.com/iotaledger/twin-data/commit/5545864c08e8c42fb93844f552907648a1130b64))
|
|
9
23
|
|
|
10
24
|
|
|
11
25
|
### Dependencies
|
|
@@ -14,7 +28,7 @@
|
|
|
14
28
|
* dependencies
|
|
15
29
|
* @twin.org/data-core bumped from 0.0.3-next.19 to 0.0.3-next.20
|
|
16
30
|
|
|
17
|
-
## [0.0.3-next.20](https://github.com/
|
|
31
|
+
## [0.0.3-next.20](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.19...data-json-ld-v0.0.3-next.20) (2026-03-23)
|
|
18
32
|
|
|
19
33
|
|
|
20
34
|
### Features
|
|
@@ -34,12 +48,12 @@
|
|
|
34
48
|
* Share schema.org fixture document-cache seeding via `tests/helpers/schemaOrgDocumentCache.ts` (`jsonLdProcessor` / `jsonLdHelper` specs).
|
|
35
49
|
|
|
36
50
|
|
|
37
|
-
## [0.0.3-next.19](https://github.com/
|
|
51
|
+
## [0.0.3-next.19](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.18...data-json-ld-v0.0.3-next.19) (2026-03-20)
|
|
38
52
|
|
|
39
53
|
|
|
40
54
|
### Features
|
|
41
55
|
|
|
42
|
-
* use local LD context fixture in tests instead of remotes ([#60](https://github.com/
|
|
56
|
+
* use local LD context fixture in tests instead of remotes ([#60](https://github.com/iotaledger/twin-data/issues/60)) ([df18303](https://github.com/iotaledger/twin-data/commit/df18303301f031a5032850c900eea24b094a99a5))
|
|
43
57
|
|
|
44
58
|
|
|
45
59
|
### Dependencies
|
|
@@ -48,7 +62,7 @@
|
|
|
48
62
|
* dependencies
|
|
49
63
|
* @twin.org/data-core bumped from 0.0.3-next.18 to 0.0.3-next.19
|
|
50
64
|
|
|
51
|
-
## [0.0.3-next.18](https://github.com/
|
|
65
|
+
## [0.0.3-next.18](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.17...data-json-ld-v0.0.3-next.18) (2026-03-16)
|
|
52
66
|
|
|
53
67
|
|
|
54
68
|
### Miscellaneous Chores
|
|
@@ -62,7 +76,7 @@
|
|
|
62
76
|
* dependencies
|
|
63
77
|
* @twin.org/data-core bumped from 0.0.3-next.17 to 0.0.3-next.18
|
|
64
78
|
|
|
65
|
-
## [0.0.3-next.17](https://github.com/
|
|
79
|
+
## [0.0.3-next.17](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.16...data-json-ld-v0.0.3-next.17) (2026-03-12)
|
|
66
80
|
|
|
67
81
|
|
|
68
82
|
### Miscellaneous Chores
|
|
@@ -76,12 +90,12 @@
|
|
|
76
90
|
* dependencies
|
|
77
91
|
* @twin.org/data-core bumped from 0.0.3-next.16 to 0.0.3-next.17
|
|
78
92
|
|
|
79
|
-
## [0.0.3-next.16](https://github.com/
|
|
93
|
+
## [0.0.3-next.16](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.15...data-json-ld-v0.0.3-next.16) (2026-03-06)
|
|
80
94
|
|
|
81
95
|
|
|
82
96
|
### Features
|
|
83
97
|
|
|
84
|
-
* additional JSON-LD helper types ([575627c](https://github.com/
|
|
98
|
+
* additional JSON-LD helper types ([575627c](https://github.com/iotaledger/twin-data/commit/575627c707e691086e07163dac44ba1396ac322e))
|
|
85
99
|
|
|
86
100
|
|
|
87
101
|
### Dependencies
|
|
@@ -90,12 +104,12 @@
|
|
|
90
104
|
* dependencies
|
|
91
105
|
* @twin.org/data-core bumped from 0.0.3-next.15 to 0.0.3-next.16
|
|
92
106
|
|
|
93
|
-
## [0.0.3-next.15](https://github.com/
|
|
107
|
+
## [0.0.3-next.15](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.14...data-json-ld-v0.0.3-next.15) (2026-02-27)
|
|
94
108
|
|
|
95
109
|
|
|
96
110
|
### Features
|
|
97
111
|
|
|
98
|
-
* additional json-ld helpers ([c74cbd6](https://github.com/
|
|
112
|
+
* additional json-ld helpers ([c74cbd6](https://github.com/iotaledger/twin-data/commit/c74cbd60e423c5f780243da9868723e9d54d068a))
|
|
99
113
|
|
|
100
114
|
|
|
101
115
|
### Dependencies
|
|
@@ -104,12 +118,12 @@
|
|
|
104
118
|
* dependencies
|
|
105
119
|
* @twin.org/data-core bumped from 0.0.3-next.14 to 0.0.3-next.15
|
|
106
120
|
|
|
107
|
-
## [0.0.3-next.14](https://github.com/
|
|
121
|
+
## [0.0.3-next.14](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.13...data-json-ld-v0.0.3-next.14) (2026-02-25)
|
|
108
122
|
|
|
109
123
|
|
|
110
124
|
### Features
|
|
111
125
|
|
|
112
|
-
* update schemas ([c30159c](https://github.com/
|
|
126
|
+
* update schemas ([c30159c](https://github.com/iotaledger/twin-data/commit/c30159cd24e5f60f9124752738dd1c0312ee17dd))
|
|
113
127
|
|
|
114
128
|
|
|
115
129
|
### Dependencies
|
|
@@ -118,12 +132,12 @@
|
|
|
118
132
|
* dependencies
|
|
119
133
|
* @twin.org/data-core bumped from 0.0.3-next.13 to 0.0.3-next.14
|
|
120
134
|
|
|
121
|
-
## [0.0.3-next.13](https://github.com/
|
|
135
|
+
## [0.0.3-next.13](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.12...data-json-ld-v0.0.3-next.13) (2026-02-25)
|
|
122
136
|
|
|
123
137
|
|
|
124
138
|
### Features
|
|
125
139
|
|
|
126
|
-
* publish npm await ([7bdf0cd](https://github.com/
|
|
140
|
+
* publish npm await ([7bdf0cd](https://github.com/iotaledger/twin-data/commit/7bdf0cd5d9417e7f8811f295ccf3ab3403ae3753))
|
|
127
141
|
|
|
128
142
|
|
|
129
143
|
### Dependencies
|
|
@@ -132,12 +146,12 @@
|
|
|
132
146
|
* dependencies
|
|
133
147
|
* @twin.org/data-core bumped from 0.0.3-next.12 to 0.0.3-next.13
|
|
134
148
|
|
|
135
|
-
## [0.0.3-next.12](https://github.com/
|
|
149
|
+
## [0.0.3-next.12](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.11...data-json-ld-v0.0.3-next.12) (2026-02-25)
|
|
136
150
|
|
|
137
151
|
|
|
138
152
|
### Features
|
|
139
153
|
|
|
140
|
-
* add toStructuredObject ([58354e0](https://github.com/
|
|
154
|
+
* add toStructuredObject ([58354e0](https://github.com/iotaledger/twin-data/commit/58354e0096c917f2e2e64214107d68326c79260d))
|
|
141
155
|
|
|
142
156
|
|
|
143
157
|
### Dependencies
|
|
@@ -146,12 +160,12 @@
|
|
|
146
160
|
* dependencies
|
|
147
161
|
* @twin.org/data-core bumped from 0.0.3-next.11 to 0.0.3-next.12
|
|
148
162
|
|
|
149
|
-
## [0.0.3-next.11](https://github.com/
|
|
163
|
+
## [0.0.3-next.11](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.10...data-json-ld-v0.0.3-next.11) (2026-02-25)
|
|
150
164
|
|
|
151
165
|
|
|
152
166
|
### Features
|
|
153
167
|
|
|
154
|
-
* expand JsonLdHelper.getId with custom properties names ([8ec4dcf](https://github.com/
|
|
168
|
+
* expand JsonLdHelper.getId with custom properties names ([8ec4dcf](https://github.com/iotaledger/twin-data/commit/8ec4dcf807a6dc416b2df2a77749f841a60be05f))
|
|
155
169
|
|
|
156
170
|
|
|
157
171
|
### Dependencies
|
|
@@ -160,12 +174,12 @@
|
|
|
160
174
|
* dependencies
|
|
161
175
|
* @twin.org/data-core bumped from 0.0.3-next.10 to 0.0.3-next.11
|
|
162
176
|
|
|
163
|
-
## [0.0.3-next.10](https://github.com/
|
|
177
|
+
## [0.0.3-next.10](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.9...data-json-ld-v0.0.3-next.10) (2026-02-24)
|
|
164
178
|
|
|
165
179
|
|
|
166
180
|
### Features
|
|
167
181
|
|
|
168
|
-
* add json ld helper types ([#46](https://github.com/
|
|
182
|
+
* add json ld helper types ([#46](https://github.com/iotaledger/twin-data/issues/46)) ([22e998e](https://github.com/iotaledger/twin-data/commit/22e998e29e7eadc9202026ee9743d64ed98035df))
|
|
169
183
|
|
|
170
184
|
|
|
171
185
|
### Dependencies
|
|
@@ -174,12 +188,12 @@
|
|
|
174
188
|
* dependencies
|
|
175
189
|
* @twin.org/data-core bumped from 0.0.3-next.9 to 0.0.3-next.10
|
|
176
190
|
|
|
177
|
-
## [0.0.3-next.9](https://github.com/
|
|
191
|
+
## [0.0.3-next.9](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.8...data-json-ld-v0.0.3-next.9) (2026-02-23)
|
|
178
192
|
|
|
179
193
|
|
|
180
194
|
### Features
|
|
181
195
|
|
|
182
|
-
* additional JsonLdHelper methods ([#44](https://github.com/
|
|
196
|
+
* additional JsonLdHelper methods ([#44](https://github.com/iotaledger/twin-data/issues/44)) ([ebe2cf5](https://github.com/iotaledger/twin-data/commit/ebe2cf50d1a7fbe0474f0a556d49f43eb7767a2f))
|
|
183
197
|
|
|
184
198
|
|
|
185
199
|
### Dependencies
|
|
@@ -188,7 +202,7 @@
|
|
|
188
202
|
* dependencies
|
|
189
203
|
* @twin.org/data-core bumped from 0.0.3-next.8 to 0.0.3-next.9
|
|
190
204
|
|
|
191
|
-
## [0.0.3-next.8](https://github.com/
|
|
205
|
+
## [0.0.3-next.8](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.7...data-json-ld-v0.0.3-next.8) (2026-02-02)
|
|
192
206
|
|
|
193
207
|
|
|
194
208
|
### Miscellaneous Chores
|
|
@@ -202,12 +216,12 @@
|
|
|
202
216
|
* dependencies
|
|
203
217
|
* @twin.org/data-core bumped from 0.0.3-next.7 to 0.0.3-next.8
|
|
204
218
|
|
|
205
|
-
## [0.0.3-next.7](https://github.com/
|
|
219
|
+
## [0.0.3-next.7](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.6...data-json-ld-v0.0.3-next.7) (2026-01-21)
|
|
206
220
|
|
|
207
221
|
|
|
208
222
|
### Features
|
|
209
223
|
|
|
210
|
-
* update context naming ([#37](https://github.com/
|
|
224
|
+
* update context naming ([#37](https://github.com/iotaledger/twin-data/issues/37)) ([9d99360](https://github.com/iotaledger/twin-data/commit/9d993605aa51f27a09722729057c6ee921617c2d))
|
|
211
225
|
|
|
212
226
|
|
|
213
227
|
### Dependencies
|
|
@@ -216,7 +230,7 @@
|
|
|
216
230
|
* dependencies
|
|
217
231
|
* @twin.org/data-core bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
218
232
|
|
|
219
|
-
## [0.0.3-next.6](https://github.com/
|
|
233
|
+
## [0.0.3-next.6](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.5...data-json-ld-v0.0.3-next.6) (2026-01-14)
|
|
220
234
|
|
|
221
235
|
|
|
222
236
|
### Miscellaneous Chores
|
|
@@ -230,12 +244,12 @@
|
|
|
230
244
|
* dependencies
|
|
231
245
|
* @twin.org/data-core bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
232
246
|
|
|
233
|
-
## [0.0.3-next.5](https://github.com/
|
|
247
|
+
## [0.0.3-next.5](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.4...data-json-ld-v0.0.3-next.5) (2026-01-14)
|
|
234
248
|
|
|
235
249
|
|
|
236
250
|
### Features
|
|
237
251
|
|
|
238
|
-
* improve data type registration ([#34](https://github.com/
|
|
252
|
+
* improve data type registration ([#34](https://github.com/iotaledger/twin-data/issues/34)) ([855d110](https://github.com/iotaledger/twin-data/commit/855d11046a4d85317b77a5c4e0f4a7b1b6d1a767))
|
|
239
253
|
|
|
240
254
|
|
|
241
255
|
### Dependencies
|
|
@@ -244,7 +258,7 @@
|
|
|
244
258
|
* dependencies
|
|
245
259
|
* @twin.org/data-core bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
246
260
|
|
|
247
|
-
## [0.0.3-next.4](https://github.com/
|
|
261
|
+
## [0.0.3-next.4](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.3...data-json-ld-v0.0.3-next.4) (2026-01-06)
|
|
248
262
|
|
|
249
263
|
|
|
250
264
|
### Miscellaneous Chores
|
|
@@ -258,12 +272,12 @@
|
|
|
258
272
|
* dependencies
|
|
259
273
|
* @twin.org/data-core bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
260
274
|
|
|
261
|
-
## [0.0.3-next.3](https://github.com/
|
|
275
|
+
## [0.0.3-next.3](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.2...data-json-ld-v0.0.3-next.3) (2026-01-05)
|
|
262
276
|
|
|
263
277
|
|
|
264
278
|
### Features
|
|
265
279
|
|
|
266
|
-
* add JsonLdHelper.toNodeObject method ([93f2add](https://github.com/
|
|
280
|
+
* add JsonLdHelper.toNodeObject method ([93f2add](https://github.com/iotaledger/twin-data/commit/93f2add1948f168d7a21223929cf6c65a8115f6f))
|
|
267
281
|
|
|
268
282
|
|
|
269
283
|
### Dependencies
|
|
@@ -272,17 +286,17 @@
|
|
|
272
286
|
* dependencies
|
|
273
287
|
* @twin.org/data-core bumped from 0.0.3-next.2 to 0.0.3-next.3
|
|
274
288
|
|
|
275
|
-
## [0.0.3-next.2](https://github.com/
|
|
289
|
+
## [0.0.3-next.2](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.1...data-json-ld-v0.0.3-next.2) (2025-11-24)
|
|
276
290
|
|
|
277
291
|
|
|
278
292
|
### Features
|
|
279
293
|
|
|
280
|
-
* add JsonLdHelper getId and getType ([4b43e41](https://github.com/
|
|
294
|
+
* add JsonLdHelper getId and getType ([4b43e41](https://github.com/iotaledger/twin-data/commit/4b43e41fa47a16a19d2c759f5e40a1fb51e0a128))
|
|
281
295
|
|
|
282
296
|
|
|
283
297
|
### Bug Fixes
|
|
284
298
|
|
|
285
|
-
* add redirect remove duplicates ([49709e0](https://github.com/
|
|
299
|
+
* add redirect remove duplicates ([49709e0](https://github.com/iotaledger/twin-data/commit/49709e04cf087e216f4c9e36a9f35daceeae98fd))
|
|
286
300
|
|
|
287
301
|
|
|
288
302
|
### Dependencies
|
|
@@ -291,29 +305,29 @@
|
|
|
291
305
|
* dependencies
|
|
292
306
|
* @twin.org/data-core bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
293
307
|
|
|
294
|
-
## [0.0.3-next.1](https://github.com/
|
|
308
|
+
## [0.0.3-next.1](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.3-next.0...data-json-ld-v0.0.3-next.1) (2025-11-10)
|
|
295
309
|
|
|
296
310
|
|
|
297
311
|
### Features
|
|
298
312
|
|
|
299
|
-
* add context id features ([#25](https://github.com/
|
|
300
|
-
* add document cache access methods ([dbf1e36](https://github.com/
|
|
301
|
-
* add fail on missing type option and both mode ([e8b9702](https://github.com/
|
|
302
|
-
* add validate-locales ([cf9b761](https://github.com/
|
|
303
|
-
* eslint migration to flat config ([b0db6e6](https://github.com/
|
|
304
|
-
* expand Json LD Keyword ([70632d1](https://github.com/
|
|
305
|
-
* support multiple type JSON-LD ([8f0d530](https://github.com/
|
|
306
|
-
* update framework core ([c077b8c](https://github.com/
|
|
307
|
-
* update ts-to-schema ([8c3cd91](https://github.com/
|
|
308
|
-
* use fully qualified names for data type lookups ([b7b5c74](https://github.com/
|
|
309
|
-
* use shared store mechanism ([#3](https://github.com/
|
|
310
|
-
* use updated Is.function ([46a4715](https://github.com/
|
|
311
|
-
* use updated JSON schema specs ([465223a](https://github.com/
|
|
313
|
+
* add context id features ([#25](https://github.com/iotaledger/twin-data/issues/25)) ([6592f2e](https://github.com/iotaledger/twin-data/commit/6592f2e4e59021cc42a079a4f46242758a54313d))
|
|
314
|
+
* add document cache access methods ([dbf1e36](https://github.com/iotaledger/twin-data/commit/dbf1e36d176c5f428f8c52628fb5a1ff7a6a174a))
|
|
315
|
+
* add fail on missing type option and both mode ([e8b9702](https://github.com/iotaledger/twin-data/commit/e8b97029a04b646497ff0e55b9610291e58ae92a))
|
|
316
|
+
* add validate-locales ([cf9b761](https://github.com/iotaledger/twin-data/commit/cf9b76160820fe0b13b4fe56ed241c1d5511b7c1))
|
|
317
|
+
* eslint migration to flat config ([b0db6e6](https://github.com/iotaledger/twin-data/commit/b0db6e69a90046fc60d29e4273fcdfee13c16088))
|
|
318
|
+
* expand Json LD Keyword ([70632d1](https://github.com/iotaledger/twin-data/commit/70632d1e11ad85cf3c57e118476b125a673f1681))
|
|
319
|
+
* support multiple type JSON-LD ([8f0d530](https://github.com/iotaledger/twin-data/commit/8f0d530f66302ab19413ecf968f170f97456e31e))
|
|
320
|
+
* update framework core ([c077b8c](https://github.com/iotaledger/twin-data/commit/c077b8c07e7ee66b5482254eab6f2a52cd911270))
|
|
321
|
+
* update ts-to-schema ([8c3cd91](https://github.com/iotaledger/twin-data/commit/8c3cd9131113f2d609f6e709562402e5c7766c1a))
|
|
322
|
+
* use fully qualified names for data type lookups ([b7b5c74](https://github.com/iotaledger/twin-data/commit/b7b5c746b0180a87baa976f6a7a76cedd53d8ff7))
|
|
323
|
+
* use shared store mechanism ([#3](https://github.com/iotaledger/twin-data/issues/3)) ([33eb221](https://github.com/iotaledger/twin-data/commit/33eb221ccec2b4a79549c06e9a04225009b93a46))
|
|
324
|
+
* use updated Is.function ([46a4715](https://github.com/iotaledger/twin-data/commit/46a4715f995aea34f2011138662fe003c9727d07))
|
|
325
|
+
* use updated JSON schema specs ([465223a](https://github.com/iotaledger/twin-data/commit/465223a9e9c24af546480ef084327a78fa366eaa))
|
|
312
326
|
|
|
313
327
|
|
|
314
328
|
### Bug Fixes
|
|
315
329
|
|
|
316
|
-
* itemListElement compaction override ([d908a10](https://github.com/
|
|
330
|
+
* itemListElement compaction override ([d908a10](https://github.com/iotaledger/twin-data/commit/d908a1043d7792e31b3101221d17850757b6c2a6))
|
|
317
331
|
|
|
318
332
|
|
|
319
333
|
### Dependencies
|
|
@@ -322,12 +336,12 @@
|
|
|
322
336
|
* dependencies
|
|
323
337
|
* @twin.org/data-core bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
324
338
|
|
|
325
|
-
## [0.0.2-next.4](https://github.com/
|
|
339
|
+
## [0.0.2-next.4](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.2-next.3...data-json-ld-v0.0.2-next.4) (2025-10-09)
|
|
326
340
|
|
|
327
341
|
|
|
328
342
|
### Features
|
|
329
343
|
|
|
330
|
-
* add validate-locales ([cf9b761](https://github.com/
|
|
344
|
+
* add validate-locales ([cf9b761](https://github.com/iotaledger/twin-data/commit/cf9b76160820fe0b13b4fe56ed241c1d5511b7c1))
|
|
331
345
|
|
|
332
346
|
|
|
333
347
|
### Dependencies
|
|
@@ -336,12 +350,12 @@
|
|
|
336
350
|
* dependencies
|
|
337
351
|
* @twin.org/data-core bumped from 0.0.2-next.3 to 0.0.2-next.4
|
|
338
352
|
|
|
339
|
-
## [0.0.2-next.3](https://github.com/
|
|
353
|
+
## [0.0.2-next.3](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.2-next.2...data-json-ld-v0.0.2-next.3) (2025-09-29)
|
|
340
354
|
|
|
341
355
|
|
|
342
356
|
### Features
|
|
343
357
|
|
|
344
|
-
* use updated Is.function ([46a4715](https://github.com/
|
|
358
|
+
* use updated Is.function ([46a4715](https://github.com/iotaledger/twin-data/commit/46a4715f995aea34f2011138662fe003c9727d07))
|
|
345
359
|
|
|
346
360
|
|
|
347
361
|
### Dependencies
|
|
@@ -350,12 +364,12 @@
|
|
|
350
364
|
* dependencies
|
|
351
365
|
* @twin.org/data-core bumped from 0.0.2-next.2 to 0.0.2-next.3
|
|
352
366
|
|
|
353
|
-
## [0.0.2-next.2](https://github.com/
|
|
367
|
+
## [0.0.2-next.2](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.2-next.1...data-json-ld-v0.0.2-next.2) (2025-08-29)
|
|
354
368
|
|
|
355
369
|
|
|
356
370
|
### Features
|
|
357
371
|
|
|
358
|
-
* eslint migration to flat config ([b0db6e6](https://github.com/
|
|
372
|
+
* eslint migration to flat config ([b0db6e6](https://github.com/iotaledger/twin-data/commit/b0db6e69a90046fc60d29e4273fcdfee13c16088))
|
|
359
373
|
|
|
360
374
|
|
|
361
375
|
### Dependencies
|
|
@@ -364,25 +378,25 @@
|
|
|
364
378
|
* dependencies
|
|
365
379
|
* @twin.org/data-core bumped from 0.0.2-next.1 to 0.0.2-next.2
|
|
366
380
|
|
|
367
|
-
## [0.0.2-next.1](https://github.com/
|
|
381
|
+
## [0.0.2-next.1](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.2-next.0...data-json-ld-v0.0.2-next.1) (2025-08-19)
|
|
368
382
|
|
|
369
383
|
|
|
370
384
|
### Features
|
|
371
385
|
|
|
372
|
-
* add document cache access methods ([dbf1e36](https://github.com/
|
|
373
|
-
* add fail on missing type option and both mode ([e8b9702](https://github.com/
|
|
374
|
-
* expand Json LD Keyword ([70632d1](https://github.com/
|
|
375
|
-
* support multiple type JSON-LD ([8f0d530](https://github.com/
|
|
376
|
-
* update framework core ([c077b8c](https://github.com/
|
|
377
|
-
* update ts-to-schema ([8c3cd91](https://github.com/
|
|
378
|
-
* use fully qualified names for data type lookups ([b7b5c74](https://github.com/
|
|
379
|
-
* use shared store mechanism ([#3](https://github.com/
|
|
380
|
-
* use updated JSON schema specs ([465223a](https://github.com/
|
|
386
|
+
* add document cache access methods ([dbf1e36](https://github.com/iotaledger/twin-data/commit/dbf1e36d176c5f428f8c52628fb5a1ff7a6a174a))
|
|
387
|
+
* add fail on missing type option and both mode ([e8b9702](https://github.com/iotaledger/twin-data/commit/e8b97029a04b646497ff0e55b9610291e58ae92a))
|
|
388
|
+
* expand Json LD Keyword ([70632d1](https://github.com/iotaledger/twin-data/commit/70632d1e11ad85cf3c57e118476b125a673f1681))
|
|
389
|
+
* support multiple type JSON-LD ([8f0d530](https://github.com/iotaledger/twin-data/commit/8f0d530f66302ab19413ecf968f170f97456e31e))
|
|
390
|
+
* update framework core ([c077b8c](https://github.com/iotaledger/twin-data/commit/c077b8c07e7ee66b5482254eab6f2a52cd911270))
|
|
391
|
+
* update ts-to-schema ([8c3cd91](https://github.com/iotaledger/twin-data/commit/8c3cd9131113f2d609f6e709562402e5c7766c1a))
|
|
392
|
+
* use fully qualified names for data type lookups ([b7b5c74](https://github.com/iotaledger/twin-data/commit/b7b5c746b0180a87baa976f6a7a76cedd53d8ff7))
|
|
393
|
+
* use shared store mechanism ([#3](https://github.com/iotaledger/twin-data/issues/3)) ([33eb221](https://github.com/iotaledger/twin-data/commit/33eb221ccec2b4a79549c06e9a04225009b93a46))
|
|
394
|
+
* use updated JSON schema specs ([465223a](https://github.com/iotaledger/twin-data/commit/465223a9e9c24af546480ef084327a78fa366eaa))
|
|
381
395
|
|
|
382
396
|
|
|
383
397
|
### Bug Fixes
|
|
384
398
|
|
|
385
|
-
* itemListElement compaction override ([d908a10](https://github.com/
|
|
399
|
+
* itemListElement compaction override ([d908a10](https://github.com/iotaledger/twin-data/commit/d908a1043d7792e31b3101221d17850757b6c2a6))
|
|
386
400
|
|
|
387
401
|
|
|
388
402
|
### Dependencies
|
|
@@ -396,26 +410,26 @@
|
|
|
396
410
|
|
|
397
411
|
### Features
|
|
398
412
|
|
|
399
|
-
* add document cache access methods ([dbf1e36](https://github.com/
|
|
400
|
-
* add fail on missing type option and both mode ([e8b9702](https://github.com/
|
|
401
|
-
* expand Json LD Keyword ([70632d1](https://github.com/
|
|
402
|
-
* support multiple type JSON-LD ([8f0d530](https://github.com/
|
|
403
|
-
* update ts-to-schema ([8c3cd91](https://github.com/
|
|
404
|
-
* use fully qualified names for data type lookups ([b7b5c74](https://github.com/
|
|
405
|
-
* use shared store mechanism ([#3](https://github.com/
|
|
406
|
-
* use updated JSON schema specs ([465223a](https://github.com/
|
|
413
|
+
* add document cache access methods ([dbf1e36](https://github.com/iotaledger/twin-data/commit/dbf1e36d176c5f428f8c52628fb5a1ff7a6a174a))
|
|
414
|
+
* add fail on missing type option and both mode ([e8b9702](https://github.com/iotaledger/twin-data/commit/e8b97029a04b646497ff0e55b9610291e58ae92a))
|
|
415
|
+
* expand Json LD Keyword ([70632d1](https://github.com/iotaledger/twin-data/commit/70632d1e11ad85cf3c57e118476b125a673f1681))
|
|
416
|
+
* support multiple type JSON-LD ([8f0d530](https://github.com/iotaledger/twin-data/commit/8f0d530f66302ab19413ecf968f170f97456e31e))
|
|
417
|
+
* update ts-to-schema ([8c3cd91](https://github.com/iotaledger/twin-data/commit/8c3cd9131113f2d609f6e709562402e5c7766c1a))
|
|
418
|
+
* use fully qualified names for data type lookups ([b7b5c74](https://github.com/iotaledger/twin-data/commit/b7b5c746b0180a87baa976f6a7a76cedd53d8ff7))
|
|
419
|
+
* use shared store mechanism ([#3](https://github.com/iotaledger/twin-data/issues/3)) ([33eb221](https://github.com/iotaledger/twin-data/commit/33eb221ccec2b4a79549c06e9a04225009b93a46))
|
|
420
|
+
* use updated JSON schema specs ([465223a](https://github.com/iotaledger/twin-data/commit/465223a9e9c24af546480ef084327a78fa366eaa))
|
|
407
421
|
|
|
408
422
|
|
|
409
423
|
### Bug Fixes
|
|
410
424
|
|
|
411
|
-
* itemListElement compaction override ([d908a10](https://github.com/
|
|
425
|
+
* itemListElement compaction override ([d908a10](https://github.com/iotaledger/twin-data/commit/d908a1043d7792e31b3101221d17850757b6c2a6))
|
|
412
426
|
|
|
413
|
-
## [0.0.1-next.37](https://github.com/
|
|
427
|
+
## [0.0.1-next.37](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.1-next.36...data-json-ld-v0.0.1-next.37) (2025-06-11)
|
|
414
428
|
|
|
415
429
|
|
|
416
430
|
### Features
|
|
417
431
|
|
|
418
|
-
* use updated JSON schema specs ([465223a](https://github.com/
|
|
432
|
+
* use updated JSON schema specs ([465223a](https://github.com/iotaledger/twin-data/commit/465223a9e9c24af546480ef084327a78fa366eaa))
|
|
419
433
|
|
|
420
434
|
|
|
421
435
|
### Dependencies
|
|
@@ -424,12 +438,12 @@
|
|
|
424
438
|
* dependencies
|
|
425
439
|
* @twin.org/data-core bumped from 0.0.1-next.36 to 0.0.1-next.37
|
|
426
440
|
|
|
427
|
-
## [0.0.1-next.36](https://github.com/
|
|
441
|
+
## [0.0.1-next.36](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.1-next.35...data-json-ld-v0.0.1-next.36) (2025-06-10)
|
|
428
442
|
|
|
429
443
|
|
|
430
444
|
### Features
|
|
431
445
|
|
|
432
|
-
* expand Json LD Keyword ([70632d1](https://github.com/
|
|
446
|
+
* expand Json LD Keyword ([70632d1](https://github.com/iotaledger/twin-data/commit/70632d1e11ad85cf3c57e118476b125a673f1681))
|
|
433
447
|
|
|
434
448
|
|
|
435
449
|
### Dependencies
|
|
@@ -438,12 +452,12 @@
|
|
|
438
452
|
* dependencies
|
|
439
453
|
* @twin.org/data-core bumped from 0.0.1-next.35 to 0.0.1-next.36
|
|
440
454
|
|
|
441
|
-
## [0.0.1-next.35](https://github.com/
|
|
455
|
+
## [0.0.1-next.35](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.1-next.34...data-json-ld-v0.0.1-next.35) (2025-06-03)
|
|
442
456
|
|
|
443
457
|
|
|
444
458
|
### Features
|
|
445
459
|
|
|
446
|
-
* update ts-to-schema ([8c3cd91](https://github.com/
|
|
460
|
+
* update ts-to-schema ([8c3cd91](https://github.com/iotaledger/twin-data/commit/8c3cd9131113f2d609f6e709562402e5c7766c1a))
|
|
447
461
|
|
|
448
462
|
|
|
449
463
|
### Dependencies
|
|
@@ -452,12 +466,12 @@
|
|
|
452
466
|
* dependencies
|
|
453
467
|
* @twin.org/data-core bumped from 0.0.1-next.34 to 0.0.1-next.35
|
|
454
468
|
|
|
455
|
-
## [0.0.1-next.34](https://github.com/
|
|
469
|
+
## [0.0.1-next.34](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.1-next.33...data-json-ld-v0.0.1-next.34) (2025-06-02)
|
|
456
470
|
|
|
457
471
|
|
|
458
472
|
### Features
|
|
459
473
|
|
|
460
|
-
* support multiple type JSON-LD ([8f0d530](https://github.com/
|
|
474
|
+
* support multiple type JSON-LD ([8f0d530](https://github.com/iotaledger/twin-data/commit/8f0d530f66302ab19413ecf968f170f97456e31e))
|
|
461
475
|
|
|
462
476
|
|
|
463
477
|
### Dependencies
|
|
@@ -466,12 +480,12 @@
|
|
|
466
480
|
* dependencies
|
|
467
481
|
* @twin.org/data-core bumped from 0.0.1-next.33 to 0.0.1-next.34
|
|
468
482
|
|
|
469
|
-
## [0.0.1-next.33](https://github.com/
|
|
483
|
+
## [0.0.1-next.33](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.1-next.32...data-json-ld-v0.0.1-next.33) (2025-06-02)
|
|
470
484
|
|
|
471
485
|
|
|
472
486
|
### Features
|
|
473
487
|
|
|
474
|
-
* add fail on missing type option and both mode ([e8b9702](https://github.com/
|
|
488
|
+
* add fail on missing type option and both mode ([e8b9702](https://github.com/iotaledger/twin-data/commit/e8b97029a04b646497ff0e55b9610291e58ae92a))
|
|
475
489
|
|
|
476
490
|
|
|
477
491
|
### Dependencies
|
|
@@ -480,12 +494,12 @@
|
|
|
480
494
|
* dependencies
|
|
481
495
|
* @twin.org/data-core bumped from 0.0.1-next.32 to 0.0.1-next.33
|
|
482
496
|
|
|
483
|
-
## [0.0.1-next.32](https://github.com/
|
|
497
|
+
## [0.0.1-next.32](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.1-next.31...data-json-ld-v0.0.1-next.32) (2025-05-28)
|
|
484
498
|
|
|
485
499
|
|
|
486
500
|
### Features
|
|
487
501
|
|
|
488
|
-
* use fully qualified names for data type lookups ([b7b5c74](https://github.com/
|
|
502
|
+
* use fully qualified names for data type lookups ([b7b5c74](https://github.com/iotaledger/twin-data/commit/b7b5c746b0180a87baa976f6a7a76cedd53d8ff7))
|
|
489
503
|
|
|
490
504
|
|
|
491
505
|
### Dependencies
|
|
@@ -494,12 +508,12 @@
|
|
|
494
508
|
* dependencies
|
|
495
509
|
* @twin.org/data-core bumped from 0.0.1-next.31 to 0.0.1-next.32
|
|
496
510
|
|
|
497
|
-
## [0.0.1-next.31](https://github.com/
|
|
511
|
+
## [0.0.1-next.31](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.1-next.30...data-json-ld-v0.0.1-next.31) (2025-05-08)
|
|
498
512
|
|
|
499
513
|
|
|
500
514
|
### Bug Fixes
|
|
501
515
|
|
|
502
|
-
* itemListElement compaction override ([d908a10](https://github.com/
|
|
516
|
+
* itemListElement compaction override ([d908a10](https://github.com/iotaledger/twin-data/commit/d908a1043d7792e31b3101221d17850757b6c2a6))
|
|
503
517
|
|
|
504
518
|
|
|
505
519
|
### Dependencies
|
|
@@ -508,12 +522,12 @@
|
|
|
508
522
|
* dependencies
|
|
509
523
|
* @twin.org/data-core bumped from 0.0.1-next.30 to 0.0.1-next.31
|
|
510
524
|
|
|
511
|
-
## [0.0.1-next.30](https://github.com/
|
|
525
|
+
## [0.0.1-next.30](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.1-next.29...data-json-ld-v0.0.1-next.30) (2025-04-17)
|
|
512
526
|
|
|
513
527
|
|
|
514
528
|
### Features
|
|
515
529
|
|
|
516
|
-
* use shared store mechanism ([#3](https://github.com/
|
|
530
|
+
* use shared store mechanism ([#3](https://github.com/iotaledger/twin-data/issues/3)) ([33eb221](https://github.com/iotaledger/twin-data/commit/33eb221ccec2b4a79549c06e9a04225009b93a46))
|
|
517
531
|
|
|
518
532
|
|
|
519
533
|
### Dependencies
|
|
@@ -522,12 +536,12 @@
|
|
|
522
536
|
* dependencies
|
|
523
537
|
* @twin.org/data-core bumped from 0.0.1-next.29 to 0.0.1-next.30
|
|
524
538
|
|
|
525
|
-
## [0.0.1-next.29](https://github.com/
|
|
539
|
+
## [0.0.1-next.29](https://github.com/iotaledger/twin-data/compare/data-json-ld-v0.0.1-next.28...data-json-ld-v0.0.1-next.29) (2025-03-28)
|
|
526
540
|
|
|
527
541
|
|
|
528
542
|
### Features
|
|
529
543
|
|
|
530
|
-
* add document cache access methods ([dbf1e36](https://github.com/
|
|
544
|
+
* add document cache access methods ([dbf1e36](https://github.com/iotaledger/twin-data/commit/dbf1e36d176c5f428f8c52628fb5a1ff7a6a174a))
|
|
531
545
|
|
|
532
546
|
|
|
533
547
|
### Dependencies
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/data-json-ld",
|
|
3
|
-
"version": "0.0.3-next.
|
|
3
|
+
"version": "0.0.3-next.21",
|
|
4
4
|
"description": "JSON-LD data models and helpers for working with linked data documents.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/iotaledger/data.git",
|
|
8
8
|
"directory": "packages/data-json-ld"
|
|
9
9
|
},
|
|
10
10
|
"author": "martyn.janes@iota.org",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/core": "next",
|
|
18
|
-
"@twin.org/data-core": "0.0.3-next.
|
|
18
|
+
"@twin.org/data-core": "0.0.3-next.21",
|
|
19
19
|
"@twin.org/entity": "next",
|
|
20
20
|
"@twin.org/nameof": "next",
|
|
21
21
|
"@twin.org/web": "next",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"data"
|
|
48
48
|
],
|
|
49
49
|
"bugs": {
|
|
50
|
-
"url": "git+https://github.com/
|
|
50
|
+
"url": "git+https://github.com/iotaledger/data/issues"
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://twindev.org"
|
|
53
53
|
}
|