@twin.org/data-framework 0.0.3-next.4 → 0.0.3-next.5

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.
@@ -15,22 +15,22 @@ export class FrameworkDataTypes {
15
15
  * Register all the data types.
16
16
  */
17
17
  static registerTypes() {
18
- DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.Urn}`, () => ({
19
- context: FrameworkContexts.ContextRoot,
18
+ DataTypeHandlerFactory.register(`${FrameworkContexts.Namespace}${FrameworkTypes.Urn}`, () => ({
19
+ namespace: FrameworkContexts.Namespace,
20
20
  type: FrameworkTypes.Urn,
21
21
  defaultValue: "",
22
22
  jsonSchema: async () => URNSchema,
23
23
  validate: async (propertyName, value, failures, container) => Urn.validate(propertyName, value, failures)
24
24
  }));
25
- DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.TimestampMilliseconds}`, () => ({
26
- context: FrameworkContexts.ContextRoot,
25
+ DataTypeHandlerFactory.register(`${FrameworkContexts.Namespace}${FrameworkTypes.TimestampMilliseconds}`, () => ({
26
+ namespace: FrameworkContexts.Namespace,
27
27
  type: FrameworkTypes.TimestampMilliseconds,
28
28
  defaultValue: Date.now(),
29
29
  jsonSchema: async () => TimestampMillisecondsSchema,
30
30
  validate: async (propertyName, value, failures, container) => Validation.timestampMilliseconds(propertyName, value, failures)
31
31
  }));
32
- DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.TimestampSeconds}`, () => ({
33
- context: FrameworkContexts.ContextRoot,
32
+ DataTypeHandlerFactory.register(`${FrameworkContexts.Namespace}${FrameworkTypes.TimestampSeconds}`, () => ({
33
+ namespace: FrameworkContexts.Namespace,
34
34
  type: FrameworkTypes.TimestampSeconds,
35
35
  defaultValue: Math.floor(Date.now() / 1000),
36
36
  jsonSchema: async () => TimestampSecondsSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"frameworkDataTypes.js","sour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AAI,EAAE,cAAc,CAAC,qBAAqB;YAC1C,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;YACxB,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,2BAA0C;YAClE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,CAC5D,UAAU,CAAC,qBAAqB,CAAC,YAAY,EAAE,KAAK,EAAE,QAAQ,CAAC;SAChE,CAAC,CACF,CAAC;QAEF,sBAAsB,CAAC,QAAQ,CAC9B,GAAG,iBAAiB,CAAC,WAAW,GAAG,cAAc,CAAC,gBAAgB,EAAE,EACpE,GAAG,EAAE,CAAC,CAAC;YACN,OAAO,EAAE,iBAAiB,CAAC,WAAW;YACtC,IAAI,EAAE,cAAc,CAAC,gBAAgB;YACrC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;YAC3C,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,sBAAqC;YAC7D,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,CAC5D,UAAU,CAAC,gBAAgB,CAAC,YAAY,EAAE,KAAK,EAAE,QAAQ,CAAC;SAC3D,CAAC,CACF,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Urn, Validation } from \"@twin.org/core\";\nimport { DataTypeHandlerFactory, type IJsonSchema } from \"@twin.org/data-core\";\nimport { FrameworkContexts } from \"../models/frameworkContexts.js\";\nimport { FrameworkTypes } from \"../models/frameworkTypes.js\";\nimport TimestampMillisecondsSchema from \"../schemas/TimestampMilliseconds.json\" with { type: \"json\" };\nimport TimestampSecondsSchema from \"../schemas/TimestampSeconds.json\" with { type: \"json\" };\nimport URNSchema from \"../schemas/URN.json\" with { type: \"json\" };\n\n/**\n * Handle all the framework data types.\n */\nexport class FrameworkDataTypes {\n\t/**\n\t * Register all the data types.\n\t */\n\tpublic static registerTypes(): void {\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${FrameworkContexts.ContextRoot}${FrameworkTypes.Urn}`,\n\t\t\t() => ({\n\t\t\t\tcontext: FrameworkContexts.ContextRoot,\n\t\t\t\ttype: FrameworkTypes.Urn,\n\t\t\t\tdefaultValue: \"\",\n\t\t\t\tjsonSchema: async () => URNSchema as IJsonSchema,\n\t\t\t\tvalidate: async (propertyName, value, failures, container) =>\n\t\t\t\t\tUrn.validate(propertyName, value, failures)\n\t\t\t})\n\t\t);\n\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${FrameworkContexts.ContextRoot}${FrameworkTypes.TimestampMilliseconds}`,\n\t\t\t() => ({\n\t\t\t\tcontext: FrameworkContexts.ContextRoot,\n\t\t\t\ttype: FrameworkTypes.TimestampMilliseconds,\n\t\t\t\tdefaultValue: Date.now(),\n\t\t\t\tjsonSchema: async () => TimestampMillisecondsSchema as IJsonSchema,\n\t\t\t\tvalidate: async (propertyName, value, failures, container) =>\n\t\t\t\t\tValidation.timestampMilliseconds(propertyName, value, failures)\n\t\t\t})\n\t\t);\n\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${FrameworkContexts.ContextRoot}${FrameworkTypes.TimestampSeconds}`,\n\t\t\t() => ({\n\t\t\t\tcontext: FrameworkContexts.ContextRoot,\n\t\t\t\ttype: FrameworkTypes.TimestampSeconds,\n\t\t\t\tdefaultValue: Math.floor(Date.now() / 1000),\n\t\t\t\tjsonSchema: async () => TimestampSecondsSchema as IJsonSchema,\n\t\t\t\tvalidate: async (propertyName, value, failures, container) =>\n\t\t\t\t\tValidation.timestampSeconds(propertyName, value, failures)\n\t\t\t})\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"frameworkDataTypes.js","sourceRoot":"","sources":["../../../src/dataTypes/frameworkDataTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;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AAU,EAAE,KAAK,IAAI,EAAE,CAAC,2BAA0C;YAClE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,CAC5D,UAAU,CAAC,qBAAqB,CAAC,YAAY,EAAE,KAAK,EAAE,QAAQ,CAAC;SAChE,CAAC,CACF,CAAC;QAEF,sBAAsB,CAAC,QAAQ,CAC9B,GAAG,iBAAiB,CAAC,SAAS,GAAG,cAAc,CAAC,gBAAgB,EAAE,EAClE,GAAG,EAAE,CAAC,CAAC;YACN,SAAS,EAAE,iBAAiB,CAAC,SAAS;YACtC,IAAI,EAAE,cAAc,CAAC,gBAAgB;YACrC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;YAC3C,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,sBAAqC;YAC7D,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,CAC5D,UAAU,CAAC,gBAAgB,CAAC,YAAY,EAAE,KAAK,EAAE,QAAQ,CAAC;SAC3D,CAAC,CACF,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Urn, Validation } from \"@twin.org/core\";\nimport { DataTypeHandlerFactory, type IJsonSchema } from \"@twin.org/data-core\";\nimport { FrameworkContexts } from \"../models/frameworkContexts.js\";\nimport { FrameworkTypes } from \"../models/frameworkTypes.js\";\nimport TimestampMillisecondsSchema from \"../schemas/TimestampMilliseconds.json\" with { type: \"json\" };\nimport TimestampSecondsSchema from \"../schemas/TimestampSeconds.json\" with { type: \"json\" };\nimport URNSchema from \"../schemas/URN.json\" with { type: \"json\" };\n\n/**\n * Handle all the framework data types.\n */\nexport class FrameworkDataTypes {\n\t/**\n\t * Register all the data types.\n\t */\n\tpublic static registerTypes(): void {\n\t\tDataTypeHandlerFactory.register(`${FrameworkContexts.Namespace}${FrameworkTypes.Urn}`, () => ({\n\t\t\tnamespace: FrameworkContexts.Namespace,\n\t\t\ttype: FrameworkTypes.Urn,\n\t\t\tdefaultValue: \"\",\n\t\t\tjsonSchema: async () => URNSchema as IJsonSchema,\n\t\t\tvalidate: async (propertyName, value, failures, container) =>\n\t\t\t\tUrn.validate(propertyName, value, failures)\n\t\t}));\n\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${FrameworkContexts.Namespace}${FrameworkTypes.TimestampMilliseconds}`,\n\t\t\t() => ({\n\t\t\t\tnamespace: FrameworkContexts.Namespace,\n\t\t\t\ttype: FrameworkTypes.TimestampMilliseconds,\n\t\t\t\tdefaultValue: Date.now(),\n\t\t\t\tjsonSchema: async () => TimestampMillisecondsSchema as IJsonSchema,\n\t\t\t\tvalidate: async (propertyName, value, failures, container) =>\n\t\t\t\t\tValidation.timestampMilliseconds(propertyName, value, failures)\n\t\t\t})\n\t\t);\n\n\t\tDataTypeHandlerFactory.register(\n\t\t\t`${FrameworkContexts.Namespace}${FrameworkTypes.TimestampSeconds}`,\n\t\t\t() => ({\n\t\t\t\tnamespace: FrameworkContexts.Namespace,\n\t\t\t\ttype: FrameworkTypes.TimestampSeconds,\n\t\t\t\tdefaultValue: Math.floor(Date.now() / 1000),\n\t\t\t\tjsonSchema: async () => TimestampSecondsSchema as IJsonSchema,\n\t\t\t\tvalidate: async (propertyName, value, failures, container) =>\n\t\t\t\t\tValidation.timestampSeconds(propertyName, value, failures)\n\t\t\t})\n\t\t);\n\t}\n}\n"]}
@@ -6,8 +6,8 @@
6
6
  // eslint-disable-next-line @typescript-eslint/naming-convention
7
7
  export const FrameworkContexts = {
8
8
  /**
9
- * Context Root.
9
+ * Namespace.
10
10
  */
11
- ContextRoot: "https://schema.twindev.org/framework/"
11
+ Namespace: "https://schema.twindev.org/framework/"
12
12
  };
13
13
  //# sourceMappingURL=frameworkContexts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"frameworkContexts.js","sourceRoot":"","sources":["../../../src/models/frameworkContexts.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC;;OAEG;IACH,WAAW,EAAE,uCAAuC;CAC3C,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The contexts of framework data.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const FrameworkContexts = {\n\t/**\n\t * Context Root.\n\t */\n\tContextRoot: \"https://schema.twindev.org/framework/\"\n} as const;\n\n/**\n * The contexts of framework data.\n */\nexport type FrameworkContexts = (typeof FrameworkContexts)[keyof typeof FrameworkContexts];\n"]}
1
+ {"version":3,"file":"frameworkContexts.js","sourceRoot":"","sources":["../../../src/models/frameworkContexts.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC;;OAEG;IACH,SAAS,EAAE,uCAAuC;CACzC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The contexts of framework data.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const FrameworkContexts = {\n\t/**\n\t * Namespace.\n\t */\n\tNamespace: \"https://schema.twindev.org/framework/\"\n} as const;\n\n/**\n * The contexts of framework data.\n */\nexport type FrameworkContexts = (typeof FrameworkContexts)[keyof typeof FrameworkContexts];\n"]}
@@ -3,9 +3,9 @@
3
3
  */
4
4
  export declare const FrameworkContexts: {
5
5
  /**
6
- * Context Root.
6
+ * Namespace.
7
7
  */
8
- readonly ContextRoot: "https://schema.twindev.org/framework/";
8
+ readonly Namespace: "https://schema.twindev.org/framework/";
9
9
  };
10
10
  /**
11
11
  * The contexts of framework data.
package/docs/changelog.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @twin.org/data-framework - Changelog
2
2
 
3
+ ## [0.0.3-next.5](https://github.com/twinfoundation/data/compare/data-framework-v0.0.3-next.4...data-framework-v0.0.3-next.5) (2026-01-14)
4
+
5
+
6
+ ### Features
7
+
8
+ * improve data type registration ([#34](https://github.com/twinfoundation/data/issues/34)) ([855d110](https://github.com/twinfoundation/data/commit/855d11046a4d85317b77a5c4e0f4a7b1b6d1a767))
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.4 to 0.0.3-next.5
16
+ * @twin.org/data-json-ld bumped from 0.0.3-next.4 to 0.0.3-next.5
17
+
3
18
  ## [0.0.3-next.4](https://github.com/twinfoundation/data/compare/data-framework-v0.0.3-next.3...data-framework-v0.0.3-next.4) (2026-01-06)
4
19
 
5
20
 
@@ -6,8 +6,8 @@ The contexts of framework data.
6
6
 
7
7
  ## Type Declaration
8
8
 
9
- ### ContextRoot
9
+ ### Namespace
10
10
 
11
- > `readonly` **ContextRoot**: `"https://schema.twindev.org/framework/"` = `"https://schema.twindev.org/framework/"`
11
+ > `readonly` **Namespace**: `"https://schema.twindev.org/framework/"` = `"https://schema.twindev.org/framework/"`
12
12
 
13
- Context Root.
13
+ Namespace.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/data-framework",
3
- "version": "0.0.3-next.4",
3
+ "version": "0.0.3-next.5",
4
4
  "description": "Models which define the structure of framework types",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@twin.org/core": "next",
18
- "@twin.org/data-core": "0.0.3-next.4",
19
- "@twin.org/data-json-ld": "0.0.3-next.4",
18
+ "@twin.org/data-core": "0.0.3-next.5",
19
+ "@twin.org/data-json-ld": "0.0.3-next.5",
20
20
  "@twin.org/entity": "next",
21
21
  "@twin.org/nameof": "next"
22
22
  },