@open-dpp/dto 0.1.2 → 0.1.4
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/aas/administrative-information-json-schema.d.ts +1 -1
- package/dist/aas/administrative-information-json-schema.d.ts.map +1 -1
- package/dist/aas/asset-administration-shell-json-schema.d.ts +1 -1
- package/dist/aas/asset-administration-shell-json-schema.d.ts.map +1 -1
- package/dist/aas/asset-administration-shell-json-schema.js +2 -2
- package/dist/aas/asset-information-json-schema.d.ts +1 -1
- package/dist/aas/asset-information-json-schema.d.ts.map +1 -1
- package/dist/aas/asset-information-json-schema.js +3 -1
- package/dist/aas/common/basic-json-schema.d.ts +1 -1
- package/dist/aas/common/basic-json-schema.d.ts.map +1 -1
- package/dist/aas/common/basic-json-schema.js +7 -4
- package/dist/aas/common/key-json-schema.d.ts +1 -1
- package/dist/aas/common/key-json-schema.d.ts.map +1 -1
- package/dist/aas/common/language-text-json-schema.d.ts +1 -1
- package/dist/aas/common/language-text-json-schema.d.ts.map +1 -1
- package/dist/aas/common/qualifier-json-schema.d.ts +1 -1
- package/dist/aas/common/qualifier-json-schema.d.ts.map +1 -1
- package/dist/aas/common/reference-json-schema.d.ts +3 -3
- package/dist/aas/common/reference-json-schema.d.ts.map +1 -1
- package/dist/aas/concept-description-json-schema.d.ts +1 -1
- package/dist/aas/concept-description-json-schema.d.ts.map +1 -1
- package/dist/aas/dto/value-response.dto.d.ts +1 -1
- package/dist/aas/dto/value-response.dto.d.ts.map +1 -1
- package/dist/aas/embedded-data-specification-json-schema.d.ts +1 -1
- package/dist/aas/embedded-data-specification-json-schema.d.ts.map +1 -1
- package/dist/aas/enums/aas-submodel-elements.d.ts +1 -1
- package/dist/aas/enums/aas-submodel-elements.d.ts.map +1 -1
- package/dist/aas/enums/aas-submodel-elements.js +18 -18
- package/dist/aas/enums/asset-kind-enum.d.ts +1 -1
- package/dist/aas/enums/asset-kind-enum.d.ts.map +1 -1
- package/dist/aas/enums/asset-kind-enum.js +2 -2
- package/dist/aas/enums/data-type-def.d.ts +1 -1
- package/dist/aas/enums/data-type-def.d.ts.map +1 -1
- package/dist/aas/enums/data-type-def.js +30 -30
- package/dist/aas/enums/entity-type-enum.d.ts +1 -1
- package/dist/aas/enums/entity-type-enum.d.ts.map +1 -1
- package/dist/aas/enums/entity-type-enum.js +2 -2
- package/dist/aas/enums/key-types-enum.d.ts +1 -1
- package/dist/aas/enums/key-types-enum.d.ts.map +1 -1
- package/dist/aas/enums/key-types-enum.js +24 -24
- package/dist/aas/enums/language-enum.d.ts +1 -1
- package/dist/aas/enums/language-enum.d.ts.map +1 -1
- package/dist/aas/enums/language-enum.js +2 -2
- package/dist/aas/enums/modelling-kind-enum.d.ts +1 -1
- package/dist/aas/enums/modelling-kind-enum.d.ts.map +1 -1
- package/dist/aas/enums/modelling-kind-enum.js +2 -2
- package/dist/aas/enums/permission-enum.d.ts +1 -1
- package/dist/aas/enums/permission-enum.d.ts.map +1 -1
- package/dist/aas/enums/permission-enum.js +4 -4
- package/dist/aas/enums/permission-kind-enum.d.ts +1 -1
- package/dist/aas/enums/permission-kind-enum.d.ts.map +1 -1
- package/dist/aas/enums/permission-kind-enum.js +1 -1
- package/dist/aas/enums/qualifier-kind-enum.d.ts +1 -1
- package/dist/aas/enums/qualifier-kind-enum.d.ts.map +1 -1
- package/dist/aas/enums/qualifier-kind-enum.js +3 -3
- package/dist/aas/enums/reference-types-enum.d.ts +1 -1
- package/dist/aas/enums/reference-types-enum.d.ts.map +1 -1
- package/dist/aas/enums/reference-types-enum.js +2 -2
- package/dist/aas/environment-json-schema.d.ts +1 -1
- package/dist/aas/environment-json-schema.d.ts.map +1 -1
- package/dist/aas/environment-json-schema.js +3 -1
- package/dist/aas/extension-json-schema.d.ts +1 -1
- package/dist/aas/extension-json-schema.d.ts.map +1 -1
- package/dist/aas/resource-json-schema.d.ts +1 -1
- package/dist/aas/resource-json-schema.d.ts.map +1 -1
- package/dist/aas/security/access-permission-rule.dto.d.ts +1 -1
- package/dist/aas/security/access-permission-rule.dto.d.ts.map +1 -1
- package/dist/aas/security/security.dto.d.ts +1 -1
- package/dist/aas/security/security.dto.d.ts.map +1 -1
- package/dist/aas/specific-asset-id-json-schema.d.ts +1 -1
- package/dist/aas/specific-asset-id-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/annotated-relationship-element-json-schema.d.ts +1 -1
- package/dist/aas/submodel-base/annotated-relationship-element-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/annotated-relationship-element-json-schema.js +3 -2
- package/dist/aas/submodel-base/blob-json-schema.d.ts +1 -1
- package/dist/aas/submodel-base/blob-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/entity-type-json-schema.d.ts +1 -1
- package/dist/aas/submodel-base/entity-type-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/entity-type-json-schema.js +1 -2
- package/dist/aas/submodel-base/file-json-schema.d.ts +1 -1
- package/dist/aas/submodel-base/file-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/multi-language-property-json-schema.d.ts +1 -1
- package/dist/aas/submodel-base/multi-language-property-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/property-json-schema.d.ts +1 -1
- package/dist/aas/submodel-base/property-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/range-json-schema.d.ts +1 -1
- package/dist/aas/submodel-base/range-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/reference-element-json-schema.d.ts +2 -2
- package/dist/aas/submodel-base/reference-element-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/relationship-element-json-schema.d.ts +1 -1
- package/dist/aas/submodel-base/relationship-element-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/submodel-base-json-schema.d.ts +1 -1
- package/dist/aas/submodel-base/submodel-base-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/submodel-base-json-schema.js +3 -1
- package/dist/aas/submodel-base/submodel-element-collection-json-schema.d.ts +1 -1
- package/dist/aas/submodel-base/submodel-element-collection-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/submodel-element-collection-json-schema.js +7 -4
- package/dist/aas/submodel-base/submodel-element-list-json-schema.d.ts +1 -1
- package/dist/aas/submodel-base/submodel-element-list-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/submodel-element-list-json-schema.js +7 -4
- package/dist/aas/submodel-base/submodel-element-modification-schema.d.ts +1 -1
- package/dist/aas/submodel-base/submodel-element-modification-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/submodel-element-modification-schema.js +3 -1
- package/dist/aas/submodel-base/submodel-element-schema.d.ts +1 -1
- package/dist/aas/submodel-base/submodel-element-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/submodel-element-schema.js +12 -5
- package/dist/aas/submodel-base/submodel-json-schema.d.ts +1 -1
- package/dist/aas/submodel-base/submodel-json-schema.d.ts.map +1 -1
- package/dist/aas/submodel-base/submodel-json-schema.js +5 -3
- package/dist/branding/branding.dto.d.ts +1 -1
- package/dist/branding/branding.dto.d.ts.map +1 -1
- package/dist/index.d.ts +56 -56
- package/dist/index.d.ts.map +1 -1
- package/dist/organizations/member.dto.d.ts +1 -1
- package/dist/organizations/member.dto.d.ts.map +1 -1
- package/dist/passports/passport.dto.d.ts +1 -1
- package/dist/passports/passport.dto.d.ts.map +1 -1
- package/dist/passports/passport.dto.js +4 -2
- package/dist/shared/dpp.schemas.d.ts +1 -1
- package/dist/shared/dpp.schemas.d.ts.map +1 -1
- package/dist/shared/pagination.dto.d.ts +1 -1
- package/dist/shared/pagination.dto.d.ts.map +1 -1
- package/dist/shared/populate.dto.d.ts +1 -1
- package/dist/shared/populate.dto.d.ts.map +1 -1
- package/dist/shared/populate.dto.js +6 -6
- package/dist/shared/table.dto.d.ts +1 -1
- package/dist/shared/table.dto.d.ts.map +1 -1
- package/dist/status/status.dto.d.ts +1 -1
- package/dist/status/status.dto.d.ts.map +1 -1
- package/dist/templates/template.dto.d.ts +1 -1
- package/dist/templates/template.dto.d.ts.map +1 -1
- package/dist/templates/template.dto.js +4 -2
- package/dist/users/create-user.dto.d.ts +1 -1
- package/dist/users/create-user.dto.d.ts.map +1 -1
- package/dist/users/set-user-role.dto.d.ts +1 -1
- package/dist/users/set-user-role.dto.d.ts.map +1 -1
- package/dist/users/set-user-role.dto.js +1 -1
- package/dist/users/user.dto.d.ts +1 -1
- package/dist/users/user.dto.d.ts.map +1 -1
- package/dist/users/user.dto.js +5 -5
- package/package.json +14 -19
- package/src/aas/aas-json-schemas.spec.ts +68 -67
- package/src/aas/administrative-information-json-schema.ts +2 -2
- package/src/aas/asset-administration-shell-json-schema.ts +32 -24
- package/src/aas/asset-information-json-schema.ts +10 -8
- package/src/aas/common/basic-json-schema.ts +18 -15
- package/src/aas/common/key-json-schema.ts +4 -4
- package/src/aas/common/language-text-json-schema.ts +4 -4
- package/src/aas/common/qualifier-json-schema.ts +5 -5
- package/src/aas/common/reference-json-schema.ts +13 -13
- package/src/aas/concept-description-json-schema.ts +7 -7
- package/src/aas/dto/value-response.dto.spec.ts +21 -15
- package/src/aas/dto/value-response.dto.ts +4 -4
- package/src/aas/embedded-data-specification-json-schema.ts +3 -3
- package/src/aas/enums/aas-submodel-elements.ts +22 -22
- package/src/aas/enums/asset-kind-enum.ts +6 -6
- package/src/aas/enums/data-type-def.ts +34 -34
- package/src/aas/enums/entity-type-enum.ts +6 -6
- package/src/aas/enums/key-types-enum.ts +28 -28
- package/src/aas/enums/language-enum.ts +6 -6
- package/src/aas/enums/modelling-kind-enum.ts +6 -6
- package/src/aas/enums/permission-enum.ts +8 -8
- package/src/aas/enums/permission-kind-enum.ts +5 -5
- package/src/aas/enums/qualifier-kind-enum.ts +7 -7
- package/src/aas/enums/reference-types-enum.ts +6 -6
- package/src/aas/environment-json-schema.ts +8 -6
- package/src/aas/extension-json-schema.ts +4 -4
- package/src/aas/resource-json-schema.ts +2 -2
- package/src/aas/security/access-permission-rule.dto.ts +12 -12
- package/src/aas/security/security.dto.ts +10 -7
- package/src/aas/specific-asset-id-json-schema.ts +3 -3
- package/src/aas/submodel-base/annotated-relationship-element-json-schema.ts +10 -10
- package/src/aas/submodel-base/blob-json-schema.ts +4 -4
- package/src/aas/submodel-base/entity-type-json-schema.ts +9 -11
- package/src/aas/submodel-base/file-json-schema.ts +11 -8
- package/src/aas/submodel-base/multi-language-property-json-schema.ts +6 -6
- package/src/aas/submodel-base/property-json-schema.ts +13 -10
- package/src/aas/submodel-base/range-json-schema.ts +5 -5
- package/src/aas/submodel-base/reference-element-json-schema.ts +13 -10
- package/src/aas/submodel-base/relationship-element-json-schema.ts +5 -5
- package/src/aas/submodel-base/submodel-base-json-schema.ts +10 -8
- package/src/aas/submodel-base/submodel-element-collection-json-schema.ts +28 -17
- package/src/aas/submodel-base/submodel-element-list-json-schema.ts +27 -20
- package/src/aas/submodel-base/submodel-element-modification-schema.ts +6 -4
- package/src/aas/submodel-base/submodel-element-schema.ts +37 -30
- package/src/aas/submodel-base/submodel-json-schema.ts +28 -25
- package/src/branding/branding.dto.ts +3 -3
- package/src/index.ts +56 -56
- package/src/organizations/member.dto.ts +8 -8
- package/src/passports/passport.dto.ts +15 -13
- package/src/shared/dpp.schemas.ts +8 -7
- package/src/shared/pagination.dto.ts +6 -6
- package/src/shared/populate.dto.ts +8 -11
- package/src/shared/table.dto.ts +3 -3
- package/src/status/status.dto.ts +3 -3
- package/src/templates/template.dto.ts +15 -13
- package/src/users/create-user.dto.ts +3 -3
- package/src/users/set-user-role.dto.ts +4 -4
- package/src/users/user.dto.ts +19 -19
|
@@ -1,145 +1,146 @@
|
|
|
1
|
-
import { expect } from
|
|
2
|
-
import { z } from
|
|
3
|
-
import { DataTypeDef } from
|
|
1
|
+
import { expect } from "@jest/globals";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { DataTypeDef } from "./enums/data-type-def";
|
|
4
4
|
|
|
5
|
-
import { SubmodelElementSchema } from
|
|
5
|
+
import { SubmodelElementSchema } from "./submodel-base/submodel-element-schema";
|
|
6
6
|
|
|
7
|
-
describe(
|
|
8
|
-
it(
|
|
7
|
+
describe("zod-schemas", () => {
|
|
8
|
+
it("should parse discriminated union correctly", () => {
|
|
9
9
|
const schema = z.object({
|
|
10
10
|
submodels: SubmodelElementSchema.array(),
|
|
11
|
-
})
|
|
11
|
+
});
|
|
12
12
|
|
|
13
13
|
const submodels = [
|
|
14
14
|
{
|
|
15
|
-
modelType:
|
|
16
|
-
idShort:
|
|
15
|
+
modelType: "Property",
|
|
16
|
+
idShort: "test",
|
|
17
17
|
valueType: DataTypeDef.Double,
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
modelType:
|
|
21
|
-
entityType:
|
|
20
|
+
modelType: "Entity",
|
|
21
|
+
entityType: "CoManagedEntity",
|
|
22
22
|
statements: [
|
|
23
23
|
{
|
|
24
|
-
modelType:
|
|
25
|
-
entityType:
|
|
24
|
+
modelType: "Entity",
|
|
25
|
+
entityType: "CoManagedEntity",
|
|
26
26
|
statements: [
|
|
27
27
|
{
|
|
28
|
-
modelType:
|
|
29
|
-
value:
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
modelType: "Property",
|
|
29
|
+
value:
|
|
30
|
+
"http://shells.smartfactory.de/aHR0cHM6Ly9zbWFydGZhY3RvcnkuZGUvc2hlbGxzLy1TUjdCYm5jSkc",
|
|
31
|
+
valueType: "xs:string",
|
|
32
|
+
category: "CONSTANT",
|
|
32
33
|
description: [
|
|
33
34
|
{
|
|
34
|
-
language:
|
|
35
|
-
text:
|
|
35
|
+
language: "en",
|
|
36
|
+
text: "URL of the application",
|
|
36
37
|
},
|
|
37
38
|
{
|
|
38
|
-
language:
|
|
39
|
-
text:
|
|
39
|
+
language: "de",
|
|
40
|
+
text: "URL der Anwendung",
|
|
40
41
|
},
|
|
41
42
|
],
|
|
42
|
-
idShort:
|
|
43
|
+
idShort: "ApplicationURL",
|
|
43
44
|
},
|
|
44
45
|
],
|
|
45
46
|
semanticId: {
|
|
46
47
|
keys: [
|
|
47
48
|
{
|
|
48
|
-
type:
|
|
49
|
-
value:
|
|
49
|
+
type: "GlobalReference",
|
|
50
|
+
value: "https://admin-shell.io/idta/HierarchicalStructures/Node/1/0",
|
|
50
51
|
},
|
|
51
52
|
],
|
|
52
|
-
type:
|
|
53
|
+
type: "ExternalReference",
|
|
53
54
|
},
|
|
54
55
|
description: [
|
|
55
56
|
{
|
|
56
|
-
language:
|
|
57
|
-
text:
|
|
57
|
+
language: "en",
|
|
58
|
+
text: "SmartFactoryKL ShellScape",
|
|
58
59
|
},
|
|
59
60
|
{
|
|
60
|
-
language:
|
|
61
|
-
text:
|
|
61
|
+
language: "de",
|
|
62
|
+
text: "SmartFactoryKL ShellScape",
|
|
62
63
|
},
|
|
63
64
|
],
|
|
64
|
-
idShort:
|
|
65
|
+
idShort: "SmartFactoryShellScape",
|
|
65
66
|
},
|
|
66
67
|
{
|
|
67
|
-
modelType:
|
|
68
|
-
entityType:
|
|
68
|
+
modelType: "Entity",
|
|
69
|
+
entityType: "CoManagedEntity",
|
|
69
70
|
statements: [
|
|
70
71
|
{
|
|
71
|
-
modelType:
|
|
72
|
-
value:
|
|
73
|
-
valueType:
|
|
74
|
-
category:
|
|
72
|
+
modelType: "Property",
|
|
73
|
+
value: "https://oncite.apps.c01.demo.oncite.io/core/productionview/#/workorder",
|
|
74
|
+
valueType: "xs:string",
|
|
75
|
+
category: "CONSTANT",
|
|
75
76
|
description: [
|
|
76
77
|
{
|
|
77
|
-
language:
|
|
78
|
-
text:
|
|
78
|
+
language: "en",
|
|
79
|
+
text: "URL of the application",
|
|
79
80
|
},
|
|
80
81
|
{
|
|
81
|
-
language:
|
|
82
|
-
text:
|
|
82
|
+
language: "de",
|
|
83
|
+
text: "URL der Anwendung",
|
|
83
84
|
},
|
|
84
85
|
],
|
|
85
|
-
idShort:
|
|
86
|
+
idShort: "ApplicationURL",
|
|
86
87
|
},
|
|
87
88
|
{
|
|
88
|
-
modelType:
|
|
89
|
-
value:
|
|
90
|
-
valueType:
|
|
91
|
-
category:
|
|
89
|
+
modelType: "Property",
|
|
90
|
+
value: "https://oncite.apps.c01.demo.oncite.io/hmi/#/workorder-list",
|
|
91
|
+
valueType: "xs:string",
|
|
92
|
+
category: "CONSTANT",
|
|
92
93
|
description: [
|
|
93
94
|
{
|
|
94
|
-
language:
|
|
95
|
-
text:
|
|
95
|
+
language: "en",
|
|
96
|
+
text: "URL of the digital production system hmi client",
|
|
96
97
|
},
|
|
97
98
|
{
|
|
98
|
-
language:
|
|
99
|
-
text:
|
|
99
|
+
language: "de",
|
|
100
|
+
text: "URL des HMI Clients des digitalen Produktionssystem",
|
|
100
101
|
},
|
|
101
102
|
],
|
|
102
|
-
idShort:
|
|
103
|
+
idShort: "HMI_Client",
|
|
103
104
|
},
|
|
104
105
|
],
|
|
105
106
|
semanticId: {
|
|
106
107
|
keys: [
|
|
107
108
|
{
|
|
108
|
-
type:
|
|
109
|
-
value:
|
|
109
|
+
type: "GlobalReference",
|
|
110
|
+
value: "https://admin-shell.io/idta/HierarchicalStructures/Node/1/0",
|
|
110
111
|
},
|
|
111
112
|
],
|
|
112
|
-
type:
|
|
113
|
+
type: "ExternalReference",
|
|
113
114
|
},
|
|
114
115
|
description: [
|
|
115
116
|
{
|
|
116
|
-
language:
|
|
117
|
-
text:
|
|
117
|
+
language: "en",
|
|
118
|
+
text: "DigitalProductionSystem (German Edge Cloud)",
|
|
118
119
|
},
|
|
119
120
|
{
|
|
120
|
-
language:
|
|
121
|
-
text:
|
|
121
|
+
language: "de",
|
|
122
|
+
text: "DigitalProductionSystem (German Edge Cloud)",
|
|
122
123
|
},
|
|
123
124
|
],
|
|
124
|
-
idShort:
|
|
125
|
+
idShort: "DigitalProductionSystem",
|
|
125
126
|
},
|
|
126
127
|
],
|
|
127
128
|
semanticId: {
|
|
128
129
|
keys: [
|
|
129
130
|
{
|
|
130
|
-
type:
|
|
131
|
-
value:
|
|
131
|
+
type: "GlobalReference",
|
|
132
|
+
value: "https://admin-shell.io/idta/HierarchicalStructures/EntryNode/1/0",
|
|
132
133
|
},
|
|
133
134
|
],
|
|
134
|
-
type:
|
|
135
|
+
type: "ExternalReference",
|
|
135
136
|
},
|
|
136
|
-
idShort:
|
|
137
|
+
idShort: "BillOfApplications",
|
|
137
138
|
},
|
|
138
|
-
]
|
|
139
|
+
];
|
|
139
140
|
|
|
140
141
|
const parsed = schema.safeParse({
|
|
141
142
|
submodels,
|
|
142
|
-
})
|
|
143
|
-
expect(parsed.success).toBeTruthy()
|
|
144
|
-
})
|
|
145
|
-
})
|
|
143
|
+
});
|
|
144
|
+
expect(parsed.success).toBeTruthy();
|
|
145
|
+
});
|
|
146
|
+
});
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { PagingMetadataDtoSchema } from
|
|
3
|
-
import { AdministrativeInformationJsonSchema } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PagingMetadataDtoSchema } from "../shared/pagination.dto";
|
|
3
|
+
import { AdministrativeInformationJsonSchema } from "./administrative-information-json-schema";
|
|
4
|
+
import {
|
|
5
|
+
AssetInformationJsonSchema,
|
|
6
|
+
AssetInformationModificationSchema,
|
|
7
|
+
} from "./asset-information-json-schema";
|
|
8
|
+
import { NameAndDescriptionModificationSchema } from "./common/basic-json-schema";
|
|
9
|
+
import { LanguageTextJsonSchema } from "./common/language-text-json-schema";
|
|
10
|
+
import { ReferenceJsonSchema } from "./common/reference-json-schema";
|
|
11
|
+
import { EmbeddedDataSpecificationJsonSchema } from "./embedded-data-specification-json-schema";
|
|
12
|
+
import { ExtensionJsonSchema } from "./extension-json-schema";
|
|
13
|
+
import { ResourceJsonSchema } from "./resource-json-schema";
|
|
14
|
+
import { SecurityDtoSchema } from "./security/security.dto";
|
|
12
15
|
|
|
13
16
|
export const AssetAdministrationShellJsonSchema = z.object({
|
|
14
|
-
id: z.string().meta({ description:
|
|
17
|
+
id: z.string().meta({ description: "Id of the AAS" }),
|
|
15
18
|
assetInformation: AssetInformationJsonSchema,
|
|
16
19
|
extensions: ExtensionJsonSchema.array().default([]),
|
|
17
20
|
category: z.nullish(z.string()),
|
|
@@ -23,30 +26,35 @@ export const AssetAdministrationShellJsonSchema = z.object({
|
|
|
23
26
|
derivedFrom: z.nullish(ResourceJsonSchema),
|
|
24
27
|
submodels: ReferenceJsonSchema.array().default([]),
|
|
25
28
|
security: SecurityDtoSchema,
|
|
26
|
-
})
|
|
29
|
+
});
|
|
27
30
|
export const AssetAdministrationShellPaginationResponseDtoSchema = z
|
|
28
31
|
.object({
|
|
29
32
|
...PagingMetadataDtoSchema.shape,
|
|
30
33
|
result: AssetAdministrationShellJsonSchema.array(),
|
|
31
34
|
})
|
|
32
|
-
.meta({ id:
|
|
35
|
+
.meta({ id: "AssetAdministrationShells" });
|
|
33
36
|
export type AssetAdministrationShellPaginationResponseDto = z.infer<
|
|
34
37
|
typeof AssetAdministrationShellPaginationResponseDtoSchema
|
|
35
|
-
|
|
38
|
+
>;
|
|
36
39
|
export const AssetAdministrationShellCreateDtoSchema = AssetAdministrationShellJsonSchema.pick({
|
|
37
40
|
displayName: true,
|
|
38
41
|
description: true,
|
|
39
|
-
})
|
|
40
|
-
export type AssetAdministrationShellCreateDto = z.input<
|
|
41
|
-
|
|
42
|
+
});
|
|
43
|
+
export type AssetAdministrationShellCreateDto = z.input<
|
|
44
|
+
typeof AssetAdministrationShellCreateDtoSchema
|
|
45
|
+
>;
|
|
46
|
+
export type AssetAdministrationShellResponseDto = z.infer<
|
|
47
|
+
typeof AssetAdministrationShellJsonSchema
|
|
48
|
+
>;
|
|
42
49
|
|
|
43
|
-
export type AssetAdministrationShellRequestDto = z.input<typeof AssetAdministrationShellJsonSchema
|
|
50
|
+
export type AssetAdministrationShellRequestDto = z.input<typeof AssetAdministrationShellJsonSchema>;
|
|
44
51
|
|
|
45
|
-
export const AssetAdministrationShellModificationSchema =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
export const AssetAdministrationShellModificationSchema =
|
|
53
|
+
NameAndDescriptionModificationSchema.extend({
|
|
54
|
+
assetInformation: AssetInformationModificationSchema.optional(),
|
|
55
|
+
security: SecurityDtoSchema.optional(),
|
|
56
|
+
});
|
|
49
57
|
|
|
50
58
|
export type AssetAdministrationShellModificationDto = z.infer<
|
|
51
59
|
typeof AssetAdministrationShellModificationSchema
|
|
52
|
-
|
|
60
|
+
>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { AssetKindEnum } from
|
|
3
|
-
import { ResourceJsonSchema } from
|
|
4
|
-
import { SpecificAssetIdJsonSchema } from
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AssetKindEnum } from "./enums/asset-kind-enum";
|
|
3
|
+
import { ResourceJsonSchema } from "./resource-json-schema";
|
|
4
|
+
import { SpecificAssetIdJsonSchema } from "./specific-asset-id-json-schema";
|
|
5
5
|
|
|
6
6
|
export const AssetInformationJsonSchema = z.object({
|
|
7
7
|
assetKind: AssetKindEnum,
|
|
@@ -9,10 +9,12 @@ export const AssetInformationJsonSchema = z.object({
|
|
|
9
9
|
specificAssetIds: SpecificAssetIdJsonSchema.array().default([]),
|
|
10
10
|
assetType: z.nullish(z.string()),
|
|
11
11
|
defaultThumbnails: ResourceJsonSchema.array().default([]),
|
|
12
|
-
})
|
|
12
|
+
});
|
|
13
13
|
|
|
14
|
-
export type AssetInformationDto = z.infer<typeof AssetInformationJsonSchema
|
|
14
|
+
export type AssetInformationDto = z.infer<typeof AssetInformationJsonSchema>;
|
|
15
15
|
|
|
16
|
-
export const AssetInformationModificationSchema = AssetInformationJsonSchema.pick({
|
|
16
|
+
export const AssetInformationModificationSchema = AssetInformationJsonSchema.pick({
|
|
17
|
+
defaultThumbnails: true,
|
|
18
|
+
}).partial();
|
|
17
19
|
|
|
18
|
-
export type AssetInformationModificationDto = z.input<typeof AssetInformationModificationSchema
|
|
20
|
+
export type AssetInformationModificationDto = z.input<typeof AssetInformationModificationSchema>;
|
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { DataTypeDef, DataTypeDefEnum } from
|
|
3
|
-
import { LanguageTextJsonSchema } from
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { DataTypeDef, DataTypeDefEnum } from "../enums/data-type-def";
|
|
3
|
+
import { LanguageTextJsonSchema } from "./language-text-json-schema";
|
|
4
4
|
|
|
5
|
-
export const ValueTypeSchema = z
|
|
6
|
-
(
|
|
5
|
+
export const ValueTypeSchema = z
|
|
6
|
+
.string()
|
|
7
|
+
.overwrite((value) => {
|
|
7
8
|
// turn "positiveInteger" → "PositiveInteger"
|
|
8
|
-
let key = value
|
|
9
|
-
if (value.startsWith(
|
|
10
|
-
const raw = value.replace(/^xs:/,
|
|
11
|
-
key = raw.charAt(0).toUpperCase() + raw.slice(1)
|
|
9
|
+
let key = value;
|
|
10
|
+
if (value.startsWith("xs:")) {
|
|
11
|
+
const raw = value.replace(/^xs:/, "");
|
|
12
|
+
key = raw.charAt(0).toUpperCase() + raw.slice(1);
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
// validate against enum
|
|
15
16
|
if (!(key in DataTypeDef)) {
|
|
16
|
-
throw new Error(`Unknown number type: ${value}`)
|
|
17
|
+
throw new Error(`Unknown number type: ${value}`);
|
|
17
18
|
}
|
|
18
|
-
return key
|
|
19
|
-
}
|
|
20
|
-
|
|
19
|
+
return key;
|
|
20
|
+
})
|
|
21
|
+
.pipe(DataTypeDefEnum);
|
|
21
22
|
|
|
22
23
|
export const NameAndDescriptionModificationSchema = z.object({
|
|
23
24
|
displayName: LanguageTextJsonSchema.array().optional(),
|
|
24
25
|
description: LanguageTextJsonSchema.array().optional(),
|
|
25
|
-
})
|
|
26
|
+
});
|
|
26
27
|
|
|
27
|
-
export type NameAndDescriptionModificationDto = z.infer<
|
|
28
|
+
export type NameAndDescriptionModificationDto = z.infer<
|
|
29
|
+
typeof NameAndDescriptionModificationSchema
|
|
30
|
+
>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
import { KeyTypesEnum } from
|
|
3
|
+
import { KeyTypesEnum } from "../enums/key-types-enum";
|
|
4
4
|
|
|
5
5
|
export const KeyJsonSchema = z.object({
|
|
6
6
|
type: KeyTypesEnum,
|
|
7
7
|
value: z.string(),
|
|
8
|
-
})
|
|
8
|
+
});
|
|
9
9
|
|
|
10
|
-
export const KeyModificationSchema = KeyJsonSchema
|
|
10
|
+
export const KeyModificationSchema = KeyJsonSchema;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
import { LanguageEnum } from
|
|
3
|
+
import { LanguageEnum } from "../enums/language-enum";
|
|
4
4
|
|
|
5
5
|
export const LanguageTextJsonSchema = z.object({
|
|
6
6
|
language: LanguageEnum,
|
|
7
7
|
text: z.string(),
|
|
8
|
-
})
|
|
8
|
+
});
|
|
9
9
|
|
|
10
|
-
export type LanguageTextDto = z.infer<typeof LanguageTextJsonSchema
|
|
10
|
+
export type LanguageTextDto = z.infer<typeof LanguageTextJsonSchema>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { QualifierKindEnum } from
|
|
3
|
-
import { ValueTypeSchema } from
|
|
4
|
-
import { ReferenceJsonSchema } from
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { QualifierKindEnum } from "../enums/qualifier-kind-enum";
|
|
3
|
+
import { ValueTypeSchema } from "./basic-json-schema";
|
|
4
|
+
import { ReferenceJsonSchema } from "./reference-json-schema";
|
|
5
5
|
|
|
6
6
|
export const QualifierJsonSchema = z.object({
|
|
7
7
|
type: z.string(),
|
|
@@ -11,4 +11,4 @@ export const QualifierJsonSchema = z.object({
|
|
|
11
11
|
kind: QualifierKindEnum,
|
|
12
12
|
value: z.string().nullish(),
|
|
13
13
|
valueId: ReferenceJsonSchema.nullish(),
|
|
14
|
-
})
|
|
14
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { KeyTypesType } from
|
|
2
|
-
import type { ReferenceTypesType } from
|
|
3
|
-
import { z } from
|
|
4
|
-
import { ReferenceTypesEnum } from
|
|
5
|
-
import { KeyJsonSchema, KeyModificationSchema } from
|
|
1
|
+
import type { KeyTypesType } from "../enums/key-types-enum";
|
|
2
|
+
import type { ReferenceTypesType } from "../enums/reference-types-enum";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { ReferenceTypesEnum } from "../enums/reference-types-enum";
|
|
5
|
+
import { KeyJsonSchema, KeyModificationSchema } from "./key-json-schema";
|
|
6
6
|
|
|
7
7
|
export const ReferenceJsonSchema: z.ZodType<any> = z.lazy(() =>
|
|
8
8
|
z.object({
|
|
@@ -10,18 +10,18 @@ export const ReferenceJsonSchema: z.ZodType<any> = z.lazy(() =>
|
|
|
10
10
|
referredSemanticId: ReferenceJsonSchema.nullish(),
|
|
11
11
|
keys: z.array(KeyJsonSchema),
|
|
12
12
|
}),
|
|
13
|
-
)
|
|
13
|
+
);
|
|
14
14
|
|
|
15
15
|
export interface ReferenceValue {
|
|
16
|
-
type: ReferenceTypesType
|
|
17
|
-
referredSemanticId: ReferenceValue | null
|
|
18
|
-
keys: { type: KeyTypesType
|
|
16
|
+
type: ReferenceTypesType;
|
|
17
|
+
referredSemanticId: ReferenceValue | null;
|
|
18
|
+
keys: { type: KeyTypesType; value: string }[];
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface ReferenceModification {
|
|
22
|
-
type?: ReferenceTypesType
|
|
23
|
-
referredSemanticId?: ReferenceModification | null
|
|
24
|
-
keys?: { type: KeyTypesType
|
|
22
|
+
type?: ReferenceTypesType;
|
|
23
|
+
referredSemanticId?: ReferenceModification | null;
|
|
24
|
+
keys?: { type: KeyTypesType; value: string }[];
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export const ReferenceModificationSchema: z.ZodType<ReferenceModification> = z.lazy(() =>
|
|
@@ -30,4 +30,4 @@ export const ReferenceModificationSchema: z.ZodType<ReferenceModification> = z.l
|
|
|
30
30
|
referredSemanticId: ReferenceModificationSchema.nullish(),
|
|
31
31
|
keys: z.array(KeyModificationSchema).optional(),
|
|
32
32
|
}),
|
|
33
|
-
)
|
|
33
|
+
);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { AdministrativeInformationJsonSchema } from
|
|
3
|
-
import { LanguageTextJsonSchema } from
|
|
4
|
-
import { ReferenceJsonSchema } from
|
|
5
|
-
import { EmbeddedDataSpecificationJsonSchema } from
|
|
6
|
-
import { ExtensionJsonSchema } from
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AdministrativeInformationJsonSchema } from "./administrative-information-json-schema";
|
|
3
|
+
import { LanguageTextJsonSchema } from "./common/language-text-json-schema";
|
|
4
|
+
import { ReferenceJsonSchema } from "./common/reference-json-schema";
|
|
5
|
+
import { EmbeddedDataSpecificationJsonSchema } from "./embedded-data-specification-json-schema";
|
|
6
|
+
import { ExtensionJsonSchema } from "./extension-json-schema";
|
|
7
7
|
|
|
8
8
|
export const ConceptDescriptionJsonSchema = z.object({
|
|
9
9
|
id: z.string(),
|
|
@@ -16,4 +16,4 @@ export const ConceptDescriptionJsonSchema = z.object({
|
|
|
16
16
|
administration: z.nullish(AdministrativeInformationJsonSchema),
|
|
17
17
|
embeddedDataSpecifications: EmbeddedDataSpecificationJsonSchema.array().default([]),
|
|
18
18
|
isCaseOf: ReferenceJsonSchema.array().default([]),
|
|
19
|
-
})
|
|
19
|
+
});
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import type { ValueResponseDto } from
|
|
2
|
-
import { expect } from
|
|
3
|
-
import { ValueSchema } from
|
|
1
|
+
import type { ValueResponseDto } from "./value-response.dto";
|
|
2
|
+
import { expect } from "@jest/globals";
|
|
3
|
+
import { ValueSchema } from "./value-response.dto";
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
it(
|
|
7
|
-
const value: ValueResponseDto = {
|
|
8
|
-
{
|
|
9
|
-
|
|
5
|
+
describe("valueResponseDto", () => {
|
|
6
|
+
it("parses value", () => {
|
|
7
|
+
const value: ValueResponseDto = {
|
|
8
|
+
Design_V01: {
|
|
9
|
+
AdditionalInformation: {
|
|
10
|
+
MultilanguageProp: [
|
|
11
|
+
{
|
|
12
|
+
de: "Schnelle Übersicht",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
en: "Quick Overview",
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
10
19
|
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
expect(ValueSchema.safeParse(value).success).toBeTruthy()
|
|
16
|
-
})
|
|
17
|
-
})
|
|
20
|
+
};
|
|
21
|
+
expect(ValueSchema.safeParse(value).success).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
export const ValueSchema = z.json()
|
|
3
|
+
export const ValueSchema = z.json();
|
|
4
4
|
|
|
5
|
-
export type ValueRequestDto = z.input<typeof ValueSchema
|
|
5
|
+
export type ValueRequestDto = z.input<typeof ValueSchema>;
|
|
6
6
|
|
|
7
|
-
export type ValueResponseDto = z.infer<typeof ValueSchema
|
|
7
|
+
export type ValueResponseDto = z.infer<typeof ValueSchema>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { ReferenceJsonSchema } from
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ReferenceJsonSchema } from "./common/reference-json-schema";
|
|
3
3
|
|
|
4
4
|
export const EmbeddedDataSpecificationJsonSchema = z.object({
|
|
5
5
|
dataSpecification: ReferenceJsonSchema,
|
|
6
|
-
})
|
|
6
|
+
});
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
export const AasSubmodelElements = {
|
|
4
|
-
AnnotatedRelationshipElement:
|
|
5
|
-
BasicEventElement:
|
|
6
|
-
Blob:
|
|
7
|
-
Capability:
|
|
8
|
-
ConceptDescription:
|
|
9
|
-
DataElement:
|
|
10
|
-
Entity:
|
|
11
|
-
EventElement:
|
|
12
|
-
File:
|
|
13
|
-
MultiLanguageProperty:
|
|
14
|
-
Operation:
|
|
15
|
-
Property:
|
|
16
|
-
Range:
|
|
17
|
-
ReferenceElement:
|
|
18
|
-
RelationshipElement:
|
|
19
|
-
SubmodelElement:
|
|
20
|
-
SubmodelElementList:
|
|
21
|
-
SubmodelElementCollection:
|
|
22
|
-
} as const
|
|
4
|
+
AnnotatedRelationshipElement: "AnnotatedRelationshipElement",
|
|
5
|
+
BasicEventElement: "BasicEventElement",
|
|
6
|
+
Blob: "Blob",
|
|
7
|
+
Capability: "Capability",
|
|
8
|
+
ConceptDescription: "ConceptDescription",
|
|
9
|
+
DataElement: "DataElement",
|
|
10
|
+
Entity: "Entity",
|
|
11
|
+
EventElement: "EventElement",
|
|
12
|
+
File: "File",
|
|
13
|
+
MultiLanguageProperty: "MultiLanguageProperty",
|
|
14
|
+
Operation: "Operation",
|
|
15
|
+
Property: "Property",
|
|
16
|
+
Range: "Range",
|
|
17
|
+
ReferenceElement: "ReferenceElement",
|
|
18
|
+
RelationshipElement: "RelationshipElement",
|
|
19
|
+
SubmodelElement: "SubmodelElement",
|
|
20
|
+
SubmodelElementList: "SubmodelElementList",
|
|
21
|
+
SubmodelElementCollection: "SubmodelElementCollection",
|
|
22
|
+
} as const;
|
|
23
23
|
|
|
24
|
-
export const AasSubmodelElementsEnum = z.enum(AasSubmodelElements)
|
|
25
|
-
export type AasSubmodelElementsType = z.infer<typeof AasSubmodelElementsEnum
|
|
24
|
+
export const AasSubmodelElementsEnum = z.enum(AasSubmodelElements);
|
|
25
|
+
export type AasSubmodelElementsType = z.infer<typeof AasSubmodelElementsEnum>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
export const AssetKind = {
|
|
4
|
-
Type:
|
|
5
|
-
Instance:
|
|
6
|
-
} as const
|
|
7
|
-
export const AssetKindEnum = z.enum(AssetKind)
|
|
8
|
-
export type AssetKindType = z.infer<typeof AssetKindEnum
|
|
4
|
+
Type: "Type",
|
|
5
|
+
Instance: "Instance",
|
|
6
|
+
} as const;
|
|
7
|
+
export const AssetKindEnum = z.enum(AssetKind);
|
|
8
|
+
export type AssetKindType = z.infer<typeof AssetKindEnum>;
|