@twin.org/data-json-ld 0.0.3-next.8 → 0.9.0-next.1
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.
- package/README.md +1 -1
- package/dist/es/helpers/jsonLdAliasKey.js +4 -0
- package/dist/es/helpers/jsonLdAliasKey.js.map +1 -0
- package/dist/es/helpers/jsonLdExistingProperty.js +4 -0
- package/dist/es/helpers/jsonLdExistingProperty.js.map +1 -0
- package/dist/es/helpers/jsonLdExistingPropertyEither.js +2 -0
- package/dist/es/helpers/jsonLdExistingPropertyEither.js.map +1 -0
- package/dist/es/helpers/jsonLdKeys.js +4 -0
- package/dist/es/helpers/jsonLdKeys.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithAliases.js +2 -0
- package/dist/es/helpers/jsonLdObjectWithAliases.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithAtId.js +2 -0
- package/dist/es/helpers/jsonLdObjectWithAtId.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithAtType.js +2 -0
- package/dist/es/helpers/jsonLdObjectWithAtType.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithContext.js +2 -0
- package/dist/es/helpers/jsonLdObjectWithContext.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithId.js +2 -0
- package/dist/es/helpers/jsonLdObjectWithId.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithNoAtId.js +4 -0
- package/dist/es/helpers/jsonLdObjectWithNoAtId.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithNoAtType.js +4 -0
- package/dist/es/helpers/jsonLdObjectWithNoAtType.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithNoContext.js +4 -0
- package/dist/es/helpers/jsonLdObjectWithNoContext.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithNoId.js +4 -0
- package/dist/es/helpers/jsonLdObjectWithNoId.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithNoType.js +4 -0
- package/dist/es/helpers/jsonLdObjectWithNoType.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithOptionalAtId.js +2 -0
- package/dist/es/helpers/jsonLdObjectWithOptionalAtId.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithOptionalAtType.js +2 -0
- package/dist/es/helpers/jsonLdObjectWithOptionalAtType.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithOptionalContext.js +2 -0
- package/dist/es/helpers/jsonLdObjectWithOptionalContext.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithOptionalId.js +2 -0
- package/dist/es/helpers/jsonLdObjectWithOptionalId.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithOptionalType.js +2 -0
- package/dist/es/helpers/jsonLdObjectWithOptionalType.js.map +1 -0
- package/dist/es/helpers/jsonLdObjectWithType.js +2 -0
- package/dist/es/helpers/jsonLdObjectWithType.js.map +1 -0
- package/dist/es/helpers/jsonLdOptionalKeys.js +4 -0
- package/dist/es/helpers/jsonLdOptionalKeys.js.map +1 -0
- package/dist/es/helpers/jsonLdRequiredKeys.js +2 -0
- package/dist/es/helpers/jsonLdRequiredKeys.js.map +1 -0
- package/dist/es/helpers/jsonLdWithAliases.js +2 -0
- package/dist/es/helpers/jsonLdWithAliases.js.map +1 -0
- package/dist/es/index.js +23 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IJsonLdDocument.js.map +1 -1
- package/dist/es/schemas/JsonLdContainerType.json +17 -7
- package/dist/es/schemas/JsonLdContainerTypeArray.json +129 -142
- package/dist/es/schemas/JsonLdContextDefinition.json +76 -18
- package/dist/es/schemas/JsonLdContextDefinitionElement.json +1 -0
- package/dist/es/schemas/JsonLdContextDefinitionRoot.json +1 -0
- package/dist/es/schemas/JsonLdDocument.json +3 -3
- package/dist/es/schemas/JsonLdExpandedTermDefinition.json +101 -89
- package/dist/es/schemas/JsonLdGraphObject.json +2 -2
- package/dist/es/schemas/JsonLdIdMap.json +1 -0
- package/dist/es/schemas/JsonLdIncludedBlock.json +1 -0
- package/dist/es/schemas/JsonLdIndexMap.json +2 -1
- package/dist/es/schemas/JsonLdIndexMapItem.json +1 -0
- package/dist/es/schemas/JsonLdJsonArray.json +1 -0
- package/dist/es/schemas/JsonLdJsonObject.json +2 -8
- package/dist/es/schemas/JsonLdJsonPrimitive.json +14 -5
- package/dist/es/schemas/JsonLdJsonValue.json +1 -0
- package/dist/es/schemas/JsonLdLanguageMap.json +1 -0
- package/dist/es/schemas/JsonLdListObject.json +2 -2
- package/dist/es/schemas/JsonLdListOrSetItem.json +1 -0
- package/dist/es/schemas/JsonLdNodeObject.json +12 -72
- package/dist/es/schemas/JsonLdNodePrimitive.json +1 -0
- package/dist/es/schemas/JsonLdObject.json +3 -3
- package/dist/es/schemas/JsonLdSetObject.json +2 -2
- package/dist/es/schemas/JsonLdTypeMap.json +1 -0
- package/dist/es/schemas/JsonLdValueObject.json +99 -87
- package/dist/es/utils/jsonLdHelper.js +185 -24
- package/dist/es/utils/jsonLdHelper.js.map +1 -1
- package/dist/es/utils/jsonLdProcessor.js +134 -40
- package/dist/es/utils/jsonLdProcessor.js.map +1 -1
- package/dist/types/helpers/jsonLdAliasKey.d.ts +4 -0
- package/dist/types/helpers/jsonLdExistingProperty.d.ts +6 -0
- package/dist/types/helpers/jsonLdExistingPropertyEither.d.ts +6 -0
- package/dist/types/helpers/jsonLdKeys.d.ts +4 -0
- package/dist/types/helpers/jsonLdObjectWithAliases.d.ts +7 -0
- package/dist/types/helpers/jsonLdObjectWithAtId.d.ts +7 -0
- package/dist/types/helpers/jsonLdObjectWithAtType.d.ts +7 -0
- package/dist/types/helpers/jsonLdObjectWithContext.d.ts +7 -0
- package/dist/types/helpers/jsonLdObjectWithId.d.ts +7 -0
- package/dist/types/helpers/jsonLdObjectWithNoAtId.d.ts +4 -0
- package/dist/types/helpers/jsonLdObjectWithNoAtType.d.ts +4 -0
- package/dist/types/helpers/jsonLdObjectWithNoContext.d.ts +5 -0
- package/dist/types/helpers/jsonLdObjectWithNoId.d.ts +4 -0
- package/dist/types/helpers/jsonLdObjectWithNoType.d.ts +4 -0
- package/dist/types/helpers/jsonLdObjectWithOptionalAtId.d.ts +7 -0
- package/dist/types/helpers/jsonLdObjectWithOptionalAtType.d.ts +7 -0
- package/dist/types/helpers/jsonLdObjectWithOptionalContext.d.ts +9 -0
- package/dist/types/helpers/jsonLdObjectWithOptionalId.d.ts +7 -0
- package/dist/types/helpers/jsonLdObjectWithOptionalType.d.ts +7 -0
- package/dist/types/helpers/jsonLdObjectWithType.d.ts +7 -0
- package/dist/types/helpers/jsonLdOptionalKeys.d.ts +6 -0
- package/dist/types/helpers/jsonLdRequiredKeys.d.ts +5 -0
- package/dist/types/helpers/jsonLdWithAliases.d.ts +13 -0
- package/dist/types/index.d.ts +23 -0
- package/dist/types/models/IJsonLdDocument.d.ts +0 -4
- package/dist/types/utils/jsonLdHelper.d.ts +60 -10
- package/dist/types/utils/jsonLdProcessor.d.ts +16 -13
- package/docs/changelog.md +393 -72
- package/docs/examples.md +214 -1
- package/docs/reference/classes/JsonLdDataTypes.md +1 -1
- package/docs/reference/classes/JsonLdHelper.md +233 -19
- package/docs/reference/classes/JsonLdProcessor.md +57 -64
- package/docs/reference/index.md +23 -0
- package/docs/reference/interfaces/IJsonLdContextDefinition.md +20 -20
- package/docs/reference/interfaces/IJsonLdGraphObject.md +7 -7
- package/docs/reference/interfaces/IJsonLdIdMap.md +1 -1
- package/docs/reference/interfaces/IJsonLdIndexMap.md +1 -1
- package/docs/reference/interfaces/IJsonLdJsonObject.md +1 -1
- package/docs/reference/interfaces/IJsonLdLanguageMap.md +1 -1
- package/docs/reference/interfaces/IJsonLdListObject.md +3 -3
- package/docs/reference/interfaces/IJsonLdNodeObject.md +17 -17
- package/docs/reference/interfaces/IJsonLdObject.md +16 -16
- package/docs/reference/interfaces/IJsonLdSetObject.md +3 -3
- package/docs/reference/interfaces/IJsonLdTypeMap.md +1 -1
- package/docs/reference/type-aliases/IJsonLdExpandedTermDefinition.md +7 -7
- package/docs/reference/type-aliases/IJsonLdValueObject.md +2 -2
- package/docs/reference/type-aliases/JsonLdAliasKey.md +15 -0
- package/docs/reference/type-aliases/JsonLdExistingProperty.md +19 -0
- package/docs/reference/type-aliases/JsonLdExistingPropertyEither.md +24 -0
- package/docs/reference/type-aliases/JsonLdKeys.md +11 -0
- package/docs/reference/type-aliases/JsonLdObjectWithAliases.md +16 -0
- package/docs/reference/type-aliases/JsonLdObjectWithAtId.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithAtType.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithContext.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithId.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithNoAtId.md +11 -0
- package/docs/reference/type-aliases/JsonLdObjectWithNoAtType.md +11 -0
- package/docs/reference/type-aliases/JsonLdObjectWithNoContext.md +12 -0
- package/docs/reference/type-aliases/JsonLdObjectWithNoId.md +11 -0
- package/docs/reference/type-aliases/JsonLdObjectWithNoType.md +11 -0
- package/docs/reference/type-aliases/JsonLdObjectWithOptionalAtId.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithOptionalAtType.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithOptionalContext.md +22 -0
- package/docs/reference/type-aliases/JsonLdObjectWithOptionalId.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithOptionalType.md +21 -0
- package/docs/reference/type-aliases/JsonLdObjectWithType.md +21 -0
- package/docs/reference/type-aliases/JsonLdOptionalKeys.md +11 -0
- package/docs/reference/type-aliases/JsonLdRequiredKeys.md +11 -0
- package/docs/reference/type-aliases/JsonLdWithAliases.md +17 -0
- package/docs/reference/variables/JsonLdContexts.md +3 -3
- package/docs/reference/variables/JsonLdTypes.md +26 -26
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TWIN JSON LD Data
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides JSON-LD data models and helper utilities for working with linked data documents in a predictable and reusable way. It aligns package-level data structures with the [JSON-LD](https://json-ld.org/) ecosystem, making it easier to represent interoperable semantic data across services.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdAliasKey.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdAliasKey.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Keep JSON-LD keys as-is and prefix non-JSON-LD keys.\n */\nexport type JsonLdAliasKey<K extends string, Prefix extends string> = K extends `@${string}`\n\t? K\n\t: `${Prefix}:${K}`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdExistingProperty.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdExistingProperty.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Infer an existing property's type from a source type, or fall back to a default.\n */\nexport type JsonLdExistingProperty<T extends object, P extends PropertyKey, D> = T extends {\n\t[K in P]?: infer PropertyType;\n}\n\t? Exclude<PropertyType, undefined>\n\t: D;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdExistingPropertyEither.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdExistingPropertyEither.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { JsonLdExistingProperty } from \"./jsonLdExistingProperty.js\";\n\n/**\n * Infer an existing property's type from either of two source properties,\n * or fall back to a default when neither exists.\n */\nexport type JsonLdExistingPropertyEither<\n\tT extends object,\n\tP1 extends PropertyKey,\n\tP2 extends PropertyKey,\n\tD\n> = [JsonLdExistingProperty<T, P1, never> | JsonLdExistingProperty<T, P2, never>] extends [never]\n\t? D\n\t: JsonLdExistingProperty<T, P1, never> | JsonLdExistingProperty<T, P2, never>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdKeys.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdKeys.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Keep only JSON-LD keys (\"@...\") from a type.\n */\nexport type JsonLdKeys<T extends object> = Pick<T, Extract<keyof T, `@${string}`>>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithAliases.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithAliases.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { JsonLdKeys } from \"./jsonLdKeys.js\";\nimport type { JsonLdWithAliases } from \"./jsonLdWithAliases.js\";\n\n/**\n * Create a JSON-LD object shape containing only JSON-LD keys plus aliased\n * non-JSON-LD keys.\n */\nexport type JsonLdObjectWithAliases<T extends object, Prefix extends string> = JsonLdKeys<T> &\n\tJsonLdWithAliases<T, Prefix>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithAtId.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithAtId.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { JsonLdExistingPropertyEither } from \"./jsonLdExistingPropertyEither.js\";\n\n/**\n * Add \"@id\" to a type.\n */\nexport type JsonLdObjectWithAtId<\n\tT extends object,\n\tId = JsonLdExistingPropertyEither<T, \"@id\", \"id\", string>\n> = Omit<T, \"@id\" | \"id\"> & {\n\t\"@id\": Id;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithAtType.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithAtType.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { JsonLdExistingPropertyEither } from \"./jsonLdExistingPropertyEither.js\";\n\n/**\n * Add \"@type\" to a type.\n */\nexport type JsonLdObjectWithAtType<\n\tT extends object,\n\tTy = JsonLdExistingPropertyEither<T, \"@type\", \"type\", string | string[]>\n> = Omit<T, \"@type\" | \"type\"> & {\n\t\"@type\": Ty;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithContext.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithContext.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdContextDefinitionRoot } from \"../models/IJsonLdContextDefinitionRoot.js\";\n\n/**\n * Add \"@context\" to a type.\n */\nexport type JsonLdObjectWithContext<T extends object, C = IJsonLdContextDefinitionRoot> = Omit<\n\tT,\n\t\"@context\"\n> & {\n\t\"@context\": C;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithId.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithId.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { JsonLdExistingPropertyEither } from \"./jsonLdExistingPropertyEither.js\";\n\n/**\n * Add \"id\" to a type.\n */\nexport type JsonLdObjectWithId<\n\tT extends object,\n\tId = JsonLdExistingPropertyEither<T, \"id\", \"@id\", string>\n> = Omit<T, \"id\" | \"@id\"> & {\n\tid: Id;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithNoAtId.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithNoAtId.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Omit \"@id\" from a type.\n */\nexport type JsonLdObjectWithNoAtId<T extends object> = Omit<T, \"@id\">;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithNoAtType.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithNoAtType.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Omit \"@type\" from a type.\n */\nexport type JsonLdObjectWithNoAtType<T extends object> = Omit<T, \"@type\">;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithNoContext.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithNoContext.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Omit optional \"@context\" from a type, inferring an existing context type from\n * the source type when available, otherwise using the provided default.\n */\nexport type JsonLdObjectWithNoContext<T extends object> = Omit<T, \"@context\">;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithNoId.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithNoId.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Omit \"id\" from a type.\n */\nexport type JsonLdObjectWithNoId<T extends object> = Omit<T, \"id\">;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithNoType.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithNoType.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Omit \"type\" from a type.\n */\nexport type JsonLdObjectWithNoType<T extends object> = Omit<T, \"type\">;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithOptionalAtId.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithOptionalAtId.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { JsonLdExistingPropertyEither } from \"./jsonLdExistingPropertyEither.js\";\n\n/**\n * Add optional \"@id\" to a type.\n */\nexport type JsonLdObjectWithOptionalAtId<\n\tT extends object,\n\tId = JsonLdExistingPropertyEither<T, \"@id\", \"id\", string>\n> = Omit<T, \"@id\" | \"id\"> & {\n\t\"@id\"?: Id;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithOptionalAtType.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithOptionalAtType.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { JsonLdExistingPropertyEither } from \"./jsonLdExistingPropertyEither.js\";\n\n/**\n * Add optional \"@type\" to a type.\n */\nexport type JsonLdObjectWithOptionalAtType<\n\tT extends object,\n\tTy = JsonLdExistingPropertyEither<T, \"@type\", \"type\", string | string[]>\n> = Omit<T, \"@type\" | \"type\"> & {\n\t\"@type\"?: Ty;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithOptionalContext.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithOptionalContext.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { JsonLdExistingProperty } from \"./jsonLdExistingProperty.js\";\nimport type { IJsonLdContextDefinitionRoot } from \"../models/IJsonLdContextDefinitionRoot.js\";\n\n/**\n * Add optional \"@context\" to a type, inferring an existing context type from\n * the source type when available, otherwise using the provided default.\n */\nexport type JsonLdObjectWithOptionalContext<\n\tT extends object,\n\tC = JsonLdExistingProperty<T, \"@context\", IJsonLdContextDefinitionRoot>\n> = Omit<T, \"@context\"> & {\n\t\"@context\"?: C;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithOptionalId.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithOptionalId.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { JsonLdExistingPropertyEither } from \"./jsonLdExistingPropertyEither.js\";\n\n/**\n * Add optional \"id\" to a type.\n */\nexport type JsonLdObjectWithOptionalId<\n\tT extends object,\n\tId = JsonLdExistingPropertyEither<T, \"id\", \"@id\", string>\n> = Omit<T, \"id\" | \"@id\"> & {\n\tid?: Id;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithOptionalType.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithOptionalType.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { JsonLdExistingPropertyEither } from \"./jsonLdExistingPropertyEither.js\";\n\n/**\n * Add optional \"type\" to a type.\n */\nexport type JsonLdObjectWithOptionalType<\n\tT extends object,\n\tTy = JsonLdExistingPropertyEither<T, \"type\", \"@type\", string | string[]>\n> = Omit<T, \"type\" | \"@type\"> & {\n\ttype?: Ty;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdObjectWithType.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdObjectWithType.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { JsonLdExistingPropertyEither } from \"./jsonLdExistingPropertyEither.js\";\n\n/**\n * Add \"type\" to a type.\n */\nexport type JsonLdObjectWithType<\n\tT extends object,\n\tTy = JsonLdExistingPropertyEither<T, \"type\", \"@type\", string | string[]>\n> = Omit<T, \"type\" | \"@type\"> & {\n\ttype: Ty;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdOptionalKeys.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdOptionalKeys.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Extract the optional property names from a type.\n */\nexport type JsonLdOptionalKeys<T> = {\n\t[K in keyof T]-?: {} extends Pick<T, K> ? K : never;\n}[keyof T];\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdRequiredKeys.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdRequiredKeys.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { JsonLdOptionalKeys } from \"./jsonLdOptionalKeys.js\";\n\n/**\n * Extract the required property names from a type.\n */\nexport type JsonLdRequiredKeys<T> = Exclude<keyof T, JsonLdOptionalKeys<T>>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLdWithAliases.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdWithAliases.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { JsonLdAliasKey } from \"./jsonLdAliasKey.js\";\nimport type { JsonLdOptionalKeys } from \"./jsonLdOptionalKeys.js\";\nimport type { JsonLdRequiredKeys } from \"./jsonLdRequiredKeys.js\";\n\n/**\n * Remap an object type so JSON-LD keys (\"@...\") are preserved and\n * non-JSON-LD keys are exposed as `Prefix:key` aliases, while preserving\n * each key's original required/optional status.\n */\nexport type JsonLdWithAliases<T extends object, Prefix extends string> = {\n\t[K in Extract<JsonLdRequiredKeys<T>, string> as JsonLdAliasKey<K, Prefix>]: T[K];\n} & {\n\t[K in Extract<JsonLdOptionalKeys<T>, string> as JsonLdAliasKey<K, Prefix>]?: T[K];\n};\n"]}
|
package/dist/es/index.js
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
// Copyright 2024 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
3
|
export * from "./dataTypes/jsonLdDataTypes.js";
|
|
4
|
+
export * from "./helpers/jsonLdAliasKey.js";
|
|
5
|
+
export * from "./helpers/jsonLdExistingProperty.js";
|
|
6
|
+
export * from "./helpers/jsonLdExistingPropertyEither.js";
|
|
7
|
+
export * from "./helpers/jsonLdKeys.js";
|
|
8
|
+
export * from "./helpers/jsonLdObjectWithAliases.js";
|
|
9
|
+
export * from "./helpers/jsonLdObjectWithAtId.js";
|
|
10
|
+
export * from "./helpers/jsonLdObjectWithAtType.js";
|
|
11
|
+
export * from "./helpers/jsonLdObjectWithContext.js";
|
|
12
|
+
export * from "./helpers/jsonLdObjectWithId.js";
|
|
13
|
+
export * from "./helpers/jsonLdObjectWithNoAtId.js";
|
|
14
|
+
export * from "./helpers/jsonLdObjectWithNoAtType.js";
|
|
15
|
+
export * from "./helpers/jsonLdObjectWithNoContext.js";
|
|
16
|
+
export * from "./helpers/jsonLdObjectWithNoId.js";
|
|
17
|
+
export * from "./helpers/jsonLdObjectWithNoType.js";
|
|
18
|
+
export * from "./helpers/jsonLdObjectWithOptionalAtId.js";
|
|
19
|
+
export * from "./helpers/jsonLdObjectWithOptionalAtType.js";
|
|
20
|
+
export * from "./helpers/jsonLdObjectWithOptionalContext.js";
|
|
21
|
+
export * from "./helpers/jsonLdObjectWithOptionalId.js";
|
|
22
|
+
export * from "./helpers/jsonLdObjectWithOptionalType.js";
|
|
23
|
+
export * from "./helpers/jsonLdObjectWithType.js";
|
|
24
|
+
export * from "./helpers/jsonLdOptionalKeys.js";
|
|
25
|
+
export * from "./helpers/jsonLdRequiredKeys.js";
|
|
26
|
+
export * from "./helpers/jsonLdWithAliases.js";
|
|
4
27
|
export * from "./models/IJsonLdContainerType.js";
|
|
5
28
|
export * from "./models/IJsonLdContainerTypeArray.js";
|
|
6
29
|
export * from "./models/IJsonLdContextDefinition.js";
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0CAA0C,CAAC;AACzD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./dataTypes/jsonLdDataTypes.js\";\nexport * from \"./models/IJsonLdContainerType.js\";\nexport * from \"./models/IJsonLdContainerTypeArray.js\";\nexport * from \"./models/IJsonLdContextDefinition.js\";\nexport * from \"./models/IJsonLdContextDefinitionElement.js\";\nexport * from \"./models/IJsonLdContextDefinitionRoot.js\";\nexport * from \"./models/IJsonLdDocument.js\";\nexport * from \"./models/IJsonLdExpandedTermDefinition.js\";\nexport * from \"./models/IJsonLdGraphObject.js\";\nexport * from \"./models/IJsonLdIdMap.js\";\nexport * from \"./models/IJsonLdIncludedBlock.js\";\nexport * from \"./models/IJsonLdIndexMap.js\";\nexport * from \"./models/IJsonLdIndexMapItem.js\";\nexport * from \"./models/IJsonLdJsonArray.js\";\nexport * from \"./models/IJsonLdJsonObject.js\";\nexport * from \"./models/IJsonLdJsonPrimitive.js\";\nexport * from \"./models/IJsonLdJsonValue.js\";\nexport * from \"./models/IJsonLdLanguageMap.js\";\nexport * from \"./models/IJsonLdListObject.js\";\nexport * from \"./models/IJsonLdListOrSetItem.js\";\nexport * from \"./models/IJsonLdNodeObject.js\";\nexport * from \"./models/IJsonLdNodePrimitive.js\";\nexport * from \"./models/IJsonLdObject.js\";\nexport * from \"./models/IJsonLdSetObject.js\";\nexport * from \"./models/IJsonLdTypeMap.js\";\nexport * from \"./models/IJsonLdValueObject.js\";\nexport * from \"./models/jsonLdContexts.js\";\nexport * from \"./models/jsonLdTypes.js\";\nexport * from \"./utils/jsonLdHelper.js\";\nexport * from \"./utils/jsonLdProcessor.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,yBAAyB,CAAC;AACxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,yCAAyC,CAAC;AACxD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0CAA0C,CAAC;AACzD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./dataTypes/jsonLdDataTypes.js\";\nexport * from \"./helpers/jsonLdAliasKey.js\";\nexport * from \"./helpers/jsonLdExistingProperty.js\";\nexport * from \"./helpers/jsonLdExistingPropertyEither.js\";\nexport * from \"./helpers/jsonLdKeys.js\";\nexport * from \"./helpers/jsonLdObjectWithAliases.js\";\nexport * from \"./helpers/jsonLdObjectWithAtId.js\";\nexport * from \"./helpers/jsonLdObjectWithAtType.js\";\nexport * from \"./helpers/jsonLdObjectWithContext.js\";\nexport * from \"./helpers/jsonLdObjectWithId.js\";\nexport * from \"./helpers/jsonLdObjectWithNoAtId.js\";\nexport * from \"./helpers/jsonLdObjectWithNoAtType.js\";\nexport * from \"./helpers/jsonLdObjectWithNoContext.js\";\nexport * from \"./helpers/jsonLdObjectWithNoId.js\";\nexport * from \"./helpers/jsonLdObjectWithNoType.js\";\nexport * from \"./helpers/jsonLdObjectWithOptionalAtId.js\";\nexport * from \"./helpers/jsonLdObjectWithOptionalAtType.js\";\nexport * from \"./helpers/jsonLdObjectWithOptionalContext.js\";\nexport * from \"./helpers/jsonLdObjectWithOptionalId.js\";\nexport * from \"./helpers/jsonLdObjectWithOptionalType.js\";\nexport * from \"./helpers/jsonLdObjectWithType.js\";\nexport * from \"./helpers/jsonLdOptionalKeys.js\";\nexport * from \"./helpers/jsonLdRequiredKeys.js\";\nexport * from \"./helpers/jsonLdWithAliases.js\";\nexport * from \"./models/IJsonLdContainerType.js\";\nexport * from \"./models/IJsonLdContainerTypeArray.js\";\nexport * from \"./models/IJsonLdContextDefinition.js\";\nexport * from \"./models/IJsonLdContextDefinitionElement.js\";\nexport * from \"./models/IJsonLdContextDefinitionRoot.js\";\nexport * from \"./models/IJsonLdDocument.js\";\nexport * from \"./models/IJsonLdExpandedTermDefinition.js\";\nexport * from \"./models/IJsonLdGraphObject.js\";\nexport * from \"./models/IJsonLdIdMap.js\";\nexport * from \"./models/IJsonLdIncludedBlock.js\";\nexport * from \"./models/IJsonLdIndexMap.js\";\nexport * from \"./models/IJsonLdIndexMapItem.js\";\nexport * from \"./models/IJsonLdJsonArray.js\";\nexport * from \"./models/IJsonLdJsonObject.js\";\nexport * from \"./models/IJsonLdJsonPrimitive.js\";\nexport * from \"./models/IJsonLdJsonValue.js\";\nexport * from \"./models/IJsonLdLanguageMap.js\";\nexport * from \"./models/IJsonLdListObject.js\";\nexport * from \"./models/IJsonLdListOrSetItem.js\";\nexport * from \"./models/IJsonLdNodeObject.js\";\nexport * from \"./models/IJsonLdNodePrimitive.js\";\nexport * from \"./models/IJsonLdObject.js\";\nexport * from \"./models/IJsonLdSetObject.js\";\nexport * from \"./models/IJsonLdTypeMap.js\";\nexport * from \"./models/IJsonLdValueObject.js\";\nexport * from \"./models/jsonLdContexts.js\";\nexport * from \"./models/jsonLdTypes.js\";\nexport * from \"./utils/jsonLdHelper.js\";\nexport * from \"./utils/jsonLdProcessor.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IJsonLdDocument.js","sourceRoot":"","sources":["../../../src/models/IJsonLdDocument.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdContextDefinitionRoot } from \"./IJsonLdContextDefinitionRoot.js\";\nimport type { IJsonLdNodeObject } from \"./IJsonLdNodeObject.js\";\nimport type { IJsonLdValueObject } from \"./IJsonLdValueObject.js\";\n\n/**\n * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators\n * that are used in other packages cannot understand some of the types e.g. OrArray\n */\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"IJsonLdDocument.js","sourceRoot":"","sources":["../../../src/models/IJsonLdDocument.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IJsonLdContextDefinitionRoot } from \"./IJsonLdContextDefinitionRoot.js\";\nimport type { IJsonLdNodeObject } from \"./IJsonLdNodeObject.js\";\nimport type { IJsonLdValueObject } from \"./IJsonLdValueObject.js\";\n\n/**\n * This is a copy of the types from the npm jsonld package. This is necessary as the JSON schema generators\n * that are used in other packages cannot understand some of the types e.g. OrArray\n */\n\n/**\n * A JSON-LD document MUST be valid JSON text as described in [RFC8259],\n * or some format that can be represented in the JSON-LD internal representation\n * that is equivalent to valid JSON text.\n * @see https://www.w3.org/TR/json-ld11/#json-ld-grammar\n */\nexport type IJsonLdDocument =\n\t| IJsonLdNodeObject\n\t| IJsonLdNodeObject[]\n\t| {\n\t\t\t\"@context\"?: IJsonLdContextDefinitionRoot | undefined;\n\t\t\t\"@graph\"?:\n\t\t\t\t| IJsonLdValueObject\n\t\t\t\t| IJsonLdNodeObject\n\t\t\t\t| (IJsonLdValueObject | IJsonLdNodeObject)[]\n\t\t\t\t| undefined;\n\t };\n"]}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://schema.twindev.org/json-ld/JsonLdContainerType",
|
|
4
|
+
"title": "JsonLdContainerType",
|
|
4
5
|
"description": "JSON-LD container types.",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
"anyOf": [
|
|
7
|
+
{
|
|
8
|
+
"const": "@language"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"const": "@index"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"const": "@id"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"const": "@graph"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"const": "@type"
|
|
21
|
+
}
|
|
12
22
|
]
|
|
13
23
|
}
|