@aidc-toolkit/gs1 1.0.32-beta → 1.0.34-beta

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 (51) hide show
  1. package/README.md +290 -21
  2. package/dist/character-set.d.ts.map +1 -1
  3. package/dist/character-set.js +44 -11
  4. package/dist/character-set.js.map +1 -1
  5. package/dist/gcp-length-cache.d.ts +54 -15
  6. package/dist/gcp-length-cache.d.ts.map +1 -1
  7. package/dist/gcp-length-cache.js +181 -45
  8. package/dist/gcp-length-cache.js.map +1 -1
  9. package/dist/gcp-length-data.d.ts +74 -20
  10. package/dist/gcp-length-data.d.ts.map +1 -1
  11. package/dist/gcp-length-data.js +39 -15
  12. package/dist/gcp-length-data.js.map +1 -1
  13. package/dist/gcp-length.d.ts +1 -1
  14. package/dist/gcp-length.d.ts.map +1 -1
  15. package/dist/gcp-length.js +5 -6
  16. package/dist/gcp-length.js.map +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/locale/en/locale-resources.d.ts +39 -36
  22. package/dist/locale/en/locale-resources.d.ts.map +1 -1
  23. package/dist/locale/en/locale-resources.js +4 -1
  24. package/dist/locale/en/locale-resources.js.map +1 -1
  25. package/dist/locale/fr/locale-resources.d.ts +39 -36
  26. package/dist/locale/fr/locale-resources.d.ts.map +1 -1
  27. package/dist/locale/fr/locale-resources.js +4 -1
  28. package/dist/locale/fr/locale-resources.js.map +1 -1
  29. package/dist/locale/i18n.d.ts +6 -3
  30. package/dist/locale/i18n.d.ts.map +1 -1
  31. package/dist/locale/i18n.js +8 -6
  32. package/dist/locale/i18n.js.map +1 -1
  33. package/dist/numeric-identifier-validator.d.ts.map +1 -1
  34. package/dist/numeric-identifier-validator.js.map +1 -1
  35. package/dist/variable-measure.d.ts +4 -4
  36. package/dist/variable-measure.js +4 -4
  37. package/package.json +12 -10
  38. package/src/character-set.ts +55 -11
  39. package/src/gcp-length-cache.ts +208 -54
  40. package/src/gcp-length-data.ts +95 -27
  41. package/src/gcp-length.ts +5 -43
  42. package/src/index.ts +2 -1
  43. package/src/locale/en/locale-resources.ts +5 -2
  44. package/src/locale/fr/locale-resources.ts +5 -2
  45. package/src/locale/i18n.ts +9 -7
  46. package/src/locale/i18next.d.ts +2 -0
  47. package/src/numeric-identifier-validator.ts +1 -1
  48. package/src/variable-measure.ts +4 -4
  49. package/test/character-set.test.ts +46 -0
  50. package/test/gcp-length.test.ts +179 -240
  51. package/tsconfig-src.tsbuildinfo +1 -1
