@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
@@ -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;;GAE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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 { Gs1SubSiteAttributes } from "../models/gs1/gs1SubSiteAttributes.js";
7
+ import { Gs1SubSiteTypes } from "../models/gs1/gs1SubSiteTypes.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(Gs1SubSiteTypes), failures);
43
+ }
44
+ if (Is.notEmpty(value.ssa)) {
45
+ Validation.arrayOneOf("value.ssa", value.ssa, Object.values(Gs1SubSiteAttributes), 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,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE;;GAEG;AACH,MAAM,OAAO,aAAa;IACzB;;;;;;;OAOG;IACI,MAAM,CAAC,kBAAkB,CAC/B,YAAoB,EACpB,KAAkB,EAClB,QAA8B,EAC9B,SAAmB;QAEnB,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAc,KAAK,CAAC,CAAC;QAEzC,IAAI,EAAE,EAAE,CAAC;YACR,IAAI,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC9B,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,GAAG,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;gBACpF,IAAI,iBAAiB,EAAE,CAAC;oBACvB,iBAAiB,CAAC,QAAQ,uBAAiC,KAAK,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;gBAChF,CAAC;YACF,CAAC;YAED,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/D,QAAQ,CAAC,IAAI,CAAC;oBACb,QAAQ,4BAAsC;oBAC9C,MAAM,EAAE,mCAAmC;iBAC3C,CAAC,CAAC;YACJ,CAAC;YAED,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;gBACjE,QAAQ,CAAC,IAAI,CAAC;oBACb,QAAQ,6BAAuC;oBAC/C,MAAM,EAAE,oCAAoC;iBAC5C,CAAC,CAAC;YACJ,CAAC;YAED,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC5B,UAAU,CAAC,UAAU,cAEpB,KAAK,CAAC,GAAG,EACT,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,EAC9B,QAAQ,CACR,CAAC;YACH,CAAC;YAED,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC5B,UAAU,CAAC,UAAU,cAEpB,KAAK,CAAC,GAAG,EACT,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,EACnC,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 { Gs1SubSiteAttributes } from \"../models/gs1/gs1SubSiteAttributes.js\";\nimport { Gs1SubSiteTypes } from \"../models/gs1/gs1SubSiteTypes.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(\n\t\t\t\t\tnameof(value.sst),\n\t\t\t\t\tvalue.sst,\n\t\t\t\t\tObject.values(Gs1SubSiteTypes),\n\t\t\t\t\tfailures\n\t\t\t\t);\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(Gs1SubSiteAttributes),\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 { Gs1SubSiteAttributes } from "../models/gs1/gs1SubSiteAttributes.js";
2
+ import type { Gs1SubSiteTypes } from "../models/gs1/gs1SubSiteTypes.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 .
@@ -17,11 +17,11 @@ export declare class Gs1Location {
17
17
  /**
18
18
  * Sub site type describes the primary business function of the sub site location.
19
19
  */
20
- sst?: SubSiteTypes;
20
+ sst?: Gs1SubSiteTypes;
21
21
  /**
22
22
  * Sub site attribute further qualifies the business function of the sub site location.
23
23
  */
24
- ssa?: SubSiteAttributes;
24
+ ssa?: Gs1SubSiteAttributes;
25
25
  /**
26
26
  * Sub site detail provides additional proprietary information.
27
27
  */
@@ -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/epcisActionTypes.js";
6
+ export * from "./models/epcis20/epcisBizStepTypes.js";
7
+ export * from "./models/epcis20/epcisDispositionTypes.js";
8
+ export * from "./models/epcis20/epcisErrorTypes.js";
9
+ export * from "./models/epcis20/epcisEventUnionType.js";
10
+ export * from "./models/epcis20/epcisEventTypes.js";
11
+ export * from "./models/epcis20/IEpcisAggregationEvent.js";
12
+ export * from "./models/epcis20/IEpcisAssociationEvent.js";
13
+ export * from "./models/epcis20/IEpcisBizTransaction.js";
14
+ export * from "./models/epcis20/IEpcisDestination.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/IEpcisObjectEvent.js";
21
+ export * from "./models/epcis20/IEpcisQuantity.js";
22
+ export * from "./models/epcis20/IEpcisSensorElement.js";
23
+ export * from "./models/epcis20/IEpcisSensorMetadata.js";
24
+ export * from "./models/epcis20/IEpcisSensorReport.js";
25
+ export * from "./models/epcis20/IEpcisSimpleLocation.js";
26
+ export * from "./models/epcis20/IEpcisSource.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/gs1SubSiteAttributes.js";
32
+ export * from "./models/gs1/gs1SubSiteTypes.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 "./IEpcisBaseAggregationEvent.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 "./IEpcisBaseAggregationEvent.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 "./IEpcisQuantity.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 "./IEpcisDestination.js";
3
+ import type { ISource } from "./IEpcisSource.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 { EpcisActionTypes } from "./epcisActionTypes.js";
2
+ import type { EpcisBizStepTypes } from "./epcisBizStepTypes.js";
3
+ import type { EpcisDispositionTypes } from "./epcisDispositionTypes.js";
4
+ import type { IBizTransaction } from "./IEpcisBizTransaction.js";
5
+ import type { IEpcisEvent } from "./IEpcisEvent.js";
6
+ import type { ISimpleLocation } from "./IEpcisSimpleLocation.js";
7
7
  /**
8
8
  * EPCIS Event Details.
9
9
  */
@@ -11,7 +11,7 @@ export interface IEpcisEventDetails extends IEpcisEvent {
11
11
  /**
12
12
  * Action: ADD, OBSERVE, DELETE.
13
13
  */
14
- action: ActionTypes;
14
+ action: EpcisActionTypes;
15
15
  /**
16
16
  * The location of reading point.
17
17
  */
@@ -23,11 +23,11 @@ export interface IEpcisEventDetails extends IEpcisEvent {
23
23
  /**
24
24
  * The business step as per EPCIS.
25
25
  */
26
- bizStep?: BizStepTypes;
26
+ bizStep?: EpcisBizStepTypes;
27
27
  /**
28
28
  * The disposition as per EPCIS.
29
29
  */
30
- disposition?: DispositionTypes;
30
+ disposition?: EpcisDispositionTypes;
31
31
  /**
32
32
  * The list of related business transactions.
33
33
  */
@@ -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 "./IEpcisQuantity.js";
3
+ import type { ISensorElement } from "./IEpcisSensorElement.js";
4
4
  /**
5
5
  * Defines an EPCIS 2.0 Object Event.
6
6
  *
@@ -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,5 +1,5 @@
1
- import type { ISensorMetadata } from "./ISensorMetadata";
2
- import type { ISensorReport } from "./ISensorReport";
1
+ import type { ISensorMetadata } from "./IEpcisSensorMetadata.js";
2
+ import type { ISensorReport } from "./IEpcisSensorReport.js";
3
3
  /**
4
4
  * EPCIS SensorElement.
5
5
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * EPCIS 2.0 action types.
3
3
  */
4
- export declare const ActionTypes: {
4
+ export declare const EpcisActionTypes: {
5
5
  /**
6
6
  * ADD action.
7
7
  */
@@ -18,4 +18,4 @@ export declare const ActionTypes: {
18
18
  /**
19
19
  * EPCIS 2.0 action types.
20
20
  */
21
- export type ActionTypes = (typeof ActionTypes)[keyof typeof ActionTypes];
21
+ export type EpcisActionTypes = (typeof EpcisActionTypes)[keyof typeof EpcisActionTypes];
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * See EPCIS CVB specification for details.
5
5
  */
6
- export declare const BizStepTypes: {
6
+ export declare const EpcisBizStepTypes: {
7
7
  readonly Accepting: "accepting";
8
8
  readonly Arriving: "arriving";
9
9
  readonly Assembling: "assembling";
@@ -49,4 +49,4 @@ export declare const BizStepTypes: {
49
49
  /**
50
50
  * EPCIS 2.0 action types.
51
51
  */
52
- export type BizStepTypes = (typeof BizStepTypes)[keyof typeof BizStepTypes];
52
+ export type EpcisBizStepTypes = (typeof EpcisBizStepTypes)[keyof typeof EpcisBizStepTypes];
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * See EPCIS CVB for more details.
5
5
  */
6
- export declare const DispositionTypes: {
6
+ export declare const EpcisDispositionTypes: {
7
7
  readonly Active: "active";
8
8
  readonly ContainerClosed: "container_closed";
9
9
  readonly Damaged: "damaged";
@@ -41,4 +41,4 @@ export declare const DispositionTypes: {
41
41
  /**
42
42
  * EPCIS 2.0 disposition types.
43
43
  */
44
- export type DispositionTypes = (typeof DispositionTypes)[keyof typeof DispositionTypes];
44
+ export type EpcisDispositionTypes = (typeof EpcisDispositionTypes)[keyof typeof EpcisDispositionTypes];
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * EPCIS 2.0 event types.
3
3
  */
4
- export declare const EventTypes: {
4
+ export declare const EpcisEventTypes: {
5
5
  /**
6
6
  * ObjectEvent.
7
7
  */
@@ -26,4 +26,4 @@ export declare const EventTypes: {
26
26
  /**
27
27
  * EPCIS 2.0 event types.
28
28
  */
29
- export type EventTypes = (typeof EventTypes)[keyof typeof EventTypes];
29
+ export type EpcisEventTypes = (typeof EpcisEventTypes)[keyof typeof EpcisEventTypes];
@@ -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 "./IEpcisAggregationEvent.js";
2
+ import type { IAssociationEvent } from "./IEpcisAssociationEvent.js";
3
+ import type { IObjectEvent } from "./IEpcisObjectEvent.js";
4
4
  /**
5
5
  * The type that subsumes an EPCIS Event.
6
6
  */
@@ -3,7 +3,7 @@
3
3
  * Spec https://www.gs1.org/sites/default/files/docs/epc/CBV-Standard-1-2-1-r-2017-05-05.pdf .
4
4
  * Section 10.3.2 .
5
5
  */
6
- export declare const SubSiteAttributes: {
6
+ export declare const Gs1SubSiteAttributes: {
7
7
  /**
8
8
  * Electronics.
9
9
  */
@@ -142,4 +142,4 @@ export declare const SubSiteAttributes: {
142
142
  * Spec https://www.gs1.org/sites/default/files/docs/epc/CBV-Standard-1-2-1-r-2017-05-05.pdf .
143
143
  * Section 10.3.2 .
144
144
  */
145
- export type SubSiteAttributes = (typeof SubSiteAttributes)[keyof typeof SubSiteAttributes];
145
+ export type Gs1SubSiteAttributes = (typeof Gs1SubSiteAttributes)[keyof typeof Gs1SubSiteAttributes];
@@ -3,7 +3,7 @@
3
3
  * Spec https://www.gs1.org/sites/default/files/docs/epc/CBV-Standard-1-2-1-r-2017-05-05.pdf .
4
4
  * Section 10.3.1 .
5
5
  */
6
- export declare const SubSiteTypes: {
6
+ export declare const Gs1SubSiteTypes: {
7
7
  /**
8
8
  * The Backroom.
9
9
  */
@@ -74,4 +74,4 @@ export declare const SubSiteTypes: {
74
74
  * Spec https://www.gs1.org/sites/default/files/docs/epc/CBV-Standard-1-2-1-r-2017-05-05.pdf .
75
75
  * Section 10.3.1 .
76
76
  */
77
- export type SubSiteTypes = (typeof SubSiteTypes)[keyof typeof SubSiteTypes];
77
+ export type Gs1SubSiteTypes = (typeof Gs1SubSiteTypes)[keyof typeof Gs1SubSiteTypes];
@@ -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,130 @@
1
1
  # @twin.org/standards-gs1 - Changelog
2
2
 
3
+ ## [0.0.3-next.10](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.3-next.9...standards-gs1-v0.0.3-next.10) (2026-01-13)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **standards-gs1:** Synchronize repo versions
9
+
10
+ ## [0.0.3-next.9](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.3-next.8...standards-gs1-v0.0.3-next.9) (2026-01-09)
11
+
12
+
13
+ ### Miscellaneous Chores
14
+
15
+ * **standards-gs1:** Synchronize repo versions
16
+
17
+ ## [0.0.3-next.8](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.3-next.7...standards-gs1-v0.0.3-next.8) (2026-01-08)
18
+
19
+
20
+ ### Miscellaneous Chores
21
+
22
+ * **standards-gs1:** Synchronize repo versions
23
+
24
+ ## [0.0.3-next.7](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.3-next.6...standards-gs1-v0.0.3-next.7) (2026-01-06)
25
+
26
+
27
+ ### Features
28
+
29
+ * update type names ([#89](https://github.com/twinfoundation/standards/issues/89)) ([6fdef47](https://github.com/twinfoundation/standards/commit/6fdef4792151f89d1a95a07da8309d05a7b6de3d))
30
+
31
+ ## [0.0.3-next.6](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.3-next.5...standards-gs1-v0.0.3-next.6) (2025-12-03)
32
+
33
+
34
+ ### Miscellaneous Chores
35
+
36
+ * **standards-gs1:** Synchronize repo versions
37
+
38
+ ## [0.0.3-next.5](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.3-next.4...standards-gs1-v0.0.3-next.5) (2025-11-28)
39
+
40
+
41
+ ### Miscellaneous Chores
42
+
43
+ * **standards-gs1:** Synchronize repo versions
44
+
45
+ ## [0.0.3-next.4](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.3-next.3...standards-gs1-v0.0.3-next.4) (2025-11-18)
46
+
47
+
48
+ ### Miscellaneous Chores
49
+
50
+ * **standards-gs1:** Synchronize repo versions
51
+
52
+ ## [0.0.3-next.3](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.3-next.2...standards-gs1-v0.0.3-next.3) (2025-11-18)
53
+
54
+
55
+ ### Miscellaneous Chores
56
+
57
+ * **standards-gs1:** Synchronize repo versions
58
+
59
+ ## [0.0.3-next.2](https://github.com/twinfoundation/standards/compare/standards-gs1-v0.0.3-next.1...standards-gs1-v0.0.3-next.2) (2025-11-11)
60
+
61
+
62
+ ### Miscellaneous Chores
63
+
64
+ * **standards-gs1:** Synchronize repo versions
65
+
66
+ ## [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)
67
+
68
+
69
+ ### Features
70
+
71
+ * add context id features ([#64](https://github.com/twinfoundation/standards/issues/64)) ([e68bb87](https://github.com/twinfoundation/standards/commit/e68bb87a215f3c3956cfd6400a5e1e2a16256085))
72
+ * add validate-locales ([838389c](https://github.com/twinfoundation/standards/commit/838389c1daf62ed42397d5758d267c3d1a37fa4d))
73
+ * data types registered with full qualified names ([d64bd08](https://github.com/twinfoundation/standards/commit/d64bd082084172da543e9bfaffb78cdc34e6641d))
74
+ * eslint migration to flat config ([648c1a1](https://github.com/twinfoundation/standards/commit/648c1a1e69d99b6b0cf69358ec6bdeecdbe3a5ea))
75
+ * update framework core ([58c0c3d](https://github.com/twinfoundation/standards/commit/58c0c3dd6cea0e4c2393dc0e3e1eb33a6d06f617))
76
+ * update to latest JSON schema spec ([7a23930](https://github.com/twinfoundation/standards/commit/7a2393032d7f48bfb20d3a484f981fb6dd83a92c))
77
+ * use shared store mechanism ([#11](https://github.com/twinfoundation/standards/issues/11)) ([96fa237](https://github.com/twinfoundation/standards/commit/96fa23735f69c1fc7e3d0019b527634fa0a042d9))
78
+
79
+ ## [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)
80
+
81
+
82
+ ### Miscellaneous Chores
83
+
84
+ * **standards-gs1:** Synchronize repo versions
85
+
86
+ ## [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)
87
+
88
+
89
+ ### Features
90
+
91
+ * add validate-locales ([838389c](https://github.com/twinfoundation/standards/commit/838389c1daf62ed42397d5758d267c3d1a37fa4d))
92
+
93
+ ## [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)
94
+
95
+
96
+ ### Miscellaneous Chores
97
+
98
+ * **standards-gs1:** Synchronize repo versions
99
+
100
+ ## [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)
101
+
102
+
103
+ ### Miscellaneous Chores
104
+
105
+ * **standards-gs1:** Synchronize repo versions
106
+
107
+ ## [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)
108
+
109
+
110
+ ### Miscellaneous Chores
111
+
112
+ * **standards-gs1:** Synchronize repo versions
113
+
114
+ ## [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)
115
+
116
+
117
+ ### Miscellaneous Chores
118
+
119
+ * **standards-gs1:** Synchronize repo versions
120
+
121
+ ## [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)
122
+
123
+
124
+ ### Miscellaneous Chores
125
+
126
+ * **standards-gs1:** Synchronize repo versions
127
+
3
128
  ## [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
129
 
5
130
 
@@ -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.