Skip to content

AIDC Toolkit / GS1 / NonGTINNumericIdentifierCreator

Interface: NonGTINNumericIdentifierCreator<TNonGTINNumericIdentifierType> ​

Defined in: src/non-gtin-numeric-identifier-creator.ts:11

Non-GTIN numeric identifier creator. Creates one or many non-GTIN numeric identifiers.

Extends ​

Type Parameters ​

TNonGTINNumericIdentifierType ​

TNonGTINNumericIdentifierType extends NonGTINNumericIdentifierType = NonGTINNumericIdentifierType

Non-GTIN numeric identifier type type.

Properties ​

create() ​

create: <TTransformerInput>(valueOrValues, sparse?) => TransformerOutput<TTransformerInput, string>

Defined in: src/numeric-identifier-creator.ts:45

Create identifier(s) with reference(s) based on numeric value(s). The value(s) is/are converted to references of the appropriate length using NUMERIC_CREATOR.

Type Parameters ​

TTransformerInput ​

TTransformerInput extends TransformerInput<number | bigint>

Transformer input type.

Parameters ​

valueOrValues ​

TTransformerInput

Numeric value(s).

sparse? ​

boolean

If true, the value(s) are mapped to a sparse sequence resistant to discovery. Default is false.

Returns ​

TransformerOutput<TTransformerInput, string>

Identifier(s).

Inherited from ​

NumericIdentifierCreator.create


createAll() ​

createAll: () => Iterable<string>

Defined in: src/numeric-identifier-creator.ts:57

Create all identifiers for the prefix from 0 to capacity - 1.

The implementation creates the strings only as needed using an internal generator function. Although the result is equivalent to calling creator.create(new Sequence(0, creator.capacity)), this method is significantly faster.

Returns ​

Iterable<string>

All identifiers for the prefix.

Inherited from ​

NumericIdentifierCreator.createAll

Accessors ​

leaderType ​

Get Signature ​

get leaderType(): IdentifierTypeDescriptor<TNumericIdentifierType>["leaderType"]

Defined in: src/numeric-identifier-validator.ts:52

Leader type.

Returns ​

IdentifierTypeDescriptor<TNumericIdentifierType>["leaderType"]

Leader type.

Inherited from ​

NonGTINNumericIdentifierValidator.leaderType


identifierType ​

Get Signature ​

get identifierType(): IdentifierTypeDescriptor<TIdentifierType>["identifierType"]

Defined in: src/identifier-validator.ts:65

Get the identifier type. Per the GS1 General Specifications, the identifier type determines the remaining properties.

Returns ​

IdentifierTypeDescriptor<TIdentifierType>["identifierType"]

Identifier type. Per the GS1 General Specifications, the identifier type determines the remaining properties.

Inherited from ​

NonGTINNumericIdentifierValidator.identifierType


prefixType ​

Get Signature ​

get prefixType(): IdentifierTypeDescriptor<TIdentifierType>["prefixType"]

Defined in: src/identifier-validator.ts:73

Get the prefix type supported by the identifier type. For all identifier types except the GTIN, this is a GS1 Company Prefix. For the GTIN, the prefix type determines the length.

Returns ​

IdentifierTypeDescriptor<TIdentifierType>["prefixType"]

Prefix type supported by the identifier type. For all identifier types except the GTIN, this is a GS1 Company Prefix. For the GTIN, the prefix type determines the length.

Inherited from ​

NonGTINNumericIdentifierValidator.prefixType


length ​

Get Signature ​

get length(): IdentifierTypeDescriptor<TIdentifierType>["length"]

Defined in: src/identifier-validator.ts:82

Get the length. For numeric identifier types, the length is fixed; for alphanumeric identifier types, the length is the maximum.

Returns ​

IdentifierTypeDescriptor<TIdentifierType>["length"]

Length. For numeric identifier types, the length is fixed; for non-numeric identifier types, the length is the maximum.

Inherited from ​

NonGTINNumericIdentifierValidator.length


referenceCharacterSet ​

Get Signature ​

get referenceCharacterSet(): IdentifierTypeDescriptor<TIdentifierType>["referenceCharacterSet"]

Defined in: src/identifier-validator.ts:89

Get the reference character set.

Returns ​

IdentifierTypeDescriptor<TIdentifierType>["referenceCharacterSet"]

Reference character set.

Inherited from ​

NonGTINNumericIdentifierValidator.referenceCharacterSet


referenceCreator ​

Get Signature ​

get referenceCreator(): CharacterSetCreator

Defined in: src/identifier-validator.ts:96

Get the reference creator.

Returns ​

CharacterSetCreator

Inherited from ​

NonGTINNumericIdentifierValidator.referenceCreator


capacity ​

Get Signature ​

get capacity(): number

Defined in: src/numeric-identifier-creator.ts:17

Get the capacity (10**referenceLength).

Returns ​

number

Inherited from ​

NumericIdentifierCreator.capacity


tweak ​

Get Signature ​

get tweak(): bigint

Defined in: src/numeric-identifier-creator.ts:22

Get the tweak for sparse creation.

Returns ​

bigint

Set Signature ​

set tweak(value): void

Defined in: src/numeric-identifier-creator.ts:27

Set the tweak for sparse creation.

Parameters ​
value ​

bigint

Returns ​

void

Inherited from ​

NumericIdentifierCreator.tweak


prefixProvider ​

Get Signature ​

get prefixProvider(): PrefixProvider

Defined in: src/identifier-creator.ts:21

Get the prefix provider to which this identifier creator is bound.

Returns ​

PrefixProvider

Inherited from ​

NumericIdentifierCreator.prefixProvider


prefix ​

Get Signature ​

get prefix(): string

Defined in: src/identifier-creator.ts:27

Get the prefix, equivalent to calling prefixProvider.prefix for a GTIN or prefixProvider.gs1CompanyPrefix for all other identifier types.

Returns ​

string

Inherited from ​

NumericIdentifierCreator.prefix


referenceLength ​

Get Signature ​

get referenceLength(): number

Defined in: src/identifier-creator.ts:32

Get the reference length.

Returns ​

number

Inherited from ​

NumericIdentifierCreator.referenceLength

Methods ​

validate() ​

validate(identifier, validation?): void

Defined in: src/numeric-identifier-validator.ts:59

Validate an identifier and throw an error if validation fails.

Parameters ​

identifier ​

string

Identifier.

validation? ​

NumericIdentifierValidation

Identifier validation parameters.

Returns ​

void

Inherited from ​

NonGTINNumericIdentifierValidator.validate


padIdentifier() ​

protected padIdentifier(identifier, positionOffset?): string

Defined in: src/identifier-validator.ts:113

Pad an identifier on the left with zero-value character for validation purposes. This is done to align an identifier with a position offset for any error message that may be thrown by the reference validator.

Parameters ​

identifier ​

string

Identifier.

positionOffset? ​

number

Position offset within a larger string.

Returns ​

string

Padded identifier.

Inherited from ​

NonGTINNumericIdentifierValidator.padIdentifier


validatePrefix() ​

protected validatePrefix(partialIdentifier): void

Defined in: src/identifier-validator.ts:124

Validate the prefix within an identifier.

Parameters ​

partialIdentifier ​

string

Partial identifier.

Returns ​

void

Inherited from ​

NonGTINNumericIdentifierValidator.validatePrefix