@twin.org/data-framework 0.0.1-next.26 → 0.0.1-next.28

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.
@@ -6,14 +6,23 @@ var dataCore = require('@twin.org/data-core');
6
6
  // Copyright 2024 IOTA Stiftung.
7
7
  // SPDX-License-Identifier: Apache-2.0.
8
8
  /**
9
- * The types of framework data.
9
+ * The contexts of framework data.
10
10
  */
11
11
  // eslint-disable-next-line @typescript-eslint/naming-convention
12
- const FrameworkTypes = {
12
+ const FrameworkContexts = {
13
13
  /**
14
14
  * Context Root.
15
15
  */
16
- ContextRoot: "https://schema.twindev.org/framework/",
16
+ ContextRoot: "https://schema.twindev.org/framework/"
17
+ };
18
+
19
+ // Copyright 2024 IOTA Stiftung.
20
+ // SPDX-License-Identifier: Apache-2.0.
21
+ /**
22
+ * The types of framework data.
23
+ */
24
+ // eslint-disable-next-line @typescript-eslint/naming-convention
25
+ const FrameworkTypes = {
17
26
  /**
18
27
  * Represents a urn.
19
28
  */
@@ -59,19 +68,19 @@ class FrameworkDataTypes {
59
68
  * Register all the data types.
60
69
  */
61
70
  static registerTypes() {
62
- dataCore.DataTypeHandlerFactory.register(`${FrameworkTypes.ContextRoot}${FrameworkTypes.Urn}`, () => ({
71
+ dataCore.DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.Urn}`, () => ({
63
72
  type: FrameworkTypes.Urn,
64
73
  defaultValue: "",
65
74
  jsonSchema: async () => URNSchema,
66
75
  validate: async (propertyName, value, failures, container) => core.Urn.validate(propertyName, value, failures)
67
76
  }));
68
- dataCore.DataTypeHandlerFactory.register(`${FrameworkTypes.ContextRoot}${FrameworkTypes.TimestampMilliseconds}`, () => ({
77
+ dataCore.DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.TimestampMilliseconds}`, () => ({
69
78
  type: FrameworkTypes.TimestampMilliseconds,
70
79
  defaultValue: Date.now(),
71
80
  jsonSchema: async () => TimestampMillisecondsSchema,
72
81
  validate: async (propertyName, value, failures, container) => core.Validation.timestampMilliseconds(propertyName, value, failures)
73
82
  }));
74
- dataCore.DataTypeHandlerFactory.register(`${FrameworkTypes.ContextRoot}${FrameworkTypes.TimestampSeconds}`, () => ({
83
+ dataCore.DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.TimestampSeconds}`, () => ({
75
84
  type: FrameworkTypes.TimestampSeconds,
76
85
  defaultValue: Math.floor(Date.now() / 1000),
77
86
  jsonSchema: async () => TimestampSecondsSchema,
@@ -80,5 +89,6 @@ class FrameworkDataTypes {
80
89
  }
81
90
  }
82
91
 
92
+ exports.FrameworkContexts = FrameworkContexts;
83
93
  exports.FrameworkDataTypes = FrameworkDataTypes;
84
94
  exports.FrameworkTypes = FrameworkTypes;
@@ -4,14 +4,23 @@ import { DataTypeHandlerFactory } from '@twin.org/data-core';
4
4
  // Copyright 2024 IOTA Stiftung.
5
5
  // SPDX-License-Identifier: Apache-2.0.
6
6
  /**
7
- * The types of framework data.
7
+ * The contexts of framework data.
8
8
  */
9
9
  // eslint-disable-next-line @typescript-eslint/naming-convention
10
- const FrameworkTypes = {
10
+ const FrameworkContexts = {
11
11
  /**
12
12
  * Context Root.
13
13
  */
14
- ContextRoot: "https://schema.twindev.org/framework/",
14
+ ContextRoot: "https://schema.twindev.org/framework/"
15
+ };
16
+
17
+ // Copyright 2024 IOTA Stiftung.
18
+ // SPDX-License-Identifier: Apache-2.0.
19
+ /**
20
+ * The types of framework data.
21
+ */
22
+ // eslint-disable-next-line @typescript-eslint/naming-convention
23
+ const FrameworkTypes = {
15
24
  /**
16
25
  * Represents a urn.
17
26
  */
@@ -57,19 +66,19 @@ class FrameworkDataTypes {
57
66
  * Register all the data types.
58
67
  */
59
68
  static registerTypes() {
60
- DataTypeHandlerFactory.register(`${FrameworkTypes.ContextRoot}${FrameworkTypes.Urn}`, () => ({
69
+ DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.Urn}`, () => ({
61
70
  type: FrameworkTypes.Urn,
62
71
  defaultValue: "",
63
72
  jsonSchema: async () => URNSchema,
64
73
  validate: async (propertyName, value, failures, container) => Urn.validate(propertyName, value, failures)
65
74
  }));
66
- DataTypeHandlerFactory.register(`${FrameworkTypes.ContextRoot}${FrameworkTypes.TimestampMilliseconds}`, () => ({
75
+ DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.TimestampMilliseconds}`, () => ({
67
76
  type: FrameworkTypes.TimestampMilliseconds,
68
77
  defaultValue: Date.now(),
69
78
  jsonSchema: async () => TimestampMillisecondsSchema,
70
79
  validate: async (propertyName, value, failures, container) => Validation.timestampMilliseconds(propertyName, value, failures)
71
80
  }));
72
- DataTypeHandlerFactory.register(`${FrameworkTypes.ContextRoot}${FrameworkTypes.TimestampSeconds}`, () => ({
81
+ DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.TimestampSeconds}`, () => ({
73
82
  type: FrameworkTypes.TimestampSeconds,
74
83
  defaultValue: Math.floor(Date.now() / 1000),
75
84
  jsonSchema: async () => TimestampSecondsSchema,
@@ -78,4 +87,4 @@ class FrameworkDataTypes {
78
87
  }
79
88
  }
80
89
 
81
- export { FrameworkDataTypes, FrameworkTypes };
90
+ export { FrameworkContexts, FrameworkDataTypes, FrameworkTypes };
@@ -1,2 +1,3 @@
1
1
  export * from "./dataTypes/frameworkDataTypes";
2
+ export * from "./models/frameworkContexts";
2
3
  export * from "./models/frameworkTypes";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The contexts of framework data.
3
+ */
4
+ export declare const FrameworkContexts: {
5
+ /**
6
+ * Context Root.
7
+ */
8
+ readonly ContextRoot: "https://schema.twindev.org/framework/";
9
+ };
10
+ /**
11
+ * The contexts of framework data.
12
+ */
13
+ export type FrameworkContexts = (typeof FrameworkContexts)[keyof typeof FrameworkContexts];
@@ -2,10 +2,6 @@
2
2
  * The types of framework data.
3
3
  */
4
4
  export declare const FrameworkTypes: {
5
- /**
6
- * Context Root.
7
- */
8
- readonly ContextRoot: "https://schema.twindev.org/framework/";
9
5
  /**
10
6
  * Represents a urn.
11
7
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/data-framework - Changelog
2
2
 
3
- ## v0.0.1-next.26
3
+ ## v0.0.1-next.28
4
4
 
5
5
  - Initial Release
@@ -6,8 +6,10 @@
6
6
 
7
7
  ## Type Aliases
8
8
 
9
+ - [FrameworkContexts](type-aliases/FrameworkContexts.md)
9
10
  - [FrameworkTypes](type-aliases/FrameworkTypes.md)
10
11
 
11
12
  ## Variables
12
13
 
14
+ - [FrameworkContexts](variables/FrameworkContexts.md)
13
15
  - [FrameworkTypes](variables/FrameworkTypes.md)
@@ -0,0 +1,5 @@
1
+ # Type Alias: FrameworkContexts
2
+
3
+ > **FrameworkContexts**: *typeof* [`FrameworkContexts`](../variables/FrameworkContexts.md)\[keyof *typeof* [`FrameworkContexts`](../variables/FrameworkContexts.md)\]
4
+
5
+ The contexts of framework data.
@@ -0,0 +1,13 @@
1
+ # Variable: FrameworkContexts
2
+
3
+ > `const` **FrameworkContexts**: `object`
4
+
5
+ The contexts of framework data.
6
+
7
+ ## Type declaration
8
+
9
+ ### ContextRoot
10
+
11
+ > `readonly` **ContextRoot**: `"https://schema.twindev.org/framework/"` = `"https://schema.twindev.org/framework/"`
12
+
13
+ Context Root.
@@ -6,12 +6,6 @@ The types of framework data.
6
6
 
7
7
  ## Type declaration
8
8
 
9
- ### ContextRoot
10
-
11
- > `readonly` **ContextRoot**: `"https://schema.twindev.org/framework/"` = `"https://schema.twindev.org/framework/"`
12
-
13
- Context Root.
14
-
15
9
  ### Urn
16
10
 
17
11
  > `readonly` **Urn**: `"URN"` = `"URN"`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/data-framework",
3
- "version": "0.0.1-next.26",
3
+ "version": "0.0.1-next.28",
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.1-next.26",
19
- "@twin.org/data-json-ld": "0.0.1-next.26",
18
+ "@twin.org/data-core": "0.0.1-next.28",
19
+ "@twin.org/data-json-ld": "0.0.1-next.28",
20
20
  "@twin.org/entity": "next",
21
21
  "@twin.org/nameof": "next",
22
22
  "@types/json-schema": "7.0.15"