@twin.org/data-json-ld 0.0.3-next.13 → 0.0.3-next.15

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.
@@ -1 +1 @@
1
- {"version":3,"file":"jsonLdHelperTypes.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdHelperTypes.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 * 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\n/**\n * Extract the required property names from a type.\n */\nexport type JsonLdRequiredKeys<T> = Exclude<keyof T, JsonLdOptionalKeys<T>>;\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\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\n/**\n * Keep only JSON-LD keys (\"@...\") from a type.\n */\nexport type JsonLdKeys<T extends object> = Pick<T, Extract<keyof T, `@${string}`>>;\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\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\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\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\n/**\n * Add \"@type\" to a type.\n */\nexport type JsonLdObjectWithType<\n\tT extends object,\n\tTy = JsonLdExistingProperty<T, \"@type\", string | string[]>\n> = Omit<T, \"@type\"> & {\n\t\"@type\": Ty;\n};\n\n/**\n * Add optional \"@type\" to a type.\n */\nexport type JsonLdObjectWithOptionalType<\n\tT extends object,\n\tTy = JsonLdExistingProperty<T, \"@type\", string | string[]>\n> = Omit<T, \"@type\"> & {\n\t\"@type\"?: Ty;\n};\n\n/**\n * Add \"@id\" to a type.\n */\nexport type JsonLdObjectWithId<\n\tT extends object,\n\tId = JsonLdExistingProperty<T, \"@id\", string>\n> = Omit<T, \"@id\"> & {\n\t\"@id\": Id;\n};\n\n/**\n * Add optional \"@id\" to a type.\n */\nexport type JsonLdObjectWithOptionalId<\n\tT extends object,\n\tId = JsonLdExistingProperty<T, \"@id\", string>\n> = Omit<T, \"@id\"> & {\n\t\"@id\"?: Id;\n};\n"]}
1
+ {"version":3,"file":"jsonLdHelperTypes.js","sourceRoot":"","sources":["../../../src/helpers/jsonLdHelperTypes.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 * 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\n/**\n * Extract the required property names from a type.\n */\nexport type JsonLdRequiredKeys<T> = Exclude<keyof T, JsonLdOptionalKeys<T>>;\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\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\n/**\n * Keep only JSON-LD keys (\"@...\") from a type.\n */\nexport type JsonLdKeys<T extends object> = Pick<T, Extract<keyof T, `@${string}`>>;\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\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\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\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\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\n/**\n * Add \"@type\" to a type.\n */\nexport type JsonLdObjectWithType<\n\tT extends object,\n\tTy = JsonLdExistingProperty<T, \"@type\", string | string[]>\n> = Omit<T, \"@type\"> & {\n\t\"@type\": Ty;\n};\n\n/**\n * Add optional \"@type\" to a type.\n */\nexport type JsonLdObjectWithOptionalType<\n\tT extends object,\n\tTy = JsonLdExistingProperty<T, \"@type\", string | string[]>\n> = Omit<T, \"@type\"> & {\n\t\"@type\"?: Ty;\n};\n\n/**\n * Omit \"@type\" from a type.\n */\nexport type JsonLdObjectWithNoType<T extends object> = Omit<T, \"@type\">;\n\n/**\n * Add \"@id\" to a type.\n */\nexport type JsonLdObjectWithId<\n\tT extends object,\n\tId = JsonLdExistingProperty<T, \"@id\", string>\n> = Omit<T, \"@id\"> & {\n\t\"@id\": Id;\n};\n\n/**\n * Add optional \"@id\" to a type.\n */\nexport type JsonLdObjectWithOptionalId<\n\tT extends object,\n\tId = JsonLdExistingProperty<T, \"@id\", string>\n> = Omit<T, \"@id\"> & {\n\t\"@id\"?: Id;\n};\n\n/**\n * Omit \"@id\" from a type.\n */\nexport type JsonLdObjectWithNoId<T extends object> = Omit<T, \"@id\">;\n"]}
@@ -46,8 +46,7 @@
46
46
  },
47
47
  "required": [
48
48
  "@container"
49
- ],
50
- "additionalProperties": false
49
+ ]
51
50
  },
52
51
  "@version": {
53
52
  "type": "string",
@@ -41,8 +41,7 @@
41
41
  }
42
42
  ]
