@twin.org/data-framework 0.0.1-next.3 → 0.0.1-next.31
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 +20 -6
- package/dist/esm/index.mjs +20 -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 +3 -3
- package/docs/changelog.md +46 -1
- package/docs/reference/classes/FrameworkDataTypes.md +3 -3
- package/docs/reference/index.md +2 -0
- package/docs/reference/type-aliases/FrameworkContexts.md +5 -0
- package/docs/reference/type-aliases/FrameworkTypes.md +1 -1
- package/docs/reference/variables/FrameworkContexts.md +13 -0
- package/docs/reference/variables/FrameworkTypes.md +3 -3
- package/package.json +6 -33
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
var core = require('@twin.org/core');
|
|
4
4
|
var dataCore = require('@twin.org/data-core');
|
|
5
5
|
|
|
6
|
+
// Copyright 2024 IOTA Stiftung.
|
|
7
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
8
|
+
/**
|
|
9
|
+
* The contexts of framework data.
|
|
10
|
+
*/
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
12
|
+
const FrameworkContexts = {
|
|
13
|
+
/**
|
|
14
|
+
* Context Root.
|
|
15
|
+
*/
|
|
16
|
+
ContextRoot: "https://schema.twindev.org/framework/"
|
|
17
|
+
};
|
|
18
|
+
|
|
6
19
|
// Copyright 2024 IOTA Stiftung.
|
|
7
20
|
// SPDX-License-Identifier: Apache-2.0.
|
|
8
21
|
/**
|
|
@@ -13,15 +26,15 @@ const FrameworkTypes = {
|
|
|
13
26
|
/**
|
|
14
27
|
* Represents a urn.
|
|
15
28
|
*/
|
|
16
|
-
Urn: "
|
|
29
|
+
Urn: "URN",
|
|
17
30
|
/**
|
|
18
31
|
* Represents a timestamp as an integer, milliseconds since 1 Jan 1970.
|
|
19
32
|
*/
|
|
20
|
-
TimestampMilliseconds: "
|
|
33
|
+
TimestampMilliseconds: "TimestampMilliseconds",
|
|
21
34
|
/**
|
|
22
35
|
* Represents a timestamp as an integer, seconds since 1 Jan 1970.
|
|
23
36
|
*/
|
|
24
|
-
TimestampSeconds: "
|
|
37
|
+
TimestampSeconds: "TimestampSeconds"
|
|
25
38
|
};
|
|
26
39
|
|
|
27
40
|
var type$2 = "integer";
|
|
@@ -55,19 +68,19 @@ class FrameworkDataTypes {
|
|
|
55
68
|
* Register all the data types.
|
|
56
69
|
*/
|
|
57
70
|
static registerTypes() {
|
|
58
|
-
dataCore.DataTypeHandlerFactory.register(FrameworkTypes.Urn
|
|
71
|
+
dataCore.DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.Urn}`, () => ({
|
|
59
72
|
type: FrameworkTypes.Urn,
|
|
60
73
|
defaultValue: "",
|
|
61
74
|
jsonSchema: async () => URNSchema,
|
|
62
75
|
validate: async (propertyName, value, failures, container) => core.Urn.validate(propertyName, value, failures)
|
|
63
76
|
}));
|
|
64
|
-
dataCore.DataTypeHandlerFactory.register(FrameworkTypes.TimestampMilliseconds
|
|
77
|
+
dataCore.DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.TimestampMilliseconds}`, () => ({
|
|
65
78
|
type: FrameworkTypes.TimestampMilliseconds,
|
|
66
79
|
defaultValue: Date.now(),
|
|
67
80
|
jsonSchema: async () => TimestampMillisecondsSchema,
|
|
68
81
|
validate: async (propertyName, value, failures, container) => core.Validation.timestampMilliseconds(propertyName, value, failures)
|
|
69
82
|
}));
|
|
70
|
-
dataCore.DataTypeHandlerFactory.register(FrameworkTypes.TimestampSeconds
|
|
83
|
+
dataCore.DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.TimestampSeconds}`, () => ({
|
|
71
84
|
type: FrameworkTypes.TimestampSeconds,
|
|
72
85
|
defaultValue: Math.floor(Date.now() / 1000),
|
|
73
86
|
jsonSchema: async () => TimestampSecondsSchema,
|
|
@@ -76,5 +89,6 @@ class FrameworkDataTypes {
|
|
|
76
89
|
}
|
|
77
90
|
}
|
|
78
91
|
|
|
92
|
+
exports.FrameworkContexts = FrameworkContexts;
|
|
79
93
|
exports.FrameworkDataTypes = FrameworkDataTypes;
|
|
80
94
|
exports.FrameworkTypes = FrameworkTypes;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { Urn, Validation } from '@twin.org/core';
|
|
2
2
|
import { DataTypeHandlerFactory } from '@twin.org/data-core';
|
|
3
3
|
|
|
4
|
+
// Copyright 2024 IOTA Stiftung.
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
6
|
+
/**
|
|
7
|
+
* The contexts of framework data.
|
|
8
|
+
*/
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
|
+
const FrameworkContexts = {
|
|
11
|
+
/**
|
|
12
|
+
* Context Root.
|
|
13
|
+
*/
|
|
14
|
+
ContextRoot: "https://schema.twindev.org/framework/"
|
|
15
|
+
};
|
|
16
|
+
|
|
4
17
|
// Copyright 2024 IOTA Stiftung.
|
|
5
18
|
// SPDX-License-Identifier: Apache-2.0.
|
|
6
19
|
/**
|
|
@@ -11,15 +24,15 @@ const FrameworkTypes = {
|
|
|
11
24
|
/**
|
|
12
25
|
* Represents a urn.
|
|
13
26
|
*/
|
|
14
|
-
Urn: "
|
|
27
|
+
Urn: "URN",
|
|
15
28
|
/**
|
|
16
29
|
* Represents a timestamp as an integer, milliseconds since 1 Jan 1970.
|
|
17
30
|
*/
|
|
18
|
-
TimestampMilliseconds: "
|
|
31
|
+
TimestampMilliseconds: "TimestampMilliseconds",
|
|
19
32
|
/**
|
|
20
33
|
* Represents a timestamp as an integer, seconds since 1 Jan 1970.
|
|
21
34
|
*/
|
|
22
|
-
TimestampSeconds: "
|
|
35
|
+
TimestampSeconds: "TimestampSeconds"
|
|
23
36
|
};
|
|
24
37
|
|
|
25
38
|
var type$2 = "integer";
|
|
@@ -53,19 +66,19 @@ class FrameworkDataTypes {
|
|
|
53
66
|
* Register all the data types.
|
|
54
67
|
*/
|
|
55
68
|
static registerTypes() {
|
|
56
|
-
DataTypeHandlerFactory.register(FrameworkTypes.Urn
|
|
69
|
+
DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.Urn}`, () => ({
|
|
57
70
|
type: FrameworkTypes.Urn,
|
|
58
71
|
defaultValue: "",
|
|
59
72
|
jsonSchema: async () => URNSchema,
|
|
60
73
|
validate: async (propertyName, value, failures, container) => Urn.validate(propertyName, value, failures)
|
|
61
74
|
}));
|
|
62
|
-
DataTypeHandlerFactory.register(FrameworkTypes.TimestampMilliseconds
|
|
75
|
+
DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.TimestampMilliseconds}`, () => ({
|
|
63
76
|
type: FrameworkTypes.TimestampMilliseconds,
|
|
64
77
|
defaultValue: Date.now(),
|
|
65
78
|
jsonSchema: async () => TimestampMillisecondsSchema,
|
|
66
79
|
validate: async (propertyName, value, failures, container) => Validation.timestampMilliseconds(propertyName, value, failures)
|
|
67
80
|
}));
|
|
68
|
-
DataTypeHandlerFactory.register(FrameworkTypes.TimestampSeconds
|
|
81
|
+
DataTypeHandlerFactory.register(`${FrameworkContexts.ContextRoot}${FrameworkTypes.TimestampSeconds}`, () => ({
|
|
69
82
|
type: FrameworkTypes.TimestampSeconds,
|
|
70
83
|
defaultValue: Math.floor(Date.now() / 1000),
|
|
71
84
|
jsonSchema: async () => TimestampSecondsSchema,
|
|
@@ -74,4 +87,4 @@ class FrameworkDataTypes {
|
|
|
74
87
|
}
|
|
75
88
|
}
|
|
76
89
|
|
|
77
|
-
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];
|
|
@@ -5,15 +5,15 @@ export declare const FrameworkTypes: {
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents a urn.
|
|
7
7
|
*/
|
|
8
|
-
readonly Urn: "
|
|
8
|
+
readonly Urn: "URN";
|
|
9
9
|
/**
|
|
10
10
|
* Represents a timestamp as an integer, milliseconds since 1 Jan 1970.
|
|
11
11
|
*/
|
|
12
|
-
readonly TimestampMilliseconds: "
|
|
12
|
+
readonly TimestampMilliseconds: "TimestampMilliseconds";
|
|
13
13
|
/**
|
|
14
14
|
* Represents a timestamp as an integer, seconds since 1 Jan 1970.
|
|
15
15
|
*/
|
|
16
|
-
readonly TimestampSeconds: "
|
|
16
|
+
readonly TimestampSeconds: "TimestampSeconds";
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
* The types of framework data.
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @twin.org/data-framework - Changelog
|
|
2
2
|
|
|
3
|
-
## v0.0.1-next.
|
|
3
|
+
## [0.0.1-next.31](https://github.com/twinfoundation/data/compare/data-framework-v0.0.1-next.30...data-framework-v0.0.1-next.31) (2025-05-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **data-framework:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/data-core bumped from 0.0.1-next.30 to 0.0.1-next.31
|
|
16
|
+
* @twin.org/data-json-ld bumped from 0.0.1-next.30 to 0.0.1-next.31
|
|
17
|
+
|
|
18
|
+
## [0.0.1-next.30](https://github.com/twinfoundation/data/compare/data-framework-v0.0.1-next.29...data-framework-v0.0.1-next.30) (2025-04-17)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* use shared store mechanism ([#3](https://github.com/twinfoundation/data/issues/3)) ([33eb221](https://github.com/twinfoundation/data/commit/33eb221ccec2b4a79549c06e9a04225009b93a46))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Dependencies
|
|
27
|
+
|
|
28
|
+
* The following workspace dependencies were updated
|
|
29
|
+
* dependencies
|
|
30
|
+
* @twin.org/data-core bumped from 0.0.1-next.29 to 0.0.1-next.30
|
|
31
|
+
* @twin.org/data-json-ld bumped from 0.0.1-next.29 to 0.0.1-next.30
|
|
32
|
+
|
|
33
|
+
## [0.0.1-next.29](https://github.com/twinfoundation/data/compare/data-framework-v0.0.1-next.28...data-framework-v0.0.1-next.29) (2025-03-28)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* add document cache access methods ([dbf1e36](https://github.com/twinfoundation/data/commit/dbf1e36d176c5f428f8c52628fb5a1ff7a6a174a))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Dependencies
|
|
42
|
+
|
|
43
|
+
* The following workspace dependencies were updated
|
|
44
|
+
* dependencies
|
|
45
|
+
* @twin.org/data-core bumped from 0.0.1-next.28 to 0.0.1-next.29
|
|
46
|
+
* @twin.org/data-json-ld bumped from 0.0.1-next.28 to 0.0.1-next.29
|
|
47
|
+
|
|
48
|
+
## v0.0.1-next.28
|
|
4
49
|
|
|
5
50
|
- Initial Release
|
|
@@ -4,13 +4,13 @@ Handle all the framework data types.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new FrameworkDataTypes**():
|
|
9
|
+
> **new FrameworkDataTypes**(): `FrameworkDataTypes`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`FrameworkDataTypes`
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
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)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Type Alias: FrameworkTypes
|
|
2
2
|
|
|
3
|
-
> **FrameworkTypes
|
|
3
|
+
> **FrameworkTypes** = *typeof* [`FrameworkTypes`](../variables/FrameworkTypes.md)\[keyof *typeof* [`FrameworkTypes`](../variables/FrameworkTypes.md)\]
|
|
4
4
|
|
|
5
5
|
The types 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.
|
|
@@ -8,18 +8,18 @@ The types of framework data.
|
|
|
8
8
|
|
|
9
9
|
### Urn
|
|
10
10
|
|
|
11
|
-
> `readonly` **Urn**: `"
|
|
11
|
+
> `readonly` **Urn**: `"URN"` = `"URN"`
|
|
12
12
|
|
|
13
13
|
Represents a urn.
|
|
14
14
|
|
|
15
15
|
### TimestampMilliseconds
|
|
16
16
|
|
|
17
|
-
> `readonly` **TimestampMilliseconds**: `"
|
|
17
|
+
> `readonly` **TimestampMilliseconds**: `"TimestampMilliseconds"` = `"TimestampMilliseconds"`
|
|
18
18
|
|
|
19
19
|
Represents a timestamp as an integer, milliseconds since 1 Jan 1970.
|
|
20
20
|
|
|
21
21
|
### TimestampSeconds
|
|
22
22
|
|
|
23
|
-
> `readonly` **TimestampSeconds**: `"
|
|
23
|
+
> `readonly` **TimestampSeconds**: `"TimestampSeconds"` = `"TimestampSeconds"`
|
|
24
24
|
|
|
25
25
|
Represents a timestamp as an integer, seconds since 1 Jan 1970.
|
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.31",
|
|
4
4
|
"description": "Models which define the structure of framework types",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,51 +13,24 @@
|
|
|
13
13
|
"engines": {
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"clean": "rimraf dist coverage docs/reference",
|
|
18
|
-
"build": "tspc",
|
|
19
|
-
"test": "vitest --run --config ./vitest.config.ts --no-cache",
|
|
20
|
-
"coverage": "vitest --run --coverage --config ./vitest.config.ts --no-cache",
|
|
21
|
-
"bundle:esm": "rollup --config rollup.config.mjs --environment MODULE:esm",
|
|
22
|
-
"bundle:cjs": "rollup --config rollup.config.mjs --environment MODULE:cjs",
|
|
23
|
-
"bundle": "npm run bundle:esm && npm run bundle:cjs",
|
|
24
|
-
"docs:clean": "rimraf docs/reference",
|
|
25
|
-
"docs:generate": "typedoc",
|
|
26
|
-
"docs": "npm run docs:clean && npm run docs:generate",
|
|
27
|
-
"dist": "npm run clean && npm run build && npm run test && npm run bundle && npm run docs"
|
|
28
|
-
},
|
|
29
16
|
"dependencies": {
|
|
30
17
|
"@twin.org/core": "next",
|
|
31
|
-
"@twin.org/data-core": "0.0.1-next.
|
|
32
|
-
"@twin.org/data-json-ld": "0.0.1-next.
|
|
18
|
+
"@twin.org/data-core": "0.0.1-next.31",
|
|
19
|
+
"@twin.org/data-json-ld": "0.0.1-next.31",
|
|
33
20
|
"@twin.org/entity": "next",
|
|
34
21
|
"@twin.org/nameof": "next",
|
|
35
22
|
"@types/json-schema": "7.0.15"
|
|
36
23
|
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@twin.org/nameof-transformer": "next",
|
|
39
|
-
"@rollup/plugin-json": "6.1.0",
|
|
40
|
-
"@vitest/coverage-v8": "2.1.1",
|
|
41
|
-
"copyfiles": "2.4.1",
|
|
42
|
-
"rimraf": "6.0.1",
|
|
43
|
-
"rollup": "4.22.0",
|
|
44
|
-
"rollup-plugin-typescript2": "0.36.0",
|
|
45
|
-
"ts-patch": "3.2.1",
|
|
46
|
-
"typedoc": "0.26.7",
|
|
47
|
-
"typedoc-plugin-markdown": "4.2.7",
|
|
48
|
-
"typescript": "5.6.2",
|
|
49
|
-
"vitest": "2.1.1"
|
|
50
|
-
},
|
|
51
24
|
"main": "./dist/cjs/index.cjs",
|
|
52
25
|
"module": "./dist/esm/index.mjs",
|
|
53
26
|
"types": "./dist/types/index.d.ts",
|
|
54
27
|
"exports": {
|
|
55
28
|
".": {
|
|
29
|
+
"types": "./dist/types/index.d.ts",
|
|
56
30
|
"require": "./dist/cjs/index.cjs",
|
|
57
|
-
"import": "./dist/esm/index.mjs"
|
|
58
|
-
"types": "./dist/types/index.d.ts"
|
|
31
|
+
"import": "./dist/esm/index.mjs"
|
|
59
32
|
},
|
|
60
|
-
"./locales": "./locales"
|
|
33
|
+
"./locales/*.json": "./locales/*.json"
|
|
61
34
|
},
|
|
62
35
|
"files": [
|
|
63
36
|
"dist/cjs",
|