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

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 (94) 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/IAggregationEvent.js +2 -0
  12. package/dist/es/models/epcis20/IAggregationEvent.js.map +1 -0
  13. package/dist/es/models/epcis20/IAssociationEvent.js +2 -0
  14. package/dist/es/models/epcis20/IAssociationEvent.js.map +1 -0
  15. package/dist/es/models/epcis20/IBaseAggregationEvent.js +2 -0
  16. package/dist/es/models/epcis20/IBaseAggregationEvent.js.map +1 -0
  17. package/dist/es/models/epcis20/IBizTransaction.js +4 -0
  18. package/dist/es/models/epcis20/IBizTransaction.js.map +1 -0
  19. package/dist/es/models/epcis20/IDestination.js +4 -0
  20. package/dist/es/models/epcis20/IDestination.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/IEpcisQuery.js +4 -0
  28. package/dist/es/models/epcis20/IEpcisQuery.js.map +1 -0
  29. package/dist/es/models/epcis20/IEpcisQueryDocument.js +2 -0
  30. package/dist/es/models/epcis20/IEpcisQueryDocument.js.map +1 -0
  31. package/dist/es/models/epcis20/IObjectEvent.js +2 -0
  32. package/dist/es/models/epcis20/IObjectEvent.js.map +1 -0
  33. package/dist/es/models/epcis20/IQuantity.js +4 -0
  34. package/dist/es/models/epcis20/IQuantity.js.map +1 -0
  35. package/dist/es/models/epcis20/ISensorElement.js +2 -0
  36. package/dist/es/models/epcis20/ISensorElement.js.map +1 -0
  37. package/dist/es/models/epcis20/ISensorMetadata.js +4 -0
  38. package/dist/es/models/epcis20/ISensorMetadata.js.map +1 -0
  39. package/dist/es/models/epcis20/ISensorReport.js +4 -0
  40. package/dist/es/models/epcis20/ISensorReport.js.map +1 -0
  41. package/dist/es/models/epcis20/ISimpleLocation.js +4 -0
  42. package/dist/es/models/epcis20/ISimpleLocation.js.map +1 -0
  43. package/dist/es/models/epcis20/ISource.js +4 -0
  44. package/dist/es/models/epcis20/ISource.js.map +1 -0
  45. package/dist/es/models/epcis20/actionTypes.js +21 -0
  46. package/dist/es/models/epcis20/actionTypes.js.map +1 -0
  47. package/dist/es/models/epcis20/bizStepTypes.js +52 -0
  48. package/dist/es/models/epcis20/bizStepTypes.js.map +1 -0
  49. package/dist/es/models/epcis20/dispositionTypes.js +45 -0
  50. package/dist/es/models/epcis20/dispositionTypes.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/epcisEventUnionType.js +2 -0
  54. package/dist/es/models/epcis20/epcisEventUnionType.js.map +1 -0
  55. package/dist/es/models/epcis20/eventTypes.js +29 -0
  56. package/dist/es/models/epcis20/eventTypes.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/gs1Types.js +13 -0
  64. package/dist/es/models/gs1/gs1Types.js.map +1 -0
  65. package/dist/es/models/gs1/subSiteAttributes.js +143 -0
  66. package/dist/es/models/gs1/subSiteAttributes.js.map +1 -0
  67. package/dist/es/models/gs1/subSiteTypes.js +75 -0
  68. package/dist/es/models/gs1/subSiteTypes.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 +2 -2
  76. package/dist/types/index.d.ts +35 -35
  77. package/dist/types/models/epcis20/IAggregationEvent.d.ts +1 -1
  78. package/dist/types/models/epcis20/IAssociationEvent.d.ts +1 -1
  79. package/dist/types/models/epcis20/IBaseAggregationEvent.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 +6 -6
  83. package/dist/types/models/epcis20/IEpcisQueryDocument.d.ts +1 -1
  84. package/dist/types/models/epcis20/IObjectEvent.d.ts +3 -3
  85. package/dist/types/models/epcis20/ISensorElement.d.ts +2 -2
  86. package/dist/types/models/epcis20/epcisEventUnionType.d.ts +3 -3
  87. package/dist/types/utils/gs1IdentifiersValidation.d.ts +1 -1
  88. package/dist/types/utils/gs1Validation.d.ts +1 -1
  89. package/docs/changelog.md +62 -0
  90. package/docs/reference/classes/Gs1IdentifiersValidation.md +6 -6
  91. package/locales/en.json +0 -1
  92. package/package.json +20 -8
  93. package/dist/cjs/index.cjs +0 -991
  94. package/dist/esm/index.mjs +0 -974
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gs1IdentifiersValidation.js","sourceRoot":"","sources":["../../../src/utils/gs1IdentifiersValidation.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,EAAE,EAA2B,GAAG,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG9E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAClB,YAAoB,EACpB,KAAc,EACd,QAA8B;QAE9B,MAAM,EAAE,GAAG,GAAG,CAAC,QAAQ,UAAgB,KAAK,EAAE,QAAQ,CAAC,CAAC;QAExD,IAAI,EAAE,EAAE,CAAC;YACR,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YACvC,MAAM,aAAa,GAAG,GAAG,CAAC,iBAAiB,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAEzD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9B,QAAQ,CAAC,IAAI,CAAC;oBACb,QAAQ,EAAE,YAAY;oBACtB,MAAM,EAAE,qCAAqC;iBAC7C,CAAC,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACP,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CACpC,YAAY,EACZ,aAAa,CAAC,CAAC,CAAC,EAChB,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EACzB,QAAQ,CACR,CAAC;gBAEF,IAAI,OAAO,EAAE,CAAC;oBACb,QAAQ,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;wBAC1B,KAAK,UAAU,CAAC,IAAI;4BACnB,wBAAwB,CAAC,SAAS,CAAC,YAAY,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC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AI,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;IACF,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,kBAAkB,CAAC,GAAW;QAC3C,MAAM,KAAK,GAAG,yDAAyD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAElF,IAAI,KAAK,EAAE,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YACrE,OAAO;gBACN,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;gBACvB,mBAAmB,EAAE,KAAK,CAAC,CAAC,CAAC;gBAC7B,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;aACb,CAAC;QACH,CAAC;IACF,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Is, type IValidationFailure, Urn, Validation } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { IEPCClassUri } from \"../models/epc/IEPCClassUri.js\";\nimport { Gs1IdTypes } from \"../models/gs1/gs1IdTypes.js\";\n\n/**\n * Validation for GS1 identifiers.\n */\nexport class Gs1IdentifiersValidation {\n\t/**\n\t * Validate if the property is a valid epc.\n\t * @param propertyName The name of the property being validated.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @returns True if the value is valid epc.\n\t */\n\tpublic static epcId(\n\t\tpropertyName: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[]\n\t): value is string {\n\t\tconst is = Urn.validate(nameof(value), value, failures);\n\n\t\tif (is) {\n\t\t\tconst urn = Urn.fromValidString(value);\n\t\t\tconst specificParts = urn.namespaceSpecific().split(\":\");\n\n\t\t\tif (specificParts.length < 2) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty: propertyName,\n\t\t\t\t\treason: \"validation.gs1IncorrectSegmentCount\"\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst isValid = Validation.arrayOneOf(\n\t\t\t\t\tpropertyName,\n\t\t\t\t\tspecificParts[1],\n\t\t\t\t\tObject.values(Gs1IdTypes),\n\t\t\t\t\tfailures\n\t\t\t\t);\n\n\t\t\t\tif (isValid) {\n\t\t\t\t\tswitch (specificParts[1]) {\n\t\t\t\t\t\tcase Gs1IdTypes.Gtin:\n\t\t\t\t\t\t\tGs1IdentifiersValidation.epcIdGtin(propertyName, urn, failures);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Gs1IdTypes.Gln:\n\t\t\t\t\t\t\tGs1IdentifiersValidation.epcIdGln(propertyName, urn, failures);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn is;\n\t}\n\n\t/**\n\t * Validate if the property is a valid epc id gtin.\n\t * @param propertyName The name of the property being validated.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @returns True if the value is valid epc.\n\t */\n\tpublic static epcIdGtin(\n\t\tpropertyName: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[]\n\t): value is string {\n\t\tconst is = Urn.validate(nameof(value), value, failures);\n\n\t\tif (is) {\n\t\t\tconst gtin = Gs1IdentifiersValidation.extractEpcIdGtin(value);\n\n\t\t\tif (Is.undefined(gtin)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty: propertyName,\n\t\t\t\t\treason: \"validation.gs1ValueIncorrect\"\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn is;\n\t}\n\n\t/**\n\t * Validate if the property is a valid epc id gln.\n\t * @param propertyName The name of the property being validated.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @returns True if the value is valid epc.\n\t */\n\tpublic static epcIdGln(\n\t\tpropertyName: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[]\n\t): value is string {\n\t\tconst is = Urn.validate(nameof(value), value, failures);\n\n\t\tif (is) {\n\t\t\tconst gtin = Gs1IdentifiersValidation.extractEpcIdGln(value);\n\n\t\t\tif (Is.undefined(gtin)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty: propertyName,\n\t\t\t\t\treason: \"validation.gs1ValueIncorrect\"\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn is;\n\t}\n\n\t/**\n\t * Validate if the property is a valid epc class.\n\t * @param propertyName The name of the property being validated.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @returns True if the value is valid epc.\n\t */\n\tpublic static epcClass(\n\t\tpropertyName: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[]\n\t): value is string {\n\t\tconst is = Urn.validate(nameof(value), value, failures);\n\n\t\tif (is) {\n\t\t\tconst extracted = Gs1IdentifiersValidation.extractEpcClassUri(value);\n\n\t\t\tif (Is.undefined(extracted)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty: propertyName,\n\t\t\t\t\treason: \"validation.gs1EpcClassIncorrect\"\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn is;\n\t}\n\n\t/**\n\t * Extract the EPC gtin from the URI.\n\t * @param epc The uri to extract from.\n\t * @returns The extracted data or undefined.\n\t */\n\tpublic static extractEpcIdGtin(epc: string): string | undefined {\n\t\tconst parts = /^urn:epc:id:sgtin:(\\d+)\\.(\\d+)\\.([\\w!%'()*+,-.:;=]+)/.exec(epc);\n\n\t\tif (parts && parts.length >= 3 && parts[1].length + parts[2].length === 13) {\n\t\t\treturn parts.slice(1).join(\".\");\n\t\t}\n\t}\n\n\t/**\n\t * Extract the EPC gln from the URI.\n\t * @param epc The uri to extract from.\n\t * @returns The extracted data or undefined.\n\t */\n\tpublic static extractEpcIdGln(epc: string): string | undefined {\n\t\tconst parts = /^urn:epc:id:sgln:(\\d+)\\.(\\d+)\\.([\\w!%'()*+,-.:;=]+)/.exec(epc);\n\n\t\tif (parts && parts.length >= 3 && parts[1].length + parts[2].length === 12) {\n\t\t\treturn parts.slice(1).join(\".\");\n\t\t}\n\t}\n\n\t/**\n\t * Extract The EPC Class from the URI.\n\t * @param epc The uri to extract from.\n\t * @returns The extracted data or undefined.\n\t */\n\tpublic static extractEpcClassUri(epc: string): IEPCClassUri | undefined {\n\t\tconst parts = /^urn:epc:class:lgtin:(\\d+)\\.(\\d+)\\.([\\w!%'()*+,-.:;=]+)/.exec(epc);\n\n\t\tif (parts?.length === 4 && parts[1].length + parts[2].length === 13) {\n\t\t\treturn {\n\t\t\t\tcompanyPrefix: parts[1],\n\t\t\t\titemRefAndIndicator: parts[2],\n\t\t\t\tlot: parts[3]\n\t\t\t};\n\t\t}\n\t}\n}\n"]}
@@ -0,0 +1,24 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ /**
4
+ * Is checks for GS1 data.
5
+ */
6
+ export class Gs1Is {
7
+ /**
8
+ * Is the value an EPC identifier.
9
+ * @param value The value to test.
10
+ * @returns True if the value is an epc.
11
+ */
12
+ static isEpcHex(value) {
13
+ return /^[\dA-Fa-f]{24}$/.test(value);
14
+ }
15
+ /**
16
+ * Is the value a valid geo uri https://en.wikipedia.org/wiki/Geo_URI_scheme.
17
+ * @param value The value to check.
18
+ * @returns True if the value matches a geo uri.
19
+ */
20
+ static isGeoUri(value) {
21
+ return /^geo:[+-]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[+-]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)($|,)(\d{0,5})?/.test(value);
22
+ }
23
+ }
24
+ //# sourceMappingURL=gs1Is.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gs1Is.js","sourceRoot":"","sources":["../../../src/utils/gs1Is.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,MAAM,OAAO,KAAK;IACjB;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,KAAa;QACnC,OAAO,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,KAAa;QACnC,OAAO,4GAA4G,CAAC,IAAI,CACvH,KAAK,CACL,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Is checks for GS1 data.\n */\nexport class Gs1Is {\n\t/**\n\t * Is the value an EPC identifier.\n\t * @param value The value to test.\n\t * @returns True if the value is an epc.\n\t */\n\tpublic static isEpcHex(value: string): boolean {\n\t\treturn /^[\\dA-Fa-f]{24}$/.test(value);\n\t}\n\n\t/**\n\t * Is the value a valid geo uri https://en.wikipedia.org/wiki/Geo_URI_scheme.\n\t * @param value The value to check.\n\t * @returns True if the value matches a geo uri.\n\t */\n\tpublic static isGeoUri(value: string): boolean {\n\t\treturn /^geo:[+-]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[+-]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)($|,)(\\d{0,5})?/.test(\n\t\t\tvalue\n\t\t);\n\t}\n}\n"]}
@@ -0,0 +1,51 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { Is, Validation } from "@twin.org/core";
4
+ import { IdentifierHandlerFactory } from "@twin.org/data-core";
5
+ import { Gs1IdentifierTypes } from "../models/gs1/gs1IdentifierTypes.js";
6
+ import { SubSiteAttributes } from "../models/gs1/subSiteAttributes.js";
7
+ import { SubSiteTypes } from "../models/gs1/subSiteTypes.js";
8
+ /**
9
+ * Validation for GS1 types.
10
+ */
11
+ export class Gs1Validation {
12
+ /**
13
+ * Validate if the property is a valid location.
14
+ * @param propertyName The name of the property being validated.
15
+ * @param value The value to test.
16
+ * @param failures The list of failures to add to.
17
+ * @param container The object which contains this one.
18
+ * @returns True if the value is a location.
19
+ */
20
+ static locationMasterData(propertyName, value, failures, container) {
21
+ const is = Is.object(value);
22
+ if (is) {
23
+ if (Is.stringValue(value.id)) {
24
+ const identifierHandler = IdentifierHandlerFactory.get(Gs1IdentifierTypes.EpcIdGln);
25
+ if (identifierHandler) {
26
+ identifierHandler.validate(propertyName + ".id", value.id, failures);
27
+ }
28
+ }
29
+ if (Is.notEmpty(value.latitude) && !Is.number(value.latitude)) {
30
+ failures.push({
31
+ property: propertyName + ".latitude",
32
+ reason: "validation.geoCoordinatesLatitude"
33
+ });
34
+ }
35
+ if (Is.notEmpty(value.longitude) && !Is.number(value.longitude)) {
36
+ failures.push({
37
+ property: propertyName + ".longitude",
38
+ reason: "validation.geoCoordinatesLongitude"
39
+ });
40
+ }
41
+ if (Is.notEmpty(value.sst)) {
42
+ Validation.arrayOneOf("value.sst", value.sst, Object.values(SubSiteTypes), failures);
43
+ }
44
+ if (Is.notEmpty(value.ssa)) {
45
+ Validation.arrayOneOf("value.ssa", value.ssa, Object.values(SubSiteAttributes), failures);
46
+ }
47
+ }
48
+ return is;
49
+ }
50
+ }
51
+ //# sourceMappingURL=gs1Validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gs1Validation.js","sourceRoot":"","sources":["../../../src/utils/gs1Validation.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,EAAE,EAA2B,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D;;GAEG;AACH,MAAM,OAAO,aAAa;IACzB;;;;;;;OAOG;IACI,MAAM,CAAC,kBAAkB,CAC/B,Y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U,CAAC,UAAU,cAEpB,KAAK,CAAC,GAAG,EACT,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAChC,QAAQ,CACR,CAAC;YACH,CAAC;QACF,CAAC;QAED,OAAO,EAAE,CAAC;IACX,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Is, type IValidationFailure, Validation } from \"@twin.org/core\";\nimport { IdentifierHandlerFactory } from \"@twin.org/data-core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { Gs1Location } from \"../entities/gs1Location.js\";\nimport { Gs1IdentifierTypes } from \"../models/gs1/gs1IdentifierTypes.js\";\nimport { SubSiteAttributes } from \"../models/gs1/subSiteAttributes.js\";\nimport { SubSiteTypes } from \"../models/gs1/subSiteTypes.js\";\n\n/**\n * Validation for GS1 types.\n */\nexport class Gs1Validation {\n\t/**\n\t * Validate if the property is a valid location.\n\t * @param propertyName The name of the property being validated.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param container The object which contains this one.\n\t * @returns True if the value is a location.\n\t */\n\tpublic static locationMasterData(\n\t\tpropertyName: string,\n\t\tvalue: Gs1Location,\n\t\tfailures: IValidationFailure[],\n\t\tcontainer?: unknown\n\t): value is Gs1Location {\n\t\tconst is = Is.object<Gs1Location>(value);\n\n\t\tif (is) {\n\t\t\tif (Is.stringValue(value.id)) {\n\t\t\t\tconst identifierHandler = IdentifierHandlerFactory.get(Gs1IdentifierTypes.EpcIdGln);\n\t\t\t\tif (identifierHandler) {\n\t\t\t\t\tidentifierHandler.validate(nameof(value.id, propertyName), value.id, failures);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (Is.notEmpty(value.latitude) && !Is.number(value.latitude)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty: nameof(value.latitude, propertyName),\n\t\t\t\t\treason: \"validation.geoCoordinatesLatitude\"\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (Is.notEmpty(value.longitude) && !Is.number(value.longitude)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty: nameof(value.longitude, propertyName),\n\t\t\t\t\treason: \"validation.geoCoordinatesLongitude\"\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (Is.notEmpty(value.sst)) {\n\t\t\t\tValidation.arrayOneOf(nameof(value.sst), value.sst, Object.values(SubSiteTypes), failures);\n\t\t\t}\n\n\t\t\tif (Is.notEmpty(value.ssa)) {\n\t\t\t\tValidation.arrayOneOf(\n\t\t\t\t\tnameof(value.ssa),\n\t\t\t\t\tvalue.ssa,\n\t\t\t\t\tObject.values(SubSiteAttributes),\n\t\t\t\t\tfailures\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn is;\n\t}\n}\n"]}
@@ -1,5 +1,5 @@
1
- import type { SubSiteAttributes } from "../models/gs1/subSiteAttributes";
2
- import type { SubSiteTypes } from "../models/gs1/subSiteTypes";
1
+ import type { SubSiteAttributes } from "../models/gs1/subSiteAttributes.js";
2
+ import type { SubSiteTypes } from "../models/gs1/subSiteTypes.js";
3
3
  /**
4
4
  * Interface describing a GS1 Location master data.
5
5
  * Spec https://www.gs1.org/sites/default/files/docs/epc/CBV-Standard-1-2-1-r-2017-05-05.pdf .
@@ -1,35 +1,35 @@
1
- export * from "./dataTypes/gs1DataTypes";
2
- export * from "./entities/gs1Location";
3
- export * from "./identifiers/gs1Identifiers";
4
- export * from "./models/epc/IEPCClassUri";
5
- export * from "./models/epcis20/actionTypes";
6
- export * from "./models/epcis20/bizStepTypes";
7
- export * from "./models/epcis20/dispositionTypes";
8
- export * from "./models/epcis20/epcisErrorTypes";
9
- export * from "./models/epcis20/epcisEventUnionType";
10
- export * from "./models/epcis20/eventTypes";
11
- export * from "./models/epcis20/IAggregationEvent";
12
- export * from "./models/epcis20/IAssociationEvent";
13
- export * from "./models/epcis20/IBizTransaction";
14
- export * from "./models/epcis20/IDestination";
15
- export * from "./models/epcis20/IEpcisDocument";
16
- export * from "./models/epcis20/IEpcisEvent";
17
- export * from "./models/epcis20/IEpcisEventDetails";
18
- export * from "./models/epcis20/IEpcisQuery";
19
- export * from "./models/epcis20/IEpcisQueryDocument";
20
- export * from "./models/epcis20/IObjectEvent";
21
- export * from "./models/epcis20/IQuantity";
22
- export * from "./models/epcis20/ISensorElement";
23
- export * from "./models/epcis20/ISensorMetadata";
24
- export * from "./models/epcis20/ISensorReport";
25
- export * from "./models/epcis20/ISimpleLocation";
26
- export * from "./models/epcis20/ISource";
27
- export * from "./models/gs1/gs1Contexts";
28
- export * from "./models/gs1/gs1IdentifierTypes";
29
- export * from "./models/gs1/gs1IdTypes";
30
- export * from "./models/gs1/gs1Types";
31
- export * from "./models/gs1/subSiteAttributes";
32
- export * from "./models/gs1/subSiteTypes";
33
- export * from "./utils/gs1IdentifiersValidation";
34
- export * from "./utils/gs1Is";
35
- export * from "./utils/gs1Validation";
1
+ export * from "./dataTypes/gs1DataTypes.js";
2
+ export * from "./entities/gs1Location.js";
3
+ export * from "./identifiers/gs1Identifiers.js";
4
+ export * from "./models/epc/IEPCClassUri.js";
5
+ export * from "./models/epcis20/actionTypes.js";
6
+ export * from "./models/epcis20/bizStepTypes.js";
7
+ export * from "./models/epcis20/dispositionTypes.js";
8
+ export * from "./models/epcis20/epcisErrorTypes.js";
9
+ export * from "./models/epcis20/epcisEventUnionType.js";
10
+ export * from "./models/epcis20/eventTypes.js";
11
+ export * from "./models/epcis20/IAggregationEvent.js";
12
+ export * from "./models/epcis20/IAssociationEvent.js";
13
+ export * from "./models/epcis20/IBizTransaction.js";
14
+ export * from "./models/epcis20/IDestination.js";
15
+ export * from "./models/epcis20/IEpcisDocument.js";
16
+ export * from "./models/epcis20/IEpcisEvent.js";
17
+ export * from "./models/epcis20/IEpcisEventDetails.js";
18
+ export * from "./models/epcis20/IEpcisQuery.js";
19
+ export * from "./models/epcis20/IEpcisQueryDocument.js";
20
+ export * from "./models/epcis20/IObjectEvent.js";
21
+ export * from "./models/epcis20/IQuantity.js";
22
+ export * from "./models/epcis20/ISensorElement.js";
23
+ export * from "./models/epcis20/ISensorMetadata.js";
24
+ export * from "./models/epcis20/ISensorReport.js";
25
+ export * from "./models/epcis20/ISimpleLocation.js";
26
+ export * from "./models/epcis20/ISource.js";
27
+ export * from "./models/gs1/gs1Contexts.js";
28
+ export * from "./models/gs1/gs1IdentifierTypes.js";
29
+ export * from "./models/gs1/gs1IdTypes.js";
30
+ export * from "./models/gs1/gs1Types.js";
31
+ export * from "./models/gs1/subSiteAttributes.js";
32
+ export * from "./models/gs1/subSiteTypes.js";
33
+ export * from "./utils/gs1IdentifiersValidation.js";
34
+ export * from "./utils/gs1Is.js";
35
+ export * from "./utils/gs1Validation.js";
@@ -1,4 +1,4 @@
1
- import type { IBaseAggregationEvent } from "./IBaseAggregationEvent";
1
+ import type { IBaseAggregationEvent } from "./IBaseAggregationEvent.js";
2
2
  /**
3
3
  * Describes an AggregationEvent.
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { IBaseAggregationEvent } from "./IBaseAggregationEvent";
1
+ import type { IBaseAggregationEvent } from "./IBaseAggregationEvent.js";
2
2
  /**
3
3
  * Association Event.
4
4
  */