43
43
  }
44
- },
45
- "additionalProperties": false
44
+ }
46
45
  }
47
46
  ]
48
47
  }
@@ -5,7 +5,6 @@
5
5
  "anyOf": [
6
6
  {
7
7
  "type": "object",
8
- "additionalProperties": false,
9
8
  "properties": {
10
9
  "@id": {
11
10
  "anyOf": [
@@ -90,7 +89,6 @@
90
89
  },
91
90
  {
92
91
  "type": "object",
93
- "additionalProperties": false,
94
92
  "properties": {
95
93
  "@reverse": {
96
94
  "type": "string"
@@ -39,6 +39,5 @@
39
39
  },
40
40
  "required": [
41
41
  "@graph"
42
- ],
43
- "additionalProperties": false
42
+ ]
44
43
  }
@@ -23,6 +23,5 @@
23
23
  },
24
24
  "required": [
25
25
  "@list"
26
- ],
27
- "additionalProperties": false
26
+ ]
28
27
  }
@@ -71,6 +71,5 @@
71
71
  "@index": {
72
72
  "type": "string"
73
73
  }
74
- },
75
- "additionalProperties": false
74
+ }
76
75
  }
@@ -23,6 +23,5 @@
23
23
  },
24
24
  "required": [
25
25
  "@set"
26
- ],
27
- "additionalProperties": false
26
+ ]
28
27
  }
