Cicero 0.21 to 0.22
The main change between the 0.21
release and the 0.22
release is the switch to version 1.0
of the Concerto modeling language and library. This change comes along with a complete revision for the Accord Project "base models" which define key types for: clause and contract data, parties, obligations and requests / responses. We encourage developers to get familiarized with the new base models before switching to Cicero 0.22
.
note
Before following those migration instructions, make sure to first install version 0.22
of Cicero, as described in the Install Cicero Section of this documentation.
Metadata Changes
You should only have to update the Cicero version in the package.json
for your template to ^0.22.0
. Remember to also increment the version number for the template itself.
Example
After those changes, the accordproject
field in your package.json
should look as follows (with the template
field being either clause
or contract
depending on the template):
...
"accordproject": {
"template": "clause",
"cicero": "^0.22.0"
}
...
Text Changes
There should be no text changes required for this version.
Model Changes
Most templates will require changes to the model and should be re-written against the new base Accord Project models. Most of the changes should be renaming for key classes:
- Contract and Clause data
- the
org.accordproject.cicero.contract.AccordContract
class is noworg.accordproject.contract.Contract
found in https://models.accordproject.org/accordproject/contract.cto - the
org.accordproject.cicero.contract.AccordClause
class is noworg.accordproject.contract.Clause
found in https://models.accordproject.org/accordproject/contract.cto
- the
- Contract state and parties
- the
org.accordproject.cicero.contract.AccordState
class is noworg.accordproject.runtime.State
found in https://models.accordproject.org/accordproject/runtime.cto - the
org.accordproject.cicero.contract.AccordParty
class is noworg.accordproject.party.Party
found in https://models.accordproject.org/accordproject/party.cto
- the
- Request and response
- the
org.accordproject.cicero.runtime.Request
class is noworg.accordproject.runtime.Request
found in https://models.accordproject.org/accordproject/runtime.cto - the
org.accordproject.cicero.runtime.Response
class is noworg.accordproject.runtime.Response
found in https://models.accordproject.org/accordproject/runtime.cto
- the
- Predefined obligations have been moved to their own model file found in https://models.accordproject.org/accordproject/obligation.cto
warning
Some of the properties in those base classes have changed, e.g., the contract state no longer requires a stateId
. As a result, corresponding changes to the contract logic in Ergo or to the application code may be required.
Example
A typical change to a template model might look as follows, from:
import org.accordproject.cicero.contract.* from https://models.accordproject.org/cicero/contract.cto
import org.accordproject.cicero.runtime.* from https://models.accordproject.org/cicero/runtime.cto
/**
* Defines the data model for the Purchase Order Failure
* template.
*/
asset PurchaseOrderFailure extends AccordContract {
o AccordParty buyer
...
}
To:
import org.accordproject.contract.* from https://models.accordproject.org/accordproject/contract.cto
import org.accordproject.runtime.* from https://models.accordproject.org/accordproject/runtime.cto
import org.accordproject.party.* from https://models.accordproject.org/accordproject/party.cto
import org.accordproject.obligation.* from https://models.accordproject.org/accordproject/obligation.cto
asset PurchaseOrderFailure extends Contract {
--> Party buyer
...
}
Logic Changes
Minimal changes to the contract logic should be required, however a few changes to the base models may affect your Ergo code. Notably:
- You should import the new Accord Project core models as needed
- The contract state no longer requires a
stateId
field. - The base contract state has been moved to the runtime model, which may need to be imported
API Changes
A number of API changes may affect Node.js applications using Cicero or Ergo packages. The main API changes are:
- Additional
utcOffset
parameter.@accordproject/cicero-core
package- the
TemplateInstance.parse
andTemplateInstance.draft
calls take an additionalutcOffset
parameter to specify the current timezone offset
- the
@accordproject/cicero-engine
package- the
Engine.init
,Engine.invoke
andEngine.trigger
calls take an additionalutcOffset
parameter to specify the current timezone offset
- the
@accordproject/ergo-engine
package- the
Engine.init
,Engine.invoke
andEngine.trigger
calls take an additionalutcOffset
parameter to specify the current timezone offset
- the
- New
es6
compilation target for Ergo.@accordproject/ergo-compiler
package- the
Compiler.compileToJavaScript
compilation targetcicero
has been renamed toes6
- the
@accordproject/cicero-core
package- the
Template.toArchive
compilation targetcicero
has been renamed toes6
- the
CLI Changes
- Specific UTC timezone offset now needs to be passed using the new option
--utcOffset
option has been removed
Cicero Server Changes
There should be no text changes required for this version.