Class: TypeRepoDbApi

TypeRepoDbApi()

Implements the DynamoDB API for the type repository. It contains methods for adding, getting, deleting, and querying types from the database. It also contains methods for getting domains, groups, modules, and purposes from the database.

Constructor

new TypeRepoDbApi()

Source:

Methods

(async) addTypeToDB(path, type, descriptionopt, documentationopt, purposeopt, versionopt, parent_type_idopt, topicopt, domainopt, groupopt, contactopt) → {Promise}

Adds a type to the database.
Parameters:
Name Type Attributes Default Description
path string The path of the type.
type string The type to be added.
description string <optional>
"" The description of the type.
documentation string <optional>
"" The documentation of the type.
purpose string <optional>
"" The purpose of the type.
version string <optional>
"" The version of the type.
parent_type_id number <optional>
-1 The ID of the parent type.
topic string <optional>
"" The topic of the type.
domain string <optional>
"" The domain of the type.
group string <optional>
"" The group of the type.
contact string <optional>
"" The contact information for the type.
Source:
Returns:
A promise that resolves when the type is added to the database.
Type
Promise

createRecordFromType()

tries to get information about the type to be used in the database. not all the information are available for all types. For example for a typedef the samplesize is not available.
Source:

(async) decrementDomains(domain) → {Promise.<void>}

Decrements the counters of a domain in the TypeRepoDomains table.
Parameters:
Name Type Description
domain string The domain to decrement.
Source:
Returns:
- A promise that resolves when the counters are decremented successfully.
Type
Promise.<void>

(async) deleteTypeFromDB(type_id) → {Promise}

Deletes a type from the database.
Parameters:
Name Type Description
type_id string The ID of the type to be deleted.
Source:
Returns:
A promise that resolves when the type is successfully deleted.
Type
Promise

describeTable() → {Promise.<Object>}

Retrieves the description of the table.
Source:
Returns:
A promise that resolves to the table description. The result will either contain the table description or an error.
Type
Promise.<Object>

getDomainsFromDB() → {Promise.<Array>}

Retrieves the domains from the database.
Source:
Returns:
A promise that resolves to an array of domain items. The result will either contain the array of domain items or an error.
Type
Promise.<Array>

getGroupsFromDB() → {Promise.<Array>}

Retrieves groups from the DynamoDB table.
Source:
Returns:
A promise that resolves to an array of group items.
Type
Promise.<Array>

getModulesFromDB() → {Promise.<Array>}

Retrieves modules from the DynamoDB table.
Source:
Returns:
A promise that resolves to an array of module items.
Type
Promise.<Array>

getPurposesFromDB() → {Promise.<Object>}

Retrieves purposes from the database.
Source:
Returns:
A promise that resolves to an object containing the purposes and their counts.
Type
Promise.<Object>

getTypeFromDB(type_id) → {Promise.<Object>}

Retrieves a type from the database based on the given type ID.
Parameters:
Name Type Description
type_id string The ID of the type to retrieve.
Source:
Returns:
A promise that resolves to the retrieved type object. The result will either contain the type object or an error.
Type
Promise.<Object>

(async) incrementDomains(domain) → {Promise}

Increments the counters for a given domain in the TypeRepoDomains table.
Parameters:
Name Type Description
domain string The domain to increment the counters for.
Source:
Returns:
A promise that resolves when the counters are incremented. The result will either contain the counters or an error.
Type
Promise

(async) incrementGroups(group) → {Promise}

Increments the counters for a given group in the TypeRepoGroups table.
Parameters:
Name Type Description
group string The group to increment the counters for.
Source:
Returns:
A promise that resolves when the counters are incremented. The result will either contain the counters or an error.
Type
Promise

(async) queryTypesFromDB(domain, group, modules, topic, type_name, contains, start, stop) → {Promise.<Array.<Object>>}

Queries types from the database based on the specified criteria.
Parameters:
Name Type Description
domain string The domain to filter the types by.
group string The group to filter the types by.
modules string The modules to filter the types by.
topic string The topic to filter the types by.
type_name string The type name to filter the types by.
contains number The flag indicating whether to perform exact match (0) or partial match (1) for filtering.
start number The index of the first item to return.
stop number The index of the last item to return.
Source:
Returns:
- A promise that resolves to an array of type objects matching the specified criteria. The result will either contain the array of type objects or an error.
Type
Promise.<Array.<Object>>

(async) queryTypesFromDBWithLastIndex(domain, group, modules, topic, type_name, contains, last_typeid, limitopt) → {Promise.<Array>}

Queries types from the database with the last index.
Parameters:
Name Type Attributes Default Description
domain string The domain value.
group string The group value.
modules string The modules value.
topic string The topic value.
type_name string The type name value.
contains number The contains value.
last_typeid number The last type ID value.
limit number <optional>
1000 The limit value (default is 1000).
Source:
Returns:
- A promise that resolves to an array of items. The result will either contain the array of items or an error.
Type
Promise.<Array>

