Skip to content

AIDC Toolkit / GS1 / SerializableNumericIdentifierCreator

Class: SerializableNumericIdentifierCreator

Defined in: src/serializable-numeric-identifier-creator.ts:12

Serializable numeric identifier creator.

Extends

Constructors

Constructor

new SerializableNumericIdentifierCreator(prefixProvider, identifierType, length, serialComponentLength, serialComponentCharacterSet): SerializableNumericIdentifierCreator

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

Constructor. Typically called internally by a prefix manager but may be called by other code with another prefix provider type.

Parameters

prefixProvider

PrefixProvider

Prefix provider.

identifierType

IdentifierType

Identifier type.

length

number

Length.

serialComponentLength

number

Serial component length.

serialComponentCharacterSet

ContentCharacterSet

Serial component character set.

Returns

SerializableNumericIdentifierCreator

Overrides

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).constructor

Accessors

serialComponentLength

Get Signature

get serialComponentLength(): number

Defined in: src/serializable-numeric-identifier-validator.ts:74

Get the serial component length.

Returns

number

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).serialComponentLength


serialComponentCharacterSet

Get Signature

get serialComponentCharacterSet(): ContentCharacterSet

Defined in: src/serializable-numeric-identifier-validator.ts:81

Get the serial component character set.

Returns

ContentCharacterSet

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).serialComponentCharacterSet


serialComponentValidation

Get Signature

get protected serialComponentValidation(): CharacterSetValidation

Defined in: src/serializable-numeric-identifier-validator.ts:88

Get the serial component validation parameters.

Returns

CharacterSetValidation

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).serialComponentValidation


serialComponentCreator

Get Signature

get serialComponentCreator(): CharacterSetCreator

Defined in: src/serializable-numeric-identifier-validator.ts:95

Get the serial component creator.

Returns

CharacterSetCreator

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).serialComponentCreator


leaderType

Get Signature

get leaderType(): string

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

Inherit Doc
Returns

string

Inherited from

AbstractNumericIdentifierValidator.leaderType


identifierType

Get Signature

get identifierType(): IdentifierType

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

Inherit Doc
Returns

IdentifierType

Inherited from

AbstractIdentifierValidator.identifierType


prefixType

Get Signature

get prefixType(): PrefixType

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

Inherit Doc
Returns

PrefixType

Inherited from

AbstractIdentifierValidator.prefixType


length

Get Signature

get length(): number

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

Inherit Doc
Returns

number

Inherited from

AbstractIdentifierValidator.length


referenceCharacterSet

Get Signature

get referenceCharacterSet(): ContentCharacterSet

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

Inherit Doc
Returns

ContentCharacterSet

Inherited from

AbstractIdentifierValidator.referenceCharacterSet


referenceCreator

Get Signature

get referenceCreator(): CharacterSetCreator

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

Inherit Doc
Returns

CharacterSetCreator

Inherited from

AbstractIdentifierValidator.referenceCreator


capacity

Get Signature

get capacity(): number

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

Inherit Doc
Returns

number

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).capacity


tweak

Get Signature

get tweak(): bigint

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

Get the tweak for sparse creation.

Returns

bigint

Set Signature

set tweak(value): void

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

Set the tweak for sparse creation.

Parameters
value

bigint

Returns

void

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).tweak


prefixProvider

Get Signature

get prefixProvider(): PrefixProvider

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

Inherit Doc
Returns

PrefixProvider

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).prefixProvider


prefix

Get Signature

get prefix(): string

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

Inherit Doc
Returns

string

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).prefix


referenceLength

Get Signature

get referenceLength(): number

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

Inherit Doc
Returns

number

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).referenceLength

Methods

creatorFor()

protected static creatorFor(characterSet): CharacterSetCreator

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

Get the character set creator for a character set.

Parameters

characterSet

ContentCharacterSet

Character set.

Returns

CharacterSetCreator

Character set creator.

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).creatorFor


createSerialized()

createSerialized<TTransformerInput>(value, serialComponentOrComponents, sparse?): TransformerOutput<TTransformerInput, string>

Defined in: src/serializable-numeric-identifier-creator.ts:104

Create serialized identifier(s) with a reference based on a numeric value concatenated with serial component(s). The value is converted to a reference of the appropriate length using a numeric creator.

Type Parameters

TTransformerInput

TTransformerInput extends TransformerInput<string>

Transformer input type.

Parameters

value

number

Numeric value of the reference.

serialComponentOrComponents

TTransformerInput

Serial component(s).

sparse?

boolean

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

Returns

TransformerOutput<TTransformerInput, string>

Serialized identifiers.


concatenate()

concatenate<TTransformerInput>(baseIdentifier, serialComponentOrComponents): TransformerOutput<TTransformerInput, string>

Defined in: src/serializable-numeric-identifier-creator.ts:123

Concatenate a base identifier with serial component(s).

Type Parameters

TTransformerInput

TTransformerInput extends TransformerInput<string>

Transformer input type.

Parameters

baseIdentifier

string

Base identifier.

serialComponentOrComponents

TTransformerInput

Serial component(s).

Returns

TransformerOutput<TTransformerInput, string>

Serialized identifier(s).


validate()

validate(identifier, validation?): void

Defined in: src/serializable-numeric-identifier-validator.ts:102

Parameters

identifier

string

validation?

IdentifierValidation

Returns

void

Inherit Doc

Inherited from

SerializableNumericIdentifierValidator.validate


padIdentifier()

protected padIdentifier(identifier, validation): string

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

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.

validation

Identifier validation parameters.

IdentifierValidation | undefined

Returns

string

Padded identifier.

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).padIdentifier


validatePrefix()

protected validatePrefix(partialIdentifier, positionOffset?): void

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

Validate the prefix within an identifier.

Parameters

partialIdentifier

string

Partial identifier.

positionOffset?

number

Position offset within a larger string.

Returns

void

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).validatePrefix


init()

protected init(prefixProvider, prefix): void

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

Initialize the prefix provider. This method is in lieu of a constructor due to the mixin architecture.

Parameters

prefixProvider

PrefixProvider

Prefix provider.

prefix

string

Prefix within prefix manager to use to calculate reference length.

Returns

void

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).init


create()

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

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

Type Parameters

TTransformerInput

TTransformerInput extends TransformerInput<number | bigint>

Parameters

valueOrValues

TTransformerInput

sparse

boolean = false

Returns

TransformerOutput<TTransformerInput, string>

Inherit Doc

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).create


createAll()

createAll(): Iterable<string>

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

Returns

Iterable<string>

Inherit Doc

Inherited from

Mixin(SerializableNumericIdentifierValidator, AbstractNumericIdentifierCreator).createAll