From 930e1530846d36aa41a91e84e6f31b8c7f129aa3 Mon Sep 17 00:00:00 2001 From: Ved Prakash Vishwakarma Date: Fri, 6 Dec 2024 22:35:17 +0530 Subject: [PATCH 1/3] fix: updated basic-use.md file to avoid the confusion where to use the execute command --- website/package-lock.json | 1 - website/versioned_docs/version-0.13/basic-use.md | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/website/package-lock.json b/website/package-lock.json index 109007cb..9317a711 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -4,7 +4,6 @@ "requires": true, "packages": { "": { - "name": "website", "license": "Apache-2.0", "dependencies": { "axios": "^0.21.2", diff --git a/website/versioned_docs/version-0.13/basic-use.md b/website/versioned_docs/version-0.13/basic-use.md index daed6a2a..99c62e34 100644 --- a/website/versioned_docs/version-0.13/basic-use.md +++ b/website/versioned_docs/version-0.13/basic-use.md @@ -91,6 +91,8 @@ Unexpected "F" ## Execute the Clause +***Note** : `execute` command is deprecated in versions from `v0.22.0`. Therefore, if you are using the latest version, please refrain from using this deprecated command, as it is no longer functional. + Use the `cicero execute` command to parse a clause text based (your `sample.txt`) *and* execute the clause logic using an incoming request in JSON format. To do so you need to create two additional files. First, create a `state.json` file which contains: From e0ae0d4b7a7f6e59569c64aa30b0a22734b1eae2 Mon Sep 17 00:00:00 2001 From: Ved Prakash Vishwakarma Date: Fri, 6 Dec 2024 22:38:49 +0530 Subject: [PATCH 2/3] fix: updated basic-use.md file to avoid the confusion where to use the execute command Signed-off-by: Ved Prakash Vishwakarma --- website/versioned_docs/version-0.13/basic-use.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/versioned_docs/version-0.13/basic-use.md b/website/versioned_docs/version-0.13/basic-use.md index 99c62e34..25f805a9 100644 --- a/website/versioned_docs/version-0.13/basic-use.md +++ b/website/versioned_docs/version-0.13/basic-use.md @@ -91,7 +91,7 @@ Unexpected "F" ## Execute the Clause -***Note** : `execute` command is deprecated in versions from `v0.22.0`. Therefore, if you are using the latest version, please refrain from using this deprecated command, as it is no longer functional. +**Note** : `execute` command is deprecated in versions from `v0.22.0`. Therefore, if you are using the latest version, please refrain from using this deprecated command, as it is no longer functional. Use the `cicero execute` command to parse a clause text based (your `sample.txt`) *and* execute the clause logic using an incoming request in JSON format. To do so you need to create two additional files. From 4d0dc95dddb4950a450289086646c941de27fa6d Mon Sep 17 00:00:00 2001 From: Ved Prakash Vishwakarma Date: Sat, 7 Dec 2024 23:28:57 +0530 Subject: [PATCH 3/3] Update the documentation to aviod the confusion for the execute command Signed-off-by: Ved Prakash Vishwakarma --- docs/ref-cicero-api.md | 971 --------------------------------------- docs/ref-concerto-api.md | 11 + package-lock.json | 6 + 3 files changed, 17 insertions(+), 971 deletions(-) create mode 100644 package-lock.json diff --git a/docs/ref-cicero-api.md b/docs/ref-cicero-api.md index 2e676d67..e69de29b 100644 --- a/docs/ref-cicero-api.md +++ b/docs/ref-cicero-api.md @@ -1,971 +0,0 @@ ---- -id: ref-cicero-api -title: Cicero API ---- - -## Modules - -
-
cicero-engine
-

Clause Engine

-
-
cicero-core
-

Cicero Core - defines the core data types for Cicero.

-
-
- -## Classes - -
-
Clause
-

A Clause is executable business logic, linked to a natural language (legally enforceable) template. -A Clause must be constructed with a template and then prior to execution the data for the clause must be set. -Set the data for the clause (an instance of the template model) by either calling the setData method or by -calling the parse method and passing in natural language text that conforms to the template grammar.

-
-
Contract
-

A Contract is executable business logic, linked to a natural language (legally enforceable) template. -A Clause must be constructed with a template and then prior to execution the data for the clause must be set. -Set the data for the clause (an instance of the template model) by either calling the setData method or by -calling the parse method and passing in natural language text that conforms to the template grammar.

-
-
Metadata
-

Defines the metadata for a Template, including the name, version, README markdown.

-
-
Template
-

A template for a legal clause or contract. A Template has a template model, request/response transaction types, -a template grammar (natural language for the template) as well as Ergo code for the business logic of the -template.

-
-
TemplateInstance
-

A TemplateInstance is an instance of a Clause or Contract template. It is executable business logic, linked to -a natural language (legally enforceable) template. -A TemplateInstance must be constructed with a template and then prior to execution the data for the clause must be set. -Set the data for the TemplateInstance by either calling the setData method or by -calling the parse method and passing in natural language text that conforms to the template grammar.

-
-
CompositeArchiveLoader
-

Manages a set of archive loaders, delegating to the first archive -loader that accepts a URL.

-
-
- -## Functions - -
-
isPNG(buffer)Boolean
-

Checks whether the file is PNG

-
-
getMimeType(buffer)Object
-

Returns the mime-type of the file

-
-
- - - -## cicero-engine -Clause Engine - - -* [cicero-engine](#module_cicero-engine) - * [.Engine](#module_cicero-engine.Engine) - * [new Engine()](#new_module_cicero-engine.Engine_new) - * [.trigger(clause, request, state, [currentTime], [utcOffset])](#module_cicero-engine.Engine+trigger) ⇒ Promise - * [.invoke(clause, clauseName, params, state, [currentTime], [utcOffset])](#module_cicero-engine.Engine+invoke) ⇒ Promise - * [.init(clause, [currentTime], [utcOffset], params)](#module_cicero-engine.Engine+init) ⇒ Promise - * [.getErgoEngine()](#module_cicero-engine.Engine+getErgoEngine) ⇒ ErgoEngine - - - -### cicero-engine.Engine -

-Engine class. Stateless execution of clauses against a request object, returning a response to the caller. -

- -**Kind**: static class of [cicero-engine](#module_cicero-engine) -**Access**: public - -* [.Engine](#module_cicero-engine.Engine) - * [new Engine()](#new_module_cicero-engine.Engine_new) - * [.trigger(clause, request, state, [currentTime], [utcOffset])](#module_cicero-engine.Engine+trigger) ⇒ Promise - * [.invoke(clause, clauseName, params, state, [currentTime], [utcOffset])](#module_cicero-engine.Engine+invoke) ⇒ Promise - * [.init(clause, [currentTime], [utcOffset], params)](#module_cicero-engine.Engine+init) ⇒ Promise - * [.getErgoEngine()](#module_cicero-engine.Engine+getErgoEngine) ⇒ ErgoEngine - - - -#### new Engine() -Create the Engine. - - - -#### engine.trigger(clause, request, state, [currentTime], [utcOffset]) ⇒ Promise -Send a request to a clause for execution - -**Kind**: instance method of [Engine](#module_cicero-engine.Engine) -**Returns**: Promise - a promise that resolves to a result for the clause - -| Param | Type | Description | -| --- | --- | --- | -| clause | [Clause](#Clause) | the clause | -| request | object | the request, a JS object that can be deserialized using the Composer serializer. | -| state | object | the contract state, a JS object that can be deserialized using the Composer serializer. | -| [currentTime] | string | the definition of 'now', defaults to current time | -| [utcOffset] | number | UTC Offset for this execution, defaults to local offset | - - - -#### engine.invoke(clause, clauseName, params, state, [currentTime], [utcOffset]) ⇒ Promise -Invoke a specific clause for execution - -**Kind**: instance method of [Engine](#module_cicero-engine.Engine) -**Returns**: Promise - a promise that resolves to a result for the clause - -| Param | Type | Description | -| --- | --- | --- | -| clause | [Clause](#Clause) | the clause | -| clauseName | string | the clause name | -| params | object | the clause parameters, a JS object whose fields that can be deserialized using the Composer serializer. | -| state | object | the contract state, a JS object that can be deserialized using the Composer serializer. | -| [currentTime] | string | the definition of 'now', defaults to current time | -| [utcOffset] | number | UTC Offset for this execution, defaults to local offset | - - - -#### engine.init(clause, [currentTime], [utcOffset], params) ⇒ Promise -Initialize a clause - -**Kind**: instance method of [Engine](#module_cicero-engine.Engine) -**Returns**: Promise - a promise that resolves to a result for the clause initialization - -| Param | Type | Description | -| --- | --- | --- | -| clause | [Clause](#Clause) | the clause | -| [currentTime] | string | the definition of 'now', defaults to current time | -| [utcOffset] | number | UTC Offset for this execution, defaults to local offset | -| params | object | the clause parameters, a JS object whose fields that can be deserialized using the Composer serializer. | - - - -#### engine.getErgoEngine() ⇒ ErgoEngine -Provides access to the underlying Ergo engine. - -**Kind**: instance method of [Engine](#module_cicero-engine.Engine) -**Returns**: ErgoEngine - the Ergo Engine for this Engine - - -## cicero-core -Cicero Core - defines the core data types for Cicero. - - - -## Clause -A Clause is executable business logic, linked to a natural language (legally enforceable) template. -A Clause must be constructed with a template and then prior to execution the data for the clause must be set. -Set the data for the clause (an instance of the template model) by either calling the setData method or by -calling the parse method and passing in natural language text that conforms to the template grammar. - -**Kind**: global class -**Access**: public - - -## Contract -A Contract is executable business logic, linked to a natural language (legally enforceable) template. -A Clause must be constructed with a template and then prior to execution the data for the clause must be set. -Set the data for the clause (an instance of the template model) by either calling the setData method or by -calling the parse method and passing in natural language text that conforms to the template grammar. - -**Kind**: global class -**Access**: public - - -## Metadata -Defines the metadata for a Template, including the name, version, README markdown. - -**Kind**: global class -**Access**: public - -* [Metadata](#Metadata) - * [new Metadata(packageJson, readme, samples, request, logo)](#new_Metadata_new) - * _instance_ - * [.getTemplateType()](#Metadata+getTemplateType) ⇒ number - * [.getLogo()](#Metadata+getLogo) ⇒ Buffer - * [.getAuthor()](#Metadata+getAuthor) ⇒ \* - * [.getRuntime()](#Metadata+getRuntime) ⇒ string - * [.getCiceroVersion()](#Metadata+getCiceroVersion) ⇒ string - * [.satisfiesCiceroVersion(version)](#Metadata+satisfiesCiceroVersion) ⇒ string - * [.getSamples()](#Metadata+getSamples) ⇒ object - * [.getRequest()](#Metadata+getRequest) ⇒ object - * [.getSample(locale)](#Metadata+getSample) ⇒ string - * [.getREADME()](#Metadata+getREADME) ⇒ String - * [.getPackageJson()](#Metadata+getPackageJson) ⇒ object - * [.getName()](#Metadata+getName) ⇒ string - * [.getDisplayName()](#Metadata+getDisplayName) ⇒ string - * [.getKeywords()](#Metadata+getKeywords) ⇒ Array - * [.getDescription()](#Metadata+getDescription) ⇒ string - * [.getVersion()](#Metadata+getVersion) ⇒ string - * [.getIdentifier()](#Metadata+getIdentifier) ⇒ string - * [.createTargetMetadata(runtimeName)](#Metadata+createTargetMetadata) ⇒ object - * [.toJSON()](#Metadata+toJSON) ⇒ object - * _static_ - * [.checkImage(buffer)](#Metadata.checkImage) - * [.checkImageDimensions(buffer, mimeType)](#Metadata.checkImageDimensions) - - - -### new Metadata(packageJson, readme, samples, request, logo) -Create the Metadata. -

-Note: Only to be called by framework code. Applications should -retrieve instances from [Template](#Template) -

- - -| Param | Type | Description | -| --- | --- | --- | -| packageJson | object | the JS object for package.json (required) | -| readme | String | the README.md for the template (may be null) | -| samples | object | the sample markdown for the template in different locales, | -| request | object | the JS object for the sample request | -| logo | Buffer | the bytes data for the image represented as an object whose keys are the locales and whose values are the sample markdown. For example: { default: 'default sample markdown', en: 'sample text in english', fr: 'exemple de texte français' } Locale keys (with the exception of default) conform to the IETF Language Tag specification (BCP 47). THe `default` key represents sample template text in a non-specified language, stored in a file called `sample.md`. | - - - -### metadata.getTemplateType() ⇒ number -Returns either a 0 (for a contract template), or 1 (for a clause template) - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: number - the template type - - -### metadata.getLogo() ⇒ Buffer -Returns the logo at the root of the template - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: Buffer - the bytes data of logo - - -### metadata.getAuthor() ⇒ \* -Returns the author for this template. - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: \* - the author information - - -### metadata.getRuntime() ⇒ string -Returns the name of the runtime target for this template, or null if this template -has not been compiled for a specific runtime. - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: string - the name of the runtime - - -### metadata.getCiceroVersion() ⇒ string -Returns the version of Cicero that this template is compatible with. -i.e. which version of the runtime was this template built for? -The version string conforms to the semver definition - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: string - the semantic version - - -### metadata.satisfiesCiceroVersion(version) ⇒ string -Only returns true if the current cicero version satisfies the target version of this template - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: string - the semantic version - -| Param | Type | Description | -| --- | --- | --- | -| version | string | the cicero version to check against | - - - -### metadata.getSamples() ⇒ object -Returns the samples for this template. - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: object - the sample files for the template - - -### metadata.getRequest() ⇒ object -Returns the sample request for this template. - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: object - the sample request for the template - - -### metadata.getSample(locale) ⇒ string -Returns the sample for this template in the given locale. This may be null. -If no locale is specified returns the default sample if it has been specified. - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: string - the sample file for the template in the given locale or null - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| locale | string | null | the IETF language code for the language. | - - - -### metadata.getREADME() ⇒ String -Returns the README.md for this template. This may be null if the template does not have a README.md - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: String - the README.md file for the template or null - - -### metadata.getPackageJson() ⇒ object -Returns the package.json for this template. - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: object - the Javascript object for package.json - - -### metadata.getName() ⇒ string -Returns the name for this template. - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: string - the name of the template - - -### metadata.getDisplayName() ⇒ string -Returns the display name for this template. - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: string - the display name of the template - - -### metadata.getKeywords() ⇒ Array -Returns the keywords for this template. - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: Array - the keywords of the template - - -### metadata.getDescription() ⇒ string -Returns the description for this template. - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: string - the description of the template - - -### metadata.getVersion() ⇒ string -Returns the version for this template. - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: string - the description of the template - - -### metadata.getIdentifier() ⇒ string -Returns the identifier for this template, formed from name@version. - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: string - the identifier of the template - - -### metadata.createTargetMetadata(runtimeName) ⇒ object -Return new Metadata for a target runtime - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: object - the new Metadata - -| Param | Type | Description | -| --- | --- | --- | -| runtimeName | string | the target runtime name | - - - -### metadata.toJSON() ⇒ object -Return the whole metadata content, for hashing - -**Kind**: instance method of [Metadata](#Metadata) -**Returns**: object - the content of the metadata object - - -### Metadata.checkImage(buffer) -Check the buffer is a png file with the right size - -**Kind**: static method of [Metadata](#Metadata) - -| Param | Type | Description | -| --- | --- | --- | -| buffer | Buffer | the buffer object | - - - -### Metadata.checkImageDimensions(buffer, mimeType) -Checks if dimensions for the image are correct. - -**Kind**: static method of [Metadata](#Metadata) - -| Param | Type | Description | -| --- | --- | --- | -| buffer | Buffer | the buffer object | -| mimeType | string | the mime type of the object | - - - -## *Template* -A template for a legal clause or contract. A Template has a template model, request/response transaction types, -a template grammar (natural language for the template) as well as Ergo code for the business logic of the -template. - -**Kind**: global abstract class -**Access**: public - -* *[Template](#Template)* - * *[new Template(packageJson, readme, samples, request, logo, options, authorSignature)](#new_Template_new)* - * _instance_ - * *[.validate(options)](#Template+validate)* - * *[.getTemplateModel()](#Template+getTemplateModel) ⇒ ClassDeclaration* - * *[.getIdentifier()](#Template+getIdentifier) ⇒ String* - * *[.getMetadata()](#Template+getMetadata) ⇒ [Metadata](#Metadata)* - * *[.getName()](#Template+getName) ⇒ String* - * *[.getDisplayName()](#Template+getDisplayName) ⇒ string* - * *[.getVersion()](#Template+getVersion) ⇒ String* - * *[.getDescription()](#Template+getDescription) ⇒ String* - * *[.getHash()](#Template+getHash) ⇒ string* - * *[.verifyTemplateSignature()](#Template+verifyTemplateSignature)* - * *[.signTemplate(p12File, passphrase, timestamp)](#Template+signTemplate)* - * *[.toArchive([language], [options])](#Template+toArchive) ⇒ Promise.<Buffer>* - * *[.getParserManager()](#Template+getParserManager) ⇒ ParserManager* - * *[.getLogicManager()](#Template+getLogicManager) ⇒ LogicManager* - * *[.getIntrospector()](#Template+getIntrospector) ⇒ Introspector* - * *[.getFactory()](#Template+getFactory) ⇒ Factory* - * *[.getSerializer()](#Template+getSerializer) ⇒ Serializer* - * *[.getRequestTypes()](#Template+getRequestTypes) ⇒ Array* - * *[.getResponseTypes()](#Template+getResponseTypes) ⇒ Array* - * *[.getEmitTypes()](#Template+getEmitTypes) ⇒ Array* - * *[.getStateTypes()](#Template+getStateTypes) ⇒ Array* - * *[.hasLogic()](#Template+hasLogic) ⇒ boolean* - * _static_ - * *[.fromDirectory(path, [options])](#Template.fromDirectory) ⇒ [Promise.<Template>](#Template)* - * *[.fromArchive(buffer, [options])](#Template.fromArchive) ⇒ [Promise.<Template>](#Template)* - * *[.fromUrl(url, [options])](#Template.fromUrl) ⇒ Promise* - * *[.instanceOf(classDeclaration, fqt)](#Template.instanceOf) ⇒ boolean* - - - -### *new Template(packageJson, readme, samples, request, logo, options, authorSignature)* -Create the Template. -Note: Only to be called by framework code. Applications should -retrieve instances from [fromArchive](#Template.fromArchive) or [fromDirectory](#Template.fromDirectory). - - -| Param | Type | Description | -| --- | --- | --- | -| packageJson | object | the JS object for package.json | -| readme | String | the readme in markdown for the template (optional) | -| samples | object | the sample text for the template in different locales | -| request | object | the JS object for the sample request | -| logo | Buffer | the bytes data of logo | -| options | Object | e.g., { warnings: true } | -| authorSignature | Object | object containing template hash, timestamp, author's certificate, signature | - - - -### *template.validate(options)* -Verifies that the template is well formed. -Compiles the Ergo logic. -Throws an exception with the details of any validation errors. - -**Kind**: instance method of [Template](#Template) - -| Param | Type | Description | -| --- | --- | --- | -| options | Object | e.g., { verify: true } | - - - -### *template.getTemplateModel() ⇒ ClassDeclaration* -Returns the template model for the template - -**Kind**: instance method of [Template](#Template) -**Returns**: ClassDeclaration - the template model for the template -**Throws**: - -- Error if no template model is found, or multiple template models are found - - - -### *template.getIdentifier() ⇒ String* -Returns the identifier for this template - -**Kind**: instance method of [Template](#Template) -**Returns**: String - the identifier of this template - - -### *template.getMetadata() ⇒ [Metadata](#Metadata)* -Returns the metadata for this template - -**Kind**: instance method of [Template](#Template) -**Returns**: [Metadata](#Metadata) - the metadata for this template - - -### *template.getName() ⇒ String* -Returns the name for this template - -**Kind**: instance method of [Template](#Template) -**Returns**: String - the name of this template - - -### *template.getDisplayName() ⇒ string* -Returns the display name for this template. - -**Kind**: instance method of [Template](#Template) -**Returns**: string - the display name of the template - - -### *template.getVersion() ⇒ String* -Returns the version for this template - -**Kind**: instance method of [Template](#Template) -**Returns**: String - the version of this template. Use semver module -to parse. - - -### *template.getDescription() ⇒ String* -Returns the description for this template - -**Kind**: instance method of [Template](#Template) -**Returns**: String - the description of this template - - -### *template.getHash() ⇒ string* -Gets a content based SHA-256 hash for this template. Hash -is based on the metadata for the template plus the contents of -all the models and all the script files. - -**Kind**: instance method of [Template](#Template) -**Returns**: string - the SHA-256 hash in hex format - - -### *template.verifyTemplateSignature()* -verifies the signature stored in the template object using the template hash and timestamp - -**Kind**: instance method of [Template](#Template) - - -### *template.signTemplate(p12File, passphrase, timestamp)* -signs a string made up of template hash and time stamp using private key derived -from the keystore - -**Kind**: instance method of [Template](#Template) - -| Param | Type | Description | -| --- | --- | --- | -| p12File | String | encoded string of p12 keystore file | -| passphrase | String | passphrase for the keystore file | -| timestamp | Number | timestamp of the moment of signature is done | - - - -### *template.toArchive([language], [options]) ⇒ Promise.<Buffer>* -Persists this template to a Cicero Template Archive (cta) file. - -**Kind**: instance method of [Template](#Template) -**Returns**: Promise.<Buffer> - the zlib buffer - -| Param | Type | Description | -| --- | --- | --- | -| [language] | string | target language for the archive (should be 'ergo') | -| [options] | Object | JSZip options and keystore object containing path and passphrase for the keystore | - - - -### *template.getParserManager() ⇒ ParserManager* -Provides access to the parser manager for this template. -The parser manager can convert template data to and from -natural language text. - -**Kind**: instance method of [Template](#Template) -**Returns**: ParserManager - the ParserManager for this template - - -### *template.getLogicManager() ⇒ LogicManager* -Provides access to the template logic for this template. -The template logic encapsulate the code necessary to -execute the clause or contract. - -**Kind**: instance method of [Template](#Template) -**Returns**: LogicManager - the LogicManager for this template - - -### *template.getIntrospector() ⇒ Introspector* -Provides access to the Introspector for this template. The Introspector -is used to reflect on the types defined within this template. - -**Kind**: instance method of [Template](#Template) -**Returns**: Introspector - the Introspector for this template - - -### *template.getFactory() ⇒ Factory* -Provides access to the Factory for this template. The Factory -is used to create the types defined in this template. - -**Kind**: instance method of [Template](#Template) -**Returns**: Factory - the Factory for this template - - -### *template.getSerializer() ⇒ Serializer* -Provides access to the Serializer for this template. The Serializer -is used to serialize instances of the types defined within this template. - -**Kind**: instance method of [Template](#Template) -**Returns**: Serializer - the Serializer for this template - - -### *template.getRequestTypes() ⇒ Array* -Provides a list of the input types that are accepted by this Template. Types use the fully-qualified form. - -**Kind**: instance method of [Template](#Template) -**Returns**: Array - a list of the request types - - -### *template.getResponseTypes() ⇒ Array* -Provides a list of the response types that are returned by this Template. Types use the fully-qualified form. - -**Kind**: instance method of [Template](#Template) -**Returns**: Array - a list of the response types - - -### *template.getEmitTypes() ⇒ Array* -Provides a list of the emit types that are emitted by this Template. Types use the fully-qualified form. - -**Kind**: instance method of [Template](#Template) -**Returns**: Array - a list of the emit types - - -### *template.getStateTypes() ⇒ Array* -Provides a list of the state types that are expected by this Template. Types use the fully-qualified form. - -**Kind**: instance method of [Template](#Template) -**Returns**: Array - a list of the state types - - -### *template.hasLogic() ⇒ boolean* -Returns true if the template has logic, i.e. has more than one script file. - -**Kind**: instance method of [Template](#Template) -**Returns**: boolean - true if the template has logic - - -### *Template.fromDirectory(path, [options]) ⇒ [Promise.<Template>](#Template)* -Builds a Template from the contents of a directory. -The directory must include a package.json in the root (used to specify -the name, version and description of the template). - -**Kind**: static method of [Template](#Template) -**Returns**: [Promise.<Template>](#Template) - a Promise to the instantiated template - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| path | String | | to a local directory | -| [options] | Object | | an optional set of options to configure the instance. | - - - -### *Template.fromArchive(buffer, [options]) ⇒ [Promise.<Template>](#Template)* -Create a template from an archive. - -**Kind**: static method of [Template](#Template) -**Returns**: [Promise.<Template>](#Template) - a Promise to the template - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| buffer | Buffer | | the buffer to a Cicero Template Archive (cta) file | -| [options] | Object | | an optional set of options to configure the instance. | - - - -### *Template.fromUrl(url, [options]) ⇒ Promise* -Create a template from an URL. - -**Kind**: static method of [Template](#Template) -**Returns**: Promise - a Promise to the template - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| url | String | | the URL to a Cicero Template Archive (cta) file | -| [options] | Object | | an optional set of options to configure the instance. | - - - -### *Template.instanceOf(classDeclaration, fqt) ⇒ boolean* -Check to see if a ClassDeclaration is an instance of the specified fully qualified -type name. - -**Kind**: static method of [Template](#Template) -**Returns**: boolean - True if classDeclaration an instance of the specified fully -qualified type name, false otherwise. -**Internal**: - -| Param | Type | Description | -| --- | --- | --- | -| classDeclaration | ClassDeclaration | The class to test | -| fqt | String | The fully qualified type name. | - - - -## *TemplateInstance* -A TemplateInstance is an instance of a Clause or Contract template. It is executable business logic, linked to -a natural language (legally enforceable) template. -A TemplateInstance must be constructed with a template and then prior to execution the data for the clause must be set. -Set the data for the TemplateInstance by either calling the setData method or by -calling the parse method and passing in natural language text that conforms to the template grammar. - -**Kind**: global abstract class -**Access**: public - -* *[TemplateInstance](#TemplateInstance)* - * *[new TemplateInstance(template)](#new_TemplateInstance_new)* - * _instance_ - * *[.setData(data)](#TemplateInstance+setData)* - * *[.getData()](#TemplateInstance+getData) ⇒ object* - * *[.getEngine()](#TemplateInstance+getEngine) ⇒ object* - * *[.getDataAsConcertoObject()](#TemplateInstance+getDataAsConcertoObject) ⇒ object* - * *[.parse(input, [currentTime], [utcOffset], [fileName])](#TemplateInstance+parse)* - * *[.draft([options], [currentTime], [utcOffset])](#TemplateInstance+draft) ⇒ string* - * *[.formatCiceroMark(ciceroMarkParsed, options, format)](#TemplateInstance+formatCiceroMark) ⇒ string* - * *[.getIdentifier()](#TemplateInstance+getIdentifier) ⇒ String* - * *[.getTemplate()](#TemplateInstance+getTemplate) ⇒ [Template](#Template)* - * *[.getLogicManager()](#TemplateInstance+getLogicManager) ⇒ LogicManager* - * *[.toJSON()](#TemplateInstance+toJSON) ⇒ object* - * _static_ - * *[.ciceroFormulaEval(logicManager, clauseId, ergoEngine, name)](#TemplateInstance.ciceroFormulaEval) ⇒ \** - * *[.rebuildParser(parserManager, logicManager, ergoEngine, templateName, grammar)](#TemplateInstance.rebuildParser)* - - - -### *new TemplateInstance(template)* -Create the Clause and link it to a Template. - - -| Param | Type | Description | -| --- | --- | --- | -| template | [Template](#Template) | the template for the clause | - - - -### *templateInstance.setData(data)* -Set the data for the clause - -**Kind**: instance method of [TemplateInstance](#TemplateInstance) - -| Param | Type | Description | -| --- | --- | --- | -| data | object | the data for the clause, must be an instance of the template model for the clause's template. This should be a plain JS object and will be deserialized and validated into the Concerto object before assignment. | - - - -### *templateInstance.getData() ⇒ object* -Get the data for the clause. This is a plain JS object. To retrieve the Concerto -object call getConcertoData(). - -**Kind**: instance method of [TemplateInstance](#TemplateInstance) -**Returns**: object - - the data for the clause, or null if it has not been set - - -### *templateInstance.getEngine() ⇒ object* -Get the current Ergo engine - -**Kind**: instance method of [TemplateInstance](#TemplateInstance) -**Returns**: object - - the data for the clause, or null if it has not been set - - -### *templateInstance.getDataAsConcertoObject() ⇒ object* -Get the data for the clause. This is a Concerto object. To retrieve the -plain JS object suitable for serialization call toJSON() and retrieve the `data` property. - -**Kind**: instance method of [TemplateInstance](#TemplateInstance) -**Returns**: object - - the data for the clause, or null if it has not been set - - -### *templateInstance.parse(input, [currentTime], [utcOffset], [fileName])* -Set the data for the clause by parsing natural language text. - -**Kind**: instance method of [TemplateInstance](#TemplateInstance) - -| Param | Type | Description | -| --- | --- | --- | -| input | string | the text for the clause | -| [currentTime] | string | the definition of 'now', defaults to current time | -| [utcOffset] | number | UTC Offset for this execution, defaults to local offset | -| [fileName] | string | the fileName for the text (optional) | - - - -### *templateInstance.draft([options], [currentTime], [utcOffset]) ⇒ string* -Generates the natural language text for a contract or clause clause; combining the text from the template -and the instance data. - -**Kind**: instance method of [TemplateInstance](#TemplateInstance) -**Returns**: string - the natural language text for the contract or clause; created by combining the structure of -the template with the JSON data for the clause. - -| Param | Type | Description | -| --- | --- | --- | -| [options] | \* | text generation options. | -| [currentTime] | string | the definition of 'now', defaults to current time | -| [utcOffset] | number | UTC Offset for this execution, defaults to local offset | - - - -### *templateInstance.formatCiceroMark(ciceroMarkParsed, options, format) ⇒ string* -Format CiceroMark - -**Kind**: instance method of [TemplateInstance](#TemplateInstance) -**Returns**: string - the result of parsing and printing back the text - -| Param | Type | Description | -| --- | --- | --- | -| ciceroMarkParsed | object | the parsed CiceroMark DOM | -| options | object | parameters to the formatting | -| format | string | to the text generation | - - - -### *templateInstance.getIdentifier() ⇒ String* -Returns the identifier for this clause. The identifier is the identifier of -the template plus '-' plus a hash of the data for the clause (if set). - -**Kind**: instance method of [TemplateInstance](#TemplateInstance) -**Returns**: String - the identifier of this clause - - -### *templateInstance.getTemplate() ⇒ [Template](#Template)* -Returns the template for this clause - -**Kind**: instance method of [TemplateInstance](#TemplateInstance) -**Returns**: [Template](#Template) - the template for this clause - - -### *templateInstance.getLogicManager() ⇒ LogicManager* -Returns the template logic for this clause - -**Kind**: instance method of [TemplateInstance](#TemplateInstance) -**Returns**: LogicManager - the template for this clause - - -### *templateInstance.toJSON() ⇒ object* -Returns a JSON representation of the clause - -**Kind**: instance method of [TemplateInstance](#TemplateInstance) -**Returns**: object - the JS object for serialization - - -### *TemplateInstance.ciceroFormulaEval(logicManager, clauseId, ergoEngine, name) ⇒ \** -Constructs a function for formula evaluation based for this template instance - -**Kind**: static method of [TemplateInstance](#TemplateInstance) -**Returns**: \* - A function from formula code + input data to result - -| Param | Type | Description | -| --- | --- | --- | -| logicManager | \* | the logic manager | -| clauseId | string | this instance identifier | -| ergoEngine | \* | the evaluation engine | -| name | string | the name of the formula | - - - -### *TemplateInstance.rebuildParser(parserManager, logicManager, ergoEngine, templateName, grammar)* -Utility to rebuild a parser when the grammar changes - -**Kind**: static method of [TemplateInstance](#TemplateInstance) - -| Param | Type | Description | -| --- | --- | --- | -| parserManager | \* | the parser manager | -| logicManager | \* | the logic manager | -| ergoEngine | \* | the evaluation engine | -| templateName | string | this template name | -| grammar | string | the new grammar | - - - -## CompositeArchiveLoader -Manages a set of archive loaders, delegating to the first archive -loader that accepts a URL. - -**Kind**: global class - -* [CompositeArchiveLoader](#CompositeArchiveLoader) - * [new CompositeArchiveLoader()](#new_CompositeArchiveLoader_new) - * [.addArchiveLoader(archiveLoader)](#CompositeArchiveLoader+addArchiveLoader) - * [.clearArchiveLoaders()](#CompositeArchiveLoader+clearArchiveLoaders) - * *[.accepts(url)](#CompositeArchiveLoader+accepts) ⇒ boolean* - * [.load(url, options)](#CompositeArchiveLoader+load) ⇒ Promise - - - -### new CompositeArchiveLoader() -Create the CompositeArchiveLoader. Used to delegate to a set of ArchiveLoaders. - - - -### compositeArchiveLoader.addArchiveLoader(archiveLoader) -Adds a ArchiveLoader implemenetation to the ArchiveLoader - -**Kind**: instance method of [CompositeArchiveLoader](#CompositeArchiveLoader) - -| Param | Type | Description | -| --- | --- | --- | -| archiveLoader | ArchiveLoader | The archive to add to the CompositeArchiveLoader | - - - -### compositeArchiveLoader.clearArchiveLoaders() -Remove all registered ArchiveLoaders - -**Kind**: instance method of [CompositeArchiveLoader](#CompositeArchiveLoader) - - -### *compositeArchiveLoader.accepts(url) ⇒ boolean* -Returns true if this ArchiveLoader can process the URL - -**Kind**: instance abstract method of [CompositeArchiveLoader](#CompositeArchiveLoader) -**Returns**: boolean - true if this ArchiveLoader accepts the URL - -| Param | Type | Description | -| --- | --- | --- | -| url | string | the URL | - - - -### compositeArchiveLoader.load(url, options) ⇒ Promise -Load a Archive from a URL and return it - -**Kind**: instance method of [CompositeArchiveLoader](#CompositeArchiveLoader) -**Returns**: Promise - a promise to the Archive - -| Param | Type | Description | -| --- | --- | --- | -| url | string | the url to get | -| options | object | additional options | - - - -## isPNG(buffer) ⇒ Boolean -Checks whether the file is PNG - -**Kind**: global function -**Returns**: Boolean - whether the file in PNG - -| Param | Type | Description | -| --- | --- | --- | -| buffer | Buffer | buffer of the file | - - - -## getMimeType(buffer) ⇒ Object -Returns the mime-type of the file - -**Kind**: global function -**Returns**: Object - the mime-type of the file - -| Param | Type | Description | -| --- | --- | --- | -| buffer | Buffer | buffer of the file | - diff --git a/docs/ref-concerto-api.md b/docs/ref-concerto-api.md index 8b9b294a..c58d4e5b 100644 --- a/docs/ref-concerto-api.md +++ b/docs/ref-concerto-api.md @@ -3,3 +3,14 @@ id: ref-concerto-api title: Concerto API --- + + +## workspacesPattern +This script updates the devDependencies and dependencies in the workspaces +to match the version specified by the given parameter. +The expected parameter should be the tag for the package. + +Example: +node ./script/bump_version.js + +**Kind**: global constant diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..43df3339 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "techdocs", + "lockfileVersion": 3, + "requires": true, + "packages": {} +}