Node.js API
concerto-core
Concerto module. Concerto is a framework for defining domain specific models.
- concerto-core
- static
- inner
- ~BaseException ⇐
Error - ~BaseFileException ⇐
BaseException - ~Factory
- new Factory(modelManager)
- instance
- .newResource(ns, type, id, [options]) ⇒
Resource - .newConcept(ns, type, [options]) ⇒
Resource - .newRelationship(ns, type, id) ⇒
Relationship - .newTransaction(ns, type, [id], [options]) ⇒
Resource - .newEvent(ns, type, [id], [options]) ⇒
Resource
- .newResource(ns, type, id, [options]) ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
- ~ModelManager
- new ModelManager()
- instance
- .validateModelFile(modelFile, fileName)
- .addModelFile(modelFile, fileName, [disableValidation], [systemModelTable]) ⇒
Object - .updateModelFile(modelFile, fileName, [disableValidation]) ⇒
Object - .deleteModelFile(namespace)
- .addModelFiles(modelFiles, [fileNames], [disableValidation], [systemModelTable]) ⇒
Array.<Object> - .validateModelFiles()
- .updateExternalModels([options], [modelFileDownloader]) ⇒
Promise - .writeModelsToFileSystem(path, [options])
- .getModels([options]) ⇒
Array.<{name:string, content:string}> - .clearModelFiles()
- .getNamespaces() ⇒
Array.<string> - .getSystemTypes() ⇒
Array.<ClassDeclaration> - .getAssetDeclarations(includeSystemType) ⇒
Array.<AssetDeclaration> - .getTransactionDeclarations(includeSystemType) ⇒
Array.<TransactionDeclaration> - .getEventDeclarations(includeSystemType) ⇒
Array.<EventDeclaration> - .getParticipantDeclarations(includeSystemType) ⇒
Array.<ParticipantDeclaration> - .getEnumDeclarations(includeSystemType) ⇒
Array.<EnumDeclaration> - .getConceptDeclarations(includeSystemType) ⇒
Array.<ConceptDeclaration> - .getFactory() ⇒
Factory - .getSerializer() ⇒
Serializer - .getDecoratorFactories() ⇒
Array.<DecoratorFactory> - .addDecoratorFactory(factory)
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
- ~SecurityException ⇐
BaseException - ~Serializer
- new Serializer(factory, modelManager)
- instance
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
- ~AssetDeclaration ⇐
ClassDeclaration- new AssetDeclaration(modelFile, ast)
- instance
- .isRelationshipTarget() ⇒
boolean - .getSystemType() ⇒
string
- .isRelationshipTarget() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
- ~ClassDeclaration
- new ClassDeclaration(modelFile, ast)
- instance
- ._resolveSuperType() ⇒
ClassDeclaration - .getSystemType() ⇒
string - .isAbstract() ⇒
boolean - .isEnum() ⇒
boolean - .isConcept() ⇒
boolean - .isEvent() ⇒
boolean - .isRelationshipTarget() ⇒
boolean - .isSystemRelationshipTarget() ⇒
boolean - .isSystemType() ⇒
boolean - .isSystemCoreType() ⇒
boolean - .getName() ⇒
string - .getNamespace() ⇒
String - .getFullyQualifiedName() ⇒
string - .getIdentifierFieldName() ⇒
string - .getOwnProperty(name) ⇒
Property - .getOwnProperties() ⇒
Array.<Property> - .getSuperType() ⇒
string - .getSuperTypeDeclaration() ⇒
ClassDeclaration - .getAssignableClassDeclarations() ⇒
Array.<ClassDeclaration> - .getAllSuperTypeDeclarations() ⇒
Array.<ClassDeclaration> - .getProperty(name) ⇒
Property - .getProperties() ⇒
Array.<Property> - .getNestedProperty(propertyPath) ⇒
Property - .toString() ⇒
String
- ._resolveSuperType() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
- ~ConceptDeclaration ⇐
ClassDeclaration- new ConceptDeclaration(modelFile, ast)
- instance
- .isConcept() ⇒
boolean
- .isConcept() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
- ~Decorator
- new Decorator(parent, ast)
- .getParent() ⇒
ClassDeclaration|Property - .getName() ⇒
string - .getArguments() ⇒
Array.<object>
- ~EnumDeclaration ⇐
ClassDeclaration- new EnumDeclaration(modelFile, ast)
- instance
- .isEnum() ⇒
boolean - .toString() ⇒
String
- .isEnum() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
- ~EnumValueDeclaration ⇐
Property - ~EventDeclaration ⇐
ClassDeclaration- new EventDeclaration(modelFile, ast)
- instance
- .getSystemType() ⇒
string - .isEvent() ⇒
boolean
- .getSystemType() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
- ~Introspector
- new Introspector(modelManager)
- .getClassDeclarations() ⇒
Array.<ClassDeclaration> - .getClassDeclaration(fullyQualifiedTypeName) ⇒
ClassDeclaration
- ~ModelFile
- new ModelFile(modelManager, definitions, [fileName], [isSystemModelFile])
- instance
- .isExternal() ⇒
boolean - .getModelManager() ⇒
ModelManager - .getImports() ⇒
Array.<string> - .isDefined(type) ⇒
boolean - .getLocalType(type) ⇒
ClassDeclaration - .getAssetDeclaration(name) ⇒
AssetDeclaration - .getTransactionDeclaration(name) ⇒
TransactionDeclaration - .getEventDeclaration(name) ⇒
EventDeclaration - .getParticipantDeclaration(name) ⇒
ParticipantDeclaration - .getNamespace() ⇒
string - .getName() ⇒
string - .getAssetDeclarations(includeSystemType) ⇒
Array.<AssetDeclaration> - .getTransactionDeclarations(includeSystemType) ⇒
Array.<TransactionDeclaration> - .getEventDeclarations(includeSystemType) ⇒
Array.<EventDeclaration> - .getParticipantDeclarations(includeSystemType) ⇒
Array.<ParticipantDeclaration> - .getConceptDeclarations(includeSystemType) ⇒
Array.<ConceptDeclaration> - .getEnumDeclarations(includeSystemType) ⇒
Array.<EnumDeclaration> - .getDeclarations(type, includeSystemType) ⇒
Array.<ClassDeclaration> - .getAllDeclarations() ⇒
Array.<ClassDeclaration> - .getDefinitions() ⇒
string - .isSystemModelFile() ⇒
boolean
- .isExternal() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
- ~ParticipantDeclaration ⇐
ClassDeclaration- new ParticipantDeclaration(modelFile, ast)
- instance
- .isRelationshipTarget() ⇒
boolean - .getSystemType() ⇒
string
- .isRelationshipTarget() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
- ~Property
- new Property(parent, ast)
- instance
- .getParent() ⇒
ClassDeclaration - .getName() ⇒
string - .getType() ⇒
string - .isOptional() ⇒
boolean - .getFullyQualifiedTypeName() ⇒
string - .getFullyQualifiedName() ⇒
string - .getNamespace() ⇒
string - .isArray() ⇒
boolean - .isTypeEnum() ⇒
boolean - .isPrimitive() ⇒
boolean
- .getParent() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
- ~RelationshipDeclaration ⇐
Property- new RelationshipDeclaration(parent, ast)
- instance
- .toString() ⇒
String
- .toString() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
- ~TransactionDeclaration ⇐
ClassDeclaration- new TransactionDeclaration(modelFile, ast)
- instance
- .getSystemType() ⇒
string
- .getSystemType() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
- ~BaseException ⇐
concerto-core.ModelLoader
Create a ModelManager from model files, with an optional system model.
If a ctoFile is not provided, the Accord Project system model is used.
Kind: static class of concerto-core
ModelLoader.loadModelManager(ctoSystemFile, ctoFiles) ⇒ object
Load system and models in a new model manager
Kind: static method of ModelLoader
Returns: object - the model manager
| Param | Type | Description |
|---|---|---|
| ctoSystemFile | string | the system model file |
| ctoFiles | Array.<string> | the CTO files (can be local file paths or URLs) |
ModelLoader.loadModelManagerFromModelFiles(ctoSystemFile, modelFiles, [fileNames]) ⇒ object
Load system and models in a new model manager from model files objects
Kind: static method of ModelLoader
Returns: object - the model manager
| Param | Type | Description |
|---|---|---|
| ctoSystemFile | string | the system model file |
| modelFiles | Array.<object> | An array of Concerto files as strings or ModelFile objects. |
| [fileNames] | Array.<string> | An optional array of file names to associate with the model files |
concerto-core.DecoratorFactory
An interface for a class that processes a decorator and returns a specific implementation class for that decorator.
Kind: static class of concerto-core
decoratorFactory.newDecorator(parent, ast) ⇒ Decorator
Process the decorator, and return a specific implementation class for that decorator, or return null if this decorator is not handled by this processor.
Kind: instance abstract method of DecoratorFactory
Returns: Decorator - The decorator.
| Param | Type | Description | |
|---|---|---|---|
| parent | ClassDeclaration \ | Property | the owner of this property |
| ast | Object | The AST created by the parser |
concerto-core~BaseException ⇐ Error
A base class for all Concerto exceptions
Kind: inner class of concerto-core
Extends: Error
new BaseException(message, component)
Create the BaseException.
| Param | Type | Description |
|---|---|---|
| message | string | The exception message. |
| component | string | The optional component which throws this error. |
concerto-core~BaseFileException ⇐ BaseException
Exception throws when a Concerto file is semantically invalid
Kind: inner class of concerto-core
Extends: BaseException
See: BaseException
- ~BaseFileException ⇐
BaseException
new BaseFileException(message, fileLocation, fullMessage, fileName, component)
Create an BaseFileException
| Param | Type | Description |
|---|---|---|
| message | string | the message for the exception |
| fileLocation | string | the optional file location associated with the exception |
| fullMessage | string | the optional full message text |
| fileName | string | the optional file name |
| component | string | the optional component which throws this error |
baseFileException.getFileLocation() ⇒ string
Returns the file location associated with the exception or null
Kind: instance method of BaseFileException
Returns: string - the optional location associated with the exception
baseFileException.getShortMessage() ⇒ string
Returns the error message without the location of the error
Kind: instance method of BaseFileException
Returns: string - the error message
baseFileException.getFileName() ⇒ string
Returns the fileName for the error
Kind: instance method of BaseFileException
Returns: string - the file name or null
concerto-core~Factory
Use the Factory to create instances of Resource: transactions, participants and assets.
Kind: inner class of concerto-core
- ~Factory
- new Factory(modelManager)
- instance
- .newResource(ns, type, id, [options]) ⇒
Resource - .newConcept(ns, type, [options]) ⇒
Resource - .newRelationship(ns, type, id) ⇒
Relationship - .newTransaction(ns, type, [id], [options]) ⇒
Resource - .newEvent(ns, type, [id], [options]) ⇒
Resource
- .newResource(ns, type, id, [options]) ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
new Factory(modelManager)
Create the factory.
| Param | Type | Description |
|---|---|---|
| modelManager | ModelManager | The ModelManager to use for this registry |
factory.newResource(ns, type, id, [options]) ⇒ Resource
Create a new Resource with a given namespace, type name and id
Kind: instance method of Factory
Returns: Resource - the new instance
Throws:
TypeNotFoundExceptionif the type is not registered with the ModelManager
| Param | Type | Description |
|---|---|---|
| ns | String | the namespace of the Resource |
| type | String | the type of the Resource |
| id | String | the identifier |
| [options] | Object | an optional set of options |
| [options.disableValidation] | boolean | pass true if you want the factory to return a Resource instead of a ValidatedResource. Defaults to false. |
| [options.generate] | String | Pass one of:
|
| [options.includeOptionalFields] | boolean | if options.generate is specified, whether optional fields should be generated. |
| [options.allowEmptyId] | boolean | if options.allowEmptyId is specified as true, a zero length string for id is allowed (allows it to be filled in later). |
factory.newConcept(ns, type, [options]) ⇒ Resource
Create a new Concept with a given namespace and type name
Kind: instance method of Factory
Returns: Resource - the new instance
Throws:
TypeNotFoundExceptionif the type is not registered with the ModelManager
| Param | Type | Description |
|---|---|---|
| ns | String | the namespace of the Concept |
| type | String | the type of the Concept |
| [options] | Object | an optional set of options |
| [options.disableValidation] | boolean | pass true if you want the factory to return a Concept instead of a ValidatedConcept. Defaults to false. |
| [options.generate] | String | Pass one of:
|
| [options.includeOptionalFields] | boolean | if options.generate is specified, whether optional fields should be generated. |
factory.newRelationship(ns, type, id) ⇒ Relationship
Create a new Relationship with a given namespace, type and identifier.
A relationship is a typed pointer to an instance. I.e the relationship
with namespace = 'org.example', type = 'Vehicle' and id = 'ABC' creates
a pointer that points at an instance of org.example.Vehicle with the id
ABC.
Kind: instance method of Factory
Returns: Relationship - - the new relationship instance
Throws:
TypeNotFoundExceptionif the type is not registered with the ModelManager
| Param | Type | Description |
|---|---|---|
| ns | String | the namespace of the Resource |
| type | String | the type of the Resource |
| id | String | the identifier |
factory.newTransaction(ns, type, [id], [options]) ⇒ Resource
Create a new transaction object. The identifier of the transaction is set to a UUID.
Kind: instance method of Factory
Returns: Resource - A resource for the new transaction.
| Param | Type | Description |
|---|---|---|
| ns | String | the namespace of the transaction. |
| type | String | the type of the transaction. |
| [id] | String | an optional identifier for the transaction; if you do not specify one then an identifier will be automatically generated. |
| [options] | Object | an optional set of options |
| [options.generate] | String | Pass one of:
|
| [options.includeOptionalFields] | boolean | if options.generate is specified, whether optional fields should be generated. |
| [options.allowEmptyId] | boolean | if options.allowEmptyId is specified as true, a zero length string for id is allowed (allows it to be filled in later). |
factory.newEvent(ns, type, [id], [options]) ⇒ Resource
Create a new event object. The identifier of the event is set to a UUID.
Kind: instance method of Factory
Returns: Resource - A resource for the new event.
| Param | Type | Description |
|---|---|---|
| ns | String | the namespace of the event. |
| type | String | the type of the event. |
| [id] | String | an optional identifier for the event; if you do not specify one then an identifier will be automatically generated. |
| [options] | Object | an optional set of options |
| [options.generate] | String | Pass one of:
|
| [options.includeOptionalFields] | boolean | if options.generate is specified, whether optional fields should be generated. |
| [options.allowEmptyId] | boolean | if options.allowEmptyId is specified as true, a zero length string for id is allowed (allows it to be filled in later). |
Factory.Symbol.hasInstance(object) ⇒ boolean
Alternative instanceof that is reliable across different module instances
Kind: static method of Factory
Returns: boolean - - True, if the object is an instance of a Factory
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |
concerto-core~ModelManager
Manages the Concerto model files.
The structure of Resources (Assets, Transactions, Participants) is modelled in a set of Concerto files. The contents of these files are managed by the ModelManager. Each Concerto file has a single namespace and contains a set of asset, transaction and participant type definitions.
Concerto applications load their Concerto files and then call the addModelFile method to register the Concerto file(s) with the ModelManager. The ModelManager parses the text of the Concerto file and will make all defined types available to other Concerto services, such as the Serializer (to convert instances to/from JSON) and Factory (to create instances).
Kind: inner class of concerto-core
- ~ModelManager
- new ModelManager()
- instance
- .validateModelFile(modelFile, fileName)
- .addModelFile(modelFile, fileName, [disableValidation], [systemModelTable]) ⇒
Object - .updateModelFile(modelFile, fileName, [disableValidation]) ⇒
Object - .deleteModelFile(namespace)
- .addModelFiles(modelFiles, [fileNames], [disableValidation], [systemModelTable]) ⇒
Array.<Object> - .validateModelFiles()
- .updateExternalModels([options], [modelFileDownloader]) ⇒
Promise - .writeModelsToFileSystem(path, [options])
- .getModels([options]) ⇒
Array.<{name:string, content:string}> - .clearModelFiles()
- .getNamespaces() ⇒
Array.<string> - .getSystemTypes() ⇒
Array.<ClassDeclaration> - .getAssetDeclarations(includeSystemType) ⇒
Array.<AssetDeclaration> - .getTransactionDeclarations(includeSystemType) ⇒
Array.<TransactionDeclaration> - .getEventDeclarations(includeSystemType) ⇒
Array.<EventDeclaration> - .getParticipantDeclarations(includeSystemType) ⇒
Array.<ParticipantDeclaration> - .getEnumDeclarations(includeSystemType) ⇒
Array.<EnumDeclaration> - .getConceptDeclarations(includeSystemType) ⇒
Array.<ConceptDeclaration> - .getFactory() ⇒
Factory - .getSerializer() ⇒
Serializer - .getDecoratorFactories() ⇒
Array.<DecoratorFactory> - .addDecoratorFactory(factory)
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
new ModelManager()
Create the ModelManager.
modelManager.validateModelFile(modelFile, fileName)
Validates a Concerto file (as a string) to the ModelManager. Concerto files have a single namespace.
Note that if there are dependencies between multiple files the files must be added in dependency order, or the addModelFiles method can be used to add a set of files irrespective of dependencies.
Kind: instance method of ModelManager
Throws:
IllegalModelException
| Param | Type | Description |
|---|---|---|
| modelFile | string | The Concerto file as a string |
| fileName | string | an optional file name to associate with the model file |
modelManager.addModelFile(modelFile, fileName, [disableValidation], [systemModelTable]) ⇒ Object
Adds a Concerto file (as a string) to the ModelManager. Concerto files have a single namespace. If a Concerto file with the same namespace has already been added to the ModelManager then it will be replaced. Note that if there are dependencies between multiple files the files must be added in dependency order, or the addModelFiles method can be used to add a set of files irrespective of dependencies.
Kind: instance method of ModelManager
Returns: Object - The newly added model file (internal).
Throws:
IllegalModelException
| Param | Type | Description |
|---|---|---|
| modelFile | string | The Concerto file as a string |
| fileName | string | an optional file name to associate with the model file |
| [disableValidation] | boolean | If true then the model files are not validated |
| [systemModelTable] | boolean | A table that maps classes in the new models to system types |
modelManager.updateModelFile(modelFile, fileName, [disableValidation]) ⇒ Object
Updates a Concerto file (as a string) on the ModelManager. Concerto files have a single namespace. If a Concerto file with the same namespace has already been added to the ModelManager then it will be replaced.
Kind: instance method of ModelManager
Returns: Object - The newly added model file (internal).
Throws:
IllegalModelException
| Param | Type | Description |
|---|---|---|
| modelFile | string | The Concerto file as a string |
| fileName | string | an optional file name to associate with the model file |
| [disableValidation] | boolean | If true then the model files are not validated |
modelManager.deleteModelFile(namespace)
Remove the Concerto file for a given namespace
Kind: instance method of ModelManager
| Param | Type | Description |
|---|---|---|
| namespace | string | The namespace of the model file to delete. |
modelManager.addModelFiles(modelFiles, [fileNames], [disableValidation], [systemModelTable]) ⇒ Array.<Object>
Add a set of Concerto files to the model manager.
Kind: instance method of ModelManager
Returns: Array.<Object> - The newly added model files (internal).
| Param | Type | Description |
|---|---|---|
| modelFiles | Array.<object> | An array of Concerto files as strings or ModelFile objects. |
| [fileNames] | Array.<string> | An optional array of file names to associate with the model files |
| [disableValidation] | boolean | If true then the model files are not validated |
| [systemModelTable] | boolean | A table that maps classes in the new models to system types |
modelManager.validateModelFiles()
Validates all models files in this model manager
Kind: instance method of ModelManager
modelManager.updateExternalModels([options], [modelFileDownloader]) ⇒ Promise
Downloads all ModelFiles that are external dependencies and adds or updates them in this ModelManager.
Kind: instance method of ModelManager
Returns: Promise - a promise when the download and update operation is completed.
Throws:
IllegalModelExceptionif the models fail validation
| Param | Type | Description |
|---|---|---|
| [options] | Object | Options object passed to ModelFileLoaders |
| [modelFileDownloader] | ModelFileDownloader | an optional ModelFileDownloader |
modelManager.writeModelsToFileSystem(path, [options])
Write all models in this model manager to the specified path in the file system
Kind: instance method of ModelManager
| Param | Type | Description |
|---|---|---|
| path | String | to a local directory |
| [options] | Object | Options object |
| options.includeExternalModels | boolean | If true, external models are written to the file system. Defaults to true |
| options.includeSystemModels | boolean | If true, system models are written to the file system. Defaults to false |
modelManager.getModels([options]) ⇒ Array.<{name:string, content:string}>
Gets all the CTO models
Kind: instance method of ModelManager
Returns: Array.<{name:string, content:string}> - the name and content of each CTO file
| Param | Type | Description |
|---|---|---|
| [options] | Object | Options object |
| options.includeExternalModels | boolean | If true, external models are written to the file system. Defaults to true |
| options.includeSystemModels | boolean | If true, system models are written to the file system. Defaults to false |
modelManager.clearModelFiles()
Remove all registered Concerto files
Kind: instance method of ModelManager
modelManager.getNamespaces() ⇒ Array.<string>
Get the namespaces registered with the ModelManager.
Kind: instance method of ModelManager
Returns: Array.<string> - namespaces - the namespaces that have been registered.
modelManager.getSystemTypes() ⇒ Array.<ClassDeclaration>
Get all class declarations from system namespaces
Kind: instance method of ModelManager
Returns: Array.<ClassDeclaration> - the ClassDeclarations from system namespaces
modelManager.getAssetDeclarations(includeSystemType) ⇒ Array.<AssetDeclaration>
Get the AssetDeclarations defined in this model manager
Kind: instance method of ModelManager
Returns: Array.<AssetDeclaration> - the AssetDeclarations defined in the model manager
| Param | Type | Default | Description |
|---|---|---|---|
| includeSystemType | Boolean | true | Include the decalarations of system type in returned data |
modelManager.getTransactionDeclarations(includeSystemType) ⇒ Array.<TransactionDeclaration>
Get the TransactionDeclarations defined in this model manager
Kind: instance method of ModelManager
Returns: Array.<TransactionDeclaration> - the TransactionDeclarations defined in the model manager
| Param | Type | Default | Description |
|---|---|---|---|
| includeSystemType | Boolean | true | Include the decalarations of system type in returned data |
modelManager.getEventDeclarations(includeSystemType) ⇒ Array.<EventDeclaration>
Get the EventDeclarations defined in this model manager
Kind: instance method of ModelManager
Returns: Array.<EventDeclaration> - the EventDeclaration defined in the model manager
| Param | Type | Default | Description |
|---|---|---|---|
| includeSystemType | Boolean | true | Include the decalarations of system type in returned data |
modelManager.getParticipantDeclarations(includeSystemType) ⇒ Array.<ParticipantDeclaration>
Get the ParticipantDeclarations defined in this model manager
Kind: instance method of ModelManager
Returns: Array.<ParticipantDeclaration> - the ParticipantDeclaration defined in the model manager
| Param | Type | Default | Description |
|---|---|---|---|
| includeSystemType | Boolean | true | Include the decalarations of system type in returned data |
modelManager.getEnumDeclarations(includeSystemType) ⇒ Array.<EnumDeclaration>
Get the EnumDeclarations defined in this model manager
Kind: instance method of ModelManager
Returns: Array.<EnumDeclaration> - the EnumDeclaration defined in the model manager
| Param | Type | Default | Description |
|---|---|---|---|
| includeSystemType | Boolean | true | Include the decalarations of system type in returned data |
modelManager.getConceptDeclarations(includeSystemType) ⇒ Array.<ConceptDeclaration>
Get the Concepts defined in this model manager
Kind: instance method of ModelManager
Returns: Array.<ConceptDeclaration> - the ConceptDeclaration defined in the model manager
| Param | Type | Default | Description |
|---|---|---|---|
| includeSystemType | Boolean | true | Include the decalarations of system type in returned data |
modelManager.getFactory() ⇒ Factory
Get a factory for creating new instances of types defined in this model manager.
Kind: instance method of ModelManager
Returns: Factory - A factory for creating new instances of types defined in this model manager.
modelManager.getSerializer() ⇒ Serializer
Get a serializer for serializing instances of types defined in this model manager.
Kind: instance method of ModelManager
Returns: Serializer - A serializer for serializing instances of types defined in this model manager.
modelManager.getDecoratorFactories() ⇒ Array.<DecoratorFactory>
Get the decorator factories for this model manager.
Kind: instance method of ModelManager
Returns: Array.<DecoratorFactory> - The decorator factories for this model manager.
modelManager.addDecoratorFactory(factory)
Add a decorator factory to this model manager.
Kind: instance method of ModelManager
| Param | Type | Description |
|---|---|---|
| factory | DecoratorFactory | The decorator factory to add to this model manager. |
ModelManager.Symbol.hasInstance(object) ⇒ boolean
Alternative instanceof that is reliable across different module instances
Kind: static method of ModelManager
Returns: boolean - - True, if the object is an instance of a ModelManager
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |
concerto-core~SecurityException ⇐ BaseException
Class representing a security exception
Kind: inner class of concerto-core
Extends: BaseException
See: See BaseException
new SecurityException(message)
Create the SecurityException.
| Param | Type | Description |
|---|---|---|
| message | string | The exception message. |
concerto-core~Serializer
Serialize Resources instances to/from various formats for long-term storage (e.g. on the blockchain).
Kind: inner class of concerto-core
- ~Serializer
- new Serializer(factory, modelManager)
- instance
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
new Serializer(factory, modelManager)
Create a Serializer.
| Param | Type | Description |
|---|---|---|
| factory | Factory | The Factory to use to create instances |
| modelManager | ModelManager | The ModelManager to use for validation etc. |
serializer.setDefaultOptions(newDefaultOptions)
Set the default options for the serializer.
Kind: instance method of Serializer
| Param | Type | Description |
|---|---|---|
| newDefaultOptions | Object | The new default options for the serializer. |
serializer.toJSON(resource, [options]) ⇒ Object
Convert a [Resource](Resource) to a JavaScript object suitable for long-term peristent storage.
Kind: instance method of Serializer
Returns: Object - - The Javascript Object that represents the resource
Throws:
Error- throws an exception if resource is not an instance of Resource or fails validation.
| Param | Type | Description |
|---|---|---|
| resource | Resource | The instance to convert to JSON |
| [options] | Object | the optional serialization options. |
| [options.validate] | boolean | validate the structure of the Resource with its model prior to serialization (default to true) |
| [options.convertResourcesToRelationships] | boolean | Convert resources that are specified for relationship fields into relationships, false by default. |
| [options.permitResourcesForRelationships] | boolean | Permit resources in the place of relationships (serializing them as resources), false by default. |
| [options.deduplicateResources] | boolean | Generate $id for resources and if a resources appears multiple times in the object graph only the first instance is serialized in full, subsequent instances are replaced with a reference to the $id |
| [options.convertResourcesToId] | boolean | Convert resources that are specified for relationship fields into their id, false by default. |
serializer.fromJSON(jsonObject, options) ⇒ Resource
Create a Resource from a JavaScript Object representation. The JavaScript Object should have been created by calling the toJSON API.
The Resource is populated based on the JavaScript object.
Kind: instance method of Serializer
Returns: Resource - The new populated resource
| Param | Type | Description |
|---|---|---|
| jsonObject | Object | The JavaScript Object for a Resource |
| options | Object | the optional serialization options |
| options.acceptResourcesForRelationships | boolean | handle JSON objects in the place of strings for relationships, defaults to false. |
| options.validate | boolean | validate the structure of the Resource with its model prior to serialization (default to true) |
Serializer.Symbol.hasInstance(object) ⇒ boolean
Alternative instanceof that is reliable across different module instances
Kind: static method of Serializer
Returns: boolean - - True, if the object is an instance of a Serializer
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |
concerto-core~AssetDeclaration ⇐ ClassDeclaration
AssetDeclaration defines the schema (aka model or class) for an Asset. It extends ClassDeclaration which manages a set of fields, a super-type and the specification of an identifying field.
Kind: inner class of concerto-core
Extends: ClassDeclaration
See: See ClassDeclaration
- ~AssetDeclaration ⇐
ClassDeclaration- new AssetDeclaration(modelFile, ast)
- instance
- .isRelationshipTarget() ⇒
boolean - .getSystemType() ⇒
string
- .isRelationshipTarget() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
new AssetDeclaration(modelFile, ast)
Create an AssetDeclaration.
Throws:
IllegalModelException
| Param | Type | Description |
|---|---|---|
| modelFile | ModelFile | the ModelFile for this class |
| ast | Object | The AST created by the parser |
assetDeclaration.isRelationshipTarget() ⇒ boolean
Returns true if this class can be pointed to by a relationship
Kind: instance method of AssetDeclaration
Returns: boolean - true if the class may be pointed to by a relationship
assetDeclaration.getSystemType() ⇒ string
Returns the base system type for Assets from the system namespace
Kind: instance method of AssetDeclaration
Returns: string - the short name of the base system type
AssetDeclaration.Symbol.hasInstance(object) ⇒ boolean
Alternative instanceof that is reliable across different module instances
Kind: static method of AssetDeclaration
Returns: boolean - - True, if the object is an instance of a AssetDeclaration
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |
concerto-core~ClassDeclaration
ClassDeclaration defines the structure (model/schema) of composite data. It is composed of a set of Properties, may have an identifying field, and may have a super-type. A ClassDeclaration is conceptually owned by a ModelFile which defines all the classes that are part of a namespace.
Kind: inner abstract class of concerto-core
- ~ClassDeclaration
- new ClassDeclaration(modelFile, ast)
- instance
- ._resolveSuperType() ⇒
ClassDeclaration - .getSystemType() ⇒
string - .isAbstract() ⇒
boolean - .isEnum() ⇒
boolean - .isConcept() ⇒
boolean - .isEvent() ⇒
boolean - .isRelationshipTarget() ⇒
boolean - .isSystemRelationshipTarget() ⇒
boolean - .isSystemType() ⇒
boolean - .isSystemCoreType() ⇒
boolean - .getName() ⇒
string - .getNamespace() ⇒
String - .getFullyQualifiedName() ⇒
string - .getIdentifierFieldName() ⇒
string - .getOwnProperty(name) ⇒
Property - .getOwnProperties() ⇒
Array.<Property> - .getSuperType() ⇒
string - .getSuperTypeDeclaration() ⇒
ClassDeclaration - .getAssignableClassDeclarations() ⇒
Array.<ClassDeclaration> - .getAllSuperTypeDeclarations() ⇒
Array.<ClassDeclaration> - .getProperty(name) ⇒
Property - .getProperties() ⇒
Array.<Property> - .getNestedProperty(propertyPath) ⇒
Property - .toString() ⇒
String
- ._resolveSuperType() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
new ClassDeclaration(modelFile, ast)
Create a ClassDeclaration from an Abstract Syntax Tree. The AST is the result of parsing.
Throws:
IllegalModelException
| Param | Type | Description |
|---|---|---|
| modelFile | ModelFile | the ModelFile for this class |
| ast | string | the AST created by the parser |
classDeclaration._resolveSuperType() ⇒ ClassDeclaration
Resolve the super type on this class and store it as an internal property.
Kind: instance method of ClassDeclaration
Returns: ClassDeclaration - The super type, or null if non specified.
classDeclaration.getSystemType() ⇒ string
Returns the base system type for this type of class declaration. Override this method in derived classes to specify a base system type.
Kind: instance method of ClassDeclaration
Returns: string - the short name of the base system type or null
classDeclaration.isAbstract() ⇒ boolean
Returns true if this class is declared as abstract in the model file
Kind: instance method of ClassDeclaration
Returns: boolean - true if the class is abstract
classDeclaration.isEnum() ⇒ boolean
Returns true if this class is an enumeration.
Kind: instance method of ClassDeclaration
Returns: boolean - true if the class is an enumerated type
classDeclaration.isConcept() ⇒ boolean
Returns true if this class is the definition of a concept.
Kind: instance method of ClassDeclaration
Returns: boolean - true if the class is a concept
classDeclaration.isEvent() ⇒ boolean
Returns true if this class is the definition of an event.
Kind: instance method of ClassDeclaration
Returns: boolean - true if the class is an event
classDeclaration.isRelationshipTarget() ⇒ boolean
Returns true if this class can be pointed to by a relationship
Kind: instance method of ClassDeclaration
Returns: boolean - true if the class may be pointed to by a relationship
classDeclaration.isSystemRelationshipTarget() ⇒ boolean
Returns true if this class can be pointed to by a relationship in a system model
Kind: instance method of ClassDeclaration
Returns: boolean - true if the class may be pointed to by a relationship
classDeclaration.isSystemType() ⇒ boolean
Returns true is this type is in the system namespace
Kind: instance method of ClassDeclaration
Returns: boolean - true if the class may be pointed to by a relationship
classDeclaration.isSystemCoreType() ⇒ boolean
Returns true if this class is a system core type - both in the system namespace, and also one of the system core types (Asset, Participant, etc).
Kind: instance method of ClassDeclaration
Returns: boolean - true if the class may be pointed to by a relationship
classDeclaration.getName() ⇒ string
Returns the short name of a class. This name does not include the namespace from the owning ModelFile.
Kind: instance method of ClassDeclaration
Returns: string - the short name of this class
classDeclaration.getNamespace() ⇒ String
Return the namespace of this class.
Kind: instance method of ClassDeclaration
Returns: String - namespace - a namespace.
classDeclaration.getFullyQualifiedName() ⇒ string
Returns the fully qualified name of this class. The name will include the namespace if present.
Kind: instance method of ClassDeclaration
Returns: string - the fully-qualified name of this class
classDeclaration.getIdentifierFieldName() ⇒ string
Returns the name of the identifying field for this class. Note that the identifying field may come from a super type.
Kind: instance method of ClassDeclaration
Returns: string - the name of the id field for this class
classDeclaration.getOwnProperty(name) ⇒ Property
Returns the field with a given name or null if it does not exist. The field must be directly owned by this class -- the super-type is not introspected.
Kind: instance method of ClassDeclaration
Returns: Property - the field definition or null if it does not exist.
| Param | Type | Description |
|---|---|---|
| name | string | the name of the field |
classDeclaration.getOwnProperties() ⇒ Array.<Property>
Returns the fields directly defined by this class.
Kind: instance method of ClassDeclaration
Returns: Array.<Property> - the array of fields
classDeclaration.getSuperType() ⇒ string
Returns the FQN of the super type for this class or null if this class does not have a super type.
Kind: instance method of ClassDeclaration
Returns: string - the FQN name of the super type or null
classDeclaration.getSuperTypeDeclaration() ⇒ ClassDeclaration
Get the super type class declaration for this class.
Kind: instance method of ClassDeclaration
Returns: ClassDeclaration - the super type declaration, or null if there is no super type.
classDeclaration.getAssignableClassDeclarations() ⇒ Array.<ClassDeclaration>
Get the class declarations for all subclasses of this class, including this class.
Kind: instance method of ClassDeclaration
Returns: Array.<ClassDeclaration> - subclass declarations.
classDeclaration.getAllSuperTypeDeclarations() ⇒ Array.<ClassDeclaration>
Get all the super-type declarations for this type.
Kind: instance method of ClassDeclaration
Returns: Array.<ClassDeclaration> - super-type declarations.
classDeclaration.getProperty(name) ⇒ Property
Returns the property with a given name or null if it does not exist. Fields defined in super-types are also introspected.
Kind: instance method of ClassDeclaration
Returns: Property - the field, or null if it does not exist
| Param | Type | Description |
|---|---|---|
| name | string | the name of the field |
classDeclaration.getProperties() ⇒ Array.<Property>
Returns the properties defined in this class and all super classes.
Kind: instance method of ClassDeclaration
Returns: Array.<Property> - the array of fields
classDeclaration.getNestedProperty(propertyPath) ⇒ Property
Get a nested property using a dotted property path
Kind: instance method of ClassDeclaration
Returns: Property - the property
Throws:
IllegalModelExceptionif the property path is invalid or the property does not exist
| Param | Type | Description |
|---|---|---|
| propertyPath | string | The property name or name with nested structure e.g a.b.c |
classDeclaration.toString() ⇒ String
Returns the string representation of this class
Kind: instance method of ClassDeclaration
Returns: String - the string representation of the class
ClassDeclaration.Symbol.hasInstance(object) ⇒ boolean
Alternative instanceof that is reliable across different module instances
Kind: static method of ClassDeclaration
Returns: boolean - - True, if the object is an instance of a Class Declaration
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |
concerto-core~ConceptDeclaration ⇐ ClassDeclaration
ConceptDeclaration defines the schema (aka model or class) for an Concept. It extends ClassDeclaration which manages a set of fields, a super-type and the specification of an identifying field.
Kind: inner class of concerto-core
Extends: ClassDeclaration
See: ClassDeclaration
- ~ConceptDeclaration ⇐
ClassDeclaration- new ConceptDeclaration(modelFile, ast)
- instance
- .isConcept() ⇒
boolean
- .isConcept() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
new ConceptDeclaration(modelFile, ast)
Create an AssetDeclaration.
Throws:
IllegalModelException
| Param | Type | Description |
|---|---|---|
| modelFile | ModelFile | the ModelFile for this class |
| ast | Object | The AST created by the parser |
conceptDeclaration.isConcept() ⇒ boolean
Returns true if this class is the definition of a concept.
Kind: instance method of ConceptDeclaration
Returns: boolean - true if the class is a concept
ConceptDeclaration.Symbol.hasInstance(object) ⇒ boolean
Alternative instanceof that is reliable across different module instances
Kind: static method of ConceptDeclaration
Returns: boolean - - True, if the object is an instance of a ConceptDeclaration
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |
concerto-core~Decorator
Decorator encapsulates a decorator (annotation) on a class or property.
Kind: inner class of concerto-core
- ~Decorator
- new Decorator(parent, ast)
- .getParent() ⇒
ClassDeclaration|Property - .getName() ⇒
string - .getArguments() ⇒
Array.<object>
new Decorator(parent, ast)
Create a Decorator.
Throws:
IllegalModelException
| Param | Type | Description | |
|---|---|---|---|
| parent | ClassDeclaration \ | Property | the owner of this property |
| ast | Object | The AST created by the parser |
decorator.getParent() ⇒ ClassDeclaration | Property
Returns the owner of this property
Kind: instance method of Decorator
Returns: ClassDeclaration | Property - the parent class or property declaration
decorator.getName() ⇒ string
Returns the name of a decorator
Kind: instance method of Decorator
Returns: string - the name of this decorator
decorator.getArguments() ⇒ Array.<object>
Returns the arguments for this decorator
Kind: instance method of Decorator
Returns: Array.<object> - the arguments for this decorator or null if it does not have any arguments
concerto-core~EnumDeclaration ⇐ ClassDeclaration
EnumDeclaration defines an enumeration of static values.
Kind: inner class of concerto-core
Extends: ClassDeclaration
See: See ClassDeclaration
- ~EnumDeclaration ⇐
ClassDeclaration- new EnumDeclaration(modelFile, ast)
- instance
- .isEnum() ⇒
boolean - .toString() ⇒
String
- .isEnum() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
new EnumDeclaration(modelFile, ast)
Create an AssetDeclaration.
Throws:
IllegalModelException
| Param | Type | Description |
|---|---|---|
| modelFile | ModelFile | the ModelFile for this class |
| ast | Object | The AST created by the parser |
enumDeclaration.isEnum() ⇒ boolean
Returns true if this class is an enumeration.
Kind: instance method of EnumDeclaration
Returns: boolean - true if the class is an enumerated type
enumDeclaration.toString() ⇒ String
Returns the string representation of this class
Kind: instance method of EnumDeclaration
Returns: String - the string representation of the class
EnumDeclaration.Symbol.hasInstance(object) ⇒ boolean
Alternative instanceof that is reliable across different module instances
Kind: static method of EnumDeclaration
Returns: boolean - - True, if the object is an instance of a Class Declaration
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |
concerto-core~EnumValueDeclaration ⇐ Property
Class representing a value from a set of enumerated values
Kind: inner class of concerto-core
Extends: Property
See: See Property
- ~EnumValueDeclaration ⇐
Property
new EnumValueDeclaration(parent, ast)
Create a EnumValueDeclaration.
Throws:
IllegalModelException
| Param | Type | Description |
|---|---|---|
| parent | ClassDeclaration | The owner of this property |
| ast | Object | The AST created by the parser |
EnumValueDeclaration.Symbol.hasInstance(object) ⇒ boolean
Alternative instanceof that is reliable across different module instances
Kind: static method of EnumValueDeclaration
Returns: boolean - - True, if the object is an instance of a EnumValueDeclaration
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |
concerto-core~EventDeclaration ⇐ ClassDeclaration
Class representing the definition of an Event.
Kind: inner class of concerto-core
Extends: ClassDeclaration
See: See ClassDeclaration
- ~EventDeclaration ⇐
ClassDeclaration- new EventDeclaration(modelFile, ast)
- instance
- .getSystemType() ⇒
string - .isEvent() ⇒
boolean
- .getSystemType() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
new EventDeclaration(modelFile, ast)
Create an EventDeclaration.
Throws:
IllegalModelException
| Param | Type | Description |
|---|---|---|
| modelFile | ModelFile | the ModelFile for this class |
| ast | Object | The AST created by the parser |
eventDeclaration.getSystemType() ⇒ string
Returns the base system type for Events from the system namespace
Kind: instance method of EventDeclaration
Returns: string - the short name of the base system type
eventDeclaration.isEvent() ⇒ boolean
Returns true if this class is the definition of an event
Kind: instance method of EventDeclaration
Returns: boolean - true if the class is an event
EventDeclaration.Symbol.hasInstance(object) ⇒ boolean
Alternative instanceof that is reliable across different module instances
Kind: static method of EventDeclaration
Returns: boolean - - True, if the object is an instance of a EventDeclaration
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |
concerto-core~Introspector
Provides access to the structure of transactions, assets and participants.
Kind: inner class of concerto-core
- ~Introspector
- new Introspector(modelManager)
- .getClassDeclarations() ⇒
Array.<ClassDeclaration> - .getClassDeclaration(fullyQualifiedTypeName) ⇒
ClassDeclaration
new Introspector(modelManager)
Create the Introspector.
| Param | Type | Description |
|---|---|---|
| modelManager | ModelManager | the ModelManager that backs this Introspector |
introspector.getClassDeclarations() ⇒ Array.<ClassDeclaration>
Returns all the class declarations for the business network.
Kind: instance method of Introspector
Returns: Array.<ClassDeclaration> - the array of class declarations
introspector.getClassDeclaration(fullyQualifiedTypeName) ⇒ ClassDeclaration
Returns the class declaration with the given fully qualified name. Throws an error if the class declaration does not exist.
Kind: instance method of Introspector
Returns: ClassDeclaration - the class declaration
Throws:
Errorif the class declaration does not exist
| Param | Type | Description |
|---|---|---|
| fullyQualifiedTypeName | String | the fully qualified name of the type |
concerto-core~ModelFile
Class representing a Model File. A Model File contains a single namespace and a set of model elements: assets, transactions etc.
Kind: inner class of concerto-core
- ~ModelFile
- new ModelFile(modelManager, definitions, [fileName], [isSystemModelFile])
- instance
- .isExternal() ⇒
boolean - .getModelManager() ⇒
ModelManager - .getImports() ⇒
Array.<string> - .isDefined(type) ⇒
boolean - .getLocalType(type) ⇒
ClassDeclaration - .getAssetDeclaration(name) ⇒
AssetDeclaration - .getTransactionDeclaration(name) ⇒
TransactionDeclaration - .getEventDeclaration(name) ⇒
EventDeclaration - .getParticipantDeclaration(name) ⇒
ParticipantDeclaration - .getNamespace() ⇒
string - .getName() ⇒
string - .getAssetDeclarations(includeSystemType) ⇒
Array.<AssetDeclaration> - .getTransactionDeclarations(includeSystemType) ⇒
Array.<TransactionDeclaration> - .getEventDeclarations(includeSystemType) ⇒
Array.<EventDeclaration> - .getParticipantDeclarations(includeSystemType) ⇒
Array.<ParticipantDeclaration> - .getConceptDeclarations(includeSystemType) ⇒
Array.<ConceptDeclaration> - .getEnumDeclarations(includeSystemType) ⇒
Array.<EnumDeclaration> - .getDeclarations(type, includeSystemType) ⇒
Array.<ClassDeclaration> - .getAllDeclarations() ⇒
Array.<ClassDeclaration> - .getDefinitions() ⇒
string - .isSystemModelFile() ⇒
boolean
- .isExternal() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
new ModelFile(modelManager, definitions, [fileName], [isSystemModelFile])
Create a ModelFile. This should only be called by framework code. Use the ModelManager to manage ModelFiles.
Throws:
IllegalModelException
| Param | Type | Default | Description |
|---|---|---|---|
| modelManager | ModelManager | the ModelManager that manages this ModelFile | |
| definitions | string | The DSL model as a string. | |
| [fileName] | string | The optional filename for this modelfile | |
| [isSystemModelFile] | boolean | false | If true, this is a system model file, defaults to false |
modelFile.isExternal() ⇒ boolean
Returns true if this ModelFile was downloaded from an external URI.
Kind: instance method of ModelFile
Returns: boolean - true iff this ModelFile was downloaded from an external URI
modelFile.getModelManager() ⇒ ModelManager
Returns the ModelManager associated with this ModelFile
Kind: instance method of ModelFile
Returns: ModelManager - The ModelManager for this ModelFile
modelFile.getImports() ⇒ Array.<string>
Returns the types that have been imported into this ModelFile.
Kind: instance method of ModelFile
Returns: Array.<string> - The array of imports for this ModelFile
modelFile.isDefined(type) ⇒ boolean
Returns true if the type is defined in the model file
Kind: instance method of ModelFile
Returns: boolean - true if the type (asset or transaction) is defined
| Param | Type | Description |
|---|---|---|
| type | string | the name of the type |
modelFile.getLocalType(type) ⇒ ClassDeclaration
Returns the type with the specified name or null
Kind: instance method of ModelFile
Returns: ClassDeclaration - the ClassDeclaration, or null if the type does not exist
| Param | Type | Description |
|---|---|---|
| type | string | the short OR FQN name of the type |
modelFile.getAssetDeclaration(name) ⇒ AssetDeclaration
Get the AssetDeclarations defined in this ModelFile or null
Kind: instance method of ModelFile
Returns: AssetDeclaration - the AssetDeclaration with the given short name
| Param | Type | Description |
|---|---|---|
| name | string | the name of the type |
modelFile.getTransactionDeclaration(name) ⇒ TransactionDeclaration
Get the TransactionDeclaration defined in this ModelFile or null
Kind: instance method of ModelFile
Returns: TransactionDeclaration - the TransactionDeclaration with the given short name
| Param | Type | Description |
|---|---|---|
| name | string | the name of the type |
modelFile.getEventDeclaration(name) ⇒ EventDeclaration
Get the EventDeclaration defined in this ModelFile or null
Kind: instance method of ModelFile
Returns: EventDeclaration - the EventDeclaration with the given short name
| Param | Type | Description |
|---|---|---|
| name | string | the name of the type |
modelFile.getParticipantDeclaration(name) ⇒ ParticipantDeclaration
Get the ParticipantDeclaration defined in this ModelFile or null
Kind: instance method of ModelFile
Returns: ParticipantDeclaration - the ParticipantDeclaration with the given short name
| Param | Type | Description |
|---|---|---|
| name | string | the name of the type |
modelFile.getNamespace() ⇒ string
Get the Namespace for this model file.
Kind: instance method of ModelFile
Returns: string - The Namespace for this model file
modelFile.getName() ⇒ string
Get the filename for this model file. Note that this may be null.
Kind: instance method of ModelFile
Returns: string - The filename for this model file
modelFile.getAssetDeclarations(includeSystemType) ⇒ Array.<AssetDeclaration>
Get the AssetDeclarations defined in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<AssetDeclaration> - the AssetDeclarations defined in the model file
| Param | Type | Default | Description |
|---|---|---|---|
| includeSystemType | Boolean | true | Include the decalarations of system type in returned data |
modelFile.getTransactionDeclarations(includeSystemType) ⇒ Array.<TransactionDeclaration>
Get the TransactionDeclarations defined in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<TransactionDeclaration> - the TransactionDeclarations defined in the model file
| Param | Type | Default | Description |
|---|---|---|---|
| includeSystemType | Boolean | true | Include the decalarations of system type in returned data |
modelFile.getEventDeclarations(includeSystemType) ⇒ Array.<EventDeclaration>
Get the EventDeclarations defined in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<EventDeclaration> - the EventDeclarations defined in the model file
| Param | Type | Default | Description |
|---|---|---|---|
| includeSystemType | Boolean | true | Include the decalarations of system type in returned data |
modelFile.getParticipantDeclarations(includeSystemType) ⇒ Array.<ParticipantDeclaration>
Get the ParticipantDeclarations defined in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<ParticipantDeclaration> - the ParticipantDeclaration defined in the model file
| Param | Type | Default | Description |
|---|---|---|---|
| includeSystemType | Boolean | true | Include the decalarations of system type in returned data |
modelFile.getConceptDeclarations(includeSystemType) ⇒ Array.<ConceptDeclaration>
Get the ConceptDeclarations defined in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<ConceptDeclaration> - the ParticipantDeclaration defined in the model file
| Param | Type | Default | Description |
|---|---|---|---|
| includeSystemType | Boolean | true | Include the decalarations of system type in returned data |
modelFile.getEnumDeclarations(includeSystemType) ⇒ Array.<EnumDeclaration>
Get the EnumDeclarations defined in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<EnumDeclaration> - the EnumDeclaration defined in the model file
| Param | Type | Default | Description |
|---|---|---|---|
| includeSystemType | Boolean | true | Include the decalarations of system type in returned data |
modelFile.getDeclarations(type, includeSystemType) ⇒ Array.<ClassDeclaration>
Get the instances of a given type in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<ClassDeclaration> - the ClassDeclaration defined in the model file
| Param | Type | Default | Description |
|---|---|---|---|
| type | function | the type of the declaration | |
| includeSystemType | Boolean | true | Include the decalarations of system type in returned data |
modelFile.getAllDeclarations() ⇒ Array.<ClassDeclaration>
Get all declarations in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<ClassDeclaration> - the ClassDeclarations defined in the model file
modelFile.getDefinitions() ⇒ string
Get the definitions for this model.
Kind: instance method of ModelFile
Returns: string - The definitions for this model.
modelFile.isSystemModelFile() ⇒ boolean
Returns true if this ModelFile is a system model
Kind: instance method of ModelFile
Returns: boolean - true of this ModelFile is a system model
ModelFile.Symbol.hasInstance(object) ⇒ boolean
Alternative to instanceof that is reliable across different module instances
Kind: static method of ModelFile
Returns: boolean - - True, if the object is an instance of a ModelFile
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |
concerto-core~ParticipantDeclaration ⇐ ClassDeclaration
Class representing the definition of a Participant.
Kind: inner class of concerto-core
Extends: ClassDeclaration
See: See ClassDeclaration
- ~ParticipantDeclaration ⇐
ClassDeclaration- new ParticipantDeclaration(modelFile, ast)
- instance
- .isRelationshipTarget() ⇒
boolean - .getSystemType() ⇒
string
- .isRelationshipTarget() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
new ParticipantDeclaration(modelFile, ast)
Create an ParticipantDeclaration.
Throws:
IllegalModelException
| Param | Type | Description |
|---|---|---|
| modelFile | ModelFile | the ModelFile for this class |
| ast | Object | The AST created by the parser |
participantDeclaration.isRelationshipTarget() ⇒ boolean
Returns true if this class can be pointed to by a relationship
Kind: instance method of ParticipantDeclaration
Returns: boolean - true if the class may be pointed to by a relationship
participantDeclaration.getSystemType() ⇒ string
Returns the base system type for Participants from the system namespace
Kind: instance method of ParticipantDeclaration
Returns: string - the short name of the base system type
ParticipantDeclaration.Symbol.hasInstance(object) ⇒ boolean
Alternative instanceof that is reliable across different module instances
Kind: static method of ParticipantDeclaration
Returns: boolean - - True, if the object is an instance of a ParticipantDeclaration
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |
concerto-core~Property
Property representing an attribute of a class declaration, either a Field or a Relationship.
Kind: inner class of concerto-core
- ~Property
- new Property(parent, ast)
- instance
- .getParent() ⇒
ClassDeclaration - .getName() ⇒
string - .getType() ⇒
string - .isOptional() ⇒
boolean - .getFullyQualifiedTypeName() ⇒
string - .getFullyQualifiedName() ⇒
string - .getNamespace() ⇒
string - .isArray() ⇒
boolean - .isTypeEnum() ⇒
boolean - .isPrimitive() ⇒
boolean
- .getParent() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
new Property(parent, ast)
Create a Property.
Throws:
IllegalModelException
| Param | Type | Description |
|---|---|---|
| parent | ClassDeclaration | the owner of this property |
| ast | Object | The AST created by the parser |
property.getParent() ⇒ ClassDeclaration
Returns the owner of this property
Kind: instance method of Property
Returns: ClassDeclaration - the parent class declaration
property.getName() ⇒ string
Returns the name of a property
Kind: instance method of Property
Returns: string - the name of this field
property.getType() ⇒ string
Returns the type of a property
Kind: instance method of Property
Returns: string - the type of this field
property.isOptional() ⇒ boolean
Returns true if the field is optional
Kind: instance method of Property
Returns: boolean - true if the field is optional
property.getFullyQualifiedTypeName() ⇒ string
Returns the fully qualified type name of a property
Kind: instance method of Property
Returns: string - the fully qualified type of this property
property.getFullyQualifiedName() ⇒ string
Returns the fully name of a property (ns + class name + property name)
Kind: instance method of Property
Returns: string - the fully qualified name of this property
property.getNamespace() ⇒ string
Returns the namespace of the parent of this property
Kind: instance method of Property
Returns: string - the namespace of the parent of this property
property.isArray() ⇒ boolean
Returns true if the field is declared as an array type
Kind: instance method of Property
Returns: boolean - true if the property is an array type
property.isTypeEnum() ⇒ boolean
Returns true if the field is declared as an enumerated value
Kind: instance method of Property
Returns: boolean - true if the property is an enumerated value
property.isPrimitive() ⇒ boolean
Returns true if this property is a primitive type.
Kind: instance method of Property
Returns: boolean - true if the property is a primitive type.
Property.Symbol.hasInstance(object) ⇒ boolean
Alternative instanceof that is reliable across different module instances
Kind: static method of Property
Returns: boolean - - True, if the object is an instance of a Property
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |
concerto-core~RelationshipDeclaration ⇐ Property
Class representing a relationship between model elements
Kind: inner class of concerto-core
Extends: Property
See: See Property
- ~RelationshipDeclaration ⇐
Property- new RelationshipDeclaration(parent, ast)
- instance
- .toString() ⇒
String
- .toString() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
new RelationshipDeclaration(parent, ast)
Create a Relationship.
Throws:
IllegalModelException
| Param | Type | Description |
|---|---|---|
| parent | ClassDeclaration | The owner of this property |
| ast | Object | The AST created by the parser |
relationshipDeclaration.toString() ⇒ String
Returns a string representation of this property
Kind: instance method of RelationshipDeclaration
Returns: String - the string version of the property.
RelationshipDeclaration.Symbol.hasInstance(object) ⇒ boolean
Alternative instanceof that is reliable across different module instances
Kind: static method of RelationshipDeclaration
Returns: boolean - - True, if the object is an instance of a RelationshipDeclaration
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |
concerto-core~TransactionDeclaration ⇐ ClassDeclaration
Class representing the definition of an Transaction.
Kind: inner class of concerto-core
Extends: ClassDeclaration
See: See ClassDeclaration
- ~TransactionDeclaration ⇐
ClassDeclaration- new TransactionDeclaration(modelFile, ast)
- instance
- .getSystemType() ⇒
string
- .getSystemType() ⇒
- static
- .Symbol.hasInstance(object) ⇒
boolean
- .Symbol.hasInstance(object) ⇒
new TransactionDeclaration(modelFile, ast)
Create an TransactionDeclaration.
Throws:
IllegalModelException
| Param | Type | Description |
|---|---|---|
| modelFile | ModelFile | the ModelFile for this class |
| ast | Object | The AST created by the parser |
transactionDeclaration.getSystemType() ⇒ string
Returns the base system type for Transactions from the system namespace
Kind: instance method of TransactionDeclaration
Returns: string - the short name of the base system type
TransactionDeclaration.Symbol.hasInstance(object) ⇒ boolean
Alternative instanceof that is reliable across different module instances
Kind: static method of TransactionDeclaration
Returns: boolean - - True, if the object is an instance of a TransactionDeclaration
See: https://github.com/hyperledger/composer-concerto/issues/47
| Param | Type | Description |
|---|---|---|
| object | object | The object to test against |