@doxteam/reference-data
TypeScript icon, indicating that this package has built-in type declarations

0.9.0 • Public • Published

reference-data

Helps lookup reference data.

API

init

Must be called before using to initialize data for the current context.

Parameters:

  • data - the reference data object to use.
  • contextId: {id: string}|{name: string} (optional, defaults to { name: "Master" }) - an identifier specifying the context.

Can throw an error if an invalid contextId is provided.

initFromFile

Equivalent to init(), only gets the data from a JSON file that is provided by path. Async.

initFromS3

Equivalent to initFromFile(), only gets the JSON file from Amazon S3. Async.

Parameters:

  • bucket - the S3 bucket that the file is in.
  • key - the key (i.e. file name).
  • contextId: {id: string}|{name: string} (optional, defaults to { name: "Master" }) - an identifier specifying the context.

Can throw an error if an invalid contextId is provided or if the file does not exist.

isInitialized

Determines whether reference data has been initialized.

lookup

Gets a value.

Parameters:

  • domainId: {id: string}|{referenceId: string}|{logicalName: string}|{technicalName: string} - an identifier specifying the domain of the value.
  • serviceName - the name of the service.
  • valueReferenceId - the reference ID of the value to get.

Can throw an error if no such domain, service or value exists.

reverseLookup

Gets a reference value based on a value from another service.

Parameters:

  • domainId: {id: string}|{referenceId: string}|{logicalName: string}|{technicalName: string} - an identifier specifying the domain of the value.
  • serviceName - the name of the service.
  • value - the value to check.

Can throw an error if no such domain or service exists, if the specified value could not be found, or if there are multiple matches for the value.

reverseValueLookup

Gets a base value based on a value from another service.

Parameters:

  • domainId: {id: string}|{referenceId: string}|{logicalName: string}|{technicalName: string} - an identifier specifying the domain of the value.
  • serviceName - the name of the service.
  • value - the value to check.

Can throw an error if no such domain or service exists, if the specified value could not be found, or if there are multiple matches for the value.

getReferenceIdByValueName

Gets a reference ID based on a value name.

Parameters:

  • domainId: {id: string}|{referenceId: string}|{logicalName: string}|{technicalName: string} - an identifier specifying the domain of the value.
  • valueName - the name of the value.

Can throw an error if no such domain exists or if the specified value could not be found.

getValueByReferenceId

Gets a base value by reference ID.

Parameters:

  • referenceId - the reference ID of the value to get.

Returns undefined if the specified value is not found.

getDomainReferenceIds

Gets all reference IDs for a domain.

Parameters:

  • domainId: {id: string}|{referenceId: string}|{logicalName: string}|{technicalName: string} - an identifier specifying the domain.

Can throw an error if no such domain exists.

Readme

Keywords

none

Package Sidebar

Install

npm i @doxteam/reference-data

Weekly Downloads

3

Version

0.9.0

License

ISC

Unpacked Size

27.3 kB

Total Files

6

Last publish

Collaborators

  • doxteam