Class: Registry

composer-client. Registry

Class representing an Abstract Registry.


<abstract> new Registry(registryType, id, name, securityContext, modelManager, factory, serializer)

Create a registry.

Note: Only to be called by framework code. Applications should
retrieve instances from BusinessNetworkConnection

Parameters:
Name Type Description
registryType string

The type of this registry.

id string

The unique identifier of the registry.

name string

The display name for the registry.

securityContext SecurityContext

The users security context.

modelManager ModelManager

The ModelManager to use for this registry.

factory Factory

The factory to use for this registry.

serializer Serializer

The Serializer to use for this registry.

Source:

Methods


add(resource)

Adds a new resource to the registry.

Parameters:
Name Type Description
resource Resource

The resource to be added to the registry.

Source:
Returns:

A promise that will be resolved when the resource is
added to the registry.

Type
Promise

addAll(resources)

Adds a list of new resources to the registry.

Parameters:
Name Type Description
resources Array.<Resource>

The resources to be added to the registry.

Source:
Returns:

A promise that will be resolved when the resource is
added to the registry.

Type
Promise

exists(id)

Determines whether a specific resource exists in the registry.

Parameters:
Name Type Description
id string

The unique identifier of the resource.

Source:
Returns:

A promise that will be resolved with true/false depending on whether the resource exists.

Type
Promise

find(expression)

Find resources in the registry that match the specified JSONata expression.
The JSONata expression is applied to each resource in the registry, and
resources are returned if the JSONata expression returns a truthy value for that
resource.

Parameters:
Name Type Description
expression string

The JSONata expression.

Source:
Returns:

A promise that will be resolved with an array of {@link
Resource} instances representing the assets that match the query.

Type
Promise

get(id)

Get a specific resource in the registry.

Parameters:
Name Type Description
id string

The unique identifier of the resource.

Source:
Returns:

A promise that will be resolved with a JSON object
representing the resource.

Type
Promise

getAll()

Get all of the resources in the registry.

Source:
Returns:

A promise that will be resolved with an array of JSON
objects representing the resources.

Type
Promise

query(expression)

Execute a query against all resources in the registry. The JSONata
expression is applied to each resource in the registry, and the result
of the JSONata expression is returned if the result is truthy. The result
is a JavaScript object, and should only be used for visualization
purposes. You cannot use the add or update functions with
data returned by this function.

Parameters:
Name Type Description
expression string

The JSONata expression.

Source:
Returns:

A promise that will be resolved with an array of JavaScript
objects representing the resources and all of their resolved relationships.

Type
Promise

remove(resource)

Remove an asset with a given type and id from the registry.

Parameters:
Name Type Description
resource Resource | string

The resource, or the unique identifier of the resource.

Source:
Returns:

A promise that will be resolved when the resource is
removed from the registry.

Type
Promise

removeAll(resources)

Removes a list of resources from the registry.

Parameters:
Name Type Description
resources Array.<Resource> | Array.<string>

The resources, or the unique identifiers of the resources.

Source:
Returns:

A promise that will be resolved when the resource is
added to the registry.

Type
Promise

resolve(id)

Get a specific resource in the registry, and resolve all of its relationships
to other assets, participants, and transactions. The result is a JavaScript
object, and should only be used for visualization purposes. You cannot use
the add or update functions with a resolved resource.

Parameters:
Name Type Description
id string

The unique identifier of the asset.

Source:
Returns:

A promise that will be resolved with a JavaScript object
representing the resource and all of its resolved relationships.

Type
Promise

resolveAll()

Get all of the resources in the registry, and resolve all of their relationships
to other assets, participants, and transactions. The result is a JavaScript
object, and should only be used for visualization purposes. You cannot use
the add or update functions with a resolved resource.

Source:
Returns:

A promise that will be resolved with an array of JavaScript
objects representing the resources and all of their resolved relationships.

Type
Promise

update(resource)

Updates a resource in the registry.

Parameters:
Name Type Description
resource Resource

The resource to be updated in the registry.

Source:
Returns:

A promise that will be resolved when the resource is
updated in the registry.

Type
Promise

updateAll(resources)

Updates a list of resources in the registry.

Parameters:
Name Type Description
resources Array.<Resource>

The resources to be updated in the asset registry.

Source:
Returns:

A promise that will be resolved when the resource is
added to the registry.

Type
Promise