@twin.org/standards-vda 0.0.1-next.21
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/LICENSE +201 -0
- package/README.md +21 -0
- package/dist/cjs/index.cjs +334 -0
- package/dist/esm/index.mjs +327 -0
- package/dist/types/identifiers/vdaIdentifiers.d.ts +9 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/models/IVdaBizLocation.d.ts +14 -0
- package/dist/types/models/IVdaCommon.d.ts +13 -0
- package/dist/types/models/IVdaObjectIdentifier.d.ts +18 -0
- package/dist/types/models/IVdaReadPoint.d.ts +22 -0
- package/dist/types/models/IVdaUriPlates.d.ts +25 -0
- package/dist/types/models/vdaIdTypes.d.ts +17 -0
- package/dist/types/models/vdaIdentifierTypes.d.ts +21 -0
- package/dist/types/models/vdaUriIdentifiers.d.ts +53 -0
- package/dist/types/models/vdaUriPackages.d.ts +29 -0
- package/dist/types/utils/vdaIdentifiersValidation.d.ts +66 -0
- package/docs/changelog.md +5 -0
- package/docs/examples.md +1 -0
- package/docs/reference/classes/VdaIdentifiers.md +25 -0
- package/docs/reference/classes/VdaIdentifiersValidation.md +237 -0
- package/docs/reference/index.md +28 -0
- package/docs/reference/interfaces/IVdaBizLocation.md +47 -0
- package/docs/reference/interfaces/IVdaCommon.md +25 -0
- package/docs/reference/interfaces/IVdaObjectIdentifier.md +55 -0
- package/docs/reference/interfaces/IVdaReadPoint.md +63 -0
- package/docs/reference/interfaces/IVdaUriPlates.md +43 -0
- package/docs/reference/type-aliases/VdaIdTypes.md +5 -0
- package/docs/reference/type-aliases/VdaIdentifierTypes.md +5 -0
- package/docs/reference/type-aliases/VdaUriIdentifiers.md +5 -0
- package/docs/reference/type-aliases/VdaUriPackages.md +5 -0
- package/docs/reference/variables/VdaIdTypes.md +19 -0
- package/docs/reference/variables/VdaIdentifierTypes.md +25 -0
- package/docs/reference/variables/VdaUriIdentifiers.md +73 -0
- package/docs/reference/variables/VdaUriPackages.md +37 -0
- package/locales/en.json +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { IdentifierHandlerFactory } from '@twin.org/data-core';
|
|
2
|
+
import { Urn, Is } from '@twin.org/core';
|
|
3
|
+
|
|
4
|
+
// Copyright 2024 IOTA Stiftung.
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
6
|
+
/**
|
|
7
|
+
* The types of VDA Identifier data.
|
|
8
|
+
*/
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
|
+
const VdaIdentifierTypes = {
|
|
11
|
+
/**
|
|
12
|
+
* Identifier Joint Automotive Industry Format namespace.
|
|
13
|
+
*/
|
|
14
|
+
JaifId: "jaif:id",
|
|
15
|
+
/**
|
|
16
|
+
* Specific extended namespace for location validation.
|
|
17
|
+
*/
|
|
18
|
+
JaifLocation: "jaif:id@location",
|
|
19
|
+
/**
|
|
20
|
+
* Specific extended namespace for item validation.
|
|
21
|
+
*/
|
|
22
|
+
JaifItem: "jaif:id@item"
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Copyright 2024 IOTA Stiftung.
|
|
26
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
27
|
+
/**
|
|
28
|
+
* VDA URI Packages License Plates identifiers.
|
|
29
|
+
*/
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
31
|
+
const VdaUriIdentifiers = {
|
|
32
|
+
/**
|
|
33
|
+
* ISO 17367 Supply chain applications for RFID - Product tagging.
|
|
34
|
+
*/
|
|
35
|
+
RfidProductTagging: "A1",
|
|
36
|
+
/**
|
|
37
|
+
* ISO 17365 Supply chain applications for RFID - Transport unit.
|
|
38
|
+
*/
|
|
39
|
+
RfidTransportUnit: "A2",
|
|
40
|
+
/**
|
|
41
|
+
* ISO 17364 Supply chain applications for RFID - Returnable transport item.
|
|
42
|
+
*/
|
|
43
|
+
RfidReturnableTransportItem: "A3",
|
|
44
|
+
/**
|
|
45
|
+
* ISO 17367 Supply chain applications for RFID - Product tagging (HazMat).
|
|
46
|
+
*/
|
|
47
|
+
RfidProductTaggingHazmat: "A4",
|
|
48
|
+
/**
|
|
49
|
+
* ISO 17366 Supply chain applications for RFID - Product packaging.
|
|
50
|
+
*/
|
|
51
|
+
RfidProductPackaging: "A5",
|
|
52
|
+
/**
|
|
53
|
+
* ISO 17366 Supply chain applications for RFID - Product packaging (HazMat).
|
|
54
|
+
*/
|
|
55
|
+
RfidProductPackagingHazmat: "A6",
|
|
56
|
+
/**
|
|
57
|
+
* ISO 17365 Supply chain applications for RFID - Transport unit (HazMat).
|
|
58
|
+
*/
|
|
59
|
+
RfidTransportUnitHazmat: "A7",
|
|
60
|
+
/**
|
|
61
|
+
* ISO 17364 Supply chain applications for RFID - Returnable transport item (Hazmat).
|
|
62
|
+
*/
|
|
63
|
+
RfidReturnableTransportItemHazmat: "A8",
|
|
64
|
+
/**
|
|
65
|
+
* ISO 17363 Supply chain applications for RFID - Freight container.
|
|
66
|
+
*/
|
|
67
|
+
RfidFreightContainer: "A9",
|
|
68
|
+
/**
|
|
69
|
+
* ISO 17363 Supply chain applications for RFID - Freight container (HazMat).
|
|
70
|
+
*/
|
|
71
|
+
RfidFreightContainerHazmat: "AA",
|
|
72
|
+
/**
|
|
73
|
+
* Vehicle identified with the Vehicle Identification Number (VIN) as defined in ISO 3779.
|
|
74
|
+
*/
|
|
75
|
+
VehicleIdentificationNumber: "90"
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// Copyright 2024 IOTA Stiftung.
|
|
79
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
80
|
+
/**
|
|
81
|
+
* VDA URI Packages License Plates identifiers.
|
|
82
|
+
*/
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
84
|
+
const VdaUriPackages = {
|
|
85
|
+
/**
|
|
86
|
+
* Unique package ID of inner packaging (Single Label).
|
|
87
|
+
*/
|
|
88
|
+
Package1J: "1J",
|
|
89
|
+
/**
|
|
90
|
+
* Unique package ID of JIS loading unit with compartments.
|
|
91
|
+
*/
|
|
92
|
+
Package3J: "3J",
|
|
93
|
+
/**
|
|
94
|
+
* Unique package ID of JIS loading unit with 1...n JIS packages.
|
|
95
|
+
*/
|
|
96
|
+
Package4J: "4J",
|
|
97
|
+
/**
|
|
98
|
+
* Unique package ID of mixed loading unit with intermediate packaging level (mixed master).
|
|
99
|
+
*/
|
|
100
|
+
Package5J: "5J",
|
|
101
|
+
/**
|
|
102
|
+
* Unique package ID of loading unit or intermediate packaging containing identical parts.
|
|
103
|
+
*/
|
|
104
|
+
Package67: "6J"
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// Copyright 2024 IOTA Stiftung.
|
|
108
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
109
|
+
/**
|
|
110
|
+
* Validation for identifier types for VDA.
|
|
111
|
+
*/
|
|
112
|
+
class VdaIdentifiersValidation {
|
|
113
|
+
/**
|
|
114
|
+
* Validate if the property is a valid epc.
|
|
115
|
+
* @param propertyName The name of the property being validated.
|
|
116
|
+
* @param value The value to test.
|
|
117
|
+
* @param failures The list of failures to add to.
|
|
118
|
+
* @returns True if the value is valid epc.
|
|
119
|
+
*/
|
|
120
|
+
static jaifId(propertyName, value, failures) {
|
|
121
|
+
const is = Urn.validate("value", value, failures);
|
|
122
|
+
if (is) {
|
|
123
|
+
const urn = Urn.fromValidString(value);
|
|
124
|
+
const specificParts = urn.namespaceSpecific().split(":");
|
|
125
|
+
if (specificParts[0] !== "id") {
|
|
126
|
+
failures.push({
|
|
127
|
+
property: propertyName,
|
|
128
|
+
reason: "validation.vdaEpcNoId"
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else if (specificParts.length < 2) {
|
|
132
|
+
failures.push({
|
|
133
|
+
property: propertyName,
|
|
134
|
+
reason: "validation.vdaIncorrectSegmentCount"
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return is;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Validate if the property is a valid epc vda id location.
|
|
142
|
+
* @param propertyName The name of the property being validated.
|
|
143
|
+
* @param value The value to test.
|
|
144
|
+
* @param failures The list of failures to add to.
|
|
145
|
+
* @returns True if the value is valid epc.
|
|
146
|
+
*/
|
|
147
|
+
static jaifIdLocation(propertyName, value, failures) {
|
|
148
|
+
const is = Urn.validate("value", value, failures);
|
|
149
|
+
if (is &&
|
|
150
|
+
Is.undefined(VdaIdentifiersValidation.extractBizLocation(value)) &&
|
|
151
|
+
Is.undefined(VdaIdentifiersValidation.extractReadPoint(value))) {
|
|
152
|
+
failures.push({
|
|
153
|
+
property: propertyName,
|
|
154
|
+
reason: "validation.vdaValueIncorrect"
|
|
155
|
+
});
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
return is;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Validate if the property is a valid epc vda id item.
|
|
162
|
+
* @param propertyName The name of the property being validated.
|
|
163
|
+
* @param value The value to test.
|
|
164
|
+
* @param failures The list of failures to add to.
|
|
165
|
+
* @returns True if the value is valid epc.
|
|
166
|
+
*/
|
|
167
|
+
static jaifIdItem(propertyName, value, failures) {
|
|
168
|
+
const is = Urn.validate("value", value, failures);
|
|
169
|
+
if (is &&
|
|
170
|
+
Is.undefined(VdaIdentifiersValidation.extractUriPlp(value)) &&
|
|
171
|
+
Is.undefined(VdaIdentifiersValidation.extractIdentifier(value))) {
|
|
172
|
+
failures.push({
|
|
173
|
+
property: propertyName,
|
|
174
|
+
reason: "validation.vdaValueIncorrect"
|
|
175
|
+
});
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
return is;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Validate if the property is a valid epc id gtin.
|
|
182
|
+
* @param propertyName The name of the property being validated.
|
|
183
|
+
* @param value The value to test.
|
|
184
|
+
* @param failures The list of failures to add to.
|
|
185
|
+
* @returns True if the value is valid epc.
|
|
186
|
+
*/
|
|
187
|
+
static uriPlp(propertyName, value, failures) {
|
|
188
|
+
const is = Urn.validate("value", value, failures);
|
|
189
|
+
if (is) {
|
|
190
|
+
const plp = VdaIdentifiersValidation.extractUriPlp(value);
|
|
191
|
+
if (Is.undefined(plp)) {
|
|
192
|
+
failures.push({
|
|
193
|
+
property: propertyName,
|
|
194
|
+
reason: "validation.vdaValueIncorrect"
|
|
195
|
+
});
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return is;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Function to validate and extract RFID read points URNs.
|
|
203
|
+
* @param urn The URN to validate.
|
|
204
|
+
* @returns The extracted read point object or undefined.
|
|
205
|
+
*/
|
|
206
|
+
static extractReadPoint(urn) {
|
|
207
|
+
const parts = /^urn:jaif:id:obj:([\dA-Za-z]{3})([\dA-Za-z]{2})(\d{9})([\dA-Za-z]{2})(\d{5})([\dA-Za-z]*)/.exec(urn);
|
|
208
|
+
if (parts) {
|
|
209
|
+
return {
|
|
210
|
+
dataIdentifier: parts[1],
|
|
211
|
+
issuingAgencyCode: parts[2],
|
|
212
|
+
dunsNumber: parts[3],
|
|
213
|
+
plant: parts[4],
|
|
214
|
+
costCenter: parts[5],
|
|
215
|
+
serialNumber: parts[6]
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Function to validate and extract Biz Location URN.
|
|
221
|
+
* @param urn The URN to validate.
|
|
222
|
+
* @returns The extracted biz location object or undefined.
|
|
223
|
+
*/
|
|
224
|
+
static extractBizLocation(urn) {
|
|
225
|
+
const parts = /^urn:jaif:id:obj:([\dA-Za-z]{3})([\dA-Za-z]{2})(\d{9})([\dA-Za-z]*)/.exec(urn);
|
|
226
|
+
if (parts) {
|
|
227
|
+
return {
|
|
228
|
+
dataIdentifier: parts[1],
|
|
229
|
+
issuingAgencyCode: parts[2],
|
|
230
|
+
dunsNumber: parts[3],
|
|
231
|
+
plantBuildingFloorRoom: parts[4]
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Function to validate VDA URI Packages License Plates.
|
|
237
|
+
* @param id The VDA URI to validate.
|
|
238
|
+
* @returns The VDA URI object or undefined.
|
|
239
|
+
*/
|
|
240
|
+
static extractUriPlp(id) {
|
|
241
|
+
const parts = /^urn:jaif:id:([\dA-Z]{2}):([\dA-Z]{2})([\dA-Z]{2})([\dA-Z]{9})(\d{9})/.exec(id);
|
|
242
|
+
if (parts && parts.length === 6 && id.split(":")[4].length === 22) {
|
|
243
|
+
const data = {
|
|
244
|
+
applicationFamilyIdentifier: parts[1],
|
|
245
|
+
typeOfPackage: parts[2],
|
|
246
|
+
issuingAgencyCode: parts[3],
|
|
247
|
+
companyIdentificationNumber: parts[4],
|
|
248
|
+
packageSerialNumber: parts[5]
|
|
249
|
+
};
|
|
250
|
+
if (!Is.arrayOneOf(data.applicationFamilyIdentifier, Object.values(VdaUriIdentifiers))) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (!Is.arrayOneOf(data.typeOfPackage, Object.values(VdaUriPackages))) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
return data;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* VDA object identifier verifier function.
|
|
261
|
+
* @param epc The epc to validate.
|
|
262
|
+
* @returns The VDA object or undefined.
|
|
263
|
+
*/
|
|
264
|
+
static extractIdentifier(epc) {
|
|
265
|
+
if ((epc.startsWith("urn:jaif:id:obj:") || epc.startsWith("urn:jaif:id:A1:")) &&
|
|
266
|
+
epc.length <= 56) {
|
|
267
|
+
const split = epc.split(":");
|
|
268
|
+
if (split.length === 5) {
|
|
269
|
+
const parts = /([\dA-Z]{3})([\dA-Z]{2})(\d+){1,9}(([\dA-Z]+)\+([\dA-Z]+))/.exec(split[4]);
|
|
270
|
+
if (parts && parts.length === 7) {
|
|
271
|
+
return {
|
|
272
|
+
dataIdentifier: parts[1],
|
|
273
|
+
issuingAgencyCode: parts[2],
|
|
274
|
+
companyIdNumber: parts[3],
|
|
275
|
+
// skipped part[4] since it is a concatenation of part[5] + part[6]
|
|
276
|
+
partNumber: parts[5],
|
|
277
|
+
partSerialNumber: parts[6]
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Copyright 2024 IOTA Stiftung.
|
|
286
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
287
|
+
/**
|
|
288
|
+
* Handle all identifier types for VDA.
|
|
289
|
+
*/
|
|
290
|
+
class VdaIdentifiers {
|
|
291
|
+
/**
|
|
292
|
+
* Register all the identifiers.
|
|
293
|
+
*/
|
|
294
|
+
static registerIdentifiers() {
|
|
295
|
+
IdentifierHandlerFactory.register(VdaIdentifierTypes.JaifId, () => ({
|
|
296
|
+
namespace: VdaIdentifierTypes.JaifId,
|
|
297
|
+
validate: (propertyName, value, failures) => VdaIdentifiersValidation.jaifId(propertyName, value, failures)
|
|
298
|
+
}));
|
|
299
|
+
IdentifierHandlerFactory.register(VdaIdentifierTypes.JaifLocation, () => ({
|
|
300
|
+
namespace: VdaIdentifierTypes.JaifLocation,
|
|
301
|
+
validate: (propertyName, value, failures) => VdaIdentifiersValidation.jaifIdLocation(propertyName, value, failures)
|
|
302
|
+
}));
|
|
303
|
+
IdentifierHandlerFactory.register(VdaIdentifierTypes.JaifItem, () => ({
|
|
304
|
+
namespace: VdaIdentifierTypes.JaifItem,
|
|
305
|
+
validate: (propertyName, value, failures) => VdaIdentifiersValidation.jaifIdItem(propertyName, value, failures)
|
|
306
|
+
}));
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Copyright 2024 IOTA Stiftung.
|
|
311
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
312
|
+
/**
|
|
313
|
+
* VDA identifiers.
|
|
314
|
+
*/
|
|
315
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
316
|
+
const VdaIdTypes = {
|
|
317
|
+
/**
|
|
318
|
+
* Object.
|
|
319
|
+
*/
|
|
320
|
+
Obj: "obj",
|
|
321
|
+
/**
|
|
322
|
+
* Location.
|
|
323
|
+
*/
|
|
324
|
+
Loc: "loc"
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
export { VdaIdTypes, VdaIdentifierTypes, VdaIdentifiers, VdaIdentifiersValidation, VdaUriIdentifiers, VdaUriPackages };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./identifiers/vdaIdentifiers";
|
|
2
|
+
export * from "./models/IVdaBizLocation";
|
|
3
|
+
export * from "./models/IVdaCommon";
|
|
4
|
+
export * from "./models/IVdaObjectIdentifier";
|
|
5
|
+
export * from "./models/IVdaReadPoint";
|
|
6
|
+
export * from "./models/IVdaUriPlates";
|
|
7
|
+
export * from "./models/vdaIdentifierTypes";
|
|
8
|
+
export * from "./models/vdaIdTypes";
|
|
9
|
+
export * from "./models/vdaUriIdentifiers";
|
|
10
|
+
export * from "./models/vdaUriPackages";
|
|
11
|
+
export * from "./utils/vdaIdentifiersValidation";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IVdaCommon } from "./IVdaCommon";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for a VDA Biz Location.
|
|
4
|
+
*/
|
|
5
|
+
export interface IVdaBizLocation extends IVdaCommon {
|
|
6
|
+
/**
|
|
7
|
+
* DUNS Number.
|
|
8
|
+
*/
|
|
9
|
+
dunsNumber: string;
|
|
10
|
+
/**
|
|
11
|
+
* Plant Building Floor and Room.
|
|
12
|
+
*/
|
|
13
|
+
plantBuildingFloorRoom: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IVdaCommon } from "./IVdaCommon";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for VDA object identifier.
|
|
4
|
+
*/
|
|
5
|
+
export interface IVdaObjectIdentifier extends IVdaCommon {
|
|
6
|
+
/**
|
|
7
|
+
* The company identification number.
|
|
8
|
+
*/
|
|
9
|
+
companyIdNumber: string;
|
|
10
|
+
/**
|
|
11
|
+
* The part number.
|
|
12
|
+
*/
|
|
13
|
+
partNumber: string;
|
|
14
|
+
/**
|
|
15
|
+
* The part serial number.
|
|
16
|
+
*/
|
|
17
|
+
partSerialNumber: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IVdaCommon } from "./IVdaCommon";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for VDA read point.
|
|
4
|
+
*/
|
|
5
|
+
export interface IVdaReadPoint extends IVdaCommon {
|
|
6
|
+
/**
|
|
7
|
+
* DUNS Number.
|
|
8
|
+
*/
|
|
9
|
+
dunsNumber: string;
|
|
10
|
+
/**
|
|
11
|
+
* Plant.
|
|
12
|
+
*/
|
|
13
|
+
plant: string;
|
|
14
|
+
/**
|
|
15
|
+
* Cost Center.
|
|
16
|
+
*/
|
|
17
|
+
costCenter: string;
|
|
18
|
+
/**
|
|
19
|
+
* Device Name/Serial Number.
|
|
20
|
+
*/
|
|
21
|
+
serialNumber: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for VDA URI plates.
|
|
3
|
+
*/
|
|
4
|
+
export interface IVdaUriPlates {
|
|
5
|
+
/**
|
|
6
|
+
* Application family identifier A2 or A5.
|
|
7
|
+
*/
|
|
8
|
+
applicationFamilyIdentifier: string;
|
|
9
|
+
/**
|
|
10
|
+
* The type of package 2. Alphanumeric characters.
|
|
11
|
+
*/
|
|
12
|
+
typeOfPackage: string;
|
|
13
|
+
/**
|
|
14
|
+
* The issuing agency. 2 alphanumeric characters.
|
|
15
|
+
*/
|
|
16
|
+
issuingAgencyCode: string;
|
|
17
|
+
/**
|
|
18
|
+
* The company identification number.
|
|
19
|
+
*/
|
|
20
|
+
companyIdentificationNumber: string;
|
|
21
|
+
/**
|
|
22
|
+
* The serial number of the package.
|
|
23
|
+
*/
|
|
24
|
+
packageSerialNumber: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VDA identifiers.
|
|
3
|
+
*/
|
|
4
|
+
export declare const VdaIdTypes: {
|
|
5
|
+
/**
|
|
6
|
+
* Object.
|
|
7
|
+
*/
|
|
8
|
+
readonly Obj: "obj";
|
|
9
|
+
/**
|
|
10
|
+
* Location.
|
|
11
|
+
*/
|
|
12
|
+
readonly Loc: "loc";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* VDA identifiers.
|
|
16
|
+
*/
|
|
17
|
+
export type VdaIdTypes = (typeof VdaIdTypes)[keyof typeof VdaIdTypes];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The types of VDA Identifier data.
|
|
3
|
+
*/
|
|
4
|
+
export declare const VdaIdentifierTypes: {
|
|
5
|
+
/**
|
|
6
|
+
* Identifier Joint Automotive Industry Format namespace.
|
|
7
|
+
*/
|
|
8
|
+
readonly JaifId: "jaif:id";
|
|
9
|
+
/**
|
|
10
|
+
* Specific extended namespace for location validation.
|
|
11
|
+
*/
|
|
12
|
+
readonly JaifLocation: "jaif:id@location";
|
|
13
|
+
/**
|
|
14
|
+
* Specific extended namespace for item validation.
|
|
15
|
+
*/
|
|
16
|
+
readonly JaifItem: "jaif:id@item";
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The types of VDA Identifier data.
|
|
20
|
+
*/
|
|
21
|
+
export type VdaIdentifierTypes = (typeof VdaIdentifierTypes)[keyof typeof VdaIdentifierTypes];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VDA URI Packages License Plates identifiers.
|
|
3
|
+
*/
|
|
4
|
+
export declare const VdaUriIdentifiers: {
|
|
5
|
+
/**
|
|
6
|
+
* ISO 17367 Supply chain applications for RFID - Product tagging.
|
|
7
|
+
*/
|
|
8
|
+
readonly RfidProductTagging: "A1";
|
|
9
|
+
/**
|
|
10
|
+
* ISO 17365 Supply chain applications for RFID - Transport unit.
|
|
11
|
+
*/
|
|
12
|
+
readonly RfidTransportUnit: "A2";
|
|
13
|
+
/**
|
|
14
|
+
* ISO 17364 Supply chain applications for RFID - Returnable transport item.
|
|
15
|
+
*/
|
|
16
|
+
readonly RfidReturnableTransportItem: "A3";
|
|
17
|
+
/**
|
|
18
|
+
* ISO 17367 Supply chain applications for RFID - Product tagging (HazMat).
|
|
19
|
+
*/
|
|
20
|
+
readonly RfidProductTaggingHazmat: "A4";
|
|
21
|
+
/**
|
|
22
|
+
* ISO 17366 Supply chain applications for RFID - Product packaging.
|
|
23
|
+
*/
|
|
24
|
+
readonly RfidProductPackaging: "A5";
|
|
25
|
+
/**
|
|
26
|
+
* ISO 17366 Supply chain applications for RFID - Product packaging (HazMat).
|
|
27
|
+
*/
|
|
28
|
+
readonly RfidProductPackagingHazmat: "A6";
|
|
29
|
+
/**
|
|
30
|
+
* ISO 17365 Supply chain applications for RFID - Transport unit (HazMat).
|
|
31
|
+
*/
|
|
32
|
+
readonly RfidTransportUnitHazmat: "A7";
|
|
33
|
+
/**
|
|
34
|
+
* ISO 17364 Supply chain applications for RFID - Returnable transport item (Hazmat).
|
|
35
|
+
*/
|
|
36
|
+
readonly RfidReturnableTransportItemHazmat: "A8";
|
|
37
|
+
/**
|
|
38
|
+
* ISO 17363 Supply chain applications for RFID - Freight container.
|
|
39
|
+
*/
|
|
40
|
+
readonly RfidFreightContainer: "A9";
|
|
41
|
+
/**
|
|
42
|
+
* ISO 17363 Supply chain applications for RFID - Freight container (HazMat).
|
|
43
|
+
*/
|
|
44
|
+
readonly RfidFreightContainerHazmat: "AA";
|
|
45
|
+
/**
|
|
46
|
+
* Vehicle identified with the Vehicle Identification Number (VIN) as defined in ISO 3779.
|
|
47
|
+
*/
|
|
48
|
+
readonly VehicleIdentificationNumber: "90";
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* VDA URI Packages License Plates identifiers.
|
|
52
|
+
*/
|
|
53
|
+
export type VdaUriIdentifiers = (typeof VdaUriIdentifiers)[keyof typeof VdaUriIdentifiers];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VDA URI Packages License Plates identifiers.
|
|
3
|
+
*/
|
|
4
|
+
export declare const VdaUriPackages: {
|
|
5
|
+
/**
|
|
6
|
+
* Unique package ID of inner packaging (Single Label).
|
|
7
|
+
*/
|
|
8
|
+
readonly Package1J: "1J";
|
|
9
|
+
/**
|
|
10
|
+
* Unique package ID of JIS loading unit with compartments.
|
|
11
|
+
*/
|
|
12
|
+
readonly Package3J: "3J";
|
|
13
|
+
/**
|
|
14
|
+
* Unique package ID of JIS loading unit with 1...n JIS packages.
|
|
15
|
+
*/
|
|
16
|
+
readonly Package4J: "4J";
|
|
17
|
+
/**
|
|
18
|
+
* Unique package ID of mixed loading unit with intermediate packaging level (mixed master).
|
|
19
|
+
*/
|
|
20
|
+
readonly Package5J: "5J";
|
|
21
|
+
/**
|
|
22
|
+
* Unique package ID of loading unit or intermediate packaging containing identical parts.
|
|
23
|
+
*/
|
|
24
|
+
readonly Package67: "6J";
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* VDA URI Packages License Plates identifiers.
|
|
28
|
+
*/
|
|
29
|
+
export type VdaUriPackages = (typeof VdaUriPackages)[keyof typeof VdaUriPackages];
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type IValidationFailure } from "@twin.org/core";
|
|
2
|
+
import type { IVdaBizLocation } from "../models/IVdaBizLocation";
|
|
3
|
+
import type { IVdaObjectIdentifier } from "../models/IVdaObjectIdentifier";
|
|
4
|
+
import type { IVdaReadPoint } from "../models/IVdaReadPoint";
|
|
5
|
+
import type { IVdaUriPlates } from "../models/IVdaUriPlates";
|
|
6
|
+
/**
|
|
7
|
+
* Validation for identifier types for VDA.
|
|
8
|
+
*/
|
|
9
|
+
export declare class VdaIdentifiersValidation {
|
|
10
|
+
/**
|
|
11
|
+
* Validate if the property is a valid epc.
|
|
12
|
+
* @param propertyName The name of the property being validated.
|
|
13
|
+
* @param value The value to test.
|
|
14
|
+
* @param failures The list of failures to add to.
|
|
15
|
+
* @returns True if the value is valid epc.
|
|
16
|
+
*/
|
|
17
|
+
static jaifId(propertyName: string, value: unknown, failures: IValidationFailure[]): value is string;
|
|
18
|
+
/**
|
|
19
|
+
* Validate if the property is a valid epc vda id location.
|
|
20
|
+
* @param propertyName The name of the property being validated.
|
|
21
|
+
* @param value The value to test.
|
|
22
|
+
* @param failures The list of failures to add to.
|
|
23
|
+
* @returns True if the value is valid epc.
|
|
24
|
+
*/
|
|
25
|
+
static jaifIdLocation(propertyName: string, value: unknown, failures: IValidationFailure[]): value is string;
|
|
26
|
+
/**
|
|
27
|
+
* Validate if the property is a valid epc vda id item.
|
|
28
|
+
* @param propertyName The name of the property being validated.
|
|
29
|
+
* @param value The value to test.
|
|
30
|
+
* @param failures The list of failures to add to.
|
|
31
|
+
* @returns True if the value is valid epc.
|
|
32
|
+
*/
|
|
33
|
+
static jaifIdItem(propertyName: string, value: unknown, failures: IValidationFailure[]): value is string;
|
|
34
|
+
/**
|
|
35
|
+
* Validate if the property is a valid epc id gtin.
|
|
36
|
+
* @param propertyName The name of the property being validated.
|
|
37
|
+
* @param value The value to test.
|
|
38
|
+
* @param failures The list of failures to add to.
|
|
39
|
+
* @returns True if the value is valid epc.
|
|
40
|
+
*/
|
|
41
|
+
static uriPlp(propertyName: string, value: unknown, failures: IValidationFailure[]): value is string;
|
|
42
|
+
/**
|
|
43
|
+
* Function to validate and extract RFID read points URNs.
|
|
44
|
+
* @param urn The URN to validate.
|
|
45
|
+
* @returns The extracted read point object or undefined.
|
|
46
|
+
*/
|
|
47
|
+
static extractReadPoint(urn: string): IVdaReadPoint | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Function to validate and extract Biz Location URN.
|
|
50
|
+
* @param urn The URN to validate.
|
|
51
|
+
* @returns The extracted biz location object or undefined.
|
|
52
|
+
*/
|
|
53
|
+
static extractBizLocation(urn: string): IVdaBizLocation | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Function to validate VDA URI Packages License Plates.
|
|
56
|
+
* @param id The VDA URI to validate.
|
|
57
|
+
* @returns The VDA URI object or undefined.
|
|
58
|
+
*/
|
|
59
|
+
static extractUriPlp(id: string): IVdaUriPlates | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* VDA object identifier verifier function.
|
|
62
|
+
* @param epc The epc to validate.
|
|
63
|
+
* @returns The VDA object or undefined.
|
|
64
|
+
*/
|
|
65
|
+
static extractIdentifier(epc: string): IVdaObjectIdentifier | undefined;
|
|
66
|
+
}
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @twin.org/standards-vda - Examples
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Class: VdaIdentifiers
|
|
2
|
+
|
|
3
|
+
Handle all identifier types for VDA.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### new VdaIdentifiers()
|
|
8
|
+
|
|
9
|
+
> **new VdaIdentifiers**(): [`VdaIdentifiers`](VdaIdentifiers.md)
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
[`VdaIdentifiers`](VdaIdentifiers.md)
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### registerIdentifiers()
|
|
18
|
+
|
|
19
|
+
> `static` **registerIdentifiers**(): `void`
|
|
20
|
+
|
|
21
|
+
Register all the identifiers.
|
|
22
|
+
|
|
23
|
+
#### Returns
|
|
24
|
+
|
|
25
|
+
`void`
|