Class: BusinessNetworkDefinition

composer-common. BusinessNetworkDefinition


A BusinessNetworkDefinition defines a set of Participants that exchange Assets by
sending Transactions. This class manages the metadata and domain-specific types for
the network as well as a set of executable scripts.


new BusinessNetworkDefinition(identifier, description)

Create the BusinessNetworkDefinition.


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

Parameters:
Name Type Description
identifier String

the identifier of the business network. The
identifier is formed from a business network name + '@' + version. The
version is a semver valid version string.

description String

the description of the business network

Source:

Methods


<static> fromArchive(Buffer)

Create a BusinessNetworkDefinition from an archive.

Parameters:
Name Type Description
Buffer Buffer

the Buffer to a zip archive

Source:
Returns:

a Promise to the instantiated business network

Type
Promise

<static> fromDirectory(path [, options])

Builds a BusinessNetworkDefintion from the contents of a directory.
The directory must include a package.json in the root (used to specify
the name, version and description of the business network). This method
is designed to work with business networks that refer to external models
using npm dependencies as well as business networks that statically
package their model files.


If package.json contains a dependencies property then this method will search for
model (CTO) files under the node_modules directory for each dependency that
passes the options.dependencyGlob pattern.



In addition all model files will be added that are not under node_modules
and that pass the options.modelFileGlob pattern. By default you should put
model files under a directory called 'models'.



All script (js) files will be added that are not under node_modules and
that pass the options.scriptGlob pattern. By default you should put Javascript
files under the 'lib' directory.

Parameters:
Name Type Argument Description
path String

to a local directory

options Object <optional>

an optional set of options to configure the instance.

Properties
Name Type Argument Description
dependencyGlob Object <optional>

specify the glob pattern used to match
the npm dependencies to process. Defaults to **

modelFileGlob boolean <optional>

specify the glob pattern used to match
the model files to include. Defaults to \/models/\/*.cto

scriptGlob boolean <optional>

specify the glob pattern used to match
the script files to include. Defaults to \/lib/\/*.js

Source:
Returns:

a Promise to the instantiated business network

Type
Promise

getDescription()

Returns the description for this business network

Source:
Returns:

the description of this business network

Type
String

getFactory()

Provides access to the Factory for this business network. The Factory
is used to create the types defined in this business network.

Source:
Returns:

the Factory for this business network

Type
Factory

getIdentifier()

Returns the identifier for this business network

Source:
Returns:

the identifier of this business network

Type
String

getIntrospector()

Provides access to the Introspector for this business network. The Introspector
is used to reflect on the types defined within this business network.

Source:
Returns:

the Introspector for this business network

Type
Introspector

getName()

Returns the name for this business network

Source:
Returns:

the name of this business network

Type
String

getSerializer()

Provides access to the Serializer for this business network. The Serializer
is used to serialize instances of the types defined within this business network.

Source:
Returns:

the Serializer for this business network

Type
Serializer

getVersion()

Returns the version for this business network

Source:
Returns:

the version of this business network. Use semver module
to parse.

Type
String

toArchive()

Store a BusinessNetworkDefinition as an archive.

Source:
Returns:

buffer - the zlib buffer

Type
Buffer