@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.
- package/dist/cjs/index.cjs +16 -6
- package/dist/esm/index.mjs +16 -7
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/frameworkContexts.d.ts +13 -0
- package/dist/types/models/frameworkTypes.d.ts +0 -4
- package/docs/changelog.md +1 -1
- package/docs/reference/index.md +2 -0
- package/docs/reference/type-aliases/FrameworkContexts.md +5 -0
- package/docs/reference/variables/FrameworkContexts.md +13 -0
- package/docs/reference/variables/FrameworkTypes.md +0 -6
- package/package.json +3 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -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
|
|
9
|
+
* The contexts of framework data.
|
|
10
10
|
*/
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
12
|
-
const
|
|
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(`${
|
|
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(`${
|
|
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(`${
|
|
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;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -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
|
|
7
|
+
* The contexts of framework data.
|
|
8
8
|
*/
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
|
-
const
|
|
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(`${
|
|
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(`${
|
|
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(`${
|
|
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 };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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];
|
package/docs/changelog.md
CHANGED
package/docs/reference/index.md
CHANGED
|
@@ -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,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.
|
|
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.
|
|
19
|
-
"@twin.org/data-json-ld": "0.0.1-next.
|
|
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"
|