@@ -1,5 +1,5 @@
1
- import type { IEpcisEventDetails } from "./IEpcisEventDetails";
2
- import type { IQuantity } from "./IQuantity";
1
+ import type { IEpcisEventDetails } from "./IEpcisEventDetails.js";
2
+ import type { IQuantity } from "./IQuantity.js";
3
3
  /**
4
4
  * Describes an AggregationEvent.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import type { IJsonLdContextDefinition } from "@twin.org/data-json-ld";
2
- import type { IEpcisEvent } from "./IEpcisEvent";
2
+ import type { IEpcisEvent } from "./IEpcisEvent.js";
3
3
  /**
4
4
  * EPCIS Document.
5
5
  */
@@ -1,6 +1,6 @@
1
1
  import type { IJsonLdContextDefinition } from "@twin.org/data-json-ld";
2
- import type { IDestination } from "./IDestination";
3
- import type { ISource } from "./ISource";
2
+ import type { IDestination } from "./IDestination.js";
3
+ import type { ISource } from "./ISource.js";
4
4
  /**
5
5
  * EPCIS Event.
6
6
  */
@@ -1,9 +1,9 @@
1
- import type { ActionTypes } from "./actionTypes";
2
- import type { BizStepTypes } from "./bizStepTypes";
3
- import type { DispositionTypes } from "./dispositionTypes";
4
- import type { IBizTransaction } from "./IBizTransaction";
5
- import type { IEpcisEvent } from "./IEpcisEvent";
6
- import type { ISimpleLocation } from "./ISimpleLocation";
1
+ import type { ActionTypes } from "./actionTypes.js";
2
+ import type { BizStepTypes } from "./bizStepTypes.js";
3
+ import type { DispositionTypes } from "./dispositionTypes.js";
4
+ import type { IBizTransaction } from "./IBizTransaction.js";
5
+ import type { IEpcisEvent } from "./IEpcisEvent.js";
6
+ import type { ISimpleLocation } from "./ISimpleLocation.js";
7
7
  /**
8
8
  * EPCIS Event Details.
9
9
  */