TypeRepoDbApi()

new TypeRepoDbApi()

Represents a LibDynamoDB object. It loads the credentials from the creds.json file and specifies the table name. It also specifies the DynamoDB API version.
Source:

Methods

(async) addTypeToDB(path, type, descriptionopt, documentationopt, purposeopt, versionopt, parent_type_idopt, topicopt, domainopt, groupopt, contactopt) → {Promise}

Adds a type to the database.
Parameters:
Name Type Attributes Default Description
path string The path of the type.
type string The type to be added.
description string <optional>
"" The description of the type.
documentation string <optional>
"" The documentation of the type.
purpose string <optional>
"" The purpose of the type.
version string <optional>
"" The version of the type.
parent_type_id number <optional>
-1 The ID of the parent type.
topic string <optional>
"" The topic of the type.
domain string <optional>
"" The domain of the type.
group string <optional>
"" The group of the type.
contact string <optional>
"" The contact information for the type.
Source:
Returns:
A promise that resolves when the type is added to the database.
Type
Promise

createRecordFromType()

tries to get information about the type to be used in the database. not all the information are available for all types. For example for a typedef the samplesize is not available.
Source:

(async) decrementDomains(domain) → {Promise.<void>}

Decrements the counters of a domain in the TypeRepoDomains table.
Parameters:
Name Type Description
domain string The domain to decrement.
Source:
Returns:
- A promise that resolves when the counters are decremented successfully.
Type
Promise.<void>

(async) deleteTypeFromDB(type_id) → {Promise}

Deletes a type from the database.
Parameters:
Name Type Description
type_id string The ID of the type to be deleted.
Source:
Returns:
A promise that resolves when the type is successfully deleted.
Type
Promise

describeTable() → {Promise.<Object>}

Retrieves the description of the table.
Source:
Returns:
A promise that resolves to the table description. The result will either contain the table description or an error.
Type
Promise.<Object>

getDomainsFromDB() → {Promise.<Array>}

Retrieves the domains from the database.
Source:
Returns:
A promise that resolves to an array of domain items. The result will either contain the array of domain items or an error.
Type
Promise.<Array>

getGroupsFromDB() → {Promise.<Array>}

Retrieves groups from the DynamoDB table.
Source:
Returns:
A promise that resolves to an array of group items.
Type
Promise.<Array>

getModulesFromDB() → {Promise.<Array>}

Retrieves modules from the DynamoDB table.
Source:
Returns:
A promise that resolves to an array of module items.
Type
Promise.<Array>

getPurposesFromDB() → {Promise.<Object>}

Retrieves purposes from the database.
Source:
Returns:
A promise that resolves to an object containing the purposes and their counts.
Type
Promise.<Object>

getTypeFromDB(type_id) → {Promise.<Object>}

Retrieves a type from the database based on the given type ID.
Parameters:
Name Type Description
type_id string The ID of the type to retrieve.
Source:
Returns:
A promise that resolves to the retrieved type object. The result will either contain the type object or an error.
Type
Promise.<Object>

(async) incrementDomains(domain) → {Promise}

Increments the counters for a given domain in the TypeRepoDomains table.
Parameters:
Name Type Description
domain string The domain to increment the counters for.
Source:
Returns:
A promise that resolves when the counters are incremented. The result will either contain the counters or an error.
Type
Promise

(async) incrementGroups(group) → {Promise}

Increments the counters for a given group in the TypeRepoGroups table.
Parameters:
Name Type Description
group string The group to increment the counters for.
Source:
Returns:
A promise that resolves when the counters are incremented. The result will either contain the counters or an error.
Type
Promise

(async) queryTypesFromDB(domain, group, modules, topic, type_name, contains, start, stop) → {Promise.<Array.<Object>>}

Queries types from the database based on the specified criteria.
Parameters:
Name Type Description
domain string The domain to filter the types by.
group string The group to filter the types by.
modules string The modules to filter the types by.
topic string The topic to filter the types by.
type_name string The type name to filter the types by.
contains number The flag indicating whether to perform exact match (0) or partial match (1) for filtering.
start number The index of the first item to return.
stop number The index of the last item to return.
Source:
Returns:
- A promise that resolves to an array of type objects matching the specified criteria. The result will either contain the array of type objects or an error.
Type
Promise.<Array.<Object>>

(async) queryTypesFromDBWithLastIndex(domain, group, modules, topic, type_name, contains, last_typeid, limitopt) → {Promise.<Array>}

Queries types from the database with the last index.
Parameters:
Name Type Attributes Default Description
domain string The domain value.
group string The group value.
modules string The modules value.
topic string The topic value.
type_name string The type name value.
contains number The contains value.
last_typeid number The last type ID value.
limit number <optional>
1000 The limit value (default is 1000).
Source:
Returns:
- A promise that resolves to an array of items. The result will either contain the array of items or an error.
Type
Promise.<Array>