@@ -1,42 +1,45 @@
1
1
  declare const _default: {
2
- readonly Check: {
3
- readonly lengthOfStringForPriceOrWeightMustBeExactly: "Length {{length, number}} of string for price or weight must be 4 or 5";
4
- readonly priceOrWeightComponent: "price or weight";
5
- readonly lengthOfStringForCheckCharacterPairMustBeLessThanOrEqualTo: "Length {{length, number}} of string for check character pair must be less than or equal to {{maximumLength, number}}";
2
+ AI64CharacterSetValidator: {
3
+ lengthMustBeMultipleOf4: string;
6
4
  };
7
- readonly Identifier: {
8
- readonly identifierTypeLength: "{{identifierType}} must be {{length, number}} digits long";
9
- readonly invalidCheckDigit: "Invalid check digit";
10
- readonly invalidGTINLength: "GTIN must be 13, 12, 8, or 14 digits long";
11
- readonly invalidGTIN14Length: "GTIN must be 14 digits long";
12
- readonly invalidZeroSuppressedGTIN12: "Invalid zero-suppressed GTIN-12";
13
- readonly invalidZeroSuppressibleGTIN12: "GTIN-12 not zero-suppressible";
14
- readonly invalidZeroSuppressedGTIN12AsGTIN13: "Invalid zero-suppressed GTIN-12 as GTIN-13";
15
- readonly invalidZeroSuppressedGTIN12AsGTIN14: "Invalid zero-suppressed GTIN-12 as GTIN-14";
16
- readonly invalidGTINAtRetail: "GTIN not supported at retail consumer trade item level";
17
- readonly invalidGTINAtOtherThanRetail: "GTIN not supported at other than retail consumer trade item level";
18
- readonly invalidRCNLength: "RCN length must match format length";
19
- readonly invalidVariableMeasureRCNFormat: "Invalid variable measure RCN format";
20
- readonly invalidVariableMeasureRCNPrefix: "Invalid variable measure RCN prefix";
21
- readonly invalidVariableMeasurePriceOrWeight: "Invalid variable measure price or weight";
22
- readonly indicatorDigit: "indicator digit";
23
- readonly serialComponent: "serial component";
24
- readonly reference: "reference";
25
- readonly referenceCantBeAllNumeric: "Reference can't be all-numeric";
26
- readonly invalidCheckCharacterPair: "Invalid check character pair";
5
+ Check: {
6
+ lengthOfStringForPriceOrWeightMustBeExactly: string;
7
+ priceOrWeightComponent: string;
8
+ lengthOfStringForCheckCharacterPairMustBeLessThanOrEqualTo: string;
27
9
  };
28
- readonly Prefix: {
29
- readonly gs1CompanyPrefix: "GS1 Company Prefix";
30
- readonly upcCompanyPrefix: "U.P.C. Company Prefix";
31
- readonly gs18Prefix: "GS1-8 Prefix";
32
- readonly gs1CompanyPrefixCantStartWith0: "GS1 Company Prefix can't start with \"0\"";
33
- readonly gs1CompanyPrefixCantStartWith00000: "GS1 Company Prefix can't start with \"00000\"";
34
- readonly gs1CompanyPrefixCantStartWith000000: "GS1 Company Prefix can't start with \"000000\"";
35
- readonly upcCompanyPrefixCantStartWith0000: "U.P.C. Company Prefix can't start with \"0000\"";
36
- readonly gs18PrefixCantStartWith0: "GS1-8 Prefix can't start with \"0\"";
37
- readonly identifierTypeNotSupportedByGS18Prefix: "{{identifierType}} not supported by GS1-8 Prefix";
38
- readonly gs1CompanyPrefixLengthDataHTTPError: "HTTP error {{status, number}} loading GS1 Company Prefix length data";
39
- readonly gs1CompanyPrefixLengthDataNotLoaded: "GS1 Company Prefix length data not loaded";
10
+ Identifier: {
11
+ identifierTypeLength: string;
12
+ invalidCheckDigit: string;
13
+ invalidGTINLength: string;
14
+ invalidGTIN14Length: string;
15
+ invalidZeroSuppressedGTIN12: string;
16
+ invalidZeroSuppressibleGTIN12: string;
17
+ invalidZeroSuppressedGTIN12AsGTIN13: string;
18
+ invalidZeroSuppressedGTIN12AsGTIN14: string;
19
+ invalidGTINAtRetail: string;
20
+ invalidGTINAtOtherThanRetail: string;
21
+ invalidRCNLength: string;
22
+ invalidVariableMeasureRCNFormat: string;
23
+ invalidVariableMeasureRCNPrefix: string;
24
+ invalidVariableMeasurePriceOrWeight: string;
25
+ indicatorDigit: string;
26
+ serialComponent: string;
27
+ reference: string;
28
+ referenceCantBeAllNumeric: string;
29
+ invalidCheckCharacterPair: string;
30
+ };
31
+ Prefix: {
32
+ gs1CompanyPrefix: string;
33
+ upcCompanyPrefix: string;
34
+ gs18Prefix: string;
35
+ gs1CompanyPrefixCantStartWith0: string;
36
+ gs1CompanyPrefixCantStartWith00000: string;
37
+ gs1CompanyPrefixCantStartWith000000: string;
38
+ upcCompanyPrefixCantStartWith0000: string;
39
+ gs18PrefixCantStartWith0: string;
40
+ identifierTypeNotSupportedByGS18Prefix: string;
41
+ gs1CompanyPrefixLengthDataFileNotFound: string;
42
+ gs1CompanyPrefixLengthDataNotLoaded: string;
40
43
  };
41
44
  };
42
45
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"locale-resources.d.ts","sourceRoot":"","sources":["../../../src/locale/en/locale-resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBAwCW"}
1
+ {"version":3,"file":"locale-resources.d.ts","sourceRoot":"","sources":["../../../src/locale/en/locale-resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBA2CE"}
@@ -1,4 +1,7 @@
1
1
  export default {
2
+ AI64CharacterSetValidator: {
3
+ lengthMustBeMultipleOf4: "Length {{length, number}} must be a multiple of 4"
4
+ },
2
5
  Check: {
3
6
  lengthOfStringForPriceOrWeightMustBeExactly: "Length {{length, number}} of string for price or weight must be 4 or 5",
4
7
  priceOrWeightComponent: "price or weight",
@@ -35,7 +38,7 @@ export default {
35
38
  upcCompanyPrefixCantStartWith0000: "U.P.C. Company Prefix can't start with \"0000\"",
36
39
  gs18PrefixCantStartWith0: "GS1-8 Prefix can't start with \"0\"",
37
40
  identifierTypeNotSupportedByGS18Prefix: "{{identifierType}} not supported by GS1-8 Prefix",
38
- gs1CompanyPrefixLengthDataHTTPError: "HTTP error {{status, number}} loading GS1 Company Prefix length data",
41
+ gs1CompanyPrefixLengthDataFileNotFound: "GS1 Company Prefix length data \"{{key}}\" not found",
39
42
  gs1CompanyPrefixLengthDataNotLoaded: "GS1 Company Prefix length data not loaded"
40
43
  }
41
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"locale-resources.js","sourceRoot":"","sources":["../../../src/locale/en/locale-resources.ts"],"names":[],"mappings":"AAAA,eAAe;IACX,KAAK,EAAE;QACH,2CAA2C,EAAE,wEAAwE;QACrH,sBAAsB,EAAE,iBAAiB;QACzC,0DAA0D,EAAE,sHAAsH;KACrL;IACD,UAAU,EAAE;QACR,oBAAoB,EAAE,2DAA2D;QACjF,iBAAiB,EAAE,qBAAqB;QACxC,iBAAiB,EAAE,2CAA2C;QAC9D,mBAAmB,EAAE,6BAA6B;QAClD,2BAA2B,EAAE,iCAAiC;QAC9D,6BAA6B,EAAE,+BAA+B;QAC9D,mCAAmC,EAAE,4CAA4C;QACjF,mCAAmC,EAAE,4CAA4C;QACjF,mBAAmB,EAAE,wDAAwD;QAC7E,4BAA4B,EAAE,mEAAmE;QACjG,gBAAgB,EAAE,qCAAqC;QACvD,+BAA+B,EAAE,qCAAqC;QACtE,+BAA+B,EAAE,qCAAqC;QACtE,mCAAmC,EAAE,0CAA0C;QAC/E,cAAc,EAAE,iBAAiB;QACjC,eAAe,EAAE,kBAAkB;QACnC,SAAS,EAAE,WAAW;QACtB,yBAAyB,EAAE,gCAAgC;QAC3D,yBAAyB,EAAE,8BAA8B;KAC5D;IACD,MAAM,EAAE;QACJ,gBAAgB,EAAE,oBAAoB;QACtC,gBAAgB,EAAE,uBAAuB;QACzC,UAAU,EAAE,cAAc;QAC1B,8BAA8B,EAAE,2CAA2C;QAC3E,kCAAkC,EAAE,+CAA+C;QACnF,mCAAmC,EAAE,gDAAgD;QACrF,iCAAiC,EAAE,iDAAiD;QACpF,wBAAwB,EAAE,qCAAqC;QAC/D,sCAAsC,EAAE,kDAAkD;QAC1F,mCAAmC,EAAE,sEAAsE;QAC3G,mCAAmC,EAAE,2CAA2C;KACnF;CACK,CAAC"}
1
+ {"version":3,"file":"locale-resources.js","sourceRoot":"","sources":["../../../src/locale/en/locale-resources.ts"],"names":[],"mappings":"AAAA,eAAe;IACX,yBAAyB,EAAE;QACvB,uBAAuB,EAAE,mDAAmD;KAC/E;IACD,KAAK,EAAE;QACH,2CAA2C,EAAE,wEAAwE;QACrH,sBAAsB,EAAE,iBAAiB;QACzC,0DAA0D,EAAE,sHAAsH;KACrL;IACD,UAAU,EAAE;QACR,oBAAoB,EAAE,2DAA2D;QACjF,iBAAiB,EAAE,qBAAqB;QACxC,iBAAiB,EAAE,2CAA2C;QAC9D,mBAAmB,EAAE,6BAA6B;QAClD,2BAA2B,EAAE,iCAAiC;QAC9D,6BAA6B,EAAE,+BAA+B;QAC9D,mCAAmC,EAAE,4CAA4C;QACjF,mCAAmC,EAAE,4CAA4C;QACjF,mBAAmB,EAAE,wDAAwD;QAC7E,4BAA4B,EAAE,mEAAmE;QACjG,gBAAgB,EAAE,qCAAqC;QACvD,+BAA+B,EAAE,qCAAqC;QACtE,+BAA+B,EAAE,qCAAqC;QACtE,mCAAmC,EAAE,0CAA0C;QAC/E,cAAc,EAAE,iBAAiB;QACjC,eAAe,EAAE,kBAAkB;QACnC,SAAS,EAAE,WAAW;QACtB,yBAAyB,EAAE,gCAAgC;QAC3D,yBAAyB,EAAE,8BAA8B;KAC5D;IACD,MAAM,EAAE;QACJ,gBAAgB,EAAE,oBAAoB;QACtC,gBAAgB,EAAE,uBAAuB;QACzC,UAAU,EAAE,cAAc;QAC1B,8BAA8B,EAAE,2CAA2C;QAC3E,kCAAkC,EAAE,+CAA+C;QACnF,mCAAmC,EAAE,gDAAgD;QACrF,iCAAiC,EAAE,iDAAiD;QACpF,wBAAwB,EAAE,qCAAqC;QAC/D,sCAAsC,EAAE,kDAAkD;QAC1F,sCAAsC,EAAE,sDAAsD;QAC9F,mCAAmC,EAAE,2CAA2C;KACnF;CACJ,CAAC"}
@@ -1,42 +1,45 @@
1
1
  declare const _default: {
2
- readonly Check: {
3
- readonly lengthOfStringForPriceOrWeightMustBeExactly: "La longueur {{length, number}} de la chaîne pour le prix ou le poids doit être 4 ou 5";
4
- readonly priceOrWeightComponent: "prix ou poids";
5
- readonly lengthOfStringForCheckCharacterPairMustBeLessThanOrEqualTo: "La longueur {{length, number}} de la chaîne pour la paire de caractères de vérification doit être inférieure ou égale à {{maximumLength, number}}";
2
+ AI64CharacterSetValidator: {
3
+ lengthMustBeMultipleOf4: string;
6
4
  };
7
- readonly Identifier: {
8
- readonly identifierTypeLength: "{{identifierType}} doit comporter {{length, number}} chiffres";
9
- readonly invalidCheckDigit: "Chiffre de contrôle non valide";
10
- readonly invalidGTINLength: "Le GTIN doit comporter 13, 12, 8 ou 14 chiffres";
11
- readonly invalidGTIN14Length: "Le GTIN doit comporter 14 chiffres";
12
- readonly invalidZeroSuppressedGTIN12: "Code GTIN-12 non valide avec zéro supprimé";
13
- readonly invalidZeroSuppressibleGTIN12: "Le GTIN-12 ne peut pas être supprimé par zéro";
14
- readonly invalidZeroSuppressedGTIN12AsGTIN13: "GTIN-12 non valide avec zéro supprimé en tant que GTIN-13";
15
- readonly invalidZeroSuppressedGTIN12AsGTIN14: "GTIN-12 non valide avec zéro supprimé en tant que GTIN-14";
16
- readonly invalidGTINAtRetail: "Le GTIN n'est pas pris en charge au niveau des articles de consommation au détail";
17
- readonly invalidGTINAtOtherThanRetail: "Le GTIN n'est pas pris en charge à d'autres niveaux que ceux des articles de consommation au détail";
18
- readonly invalidRCNLength: "La longueur du RCN doit correspondre à la longueur du format";
19
- readonly invalidVariableMeasureRCNFormat: "Format RCN de mesure variable non valide";
20
- readonly invalidVariableMeasureRCNPrefix: "Préfixe RCN de mesure variable non valide";
21
- readonly invalidVariableMeasurePriceOrWeight: "Mesure variable invalide : prix ou poids";
22
- readonly indicatorDigit: "chiffre indicateur";
23
- readonly serialComponent: "composant série";
24
- readonly reference: "référence";
25
- readonly referenceCantBeAllNumeric: "La référence ne peut pas être entièrement numérique";
26
- readonly invalidCheckCharacterPair: "Paire de caractères de contrôle non valide";
5
+ Check: {
6
+ lengthOfStringForPriceOrWeightMustBeExactly: string;
7
+ priceOrWeightComponent: string;
8
+ lengthOfStringForCheckCharacterPairMustBeLessThanOrEqualTo: string;
27
9
  };
28
- readonly Prefix: {
29
- readonly gs1CompanyPrefix: "Préfixe de l'entreprise GS1";
30
- readonly upcCompanyPrefix: "Préfixe de l'entreprise U.P.C.";
31
- readonly gs18Prefix: "Préfixe GS1-8";
32
- readonly gs1CompanyPrefixCantStartWith0: "Le préfixe de l'entreprise GS1 ne peut pas commencer par \"0\"";
33
- readonly gs1CompanyPrefixCantStartWith00000: "Le préfixe de l'entreprise GS1 ne peut pas commencer par \"00000\"";
34
- readonly gs1CompanyPrefixCantStartWith000000: "Le préfixe de l'entreprise GS1 ne peut pas commencer par \"000000\"";
35
- readonly upcCompanyPrefixCantStartWith0000: "Le préfixe de l'entreprise U.P.C. ne peut pas commencer par \"0000\"";
36
- readonly gs18PrefixCantStartWith0: "Le préfixe GS1-8 ne peut pas commencer par \"0\"";
37
- readonly identifierTypeNotSupportedByGS18Prefix: "{{identifierType}} non pris en charge par le préfixe GS1-8";
38
- readonly gs1CompanyPrefixLengthDataHTTPError: "Erreur HTTP {{status, number}} lors du chargement des données de longueur du préfixe d'entreprise GS1";
39
- readonly gs1CompanyPrefixLengthDataNotLoaded: "Les données relatives à la longueur du préfixe d'entreprise GS1 n'ont pas été chargées";
10
+ Identifier: {
11
+ identifierTypeLength: string;
12
+ invalidCheckDigit: string;
13
+ invalidGTINLength: string;
14
+ invalidGTIN14Length: string;
15
+ invalidZeroSuppressedGTIN12: string;
16
+ invalidZeroSuppressibleGTIN12: string;
17
+ invalidZeroSuppressedGTIN12AsGTIN13: string;
18
+ invalidZeroSuppressedGTIN12AsGTIN14: string;
19
+ invalidGTINAtRetail: string;
20
+ invalidGTINAtOtherThanRetail: string;
21
+ invalidRCNLength: string;
22
+ invalidVariableMeasureRCNFormat: string;
23
+ invalidVariableMeasureRCNPrefix: string;
24
+ invalidVariableMeasurePriceOrWeight: string;
25
+ indicatorDigit: string;
26
+ serialComponent: string;
27
+ reference: string;
28
+ referenceCantBeAllNumeric: string;
29
+ invalidCheckCharacterPair: string;
30
+ };
31
+ Prefix: {
32
+ gs1CompanyPrefix: string;
33
+ upcCompanyPrefix: string;
34
+ gs18Prefix: string;
35
+ gs1CompanyPrefixCantStartWith0: string;
36
+ gs1CompanyPrefixCantStartWith00000: string;
37
+ gs1CompanyPrefixCantStartWith000000: string;
38
+ upcCompanyPrefixCantStartWith0000: string;
39
+ gs18PrefixCantStartWith0: string;
40
+ identifierTypeNotSupportedByGS18Prefix: string;
41
+ gs1CompanyPrefixLengthDataFileNotFound: string;
42
+ gs1CompanyPrefixLengthDataNotLoaded: string;
40
43
  };
41
44
  };
42
45
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"locale-resources.d.ts","sourceRoot":"","sources":["../../../src/locale/fr/locale-resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBAwCW"}
1
+ {"version":3,"file":"locale-resources.d.ts","sourceRoot":"","sources":["../../../src/locale/fr/locale-resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBA2CE"}
@@ -1,4 +1,7 @@
1
1
  export default {
2
+ AI64CharacterSetValidator: {
3
+ lengthMustBeMultipleOf4: "La longueur {{length, number}} doit être un multiple de 4"
4
+ },
2
5
  Check: {
3
6
  lengthOfStringForPriceOrWeightMustBeExactly: "La longueur {{length, number}} de la chaîne pour le prix ou le poids doit être 4 ou 5",
4
7
  priceOrWeightComponent: "prix ou poids",
@@ -35,7 +38,7 @@ export default {
35
38
  upcCompanyPrefixCantStartWith0000: "Le préfixe de l'entreprise U.P.C. ne peut pas commencer par \"0000\"",
36
39
  gs18PrefixCantStartWith0: "Le préfixe GS1-8 ne peut pas commencer par \"0\"",
37
40
  identifierTypeNotSupportedByGS18Prefix: "{{identifierType}} non pris en charge par le préfixe GS1-8",
38
- gs1CompanyPrefixLengthDataHTTPError: "Erreur HTTP {{status, number}} lors du chargement des données de longueur du préfixe d'entreprise GS1",
41
+ gs1CompanyPrefixLengthDataFileNotFound: "Données de longueur du préfixe d'entreprise GS1 «{{key}}» introuvables",
39
42
  gs1CompanyPrefixLengthDataNotLoaded: "Les données relatives à la longueur du préfixe d'entreprise GS1 n'ont pas été chargées"
40
43
  }
41
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"locale-resources.js","sourceRoot":"","sources":["../../../src/locale/fr/locale-resources.ts"],"names":[],"mappings":"AAAA,eAAe;IACX,KAAK,EAAE;QACH,2CAA2C,EAAE,uFAAuF;QACpI,sBAAsB,EAAE,eAAe;QACvC,0DAA0D,EAAE,mJAAmJ;KAClN;IACD,UAAU,EAAE;QACR,oBAAoB,EAAE,+DAA+D;QACrF,iBAAiB,EAAE,gCAAgC;QACnD,iBAAiB,EAAE,iDAAiD;QACpE,mBAAmB,EAAE,oCAAoC;QACzD,2BAA2B,EAAE,4CAA4C;QACzE,6BAA6B,EAAE,+CAA+C;QAC9E,mCAAmC,EAAE,2DAA2D;QAChG,mCAAmC,EAAE,2DAA2D;QAChG,mBAAmB,EAAE,mFAAmF;QACxG,4BAA4B,EAAE,qGAAqG;QACnI,gBAAgB,EAAE,8DAA8D;QAChF,+BAA+B,EAAE,0CAA0C;QAC3E,+BAA+B,EAAE,2CAA2C;QAC5E,mCAAmC,EAAE,0CAA0C;QAC/E,cAAc,EAAE,oBAAoB;QACpC,eAAe,EAAE,iBAAiB;QAClC,SAAS,EAAE,WAAW;QACtB,yBAAyB,EAAE,qDAAqD;QAChF,yBAAyB,EAAE,4CAA4C;KAC1E;IACD,MAAM,EAAE;QACJ,gBAAgB,EAAE,6BAA6B;QAC/C,gBAAgB,EAAE,gCAAgC;QAClD,UAAU,EAAE,eAAe;QAC3B,8BAA8B,EAAE,gEAAgE;QAChG,kCAAkC,EAAE,oEAAoE;QACxG,mCAAmC,EAAE,qEAAqE;QAC1G,iCAAiC,EAAE,sEAAsE;QACzG,wBAAwB,EAAE,kDAAkD;QAC5E,sCAAsC,EAAE,4DAA4D;QACpG,mCAAmC,EAAE,uGAAuG;QAC5I,mCAAmC,EAAE,wFAAwF;KAChI;CACK,CAAC"}
1
+ {"version":3,"file":"locale-resources.js","sourceRoot":"","sources":["../../../src/locale/fr/locale-resources.ts"],"names":[],"mappings":"AAAA,eAAe;IACX,yBAAyB,EAAE;QACvB,uBAAuB,EAAE,2DAA2D;KACvF;IACD,KAAK,EAAE;QACH,2CAA2C,EAAE,uFAAuF;QACpI,sBAAsB,EAAE,eAAe;QACvC,0DAA0D,EAAE,mJAAmJ;KAClN;IACD,UAAU,EAAE;QACR,oBAAoB,EAAE,+DAA+D;QACrF,iBAAiB,EAAE,gCAAgC;QACnD,iBAAiB,EAAE,iDAAiD;QACpE,mBAAmB,EAAE,oCAAoC;QACzD,2BAA2B,EAAE,4CAA4C;QACzE,6BAA6B,EAAE,+CAA+C;QAC9E,mCAAmC,EAAE,2DAA2D;QAChG,mCAAmC,EAAE,2DAA2D;QAChG,mBAAmB,EAAE,mFAAmF;QACxG,4BAA4B,EAAE,qGAAqG;QACnI,gBAAgB,EAAE,8DAA8D;QAChF,+BAA+B,EAAE,0CAA0C;QAC3E,+BAA+B,EAAE,2CAA2C;QAC5E,mCAAmC,EAAE,0CAA0C;QAC/E,cAAc,EAAE,oBAAoB;QACpC,eAAe,EAAE,iBAAiB;QAClC,SAAS,EAAE,WAAW;QACtB,yBAAyB,EAAE,qDAAqD;QAChF,yBAAyB,EAAE,4CAA4C;KAC1E;IACD,MAAM,EAAE;QACJ,gBAAgB,EAAE,6BAA6B;QAC/C,gBAAgB,EAAE,gCAAgC;QAClD,UAAU,EAAE,eAAe;QAC3B,8BAA8B,EAAE,gEAAgE;QAChG,kCAAkC,EAAE,oEAAoE;QACxG,mCAAmC,EAAE,qEAAqE;QAC1G,iCAAiC,EAAE,sEAAsE;QACzG,wBAAwB,EAAE,kDAAkD;QAC5E,sCAAsC,EAAE,4DAA4D;QACpG,sCAAsC,EAAE,wEAAwE;QAChH,mCAAmC,EAAE,wFAAwF;KAChI;CACJ,CAAC"}
@@ -7,9 +7,9 @@ export declare const gs1NS = "aidct_gs1";
7
7
  */
8
8
  export type GS1LocaleResources = typeof enLocaleResources;
9
9
  /**
10
- * GS1 resources.
10
+ * GS1 resource bundle.
11
11
  */
12
- export declare const gs1Resources: Resource;
12
+ export declare const gs1ResourceBundle: Resource;
13
13
  export declare const i18nextGS1: i18n;
14
14
  /**
15
15
  * Initialize internationalization.
@@ -19,6 +19,9 @@ export declare const i18nextGS1: i18n;
19
19
  *
20
20
  * @param debug
21
21
  * Debug setting.
22
+ *
23
+ * @returns
24
+ * GS1 resource bundle.
22
25
  */
23
- export declare function i18nGS1Init(environment: I18nEnvironment, debug?: boolean): Promise<void>;
26
+ export declare function i18nGS1Init(environment: I18nEnvironment, debug?: boolean): Promise<Resource>;
24
27
  //# sourceMappingURL=i18n.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/locale/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,oBAAoB,CAAC;AAE5E,OAAgB,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AAGzD,eAAO,MAAM,KAAK,cAAc,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,iBAAiB,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,QAO1B,CAAC;AAGF,eAAO,MAAM,UAAU,EAAE,IAA+B,CAAC;AAEzD;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,WAAW,EAAE,eAAe,EAAE,KAAK,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAG5F"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/locale/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,eAAe,EAAY,MAAM,oBAAoB,CAAC;AAElF,OAAgB,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AAGzD,eAAO,MAAM,KAAK,cAAc,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,iBAAiB,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAO/B,CAAC;AAGF,eAAO,MAAM,UAAU,EAAE,IAA+B,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAAC,WAAW,EAAE,eAAe,EAAE,KAAK,UAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEhG"}
@@ -1,13 +1,13 @@
1
- import { i18nFinalizeInit } from "@aidc-toolkit/core";
2
- import { i18nUtilityInit, utilityResources } from "@aidc-toolkit/utility";
1
+ import { i18nCoreInit, i18nInit } from "@aidc-toolkit/core";
2
+ import { i18nUtilityInit } from "@aidc-toolkit/utility";
3
3
  import i18next from "i18next";
4
4
  import enLocaleResources from "./en/locale-resources.js";
5
5
  import frLocaleResources from "./fr/locale-resources.js";
6
6
  export const gs1NS = "aidct_gs1";
7
7
  /**
8
- * GS1 resources.
8
+ * GS1 resource bundle.
9
9
  */
10
- export const gs1Resources = {
10
+ export const gs1ResourceBundle = {
11
11
  en: {
12
12
  aidct_gs1: enLocaleResources
13
13
  },
@@ -25,9 +25,11 @@ export const i18nextGS1 = i18next.createInstance();
25
25
  *
26
26
  * @param debug
27
27
  * Debug setting.
28
+ *
29
+ * @returns
30
+ * GS1 resource bundle.
28
31
  */
29
32
  export async function i18nGS1Init(environment, debug = false) {
30
- await i18nUtilityInit(environment, debug);
31
- await i18nFinalizeInit(i18nextGS1, environment, debug, gs1NS, utilityResources, gs1Resources);
33
+ return i18nInit(i18nextGS1, environment, debug, gs1NS, gs1ResourceBundle, i18nCoreInit, i18nUtilityInit);
32
34
  }
33
35
  //# sourceMappingURL=i18n.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/locale/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,OAAqC,MAAM,SAAS,CAAC;AAC5D,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AACzD,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AAEzD,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAC;AAOjC;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAa;IAClC,EAAE,EAAE;QACA,SAAS,EAAE,iBAAiB;KAC/B;IACD,EAAE,EAAE;QACA,SAAS,EAAE,iBAAiB;KAC/B;CACJ,CAAC;AAEF,2FAA2F;AAC3F,MAAM,CAAC,MAAM,UAAU,GAAS,OAAO,CAAC,cAAc,EAAE,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,WAA4B,EAAE,KAAK,GAAG,KAAK;IACzE,MAAM,eAAe,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAC1C,MAAM,gBAAgB,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;AAClG,CAAC"}
1
+ {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/locale/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAwB,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,OAAqC,MAAM,SAAS,CAAC;AAC5D,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AACzD,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AAEzD,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAC;AAOjC;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAa;IACvC,EAAE,EAAE;QACA,SAAS,EAAE,iBAAiB;KAC/B;IACD,EAAE,EAAE;QACA,SAAS,EAAE,iBAAiB;KAC/B;CACJ,CAAC;AAEF,2FAA2F;AAC3F,MAAM,CAAC,MAAM,UAAU,GAAS,OAAO,CAAC,cAAc,EAAE,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,WAA4B,EAAE,KAAK,GAAG,KAAK;IACzE,OAAO,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;AAC7G,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"numeric-identifier-validator.d.ts","sourceRoot":"","sources":["../src/numeric-identifier-validator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,KAAK,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAG3F,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC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;IACM,QAAQ,CAAC,UAAkB,EAAE,UAAwC;QAC1E,+EAA+E;QAC/E,IAAI,IAAI,CAAC,eAAe,KAAK,CAAC,EAAE,CAAC;YAC7B,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC;aAAM,CAAC;YACJ,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;QACrE,CAAC;QAED,uBAAuB;QACvB,IAAI,UAAU,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;YACpC,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,iCAAiC,EAAE;gBACjE,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,MAAM,EAAE,IAAI,CAAC,MAAM;aACtB,CAAC,CAAC,CAAC;QACR,CAAC;QAED,gEAAgE;QAChE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;YAClF,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC;QACvE,CAAC;IACL,CAAC;CACJ"}
@@ -30,12 +30,12 @@ export declare class VariableMeasure {
30
30
  *
31
31
  * Some examples:
32
32
  *
33
- * - 2IIIIIVPPPPC - RCN-12 with a five-digit item reference, a price or weight check digit, and a four-digit price
33
+ * - `2IIIIIVPPPPC` - RCN-12 with a five-digit item reference, a price or weight check digit, and a four-digit price
34
34
  * or weight.
35
- * - 23IIIIVPPPPPC - RCN-13 with a four-digit item reference, a price or weight check digit, and a five-digit price
35
+ * - `23IIIIVPPPPPC` - RCN-13 with a four-digit item reference, a price or weight check digit, and a five-digit price
36
36
  * or weight.
37
- * - 2IIIIIIPPPPC - RCN-12 with a six-digit item reference and a four-digit price or eight.
38
- * - 29IIIIIPPPPPC - RCN-13 with a five-digit item reference and a five-digit price or weight.
37
+ * - `2IIIIIIPPPPC` - RCN-12 with a six-digit item reference and a four-digit price or eight.
38
+ * - `29IIIIIPPPPPC` - RCN-13 with a five-digit item reference and a five-digit price or weight.
39
39
  *
40
40
  * @param format
41
41
  * Format.
@@ -21,12 +21,12 @@ export class VariableMeasure {
21
21
  *
22
22
  * Some examples:
23
23
  *
24
- * - 2IIIIIVPPPPC - RCN-12 with a five-digit item reference, a price or weight check digit, and a four-digit price
24
+ * - `2IIIIIVPPPPC` - RCN-12 with a five-digit item reference, a price or weight check digit, and a four-digit price
25
25
  * or weight.
26
- * - 23IIIIVPPPPPC - RCN-13 with a four-digit item reference, a price or weight check digit, and a five-digit price
26
+ * - `23IIIIVPPPPPC` - RCN-13 with a four-digit item reference, a price or weight check digit, and a five-digit price
27
27
  * or weight.
28
- * - 2IIIIIIPPPPC - RCN-12 with a six-digit item reference and a four-digit price or eight.
29
- * - 29IIIIIPPPPPC - RCN-13 with a five-digit item reference and a five-digit price or weight.
28
+ * - `2IIIIIIPPPPC` - RCN-12 with a six-digit item reference and a four-digit price or eight.
29
+ * - `29IIIIIPPPPPC` - RCN-13 with a five-digit item reference and a five-digit price or weight.
30
30
  *
31
31
  * @param format
32
32
  * Format.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@aidc-toolkit/gs1",
3
- "version": "1.0.32-beta",
3
+ "version": "1.0.34-beta",
4
4
  "description": "GS1 AIDC Toolkit",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
- "homepage": "https://aidc-toolkit.com/",
7
+ "homepage": "https://aidc-toolkit.com",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/aidc-toolkit/gs1.git"
@@ -20,18 +20,20 @@
20
20
  },
21
21
  "scripts": {
22
22
  "lint": "eslint",
23
- "tsc:core": "tsc --project tsconfig-src.json",
24
- "build:dev": "rimraf dist tsconfig-src.tsbuildinfo && npm run tsc:core -- --declarationMap --sourceMap",
25
- "build:release": "npm run tsc:core -- --noEmit && tsup --tsconfig tsconfig-tsup.json",
26
- "build:doc": "npm run build:dev",
23
+ "tsc-src": "tsc --project tsconfig-src.json",
24
+ "build:non-prod": "rimraf dist tsconfig-src.tsbuildinfo && npm run tsc-src -- --declarationMap --sourceMap",
25
+ "build:alpha": "npm run build:non-prod && tsc --project tsconfig-config.json --noEmit",
26
+ "build:beta": "npm run build:non-prod",
27
+ "build:prod": "npm run tsc-src -- --noEmit && tsup --tsconfig tsconfig-tsup.json",
28
+ "build:doc": "npm run build:non-prod",
27
29
  "test": "tsc --project tsconfig-test.json --noEmit && vitest run"
28
30
  },
29
31
  "devDependencies": {
30
- "@aidc-toolkit/dev": "1.0.32-beta",
31
- "vitest": "^4.0.16"
32
+ "@aidc-toolkit/dev": "1.0.34-beta",
33
+ "vitest": "^4.0.17"
32
34
  },
33
35
  "dependencies": {
34
- "@aidc-toolkit/core": "1.0.32-beta",
35
- "@aidc-toolkit/utility": "1.0.32-beta"
36
+ "@aidc-toolkit/core": "1.0.34-beta",
37
+ "@aidc-toolkit/utility": "1.0.34-beta"
36
38
  }
37
39
  }
@@ -1,4 +1,10 @@
1
- import { CharacterSetCreator, CharacterSetValidator, Exclusions } from "@aidc-toolkit/utility";
1
+ import {
2
+ CharacterSetCreator,
3
+ type CharacterSetValidation,
4
+ CharacterSetValidator,
5
+ Exclusions, utilityNS
6
+ } from "@aidc-toolkit/utility";
7
+ import { i18nextGS1 } from "./locale/i18n.js";
2
8
 
3
9
  /**
4
10
  * GS1 AI encodable character set 82 creator as defined in section 7.11 of the {@link
@@ -38,17 +44,55 @@ export const AI39_CREATOR = new CharacterSetCreator([
38
44
  */
39
45
  export const AI39_VALIDATOR = AI39_CREATOR as CharacterSetValidator;
40
46
 
47
+ /**
48
+ * GS1 AI encodable character set 64 validator with additional base64 validation of length (multiple of 4) and position
49
+ * of equal sign (last or last two characters).
50
+ */
51
+ class AI64CharacterSetValidator extends CharacterSetValidator {
52
+ /**
53
+ * Constructor.
54
+ */
55
+ constructor() {
56
+ super(([
57
+ "-",
58
+ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
59
+ "=",
60
+ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
61
+ "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
62
+ "_",
63
+ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
64
+ "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
65
+ ]));
66
+ }
67
+
68
+ /**
69
+ * @inheritDoc
70
+ */
71
+ override validate(s: string, validation?: CharacterSetValidation): void {
72
+ super.validate(s, validation);
73
+
74
+ const length = s.length;
75
+
76
+ if (length % 4 !== 0) {
77
+ throw new RangeError(i18nextGS1.t("AI64CharacterSetValidator.lengthMustBeMultipleOf4", {
78
+ length
79
+ }));
80
+ }
81
+
82
+ const equalIndex = s.search(/={1,2}/u);
83
+
84
+ if (equalIndex !== -1 && equalIndex < length - 2) {
85
+ throw new RangeError(i18nextGS1.t("CharacterSetValidator.invalidCharacterAtPosition", {
86
+ ns: utilityNS,
87
+ c: "=",
88
+ position: equalIndex
89
+ }));
90
+ }
91
+ }
92
+ }
93
+
41
94
  /**
42
95
  * GS1 AI encodable character set 64 validator as defined in section 7.11 of the {@link
43
96
  * https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Doesn't support any exclusions.
44
97
  */
45
- export const AI64_VALIDATOR = new CharacterSetValidator([
46
- "-",
47
- "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
48
- "=",
49
- "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
50
- "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
51
- "_",
52
- "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
53
- "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
54
- ]);
98
+ export const AI64_VALIDATOR: CharacterSetValidator = new AI64CharacterSetValidator();