@@ -1,5 +1,5 @@
1
1
  import type { IJsonLdContextDefinition } from "@twin.org/data-json-ld";
2
- import type { IEpcisEvent } from "./IEpcisEvent";
2
+ import type { IEpcisEvent } from "./IEpcisEvent.js";
3
3
  /**
4
4
  * EPCIS Query Document.
5
5
  */
@@ -1,6 +1,6 @@
1
- import type { IEpcisEventDetails } from "./IEpcisEventDetails";
2
- import type { IQuantity } from "./IQuantity";
3
- import type { ISensorElement } from "./ISensorElement";
1
+ import type { IEpcisEventDetails } from "./IEpcisEventDetails.js";
2
+ import type { IQuantity } from "./IQuantity.js";
3
+ import type { ISensorElement } from "./ISensorElement.js";
4
4
  /**
5
5
  * Defines an EPCIS 2.0 Object Event.
6
6
  *
@@ -1,5 +1,5 @@
1
- import type { ISensorMetadata } from "./ISensorMetadata";
2
- import type { ISensorReport } from "./ISensorReport";
1
+ import type { ISensorMetadata } from "./ISensorMetadata.js";
2
+ import type { ISensorReport } from "./ISensorReport.js";
3
3
  /**
4
4
  * EPCIS SensorElement.
5
5
  */
