@twin.org/standards-gs1 0.0.2-next.9 → 0.0.3-next.10

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.
Files changed (131) hide show
  1. package/dist/es/dataTypes/gs1DataTypes.js +24 -0
  2. package/dist/es/dataTypes/gs1DataTypes.js.map +1 -0
  3. package/dist/es/entities/gs1Location.js +193 -0
  4. package/dist/es/entities/gs1Location.js.map +1 -0
  5. package/dist/es/identifiers/gs1Identifiers.js +32 -0
  6. package/dist/es/identifiers/gs1Identifiers.js.map +1 -0
  7. package/dist/es/index.js +38 -0
  8. package/dist/es/index.js.map +1 -0
  9. package/dist/es/models/epc/IEPCClassUri.js +4 -0
  10. package/dist/es/models/epc/IEPCClassUri.js.map +1 -0
  11. package/dist/es/models/epcis20/IEpcisAggregationEvent.js +2 -0
  12. package/dist/es/models/epcis20/IEpcisAggregationEvent.js.map +1 -0
  13. package/dist/es/models/epcis20/IEpcisAssociationEvent.js +2 -0
  14. package/dist/es/models/epcis20/IEpcisAssociationEvent.js.map +1 -0
  15. package/dist/es/models/epcis20/IEpcisBaseAggregationEvent.js +2 -0
  16. package/dist/es/models/epcis20/IEpcisBaseAggregationEvent.js.map +1 -0
  17. package/dist/es/models/epcis20/IEpcisBizTransaction.js +4 -0
  18. package/dist/es/models/epcis20/IEpcisBizTransaction.js.map +1 -0
  19. package/dist/es/models/epcis20/IEpcisDestination.js +4 -0
  20. package/dist/es/models/epcis20/IEpcisDestination.js.map +1 -0
  21. package/dist/es/models/epcis20/IEpcisDocument.js +2 -0
  22. package/dist/es/models/epcis20/IEpcisDocument.js.map +1 -0
  23. package/dist/es/models/epcis20/IEpcisEvent.js +2 -0
  24. package/dist/es/models/epcis20/IEpcisEvent.js.map +1 -0
  25. package/dist/es/models/epcis20/IEpcisEventDetails.js +2 -0
  26. package/dist/es/models/epcis20/IEpcisEventDetails.js.map +1 -0
  27. package/dist/es/models/epcis20/IEpcisObjectEvent.js +2 -0
  28. package/dist/es/models/epcis20/IEpcisObjectEvent.js.map +1 -0
  29. package/dist/es/models/epcis20/IEpcisQuantity.js +4 -0
  30. package/dist/es/models/epcis20/IEpcisQuantity.js.map +1 -0
  31. package/dist/es/models/epcis20/IEpcisQuery.js +4 -0
  32. package/dist/es/models/epcis20/IEpcisQuery.js.map +1 -0
  33. package/dist/es/models/epcis20/IEpcisQueryDocument.js +2 -0
  34. package/dist/es/models/epcis20/IEpcisQueryDocument.js.map +1 -0
  35. package/dist/es/models/epcis20/IEpcisSensorElement.js +2 -0
  36. package/dist/es/models/epcis20/IEpcisSensorElement.js.map +1 -0
  37. package/dist/es/models/epcis20/IEpcisSensorMetadata.js +4 -0
  38. package/dist/es/models/epcis20/IEpcisSensorMetadata.js.map +1 -0
  39. package/dist/es/models/epcis20/IEpcisSensorReport.js +4 -0
  40. package/dist/es/models/epcis20/IEpcisSensorReport.js.map +1 -0
  41. package/dist/es/models/epcis20/IEpcisSimpleLocation.js +4 -0
  42. package/dist/es/models/epcis20/IEpcisSimpleLocation.js.map +1 -0
  43. package/dist/es/models/epcis20/IEpcisSource.js +4 -0
  44. package/dist/es/models/epcis20/IEpcisSource.js.map +1 -0
  45. package/dist/es/models/epcis20/epcisActionTypes.js +21 -0
  46. package/dist/es/models/epcis20/epcisActionTypes.js.map +1 -0
  47. package/dist/es/models/epcis20/epcisBizStepTypes.js +52 -0
  48. package/dist/es/models/epcis20/epcisBizStepTypes.js.map +1 -0
  49. package/dist/es/models/epcis20/epcisDispositionTypes.js +45 -0
  50. package/dist/es/models/epcis20/epcisDispositionTypes.js.map +1 -0
  51. package/dist/es/models/epcis20/epcisErrorTypes.js +11 -0
  52. package/dist/es/models/epcis20/epcisErrorTypes.js.map +1 -0
  53. package/dist/es/models/epcis20/epcisEventTypes.js +29 -0
  54. package/dist/es/models/epcis20/epcisEventTypes.js.map +1 -0
  55. package/dist/es/models/epcis20/epcisEventUnionType.js +2 -0
  56. package/dist/es/models/epcis20/epcisEventUnionType.js.map +1 -0
  57. package/dist/es/models/gs1/gs1Contexts.js +13 -0
  58. package/dist/es/models/gs1/gs1Contexts.js.map +1 -0
  59. package/dist/es/models/gs1/gs1IdTypes.js +90 -0
  60. package/dist/es/models/gs1/gs1IdTypes.js.map +1 -0
  61. package/dist/es/models/gs1/gs1IdentifierTypes.js +26 -0
  62. package/dist/es/models/gs1/gs1IdentifierTypes.js.map +1 -0
  63. package/dist/es/models/gs1/gs1SubSiteAttributes.js +143 -0
  64. package/dist/es/models/gs1/gs1SubSiteAttributes.js.map +1 -0
  65. package/dist/es/models/gs1/gs1SubSiteTypes.js +75 -0
  66. package/dist/es/models/gs1/gs1SubSiteTypes.js.map +1 -0
  67. package/dist/es/models/gs1/gs1Types.js +13 -0
  68. package/dist/es/models/gs1/gs1Types.js.map +1 -0
  69. package/dist/es/utils/gs1IdentifiersValidation.js +144 -0
  70. package/dist/es/utils/gs1IdentifiersValidation.js.map +1 -0
  71. package/dist/es/utils/gs1Is.js +24 -0
  72. package/dist/es/utils/gs1Is.js.map +1 -0
  73. package/dist/es/utils/gs1Validation.js +51 -0
  74. package/dist/es/utils/gs1Validation.js.map +1 -0
  75. package/dist/types/entities/gs1Location.d.ts +4 -4
  76. package/dist/types/index.d.ts +35 -35
  77. package/dist/types/models/epcis20/{IAggregationEvent.d.ts → IEpcisAggregationEvent.d.ts} +1 -1
  78. package/dist/types/models/epcis20/{IAssociationEvent.d.ts → IEpcisAssociationEvent.d.ts} +1 -1
  79. package/dist/types/models/epcis20/{IBaseAggregationEvent.d.ts → IEpcisBaseAggregationEvent.d.ts} +2 -2
  80. package/dist/types/models/epcis20/IEpcisDocument.d.ts +1 -1
  81. package/dist/types/models/epcis20/IEpcisEvent.d.ts +2 -2
  82. package/dist/types/models/epcis20/IEpcisEventDetails.d.ts +9 -9
  83. package/dist/types/models/epcis20/{IObjectEvent.d.ts → IEpcisObjectEvent.d.ts} +3 -3
  84. package/dist/types/models/epcis20/IEpcisQueryDocument.d.ts +1 -1
  85. package/dist/types/models/epcis20/{ISensorElement.d.ts → IEpcisSensorElement.d.ts} +2 -2
  86. package/dist/types/models/epcis20/{actionTypes.d.ts → epcisActionTypes.d.ts} +2 -2
  87. package/dist/types/models/epcis20/{bizStepTypes.d.ts → epcisBizStepTypes.d.ts} +2 -2
  88. package/dist/types/models/epcis20/{dispositionTypes.d.ts → epcisDispositionTypes.d.ts} +2 -2
  89. package/dist/types/models/epcis20/{eventTypes.d.ts → epcisEventTypes.d.ts} +2 -2
  90. package/dist/types/models/epcis20/epcisEventUnionType.d.ts +3 -3
  91. package/dist/types/models/gs1/{subSiteAttributes.d.ts → gs1SubSiteAttributes.d.ts} +2 -2
  92. package/dist/types/models/gs1/{subSiteTypes.d.ts → gs1SubSiteTypes.d.ts} +2 -2
  93. package/dist/types/utils/gs1IdentifiersValidation.d.ts +1 -1
  94. package/dist/types/utils/gs1Validation.d.ts +1 -1
  95. package/docs/changelog.md +125 -0
  96. package/docs/reference/classes/Gs1IdentifiersValidation.md +6 -6
  97. package/docs/reference/classes/Gs1Location.md +2 -2
  98. package/docs/reference/index.md +14 -14
  99. package/docs/reference/interfaces/IAggregationEvent.md +3 -3
  100. package/docs/reference/interfaces/IAssociationEvent.md +3 -3
  101. package/docs/reference/interfaces/IEpcisEventDetails.md +3 -3
  102. package/docs/reference/interfaces/IObjectEvent.md +3 -3
  103. package/docs/reference/type-aliases/EpcisActionTypes.md +5 -0
  104. package/docs/reference/type-aliases/EpcisBizStepTypes.md +5 -0
  105. package/docs/reference/type-aliases/EpcisDispositionTypes.md +5 -0
  106. package/docs/reference/type-aliases/EpcisEventTypes.md +5 -0
  107. package/docs/reference/type-aliases/Gs1SubSiteAttributes.md +7 -0
  108. package/docs/reference/type-aliases/Gs1SubSiteTypes.md +7 -0
  109. package/docs/reference/variables/{ActionTypes.md → EpcisActionTypes.md} +2 -2
  110. package/docs/reference/variables/{BizStepTypes.md → EpcisBizStepTypes.md} +2 -2
  111. package/docs/reference/variables/{DispositionTypes.md → EpcisDispositionTypes.md} +2 -2
  112. package/docs/reference/variables/{EventTypes.md → EpcisEventTypes.md} +2 -2
  113. package/docs/reference/variables/{SubSiteAttributes.md → Gs1SubSiteAttributes.md} +2 -2
  114. package/docs/reference/variables/{SubSiteTypes.md → Gs1SubSiteTypes.md} +2 -2
  115. package/locales/en.json +0 -1
  116. package/package.json +20 -8
  117. package/dist/cjs/index.cjs +0 -991
  118. package/dist/esm/index.mjs +0 -974
  119. package/docs/reference/type-aliases/ActionTypes.md +0 -5
  120. package/docs/reference/type-aliases/BizStepTypes.md +0 -5
  121. package/docs/reference/type-aliases/DispositionTypes.md +0 -5
  122. package/docs/reference/type-aliases/EventTypes.md +0 -5
  123. package/docs/reference/type-aliases/SubSiteAttributes.md +0 -7
  124. package/docs/reference/type-aliases/SubSiteTypes.md +0 -7
  125. /package/dist/types/models/epcis20/{IBizTransaction.d.ts → IEpcisBizTransaction.d.ts} +0 -0
  126. /package/dist/types/models/epcis20/{IDestination.d.ts → IEpcisDestination.d.ts} +0 -0
  127. /package/dist/types/models/epcis20/{IQuantity.d.ts → IEpcisQuantity.d.ts} +0 -0
  128. /package/dist/types/models/epcis20/{ISensorMetadata.d.ts → IEpcisSensorMetadata.d.ts} +0 -0
  129. /package/dist/types/models/epcis20/{ISensorReport.d.ts → IEpcisSensorReport.d.ts} +0 -0
  130. /package/dist/types/models/epcis20/{ISimpleLocation.d.ts → IEpcisSimpleLocation.d.ts} +0 -0
  131. /package/dist/types/models/epcis20/{ISource.d.ts → IEpcisSource.d.ts} +0 -0