@@ -5,7 +5,6 @@
5
5
  "anyOf": [
6
6
  {
7
7
  "type": "object",
8
- "additionalProperties": false,
9
8
  "properties": {
10
9
  "@value": {
11
10
  "type": [
@@ -42,7 +41,6 @@
42
41
  },
43
42
  {
44
43
  "type": "object",
45
- "additionalProperties": false,
46
44
  "properties": {
47
45
  "@value": {
48
46
  "type": [
@@ -69,7 +67,6 @@
69
67
  },
70
68
  {
71
69
  "type": "object",
72
- "additionalProperties": false,
73
70
  "properties": {
74
71
  "@value": {
75
72
  "anyOf": [
@@ -51,6 +51,11 @@ export type JsonLdExistingProperty<T extends object, P extends PropertyKey, D> =
51
51
  export type JsonLdObjectWithOptionalContext<T extends object, C = JsonLdExistingProperty<T, "@context", IJsonLdContextDefinitionRoot>> = Omit<T, "@context"> & {
52
52
  "@context"?: C;
53
53
  };
54
+ /**
55
+ * Omit optional "@context" from a type, inferring an existing context type from
56
+ * the source type when available, otherwise using the provided default.
57
+ */
58
+ export type JsonLdObjectWithNoContext<T extends object> = Omit<T, "@context">;
54
59
  /**
55
60
  * Add "@type" to a type.
56
61
  */
@@ -63,6 +68,10 @@ export type JsonLdObjectWithType<T extends object, Ty = JsonLdExistingProperty<T
63
68
  export type JsonLdObjectWithOptionalType<T extends object, Ty = JsonLdExistingProperty<T, "@type", string | string[]>> = Omit<T, "@type"> & {
64
69
  "@type"?: Ty;
65
70
  };
71
+ /**
72
+ * Omit "@type" from a type.
73
+ */
74
+ export type JsonLdObjectWithNoType<T extends object> = Omit<T, "@type">;
66
75
  /**
67
76
  * Add "@id" to a type.
68
77
  */
@@ -75,3 +84,7 @@ export type JsonLdObjectWithId<T extends object, Id = JsonLdExistingProperty<T,
75
84
  export type JsonLdObjectWithOptionalId<T extends object, Id = JsonLdExistingProperty<T, "@id", string>> = Omit<T, "@id"> & {
76
85
  "@id"?: Id;
77
86
  };
87
+ /**
88
+ * Omit "@id" from a type.
89
+ */
90
+ export type JsonLdObjectWithNoId<T extends object> = Omit<T, "@id">;
package/docs/changelog.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @twin.org/data-json-ld - Changelog
2
2
 
3
+ ## [0.0.3-next.15](https://github.com/twinfoundation/data/compare/data-json-ld-v0.0.3-next.14...data-json-ld-v0.0.3-next.15) (2026-02-27)
4
+
5
+
6
+ ### Features
7
+
8
+ * additional json-ld helpers ([c74cbd6](https://github.com/twinfoundation/data/commit/c74cbd60e423c5f780243da9868723e9d54d068a))
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.14 to 0.0.3-next.15
16
+
17
+ ## [0.0.3-next.14](https://github.com/twinfoundation/data/compare/data-json-ld-v0.0.3-next.13...data-json-ld-v0.0.3-next.14) (2026-02-25)
18
+
19
+
20
+ ### Features
21
+
22
+ * update schemas ([c30159c](https://github.com/twinfoundation/data/commit/c30159cd24e5f60f9124752738dd1c0312ee17dd))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/data-core bumped from 0.0.3-next.13 to 0.0.3-next.14
30
+
3
31
  ## [0.0.3-next.13](https://github.com/twinfoundation/data/compare/data-json-ld-v0.0.3-next.12...data-json-ld-v0.0.3-next.13) (2026-02-25)
4
32
 
5
33
 
@@ -31,10 +31,13 @@
31
31
  - [JsonLdObjectWithContext](type-aliases/JsonLdObjectWithContext.md)
32
32
  - [JsonLdExistingProperty](type-aliases/JsonLdExistingProperty.md)
33
33
  - [JsonLdObjectWithOptionalContext](type-aliases/JsonLdObjectWithOptionalContext.md)
34
+ - [JsonLdObjectWithNoContext](type-aliases/JsonLdObjectWithNoContext.md)
34
35
  - [JsonLdObjectWithType](type-aliases/JsonLdObjectWithType.md)
35
36
  - [JsonLdObjectWithOptionalType](type-aliases/JsonLdObjectWithOptionalType.md)
37
+ - [JsonLdObjectWithNoType](type-aliases/JsonLdObjectWithNoType.md)
36
38
  - [JsonLdObjectWithId](type-aliases/JsonLdObjectWithId.md)
37
39
  - [JsonLdObjectWithOptionalId](type-aliases/JsonLdObjectWithOptionalId.md)
40
+ - [JsonLdObjectWithNoId](type-aliases/JsonLdObjectWithNoId.md)
38
41
  - [IJsonLdContainerType](type-aliases/IJsonLdContainerType.md)
39
42
  - [IJsonLdContainerTypeArray](type-aliases/IJsonLdContainerTypeArray.md)
40
43
  - [IJsonLdContextDefinitionElement](type-aliases/IJsonLdContextDefinitionElement.md)
@@ -0,0 +1,12 @@
1
+ # Type Alias: JsonLdObjectWithNoContext\<T\>
2
+
3
+ > **JsonLdObjectWithNoContext**\<`T`\> = `Omit`\<`T`, `"@context"`\>
4
+
5
+ Omit optional "@context" from a type, inferring an existing context type from
6
+ the source type when available, otherwise using the provided default.
7
+
8
+ ## Type Parameters
9
+
10
+ ### T
11
+
12
+ `T` *extends* `object`
@@ -0,0 +1,11 @@
1
+ # Type Alias: JsonLdObjectWithNoId\<T\>
2
+
3
+ > **JsonLdObjectWithNoId**\<`T`\> = `Omit`\<`T`, `"@id"`\>
4
+
5
+ Omit "@id" from a type.
6
+
7
+ ## Type Parameters
8
+
9
+ ### T
10
+
11
+ `T` *extends* `object`
@@ -0,0 +1,11 @@
1
+ # Type Alias: JsonLdObjectWithNoType\<T\>
2
+
3
+ > **JsonLdObjectWithNoType**\<`T`\> = `Omit`\<`T`, `"@type"`\>
4
+
5
+ Omit "@type" from a type.
6
+
7
+ ## Type Parameters
8
+
9
+ ### T
10
+
11
+ `T` *extends* `object`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/data-json-ld",
3
- "version": "0.0.3-next.13",
3
+ "version": "0.0.3-next.15",
4
4
  "description": "Models which define the structure of JSON LD",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@twin.org/core": "next",
18
- "@twin.org/data-core": "0.0.3-next.13",
18
+ "@twin.org/data-core": "0.0.3-next.15",
19
19
  "@twin.org/entity": "next",
20
20
  "@twin.org/nameof": "next",
21
21
  "@twin.org/web": "next",