Concerto API
Modules
- concerto-core
Concerto core module. Concerto is a framework for defining domain specific models.
- concerto-cto
Concerto CTO concrete syntax module. Concerto is a framework for defining domain specific models.
- concerto-metamodel
Concerto metamodel management. Concerto is a framework for defining domain specific models.
- concerto-tools
Concerto Tools module.
- concerto-util
Concerto utility module. Concerto is a framework for defining domain specific models.
- concerto-vocabulary
Concerto vocabulary module. Concerto is a framework for defining domain specific models.
Classes
- AbstractPlugin
Simple plug-in class for code-generation. This lists functions that can be passed to extend the default code-generation behavior.
- EmptyPlugin
Simple plug-in class for code-generation. This lists functions that can be passed to extend the default code-generation behavior.
Constants
- rootModelAst :
unknown
- metaModelAst :
unknown
The metamodel itself, as an AST.
- metaModelCto
The metamodel itself, as a CTO string
- levels :
Object
Default levels for the npm configuration.
- colorMap :
Object
Default levels for the npm configuration.
Functions
- setCurrentTime([currentTime], [utcOffset]) ⇒
object
Ensures there is a proper current time
- newMetaModelManager() ⇒
*
Create a metamodel manager (for validation against the metamodel)
- validateMetaModel(input) ⇒
object
Validate metamodel instance against the metamodel
- modelManagerFromMetaModel(metaModel, [validate]) ⇒
object
Import metamodel to a model manager
- randomNumberInRangeWithPrecision(userMin, userMax, precision, systemMin, systemMax) ⇒
number
Generate a random number within a given range with a prescribed precision and inside a global range
- updateModels(models, newModel) ⇒
*
Update models with a new model
- resolveExternal(models, [options], [fileDownloader]) ⇒
Promise
Downloads all ModelFiles that are external dependencies and adds or updates them in this ModelManager.
- parse(cto, [fileName]) ⇒
object
Create decorator argument string from a metamodel
- parseModels(files) ⇒
*
Parses an array of model files
- decoratorArgFromMetaModel(mm) ⇒
string
Create decorator argument string from a metamodel
- decoratorFromMetaModel(mm) ⇒
string
Create decorator string from a metamodel
- decoratorsFromMetaModel(mm, prefix) ⇒
string
Create decorators string from a metamodel
- propertyFromMetaModel(mm) ⇒
string
Create a property string from a metamodel
- declFromMetaModel(mm) ⇒
string
Create a declaration string from a metamodel
- toCTO(metaModel) ⇒
string
Create a model string from a metamodel
- findNamespace(priorModels, namespace) ⇒
*
Find the model for a given namespace
- findDeclaration(thisModel, name) ⇒
*
Find a declaration for a given name in a model
- createNameTable(priorModels, metaModel) ⇒
object
Create a name resolution table
- resolveName(name, table) ⇒
string
Resolve a name using the name table
- resolveTypeNames(metaModel, table) ⇒
object
Name resolution for metamodel
- resolveLocalNames(priorModels, metaModel) ⇒
object
Resolve the namespace for names in the metamodel
- resolveLocalNamesForAll(allModels) ⇒
object
Resolve the namespace for names in the metamodel
- inferModelFile(defaultNamespace, defaultType, schema) ⇒
string
Infers a Concerto model from a JSON Schema.
- capitalizeFirstLetter(string) ⇒
string
Capitalize the first letter of a string
- hashCode(value) ⇒
number
Computes an integer hashcode value for a string
- isObject(val) ⇒
Boolean
Returns true if val is an object
- isBoolean(val) ⇒
Boolean
Returns true if val is a boolean
- isNull(val) ⇒
Boolean
Returns true if val is null
- isArray(val) ⇒
Boolean
Returns true if val is an array
- isString(val) ⇒
Boolean
Returns true if val is a string
- isDateTime(val) ⇒
Boolean
Returns true if val is a date time
- isInteger(val) ⇒
Boolean
Returns true if val is an integer
- isDouble(val) ⇒
Boolean
Returns true if val is an integer
- getType(input) ⇒
string
Get the primitive Concerto type for an input
- handleArray(typeName, context, input) ⇒
object
Handles an array
- handleType(name, context, input) ⇒
object
Handles an input type
- removeDuplicateTypes(context)
Detect duplicate types and remove them
- inferModel(namespace, rootTypeName, input) ⇒
string
Infers a Concerto model from a JSON instance.
- labelToSentence(labelName) ⇒
string
Inserts correct spacing and capitalization to a camelCase label
- sentenceToLabel(sentence) ⇒
string
Create a camelCase label from a sentence
- writeModelsToFileSystem(files, path, options)
Writes a set of model files to disk
- camelCaseToSentence(text) ⇒
string
Converts a camel case string to a sentence
concerto-core
Concerto core module. Concerto is a framework for defining domain specific models.
- concerto-core
- static
- .AstModelManager
- .BaseModelManager
- new BaseModelManager([options], [processFile])
- .isModelManager() ⇒
boolean
- .accept(visitor, parameters) ⇒
Object
- .validateModelFile(modelFile, [fileName])
- .addModelFile(modelFile, [cto], [fileName], [disableValidation]) ⇒
Object
- .addModel(modelInput, [cto], [fileName], [disableValidation]) ⇒
Object
- .updateModelFile(modelFile, [fileName], [disableValidation]) ⇒
Object
- .deleteModelFile(namespace)
- .addModelFiles(modelFiles, [fileNames], [disableValidation]) ⇒
Array.<Object>
- .validateModelFiles()
- .updateExternalModels([options], [fileDownloader]) ⇒
Promise
- .writeModelsToFileSystem(path, [options])
- .getModels([options]) ⇒
Array.<{name:string, content:string}>
- .clearModelFiles()
- .getModelFile(namespace) ⇒
ModelFile
- .getNamespaces() ⇒
Array.<string>
- .getType(qualifiedName) ⇒
ClassDeclaration
- .getAssetDeclarations() ⇒
Array.<AssetDeclaration>
- .getTransactionDeclarations() ⇒
Array.<TransactionDeclaration>
- .getEventDeclarations() ⇒
Array.<EventDeclaration>
- .getParticipantDeclarations() ⇒
Array.<ParticipantDeclaration>
- .getEnumDeclarations() ⇒
Array.<EnumDeclaration>
- .getConceptDeclarations() ⇒
Array.<ConceptDeclaration>
- .getFactory() ⇒
Factory
- .getSerializer() ⇒
Serializer
- .getDecoratorFactories() ⇒
Array.<DecoratorFactory>
- .addDecoratorFactory(factory)
- .derivesFrom(fqt1, fqt2) ⇒
boolean
- .resolveMetaModel(metaModel) ⇒
object
- .fromAst(ast)
- .getAst([resolve]) ⇒
*
- .Concerto
- new Concerto(modelManager)
- .validate(obj, [options])
- .getModelManager() ⇒
*
- .isObject(obj) ⇒
boolean
- .getTypeDeclaration(obj) ⇒
*
- .getIdentifier(obj) ⇒
string
- .isIdentifiable(obj) ⇒
boolean
- .isRelationship(obj) ⇒
boolean
- .setIdentifier(obj, id) ⇒
*
- .getFullyQualifiedIdentifier(obj) ⇒
string
- .toURI(obj) ⇒
string
- .fromURI(uri) ⇒
*
- .getType(obj) ⇒
string
- .getNamespace(obj) ⇒
string
- .DecoratorManager
- .Factory
- new Factory(modelManager)
- instance
- .newResource(ns, type, [id], [options]) ⇒
Resource
- .newConcept(ns, type, [id], [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
- .newId() ⇒
string
- .newId() ⇒
- .AssetDeclaration ⇐
ClassDeclaration
- .ClassDeclaration
- new ClassDeclaration(modelFile, ast)
- ._resolveSuperType() ⇒
ClassDeclaration
- .validate()
- .isAbstract() ⇒
boolean
- .getName() ⇒
string
- .getNamespace() ⇒
string
- .getFullyQualifiedName() ⇒
string
- .isIdentified() ⇒
Boolean
- .isSystemIdentified() ⇒
Boolean
- .isExplicitlyIdentified() ⇒
Boolean
- .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
- .isAsset() ⇒
boolean
- .isParticipant() ⇒
boolean
- .isTransaction() ⇒
boolean
- .isEvent() ⇒
boolean
- .isConcept() ⇒
boolean
- .isEnum() ⇒
boolean
- .isClassDeclaration() ⇒
boolean
- .ConceptDeclaration ⇐
ClassDeclaration
- .Decorator
- new Decorator(parent, ast)
- .getParent() ⇒
ClassDeclaration
|Property
- .getName() ⇒
string
- .getArguments() ⇒
Array.<object>
- .DecoratorFactory
- .newDecorator(parent, ast) ⇒
Decorator
- .newDecorator(parent, ast) ⇒
- .EnumDeclaration ⇐
ClassDeclaration
- new EnumDeclaration(modelFile, ast)
- .toString() ⇒
String
- .declarationKind() ⇒
string
- .EnumValueDeclaration ⇐
Property
- .EventDeclaration ⇐
ClassDeclaration
- .IdentifiedDeclaration ⇐
ClassDeclaration
- .IllegalModelException ⇐
BaseFileException
- .Introspector
- new Introspector(modelManager)
- .getClassDeclarations() ⇒
Array.<ClassDeclaration>
- .getClassDeclaration(fullyQualifiedTypeName) ⇒
ClassDeclaration
- .ModelFile
- new ModelFile(modelManager, ast, [definitions], [fileName])
- .isModelFile() ⇒
boolean
- .isSystemModelFile() ⇒
Boolean
- .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() ⇒
Array.<AssetDeclaration>
- .getTransactionDeclarations() ⇒
Array.<TransactionDeclaration>
- .getEventDeclarations() ⇒
Array.<EventDeclaration>
- .getParticipantDeclarations() ⇒
Array.<ParticipantDeclaration>
- .getConceptDeclarations() ⇒
Array.<ConceptDeclaration>
- .getEnumDeclarations() ⇒
Array.<EnumDeclaration>
- .getDeclarations(type) ⇒
Array.<ClassDeclaration>
- .getAllDeclarations() ⇒
Array.<ClassDeclaration>
- .getDefinitions() ⇒
string
- .getAst() ⇒
object
- .getConcertoVersion() ⇒
string
- .isCompatibleVersion()
- .ParticipantDeclaration ⇐
ClassDeclaration
- .Property
- new Property(parent, ast)
- .getParent() ⇒
ClassDeclaration
- .validate(classDecl)
- .getName() ⇒
string
- .getType() ⇒
string
- .isOptional() ⇒
boolean
- .getFullyQualifiedTypeName() ⇒
string
- .getFullyQualifiedName() ⇒
string
- .getNamespace() ⇒
string
- .isArray() ⇒
boolean
- .isTypeEnum() ⇒
boolean
- .isPrimitive() ⇒
boolean
- .RelationshipDeclaration ⇐
Property
- new RelationshipDeclaration(parent, ast)
- .validate(classDecl)
- .toString() ⇒
String
- .isRelationship() ⇒
boolean
- .TransactionDeclaration ⇐
ClassDeclaration
- .Identifiable ⇐
Typed
- new Identifiable(modelManager, classDeclaration, ns, type, id, timestamp)
- .getTimestamp() ⇒
string
- .getIdentifier() ⇒
string
- .setIdentifier(id)
- .getFullyQualifiedIdentifier() ⇒
string
- .toString() ⇒
String
- .isRelationship() ⇒
boolean
- .isResource() ⇒
boolean
- .toURI() ⇒
String
- .Resource ⇐
Identifiable
- new Resource(modelManager, classDeclaration, ns, type, id, timestamp)
- .toString() ⇒
String
- .isResource() ⇒
boolean
- .isConcept() ⇒
boolean
- .isIdentifiable() ⇒
boolean
- .toJSON() ⇒
Object
- .Typed
- .ModelLoader
- .ModelManager
- .SecurityException ⇐
BaseException
- .Serializer
- .TypeNotFoundException ⇐
BaseException
- .BaseException ⇐
Error
- .BaseFileException ⇐
BaseException
- .FileDownloader
- .TypedStack
- inner
- ~version :
Object
- ~version :
- static
concerto-core.AstModelManager
Manages the Concerto model files in AST format.
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.
Kind: static class of concerto-core
new AstModelManager([options])
Create the ModelManager.
Param | Type | Description |
---|---|---|
[options] | object | Serializer options |
concerto-core.BaseModelManager
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.
Use the Concerto class to validate instances.
Kind: static class of concerto-core
- .BaseModelManager
- new BaseModelManager([options], [processFile])
- .isModelManager() ⇒
boolean
- .accept(visitor, parameters) ⇒
Object
- .validateModelFile(modelFile, [fileName])
- .addModelFile(modelFile, [cto], [fileName], [disableValidation]) ⇒
Object
- .addModel(modelInput, [cto], [fileName], [disableValidation]) ⇒
Object
- .updateModelFile(modelFile, [fileName], [disableValidation]) ⇒
Object
- .deleteModelFile(namespace)
- .addModelFiles(modelFiles, [fileNames], [disableValidation]) ⇒
Array.<Object>
- .validateModelFiles()
- .updateExternalModels([options], [fileDownloader]) ⇒
Promise
- .writeModelsToFileSystem(path, [options])
- .getModels([options]) ⇒
Array.<{name:string, content:string}>
- .clearModelFiles()
- .getModelFile(namespace) ⇒
ModelFile
- .getNamespaces() ⇒
Array.<string>
- .getType(qualifiedName) ⇒
ClassDeclaration
- .getAssetDeclarations() ⇒
Array.<AssetDeclaration>
- .getTransactionDeclarations() ⇒
Array.<TransactionDeclaration>
- .getEventDeclarations() ⇒
Array.<EventDeclaration>
- .getParticipantDeclarations() ⇒
Array.<ParticipantDeclaration>
- .getEnumDeclarations() ⇒
Array.<EnumDeclaration>
- .getConceptDeclarations() ⇒
Array.<ConceptDeclaration>
- .getFactory() ⇒
Factory
- .getSerializer() ⇒
Serializer
- .getDecoratorFactories() ⇒
Array.<DecoratorFactory>
- .addDecoratorFactory(factory)
- .derivesFrom(fqt1, fqt2) ⇒
boolean
- .resolveMetaModel(metaModel) ⇒
object
- .fromAst(ast)
- .getAst([resolve]) ⇒
*
new BaseModelManager([options], [processFile])
Create the ModelManager.
Param | Type | Description |
---|---|---|
[options] | object | Serializer options |
[processFile] | * | how to obtain a concerto AST from an input to the model manager |
boolean
baseModelManager.isModelManager() ⇒ Returns true
Kind: instance method of BaseModelManager
Returns: boolean
- true
Object
baseModelManager.accept(visitor, parameters) ⇒ Visitor design pattern
Kind: instance method of BaseModelManager
Returns: Object
- the result of visiting or null
Param | Type | Description |
---|---|---|
visitor | Object | the visitor |
parameters | Object | the parameter |
baseModelManager.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 BaseModelManager
Throws:
IllegalModelException
Param | Type | Description | |
---|---|---|---|
modelFile | string \ | ModelFile | The Concerto file as a string |
[fileName] | string | a file name to associate with the model file |
Object
baseModelManager.addModelFile(modelFile, [cto], [fileName], [disableValidation]) ⇒ Adds a Concerto file (as an AST) 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 BaseModelManager
Returns: Object
- The newly added model file (internal).
Throws:
IllegalModelException
Param | Type | Description |
---|---|---|
modelFile | ModelFile | Model as a ModelFile object |
[cto] | string | an optional cto string |
[fileName] | string | an optional file name to associate with the model file |
[disableValidation] | boolean | If true then the model files are not validated |
Object
baseModelManager.addModel(modelInput, [cto], [fileName], [disableValidation]) ⇒ Adds a model 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 addModel method can be used to add a set of files irrespective of dependencies.
Kind: instance method of BaseModelManager
Returns: Object
- The newly added model file (internal).
Throws:
IllegalModelException
Param | Type | Description |
---|---|---|
modelInput | * | Model (as a string or object) |
[cto] | string | an optional cto string |
[fileName] | string | an optional file name to associate with the model file |
[disableValidation] | boolean | If true then the model files are not validated |
Object
baseModelManager.updateModelFile(modelFile, [fileName], [disableValidation]) ⇒ 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 BaseModelManager
Returns: Object
- The newly added model file (internal).
Throws:
IllegalModelException
Param | Type | Description | |
---|---|---|---|
modelFile | string \ | ModelFile | Model as a string or object |
[fileName] | string | a file name to associate with the model file | |
[disableValidation] | boolean | If true then the model files are not validated |
baseModelManager.deleteModelFile(namespace)
Remove the Concerto file for a given namespace
Kind: instance method of BaseModelManager
Param | Type | Description |
---|---|---|
namespace | string | The namespace of the model file to delete. |
Array.<Object>
baseModelManager.addModelFiles(modelFiles, [fileNames], [disableValidation]) ⇒ Add a set of Concerto files to the model manager.
Kind: instance method of BaseModelManager
Returns: Array.<Object>
- The newly added model files (internal).
Param | Type | Description | |
---|---|---|---|
modelFiles | Array.<string> \ | Array.<ModelFile> | An array of models as strings or ModelFile objects. |
[fileNames] | Array.<string> | A array of file names to associate with the model files | |
[disableValidation] | boolean | If true then the model files are not validated |
baseModelManager.validateModelFiles()
Validates all models files in this model manager
Kind: instance method of BaseModelManager
Promise
baseModelManager.updateExternalModels([options], [fileDownloader]) ⇒ Downloads all ModelFiles that are external dependencies and adds or updates them in this ModelManager.
Kind: instance method of BaseModelManager
Returns: Promise
- a promise when the download and update operation is completed.
Throws:
IllegalModelException
if the models fail validation
Param | Type | Description |
---|---|---|
[options] | Object | Options object passed to ModelFileLoaders |
[fileDownloader] | FileDownloader | an optional FileDownloader |
baseModelManager.writeModelsToFileSystem(path, [options])
Write all models in this model manager to the specified path in the file system
Kind: instance method of BaseModelManager
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 |
Array.<{name:string, content:string}>
baseModelManager.getModels([options]) ⇒ Gets all the Concerto models
Kind: instance method of BaseModelManager
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 |
baseModelManager.clearModelFiles()
Remove all registered Concerto files
Kind: instance method of BaseModelManager
ModelFile
baseModelManager.getModelFile(namespace) ⇒ Get the ModelFile associated with a namespace
Kind: instance method of BaseModelManager
Returns: ModelFile
- registered ModelFile for the namespace or null
Param | Type | Description |
---|---|---|
namespace | string | the namespace containing the ModelFile |
Array.<string>
baseModelManager.getNamespaces() ⇒ Get the namespaces registered with the ModelManager.
Kind: instance method of BaseModelManager
Returns: Array.<string>
- namespaces - the namespaces that have been registered.
ClassDeclaration
baseModelManager.getType(qualifiedName) ⇒ Look up a type in all registered namespaces.
Kind: instance method of BaseModelManager
Returns: ClassDeclaration
- - the class declaration for the specified type.
Throws:
TypeNotFoundException
- if the type cannot be found or is a primitive type.
Param | Type | Description |
---|---|---|
qualifiedName | string | fully qualified type name. |
Array.<AssetDeclaration>
baseModelManager.getAssetDeclarations() ⇒ Get the AssetDeclarations defined in this model manager
Kind: instance method of BaseModelManager
Returns: Array.<AssetDeclaration>
- the AssetDeclarations defined in the model manager
Array.<TransactionDeclaration>
baseModelManager.getTransactionDeclarations() ⇒ Get the TransactionDeclarations defined in this model manager
Kind: instance method of BaseModelManager
Returns: Array.<TransactionDeclaration>
- the TransactionDeclarations defined in the model manager
Array.<EventDeclaration>
baseModelManager.getEventDeclarations() ⇒ Get the EventDeclarations defined in this model manager
Kind: instance method of BaseModelManager
Returns: Array.<EventDeclaration>
- the EventDeclaration defined in the model manager
Array.<ParticipantDeclaration>
baseModelManager.getParticipantDeclarations() ⇒ Get the ParticipantDeclarations defined in this model manager
Kind: instance method of BaseModelManager
Returns: Array.<ParticipantDeclaration>
- the ParticipantDeclaration defined in the model manager
Array.<EnumDeclaration>
baseModelManager.getEnumDeclarations() ⇒ Get the EnumDeclarations defined in this model manager
Kind: instance method of BaseModelManager
Returns: Array.<EnumDeclaration>
- the EnumDeclaration defined in the model manager
Array.<ConceptDeclaration>
baseModelManager.getConceptDeclarations() ⇒ Get the Concepts defined in this model manager
Kind: instance method of BaseModelManager
Returns: Array.<ConceptDeclaration>
- the ConceptDeclaration defined in the model manager
Factory
baseModelManager.getFactory() ⇒ Get a factory for creating new instances of types defined in this model manager.
Kind: instance method of BaseModelManager
Returns: Factory
- A factory for creating new instances of types defined in this model manager.
Serializer
baseModelManager.getSerializer() ⇒ Get a serializer for serializing instances of types defined in this model manager.
Kind: instance method of BaseModelManager
Returns: Serializer
- A serializer for serializing instances of types defined in this model manager.
Array.<DecoratorFactory>
baseModelManager.getDecoratorFactories() ⇒ Get the decorator factories for this model manager.
Kind: instance method of BaseModelManager
Returns: Array.<DecoratorFactory>
- The decorator factories for this model manager.
baseModelManager.addDecoratorFactory(factory)
Add a decorator factory to this model manager.
Kind: instance method of BaseModelManager
Param | Type | Description |
---|---|---|
factory | DecoratorFactory | The decorator factory to add to this model manager. |
boolean
baseModelManager.derivesFrom(fqt1, fqt2) ⇒ Checks if this fully qualified type name is derived from another.
Kind: instance method of BaseModelManager
Returns: boolean
- True if this instance is an instance of the specified fully
qualified type name, false otherwise.
Param | Type | Description |
---|---|---|
fqt1 | string | The fully qualified type name to check. |
fqt2 | string | The fully qualified type name it is may be derived from. |
object
baseModelManager.resolveMetaModel(metaModel) ⇒ Resolve the namespace for names in the metamodel
Kind: instance method of BaseModelManager
Returns: object
- the resolved metamodel
Param | Type | Description |
---|---|---|
metaModel | object | the MetaModel |
baseModelManager.fromAst(ast)
Populates the model manager from a models metamodel AST
Kind: instance method of BaseModelManager
Param | Type | Description |
---|---|---|
ast | * | the metamodel |
*
baseModelManager.getAst([resolve]) ⇒ Get the full ast (metamodel instances) for a modelmanager
Kind: instance method of BaseModelManager
Returns: *
- the metamodel
Param | Type | Description |
---|---|---|
[resolve] | boolean | whether to resolve names |
concerto-core.Concerto
Runtime API for Concerto.
Kind: static class of concerto-core
- .Concerto
- new Concerto(modelManager)
- .validate(obj, [options])
- .getModelManager() ⇒
*
- .isObject(obj) ⇒
boolean
- .getTypeDeclaration(obj) ⇒
*
- .getIdentifier(obj) ⇒
string
- .isIdentifiable(obj) ⇒
boolean
- .isRelationship(obj) ⇒
boolean
- .setIdentifier(obj, id) ⇒
*
- .getFullyQualifiedIdentifier(obj) ⇒
string
- .toURI(obj) ⇒
string
- .fromURI(uri) ⇒
*
- .getType(obj) ⇒
string
- .getNamespace(obj) ⇒
string
new Concerto(modelManager)
Create a Concerto instance.
Param | Type | Description |
---|---|---|
modelManager | * | The this.modelManager to use for validation etc. |
concerto.validate(obj, [options])
Validates the instance against its model.
Kind: instance method of Concerto
Throws:
Error
- if the instance if invalid with respect to the model
Param | Type | Description |
---|---|---|
obj | * | the input object |
[options] | * | the validation options |
*
concerto.getModelManager() ⇒ Returns the model manager
Kind: instance method of Concerto
Returns: *
- the model manager associated with this Concerto class
boolean
concerto.isObject(obj) ⇒ Returns true if the input object is a Concerto object
Kind: instance method of Concerto
Returns: boolean
- true if the object has a $class attribute
Param | Type | Description |
---|---|---|
obj | * | the input object |
*
concerto.getTypeDeclaration(obj) ⇒ Returns the ClassDeclaration for an object, or throws an exception
Kind: instance method of Concerto
Returns: *
- the ClassDeclaration for the type
Throw: Error
an error if the object does not have a $class attribute
Param | Type | Description |
---|---|---|
obj | * | the input object |
string
concerto.getIdentifier(obj) ⇒ Gets the identifier for an object
Kind: instance method of Concerto
Returns: string
- The identifier for this object
Param | Type | Description |
---|---|---|
obj | * | the input object |
boolean
concerto.isIdentifiable(obj) ⇒ Returns true if the object has an identifier
Kind: instance method of Concerto
Returns: boolean
- is the object has been defined with an identifier in the model
Param | Type | Description |
---|---|---|
obj | * | the input object |
boolean
concerto.isRelationship(obj) ⇒ Returns true if the object is a relationship. Relationships are strings of the form: 'resource:org.accordproject.Order#001' (a relationship) to the 'Order' identifiable, with the id 001.
Kind: instance method of Concerto
Returns: boolean
- true if the object is a relationship
Param | Type | Description |
---|---|---|
obj | * | the input object |
*
concerto.setIdentifier(obj, id) ⇒ Set the identifier for an object. This method does not mutate the input object, use the return object.
Kind: instance method of Concerto
Returns: *
- the input object with the identifier set
Param | Type | Description |
---|---|---|
obj | * | the input object |
id | string | the new identifier |
string
concerto.getFullyQualifiedIdentifier(obj) ⇒ Returns the fully qualified identifier for an object
Kind: instance method of Concerto
Returns: string
- the fully qualified identifier
Param | Type | Description |
---|---|---|
obj | * | the input object |
string
concerto.toURI(obj) ⇒ Returns a URI for an object
Kind: instance method of Concerto
Returns: string
- the URI for the object
Param | Type | Description |
---|---|---|
obj | * | the input object |
*
concerto.fromURI(uri) ⇒ Parses a resource URI into typeDeclaration and id components.
Kind: instance method of Concerto
Returns: *
- an object with typeDeclaration and id attributes
Throws:
Error
if the URI is invalid or the type does not exist in the model manager
Param | Type | Description |
---|---|---|
uri | string | the input URI |
string
concerto.getType(obj) ⇒ Returns the short type name
Kind: instance method of Concerto
Returns: string
- the short type name
Param | Type | Description |
---|---|---|
obj | * | the input object |
string
concerto.getNamespace(obj) ⇒ Returns the namespace for the object
Kind: instance method of Concerto
Returns: string
- the namespace
Param | Type | Description |
---|---|---|
obj | * | the input object |
concerto-core.DecoratorManager
Utility functions to work with DecoratorCommandSet
Kind: static class of concerto-core
ModelManager
DecoratorManager.decorateModels(modelManager, decoratorCommandSet) ⇒ Applies all the decorator commands from the DecoratorCommandSet to the ModelManager.
Kind: static method of DecoratorManager
Returns: ModelManager
- a new model manager with the decorations applied
Param | Type | Description |
---|---|---|
modelManager | ModelManager | the input model manager |
decoratorCommandSet | * | the DecoratorCommandSet object |
Boolean
DecoratorManager.falsyOrEqual(test, value) ⇒ Compares two values. If the first argument is falsy the function returns true.
Kind: static method of DecoratorManager
Returns: Boolean
- true if the lhs is falsy or test === value
Param | Type | Description | |
---|---|---|---|
test | string \ | null | the value to test (lhs) |
value | string | the value to compare (rhs) |
DecoratorManager.applyDecorator(decorated, type, newDecorator)
Applies a decorator to a decorated model element.
Kind: static method of DecoratorManager
Param | Type | Description |
---|---|---|
decorated | * | the type to apply the decorator to |
type | string | the command type |
newDecorator | * | the decorator to add |
DecoratorManager.executeCommand(namespace, declaration, command)
Executes a Command against a ClassDeclaration, adding decorators to the ClassDeclaration, or its properties, as required.
Kind: static method of DecoratorManager
Param | Type | Description |
---|---|---|
namespace | string | the namespace for the declaration |
declaration | * | the class declaration |
command | * | the Command object from the org.accordproject.decoratorcommands model |
concerto-core.Factory
Use the Factory to create instances of Resource: transactions, participants and assets.
Kind: static class of concerto-core
- .Factory
- new Factory(modelManager)
- instance
- .newResource(ns, type, [id], [options]) ⇒
Resource
- .newConcept(ns, type, [id], [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
- .newId() ⇒
string
- .newId() ⇒
new Factory(modelManager)
Create the factory.
Param | Type | Description |
---|---|---|
modelManager | ModelManager | The ModelManager to use for this registry |
Resource
factory.newResource(ns, type, [id], [options]) ⇒ Create a new Resource with a given namespace, type name and id
Kind: instance method of Factory
Returns: Resource
- the new instance
Throws:
TypeNotFoundException
if 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 | an optional string 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. |
Resource
factory.newConcept(ns, type, [id], [options]) ⇒ Create a new Concept with a given namespace and type name
Kind: instance method of Factory
Returns: Resource
- the new instance
Throws:
TypeNotFoundException
if 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 |
[id] | String | an optional string identifier |
[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. |
Relationship
factory.newRelationship(ns, type, id) ⇒ 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:
TypeNotFoundException
if 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 |
Resource
factory.newTransaction(ns, type, [id], [options]) ⇒ 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 string identifier |
[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. |
Resource
factory.newEvent(ns, type, [id], [options]) ⇒ 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 string identifier |
[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. |
string
Factory.newId() ⇒ Create a new ID for an object.
Kind: static method of Factory
Returns: string
- a new ID
ClassDeclaration
concerto-core.AssetDeclaration ⇐ 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: static class of concerto-core
Extends: ClassDeclaration
See: See ClassDeclaration
- .AssetDeclaration ⇐
ClassDeclaration
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 |
string
assetDeclaration.declarationKind() ⇒ Returns the kind of declaration
Kind: instance method of AssetDeclaration
Returns: string
- what kind of declaration this is
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: static abstract class of concerto-core
- .ClassDeclaration
- new ClassDeclaration(modelFile, ast)
- ._resolveSuperType() ⇒
ClassDeclaration
- .validate()
- .isAbstract() ⇒
boolean
- .getName() ⇒
string
- .getNamespace() ⇒
string
- .getFullyQualifiedName() ⇒
string
- .isIdentified() ⇒
Boolean
- .isSystemIdentified() ⇒
Boolean
- .isExplicitlyIdentified() ⇒
Boolean
- .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
- .isAsset() ⇒
boolean
- .isParticipant() ⇒
boolean
- .isTransaction() ⇒
boolean
- .isEvent() ⇒
boolean
- .isConcept() ⇒
boolean
- .isEnum() ⇒
boolean
- .isClassDeclaration() ⇒
boolean
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 | Object | the AST created by the parser |
ClassDeclaration
classDeclaration._resolveSuperType() ⇒ 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.validate()
Semantic validation of the structure of this class. Subclasses should override this method to impose additional semantic constraints on the contents/relations of fields.
Kind: instance method of ClassDeclaration
Throws:
IllegalModelException
boolean
classDeclaration.isAbstract() ⇒ 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
string
classDeclaration.getName() ⇒ 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
string
classDeclaration.getNamespace() ⇒ Return the namespace of this class.
Kind: instance method of ClassDeclaration
Returns: string
- namespace - a namespace.
string
classDeclaration.getFullyQualifiedName() ⇒ 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
Boolean
classDeclaration.isIdentified() ⇒ Returns true if this class declaration declares an identifying field (system or explicit)
Kind: instance method of ClassDeclaration
Returns: Boolean
- true if the class declaration includes an identifier
Boolean
classDeclaration.isSystemIdentified() ⇒ Returns true if this class declaration declares a system identifier $identifier
Kind: instance method of ClassDeclaration
Returns: Boolean
- true if the class declaration includes a system identifier
Boolean
classDeclaration.isExplicitlyIdentified() ⇒ Returns true if this class declaration declares an explicit identifier
Kind: instance method of ClassDeclaration
Returns: Boolean
- true if the class declaration includes an explicit identifier
string
classDeclaration.getIdentifierFieldName() ⇒ 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 or null if it does not exist
Property
classDeclaration.getOwnProperty(name) ⇒ 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 |
Array.<Property>
classDeclaration.getOwnProperties() ⇒ Returns the fields directly defined by this class.
Kind: instance method of ClassDeclaration
Returns: Array.<Property>
- the array of fields
string
classDeclaration.getSuperType() ⇒ 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
classDeclaration.getSuperTypeDeclaration() ⇒ 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.
Array.<ClassDeclaration>
classDeclaration.getAssignableClassDeclarations() ⇒ Get the class declarations for all subclasses of this class, including this class.
Kind: instance method of ClassDeclaration
Returns: Array.<ClassDeclaration>
- subclass declarations.
Array.<ClassDeclaration>
classDeclaration.getAllSuperTypeDeclarations() ⇒ Get all the super-type declarations for this type.
Kind: instance method of ClassDeclaration
Returns: Array.<ClassDeclaration>
- super-type declarations.
Property
classDeclaration.getProperty(name) ⇒ 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 |
Array.<Property>
classDeclaration.getProperties() ⇒ Returns the properties defined in this class and all super classes.
Kind: instance method of ClassDeclaration
Returns: Array.<Property>
- the array of fields
Property
classDeclaration.getNestedProperty(propertyPath) ⇒ Get a nested property using a dotted property path
Kind: instance method of ClassDeclaration
Returns: Property
- the property
Throws:
IllegalModelException
if 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 |
String
classDeclaration.toString() ⇒ Returns the string representation of this class
Kind: instance method of ClassDeclaration
Returns: String
- the string representation of the class
boolean
classDeclaration.isAsset() ⇒ Returns true if this class is the definition of an asset.
Kind: instance method of ClassDeclaration
Returns: boolean
- true if the class is an asset
boolean
classDeclaration.isParticipant() ⇒ Returns true if this class is the definition of a participant.
Kind: instance method of ClassDeclaration
Returns: boolean
- true if the class is an asset
boolean
classDeclaration.isTransaction() ⇒ Returns true if this class is the definition of a transaction.
Kind: instance method of ClassDeclaration
Returns: boolean
- true if the class is an asset
boolean
classDeclaration.isEvent() ⇒ Returns true if this class is the definition of an event.
Kind: instance method of ClassDeclaration
Returns: boolean
- true if the class is an asset
boolean
classDeclaration.isConcept() ⇒ Returns true if this class is the definition of a concept.
Kind: instance method of ClassDeclaration
Returns: boolean
- true if the class is an asset
boolean
classDeclaration.isEnum() ⇒ Returns true if this class is the definition of a enum.
Kind: instance method of ClassDeclaration
Returns: boolean
- true if the class is an asset
boolean
classDeclaration.isClassDeclaration() ⇒ Returns true if this class is the definition of a enum.
Kind: instance method of ClassDeclaration
Returns: boolean
- true if the class is an asset
ClassDeclaration
concerto-core.ConceptDeclaration ⇐ 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: static class of concerto-core
Extends: ClassDeclaration
See: ClassDeclaration
- .ConceptDeclaration ⇐
ClassDeclaration
new ConceptDeclaration(modelFile, ast)
Create a ConceptDeclaration.
Throws:
IllegalModelException
Param | Type | Description |
---|---|---|
modelFile | ModelFile | the ModelFile for this class |
ast | Object | The AST created by the parser |
string
conceptDeclaration.declarationKind() ⇒ Returns the kind of declaration
Kind: instance method of ConceptDeclaration
Returns: string
- what kind of declaration this is
concerto-core.Decorator
Decorator encapsulates a decorator (annotation) on a class or property.
Kind: static 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 |
ClassDeclaration
| Property
decorator.getParent() ⇒ Returns the owner of this property
Kind: instance method of Decorator
Returns: ClassDeclaration
| Property
- the parent class or property declaration
string
decorator.getName() ⇒ Returns the name of a decorator
Kind: instance method of Decorator
Returns: string
- the name of this decorator
Array.<object>
decorator.getArguments() ⇒ Returns the arguments for this decorator
Kind: instance method of Decorator
Returns: Array.<object>
- the arguments for this decorator
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
Decorator
decoratorFactory.newDecorator(parent, ast) ⇒ 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 |
ClassDeclaration
concerto-core.EnumDeclaration ⇐ EnumDeclaration defines an enumeration of static values.
Kind: static class of concerto-core
Extends: ClassDeclaration
See: See ClassDeclaration
- .EnumDeclaration ⇐
ClassDeclaration
- new EnumDeclaration(modelFile, ast)
- .toString() ⇒
String
- .declarationKind() ⇒
string
new EnumDeclaration(modelFile, ast)
Create an EnumDeclaration.
Throws:
IllegalModelException
Param | Type | Description |
---|---|---|
modelFile | ModelFile | the ModelFile for this class |
ast | Object | The AST created by the parser |
String
enumDeclaration.toString() ⇒ Returns the string representation of this class
Kind: instance method of EnumDeclaration
Returns: String
- the string representation of the class
string
enumDeclaration.declarationKind() ⇒ Returns the kind of declaration
Kind: instance method of EnumDeclaration
Returns: string
- what kind of declaration this is
Property
concerto-core.EnumValueDeclaration ⇐ Class representing a value from a set of enumerated values
Kind: static 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 |
boolean
enumValueDeclaration.isEnumValue() ⇒ Returns true if this class is the definition of a enum value.
Kind: instance method of EnumValueDeclaration
Returns: boolean
- true if the class is an enum value
ClassDeclaration
concerto-core.EventDeclaration ⇐ Class representing the definition of an Event.
Kind: static class of concerto-core
Extends: ClassDeclaration
See: See ClassDeclaration
- .EventDeclaration ⇐
ClassDeclaration
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 |
string
eventDeclaration.declarationKind() ⇒ Returns the kind of declaration
Kind: instance method of EventDeclaration
Returns: string
- what kind of declaration this is
ClassDeclaration
concerto-core.IdentifiedDeclaration ⇐ IdentifiedDeclaration
Kind: static abstract class of concerto-core
Extends: ClassDeclaration
See: See ClassDeclaration
new IdentifiedDeclaration(modelFile, ast)
Create an IdentifiedDeclaration.
Throws:
IllegalModelException
Param | Type | Description |
---|---|---|
modelFile | ModelFile | the ModelFile for this class |
ast | Object | The AST created by the parser |
BaseFileException
concerto-core.IllegalModelException ⇐ Exception throws when a composer file is semantically invalid
Kind: static class of concerto-core
Extends: BaseFileException
See: See BaseFileException
new IllegalModelException(message, [modelFile], [fileLocation], [component])
Create an IllegalModelException.
Param | Type | Description |
---|---|---|
message | string | the message for the exception |
[modelFile] | ModelFile | the modelfile associated with the exception |
[fileLocation] | Object | location details of the error within the model file. |
fileLocation.start.line | number | start line of the error location. |
fileLocation.start.column | number | start column of the error location. |
fileLocation.end.line | number | end line of the error location. |
fileLocation.end.column | number | end column of the error location. |
[component] | string | the component which throws this error |
concerto-core.Introspector
Provides access to the structure of transactions, assets and participants.
Kind: static 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 |
Array.<ClassDeclaration>
introspector.getClassDeclarations() ⇒ Returns all the class declarations for the business network.
Kind: instance method of Introspector
Returns: Array.<ClassDeclaration>
- the array of class declarations
ClassDeclaration
introspector.getClassDeclaration(fullyQualifiedTypeName) ⇒ 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:
Error
if 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: static class of concerto-core
- .ModelFile
- new ModelFile(modelManager, ast, [definitions], [fileName])
- .isModelFile() ⇒
boolean
- .isSystemModelFile() ⇒
Boolean
- .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() ⇒
Array.<AssetDeclaration>
- .getTransactionDeclarations() ⇒
Array.<TransactionDeclaration>
- .getEventDeclarations() ⇒
Array.<EventDeclaration>
- .getParticipantDeclarations() ⇒
Array.<ParticipantDeclaration>
- .getConceptDeclarations() ⇒
Array.<ConceptDeclaration>
- .getEnumDeclarations() ⇒
Array.<EnumDeclaration>
- .getDeclarations(type) ⇒
Array.<ClassDeclaration>
- .getAllDeclarations() ⇒
Array.<ClassDeclaration>
- .getDefinitions() ⇒
string
- .getAst() ⇒
object
- .getConcertoVersion() ⇒
string
- .isCompatibleVersion()
new ModelFile(modelManager, ast, [definitions], [fileName])
Create a ModelFile. This should only be called by framework code. Use the ModelManager to manage ModelFiles.
Throws:
IllegalModelException
Param | Type | Description |
---|---|---|
modelManager | ModelManager | the ModelManager that manages this ModelFile |
ast | object | The abstract syntax tree of the model as a JSON object. |
[definitions] | string | The optional CTO model as a string. |
[fileName] | string | The optional filename for this modelfile |
boolean
modelFile.isModelFile() ⇒ Returns true
Kind: instance method of ModelFile
Returns: boolean
- true
Boolean
modelFile.isSystemModelFile() ⇒ Returns true if the ModelFile is a system namespace
Kind: instance method of ModelFile
Returns: Boolean
- true if this is a system model file
boolean
modelFile.isExternal() ⇒ 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
ModelManager
modelFile.getModelManager() ⇒ Returns the ModelManager associated with this ModelFile
Kind: instance method of ModelFile
Returns: ModelManager
- The ModelManager for this ModelFile
Array.<string>
modelFile.getImports() ⇒ 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
boolean
modelFile.isDefined(type) ⇒ 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 |
ClassDeclaration
modelFile.getLocalType(type) ⇒ 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 |
AssetDeclaration
modelFile.getAssetDeclaration(name) ⇒ 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 |
TransactionDeclaration
modelFile.getTransactionDeclaration(name) ⇒ 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 |
EventDeclaration
modelFile.getEventDeclaration(name) ⇒ 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 |
ParticipantDeclaration
modelFile.getParticipantDeclaration(name) ⇒ 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 |
string
modelFile.getNamespace() ⇒ Get the Namespace for this model file.
Kind: instance method of ModelFile
Returns: string
- The Namespace for this model file
string
modelFile.getName() ⇒ 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
Array.<AssetDeclaration>
modelFile.getAssetDeclarations() ⇒ Get the AssetDeclarations defined in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<AssetDeclaration>
- the AssetDeclarations defined in the model file
Array.<TransactionDeclaration>
modelFile.getTransactionDeclarations() ⇒ Get the TransactionDeclarations defined in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<TransactionDeclaration>
- the TransactionDeclarations defined in the model file
Array.<EventDeclaration>
modelFile.getEventDeclarations() ⇒ Get the EventDeclarations defined in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<EventDeclaration>
- the EventDeclarations defined in the model file
Array.<ParticipantDeclaration>
modelFile.getParticipantDeclarations() ⇒ Get the ParticipantDeclarations defined in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<ParticipantDeclaration>
- the ParticipantDeclaration defined in the model file
Array.<ConceptDeclaration>
modelFile.getConceptDeclarations() ⇒ Get the ConceptDeclarations defined in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<ConceptDeclaration>
- the ParticipantDeclaration defined in the model file
Array.<EnumDeclaration>
modelFile.getEnumDeclarations() ⇒ Get the EnumDeclarations defined in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<EnumDeclaration>
- the EnumDeclaration defined in the model file
Array.<ClassDeclaration>
modelFile.getDeclarations(type) ⇒ 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 | Description |
---|---|---|
type | function | the type of the declaration |
Array.<ClassDeclaration>
modelFile.getAllDeclarations() ⇒ Get all declarations in this ModelFile
Kind: instance method of ModelFile
Returns: Array.<ClassDeclaration>
- the ClassDeclarations defined in the model file
string
modelFile.getDefinitions() ⇒ Get the definitions for this model.
Kind: instance method of ModelFile
Returns: string
- The definitions for this model.
object
modelFile.getAst() ⇒ Get the ast for this model.
Kind: instance method of ModelFile
Returns: object
- The definitions for this model.
string
modelFile.getConcertoVersion() ⇒ Get the expected concerto version
Kind: instance method of ModelFile
Returns: string
- The semver range for compatible concerto versions
modelFile.isCompatibleVersion()
Check whether this modelfile is compatible with the concerto version
Kind: instance method of ModelFile
ClassDeclaration
concerto-core.ParticipantDeclaration ⇐ Class representing the definition of a Participant.
Kind: static class of concerto-core
Extends: ClassDeclaration
See: See ClassDeclaration
- .ParticipantDeclaration ⇐
ClassDeclaration
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 |
string
participantDeclaration.declarationKind() ⇒ Returns the kind of declaration
Kind: instance method of ParticipantDeclaration
Returns: string
- what kind of declaration this is
concerto-core.Property
Property representing an attribute of a class declaration, either a Field or a Relationship.
Kind: static class of concerto-core
- .Property
- new Property(parent, ast)
- .getParent() ⇒
ClassDeclaration
- .validate(classDecl)
- .getName() ⇒
string
- .getType() ⇒
string
- .isOptional() ⇒
boolean
- .getFullyQualifiedTypeName() ⇒
string
- .getFullyQualifiedName() ⇒
string
- .getNamespace() ⇒
string
- .isArray() ⇒
boolean
- .isTypeEnum() ⇒
boolean
- .isPrimitive() ⇒
boolean
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 |
ClassDeclaration
property.getParent() ⇒ Returns the owner of this property
Kind: instance method of Property
Returns: ClassDeclaration
- the parent class declaration
property.validate(classDecl)
Validate the property
Kind: instance method of Property
Throws:
IllegalModelException
Access: protected
Param | Type | Description |
---|---|---|
classDecl | ClassDeclaration | the class declaration of the property |
string
property.getName() ⇒ Returns the name of a property
Kind: instance method of Property
Returns: string
- the name of this field
string
property.getType() ⇒ Returns the type of a property
Kind: instance method of Property
Returns: string
- the type of this field
boolean
property.isOptional() ⇒ Returns true if the field is optional
Kind: instance method of Property
Returns: boolean
- true if the field is optional
string
property.getFullyQualifiedTypeName() ⇒ Returns the fully qualified type name of a property
Kind: instance method of Property
Returns: string
- the fully qualified type of this property
string
property.getFullyQualifiedName() ⇒ 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
string
property.getNamespace() ⇒ Returns the namespace of the parent of this property
Kind: instance method of Property
Returns: string
- the namespace of the parent of this property
boolean
property.isArray() ⇒ 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
boolean
property.isTypeEnum() ⇒ 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
boolean
property.isPrimitive() ⇒ 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
concerto-core.RelationshipDeclaration ⇐ Class representing a relationship between model elements
Kind: static class of concerto-core
Extends: Property
See: See Property
- .RelationshipDeclaration ⇐
Property
- new RelationshipDeclaration(parent, ast)
- .validate(classDecl)
- .toString() ⇒
String
- .isRelationship() ⇒
boolean
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.validate(classDecl)
Validate the property
Kind: instance method of RelationshipDeclaration
Throws:
IllegalModelException
Access: protected
Param | Type | Description |
---|---|---|
classDecl | ClassDeclaration | the class declaration of the property |
String
relationshipDeclaration.toString() ⇒ Returns a string representation of this property
Kind: instance method of RelationshipDeclaration
Returns: String
- the string version of the property.
boolean
relationshipDeclaration.isRelationship() ⇒ Returns true if this class is the definition of a relationship.
Kind: instance method of RelationshipDeclaration
Returns: boolean
- true if the class is a relationship
ClassDeclaration
concerto-core.TransactionDeclaration ⇐ Class representing the definition of an Transaction.
Kind: static class of concerto-core
Extends: ClassDeclaration
See: See ClassDeclaration
- .TransactionDeclaration ⇐
ClassDeclaration
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 |
string
transactionDeclaration.declarationKind() ⇒ Returns the kind of declaration
Kind: instance method of TransactionDeclaration
Returns: string
- what kind of declaration this is
Typed
concerto-core.Identifiable ⇐ Identifiable is an entity with a namespace, type and an identifier. Applications should retrieve instances from Factory This class is abstract.
Kind: static abstract class of concerto-core
Extends: Typed
Access: protected
- .Identifiable ⇐
Typed
- new Identifiable(modelManager, classDeclaration, ns, type, id, timestamp)
- .getTimestamp() ⇒
string
- .getIdentifier() ⇒
string
- .setIdentifier(id)
- .getFullyQualifiedIdentifier() ⇒
string
- .toString() ⇒
String
- .isRelationship() ⇒
boolean
- .isResource() ⇒
boolean
- .toURI() ⇒
String
new Identifiable(modelManager, classDeclaration, ns, type, id, timestamp)
Create an instance.
Note: Only to be called by framework code. Applications should retrieve instances from [Factory](Factory)
Param | Type | Description |
---|---|---|
modelManager | ModelManager | The ModelManager for this instance |
classDeclaration | ClassDeclaration | The class declaration for this instance. |
ns | string | The namespace this instance. |
type | string | The type this instance. |
id | string | The identifier of this instance. |
timestamp | string | The timestamp of this instance |
string
identifiable.getTimestamp() ⇒ Get the timestamp of this instance
Kind: instance method of Identifiable
Returns: string
- The timestamp for this object
string
identifiable.getIdentifier() ⇒ Get the identifier of this instance
Kind: instance method of Identifiable
Returns: string
- The identifier for this object
identifiable.setIdentifier(id)
Set the identifier of this instance
Kind: instance method of Identifiable
Param | Type | Description |
---|---|---|
id | string | the new identifier for this object |
string
identifiable.getFullyQualifiedIdentifier() ⇒ Get the fully qualified identifier of this instance. (namespace '.' type '#' identifier).
Kind: instance method of Identifiable
Returns: string
- the fully qualified identifier of this instance
String
identifiable.toString() ⇒ Returns the string representation of this class
Kind: instance method of Identifiable
Returns: String
- the string representation of the class
boolean
identifiable.isRelationship() ⇒ Determine if this identifiable is a relationship.
Kind: instance method of Identifiable
Returns: boolean
- True if this identifiable is a relationship,
false if not.
boolean
identifiable.isResource() ⇒ Determine if this identifiable is a resource.
Kind: instance method of Identifiable
Returns: boolean
- True if this identifiable is a resource,
false if not.
String
identifiable.toURI() ⇒ Returns a URI representation of a reference to this identifiable
Kind: instance method of Identifiable
Returns: String
- the URI for the identifiable
Identifiable
concerto-core.Resource ⇐ Resource is an instance that has a type. The type of the resource specifies a set of properites (which themselves have types).
Type information in Concerto is used to validate the structure of Resource instances and for serialization.
Resources are used in Concerto to represent Assets, Participants, Transactions and other domain classes that can be serialized for long-term persistent storage.
Kind: static class of concerto-core
Extends: Identifiable
Access: public
See: See Resource
- .Resource ⇐
Identifiable
- new Resource(modelManager, classDeclaration, ns, type, id, timestamp)
- .toString() ⇒
String
- .isResource() ⇒
boolean
- .isConcept() ⇒
boolean
- .isIdentifiable() ⇒
boolean
- .toJSON() ⇒
Object
new Resource(modelManager, classDeclaration, ns, type, id, timestamp)
This constructor should not be called directly.
Note: Only to be called by framework code. Applications should retrieve instances from [Factory](Factory)
Param | Type | Description |
---|---|---|
modelManager | ModelManager | The ModelManager for this instance |
classDeclaration | ClassDeclaration | The class declaration for this instance. |
ns | string | The namespace this instance. |
type | string | The type this instance. |
id | string | The identifier of this instance. |
timestamp | string | The timestamp of this instance |
String
resource.toString() ⇒ Returns the string representation of this class
Kind: instance method of Resource
Returns: String
- the string representation of the class
boolean
resource.isResource() ⇒ Determine if this identifiable is a resource.
Kind: instance method of Resource
Returns: boolean
- True if this identifiable is a resource,
false if not.
boolean
resource.isConcept() ⇒ Determine if this identifiable is a concept.
Kind: instance method of Resource
Returns: boolean
- True if this identifiable is a concept,
false if not.
boolean
resource.isIdentifiable() ⇒ Determine if this object is identifiable.
Kind: instance method of Resource
Returns: boolean
- True if this object has an identifiying field
false if not.
Object
resource.toJSON() ⇒ Serialize this resource into a JavaScript object suitable for serialization to JSON, using the default options for the serializer. If you need to set additional options for the serializer, use the Serializer#toJSON method instead.
Kind: instance method of Resource
Returns: Object
- A JavaScript object suitable for serialization to JSON.
concerto-core.Typed
Object is an instance with a namespace and a type.
This class is abstract.
Kind: static abstract class of concerto-core
Access: protected
new Typed(modelManager, classDeclaration, ns, type)
Create an instance.
Note: Only to be called by framework code. Applications should retrieve instances from [Factory](Factory)
Param | Type | Description |
---|---|---|
modelManager | ModelManager | The ModelManager for this instance |
classDeclaration | ClassDeclaration | The class declaration for this instance. |
ns | string | The namespace this instance. |
type | string | The type this instance. |
string
typed.getType() ⇒ Get the type of the instance (a short name, not including namespace).
Kind: instance method of Typed
Returns: string
- The type of this object
string
typed.getFullyQualifiedType() ⇒ Get the fully-qualified type name of the instance (including namespace).
Kind: instance method of Typed
Returns: string
- The fully-qualified type name of this object
string
typed.getNamespace() ⇒ Get the namespace of the instance.
Kind: instance method of Typed
Returns: string
- The namespace of this object
typed.setPropertyValue(propName, value)
Sets a property on this Resource
Kind: instance method of Typed
Param | Type | Description |
---|---|---|
propName | string | the name of the field |
value | string | the value of the property |
typed.addArrayValue(propName, value)
Adds a value to an array property on this Resource
Kind: instance method of Typed
Param | Type | Description |
---|---|---|
propName | string | the name of the field |
value | string | the value of the property |
boolean
typed.instanceOf(fqt) ⇒ Check to see if this instance is an instance of the specified fully qualified type name.
Kind: instance method of Typed
Returns: boolean
- True if this instance is an instance of the specified fully
qualified type name, false otherwise.
Param | Type | Description |
---|---|---|
fqt | String | The fully qualified type name. |
typed.toJSON()
Overriden to prevent people accidentally converting a resource to JSON without using the Serializer.
Kind: instance method of Typed
Access: protected
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
object
ModelLoader.loadModelManager(ctoFiles, options) ⇒ Load models in a new model manager
Kind: static method of ModelLoader
Returns: object
- the model manager
Param | Type | Description |
---|---|---|
ctoFiles | Array.<string> | the CTO files (can be local file paths or URLs) |
options | object | optional parameters |
[options.offline] | boolean | do not resolve external models |
[options.utcOffset] | number | UTC Offset for this execution |
object
ModelLoader.loadModelManagerFromModelFiles(modelFiles, [fileNames], options) ⇒ 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 |
---|---|---|
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 |
options | object | optional parameters |
[options.offline] | boolean | do not resolve external models |
[options.utcOffset] | number | UTC Offset for this execution |
concerto-core.ModelManager
Manages the Concerto model files in CTO format.
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.
Kind: static class of concerto-core
new ModelManager([options])
Create the ModelManager.
Param | Type | Description |
---|---|---|
[options] | object | Serializer options |
Object
modelManager.addCTOModel(cto, [fileName], [disableValidation]) ⇒ Adds a model in CTO format to the ModelManager.
This is a convenience function equivalent to addModel
but useful since it avoids having to copy the input CTO.
Kind: instance method of ModelManager
Returns: Object
- The newly added model file (internal).
Throws:
IllegalModelException
Param | Type | Description |
---|---|---|
cto | string | a cto string |
[fileName] | string | an optional file name to associate with the model file |
[disableValidation] | boolean | If true then the model files are not validated |
BaseException
concerto-core.SecurityException ⇐ Class representing a security exception
Kind: static 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: static class of concerto-core
new Serializer(factory, modelManager, [options])
Create a Serializer.
Param | Type | Description |
---|---|---|
factory | Factory | The Factory to use to create instances |
modelManager | ModelManager | The ModelManager to use for validation etc. |
[options] | object | Serializer options |
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. |
Object
serializer.toJSON(resource, [options]) ⇒ 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. |
[options.utcOffset] | number | UTC Offset for DateTime values. |
Resource
serializer.fromJSON(jsonObject, [options]) ⇒ 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) |
[options.utcOffset] | number | UTC Offset for DateTime values. |
BaseException
concerto-core.TypeNotFoundException ⇐ Error thrown when a Concerto type does not exist.
Kind: static class of concerto-core
Extends: BaseException
See: see BaseException
- .TypeNotFoundException ⇐
BaseException
new TypeNotFoundException(typeName, message, component)
Constructor. If the optional 'message' argument is not supplied, it will be set to a default value that includes the type name.
Param | Type | Description | |
---|---|---|---|
typeName | string | fully qualified type name. | |
message | string \ | undefined | error message. |
component | string | the optional component which throws this error |
string
typeNotFoundException.getTypeName() ⇒ Get the name of the type that was not found.
Kind: instance method of TypeNotFoundException
Returns: string
- fully qualified type name.
Error
concerto-core.BaseException ⇐ A base class for all Concerto exceptions
Kind: static 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. |
BaseException
concerto-core.BaseFileException ⇐ Exception throws when a Concerto file is semantically invalid
Kind: static 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 file name |
[component] | string | the component which throws this error |
string
baseFileException.getFileLocation() ⇒ Returns the file location associated with the exception or null
Kind: instance method of BaseFileException
Returns: string
- the optional location associated with the exception
string
baseFileException.getShortMessage() ⇒ Returns the error message without the location of the error
Kind: instance method of BaseFileException
Returns: string
- the error message
string
baseFileException.getFileName() ⇒ Returns the fileName for the error
Kind: instance method of BaseFileException
Returns: string
- the file name or null
concerto-core.FileDownloader
Downloads the transitive closure of a set of model files.
Kind: static class of concerto-core
new FileDownloader(fileLoader, getExternalImports, concurrency)
Create a FileDownloader and bind to a FileLoader.
Param | Type | Default | Description |
---|---|---|---|
fileLoader | * | the loader to use to download model files | |
getExternalImports | * | a function taking a file and returning new files | |
concurrency | Number | 10 | the number of model files to download concurrently |
Promise
fileDownloader.downloadExternalDependencies(files, [options]) ⇒ Download all external dependencies for an array of model files
Kind: instance method of FileDownloader
Returns: Promise
- a promise that resolves to Files[] for the external model files
Param | Type | Description |
---|---|---|
files | Array.<File> | the model files |
[options] | Object | Options object passed to FileLoaders |
Promise
fileDownloader.runJob(job, fileLoader) ⇒ Execute a Job
Kind: instance method of FileDownloader
Returns: Promise
- a promise to the job results
Param | Type | Description |
---|---|---|
job | Object | the job to execute |
fileLoader | Object | the loader to use to download model files. |
concerto-core.TypedStack
Tracks a stack of typed instances. The type information is used to detect overflow / underflow bugs by the caller. It also performs basic sanity checking on push/pop to make detecting bugs easier.
Kind: static class of concerto-core
new TypedStack(resource)
Create the Stack with the resource at the head.
Param | Type | Description |
---|---|---|
resource | Object | the resource to be put at the head of the stack |
typedStack.push(obj, expectedType)
Push a new object.
Kind: instance method of TypedStack
Param | Type | Description |
---|---|---|
obj | Object | the object being visited |
expectedType | Object | the expected type of the object being pushed |
Object
typedStack.pop(expectedType) ⇒ Push a new object.
Kind: instance method of TypedStack
Returns: Object
- the result of pop
Param | Type | Description |
---|---|---|
expectedType | Object | the type that should be the result of pop |
Object
typedStack.peek(expectedType) ⇒ Peek the top of the stack
Kind: instance method of TypedStack
Returns: Object
- the result of peek
Param | Type | Description |
---|---|---|
expectedType | Object | the type that should be the result of pop |
typedStack.clear()
Clears the stack
Kind: instance method of TypedStack
Object
concerto-core~version : Kind: inner constant of concerto-core
concerto-cto
Concerto CTO concrete syntax module. Concerto is a framework for defining domain specific models.
concerto-metamodel
Concerto metamodel management. Concerto is a framework for defining domain specific models.
concerto-tools
Concerto Tools module.
concerto-util
Concerto utility module. Concerto is a framework for defining domain specific models.
concerto-vocabulary
Concerto vocabulary module. Concerto is a framework for defining domain specific models.
- concerto-vocabulary
- .Vocabulary
- new Vocabulary(vocabularyManager, voc)
- .getNamespace() ⇒
string
- .getLocale() ⇒
string
- .getIdentifier() ⇒
string
- .getTerms() ⇒
Array
- .getTerm(declarationName, [propertyName]) ⇒
string
- .validate(modelFile) ⇒
*
- .toJSON() ⇒
*
- .VocabularyManager
- new VocabularyManager([options])
- instance
- .clear()
- .removeVocabulary(namespace, locale)
- .addVocabulary(contents) ⇒
Vocabulary
- .getVocabulary(namespace, locale, [options]) ⇒
Vocabulary
- .getVocabulariesForNamespace(namespace) ⇒
Array.<Vocabulary>
- .getVocabulariesForLocale(locale) ⇒
Array.<Vocabulary>
- .resolveTerm(modelManager, namespace, locale, declarationName, [propertyName]) ⇒
string
- .getTerm(namespace, locale, declarationName, [propertyName]) ⇒
string
- .generateDecoratorCommands(modelManager, locale) ⇒
*
- .validate(modelManager, locale) ⇒
*
- static
- .Vocabulary
concerto-vocabulary.Vocabulary
A vocabulary for a concerto model
Kind: static class of concerto-vocabulary
- .Vocabulary
- new Vocabulary(vocabularyManager, voc)
- .getNamespace() ⇒
string
- .getLocale() ⇒
string
- .getIdentifier() ⇒
string
- .getTerms() ⇒
Array
- .getTerm(declarationName, [propertyName]) ⇒
string
- .validate(modelFile) ⇒
*
- .toJSON() ⇒
*
new Vocabulary(vocabularyManager, voc)
Create the Vocabulary
Param | Type | Description |
---|---|---|
vocabularyManager | VocabularyManager | the manager for this vocabulary |
voc | object | the JSON representation of the vocabulary |
string
vocabulary.getNamespace() ⇒ Returns the namespace for the vocabulary
Kind: instance method of Vocabulary
Returns: string
- the namespace for this vocabulary
string
vocabulary.getLocale() ⇒ Returns the locale for the vocabulary
Kind: instance method of Vocabulary
Returns: string
- the locale for this vocabulary
string
vocabulary.getIdentifier() ⇒ Returns the identifier for the vocabulary, composed of the namespace plus the locale
Kind: instance method of Vocabulary
Returns: string
- the identifier for this vocabulary
Array
vocabulary.getTerms() ⇒ Returns all the declarations for this vocabulary
Kind: instance method of Vocabulary
Returns: Array
- an array of objects
string
vocabulary.getTerm(declarationName, [propertyName]) ⇒ Gets the term for a concept, enum or property
Kind: instance method of Vocabulary
Returns: string
- the term or null if it does not exist
Param | Type | Description |
---|---|---|
declarationName | string | the name of a concept or enum |
[propertyName] | string | the name of a property (optional) |
*
vocabulary.validate(modelFile) ⇒ Validates a vocabulary against a ModelFile, returning errors for missing and additional terms.
Kind: instance method of Vocabulary
Returns: *
- an object with missingTerms and additionalTerms properties
Param | Type | Description |
---|---|---|
modelFile | ModelFile | the model file for this vocabulary |
*
vocabulary.toJSON() ⇒ Converts the object to JSON
Kind: instance method of Vocabulary
Returns: *
- the contens of this vocabulary
concerto-vocabulary.VocabularyManager
A vocabulary manager for concerto models. The vocabulary manager stores and provides API access to a set of vocabulary files, where each file is associated with a BCP-47 language tag and a Concerto namespace.
Kind: static class of concerto-vocabulary
See: https://datatracker.ietf.org/doc/html/rfc5646#section-2
- .VocabularyManager
- new VocabularyManager([options])
- instance
- .clear()
- .removeVocabulary(namespace, locale)
- .addVocabulary(contents) ⇒
Vocabulary
- .getVocabulary(namespace, locale, [options]) ⇒
Vocabulary
- .getVocabulariesForNamespace(namespace) ⇒
Array.<Vocabulary>
- .getVocabulariesForLocale(locale) ⇒
Array.<Vocabulary>
- .resolveTerm(modelManager, namespace, locale, declarationName, [propertyName]) ⇒
string
- .getTerm(namespace, locale, declarationName, [propertyName]) ⇒
string
- .generateDecoratorCommands(modelManager, locale) ⇒
*
- .validate(modelManager, locale) ⇒
*
- static
new VocabularyManager([options])
Create the VocabularyManager
Param | Type | Description |
---|---|---|
[options] | * | options to configure vocabulary lookup |
[options.missingTermGenerator] | * | A function to call for missing terms. The function should accept namespace, locale, declarationName, propertyName as arguments |
vocabularyManager.clear()
Removes all vocabularies
Kind: instance method of VocabularyManager
vocabularyManager.removeVocabulary(namespace, locale)
Removes a vocabulary from the vocabulary manager
Kind: instance method of VocabularyManager
Param | Type | Description |
---|---|---|
namespace | string | the namespace for the vocabulary |
locale | string | the BCP-47 locale identifier |
Vocabulary
vocabularyManager.addVocabulary(contents) ⇒ Adds a vocabulary to the vocabulary manager
Kind: instance method of VocabularyManager
Returns: Vocabulary
- the vocabulary the was added
Param | Type | Description |
---|---|---|
contents | string | the YAML string for the vocabulary |
Vocabulary
vocabularyManager.getVocabulary(namespace, locale, [options]) ⇒ Gets a vocabulary for a given namespace plus locale
Kind: instance method of VocabularyManager
Returns: Vocabulary
- the vocabulary or null if no vocabulary exists for the locale
Param | Type | Description |
---|---|---|
namespace | string | the namespace for the vocabulary |
locale | string | the BCP-47 locale identifier |
[options] | * | options to configure vocabulary lookup |
[options.localeMatcher] | * | Pass 'lookup' to find a general vocabulary, if available |
Array.<Vocabulary>
vocabularyManager.getVocabulariesForNamespace(namespace) ⇒ Gets all the vocabulary files for a given namespace
Kind: instance method of VocabularyManager
Returns: Array.<Vocabulary>
- the array of vocabularies
Param | Type | Description |
---|---|---|
namespace | string | the namespace |
Array.<Vocabulary>
vocabularyManager.getVocabulariesForLocale(locale) ⇒ Gets all the vocabulary files for a given locale
Kind: instance method of VocabularyManager
Returns: Array.<Vocabulary>
- the array of vocabularies
Param | Type | Description |
---|---|---|
locale | string | the BCP-47 locale identifier |
string
vocabularyManager.resolveTerm(modelManager, namespace, locale, declarationName, [propertyName]) ⇒ Resolve the term for a property, looking up terms from a more general vocabulary if required, and resolving properties using an object manager, allowing terms defined on super types to be automatically resolved.
Kind: instance method of VocabularyManager
Returns: string
- the term or null if it does not exist
Param | Type | Description |
---|---|---|
modelManager | ModelManager | the model manager |
namespace | string | the namespace |
locale | string | the BCP-47 locale identifier |
declarationName | string | the name of a concept or enum |
[propertyName] | string | the name of a property (optional) |
string
vocabularyManager.getTerm(namespace, locale, declarationName, [propertyName]) ⇒ Gets the term for a concept, enum or property, looking up terms from a more general vocabulary if required
Kind: instance method of VocabularyManager
Returns: string
- the term or null if it does not exist
Param | Type | Description |
---|---|---|
namespace | string | the namespace |
locale | string | the BCP-47 locale identifier |
declarationName | string | the name of a concept or enum |
[propertyName] | string | the name of a property (optional) |
*
vocabularyManager.generateDecoratorCommands(modelManager, locale) ⇒ Creates a DecoractorCommandSet with @Term decorators to decorate all model elements based on the vocabulary for a locale. Pass the return value to the DecoratorManager.decorateModel to apply the decorators to a ModelManager.
Kind: instance method of VocabularyManager
Returns: *
- the decorator command set used to decorate the model.
Param | Type | Description |
---|---|---|
modelManager | ModelManager | the Model Manager |
locale | string | the BCP-47 locale identifier |
*
vocabularyManager.validate(modelManager, locale) ⇒ Validates the terms in the vocabulary against the namespaces and declarations within a ModelManager
Kind: instance method of VocabularyManager
Returns: *
- the result of validation
Param | Type | Description |
---|---|---|
modelManager | ModelManager | the Model Manager |
locale | string | the BCP-47 locale identifier |
string
VocabularyManager.englishMissingTermGenerator(namespace, locale, declarationName, [propertyName]) ⇒ Computes a term in English based on declaration and property name.
Kind: static method of VocabularyManager
Returns: string
- the term or null if it does not exist
Param | Type | Description |
---|---|---|
namespace | string | the namespace |
locale | string | the BCP-47 locale identifier |
declarationName | string | the name of a concept or enum |
[propertyName] | string | the name of a property (optional) |
Vocabulary
VocabularyManager.findVocabulary(requestedLocale, vocabularies, [options]) ⇒ Finds the vocabulary for a requested locale, removing language identifiers from the locale until the locale matches, or if no vocabulary is found, null is returned
Kind: static method of VocabularyManager
Returns: Vocabulary
- the most specific vocabulary, or null
Param | Type | Description |
---|---|---|
requestedLocale | string | the BCP-47 locale identifier |
vocabularies | Array.<Vocabulary> | the vocabularies to match against |
[options] | * | options to configure vocabulary lookup |
[options.localeMatcher] | * | Pass 'lookup' to find a general vocabulary, if available |
AbstractPlugin
Simple plug-in class for code-generation. This lists functions that can be passed to extend the default code-generation behavior.
Kind: global class
abstractPlugin.addClassImports(clazz, parameters, options)
Additional imports to generate in classes
Kind: instance method of AbstractPlugin
Param | Type | Description |
---|---|---|
clazz | ClassDeclaration | the clazz being visited |
parameters | Object | the parameter |
options | Object | the visitor options |
abstractPlugin.addClassAnnotations(clazz, parameters, options)
Additional annotations to generate in classes
Kind: instance method of AbstractPlugin
Param | Type | Description |
---|---|---|
clazz | ClassDeclaration | the clazz being visited |
parameters | Object | the parameter |
options | Object | the visitor options |
abstractPlugin.addClassMethods(clazz, parameters, options)
Additional methods to generate in classes
Kind: instance method of AbstractPlugin
Param | Type | Description |
---|---|---|
clazz | ClassDeclaration | the clazz being visited |
parameters | Object | the parameter |
options | Object | the visitor options |
abstractPlugin.addEnumAnnotations(enumDecl, parameters, options)
Additional annotations to generate in enums
Kind: instance method of AbstractPlugin
Param | Type | Description |
---|---|---|
enumDecl | EnumDeclaration | the enum being visited |
parameters | Object | the parameter |
options | Object | the visitor options |
EmptyPlugin
Simple plug-in class for code-generation. This lists functions that can be passed to extend the default code-generation behavior.
Kind: global class
emptyPlugin.addClassImports(clazz, parameters)
Additional imports to generate in classes
Kind: instance method of EmptyPlugin
Param | Type | Description |
---|---|---|
clazz | ClassDeclaration | the clazz being visited |
parameters | Object | the parameter |
emptyPlugin.addClassAnnotations(clazz, parameters)
Additional annotations to generate in classes
Kind: instance method of EmptyPlugin
Param | Type | Description |
---|---|---|
clazz | ClassDeclaration | the clazz being visited |
parameters | Object | the parameter |
emptyPlugin.addClassMethods(clazz, parameters)
Additional methods to generate in classes
Kind: instance method of EmptyPlugin
Param | Type | Description |
---|---|---|
clazz | ClassDeclaration | the clazz being visited |
parameters | Object | the parameter |
emptyPlugin.addEnumAnnotations(enumDecl, parameters)
Additional annotations to generate in enums
Kind: instance method of EmptyPlugin
Param | Type | Description |
---|---|---|
enumDecl | EnumDeclaration | the enum being visited |
parameters | Object | the parameter |
unknown
rootModelAst :
unknown
metaModelAst : The metamodel itself, as an AST.
metaModelCto
The metamodel itself, as a CTO string
Object
levels : Default levels for the npm configuration.
Object
colorMap : Default levels for the npm configuration.
object
setCurrentTime([currentTime], [utcOffset]) ⇒ Ensures there is a proper current time
Kind: global function
Returns: object
- if valid, the dayjs object for the current time
Param | Type | Description |
---|---|---|
[currentTime] | string | the definition of 'now' |
[utcOffset] | number | UTC Offset for this execution |
*
newMetaModelManager() ⇒ Create a metamodel manager (for validation against the metamodel)
Kind: global function
Returns: *
- the metamodel manager
object
validateMetaModel(input) ⇒ Validate metamodel instance against the metamodel
Kind: global function
Returns: object
- the validated metamodel instance in JSON
Param | Type | Description |
---|---|---|
input | object | the metamodel instance in JSON |
object
modelManagerFromMetaModel(metaModel, [validate]) ⇒ Import metamodel to a model manager
Kind: global function
Returns: object
- the metamodel for this model manager
Param | Type | Default | Description |
---|---|---|---|
metaModel | object | the metamodel | |
[validate] | boolean | true | whether to perform validation |
number
randomNumberInRangeWithPrecision(userMin, userMax, precision, systemMin, systemMax) ⇒ Generate a random number within a given range with a prescribed precision and inside a global range
Kind: global function
Returns: number
- a number
Param | Type | Description |
---|---|---|
userMin | * | Lower bound on the range, inclusive. Defaults to systemMin |
userMax | * | Upper bound on the range, inclusive. Defaults to systemMax |
precision | * | The precision of values returned, e.g. a value of 1 returns only whole numbers |
systemMin | * | Global minimum on the range, takes precidence over the userMin |
systemMax | * | Global maximum on the range, takes precidence over the userMax |
*
updateModels(models, newModel) ⇒ Update models with a new model
Kind: global function
Returns: *
- the updated models
Param | Type | Description |
---|---|---|
models | * | existing models |
newModel | * | new model |
Promise
resolveExternal(models, [options], [fileDownloader]) ⇒ Downloads all ModelFiles that are external dependencies and adds or updates them in this ModelManager.
Kind: global function
Returns: Promise
- a promise when the download and update operation is completed.
Throws:
IllegalModelException
if the models fail validation
Param | Type | Description |
---|---|---|
models | * | the AST for all the known models |
[options] | Object | Options object passed to ModelFileLoaders |
[fileDownloader] | FileDownloader | an optional FileDownloader |
object
parse(cto, [fileName]) ⇒ Create decorator argument string from a metamodel
Kind: global function
Returns: object
- the string for the decorator argument
Param | Type | Description |
---|---|---|
cto | string | the Concerto string |
[fileName] | string | an optional file name |
*
parseModels(files) ⇒ Parses an array of model files
Kind: global function
Returns: *
- the AST / metamodel
Param | Type | Description |
---|---|---|
files | Array.<string> | array of cto files |
string
decoratorArgFromMetaModel(mm) ⇒ Create decorator argument string from a metamodel
Kind: global function
Returns: string
- the string for the decorator argument
Param | Type | Description |
---|---|---|
mm | object | the metamodel |
string
decoratorFromMetaModel(mm) ⇒ Create decorator string from a metamodel
Kind: global function
Returns: string
- the string for the decorator
Param | Type | Description |
---|---|---|
mm | object | the metamodel |
string
decoratorsFromMetaModel(mm, prefix) ⇒ Create decorators string from a metamodel
Kind: global function
Returns: string
- the string for the decorators
Param | Type | Description |
---|---|---|
mm | object | the metamodel |
prefix | string | indentation |
string
propertyFromMetaModel(mm) ⇒ Create a property string from a metamodel
Kind: global function
Returns: string
- the string for that property
Param | Type | Description |
---|---|---|
mm | object | the metamodel |
string
declFromMetaModel(mm) ⇒ Create a declaration string from a metamodel
Kind: global function
Returns: string
- the string for that declaration
Param | Type | Description |
---|---|---|
mm | object | the metamodel |
string
toCTO(metaModel) ⇒ Create a model string from a metamodel
Kind: global function
Returns: string
- the string for that model
Param | Type | Description |
---|---|---|
metaModel | object | the metamodel |
*
findNamespace(priorModels, namespace) ⇒ Find the model for a given namespace
Kind: global function
Returns: *
- the model
Param | Type | Description |
---|---|---|
priorModels | * | known models |
namespace | string | the namespace |
*
findDeclaration(thisModel, name) ⇒ Find a declaration for a given name in a model
Kind: global function
Returns: *
- the declaration
Param | Type | Description |
---|---|---|
thisModel | * | the model |
name | string | the declaration name |
object
createNameTable(priorModels, metaModel) ⇒ Create a name resolution table
Kind: global function
Returns: object
- mapping from a name to its namespace
Param | Type | Description |
---|---|---|
priorModels | * | known models |
metaModel | object | the metamodel (JSON) |
string
resolveName(name, table) ⇒ Resolve a name using the name table
Kind: global function
Returns: string
- the namespace for that name
Param | Type | Description |
---|---|---|
name | string | the name of the type to resolve |
table | object | the name table |
object
resolveTypeNames(metaModel, table) ⇒ Name resolution for metamodel
Kind: global function
Returns: object
- the metamodel with fully qualified names
Param | Type | Description |
---|---|---|
metaModel | object | the metamodel (JSON) |
table | object | the name table |
object
resolveLocalNames(priorModels, metaModel) ⇒ Resolve the namespace for names in the metamodel
Kind: global function
Returns: object
- the resolved metamodel
Param | Type | Description |
---|---|---|
priorModels | * | known models |
metaModel | object | the MetaModel |
object
resolveLocalNamesForAll(allModels) ⇒ Resolve the namespace for names in the metamodel
Kind: global function
Returns: object
- the resolved metamodel
Param | Type | Description |
---|---|---|
allModels | * | known models |
string
inferModelFile(defaultNamespace, defaultType, schema) ⇒ Infers a Concerto model from a JSON Schema.
Kind: global function
Returns: string
- the Concerto model
Param | Type | Description |
---|---|---|
defaultNamespace | string | a fallback namespace to use for the model if it can't be infered |
defaultType | string | a fallback name for the root concept if it can't be infered |
schema | object | the input json object |
string
capitalizeFirstLetter(string) ⇒ Capitalize the first letter of a string
Kind: global function
Returns: string
- input with first letter capitalized
Param | Type | Description |
---|---|---|
string | string | the input string |
number
hashCode(value) ⇒ Computes an integer hashcode value for a string
Kind: global function
Returns: number
- the hashcode
Param | Type | Description |
---|---|---|
value | string | the input string |
Boolean
isObject(val) ⇒ Returns true if val is an object
Kind: global function
Returns: Boolean
- true if val is an object
Param | Type | Description |
---|---|---|
val | * | the value to test |
Boolean
isBoolean(val) ⇒ Returns true if val is a boolean
Kind: global function
Returns: Boolean
- true if val is a boolean
Param | Type | Description |
---|---|---|
val | * | the value to test |
Boolean
isNull(val) ⇒ Returns true if val is null
Kind: global function
Returns: Boolean
- true if val is null
Param | Type | Description |
---|---|---|
val | * | the value to test |
Boolean
isArray(val) ⇒ Returns true if val is an array
Kind: global function
Returns: Boolean
- true if val is an array
Param | Type | Description |
---|---|---|
val | * | the value to test |
Boolean
isString(val) ⇒ Returns true if val is a string
Kind: global function
Returns: Boolean
- true if val is a string
Param | Type | Description |
---|---|---|
val | * | the value to test |
Boolean
isDateTime(val) ⇒ Returns true if val is a date time
Kind: global function
Returns: Boolean
- true if val is a string
Param | Type | Description |
---|---|---|
val | * | the value to test |
Boolean
isInteger(val) ⇒ Returns true if val is an integer
Kind: global function
Returns: Boolean
- true if val is a string
Param | Type | Description |
---|---|---|
val | * | the value to test |
Boolean
isDouble(val) ⇒ Returns true if val is an integer
Kind: global function
Returns: Boolean
- true if val is a string
Param | Type | Description |
---|---|---|
val | * | the value to test |
string
getType(input) ⇒ Get the primitive Concerto type for an input
Kind: global function
Returns: string
- the Concerto type
Param | Type | Description |
---|---|---|
input | * | the input object |
object
handleArray(typeName, context, input) ⇒ Handles an array
Kind: global function
Returns: object
- the type for the array
Param | Type | Description |
---|---|---|
typeName | * | the name of the type being processed |
context | * | the processing context |
input | * | the input object |
object
handleType(name, context, input) ⇒ Handles an input type
Kind: global function
Returns: object
- an object for the type
Param | Type | Description |
---|---|---|
name | * | the name of the type being processed |
context | * | the processing context |
input | * | the input object |
removeDuplicateTypes(context)
Detect duplicate types and remove them
Kind: global function
Param | Type | Description |
---|---|---|
context | * | the context |
string
inferModel(namespace, rootTypeName, input) ⇒ Infers a Concerto model from a JSON instance.
Kind: global function
Returns: string
- the Concerto model
Param | Type | Description |
---|---|---|
namespace | string | the namespace to use for the model |
rootTypeName | * | the name for the root concept |
input | * | the input json object |
string
labelToSentence(labelName) ⇒ Inserts correct spacing and capitalization to a camelCase label
Kind: global function
Returns: string
- - The label text formatted for rendering
Param | Type | Description |
---|---|---|
labelName | string | the label text to be transformed |
string
sentenceToLabel(sentence) ⇒ Create a camelCase label from a sentence
Kind: global function
Returns: string
- - The camelCase label
Param | Type | Description |
---|---|---|
sentence | string | the sentence |
writeModelsToFileSystem(files, path, options)
Writes a set of model files to disk
Kind: global function
Param | Type | Description |
---|---|---|
files | * | the set of files to write, with names and whether they are external |
path | string | a path to the directory where to write the files |
options | * | a set of options |
string
camelCaseToSentence(text) ⇒ Converts a camel case string to a sentence
Kind: global function
Returns: string
- modified string
Param | Type | Description |
---|---|---|
text | string | input |