@@ -1,991 +0,0 @@
1
- 'use strict';
2
-
3
- var dataCore = require('@twin.org/data-core');
4
- var core = require('@twin.org/core');
5
- var entity = require('@twin.org/entity');
6
-
7
- // Copyright 2024 IOTA Stiftung.
8
- // SPDX-License-Identifier: Apache-2.0.
9
- /**
10
- * The contexts of GS1.
11
- */
12
- // eslint-disable-next-line @typescript-eslint/naming-convention
13
- const GS1Contexts = {
14
- /**
15
- * The context root for the GS1 types.
16
- */
17
- ContextRoot: "https://gs1.org/voc/"
18
- };
19
-
20
- // Copyright 2024 IOTA Stiftung.
21
- // SPDX-License-Identifier: Apache-2.0.
22
- /**
23
- * The types of GS1 data.
24
- */
25
- // eslint-disable-next-line @typescript-eslint/naming-convention
26
- const Gs1Types = {
27
- /**
28
- * Represents Location Master Data.
29
- */
30
- LocationMasterData: "gs1_location_masterdata"
31
- };
32
-
33
- // Copyright 2024 IOTA Stiftung.
34
- // SPDX-License-Identifier: Apache-2.0.
35
- /* cSpell:disable */
36
- /**
37
- * GS1 EPC Identifiers.
38
- */
39
- // eslint-disable-next-line @typescript-eslint/naming-convention
40
- const Gs1IdTypes = {
41
- /**
42
- * GTIN - Trade Item.
43
- */
44
- Gtin: "sgtin",
45
- /**
46
- * SSCC - Logistics Unit.
47
- */
48
- Sscc: "sscc",
49
- /**
50
- * GLN - Location.
51
- */
52
- Gln: "sgln",
53
- /**
54
- * GRAI - Returnable Asset.
55
- */
56
- Grai: "grai",
57
- /**
58
- * GIAI - Fixed Asset.
59
- */
60
- Giai: "giai",
61
- /**
62
- * GSRN - Recipient - Hospital Admission or Club Membership.
63
- */
64
- GsrnRecipient: "gsrn",
65
- /**
66
- * GSRN - Provider - Medical Caregiver or Loyalty Club.
67
- */
68
- GsrnProvider: "gsrnp",
69
- /**
70
- * GDTI - Document.
71
- */
72
- Gtdi: "gtdi",
73
- /**
74
- * Technical Industries for unique identification of parts and components.
75
- */
76
- None: "cpi",
77
- /**
78
- * GCN - Coupon.
79
- */
80
- Gcn: "sgcn",
81
- /**
82
- * Logical grouping of goods intended for transport as a whole assigned by a freight forwarder.
83
- */
84
- Ginc: "ginc",
85
- /**
86
- * Logical grouping of logistic units travelling under one dispatch advice and/or bill of lading.
87
- */
88
- Gsin: "gsin",
89
- /**
90
- * One of multiple pieces comprising, and subordinate to, a whole.
91
- */
92
- Ai: "itip",
93
- /**
94
- * Pack identification to combat illicit trade.
95
- */
96
- GtinTpx: "upui",
97
- /**
98
- * Identification of Economic Operator, Owning party or processing party in CoC/CoO.
99
- */
100
- GlnAi: "pgln",
101
- /**
102
- * Unspecified.
103
- */
104
- Unspecified: "gid",
105
- /**
106
- * US Dept of Defense supply chain.
107
- */
108
- UsDod: "usdod",
109
- /**
110
- * Aerospace and Defense sector for unique identification of aircraft and other parts and items.
111
- */
112
- AerospaceDefence: "adi",
113
- /**
114
- * Intermodal shipping containers.
115
- */
116
- Intermodal: "bic",
117
- /**
118
- * Vessel Identification.
119
- */
120
- Vessel: "imovn"
121
- };
122
-
123
- // Copyright 2024 IOTA Stiftung.
124
- // SPDX-License-Identifier: Apache-2.0.
125
- /**
126
- * The types of GS1 Identifier data.
127
- */
128
- // eslint-disable-next-line @typescript-eslint/naming-convention
129
- const Gs1IdentifierTypes = {
130
- /**
131
- * Identifier epc id namespace.
132
- */
133
- EpcId: "epc:id",
134
- /**
135
- * Identifier epc:id:gtin namespace.
136
- */
137
- EpcIdGtin: `epc:id:${Gs1IdTypes.Gtin}`,
138
- /**
139
- * Identifier epc:id:sgln namespace.
140
- */
141
- EpcIdGln: `epc:id:${Gs1IdTypes.Gln}`,
142
- /**
143
- * Identifier epc id namespace.
144
- */
145
- EpcClass: "epc:class"
146
- };
147
-
148
- // Copyright 2024 IOTA Stiftung.
149
- // SPDX-License-Identifier: Apache-2.0.
150
- /**
151
- * Sub Site Attributes.
152
- * Spec https://www.gs1.org/sites/default/files/docs/epc/CBV-Standard-1-2-1-r-2017-05-05.pdf .
153
- * Section 10.3.2 .
154
- */
155
- // eslint-disable-next-line @typescript-eslint/naming-convention
156
- const SubSiteAttributes = {
157
- /**
158
- * Electronics.
159
- */
160
- Electronics: "401",
161
- /**
162
- * Cold Storage.
163
- */
164
- ColdStorage: "402",
165
- /**
166
- * Shelf.
167
- */
168
- Shelf: "403",
169
- /**
170
- * Frozen.
171
- */
172
- Frozen: "404",
173
- /**
174
- * Fresh.
175
- */
176
- Fresh: "405",
177
- /**
178
- * Promotion.
179
- */
180
- Promotion: "406",
181
- /**
182
- * End Cap.
183
- */
184
- EndCap: "407",
185
- /**
186
- * Point of Sale.
187
- */
188
- PointOfSale: "408",
189
- /**
190
- * Security.
191
- */
192
- Security: "409",
193
- /**
194
- * General Mdse.
195
- */
196
- GeneralMdse: "411",
197
- /**
198
- * Grocery.
199
- */
200
- Grocery: "412",
201
- /**
202
- * Box crusher.
203
- */
204
- BoxCrusher: "413",
205
- /**
206
- * Dock/Door.
207
- */
208
- DockDoor: "414",
209
- /**
210
- * Conveyor Belt.
211
- */
212
- ConveyorBelt: "415",
213
- /**
214
- * Pallet Wrapper.
215
- */
216
- PalletWrapper: "416",
217
- /**
218
- * Fixed Reader.
219
- */
220
- FixedReader: "417",
221
- /**
222
- * Mobile Reader.
223
- */
224
- MobileReader: "418",
225
- /**
226
- * Shelf Storage.
227
- */
228
- ShelfStorage: "419",
229
- /**
230
- * Returns.
231
- */
232
- Returns: "420",
233
- /**
234
- * Staging.
235
- */
236
- Staging: "421",
237
- /**
238
- * Assembly.
239
- */
240
- Assembly: "422",
241
- /**
242
- * Lay-Away.
243
- */
244
- LayAway: "423",
245
- /**
246
- * Dispenser.
247
- */
248
- Dispenser: "424",
249
- /**
250
- * Quarantine.
251
- */
252
- Quarantine: "425",
253
- /**
254
- * Controlled Substance.
255
- */
256
- ControlledSubstance: "426",
257
- /**
258
- * Recalled Product.
259
- */
260
- RecalledProduct: "427",
261
- /**
262
- * Quality Control.
263
- */
264
- QualityControl: "428",
265
- /**
266
- * Printing Room.
267
- */
268
- PrintingRoom: "429",
269
- /**
270
- * Loading Dock.
271
- */
272
- LoadingDock: "420",
273
- /**
274
- * Entrance Gate.
275
- */
276
- EntranceGate: "431",
277
- /**
278
- * Exit Gate.
279
- */
280
- ExitGate: "432",
281
- /**
282
- * Gate.
283
- */
284
- Gate: "433",
285
- /**
286
- * Read Point Verification Spot.
287
- */
288
- ReadPointVerificationSpot: "434"
289
- };
290
-
291
- // Copyright 2024 IOTA Stiftung.
292
- // SPDX-License-Identifier: Apache-2.0.
293
- /**
294
- * Sub Site Identifier Types.
295
- * Spec https://www.gs1.org/sites/default/files/docs/epc/CBV-Standard-1-2-1-r-2017-05-05.pdf .
296
- * Section 10.3.1 .
297
- */
298
- // eslint-disable-next-line @typescript-eslint/naming-convention
299
- const SubSiteTypes = {
300
- /**
301
- * The Backroom.
302
- */
303
- Backroom: "201",
304
- /**
305
- * The Storage Area.
306
- */
307
- StorageArea: "202",
308
- /**
309
- * The Sales Floor.
310
- */
311
- SalesFloor: "203",
312
- /**
313
- * The Returns Area.
314
- */
315
- ReturnsArea: "207",
316
- /**
317
- * The Production Area.
318
- */
319
- ProductionArea: "208",
320
- /**
321
- * The Receiving Area.
322
- */
323
- ReceivingArea: "209",
324
- /**
325
- * The Shipping Area.
326
- */
327
- ShippingArea: "210",
328
- /**
329
- * The Sales Floor Transition Area.
330
- */
331
- SalesFloorTransitionArea: "211",
332
- /**
333
- * The Customer Pick-Up Area.
334
- */
335
- CustomerPickupArea: "212",
336
- /**
337
- * The Yard.
338
- */
339
- Yard: "213",
340
- /**
341
- * The Container Deck.
342
- */
343
- ContainerDeck: "214",
344
- /**
345
- * The Cargo Terminal.
346
- */
347
- CargoTerminal: "215",
348
- /**
349
- * The Packaging Area.
350
- */
351
- PackagingArea: "251",
352
- /**
353
- * The Picking Area.
354
- */
355
- PickingArea: "252",
356
- /**
357
- * The Pharmacy Area.
358
- */
359
- PharmacyArea: "253",
360
- /**
361
- * Undefined.
362
- */
363
- Undefined: "299"
364
- };
365
-
366
- // Copyright 2024 IOTA Stiftung.
367
- // SPDX-License-Identifier: Apache-2.0.
368
- /**
369
- * Validation for GS1 types.
370
- */
371
- class Gs1Validation {
372
- /**
373
- * Validate if the property is a valid location.
374
- * @param propertyName The name of the property being validated.
375
- * @param value The value to test.
376
- * @param failures The list of failures to add to.
377
- * @param container The object which contains this one.
378
- * @returns True if the value is a location.
379
- */
380
- static locationMasterData(propertyName, value, failures, container) {
381
- const is = core.Is.object(value);
382
- if (is) {
383
- if (core.Is.stringValue(value.id)) {
384
- const identifierHandler = dataCore.IdentifierHandlerFactory.get(Gs1IdentifierTypes.EpcIdGln);
385
- if (identifierHandler) {
386
- identifierHandler.validate(propertyName + ".id", value.id, failures);
387
- }
388
- }
389
- if (core.Is.notEmpty(value.latitude) && !core.Is.number(value.latitude)) {
390
- failures.push({
391
- property: propertyName + ".latitude",
392
- reason: "validation.geoCoordinatesLatitude"
393
- });
394
- }
395
- if (core.Is.notEmpty(value.longitude) && !core.Is.number(value.longitude)) {
396
- failures.push({
397
- property: propertyName + ".longitude",
398
- reason: "validation.geoCoordinatesLongitude"
399
- });
400
- }
401
- if (core.Is.notEmpty(value.sst)) {
402
- core.Validation.arrayOneOf("value.sst", value.sst, Object.values(SubSiteTypes), failures);
403
- }
404
- if (core.Is.notEmpty(value.ssa)) {
405
- core.Validation.arrayOneOf("value.ssa", value.ssa, Object.values(SubSiteAttributes), failures);
406
- }
407
- }
408
- return is;
409
- }
410
- }
411
-
412
- // Copyright 2024 IOTA Stiftung.
413
- // SPDX-License-Identifier: Apache-2.0.
414
- /**
415
- * Handle all the data types for GS1.
416
- * Vocabulary https://www.gs1.org/voc .
417
- */
418
- class Gs1DataTypes {
419
- /**
420
- * Register all the data types.
421
- */
422
- static registerTypes() {
423
- dataCore.DataTypeHandlerFactory.register(`${GS1Contexts.ContextRoot}${Gs1Types.LocationMasterData}`, () => ({
424
- context: GS1Contexts.ContextRoot,
425
- type: Gs1Types.LocationMasterData,
426
- defaultValue: {},
427
- validate: async (propertyName, value, failures, container) => Gs1Validation.locationMasterData(propertyName, value, failures, container)
428
- }));
429
- }
430
- }
431
-
432
- // Copyright 2024 IOTA Stiftung.
433
- // SPDX-License-Identifier: Apache-2.0.
434
- /**
435
- * Interface describing a GS1 Location master data.
436
- * Spec https://www.gs1.org/sites/default/files/docs/epc/CBV-Standard-1-2-1-r-2017-05-05.pdf .
437
- * Section 10.2 .
438
- */
439
- exports.Gs1Location = class Gs1Location {
440
- /**
441
- * The GS1 sgln identifier.
442
- */
443
- id;
444
- /**
445
- * Identifies the site in which the location is contained.
446
- */
447
- site;
448
- /**
449
- * Sub site type describes the primary business function of the sub site location.
450
- */
451
- sst;
452
- /**
453
- * Sub site attribute further qualifies the business function of the sub site location.
454
- */
455
- ssa;
456
- /**
457
- * Sub site detail provides additional proprietary information.
458
- */
459
- ssd;
460
- /**
461
- * The name of the location.
462
- */
463
- name;
464
- /**
465
- * The street address line 1.
466
- */
467
- streetAddressOne;
468
- /**
469
- * The street address line 2.
470
- */
471
- streetAddressTwo;
472
- /**
473
- * The street address line 3.
474
- */
475
- streetAddressThree;
476
- /**
477
- * City.
478
- */
479
- city;
480
- /**
481
- * State.
482
- */
483
- state;
484
- /**
485
- * Postal Code.
486
- */
487
- postalCode;
488
- /**
489
- * Country Code The ISO 3166-1 alpha-2 code specifying the country for the address.
490
- */
491
- countryCode;
492
- /**
493
- * The latitude of the location in degrees.
494
- */
495
- latitude;
496
- /**
497
- * The longitude of the location in degrees.
498
- */
499
- longitude;
500
- };
501
- __decorate([
502
- entity.property({ description: "Unique identifier for the location.", type: "string", isPrimary: true }),
503
- __metadata("design:type", String)
504
- ], exports.Gs1Location.prototype, "id", void 0);
505
- __decorate([
506
- entity.property({
507
- description: "Site identifier or name, if applicable.",
508
- type: "string",
509
- optional: true
510
- }),
511
- __metadata("design:type", String)
512
- ], exports.Gs1Location.prototype, "site", void 0);
513
- __decorate([
514
- entity.property({
515
- description: "Additional site-specific information or code.",
516
- type: "string",
517
- optional: true
518
- }),
519
- __metadata("design:type", String)
520
- ], exports.Gs1Location.prototype, "sst", void 0);
521
- __decorate([
522
- entity.property({
523
- description: "Sub-site area or section information.",
524
- type: "string",
525
- optional: true
526
- }),
527
- __metadata("design:type", String)
528
- ], exports.Gs1Location.prototype, "ssa", void 0);
529
- __decorate([
530
- entity.property({
531
- description: "Detailed site description or additional data.",
532
- type: "string",
533
- optional: true
534
- }),
535
- __metadata("design:type", String)
536
- ], exports.Gs1Location.prototype, "ssd", void 0);
537
- __decorate([
538
- entity.property({
539
- description: "Name of the location.",
540
- type: "string",
541
- optional: true
542
- }),
543
- __metadata("design:type", String)
544
- ], exports.Gs1Location.prototype, "name", void 0);
545
- __decorate([
546
- entity.property({
547
- description: "Primary street address.",
548
- type: "string",
549
- optional: true
550
- }),
551
- __metadata("design:type", String)
552
- ], exports.Gs1Location.prototype, "streetAddressOne", void 0);
553
- __decorate([
554
- entity.property({
555
- description: "Secondary street address, if needed.",
556
- type: "string",
557
- optional: true
558
- }),
559
- __metadata("design:type", String)
560
- ], exports.Gs1Location.prototype, "streetAddressTwo", void 0);
561
- __decorate([
562
- entity.property({
563
- description: "Tertiary street address, if applicable.",
564
- type: "string",
565
- optional: true
566
- }),
567
- __metadata("design:type", String)
568
- ], exports.Gs1Location.prototype, "streetAddressThree", void 0);
569
- __decorate([
570
- entity.property({
571
- description: "City where the location is situated.",
572
- type: "string",
573
- optional: true
574
- }),
575
- __metadata("design:type", String)
576
- ], exports.Gs1Location.prototype, "city", void 0);
577
- __decorate([
578
- entity.property({
579
- description: "State or province of the location.",
580
- type: "string",
581
- optional: true
582
- }),
583
- __metadata("design:type", String)
584
- ], exports.Gs1Location.prototype, "state", void 0);
585
- __decorate([
586
- entity.property({
587
- description: "Postal or ZIP code for the location.",
588
- type: "string",
589
- optional: true
590
- }),
591
- __metadata("design:type", String)
592
- ], exports.Gs1Location.prototype, "postalCode", void 0);
593
- __decorate([
594
- entity.property({
595
- description: "Country code where the location is located.",
596
- type: "string",
597
- optional: true
598
- }),
599
- __metadata("design:type", String)
600
- ], exports.Gs1Location.prototype, "countryCode", void 0);
601
- __decorate([
602
- entity.property({
603
- description: "Latitude coordinate of the location.",
604
- type: "number",
605
- optional: true
606
- }),
607
- __metadata("design:type", Number)
608
- ], exports.Gs1Location.prototype, "latitude", void 0);
609
- __decorate([
610
- entity.property({
611
- description: "Longitude coordinate of the location.",
612
- type: "number",
613
- optional: true
614
- }),
615
- __metadata("design:type", Number)
616
- ], exports.Gs1Location.prototype, "longitude", void 0);
617
- exports.Gs1Location = __decorate([
618
- entity.entity({
619
- description: "Stores detailed information about locations, including addresses and geographic coordinates"
620
- })
621
- ], exports.Gs1Location);
622
-
623
- // Copyright 2024 IOTA Stiftung.
624
- // SPDX-License-Identifier: Apache-2.0.
625
- /**
626
- * Validation for GS1 identifiers.
627
- */
628
- class Gs1IdentifiersValidation {
629
- /**
630
- * Validate if the property is a valid epc.
631
- * @param propertyName The name of the property being validated.
632
- * @param value The value to test.
633
- * @param failures The list of failures to add to.
634
- * @returns True if the value is valid epc.
635
- */
636
- static epcId(propertyName, value, failures) {
637
- const is = core.Urn.validate("value", value, failures);
638
- if (is) {
639
- const urn = core.Urn.fromValidString(value);
640
- const specificParts = urn.namespaceSpecific().split(":");
641
- if (specificParts.length < 2) {
642
- failures.push({
643
- property: propertyName,
644
- reason: "validation.gs1IncorrectSegmentCount"
645
- });
646
- }
647
- else {
648
- const isValid = core.Validation.arrayOneOf(propertyName, specificParts[1], Object.values(Gs1IdTypes), failures);
649
- if (isValid) {
650
- switch (specificParts[1]) {
651
- case Gs1IdTypes.Gtin:
652
- Gs1IdentifiersValidation.epcIdGtin(propertyName, urn, failures);
653
- break;
654
- case Gs1IdTypes.Gln:
655
- Gs1IdentifiersValidation.epcIdGln(propertyName, urn, failures);
656
- break;
657
- }
658
- }
659
- }
660
- }
661
- return is;
662
- }
663
- /**
664
- * Validate if the property is a valid epc id gtin.
665
- * @param propertyName The name of the property being validated.
666
- * @param value The value to test.
667
- * @param failures The list of failures to add to.
668
- * @returns True if the value is valid epc.
669
- */
670
- static epcIdGtin(propertyName, value, failures) {
671
- const is = core.Urn.validate("value", value, failures);
672
- if (is) {
673
- const gtin = Gs1IdentifiersValidation.extractEpcIdGtin(value);
674
- if (core.Is.undefined(gtin)) {
675
- failures.push({
676
- property: propertyName,
677
- reason: "validation.gs1ValueIncorrect"
678
- });
679
- return false;
680
- }
681
- }
682
- return is;
683
- }
684
- /**
685
- * Validate if the property is a valid epc id gln.
686
- * @param propertyName The name of the property being validated.
687
- * @param value The value to test.
688
- * @param failures The list of failures to add to.
689
- * @returns True if the value is valid epc.
690
- */
691
- static epcIdGln(propertyName, value, failures) {
692
- const is = core.Urn.validate("value", value, failures);
693
- if (is) {
694
- const gtin = Gs1IdentifiersValidation.extractEpcIdGln(value);
695
- if (core.Is.undefined(gtin)) {
696
- failures.push({
697
- property: propertyName,
698
- reason: "validation.gs1ValueIncorrect"
699
- });
700
- return false;
701
- }
702
- }
703
- return is;
704
- }
705
- /**
706
- * Validate if the property is a valid epc class.
707
- * @param propertyName The name of the property being validated.
708
- * @param value The value to test.
709
- * @param failures The list of failures to add to.
710
- * @returns True if the value is valid epc.
711
- */
712
- static epcClass(propertyName, value, failures) {
713
- const is = core.Urn.validate("value", value, failures);
714
- if (is) {
715
- const extracted = Gs1IdentifiersValidation.extractEpcClassUri(value);
716
- if (core.Is.undefined(extracted)) {
717
- failures.push({
718
- property: propertyName,
719
- reason: "validation.gs1EpcClassIncorrect"
720
- });
721
- return false;
722
- }
723
- }
724
- return is;
725
- }
726
- /**
727
- * Extract the EPC gtin from the URI.
728
- * @param epc The uri to extract from.
729
- * @returns The extracted data or undefined.
730
- */
731
- static extractEpcIdGtin(epc) {
732
- const parts = /^urn:epc:id:sgtin:(\d+)\.(\d+)\.([\w!%'()*+,-.:;=]+)/.exec(epc);
733
- if (parts && parts.length >= 3 && parts[1].length + parts[2].length === 13) {
734
- return parts.slice(1).join(".");
735
- }
736
- }
737
- /**
738
- * Extract the EPC gln from the URI.
739
- * @param epc The uri to extract from.
740
- * @returns The extracted data or undefined.
741
- */
742
- static extractEpcIdGln(epc) {
743
- const parts = /^urn:epc:id:sgln:(\d+)\.(\d+)\.([\w!%'()*+,-.:;=]+)/.exec(epc);
744
- if (parts && parts.length >= 3 && parts[1].length + parts[2].length === 12) {
745
- return parts.slice(1).join(".");
746
- }
747
- }
748
- /**
749
- * Extract The EPC Class from the URI.
750
- * @param epc The uri to extract from.
751
- * @returns The extracted data or undefined.
752
- */
753
- static extractEpcClassUri(epc) {
754
- const parts = /^urn:epc:class:lgtin:(\d+)\.(\d+)\.([\w!%'()*+,-.:;=]+)/.exec(epc);
755
- if (parts && parts.length === 4 && parts[1].length + parts[2].length === 13) {
756
- return {
757
- companyPrefix: parts[1],
758
- itemRefAndIndicator: parts[2],
759
- lot: parts[3]
760
- };
761
- }
762
- }
763
- }
764
-
765
- // Copyright 2024 IOTA Stiftung.
766
- // SPDX-License-Identifier: Apache-2.0.
767
- /**
768
- * Handle all identifier types for GS1.
769
- */
770
- class Gs1Identifiers {
771
- /**
772
- * Register all the identifiers.
773
- */
774
- static registerIdentifiers() {
775
- dataCore.IdentifierHandlerFactory.register(Gs1IdentifierTypes.EpcId, () => ({
776
- namespace: Gs1IdentifierTypes.EpcId,
777
- validate: (propertyName, value, failures) => Gs1IdentifiersValidation.epcId(propertyName, value, failures)
778
- }));
779
- dataCore.IdentifierHandlerFactory.register(Gs1IdentifierTypes.EpcIdGtin, () => ({
780
- namespace: Gs1IdentifierTypes.EpcIdGtin,
781
- validate: (propertyName, value, failures) => Gs1IdentifiersValidation.epcIdGtin(propertyName, value, failures)
782
- }));
783
- dataCore.IdentifierHandlerFactory.register(Gs1IdentifierTypes.EpcIdGln, () => ({
784
- namespace: Gs1IdentifierTypes.EpcIdGln,
785
- validate: (propertyName, value, failures) => Gs1IdentifiersValidation.epcIdGln(propertyName, value, failures)
786
- }));
787
- dataCore.IdentifierHandlerFactory.register(Gs1IdentifierTypes.EpcClass, () => ({
788
- namespace: Gs1IdentifierTypes.EpcClass,
789
- validate: (propertyName, value, failures) => Gs1IdentifiersValidation.epcClass(propertyName, value, failures)
790
- }));
791
- }
792
- }
793
-
794
- // Copyright 2024 IOTA Stiftung.
795
- // SPDX-License-Identifier: Apache-2.0.
796
- /**
797
- * EPCIS 2.0 action types.
798
- */
799
- // eslint-disable-next-line @typescript-eslint/naming-convention
800
- const ActionTypes = {
801
- /**
802
- * ADD action.
803
- */
804
- Add: "ADD",
805
- /**
806
- * OBSERVE action.
807
- */
808
- Observe: "OBSERVE",
809
- /**
810
- * DELETE action.
811
- */
812
- Delete: "DELETE"
813
- };
814
-
815
- // Copyright 2024 IOTA Stiftung.
816
- // SPDX-License-Identifier: Apache-2.0.
817
- /**
818
- * Supported EPCIS 2.0 bizStep.
819
- *
820
- * See EPCIS CVB specification for details.
821
- */
822
- // eslint-disable-next-line @typescript-eslint/naming-convention
823
- const BizStepTypes = {
824
- Accepting: "accepting",
825
- Arriving: "arriving",
826
- Assembling: "assembling",
827
- Collecting: "collecting",
828
- Commissioning: "commissioning",
829
- Consigning: "consigning",
830
- CreatingClassInstance: "creating_class_instance",
831
- CycleCounting: "cycle_counting",
832
- Decommissioning: "decommissioning",
833
- Departing: "departing",
834
- Destroying: "destroying",
835
- Disassembling: "disassembling",
836
- Dispensing: "dispensing",
837
- Encoding: "encoding",
838
- EnteringExiting: "entering_exiting",
839
- Holding: "holding",
840
- Inspecting: "inspecting",
841
- Installing: "installing",
842
- Killing: "killing",
843
- Loading: "loading",
844
- Other: "other",
845
- Packing: "packing",
846
- Picking: "picking",
847
- Receiving: "receiving",
848
- Removing: "removing",
849
- Repackaging: "repackaging",
850
- Repairing: "repairing",
851
- Replacing: "replacing",
852
- Reserving: "reserving",
853
- RetailSelling: "retail_selling",
854
- Shipping: "shipping",
855
- StagingOutbound: "staging_outbound",
856
- StockTaking: "stock_taking",
857
- Stocking: "stocking",
858
- Storing: "storing",
859
- Transporting: "transporting",
860
- Unloading: "unloading",
861
- Unpacking: "unpacking",
862
- VoidShipping: "void_shipping",
863
- SensorReporting: "sensor_reporting",
864
- Sampling: "sampling"
865
- };
866
-
867
- // Copyright 2024 IOTA Stiftung.
868
- // SPDX-License-Identifier: Apache-2.0.
869
- /* cSpell:disable */
870
- /**
871
- * EPCIS 2.0 disposition types.
872
- *
873
- * See EPCIS CVB for more details.
874
- */
875
- // eslint-disable-next-line @typescript-eslint/naming-convention
876
- const DispositionTypes = {
877
- Active: "active",
878
- ContainerClosed: "container_closed",
879
- Damaged: "damaged",
880
- Destroyed: "destroyed",
881
- Dispensed: "dispensed",
882
- Disposed: "disposed",
883
- Encoded: "encoded",
884
- Expired: "expired",
885
- InProgress: "in_progress",
886
- InTransit: "in_transit",
887
- Inactive: "inactive",
888
- NoPedigreeMatch: "no_pedigree_match",
889
- NonSellableOther: "non_sellable_other",
890
- PartiallyDispensed: "partially_dispensed",
891
- Recalled: "recalled",
892
- Reserved: "reserved",
893
- RetailSold: "retail_sold",
894
- Returned: "returned",
895
- SellableAccessible: "sellable_accessible",
896
- SellableNotAccessible: "sellable_not_accessible",
897
- Stolen: "stolen",
898
- Unknown: "unknown",
899
- Available: "available",
900
- CompletenessVerified: "completeness_verified",
901
- CompletenessInferred: "completeness_inferred",
902
- Conformant: "conformant",
903
- ContainerOpen: "container_open",
904
- MismatchInstance: "mismatch_instance",
905
- MismatchClass: "mismatch_class",
906
- MismatchQuantity: "mismatch_quantity",
907
- NeedsReplacement: "needs_replacement",
908
- NonConformant: "non_conformant",
909
- Unavailable: "unavailable"
910
- };
911
-
912
- // Copyright 2024 IOTA Stiftung.
913
- // SPDX-License-Identifier: Apache-2.0.
914
- /**
915
- * EPCIS Error types.
916
- */
917
- // eslint-disable-next-line @typescript-eslint/naming-convention
918
- const EpcisErrorTypes = {
919
- ValidationFailed: "epcisException:ValidationException",
920
- NoSuchResource: "epcisException:NoSuchResourceException"
921
- };
922
-
923
- // Copyright 2024 IOTA Stiftung.
924
- // SPDX-License-Identifier: Apache-2.0.
925
- /**
926
- * EPCIS 2.0 event types.
927
- */
928
- // eslint-disable-next-line @typescript-eslint/naming-convention
929
- const EventTypes = {
930
- /**
931
- * ObjectEvent.
932
- */
933
- ObjectEvent: "ObjectEvent",
934
- /**
935
- * Aggregation Event.
936
- */
937
- AggregationEvent: "AggregationEvent",
938
- /**
939
- * Association Event.
940
- */
941
- AssociationEvent: "AssociationEvent",
942
- /**
943
- * Transformation Event.
944
- */
945
- TransformationEvent: "TransformationEvent",
946
- /**
947
- * Transaction Event.
948
- */
949
- TransactionEvent: "TransactionEvent"
950
- };
951
-
952
- // Copyright 2024 IOTA Stiftung.
953
- // SPDX-License-Identifier: Apache-2.0.
954
- /**
955
- * Is checks for GS1 data.
956
- */
957
- class Gs1Is {
958
- /**
959
- * Is the value an EPC identifier.
960
- * @param value The value to test.
961
- * @returns True if the value is an epc.
962
- */
963
- static isEpcHex(value) {
964
- return /^[\dA-Fa-f]{24}$/.test(value);
965
- }
966
- /**
967
- * Is the value a valid geo uri https://en.wikipedia.org/wiki/Geo_URI_scheme.
968
- * @param value The value to check.
969
- * @returns True if the value matches a geo uri.
970
- */
971
- static isGeoUri(value) {
972
- return /^geo:[+-]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[+-]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)($|,)(\d{0,5})?/.test(value);
973
- }
974
- }
975
-
976
- exports.ActionTypes = ActionTypes;
977
- exports.BizStepTypes = BizStepTypes;
978
- exports.DispositionTypes = DispositionTypes;
979
- exports.EpcisErrorTypes = EpcisErrorTypes;
980
- exports.EventTypes = EventTypes;
981
- exports.GS1Contexts = GS1Contexts;
982
- exports.Gs1DataTypes = Gs1DataTypes;
983
- exports.Gs1IdTypes = Gs1IdTypes;
984
- exports.Gs1IdentifierTypes = Gs1IdentifierTypes;
985
- exports.Gs1Identifiers = Gs1Identifiers;
986
- exports.Gs1IdentifiersValidation = Gs1IdentifiersValidation;
987
- exports.Gs1Is = Gs1Is;
988
- exports.Gs1Types = Gs1Types;
989
- exports.Gs1Validation = Gs1Validation;
990
- exports.SubSiteAttributes = SubSiteAttributes;
991
- exports.SubSiteTypes = SubSiteTypes;