@aidc-toolkit/gs1 1.0.43 → 1.0.44-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.
- package/dist/abstract-identifier-creator.d.ts +41 -0
- package/dist/abstract-identifier-creator.d.ts.map +1 -0
- package/dist/abstract-identifier-creator.js +73 -0
- package/dist/abstract-identifier-creator.js.map +1 -0
- package/dist/abstract-non-gtin-numeric-identifier-creator.d.ts +36 -0
- package/dist/abstract-non-gtin-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/abstract-non-gtin-numeric-identifier-creator.js +37 -0
- package/dist/abstract-non-gtin-numeric-identifier-creator.js.map +1 -0
- package/dist/abstract-numeric-identifier-creator.d.ts +34 -0
- package/dist/abstract-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/abstract-numeric-identifier-creator.js +154 -0
- package/dist/abstract-numeric-identifier-creator.js.map +1 -0
- package/dist/character-set.d.ts +27 -0
- package/dist/character-set.d.ts.map +1 -0
- package/dist/character-set.js +83 -0
- package/dist/character-set.js.map +1 -0
- package/dist/check.d.ts +81 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +218 -0
- package/dist/check.js.map +1 -0
- package/dist/content-character-set-creators.d.ts +4 -0
- package/dist/content-character-set-creators.d.ts.map +1 -0
- package/dist/content-character-set-creators.js +9 -0
- package/dist/content-character-set-creators.js.map +1 -0
- package/dist/content-character-set.d.ts +26 -0
- package/dist/content-character-set.d.ts.map +1 -0
- package/dist/content-character-set.js +18 -0
- package/dist/content-character-set.js.map +1 -0
- package/dist/gcp-length-cache.d.ts +89 -0
- package/dist/gcp-length-cache.d.ts.map +1 -0
- package/dist/gcp-length-cache.js +240 -0
- package/dist/gcp-length-cache.js.map +1 -0
- package/dist/gcp-length-data.d.ts +108 -0
- package/dist/gcp-length-data.d.ts.map +1 -0
- package/dist/gcp-length-data.js +53 -0
- package/dist/gcp-length-data.js.map +1 -0
- package/dist/gcp-length.d.ts +97 -0
- package/dist/gcp-length.d.ts.map +1 -0
- package/dist/gcp-length.js +368 -0
- package/dist/gcp-length.js.map +1 -0
- package/dist/gtin-creator.d.ts +47 -0
- package/dist/gtin-creator.d.ts.map +1 -0
- package/dist/gtin-creator.js +64 -0
- package/dist/gtin-creator.js.map +1 -0
- package/dist/gtin-descriptor.d.ts +22 -0
- package/dist/gtin-descriptor.d.ts.map +1 -0
- package/dist/gtin-descriptor.js +2 -0
- package/dist/gtin-descriptor.js.map +1 -0
- package/dist/gtin-length.d.ts +64 -0
- package/dist/gtin-length.d.ts.map +1 -0
- package/dist/gtin-length.js +36 -0
- package/dist/gtin-length.js.map +1 -0
- package/dist/gtin-type.d.ts +26 -0
- package/dist/gtin-type.d.ts.map +1 -0
- package/dist/gtin-type.js +7 -0
- package/dist/gtin-type.js.map +1 -0
- package/dist/gtin-validator.d.ts +132 -0
- package/dist/gtin-validator.d.ts.map +1 -0
- package/dist/gtin-validator.js +349 -0
- package/dist/gtin-validator.js.map +1 -0
- package/dist/identifier-creator.d.ts +31 -0
- package/dist/identifier-creator.d.ts.map +1 -0
- package/dist/identifier-creator.js +2 -0
- package/dist/identifier-creator.js.map +1 -0
- package/dist/identifier-creators.d.ts +118 -0
- package/dist/identifier-creators.d.ts.map +1 -0
- package/dist/identifier-creators.js +92 -0
- package/dist/identifier-creators.js.map +1 -0
- package/dist/identifier-descriptor.d.ts +27 -0
- package/dist/identifier-descriptor.d.ts.map +1 -0
- package/dist/identifier-descriptor.js +2 -0
- package/dist/identifier-descriptor.js.map +1 -0
- package/dist/identifier-descriptors.d.ts +106 -0
- package/dist/identifier-descriptors.d.ts.map +1 -0
- package/dist/identifier-descriptors.js +262 -0
- package/dist/identifier-descriptors.js.map +1 -0
- package/dist/identifier-extension.d.ts +82 -0
- package/dist/identifier-extension.d.ts.map +1 -0
- package/dist/identifier-extension.js +79 -0
- package/dist/identifier-extension.js.map +1 -0
- package/dist/identifier-type.d.ts +62 -0
- package/dist/identifier-type.d.ts.map +1 -0
- package/dist/identifier-type.js +54 -0
- package/dist/identifier-type.js.map +1 -0
- package/dist/identifier-validator.d.ts +85 -0
- package/dist/identifier-validator.d.ts.map +1 -0
- package/dist/identifier-validator.js +107 -0
- package/dist/identifier-validator.js.map +1 -0
- package/dist/identifier-validators.d.ts +131 -0
- package/dist/identifier-validators.d.ts.map +1 -0
- package/dist/identifier-validators.js +167 -0
- package/dist/identifier-validators.js.map +1 -0
- package/dist/index.d.ts +63 -2205
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -3
- package/dist/index.js.map +1 -0
- package/dist/leader-type.d.ts +26 -0
- package/dist/leader-type.d.ts.map +1 -0
- package/dist/leader-type.js +18 -0
- package/dist/leader-type.js.map +1 -0
- package/dist/locale/en/locale-resources.d.ts +48 -0
- package/dist/locale/en/locale-resources.d.ts.map +1 -0
- package/dist/locale/en/locale-resources.js +47 -0
- package/dist/locale/en/locale-resources.js.map +1 -0
- package/dist/locale/fr/locale-resources.d.ts +48 -0
- package/dist/locale/fr/locale-resources.d.ts.map +1 -0
- package/dist/locale/fr/locale-resources.js +47 -0
- package/dist/locale/fr/locale-resources.js.map +1 -0
- package/dist/locale/i18n.d.ts +27 -0
- package/dist/locale/i18n.d.ts.map +1 -0
- package/dist/locale/i18n.js +35 -0
- package/dist/locale/i18n.js.map +1 -0
- package/dist/non-gtin-numeric-identifier-creator.d.ts +12 -0
- package/dist/non-gtin-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/non-gtin-numeric-identifier-creator.js +2 -0
- package/dist/non-gtin-numeric-identifier-creator.js.map +1 -0
- package/dist/non-gtin-numeric-identifier-descriptor.d.ts +22 -0
- package/dist/non-gtin-numeric-identifier-descriptor.d.ts.map +1 -0
- package/dist/non-gtin-numeric-identifier-descriptor.js +2 -0
- package/dist/non-gtin-numeric-identifier-descriptor.js.map +1 -0
- package/dist/non-gtin-numeric-identifier-type.d.ts +26 -0
- package/dist/non-gtin-numeric-identifier-type.d.ts.map +1 -0
- package/dist/non-gtin-numeric-identifier-type.js +8 -0
- package/dist/non-gtin-numeric-identifier-type.js.map +1 -0
- package/dist/non-gtin-numeric-identifier-validator.d.ts +12 -0
- package/dist/non-gtin-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/non-gtin-numeric-identifier-validator.js +10 -0
- package/dist/non-gtin-numeric-identifier-validator.js.map +1 -0
- package/dist/non-numeric-identifier-creator.d.ts +40 -0
- package/dist/non-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/non-numeric-identifier-creator.js +82 -0
- package/dist/non-numeric-identifier-creator.js.map +1 -0
- package/dist/non-numeric-identifier-descriptor.d.ts +26 -0
- package/dist/non-numeric-identifier-descriptor.d.ts.map +1 -0
- package/dist/non-numeric-identifier-descriptor.js +2 -0
- package/dist/non-numeric-identifier-descriptor.js.map +1 -0
- package/dist/non-numeric-identifier-type.d.ts +26 -0
- package/dist/non-numeric-identifier-type.d.ts.map +1 -0
- package/dist/non-numeric-identifier-type.js +8 -0
- package/dist/non-numeric-identifier-type.js.map +1 -0
- package/dist/non-numeric-identifier-validator.d.ts +41 -0
- package/dist/non-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/non-numeric-identifier-validator.js +69 -0
- package/dist/non-numeric-identifier-validator.js.map +1 -0
- package/dist/non-serializable-numeric-identifier-creator.d.ts +10 -0
- package/dist/non-serializable-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/non-serializable-numeric-identifier-creator.js +8 -0
- package/dist/non-serializable-numeric-identifier-creator.js.map +1 -0
- package/dist/non-serializable-numeric-identifier-descriptor.d.ts +12 -0
- package/dist/non-serializable-numeric-identifier-descriptor.d.ts.map +1 -0
- package/dist/non-serializable-numeric-identifier-descriptor.js +2 -0
- package/dist/non-serializable-numeric-identifier-descriptor.js.map +1 -0
- package/dist/non-serializable-numeric-identifier-type.d.ts +26 -0
- package/dist/non-serializable-numeric-identifier-type.d.ts.map +1 -0
- package/dist/non-serializable-numeric-identifier-type.js +7 -0
- package/dist/non-serializable-numeric-identifier-type.js.map +1 -0
- package/dist/non-serializable-numeric-identifier-validator.d.ts +16 -0
- package/dist/non-serializable-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/non-serializable-numeric-identifier-validator.js +17 -0
- package/dist/non-serializable-numeric-identifier-validator.js.map +1 -0
- package/dist/numeric-identifier-creator.d.ts +53 -0
- package/dist/numeric-identifier-creator.d.ts.map +1 -0
- package/dist/numeric-identifier-creator.js +2 -0
- package/dist/numeric-identifier-creator.js.map +1 -0
- package/dist/numeric-identifier-descriptor.d.ts +22 -0
- package/dist/numeric-identifier-descriptor.d.ts.map +1 -0
- package/dist/numeric-identifier-descriptor.js +2 -0
- package/dist/numeric-identifier-descriptor.js.map +1 -0
- package/dist/numeric-identifier-type.d.ts +26 -0
- package/dist/numeric-identifier-type.d.ts.map +1 -0
- package/dist/numeric-identifier-type.js +7 -0
- package/dist/numeric-identifier-type.js.map +1 -0
- package/dist/numeric-identifier-validator.d.ts +38 -0
- package/dist/numeric-identifier-validator.d.ts.map +1 -0
- package/dist/numeric-identifier-validator.js +61 -0
- package/dist/numeric-identifier-validator.js.map +1 -0
- package/dist/prefix-manager.d.ts +151 -0
- package/dist/prefix-manager.d.ts.map +1 -0
- package/dist/prefix-manager.js +297 -0
- package/dist/prefix-manager.js.map +1 -0
- package/dist/prefix-provider.d.ts +27 -0
- package/dist/prefix-provider.d.ts.map +1 -0
- package/dist/prefix-provider.js +2 -0
- package/dist/prefix-provider.js.map +1 -0
- package/dist/prefix-type.d.ts +26 -0
- package/dist/prefix-type.d.ts.map +1 -0
- package/dist/prefix-type.js +18 -0
- package/dist/prefix-type.js.map +1 -0
- package/dist/prefix-validator.d.ts +71 -0
- package/dist/prefix-validator.d.ts.map +1 -0
- package/dist/prefix-validator.js +204 -0
- package/dist/prefix-validator.js.map +1 -0
- package/dist/serializable-numeric-identifier-creator.d.ts +48 -0
- package/dist/serializable-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/serializable-numeric-identifier-creator.js +93 -0
- package/dist/serializable-numeric-identifier-creator.js.map +1 -0
- package/dist/serializable-numeric-identifier-descriptor.d.ts +26 -0
- package/dist/serializable-numeric-identifier-descriptor.d.ts.map +1 -0
- package/dist/serializable-numeric-identifier-descriptor.js +2 -0
- package/dist/serializable-numeric-identifier-descriptor.js.map +1 -0
- package/dist/serializable-numeric-identifier-type.d.ts +26 -0
- package/dist/serializable-numeric-identifier-type.d.ts.map +1 -0
- package/dist/serializable-numeric-identifier-type.js +8 -0
- package/dist/serializable-numeric-identifier-type.js.map +1 -0
- package/dist/serializable-numeric-identifier-validator.d.ts +67 -0
- package/dist/serializable-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/serializable-numeric-identifier-validator.js +97 -0
- package/dist/serializable-numeric-identifier-validator.js.map +1 -0
- package/dist/variable-measure.d.ts +68 -0
- package/dist/variable-measure.d.ts.map +1 -0
- package/dist/variable-measure.js +210 -0
- package/dist/variable-measure.js.map +1 -0
- package/dist/verified-by-gs1.d.ts +22 -0
- package/dist/verified-by-gs1.d.ts.map +1 -0
- package/dist/verified-by-gs1.js +46 -0
- package/dist/verified-by-gs1.js.map +1 -0
- package/package.json +4 -4
- package/src/gcp-length-cache.ts +7 -2
- package/tsconfig-src.tsbuildinfo +1 -1
- package/dist/index.cjs +0 -19
- package/dist/index.d.cts +0 -2205
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefix-validator.js","sourceRoot":"","sources":["../src/prefix-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAmB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAuBhE;;GAEG;AACH,MAAM,iCAAiC,GAAG,CAAC,CAAC;AAE5C;;GAEG;AACH,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAE7C;;GAEG;AACH,MAAM,iCAAiC,GAAG,CAAC,CAAC;AAE5C;;GAEG;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AAC;QACrC,IAAI,gBAAwB,CAAC;QAE7B,IAAI,gBAAgB,GAAuB,SAAS,CAAC;QACrD,IAAI,UAAU,GAAuB,SAAS,CAAC;QAE/C,+DAA+D;QAC/D,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,oBAAoB,GAAG,WAAW,CAAC,gBAAgB,CAAC;YACpD,gBAAgB,GAAG,gBAAgB,CAAC;QACxC,CAAC;aAAM,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/C,oBAAoB,GAAG,WAAW,CAAC,gBAAgB,CAAC;YACpD,gBAAgB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACjD,gBAAgB,GAAG,gBAAgB,CAAC;QACxC,CAAC;aAAM,CAAC;YACJ,oBAAoB,GAAG,WAAW,CAAC,UAAU,CAAC;YAC9C,UAAU,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAC3C,gBAAgB,GAAG,UAAU,CAAC;QAClC,CAAC;QAED,OAAO;YACH,UAAU,EAAE,oBAAoB;YAChC,MAAM,EAAE,gBAAgB;YACxB,gBAAgB;YAChB,gBAAgB;YAChB,UAAU;SACb,CAAC;IACN,CAAC;CACK,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type TransformerInput, type TransformerOutput } from "@aidc-toolkit/utility";
|
|
2
|
+
import type { SerializableNumericIdentifierType } from "./serializable-numeric-identifier-type.js";
|
|
3
|
+
import { SerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator.js";
|
|
4
|
+
declare const SerializableNumericIdentifierCreator_base: abstract new (...args: [prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType: "GRAI"] | [prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType: "GDTI"] | [prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType: "GCN"]) => SerializableNumericIdentifierValidator & import("./non-gtin-numeric-identifier-creator.js").NonGTINNumericIdentifierCreator<SerializableNumericIdentifierType>;
|
|
5
|
+
/**
|
|
6
|
+
* Serializable numeric identifier creator.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SerializableNumericIdentifierCreator extends SerializableNumericIdentifierCreator_base {
|
|
9
|
+
#private;
|
|
10
|
+
/**
|
|
11
|
+
* Create serialized identifier(s) with a reference based on a numeric value concatenated with serial component(s).
|
|
12
|
+
* The value is converted to a reference of the appropriate length using {@linkcode NUMERIC_CREATOR}.
|
|
13
|
+
*
|
|
14
|
+
* @template TTransformerInput
|
|
15
|
+
* Transformer input type.
|
|
16
|
+
*
|
|
17
|
+
* @param value
|
|
18
|
+
* Numeric value of the reference.
|
|
19
|
+
*
|
|
20
|
+
* @param serialComponentOrComponents
|
|
21
|
+
* Serial component(s).
|
|
22
|
+
*
|
|
23
|
+
* @param sparse
|
|
24
|
+
* If true, the value is mapped to a sparse sequence resistant to discovery. Default is false.
|
|
25
|
+
*
|
|
26
|
+
* @returns
|
|
27
|
+
* Serialized identifiers.
|
|
28
|
+
*/
|
|
29
|
+
createSerialized<TTransformerInput extends TransformerInput<string>>(value: number, serialComponentOrComponents: TTransformerInput, sparse?: boolean): TransformerOutput<TTransformerInput, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Concatenate a base identifier with serial component(s).
|
|
32
|
+
*
|
|
33
|
+
* @template TTransformerInput
|
|
34
|
+
* Transformer input type.
|
|
35
|
+
*
|
|
36
|
+
* @param baseIdentifier
|
|
37
|
+
* Base identifier.
|
|
38
|
+
*
|
|
39
|
+
* @param serialComponentOrComponents
|
|
40
|
+
* Serial component(s).
|
|
41
|
+
*
|
|
42
|
+
* @returns
|
|
43
|
+
* Serialized identifier(s).
|
|
44
|
+
*/
|
|
45
|
+
concatenate<TTransformerInput extends TransformerInput<string>>(baseIdentifier: string, serialComponentOrComponents: TTransformerInput): TransformerOutput<TTransformerInput, string>;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=serializable-numeric-identifier-creator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializable-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAEpH,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,2CAA2C,CAAC;AACnG,OAAO,EAAE,sCAAsC,EAAE,MAAM,gDAAgD,CAAC;;AAExG;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,yCAEjB;;IAgDrC;;;;;;;;;;;;;;;;;;OAkBG;IACH,gBAAgB,CAAC,iBAAiB,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,iBAAiB,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAInM;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAC,iBAAiB,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,2BAA2B,EAAE,iBAAiB,GAAG,iBAAiB,CAAC,iBAAiB,EAAE,MAAM,CAAC;CAKxL"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used in JSDoc.
|
|
2
|
+
import { mapIterable } from "@aidc-toolkit/utility";
|
|
3
|
+
import { MixinAbstractNonGTINNumericIdentifierCreator } from "./abstract-non-gtin-numeric-identifier-creator.js";
|
|
4
|
+
import { SerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator.js";
|
|
5
|
+
/**
|
|
6
|
+
* Serializable numeric identifier creator.
|
|
7
|
+
*/
|
|
8
|
+
export class SerializableNumericIdentifierCreator extends MixinAbstractNonGTINNumericIdentifierCreator(SerializableNumericIdentifierValidator) {
|
|
9
|
+
/**
|
|
10
|
+
* Concatenate a validated base identifier with serial component(s).
|
|
11
|
+
*
|
|
12
|
+
* @template TTransformerInput
|
|
13
|
+
* Transformer input type.
|
|
14
|
+
*
|
|
15
|
+
* @param baseIdentifier
|
|
16
|
+
* Base identifier.
|
|
17
|
+
*
|
|
18
|
+
* @param serialComponentOrComponents
|
|
19
|
+
* Serial component(s).
|
|
20
|
+
*
|
|
21
|
+
* @returns
|
|
22
|
+
* Serialized identifier(s).
|
|
23
|
+
*/
|
|
24
|
+
#concatenateValidated(baseIdentifier, serialComponentOrComponents) {
|
|
25
|
+
// TODO Refactor type when https://github.com/microsoft/TypeScript/pull/56941 released.
|
|
26
|
+
let result;
|
|
27
|
+
const serialComponentCreator = this.serialComponentCreator;
|
|
28
|
+
const serialComponentValidation = this.serialComponentValidation;
|
|
29
|
+
/**
|
|
30
|
+
* Validate a serial component and concatenate it to the base identifier.
|
|
31
|
+
*
|
|
32
|
+
* @param serialComponent
|
|
33
|
+
* Serial component.
|
|
34
|
+
*
|
|
35
|
+
* @returns
|
|
36
|
+
* Serialized identifier.
|
|
37
|
+
*/
|
|
38
|
+
function validateAndConcatenate(serialComponent) {
|
|
39
|
+
serialComponentCreator.validate(serialComponent, serialComponentValidation);
|
|
40
|
+
return baseIdentifier + serialComponent;
|
|
41
|
+
}
|
|
42
|
+
if (typeof serialComponentOrComponents !== "object") {
|
|
43
|
+
result = validateAndConcatenate(serialComponentOrComponents);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
result = mapIterable(serialComponentOrComponents, validateAndConcatenate);
|
|
47
|
+
}
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Type determination is handled above.
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create serialized identifier(s) with a reference based on a numeric value concatenated with serial component(s).
|
|
53
|
+
* The value is converted to a reference of the appropriate length using {@linkcode NUMERIC_CREATOR}.
|
|
54
|
+
*
|
|
55
|
+
* @template TTransformerInput
|
|
56
|
+
* Transformer input type.
|
|
57
|
+
*
|
|
58
|
+
* @param value
|
|
59
|
+
* Numeric value of the reference.
|
|
60
|
+
*
|
|
61
|
+
* @param serialComponentOrComponents
|
|
62
|
+
* Serial component(s).
|
|
63
|
+
*
|
|
64
|
+
* @param sparse
|
|
65
|
+
* If true, the value is mapped to a sparse sequence resistant to discovery. Default is false.
|
|
66
|
+
*
|
|
67
|
+
* @returns
|
|
68
|
+
* Serialized identifiers.
|
|
69
|
+
*/
|
|
70
|
+
createSerialized(value, serialComponentOrComponents, sparse) {
|
|
71
|
+
return this.#concatenateValidated(this.create(value, sparse), serialComponentOrComponents);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Concatenate a base identifier with serial component(s).
|
|
75
|
+
*
|
|
76
|
+
* @template TTransformerInput
|
|
77
|
+
* Transformer input type.
|
|
78
|
+
*
|
|
79
|
+
* @param baseIdentifier
|
|
80
|
+
* Base identifier.
|
|
81
|
+
*
|
|
82
|
+
* @param serialComponentOrComponents
|
|
83
|
+
* Serial component(s).
|
|
84
|
+
*
|
|
85
|
+
* @returns
|
|
86
|
+
* Serialized identifier(s).
|
|
87
|
+
*/
|
|
88
|
+
concatenate(baseIdentifier, serialComponentOrComponents) {
|
|
89
|
+
this.validate(baseIdentifier);
|
|
90
|
+
return this.#concatenateValidated(baseIdentifier, serialComponentOrComponents);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=serializable-numeric-identifier-creator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializable-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAkE,MAAM,uBAAuB,CAAC;AACpH,OAAO,EAAE,4CAA4C,EAAE,MAAM,mDAAmD,CAAC;AAEj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
import type { ContentCharacterSet } from "./content-character-set.js";
|
|
2
|
+
import type { LeaderTypes } from "./leader-type.js";
|
|
3
|
+
import type { NonGTINNumericIdentifierDescriptor } from "./non-gtin-numeric-identifier-descriptor.js";
|
|
4
|
+
import type { SerializableNumericIdentifierType } from "./serializable-numeric-identifier-type.js";
|
|
5
|
+
/**
|
|
6
|
+
* Serializable numeric identifier descriptor.
|
|
7
|
+
*/
|
|
8
|
+
export interface SerializableNumericIdentifierDescriptor extends NonGTINNumericIdentifierDescriptor {
|
|
9
|
+
/**
|
|
10
|
+
* @inheritDoc
|
|
11
|
+
*/
|
|
12
|
+
readonly identifierType: SerializableNumericIdentifierType;
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
*/
|
|
16
|
+
readonly leaderType: typeof LeaderTypes.None;
|
|
17
|
+
/**
|
|
18
|
+
* Serial component length.
|
|
19
|
+
*/
|
|
20
|
+
readonly serialComponentLength: number;
|
|
21
|
+
/**
|
|
22
|
+
* Serial component character set.
|
|
23
|
+
*/
|
|
24
|
+
readonly serialComponentCharacterSet: ContentCharacterSet;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=serializable-numeric-identifier-descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializable-numeric-identifier-descriptor.d.ts","sourceRoot":"","sources":["../src/serializable-numeric-identifier-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AACtG,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,2CAA2C,CAAC;AAEnG;;GAEG;AACH,MAAM,WAAW,uCAAwC,SAAQ,kCAAkC;IAC/F;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,iCAAiC,CAAC;IAE3D;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC;IAE7C;;OAEG;IACH,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IAEvC;;OAEG;IACH,QAAQ,CAAC,2BAA2B,EAAE,mBAAmB,CAAC;CAC7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializable-numeric-identifier-descriptor.js","sourceRoot":"","sources":["../src/serializable-numeric-identifier-descriptor.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serializable numeric identifier types.
|
|
3
|
+
*/
|
|
4
|
+
export declare const SerializableNumericIdentifierTypes: Omit<Omit<Pick<{
|
|
5
|
+
readonly GTIN: "GTIN";
|
|
6
|
+
readonly GLN: "GLN";
|
|
7
|
+
readonly SSCC: "SSCC";
|
|
8
|
+
readonly GRAI: "GRAI";
|
|
9
|
+
readonly GIAI: "GIAI";
|
|
10
|
+
readonly GSRN: "GSRN";
|
|
11
|
+
readonly GDTI: "GDTI";
|
|
12
|
+
readonly GINC: "GINC";
|
|
13
|
+
readonly GSIN: "GSIN";
|
|
14
|
+
readonly GCN: "GCN";
|
|
15
|
+
readonly CPID: "CPID";
|
|
16
|
+
readonly GMN: "GMN";
|
|
17
|
+
}, "GTIN" | "GLN" | "SSCC" | "GRAI" | "GSRN" | "GDTI" | "GSIN" | "GCN">, "GTIN">, "GLN" | "SSCC" | "GSRN" | "GSIN">;
|
|
18
|
+
/**
|
|
19
|
+
* Serializable numeric identifier type key.
|
|
20
|
+
*/
|
|
21
|
+
export type SerializableNumericIdentifierTypeKey = keyof typeof SerializableNumericIdentifierTypes;
|
|
22
|
+
/**
|
|
23
|
+
* Serializable numeric identifier type.
|
|
24
|
+
*/
|
|
25
|
+
export type SerializableNumericIdentifierType = typeof SerializableNumericIdentifierTypes[SerializableNumericIdentifierTypeKey];
|
|
26
|
+
//# sourceMappingURL=serializable-numeric-identifier-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializable-numeric-identifier-type.d.ts","sourceRoot":"","sources":["../src/serializable-numeric-identifier-type.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;mHAAgF,CAAC;AAEhI;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,MAAM,OAAO,kCAAkC,CAAC;AAEnG;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG,OAAO,kCAAkC,CAAC,oCAAoC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { exclude } from "@aidc-toolkit/core";
|
|
2
|
+
import { NonGTINNumericIdentifierTypes } from "./non-gtin-numeric-identifier-type.js";
|
|
3
|
+
import { NonSerializableNumericIdentifierTypes } from "./non-serializable-numeric-identifier-type.js";
|
|
4
|
+
/**
|
|
5
|
+
* Serializable numeric identifier types.
|
|
6
|
+
*/
|
|
7
|
+
export const SerializableNumericIdentifierTypes = exclude(NonGTINNumericIdentifierTypes, NonSerializableNumericIdentifierTypes);
|
|
8
|
+
//# sourceMappingURL=serializable-numeric-identifier-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializable-numeric-identifier-type.js","sourceRoot":"","sources":["../src/serializable-numeric-identifier-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,qCAAqC,EAAE,MAAM,+CAA+C,CAAC;AAEtG;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,OAAO,CAAC,6BAA6B,EAAE,qCAAqC,CAAC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { CharacterSetCreator, CharacterSetValidation } from "@aidc-toolkit/utility";
|
|
2
|
+
import type { ContentCharacterSet } from "./content-character-set.js";
|
|
3
|
+
import type { IdentifierValidation } from "./identifier-validator.js";
|
|
4
|
+
import { NonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator.js";
|
|
5
|
+
import type { SerializableNumericIdentifierDescriptor } from "./serializable-numeric-identifier-descriptor.js";
|
|
6
|
+
import type { SerializableNumericIdentifierType } from "./serializable-numeric-identifier-type.js";
|
|
7
|
+
/**
|
|
8
|
+
* Serializable numeric identifier split.
|
|
9
|
+
*/
|
|
10
|
+
export interface SerializableNumericIdentifierSplit {
|
|
11
|
+
/**
|
|
12
|
+
* Base identifier.
|
|
13
|
+
*/
|
|
14
|
+
baseIdentifier: string;
|
|
15
|
+
/**
|
|
16
|
+
* Serial component.
|
|
17
|
+
*/
|
|
18
|
+
serialComponent: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Serializable numeric identifier validator. Validates both serialized and non-serialized forms of numeric identifiers
|
|
22
|
+
* that support serialization.
|
|
23
|
+
*/
|
|
24
|
+
export declare class SerializableNumericIdentifierValidator extends NonGTINNumericIdentifierValidator<SerializableNumericIdentifierType> implements SerializableNumericIdentifierDescriptor {
|
|
25
|
+
#private;
|
|
26
|
+
/**
|
|
27
|
+
* Constructor.
|
|
28
|
+
*
|
|
29
|
+
* @param identifierType
|
|
30
|
+
* Identifier type.
|
|
31
|
+
*/
|
|
32
|
+
constructor(identifierType: SerializableNumericIdentifierType);
|
|
33
|
+
/**
|
|
34
|
+
* Get the serial component length.
|
|
35
|
+
*/
|
|
36
|
+
get serialComponentLength(): number;
|
|
37
|
+
/**
|
|
38
|
+
* Get the serial component character set.
|
|
39
|
+
*/
|
|
40
|
+
get serialComponentCharacterSet(): ContentCharacterSet;
|
|
41
|
+
/**
|
|
42
|
+
* Get the serial component validation parameters.
|
|
43
|
+
*/
|
|
44
|
+
protected get serialComponentValidation(): CharacterSetValidation;
|
|
45
|
+
/**
|
|
46
|
+
* Get the serial component creator.
|
|
47
|
+
*/
|
|
48
|
+
get serialComponentCreator(): CharacterSetCreator;
|
|
49
|
+
/**
|
|
50
|
+
* @inheritDoc
|
|
51
|
+
*/
|
|
52
|
+
validate(identifier: string, validation?: IdentifierValidation): void;
|
|
53
|
+
/**
|
|
54
|
+
* Split a serializable numeric identifier into its component parts.
|
|
55
|
+
*
|
|
56
|
+
* @param identifier
|
|
57
|
+
* Identifier.
|
|
58
|
+
*
|
|
59
|
+
* @param validation
|
|
60
|
+
* Identifier validation parameters.
|
|
61
|
+
*
|
|
62
|
+
* @returns
|
|
63
|
+
* Base identifier and serial component (possibly empty) as object.
|
|
64
|
+
*/
|
|
65
|
+
split(identifier: string, validation?: IdentifierValidation): SerializableNumericIdentifierSplit;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=serializable-numeric-identifier-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializable-numeric-identifier-validator.d.ts","sourceRoot":"","sources":["../src/serializable-numeric-identifier-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEzF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,iDAAiD,CAAC;AAC/G,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,2CAA2C,CAAC;AAEnG;;GAEG;AACH,MAAM,WAAW,kCAAkC;IAC/C;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,qBAAa,sCAAuC,SAAQ,iCAAiC,CAAC,iCAAiC,CAAE,YAAW,uCAAuC;;IAqB/K;;;;;OAKG;gBACS,cAAc,EAAE,iCAAiC;IAiB7D;;OAEG;IACH,IAAI,qBAAqB,IAAI,MAAM,CAElC;IAED;;OAEG;IACH,IAAI,2BAA2B,IAAI,mBAAmB,CAErD;IAED;;OAEG;IACH,SAAS,KAAK,yBAAyB,IAAI,sBAAsB,CAEhE;IAED;;OAEG;IACH,IAAI,sBAAsB,IAAI,mBAAmB,CAEhD;IAED;;OAEG;IACM,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,oBAAoB,GAAG,IAAI;IAQ9E;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,oBAAoB,GAAG,kCAAkC;CAQnG"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { CONTENT_CHARACTER_SET_CREATORS } from "./content-character-set-creators.js";
|
|
2
|
+
import { IdentifierDescriptors } from "./identifier-descriptors.js";
|
|
3
|
+
import { i18nextGS1 } from "./locale/i18n.js";
|
|
4
|
+
import { NonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator.js";
|
|
5
|
+
/**
|
|
6
|
+
* Serializable numeric identifier validator. Validates both serialized and non-serialized forms of numeric identifiers
|
|
7
|
+
* that support serialization.
|
|
8
|
+
*/
|
|
9
|
+
export class SerializableNumericIdentifierValidator extends NonGTINNumericIdentifierValidator {
|
|
10
|
+
/**
|
|
11
|
+
* Serial component length.
|
|
12
|
+
*/
|
|
13
|
+
#serialComponentLength;
|
|
14
|
+
/**
|
|
15
|
+
* Serial component character set.
|
|
16
|
+
*/
|
|
17
|
+
#serialComponentCharacterSet;
|
|
18
|
+
/**
|
|
19
|
+
* Serial component validation parameters.
|
|
20
|
+
*/
|
|
21
|
+
#serialComponentValidation;
|
|
22
|
+
/**
|
|
23
|
+
* Serial component creator.
|
|
24
|
+
*/
|
|
25
|
+
#serialComponentCreator;
|
|
26
|
+
/**
|
|
27
|
+
* Constructor.
|
|
28
|
+
*
|
|
29
|
+
* @param identifierType
|
|
30
|
+
* Identifier type.
|
|
31
|
+
*/
|
|
32
|
+
constructor(identifierType) {
|
|
33
|
+
const identifierDescriptor = IdentifierDescriptors[identifierType];
|
|
34
|
+
super(identifierDescriptor);
|
|
35
|
+
this.#serialComponentLength = identifierDescriptor.serialComponentLength;
|
|
36
|
+
this.#serialComponentCharacterSet = identifierDescriptor.serialComponentCharacterSet;
|
|
37
|
+
this.#serialComponentValidation = {
|
|
38
|
+
minimumLength: 1,
|
|
39
|
+
maximumLength: identifierDescriptor.serialComponentLength,
|
|
40
|
+
component: () => i18nextGS1.t("Identifier.serialComponent")
|
|
41
|
+
};
|
|
42
|
+
this.#serialComponentCreator = CONTENT_CHARACTER_SET_CREATORS[identifierDescriptor.serialComponentCharacterSet];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get the serial component length.
|
|
46
|
+
*/
|
|
47
|
+
get serialComponentLength() {
|
|
48
|
+
return this.#serialComponentLength;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the serial component character set.
|
|
52
|
+
*/
|
|
53
|
+
get serialComponentCharacterSet() {
|
|
54
|
+
return this.#serialComponentCharacterSet;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get the serial component validation parameters.
|
|
58
|
+
*/
|
|
59
|
+
get serialComponentValidation() {
|
|
60
|
+
return this.#serialComponentValidation;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get the serial component creator.
|
|
64
|
+
*/
|
|
65
|
+
get serialComponentCreator() {
|
|
66
|
+
return this.#serialComponentCreator;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @inheritDoc
|
|
70
|
+
*/
|
|
71
|
+
validate(identifier, validation) {
|
|
72
|
+
super.validate(identifier.substring(0, this.length), validation);
|
|
73
|
+
if (identifier.length > this.length) {
|
|
74
|
+
this.serialComponentCreator.validate(identifier.substring(this.length), this.#serialComponentValidation);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Split a serializable numeric identifier into its component parts.
|
|
79
|
+
*
|
|
80
|
+
* @param identifier
|
|
81
|
+
* Identifier.
|
|
82
|
+
*
|
|
83
|
+
* @param validation
|
|
84
|
+
* Identifier validation parameters.
|
|
85
|
+
*
|
|
86
|
+
* @returns
|
|
87
|
+
* Base identifier and serial component (possibly empty) as object.
|
|
88
|
+
*/
|
|
89
|
+
split(identifier, validation) {
|
|
90
|
+
this.validate(identifier, validation);
|
|
91
|
+
return {
|
|
92
|
+
baseIdentifier: identifier.substring(0, this.length),
|
|
93
|
+
serialComponent: identifier.substring(this.length)
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=serializable-numeric-identifier-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializable-numeric-identifier-validator.js","sourceRoot":"","sources":["../src/serializable-numeric-identifier-validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAErF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAmB/F;;;GAGG;AACH,MAAM,OAAO,sCAAuC,SAAQ,iCAAoE;IAC5H;;OAEG;IACM,sBAAsB,CAAS;IAExC;;OAEG;IACM,4BAA4B,CAAsB;IAE3D;;OAEG;IACM,0BAA0B,CAAyB;IAE5D;;OAEG;IACM,uBAAuB,CAAsB;IAEtD;;;;;OAKG;IACH,YAAY,cAAiD;QACzD,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,cAAc,CAAC,CAAC;QAEnE,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAE5B,IAAI,CAAC,sBAAsB,GAAG,oBAAoB,C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,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;YACpD,eAAe,EAAE,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;SACrD,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Restricted Circulation Number reference.
|
|
3
|
+
*/
|
|
4
|
+
export interface RCNReference {
|
|
5
|
+
/**
|
|
6
|
+
* Item reference.
|
|
7
|
+
*/
|
|
8
|
+
itemReference: number;
|
|
9
|
+
/**
|
|
10
|
+
* Price or weight (whole number only).
|
|
11
|
+
*/
|
|
12
|
+
priceOrWeight: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Variable measure trade item support functions.
|
|
16
|
+
*/
|
|
17
|
+
export declare class VariableMeasure {
|
|
18
|
+
/**
|
|
19
|
+
* Parse a Restricted Circulation Number (RCN) using a variable measure trade item format. The format is a 12- or
|
|
20
|
+
* 13-character string (for RCN-12 or RCN-13 respectively), containing the following:
|
|
21
|
+
*
|
|
22
|
+
* - '2' - The first character of the RCN.
|
|
23
|
+
* - '0'-'9' - The second character of the RCN (RCN-13 only).
|
|
24
|
+
* - 'I' - One or more, in sequence, for the item reference.
|
|
25
|
+
* - 'P' - One or more, in sequence, for the price or weight.
|
|
26
|
+
* - 'V' - Zero or one, for the price or weight check digit.
|
|
27
|
+
* - 'C' - The check digit of the entire RCN.
|
|
28
|
+
*
|
|
29
|
+
* The 'I', 'P', and 'V' formats may be in any order.
|
|
30
|
+
*
|
|
31
|
+
* Some examples:
|
|
32
|
+
*
|
|
33
|
+
* - `2IIIIIVPPPPC` - RCN-12 with a five-digit item reference, a price or weight check digit, and a four-digit price
|
|
34
|
+
* or weight.
|
|
35
|
+
* - `23IIIIVPPPPPC` - RCN-13 with a four-digit item reference, a price or weight check digit, and a five-digit price
|
|
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.
|
|
39
|
+
*
|
|
40
|
+
* @param format
|
|
41
|
+
* Format.
|
|
42
|
+
*
|
|
43
|
+
* @param rcn
|
|
44
|
+
* RCN.
|
|
45
|
+
*
|
|
46
|
+
* @returns
|
|
47
|
+
* RCN reference.
|
|
48
|
+
*/
|
|
49
|
+
static parseRCN(format: string, rcn: string): RCNReference;
|
|
50
|
+
/**
|
|
51
|
+
* Create a Restricted Circulation Number (RCN) using a variable measure trade item format. See {@linkcode parseRCN}
|
|
52
|
+
* for format details.
|
|
53
|
+
*
|
|
54
|
+
* @param format
|
|
55
|
+
* Format.
|
|
56
|
+
*
|
|
57
|
+
* @param itemReference
|
|
58
|
+
* Item reference.
|
|
59
|
+
*
|
|
60
|
+
* @param priceOrWeight
|
|
61
|
+
* Price or weight (whole number only).
|
|
62
|
+
*
|
|
63
|
+
* @returns
|
|
64
|
+
* RCN-12 or RCN-13.
|
|
65
|
+
*/
|
|
66
|
+
static createRCN(format: string, itemReference: number, priceOrWeight: number): string;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=variable-measure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variable-measure.d.ts","sourceRoot":"","sources":["../src/variable-measure.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AAEH,qBAAa,eAAe;IACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY;IAiG1D;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM;CAmGzF"}
|