Module: ClientAPI

Methods

(inner) addComponent(component) → {Promise}

Add a component to the library.

Parameters:
Name Type Description
component Component

The Component you want to add to the library.

Source:
Throws:

If there is already a component with the given meta id and version, or your component is not valid. (You have to use Promise.catch(...) to get this error.)

Returns:

The component was added successfully.

Type
Promise

(inner) addMeta(component, key, value) → {Promise}

Add od set meta information for a meta key of a component.

Parameters:
Name Type Description
component string

The meta id of the component.

key string

The meta key to set.

value

A value for the meta key. Can be of any serializable type.

Source:
Throws:

If the component is not defined.

Returns:

The meta key was successfully added.

Type
Promise

(inner) component(meta, versionopt) → {Promise.<Component>}

Query a specific component by its meta key and optionally in a specific version.

Parameters:
Name Type Attributes Description
meta string

The meta key of the component.

version string <optional>

A valid semver version. If no version is given the latest version is returned.

Source:
Throws:

If no component with the given meta id or version exists. (You have to use Promise.catch(...) to get this error.)

Returns:

The component with the meta ID.

Type
Promise.<Component>

(inner) componentCount() → {number}

Query the number of components in the database.

Source:
Returns:

The number of components.

Type
number

(inner) components() → {Promise.<Array.<Component>>}

Query all components in the library. Caution, depending on the database this could be lengthy.

Source:
Returns:

An array of components.

Type
Promise.<Array.<Component>>

(inner) config(key) → {Promise}

Get the configuration value specified by key.

Parameters:
Name Type Description
key string

The configuration key.

Source:
Throws:

If the key is not defined.

Returns:

The configuration value.

Type
Promise

(inner) export() → {Promise.<Object>}

Export the whole library into one JSON document.

Source:
Returns:

The library as an JSON document.

Type
Promise.<Object>

(inner) info() → {Promise.<object>}

Get information about the library server

Source:
Returns:

An object containing the version of the server and its type.

Type
Promise.<object>

(inner) meta(component, keyopt, versionopt) → {Promise.<Object>}

Get meta information for a specific component and a key at a given version. The key and version are optional.

Parameters:
Name Type Attributes Description
component string

The meta id for the component.

key string <optional>

The key identifying the meta information you want to get. If you don't specify it (or pass null) all keys will be included.

version string <optional>

The version of the component. If not specified it will use the latest version of the component.

Source:
Throws:

If the component does not exist in the specified version or the key is not defined.

Returns:

The value of the key or if no key was specified an object with all the meta keys as keys and their corresponding values.

Type
Promise.<Object>

(inner) setConfig(key, value)

Add or set the value of an configuration key.

Parameters:
Name Type Description
key string

The configuration key.

value

The value you want to set. This can be of any serializable type.

Source: