Skip to content

AIDC Toolkit / GS1 / RemoteGCPLengthCache

Class: RemoteGCPLengthCache

Defined in: src/gcp-length-cache.ts:177

GS1 Company Prefix length cache with remote source. This class provides access to the data from a remote source, by default the AIDC Toolkit website. If any error occurs, the next check date/time is set to the current date/time plus ten minutes to prevent the network from being overloaded.

The data on the AIDC Toolkit website is updated regularly with the data provided by GS1, and it's stored in binary format for faster retrieval.

Extends

Properties

DEFAULT_BASE_URL

static DEFAULT_BASE_URL: string

Defined in: src/gcp-length-cache.ts:181

Default base URL pointing to AIDC Toolkit website data directory.


APP_DATA_STORAGE_KEY

static APP_DATA_STORAGE_KEY: string = "gcp-length"

Defined in: src/gcp-length-cache.ts:28

Storage key for full application data object.

Inherited from

GCPLengthCache.APP_DATA_STORAGE_KEY


NEXT_CHECK_DATE_TIME_STORAGE_KEY

static NEXT_CHECK_DATE_TIME_STORAGE_KEY: string = "gcp-length-next-check-date-time"

Defined in: src/gcp-length-cache.ts:33

Storage key for next check date/time.

Inherited from

GCPLengthCache.NEXT_CHECK_DATE_TIME_STORAGE_KEY


HEADER_STORAGE_KEY

static HEADER_STORAGE_KEY: string = "gcp-length-header"

Defined in: src/gcp-length-cache.ts:38

Storage key for header information (date/time and disclaimer).

Inherited from

GCPLengthCache.HEADER_STORAGE_KEY


DATA_STORAGE_KEY

static DATA_STORAGE_KEY: string = "gcp-length-data"

Defined in: src/gcp-length-cache.ts:43

Storage key for data only.

Inherited from

GCPLengthCache.DATA_STORAGE_KEY

Constructors

Constructor

new RemoteGCPLengthCache(appDataStorage, baseURL, httpFetch): RemoteGCPLengthCache

Defined in: src/gcp-length-cache.ts:206

Constructor.

Parameters

appDataStorage

AppDataStorage<boolean>

Application data storage.

baseURL

string = RemoteGCPLengthCache.DEFAULT_BASE_URL

Base URL. The URL must not end with a slash and must host the gcp-length-header.json and gcp-length-data.bin files.

httpFetch

HTTPFetch = defaultHTTPFetch

HTTP fetch function.

Returns

RemoteGCPLengthCache

Overrides

GCPLengthCache.constructor

Accessors

sourceDateTime

Get Signature

get sourceDateTime(): Promise<Date>

Defined in: src/gcp-length-cache.ts:251

Get the date/time at which the source was last updated. This should not be called unless the next check date/time has passed, as it may trigger an expensive remote retrieval.

Returns

Promise<Date>

Overrides

GCPLengthCache.sourceDateTime


sourceData

Get Signature

get sourceData(): Promise<GCPLengthData>

Defined in: src/gcp-length-cache.ts:268

Get the source data. This should not be called unless the next check date/time has passed, as it may trigger an expensive remote retrieval.

Returns

Promise<GCPLengthData>

Overrides

GCPLengthCache.sourceData


appDataStorage

Get Signature

get appDataStorage(): AppDataStorage<boolean>

Defined in: src/gcp-length-cache.ts:70

Get the application data storage.

Returns

AppDataStorage<boolean>

Inherited from

GCPLengthCache.appDataStorage


nextCheckDateTime

Get Signature

get nextCheckDateTime(): Promise<Date | undefined>

Defined in: src/gcp-length-cache.ts:120

Inherit Doc
Returns

Promise<Date | undefined>

Inherited from

GCPLengthCache.nextCheckDateTime


cacheDateTime

Get Signature

get cacheDateTime(): Promise<Date | undefined>

Defined in: src/gcp-length-cache.ts:127

Inherit Doc
Returns

Promise<Date | undefined>

Inherited from

GCPLengthCache.cacheDateTime


cacheData

Get Signature

get cacheData(): Promise<GCPLengthData>

Defined in: src/gcp-length-cache.ts:134

Inherit Doc
Returns

Promise<GCPLengthData>

Inherited from

GCPLengthCache.cacheData

Methods

update()

update(nextCheckDateTime, _cacheDateTime?, cacheData?): Promise<void>

Defined in: src/gcp-length-cache.ts:148

Parameters

nextCheckDateTime

Date

_cacheDateTime?

Date

cacheData?

GCPLengthData

Returns

Promise<void>

Inherit Doc

Inherited from

GCPLengthCache.update