@@ -1,6 +1,6 @@
1
- import type { IAggregationEvent } from "./IAggregationEvent";
2
- import type { IAssociationEvent } from "./IAssociationEvent";
3
- import type { IObjectEvent } from "./IObjectEvent";
1
+ import type { IAggregationEvent } from "./IAggregationEvent.js";
2
+ import type { IAssociationEvent } from "./IAssociationEvent.js";
3
+ import type { IObjectEvent } from "./IObjectEvent.js";
4
4
  /**
5
5
  * The type that subsumes an EPCIS Event.
6
6
  */
@@ -1,5 +1,5 @@
1
1
  import { type IValidationFailure } from "@twin.org/core";
2
- import type { IEPCClassUri } from "../models/epc/IEPCClassUri";
2
+ import type { IEPCClassUri } from "../models/epc/IEPCClassUri.js";
3
3
  /**
4
4
  * Validation for GS1 identifiers.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import { type IValidationFailure } from "@twin.org/core";
2
- import type { Gs1Location } from "../entities/gs1Location";
2
+ import type { Gs1Location } from "../entities/gs1Location.js";
3
3
  /**
4
4
  * Validation for GS1 types.
5
5
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # @twin.org/standards-gs1 - Changelog
2
2
 
3
+ ## [0.0.3-next.1](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.3-next.0...standards-gs1-v0.0.3-next.1) (2025-11-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * add context id features ([#64](https://github.com/twinfoundation/standards/issues/64)) ([e68bb87](https://github.com/twinfoundation/standards/commit/e68bb87a215f3c3956cfd6400a5e1e2a16256085))
9
+ * add validate-locales ([838389c](https://github.com/twinfoundation/standards/commit/838389c1daf62ed42397d5758d267c3d1a37fa4d))
10
+ * data types registered with full qualified names ([d64bd08](https://github.com/twinfoundation/standards/commit/d64bd082084172da543e9bfaffb78cdc34e6641d))
11
+ * eslint migration to flat config ([648c1a1](https://github.com/twinfoundation/standards/commit/648c1a1e69d99b6b0cf69358ec6bdeecdbe3a5ea))
12
+ * update framework core ([58c0c3d](https://github.com/twinfoundation/standards/commit/58c0c3dd6cea0e4c2393dc0e3e1eb33a6d06f617))
13
+ * update to latest JSON schema spec ([7a23930](https://github.com/twinfoundation/standards/commit/7a2393032d7f48bfb20d3a484f981fb6dd83a92c))
14
+ * use shared store mechanism ([#11](https://github.com/twinfoundation/standards/issues/11)) ([96fa237](https://github.com/twinfoundation/standards/commit/96fa23735f69c1fc7e3d0019b527634fa0a042d9))
15
+
16
+ ## [0.0.2-next.16](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.2-next.15...standards-gs1-v0.0.2-next.16) (2025-10-09)
17
+
18
+
19
+ ### Miscellaneous Chores
20
+
21
+ * **standards-gs1:** Synchronize repo versions
22
+
23
+ ## [0.0.2-next.15](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.2-next.14...standards-gs1-v0.0.2-next.15) (2025-10-09)
24
+
25
+
26
+ ### Features
27
+
28
+ * add validate-locales ([838389c](https://github.com/twinfoundation/standards/commit/838389c1daf62ed42397d5758d267c3d1a37fa4d))
29
+
30
+ ## [0.0.2-next.14](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.2-next.13...standards-gs1-v0.0.2-next.14) (2025-10-02)
31
+
32
+
33
+ ### Miscellaneous Chores
34
+
35
+ * **standards-gs1:** Synchronize repo versions
36
+
37
+ ## [0.0.2-next.13](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.2-next.12...standards-gs1-v0.0.2-next.13) (2025-09-22)
38
+
39
+
40
+ ### Miscellaneous Chores
41
+
42
+ * **standards-gs1:** Synchronize repo versions
43
+
44
+ ## [0.0.2-next.12](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.2-next.11...standards-gs1-v0.0.2-next.12) (2025-09-16)
45
+
46
+
47
+ ### Miscellaneous Chores
48
+
49
+ * **standards-gs1:** Synchronize repo versions
50
+
51
+ ## [0.0.2-next.11](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.2-next.10...standards-gs1-v0.0.2-next.11) (2025-09-16)
52
+
53
+
54
+ ### Miscellaneous Chores
55
+
56
+ * **standards-gs1:** Synchronize repo versions
57
+
58
+ ## [0.0.2-next.10](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.2-next.9...standards-gs1-v0.0.2-next.10) (2025-09-16)
59
+
60
+
61
+ ### Miscellaneous Chores
62
+
63
+ * **standards-gs1:** Synchronize repo versions
64
+
3
65
  ## [0.0.2-next.9](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.2-next.8...standards-gs1-v0.0.2-next.9) (2025-09-15)
4
66
 
5
67
 
@@ -152,7 +152,7 @@ True if the value is valid epc.
152
152
 
153
153
  ### extractEpcIdGtin()
154
154
 
155
- > `static` **extractEpcIdGtin**(`epc`): `undefined` \| `string`
155
+ > `static` **extractEpcIdGtin**(`epc`): `string` \| `undefined`
156
156
 
157
157
  Extract the EPC gtin from the URI.
158
158
 
@@ -166,7 +166,7 @@ The uri to extract from.
166
166
 
167
167
  #### Returns
168
168
 
169
- `undefined` \| `string`
169
+ `string` \| `undefined`
170
170
 
171
171
  The extracted data or undefined.
172
172
 
@@ -174,7 +174,7 @@ The extracted data or undefined.
174
174
 
175
175
  ### extractEpcIdGln()
176
176
 
177
- > `static` **extractEpcIdGln**(`epc`): `undefined` \| `string`
177
+ > `static` **extractEpcIdGln**(`epc`): `string` \| `undefined`
178
178
 
179
179
  Extract the EPC gln from the URI.
180
180
 
@@ -188,7 +188,7 @@ The uri to extract from.
188
188
 
189
189
  #### Returns
190
190
 
191
- `undefined` \| `string`
191
+ `string` \| `undefined`
192
192
 
193
193
  The extracted data or undefined.
194
194
 
@@ -196,7 +196,7 @@ The extracted data or undefined.
196
196
 
197
197
  ### extractEpcClassUri()
198
198
 
199
- > `static` **extractEpcClassUri**(`epc`): `undefined` \| [`IEPCClassUri`](../interfaces/IEPCClassUri.md)
199
+ > `static` **extractEpcClassUri**(`epc`): [`IEPCClassUri`](../interfaces/IEPCClassUri.md) \| `undefined`
200
200
 
201
201
  Extract The EPC Class from the URI.
202
202
 
@@ -210,6 +210,6 @@ The uri to extract from.
210
210
 
211
211
  #### Returns
212
212
 
213
- `undefined` \| [`IEPCClassUri`](../interfaces/IEPCClassUri.md)
213
+ [`IEPCClassUri`](../interfaces/IEPCClassUri.md) \| `undefined`
214
214
 
215
215
  The extracted data or undefined.
package/locales/en.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "error": {
3
3
  "validation": {
4
- "gs1SegmentMissing": "The GS1 EPC for should contain \"{segment}\"",
5
4
  "gs1IncorrectSegmentCount": "The GS1 EPC has an incorrect segment count",
6
5
  "gs1ValueIncorrect": "The GS1 EPC value segment is not in the correct format",
7
6
  "gs1EpcClassIncorrect": "The GS1 EPC class uri is not in the correct format",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/standards-gs1",
3
- "version": "0.0.2-next.9",
3
+ "version": "0.0.3-next.1",
4
4
  "description": "Models which define the structure of GS1 Standard",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,22 +20,34 @@
20
20
  "@twin.org/entity": "next",
21
21
  "@twin.org/nameof": "next"
22
22
  },
23
- "main": "./dist/cjs/index.cjs",
24
- "module": "./dist/esm/index.mjs",
23
+ "main": "./dist/es/index.js",
25
24
  "types": "./dist/types/index.d.ts",
26
25
  "exports": {
27
26
  ".": {
28
27
  "types": "./dist/types/index.d.ts",
29
- "require": "./dist/cjs/index.cjs",
30
- "import": "./dist/esm/index.mjs"
28
+ "import": "./dist/es/index.js",
29
+ "default": "./dist/es/index.js"
31
30
  },
32
31
  "./locales/*.json": "./locales/*.json"
33
32
  },
34
33
  "files": [
35
- "dist/cjs",
36
- "dist/esm",
34
+ "dist/es",
37
35
  "dist/types",
38
36
  "locales",
39
37
  "docs"
40
- ]
38
+ ],
39
+ "keywords": [
40
+ "twin",
41
+ "trade",
42
+ "iota",
43
+ "framework",
44
+ "blockchain",
45
+ "standards",
46
+ "schema",
47
+ "specification"
48
+ ],
49
+ "bugs": {
50
+ "url": "git+https://github.com/twinfoundation/standards/issues"
51
+ },
52
+ "homepage": "https://twindev.org"
41
53
  }