{"_id":"@accordproject/concerto","_rev":"30-0c933ab4095075879ceac2222626894e","name":"@accordproject/concerto","dist-tags":{"=unstable":"0.71.8-20190915045234","latest":"0.80.3","unstable":"0.80.4-20191003155034"},"versions":{"0.71.8-20190915045234":{"name":"@accordproject/concerto","version":"0.71.8-20190915045234","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2","doctrine":"3.0.0"},"license-check-and-add-config":{"folder":"./lib","license":"LICENSE.txt","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE.txt","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"./markdown-license.txt"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"gitHead":"9297cd815c6e8b5c5e01dc977db314ff30003398","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.71.8-20190915045234","_nodeVersion":"8.12.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-wZDAL47nRFfRE2GYWc9BCBAZH2c8GLT81GVEDvbeG8Mjt0HEpEvG3QWXj80nUbBV1TI/ri1GaAnZeoJ71x1SEQ==","shasum":"6fc6bee510fa41ecdd94f39a0efbe45711694cd3","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.71.8-20190915045234.tgz","fileCount":102,"unpackedSize":1373410,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdff8FCRA9TVsSAnZWagAAtJsP/inzNqUnBtAN74Q3jX0n\nalSXVe5mYn0aY1LDbiC0l6cd7u78MBdClpALekhGK5wtlD9S6cHuh0cYok/y\nl9nI8roQ9HQ4tjZJ27lzYi4O3BrZoQ7MRsEBYENr6dUCI9ENlbHMS86131y2\n0ZvWOeMyF7ia6ZQWJarGbKcWSjz66CxwkGDWErQLwKIqNgH7vAFdhMo/elpC\nzP/BpzalAWSZLhhxgIuh5XtH3UqoKDag1w2iW+eLbUviCWYEbm+tE5gmFf12\nbemZE58Joq0ChBBkasZ/AJMa5kdyqjSU3Me9MwNH5QX+cm00Lu+/t8LVyezI\nJkZvDM4fZenx8Xupz0aWLTSmI5Ic9ITnOP9UVbwLW9HxJ0H3n0AVlo6snQNa\nsnPlHURgRqBuztHLPK8tzf3SVNbSad7Nqxd+dXmQ8yv/k1dDdEPcoSPgbzSt\n+RoSZ/6gHkcDLNLwlK8fzNDjgeaT3naa2EaTnrh7tH3od24eQ2GF9ncD75/w\nPrPpgb9Ai5eIn3L72CcQCIUZA4lAkCZNaUG6TGNKB1JEsQ4ZcA/hpdncGC42\nBXXVPZCcPG4KgW7xqY3vhj+MQEK/Wt0NP3hvb+o+Jkl2hkSodR2bXBbiiIxz\nphYwK2NX2gtIWD0Hhtd2BIm2rp21hiqYKb9FebxFMWyl+LpvgwYEJ44jAu77\nTVzI\r\n=KFqe\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHmsRQPyBTiVKcb0duJaAycDwa/tBNrAkgt9g94WRFbEAiAKdnPdRKdd/YyCfLuunmHu15ML1J6/lc1n5R3T4WuVRA=="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"jsimeon","email":"jerome@clause.io"}],"_npmUser":{"name":"jsimeon","email":"jerome@clause.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.71.8-20190915045234_1568538372791_0.9205854820273742"},"_hasShrinkwrap":false},"0.71.8-20190915091253":{"name":"@accordproject/concerto","version":"0.71.8-20190915091253","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2","doctrine":"3.0.0"},"license-check-and-add-config":{"folder":"./lib","license":"LICENSE.txt","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE.txt","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"./markdown-license.txt"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"gitHead":"e5b599da562064689099913740a4c10a531c7d91","readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.71.8-20190915091253","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"jsimeon","email":"jerome@clause.io"},"dist":{"integrity":"sha512-JwZxJlqVK+L3J/sbi3gdZnjnQkcIDaweYl775pqdxafXEcx8rYLiX/fEkZn9KXOfd+0AcGTzoBYFYPOIn29T6A==","shasum":"8f15304481bc66c21107ae44b16d93e009a52e60","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.71.8-20190915091253.tgz","fileCount":103,"unpackedSize":1373499,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdfgCkCRA9TVsSAnZWagAARO0P/1eQ4rlCFk5JK1njy3sZ\n8z6VdHcxBxV7/tr32y8XX78FeO4x+H4C6Id8SC7GnTLsON1BHrvOa7+hODab\ni6AMg8SnFWmYZmd0xZ4+qNxXDyvuvHpcrknMOoq4mdrLeswSJHkWql0xt85f\nhBei2seS+T01t5C1NRn7yefkK2t/VCqICrfMk14C0hCyPZ1GInRXBZ2JyQ4V\nVAjkxxR0L37YS73dUgoec7ZlP+YjguRKqY/FeXf1ekCN1AVQU6Ai90wk87AH\nZ9lHvcAtauk/JPJff68hC+q8XDMnKnBUWadlT9CKPEvw+1QBBrJX8lmZoePk\n5OsepohJuBFaZRLJO4KiAqbvC3SLSe8ds2fHtCSQ98pq8zWMlnNftgJKyuO1\nRkbfYbNT/N8PpjU/GKvP+BC9LogPQi0Uo+ozn4a8iO4y/hFaEwBboO128lS7\nZqhralrVWkM+nbWkG8LIoeFIbat5cN/1hUKtcG3CgmoBCVwja6qZU/YrIIMc\nBVMt5bBQiBmTGvuQzcKbo1sUw+7TIcnTMtQiFOpXkARkfrdhIVyC9HTjlNmi\nThX4+mECiWScBIhvSCRgUTKzIEHoHKct2GfGjoR9XTaZd47sfY2hCxkQXVsq\ntK5ts+DUwrrT6xI0J9TNRrIVj31L7B36poE7eYSzOabM1ZLOYYPnEyg3hodA\n7Yoc\r\n=f3i9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+98kw8IRHQ+c/ZuFkfx0akg/tnNMa5GgCPdK2kPTjugIhAKSGE+uQzvXlR6c05wxJ1hzntnhcyOIhoCJwHgkbIGw+"}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.71.8-20190915091253_1568538788328_0.9150345762109269"},"_hasShrinkwrap":false},"0.71.8-20190915202838":{"name":"@accordproject/concerto","version":"0.71.8-20190915202838","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2","doctrine":"3.0.0"},"license-check-and-add-config":{"folder":"./lib","license":"LICENSE.txt","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE.txt","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"./markdown-license.txt"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"gitHead":"ee71f18a5320f04e4efdd60b9e3d765ea2b7d3f5","readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.71.8-20190915202838","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"jsimeon","email":"jerome@clause.io"},"dist":{"integrity":"sha512-/RdGNhSWbvqJ0Bo8x1OOMolenL2jDp6Tn74IynhXfxi73UV55klhqqp2qZpMYLvhqBeO+hLUZw+DQJ+3gIzL+Q==","shasum":"a3142a200d8ece4e987f1e68c5b38465391a250a","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.71.8-20190915202838.tgz","fileCount":103,"unpackedSize":1373643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdfp8ECRA9TVsSAnZWagAAtQYP/ReAIVOvzcoFTmx+X/Cs\nY8k5IFe66GrBBUhw9xGySdCkU5xvqMi5mRC6fz7h7QUIAu5FPfa/b2ZoG2ni\np4FYQt4nTqFr82/62LCBN0zvPFavG6pieDwOPOSDSui3zzTMlcvPgha1kQQh\nxldi71Aa3e4LX1hCb95gosIZYqDRtA9P3WTI/7FuaKbBe2w8snilxInJlGGg\nABYT5IZVD1+30ZHmUTm5LhEnLJ9VZ0zBIHL+q15qlPrPAdFsgW/Fjda+X1cQ\nvMSJ23VaqHmp33tGWm1+PGjx5XFlztxRDvklVwZtCEiRYYTpBBLK6wqgV9/0\nujj4rBnTcQfNsa3vyO+JtAtmjREDzxD5fQVu9rFiKJ77SG4lKgYZ94Fi0tXP\nP4zdlKWo8iNkZED7Kbr0Twnymod+v+DL1lWuqIA7bSK5cYxrEvuDvWdRLZXx\nQUW6XKWzS6hpnNlQjYqWkGxn7X2GmzqQPvEgELgD0saCjLQkoEUhCLVRMAyr\n5LOQLYeoSnhRyUvur7PKVFBvCyogSgP/9pAeacYSFc8mVlDYPKD7qWwvgCy6\nyEBO8wcJ/A7Q2YIJ13Oe+5sUij47mO4L6utMmVSwXt/97tdxQ8h+oZbekrH0\nFHH+J69rLumaiyjVzxrMb6q+qKsrbJ2bvn6hPZh3SCOMaS4xZ05S0baM/Vht\nOQaP\r\n=AA9p\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDsMKp0x9u+1Xg56sBvBDzFh/WYlVHagNIz94Ua/KVApQIhAJIbYxMw8kMgAWdVuAAALlLP7Q7vGlDTEZ1bW5RTZACj"}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.71.8-20190915202838_1568579331661_0.48962254613641676"},"_hasShrinkwrap":false},"0.80.0":{"name":"@accordproject/concerto","version":"0.80.0","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2","doctrine":"3.0.0"},"license-check-and-add-config":{"folder":"./lib","license":"LICENSE.txt","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE.txt","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"./markdown-license.txt"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"gitHead":"ad309eaf207f8e57f219d30dd574970e694f2e77","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.0","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"jsimeon","email":"jerome@clause.io"},"dist":{"integrity":"sha512-Y6ep67yh87CHC43lydxTjh11d7qq100BsgDIL7eegCkLe2mIXOkvH465k04ahm5Cvrx/mA5lEIdwWOPpVwAnDw==","shasum":"c322076404b42dcf7d852a120c294300a3e68863","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.0.tgz","fileCount":102,"unpackedSize":1373525,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdfp+7CRA9TVsSAnZWagAAJn4P/0JZ00sDXKX6V6KR1opM\nZ1OxF4HHeCN1U39ZsJE5dis/bUDVhQ4FmNws6WxZ5HEALCS90uiCmjUwAjHn\nEp7nXmS307sSazClx2WpjNiNymmV1SA9E1zgPn49A7ZdwFL2xzygKsmOLJQw\nbPiro+xSnblBEcuRFhPTFjx/MwlWiCi0BARO2h/8SYYxcLVgVdbB/btVJAl7\nTxkkXUVJtqX/jzuP1yMs6l7Td84Km84Wx5YKicTG+ENjdzvW3Au84l57arGJ\n5Yt8mlKKfoC77VlPLFt6WHDeVAajWVEuPdkeKjpFHWvmZGSMTbL0MEAlOgUg\nvzscBKkyjuslFJBLx48EFekGGM5fiQERtegEDyZcg/4z6qJNYryb3UQyeV+b\nNdfol/yQZ6slDXjEDpI/VUZIv/abCmLnmueHEG0cg64InaNrfcKo5DJ5LiXE\nHLp0U6c0amiUha4Zzy4Z0fW1kiVLafJuoonEdMKSrdYHc1Bc9/lSc2nq/HVx\n+KLNbMalNNT2M3i2iRFqkcvjLT0QjICJe/9YPnkY8D8LisXKlY0FZjrJ7r/n\nI1ICIO5a5rh6LURLH35maS6oXKPZoElxpi9COAW3k6UXzsLFMTdj5HHg/5rh\nSmH73b3W8FDb5KmQVdzyYCp8UjobEERLMNSBqIXjE76T958qTyhIMycux3UC\nkhaa\r\n=YUq8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCYAyo5D2ImCPUfIlCTyobzhzYiizOKvmeNry9y3n14owIhAM7GJNKLIst4NMKthr3g4QWFiw9K9gxadpwY2jLVEOxr"}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.0_1568579514163_0.6559136627352264"},"_hasShrinkwrap":false,"deprecated":"This project has been replaced by @accordproject/concerto-core"},"0.80.1-20190915203331":{"name":"@accordproject/concerto","version":"0.80.1-20190915203331","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2","doctrine":"3.0.0"},"license-check-and-add-config":{"folder":"./lib","license":"LICENSE.txt","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE.txt","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"./markdown-license.txt"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"gitHead":"ad309eaf207f8e57f219d30dd574970e694f2e77","readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.1-20190915203331","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"jsimeon","email":"jerome@clause.io"},"dist":{"integrity":"sha512-8VpEY84siUDkAQZ4e+rHYTKj1mQoi/83Bq649uP/2wE2KwX0BBZaDlKROdtfS3xXiUDBAxWXHxy4SfDJLj99FQ==","shasum":"56200e904de2bf81d2acca7387c74b1e5e775691","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.1-20190915203331.tgz","fileCount":103,"unpackedSize":1373643,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdfqAqCRA9TVsSAnZWagAAR7EP/jGZTlntsJXkBT/XPphB\npaza+5fgeXijGQMSeYOaSU/rD4UVtqpWJKugsN2eT3ehT/45PKo46eZRc8LW\nSpMlvUKdT8Q/edSmRqCo42yCRNPOnLd1hdPlb7Ma+spIRrJqXv83vLcZvNEC\nPprehFTYRva4Gqi1qcpWcxpATXJnBhrCA8/xVmweAuCJgkmT5gPbITPlzs04\naIMdPyghVqHoRRTY8perJLwx3UllOaAvuHul+XNIZrUmIUo7J2XQ9rAageoH\nfDVVocUNL+MA0uaxv7wKw/2yUE20m27huTXMNFApSgoazbW+ytM8rtRYq66j\nO5jPYZK+yKdiLfK6ZDKVrSJRuNFz06rpizhDW8LKv+U2elBnl4TR++pNDdeq\nhGdslYfQSRZXLb7c1x/WtDpoLQS+gpanH785jAMY5cMYjOec7tZA0ktWHSkA\nIOZUQRbzrb0MLpOoVd060ozFxoL9/laN+gDF6HlEKJMMihwUEpYKjZXyVsf2\nN8Zih93Jk3Bn8DXj8ERi2aqnsPWc7eJcL/gleDC+C5mVfRsf/6SjE5E9uLKe\nGWFWG+OuhY/5wEPZqvaAXHs4rg6i9Eh01gRLg1911LuDSdCOm2W5ikAEFUkk\n/vzp1vd2oh5OGUNCVmxg5w4KOnJpQkdhApOcKSq0KQdH9mdnan0NWIazySIt\n8/+r\r\n=EZ+1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCWenGzxUpWDz0bOFb9B7Xj50NjC+yhWa/Ie1wmDop8xQIhAPl0aFIW6gbwE9uiX/KXNKPVxXoJ2vqn7Fv4LhFIH9yg"}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.1-20190915203331_1568579625618_0.07072188969102622"},"_hasShrinkwrap":false},"0.80.1-20190916195745":{"name":"@accordproject/concerto","version":"0.80.1-20190916195745","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2","doctrine":"3.0.0"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"gitHead":"a9df963e7e36a03864359e6332fe68f60c37f797","readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.1-20190916195745","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"jsimeon","email":"jerome@clause.io"},"dist":{"integrity":"sha512-K4kOebukgcNolew6iikdFOqnlZhUXvzLJM158uA7Xpf5Dlg6V6TFhqdywJu2LOT0yLR7Z27JARhvg/RYnp4KBw==","shasum":"b44b0b8390a5a2e93cd3f19933612f83abf5dd12","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.1-20190916195745.tgz","fileCount":104,"unpackedSize":1373945,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdf+lHCRA9TVsSAnZWagAAlUgQAISqeS6sFexn4JYCfWgb\nJBBAOJXk30210AkV/ubxOWH5k3UHN/8pWdm0WA3ZO62kBrZBY7dwAKlDrC7T\n/Ji17oIbVbfLjTPv7KMUg5ZVZtJ7bFKCIsLurY4pukTiZ+77eOGJxZg10EDf\nl7Y1za5RKdxuZuXdN9yHoDZu2SugGZYAuvNtn6Ailgz8wCvjYBXJZO4f3x0q\nJJT7lkoW5oTiuxA25RNGt8qy9pDs6PDKgFFx++OhCi4OsmS6LRd5fE0VfWyV\nIaEAm8drG4BOHKT69jGvgPpwvD13HxA0RZGrx/mOpiZ3Pt2jeREsF5A9NZlm\n+98VQP60LjG1U/LSfE3mpYW/hWoq2l0vpeMhc+jAEtPrc36KnQwu1r6Zgkiv\nRiJGKWQ/dTp1VQ10pRq8gqjeIKJKZvfluWXa3JB8pQbrd+JPL3MTpHDnTzbx\n4Xr5GVHK5yK3EZ0fXnFfSDgBShTwQeClDCp6LLUT+YdJBz9bqgCo+2fLIQuB\ncKBZS4dswioPBLyTMwycjHtUwhORLYfrDPn9iSqLW3OiMS71pNcjFGnK6FwP\nfOO1RYnTUD7tNivSBdqz/LAk7gv5Ue5HCDm0kSWfxnTGYqAU40UWWpSaoAem\nec3Ad3JcHb2DPO455SSXkakWGVUc3PMb4hjSysj+TjsHFQh0k3suUxfd/ef9\nUPeA\r\n=Bzf4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCqUzUtQPvumzUKFMlXnSveWjzFb0fMKXGNaQw0pzpKlAIgfKK7ucPdVwKUHgNqBpBwxOtV5iEp+mFAWyxsYpKL10c="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.1-20190916195745_1568663878561_0.30186338307754235"},"_hasShrinkwrap":false},"0.80.2-20190925200615":{"name":"@accordproject/concerto","version":"0.80.2-20190925200615","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.2-20190925200615","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"jsimeon","email":"jerome@clause.io"},"dist":{"integrity":"sha512-K5WTHY7ObeuN54kP8uY4vKL4UD+IbQolBEEDXxVjoLzZPqLaKKnyLqpAPdOYJvKY710ch/cAHEQoYrsHnLm12w==","shasum":"b0512ef7c34ad1cfa14b5f16fb62c051e166b882","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.2-20190925200615.tgz","fileCount":77,"unpackedSize":1519367,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdi8jGCRA9TVsSAnZWagAAWiQP/jnqZ0SF5S4M1bxmPRTD\ncHjCEYXREEUcr4CL6AP4IF8ww+3eh8zyhFHhdeVSIcMJ7owyVpVvo2NsOe/P\ntwP2CQD9G2ykJi+SJXXnInre4rLuZ0bpA4kz8n7J1ZhJAv/sRKO1wzlXT6z/\nFN5LLeu19G4dAhYO30YlJKlcBDC+uxAJGNTQWvrTwnQw/zSBROXLwA+05r7F\n7khwM0Up5RESAR+zyzma3noddDRLPAgJLVUtY/tWkaDY3VGFpowNR5hbvKhz\nI2q85Ezg1O2gKCc2VWJspGW4QA/yG/LRywI4utzXr4Q9borfXNVlui4MEtiP\nyA9xtdgskqC0ZQejSyZPYy/1qNkJJdx7Yn/ivyW614GzVdZ759PT0c41S5DG\nemQcZz9mJ2U5IYOaZHGa3VB/uOS/OcNoOS6s0tDhAyBxXE3NbuOoFYgXHRZz\nWXIZfuyIKQSNFlUBZIenu+2aMY5zELpk1hPz8qnP8rFze9xAR9ZD14ji8nbG\navF07cM6rNhvJtwKnY0ZNNl4p4m3ugIasBAp6oPDBfvBA8v5Xka602+b9xBh\niU8kzCS/L4smghRYO4+/mjQvKzor0wYG8ZCVyYMTfVfBIvd+DjVutFTtObQi\nox2Yl8oQQaKhMOwymjJ5LYgBHIjYtGh8jWYRFXMb9FtWtYMzwNY4W0BT3aa4\n8TBn\r\n=lKNw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGMIs86t11VhSW1oRwX5t2o/Ihs+xyit9d7HJsrbsgOQAiEAou6Og5S0qSo8vSUGfCf/6UiQKvUYqULDC+zpn92nifI="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.2-20190925200615_1569441989985_0.470928582655294"},"_hasShrinkwrap":false},"0.80.2-20190925202544":{"name":"@accordproject/concerto","version":"0.80.2-20190925202544","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.2-20190925202544","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-qTQmiYDZ9IexXH48KnnYl7jgkvSHkuSCtrUTR1fWdB51Dx+eqMAAHfR1ZLFUHeC5FPLFXC700ZBNHk+hiQ03cw==","shasum":"de8c824bbbe24c84751b6891fa44f588cbf7cf4c","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.2-20190925202544.tgz","fileCount":77,"unpackedSize":1519367,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdi81XCRA9TVsSAnZWagAAFBUP/0eXRq0EUzi2u88R0qWN\nv63t/PnYygHgayva1Czljenop8VDajhYh5gbbvDpD6iBKKoCcNYSHLENsFq1\nRo8K9SftvfDmnXR0rgvMDutBOevBS+LrhHKjP0GdPViE8Q5jluHo5lIALQVA\nQ7LHDOE4FMAu5iAO84Kwf+Im/R8gSF2uWpcDmZZAmgzKyRn+g1RAE/onvAQ3\nR/jvMQqnFJUg0kPOfPFgduQg39VQE5UC2r6V5/dPfaxbCaagcnJEpjrMgyeJ\nb6nss7TXozTXMz4zlDoN356yaNsYiXk61p+8O1mpF3nGXePki8c3+7zo373/\n0CEwCFam6KYvzMrAbGMjojifWWehh/LffMLgA6th+HiCdkgAjKS0ZNFz+PsD\n/1iO18vvr6kypHZOK0kNoR64Tci+Ujobuu8KPmLcrmGeSP0f8p18WYJK3ard\nVmfO68ioU0q5rEXFzu0jLTte0zDLN6q9msRHd1K9nlw/KqfrkbmVTqKmubUT\n6dCBGcqSXde7AnJ0Sa5OLXYdG5WN3yn13qWq2brFW09ZvXB2wSrBWUNNB5ji\n+gqLCgnkqI1n0nlMOBtoAPS5EUXVWlvzrqpTGDIMAbxXSjN31qWbqaxFlyyr\n4485kj94Ctk2qJB18fyTzA/fdZAcW3jp35DRACNno6h9Wf3JMuMkrRLYWmbY\njaV5\r\n=y3l8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC4Je6H9CIqNG6OMvMGn5aYfckr86bpRqf6HYgtP7QgfQIhAOnKpxl8th3w9+nX9e94gDPJdhEOJDhi5gcj7QedNuCM"}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.2-20190925202544_1569443159230_0.5372917012670817"},"_hasShrinkwrap":false},"0.80.2-20190926121100":{"name":"@accordproject/concerto","version":"0.80.2-20190926121100","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.2-20190926121100","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-w9IX4S1wBBT79m/rF7rYbwpHtWx4xfhUilhSXikZL2sBi5f8vAsWFGUdrUmEB+LsjkWUD47aPgPj4Omq3ehxoQ==","shasum":"40112a0f1eaac93091051d9929b6db1ce42167d9","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.2-20190926121100.tgz","fileCount":77,"unpackedSize":1519367,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjKrkCRA9TVsSAnZWagAA/kAP/2zbUKiqID+bxqZlVVnm\nc5Z2wWMqtcpvth68nLOQxBdMQavZmLgxucKN2ukCC/F/W7Lnphcst00grgb9\nwm/2tTXsMBWeP7+kOC4miG70YdIRN5dzvx32vuqQ79EgC8CoVJzQ8K0Npcgi\nFwQD4jz3Dm8zkEyqkEATf/y3wMXEUhUt8XrNGaDM2yMGp9W7k6X6KDPPNxcU\nObxGTgotwEzJvivDSRwaMUdJEOTEg14rDy+4iAoL+fFNIZ3L1w4KTAkdIK07\n0WM188ck6siIkZhIvYk+JeWURSCk/8mx8JQQVUTi0BWsmchLI162Cgxugqxz\nPoK8DlTdeu+XlnYRjJUDNhBbYsmxrhMsycR9czcM0xrSGv1NUzz+kFcfq9ZE\nCCp9u5eOJFkxthAZq+eznQdPpseHZsjERyoTjS6lfaMvlWIxxxDrGwuI2o36\nrJhmCBObT6MRLdt9nk7J0iZiYgsU5CwKP9fJ9yFhpn6SC+l4uN4PGI7FHBrL\nSIkNV/NEov3MOpyuEifgY/OjQCrpkvb4jVVvKUejnc+xf3Rqe3MX/cSHwrtM\nzIM6x80qzoo2YqTo3x0FDGeAVEc9GkrcHoveUzxKXi0q3xmtbPhbXLCts5ui\nUMIIuElCOEEt76TfrR0TrHMIAkmio871zRWtv0lvWblvmLxXIjXtJe3BjxwL\n+Z70\r\n=Rnw4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEyi9a9Sg2WpcN3giBPe6B73xI/gIBKvgaIy5+xpB3GqAiEA+hKwVrMjDAjvEbu0L5BWU0BqU86luP4Dxrpu4ZoOzxs="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.2-20190926121100_1569499875560_0.7682961591834454"},"_hasShrinkwrap":false},"0.80.2-20190927134550":{"name":"@accordproject/concerto","version":"0.80.2-20190927134550","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.2-20190927134550","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-aazjPaBzCh8FlX4aJN07EDsg7uNaGdC94MhyoFArQYlNZUOfqx/b0WuRfaGXP1KS4a4r77F0ys6VbTXNNtH2Kw==","shasum":"63008f627accf62b0f916fce90ec2ce1acaa32c9","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.2-20190927134550.tgz","fileCount":76,"unpackedSize":1301153,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjhKdCRA9TVsSAnZWagAAU1AQAIabB9ImF8EmjeR30+JM\n+pluzB3G3gX1kP03etQFlQzz2OAaepMFBKdXNQorlzSOvCwSuiVMcbvJIazO\nvrk1Rp2CDlG2CDfGQZJDr+JlKh84pWJnTpCWfs2Jwin7FhTdM8PM23cFWNaF\nqYi/sVdMbgdq09EAkb0kfH+Ms7gsLQxZRbjGSxLPsE+QpNbbTD54NQ9Zpalc\nq7H1sEv/uQ0PsjifEPLt+b/d27h1xGXqQJx9QWn5IMKkroxukxOekFVZuRqL\nobIz3jK5nds3LKKTjh7h5JqjrXOWp5UlHfRn4ZgX6nS1AQVw+VnRWaVxgDYA\noMAKibxtmbNPRbYZC9aAFob0XuPHmc7AnTr+B/p5PqJT1KSysHi0PV3ojroX\n3im9XtoUJNGbqKWiNC4Y6Y9xZT7NH9jvCfKKTYMoNizV5aOy7mZURQJZxLJW\nEA/rP++B7un4A0fSQahlXPhzqK5AlDRuueM/pTk885fJrWRVSZ4y6l4Mt4pz\ncHI0rq+neoksHCdQ5CWvKP7qPYTrppCviTBivez5iz5kUPuqXb5QNYK+fxXS\nnedYHwIx67gzkRQuHL+UrtSyew7x9S2YIbVjri4HuqWxWOq3K/tebY3my2MJ\n1Dl6bMViD8cDYoCopMFjamQRe2hVWGOQnVdop64Ubu8scKue51g1mthdQlv3\nL9ts\r\n=PGkg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC4eieeRxrtnBRvWVqaIw3/EWu6gK9M+hAFpvQ+c7w4EQIgXOYHcpckxrV4q0mCw2FnFgrwB/4oxzDNkLYNHus74bA="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.2-20190927134550_1569591965097_0.6442070068574157"},"_hasShrinkwrap":false},"0.80.2-20190927152605":{"name":"@accordproject/concerto","version":"0.80.2-20190927152605","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.2-20190927152605","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-8TapyEVWFscfofsFUbGjXi9pGbxX0okS99abPkUsWgN9KQG3v4Bfn6t0zwTHmAINS27OYZnxv3oQJeFt2rpJVw==","shasum":"2d157dca79ebb33dfd74f6e4aebce59d4836569c","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.2-20190927152605.tgz","fileCount":76,"unpackedSize":1301153,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjiobCRA9TVsSAnZWagAAjlMP+wROv1mck+Y9GGQqNuSF\n5nfKYJRAhKpwwW6MLCbGvLMk6SHIDNmcb5RP4CRPZF86Zb5Ey+uTmKLhqf5u\nEFWNx9PqDa1i17tx5q/TlEiApPwYdkawW0YoWyRTFciMQhyo5608cccLBSbf\nsBpa6LZ+syTCN73gzn9/5EKnJDNEM3Xqs8vIj2YwKAvdKBaTte6/UoiyfeIj\nGeztPF7GWRb7XA/2XZrsK6hOIX0CnmL5dyeW+VOYIkkzce88uDbOkuDbi4YS\npGVTIiK8FZX1U+OXtr21hlrUwbOK7faZ1dX+9PiuasebXadzP1jaUY++8RU5\n3yYzijK3ImJJUsdwYUn/XODaQxZ+T7QBOdkoycyBvATT75WHgqkZZVk1LsG2\nNKPVIRptcVmdhEmvU9CzwXIIG8q0VZXpQWwW9tWzDTibXmNeMfLVYzOU038B\n7i2zP2tJf6B4q9kwC7tqKIuKEBH010dFRxvG4B/J3/apIDFHDMkk8NLgdO0w\nRqclGRFm2e4EpRjuQrOy4TCpwymbKiwb0ALXzx7gn5WecakjOGIla9fZysQp\n/R3kZSA3pM562mX9qocmfdvlMBhj143JapCSmfUvcoT6LowCmckM2yd5Y5Fd\nlHN72xZ0CCSgWVQ7hq+9DSGwlHWnPaXQqza3igcELcyOTy9uY/iussUviUHk\nm9+N\r\n=KYey\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDKHD4FRZJ5KRhBMCF66/FOP09TxEEi/CaBDSI7fPO/cAiAnNIkxG00M3N3pafiSo0bE+yQr1HWYrH6eAhZXdPl4sA=="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.2-20190927152605_1569597979243_0.5334309534846966"},"_hasShrinkwrap":false},"0.80.2-20190927153010":{"name":"@accordproject/concerto","version":"0.80.2-20190927153010","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.2-20190927153010","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-6iYte+XQMgdOXbz+8L0swf1j3ri6urROBaLv38J0l5/9MnTpWhi+Y4eC+yqvdGKNXBM/NjljoWMndRNLtuHyiw==","shasum":"b9e85a5edaf4339372ac79798b5f0216bf21b475","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.2-20190927153010.tgz","fileCount":76,"unpackedSize":1301153,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjisRCRA9TVsSAnZWagAAVXMP/iZSxWqDgTwpQPXj3nTl\nlxo8dsr39uy0ygmdKeyfWdWCGVeuM6KkCWoG7SJUptm+0Jx0oDaICdIfEMud\nDy8u3WMsmTAh0d83H48tuzcnAv//2CHfX1cRoyP6k/lw2cx4mz1P2SjWQoiH\nTZcuiDyqKHnRWU8UV49m7l4k8QgiSz17MGDtu8fFSz5ipewQPglkNRwap+r/\nGJFTqwp4W8ZmKW+oqQKOT2jAE58dksX0GwQvoESg9BcHwSZU8fIo3euAHleI\nGRzIeITDAT8wSPmV9qQrButlR3QtjE7pJ91GHlY9MZ/vigINkdPYyRuxt28A\ngRUq1Dnc20izhnBvRHwG5Kgt1lfgxlOdfegDxctERhIGdTPP7nOi6VjXX9GG\nOv1VYqJoUe9OuuNJgdeUdFRRI/KRD0UffC2Tq0H4IT54q6jLZHzN2PyyiztH\nwnJesZ8yqyC6vYvay71KEWmmDL/stNi1mNWOtkAaeqXFuJcQX6A7TPiIDmAL\nP9A+3hr6o9RfQBqMvtzfZIjlxf2CmuYb71+6nttN5t4/7N1FIUsef7irPC7Y\n9PYOEO1499XTcvR47/SG2z5MDmPjRmsFRf9VT5euxcSWghp7iwpRISS8yGFY\nJGgoJY3cofLr98XJ4vtHonT4K5CjGzhUrrTrx7vOBukN85v+IPJfFse+xXSn\n0hoo\r\n=2ZG+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE+n8MhIMchcqKqR2Xbl1x/4Oe8MMe14HadwmXUGFn+uAiEAyyzwMALm1TFlQ8Oh/wrkR+AEYt8NJiVCi4OahkO+vr0="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.2-20190927153010_1569598225004_0.5779512808782867"},"_hasShrinkwrap":false},"0.80.2":{"name":"@accordproject/concerto","version":"0.80.2","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.2","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-FDCL7B+oq4Jk0HmqqocmeZIXI0XrUV6gHw/1UvFQUxnm4IioOtP/XbnsRmiTMKFgDe26Qnyn7wWeT+tegy9TQQ==","shasum":"63512862cefbd250ff1798958e94a362bcbac872","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.2.tgz","fileCount":76,"unpackedSize":1299621,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjjMbCRA9TVsSAnZWagAAc5wP+gLK+a1J3xoWEmz4GswA\nHH5ToknbDQIvX1q/M+U8trKwLWu1Ljo1Pj0cA95xB86jpcKP8RtVRaus3v1u\nZj0I8PtYh4AXeNGpOh7rlnmmOQnbpqObiZe7ToS+/SEieuaaxJzaD86BWHM+\nnQ9h6CkaZjIy7NYxxCfvlKD5hVEbnnAt7q3GWIxf04tUNYKnVrEVJ55oAqGg\nXjvf9GuGVeXXdW8tPYkUphOZNr9Ku9YPzz7FK3tE7g15RFY0dELEugt+Y5rd\nf7gPho6McRqu9u9ttFX85S8qbGqPdCtukjzTGGLCzhMW4Qkq/lg6Gf/AAMTS\nzJcrIFDmMpFKKLbqdLZNz+9UePBd0pvtHv/fIweN6SpM+nswb4bCpEndAl2i\n2NvV2GrvMtRtJ70vSt/f0CH8EHgWgjeL+nC+iI9SElef165ARCF3L+AXD17p\nbmwOCYSBvIQhoJ6a+22zO0a5dyiGh8CClsZYQv91l93yNkcnr1ZJOyswbRHI\nJ83r0TTe2dUvuIEG0ZxXTVOnGNsNhtrYMn/Az7wq84eJ18H4f6iNhHJ/atyt\nZVZ/h5TsStkfQRUn5A7LN0wYIfgswKqNHY31+mqlRyiuwdOzuRhyHgIJs/zk\n2fxX/26+DhfCCgTLmgchpZWxSPrYB2wOrlObfhN2MHUlssCJMW1Fn0dXsCD6\nLoiD\r\n=GTpt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE4vOCJOZMcnrhQAnEMy0+Dv4HcBphUtPx6njBGLIfKpAiEA4M8fPW7wKfdPS05Uz0yydBcEt6W+iCNA5jrHDG+6ERE="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.2_1569600282868_0.0922199848570171"},"_hasShrinkwrap":false,"deprecated":"This project has been replaced by @accordproject/concerto-core"},"0.80.3-20190927160708":{"name":"@accordproject/concerto","version":"0.80.3-20190927160708","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.3-20190927160708","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-64fu4ifnvcq3uA9lPj73mCIEJ5dYdirf/dcai5YaQf13d2/zS6XQl+9n54mOf8dgbcPSsUuD3+y4hEsMP5ESxg==","shasum":"063adcdb0291a30bbf13d60a922538a26becc8ea","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.3-20190927160708.tgz","fileCount":76,"unpackedSize":1301153,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjjO7CRA9TVsSAnZWagAA9uIQAIuCGExNrfL2x7q8Dnn+\nXfK05drlAPdErn9x3HTWdZV6IoMSKWSg0j+hRXT6LjWGkBIF78lQqQ6Ckzlt\nNSFZeJmcBwJ+kaHgC6Jqo+ry1WF1QVJpQYr6l4bTYVJLtzfqj+3Yly1NnRJl\np6tVbeUaqu4ioanPUUgE7J4HQ5dDF9oIKjUfy+jaY8fphCozIKavUMOsJgTW\nUrwEzes26Lqwx8yLLA9Hu/W0nmVeV9dMX4h3ZTmayEQLvw7TmctpB0bY5jjz\nre1Yx+OZyMzkKAyKoRxDImYDTfQ+kDnePlkgXqzgXiRFdz0fAvOAe7wumLvS\nFr1UauP07mRAHO2lPFMrr4xb4lrT0TZd6QvnMQ7Ml9bsPCJ6F1zQYFTwdwi3\nOQSNlzCLBs+y2oxNQLwb4K+xS2PNdYe/DdpC0AQkgGh+7MAR5/3GeWvi/uyO\nGHwdN0LN2l4ZeonkFSXbEJKFsVMm3ZB29YgO7a7oXznAi2KJebHqoDFjKocZ\nGtDoRr+35+ojUDRneXVUpqYinoCbX/U7XvY/iA7CiQCRGFjxDmQzBVWwxxus\nwFN49gII2c4UmNSY2dT470CX/HsCXYRf3aGGnJpa7gxAea/g6wTjLvD2EWvB\n0PltKP7NM5osHMNroCRUyETr2ThxvcJgXkRdCOyli7iBCiZ4EvVuHJsuYWXc\n7h1g\r\n=1tsn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHrcJ/mxGA0ramCCOYY/bV5CGBXHOZ1DirTK8WudxQ/PAiEAzbmO8uSdQXdvYG2/9FsT7lJJk1jyJtDDHUk+qq8Zla8="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.3-20190927160708_1569600442385_0.34005850473022714"},"_hasShrinkwrap":false},"0.80.3-20190927160814":{"name":"@accordproject/concerto","version":"0.80.3-20190927160814","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.3-20190927160814","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-oS7OLmBEFfonTXmyw169iQlxSPwe6+/yyQRonO1mdFmal4AS76qXuPj+XTneCCFnoxTf2jHPD7hCJ/GthLxzgw==","shasum":"d80f3edbefe09a3fc4fc4de44a45673834b15bbb","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.3-20190927160814.tgz","fileCount":76,"unpackedSize":1301153,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjjP8CRA9TVsSAnZWagAAl/cP/20+0qV/gd24kHsRDDVu\nC3zpB28m+qe+/R6uIJOpUtcvXsjy+wfATiYV6ZTd3K49HyQFJlcwIJovWlb7\n2l2qYbBM59fKnuLPmXQ+QUHaU7wOAkncMpj5WNqiYVIOMpStuT2adhQG+rKl\nxpNj3ZNneTtyNzxfj5sEPbpvj9A4Mxira7xcMmDnzQrAtBZYwfOqYzv0igEW\n6eNc2OWsSbFfuH2/SN05lyi3LahocSSdinb4BsnTT+4j/Ty+0ilkRgWWbKVV\nW4C7tibexokMYShtM6D7LYxP0snW1af6v1/xi2Q3QSky24zIi9ng+avd9UQC\n9vyKWpqcIwNlHwD1XIrIdjk4OmKOeNuFu/+1pNYT9ZOlJ5HBpO786VV8UBjR\n0fuOELlWYyNYu1kt34GCXX9Dzxd0/IemNr5pJrhPIAPbcItn76C7gNgUyNw/\ngEV+BoYewRmSAUQUvhvVcJzd2VopMLh5nes4KQRaBnHwth13SzkDw/okv+MR\nxEowd3vA9Y2E6YIdGq/1XdAjAI3kHdXrsh41KtEhNROlWz5J3RhSfjB9gdcZ\nPkca/TJG8+PleXxMaSuny1KBIJFJMBjOGbsHeWvBo4h616aZfO4YolPuUR95\nRKehSESsfyvAis/Zj4YccbVxev0DHOcDpPOzZJOYzKun0+kuELZVT2Gmcq9C\ny4lM\r\n=tLDp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHPd6so3OQwXMksPI1b0iUNG9iq/GC1P73EHZouaHFFtAiEA70Mpn+FNIGVBsIeh4gUOh09MMFmGzfZ7wNdOmIsdD04="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.3-20190927160814_1569600508172_0.08620012238178854"},"_hasShrinkwrap":false},"0.80.3-20190927165102":{"name":"@accordproject/concerto","version":"0.80.3-20190927165102","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.3-20190927165102","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-qgS4/JZVaBkEcfXMr3oC/M0Devg8Tajlg1yb2XKQa15V1ZREaQqeGD+AoM8qZLIGzQxFhDjbTPlq0zSNYBa/3A==","shasum":"dae25004e28851176adc5450d117c0c6e7cda36e","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.3-20190927165102.tgz","fileCount":76,"unpackedSize":1301153,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjj4FCRA9TVsSAnZWagAAE7QP/iiFcZIU6s8A6ldm4DmI\n5mpkiSsnJbYN5zcGh3simLGg26lWyyL3PoRIQJ+jRm6/FseHol9YpA0czrxT\nUrYheB/Q61GSZ7yC5bW4zRI/URk3nv/7KUg6hHy5qvRVzHylF66dfD3Ww5HQ\np8CXCR9sAvhBvRo3IDfCS0ZGMSGcqQoqW92vOb9HGWCuA4G6/0vN2q13vHMe\nOoV+nhQ2PeRL5L2WL/Z3tH/VDEhpqqj6ztUqHrzqOS2jbwjmT6/aOdqGy0gw\ni1U1bSNQHW3ecjps/uQ6jkEx1hU3wNsFksb5RmZvmp0U6vawA7/CWGgcQGjJ\nqtCWBPjQkGujyvLWWH7k2k7O9SuQVv2XISxNok77X6YsQOKq8VSXHxdXRiFI\nzG/bprMZvtXzqk7mfD47t2Gfee9fGzJ4MetxdqhgckxkA2fF/BKlkcnc9s2P\nGFNBOSXnC34b2yqvbTLYb4kzsovRnzXqKVZNyMDkZADTOkhUgoPaAX1LDe3H\nqKcojKhQoiJbKfDZtKDvVz9NFktaEJSWsACHZUX8ZXhyzJ0W3IVTUZjwJLQu\n/UbJRdp4PkamJFQQUkotGUS5IMFXJUJamMGsDnxO0CJsfEGa3n3VHxm8x6EB\nWw7ShdyWNKgo8xKh+UHx0rcI72icOXOTKrygXJPS5pQQv5DMFA9Ps8LiA8Cv\nfFzR\r\n=RQUA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCfXZTMIEGJnEjUiWzn5qH4lfVcgHhyBOU42/3Yt3deDAIhAI2Df01rdJTFqylZobN6+NBWgxwDyjG6LmnQ/vLYy5q+"}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.3-20190927165102_1569603076293_0.85397120137112"},"_hasShrinkwrap":false},"0.80.3":{"name":"@accordproject/concerto","version":"0.80.3","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.3","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-88hPzFt9mQxZmisnLDx6S+YGEGUHH1qknU+Z8hsBoLSZxGk1QYcTiH41enABVaLBPDhb8hs6lymmkQ0ppi/rTw==","shasum":"4af92a436031ea91320f224469c0c3d8672a46f1","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.3.tgz","fileCount":76,"unpackedSize":1299621,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjj6lCRA9TVsSAnZWagAA6igP/14vZX0wbzP+31j3bH2I\njVIGIxaT3NGcT0LC6oSRoauYpaBr++qa11z6mWIqISgDWKFXDKkiVlC0lkUf\naIGHuNGu5FBZNPH7q8ihcV8LW49iVyCg6QuJKsv3CK33dqTvYTIw8hzc1CHX\nk6vqR7IElPtPmdCcXoEODUyFf6zHO1CvcTy2HXB3IfphrrROVXQ1Dpfghqcx\neLYlx/UufoMzM8ekYJQYj+za20oVo50/EDh7aRmwCsY/dYHheYLdP4pLNHxl\nNuNxvVJnS1xRqYuWPfcBnGgePRpeZnENUyYlEjLegsTNXuW71/gCJWPp7vCz\nwBwYZ+vmgDjPnrYWuQFlaR5CzJ7FB0+3Xz7jbjskaBGvtC5LTSTolohPC1zj\n9FSd35KQLimPLxsdD1qhkxkFgifHRY/D4aZaT4eKNCx9/05TWBLttFXF++oE\nsiSJsWjA8j8POWFaa1uNTANvM8vtpsrEtl96n5nuPy7VG+UcneAtoGcsId+Z\n3sWAT3g2uCvCbB1hTqWf9OqNDH4BFTrvvIvDly3tfhCnveWaMWa4RkNiBDCH\niYO5iiq+vPWfuTiC826wK2KEu+GP6ptmat3pEPyaWriAjdJG5SQPQ8URyzi1\njQlXflm60ZaRMHdwl6ZuFQVuwJt2fO7r1TXZiF1LwQ4di3sju03Wx9gtpYil\n8Yel\r\n=NkaA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIChsFg3AmJQek3oirsdPqyzFbGw9FlryA4uwMeb1VcxTAiEAod2X2vgehAjgSO6is3obX0/hfHRsjFMVPggrA+e7uwM="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.3_1569603236626_0.7621967082344177"},"_hasShrinkwrap":false,"deprecated":"This project has been replaced by @accordproject/concerto-core"},"0.80.4-20190927165630":{"name":"@accordproject/concerto","version":"0.80.4-20190927165630","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.4-20190927165630","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-XBmgl6BP1D8VzdkZjx0Fnsk5OrvpZBEHefZf+AqFtnZRvPAGoLmlKNwcjlwjJfez8HnMi3ofMe+oPhGtl1NRGQ==","shasum":"5d075fb138951e72310642e942c34a19c25de740","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.4-20190927165630.tgz","fileCount":76,"unpackedSize":1301153,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjj9NCRA9TVsSAnZWagAACVMP/1hWe3hse3gkaNCyJAKv\n3ucpMTyx8r/2TIQK3OoCbhDwRxx1Uk95GlRKsQoNBJc+BXrTKbwRToHOIBDt\n0o+9UTLjqIRVpPkirL5OTPmjeRLbaxMemESFrBvvZDlnuh0eobXZvp4XZydN\nXg2wiXXtcupZ67ckpdjoh3Xh2oCqaCAuItIvxfRNtYfPch5ODl/XzQ+/msgP\nQoeXZcdLM07KmIPA/YK3CTWRDYaOQziFJ8CIR4UUiLcJiPTLsD6TdXH6Jz0Q\ngvvoUlLv+CHQr7vsvO+9QcqkTLawV+R3GX+ZwezqXwydO1j7GfqyxxlAwUqJ\n/MVJD0LhoOKQ5fIwA+n8elfOm4FdgYibGaYsBjenYEAUc5jajfw6pHvfai4f\n4OsvmfCYVLM2TYQjV7rI/eV7IxaJlhJvtKecdiLRgJQeBNi9m1obxYw2kXIS\nfAGwjptNmOUjQUA0ndVNEe0wTR73mHa1H2fVa9MJBLu3rAth7RtJGNiZxOGP\nGpQqfKa75Pl9bPov2YeILdsx8lIA3QWssaYqebDsX+cbfvUQi8Xui/mYbF7u\nhaCRInIujugOp4FjR4C76bFONFq0QXBitVGbDM47o6cbW/XFzxN4wOPfOqwC\n014PsJ9HU4jOfs9AeJaxCdQK62v7YDaQFHt35Ad/sfAK7IO/obW9rQMrDfFS\nfTij\r\n=yxOn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDb6lKQ2io/Ayeek4zgweSaq2PTKKdoWBb0mg1+/YOuHgIgN/cgyG2OOP/Wkwovohh9OZVxdqm+V/aBrmCK912k688="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.4-20190927165630_1569603404493_0.7103961997666726"},"_hasShrinkwrap":false},"0.80.4-20191001132104":{"name":"@accordproject/concerto","version":"0.80.4-20191001132104","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.4-20191001132104","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-fULkCwO5RISqcK8c1h7ocfXnBmlcf4xe41XoJaJDxWqBk6uhh09fca12XaVa6ter4rkEw0kxDEPPUYUc6w37BA==","shasum":"84e47956f8479f7d320a5d0cbf6dd3fc63755dff","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.4-20191001132104.tgz","fileCount":76,"unpackedSize":1301161,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdk1LOCRA9TVsSAnZWagAAPa4QAIZEMOALD815DJ1yX0EU\nsyhDaV+PwmgYPRcRIMymafTw+s55JQq14R3hfpt6yr+47ymTPFKVmOzoA95I\n+eIYLj+E+lN/s6GUAVb1rD+jOSiLFtTV39nKFsSy7C4kg6I8BRCisOP3oB7G\n0dlYYk0IKwZHCRw+eOhaneAR/i/LEEepb5lnRL/Xr0gCchj3QxGpw9N/lesI\n31Mvj2BK62C6NFvc9DWy/6xJO+ITeRIn6e95E9YQd8oA1zIUls3KU8FufQUR\nid5R7fQ0ZCsGAUhrWrppSrTJndXzeXTXzAa2mtcuHFw+kgmhPcz8oHUr2eK6\nyeoy3Xza5C4jdQcvBYEJKsnPY+yjoK14UgcdtsGal9UG7u/KS67ksOV5kkhL\nRJplhZ4PwL1sM9d6zTunSuU5RedYe9KQE4LQJZcQbrs7JgyqZZtGmt6jAi8V\n9RmTY/s8z+SKEpMjvXJxGtspbC6z+1xFzfa/U+nF9sjCkwqyMufA7s8Ukjlr\nYEd1cFxcXA7+ff3i5mOLkw0Dp3J7UgKeGejapxnAPKYbtr54oyfuClBM84VA\nTNibOR6sRMgVLzhOP3E/jw1IKm9zr2wsa/lmsFOYuF8v4uBuE8MBKMXmUoB4\nOwSI9FtNlIHgOB5XkA7URBi0UBB1KxM2zt83Q2hNKHxR7DUBxLQnQgqME6ui\n2Kkh\r\n=D0ks\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC5Ct0t2ejr6g79gywTUmPQBr+SMAwHKE3VP4bEJKDSIAiB3AV9X16o1WW5P6vccE9lGap3xH4ArjR6T7CXhpcSiAA=="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.4-20191001132104_1569936077505_0.8372374071229347"},"_hasShrinkwrap":false},"0.80.4-20191001132607":{"name":"@accordproject/concerto","version":"0.80.4-20191001132607","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.4-20191001132607","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-t0K/0m9hn1XdCExyi4RUoMKAciLnCEafRD1cm1WxjskHfbvbFk12/Ok7dqw9o4wbYi/tN85d0O321W4wt7wpLA==","shasum":"8365216f8b4972a8bc923d7f7b34777285c0629e","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.4-20191001132607.tgz","fileCount":76,"unpackedSize":1301161,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdk1P+CRA9TVsSAnZWagAAC9MP/j2ENvJ7+Pn2BlFUeEuO\n+bSX8ImL6HIzlxBIFE8gXqIPdb1TM7nai7RiQsdB91CZ5XEzMP7MYMEEEaju\nOLzqBcE0PJxhE1aJXrzoBvI2Ev/Z1GtFLK/LtTQ1PxpwO0qAJstDaT0/0w9S\nura2OhxeB6L1S7RFKuL/aR1W8pMCOznddzXCh7J6s5EP3zI+WXeY7hz5wcFJ\n3nmlclnMSL2dOf2tDctZDopmSP6RbENsV23J2BEzLWSBZSU8sFntvkAUfn8I\nsFfxt0WDnDTt6AjM+QRSlJLTMUsw64rnP31a+hBeqs6luBtvH5yU5I4XD4NS\ntx8z983QrorWHUBoea8bWBcyPjOywuT0Qj6xF4yENttiyf42iGuF5E8ai4ZL\nBp8LsgV7PEXLjS4O2CQTljn+lWoSUCJaGxIroC1T+JM0xWAUDhwEuqUjQE0D\n0QYCwIskxNeQ5yUq+7u7cPgYBaj/O+Kquzx2OEI1JDp5xCkaKP9YNJ3BVYZS\nAOhfuLSA5HAV88Pry3MZgm4wTO2gCFVy5RkS9fuAnReFVn7xQCxg4RNDrfoA\n2DT4mkW6cq5SFg7XssQAY+3jr9U9Zs6OzGPSwOwcISNu7x/WrHANhbg6JOVw\nzLVU9GYkIPNAR8RjHI7ArJZsIqKCy3ytgFwfFBSlU8idkc9UwD5U8mEwcgh8\ny/Oz\r\n=Mm4j\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICjwKM53KFvYDRyNLLeIPGcFF8sQ9yZWSPkeJ4flNemnAiBxrAK75S88o6SzPaMZ2v/KcGKQCL4RDS9Sypy3HO945w=="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.4-20191001132607_1569936381901_0.8096702323574525"},"_hasShrinkwrap":false},"0.80.4-20191002062052":{"name":"@accordproject/concerto","version":"0.80.4-20191002062052","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.4-20191002062052","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-ZRuInc0pJxu+ijBbVVccc40jFSuTjjWKPnN19hyBH1Msu9bhgTAmZXCMgBYasaGgGhNPwFqasolvMb/SCF7QYg==","shasum":"488f1ae85bd5e79a63781f8c54dcc3f3e8a9ef39","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.4-20191002062052.tgz","fileCount":76,"unpackedSize":1301274,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdlEHSCRA9TVsSAnZWagAAC8cQAJY9GgU8LqRH03L5hVBD\ngj3gwK6P5w6zLLOlXXyrHhTnXajUxTfkF2mXwxSqeXZdCdC2sR4YjqnQxwyS\nmGt3DY9amFJMm3c0YhjqZUQsSj3NnhKXIT/4tNDxlxohSVfxAb+8Y/UnsvsY\ni/w42jL8OuHd81SMoVQewS/telPaD8vzTjKwXF1c+v38hSlfyYRwtL1+cd6K\nGXAPAL6b9Vlb1VzCH0PjZmwvFmUOGxTV4idxt92COaXWQDons/Wj/SIjcf/t\nB6/Z8KgrZ428GkJ6G0/sDEkTdWUKXP1IvLcFPFfZuDvo7Fr+/IyxhK7Pcg6U\nb2jSIbqWEBLB39ieNIdikedl/gUIIg1BA8c5sh7yb9pVr3OgccJ7iEJrc5f8\nRge1ScE01BL1M6sxkcU91469YJXwPt1qNXpMJnuaEsMX9cZz8fDbz2waJ3Yp\nREcmG286P8YKDR7Pf8W9z+IxcCPzUQl8IvKs+mk5Y+2mfzBXr3OEgpTAT8xP\nAwfFhx7CgDaAPGjrlDsxSL1nhZfuWXpog6JaowzmdS2E4bdU91lqpQmmaDWT\nNs6INU99KCDOJ9JnWPUZdpQIFCzrabr364Lw8hp6QX+15pY2arQrghg4mzcC\nlyXyC5A/qxYmYv9CKGqzL1HCyRunxmFFysDrmaRfpk5Hn2E1ePVCN6nZ+cXS\ngnKc\r\n=QTZS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCXzw1zF33Ipchdu1bm5DFCE/GVIT62SWO15qfmFXD1cwIgFrBYg8xvKDkt9LORN5Ij11LDACpw9Qp+q4+HwswkmPU="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.4-20191002062052_1569997265708_0.08723202145175835"},"_hasShrinkwrap":false},"0.80.4-20191002070543":{"name":"@accordproject/concerto","version":"0.80.4-20191002070543","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.3.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.4-20191002070543","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-iC0X2+SSTQ1eJc7SkB3viQw+HL8jicwgv7/mb2GqQCiN2IGptOVCsRWlpNRKMl8jIGQ19ZVR3vP8UxhQJCPyGg==","shasum":"b47d7d01dbec9f514489714b70e63987ebc89f84","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.4-20191002070543.tgz","fileCount":76,"unpackedSize":1301277,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdlExXCRA9TVsSAnZWagAAp+4P/jzjzk/IGDVdZH0WfFiK\nNjzoLMYoWWR+UxSHFv+OaqGasSzt4s2P57yDn0PVNCabDmBWSGjYgDVcqsh/\ncE1wkVCLIxgLRvIKHYJmSdhGgzxSQ042zQpFmQBLu265Zk4Z02oyZtv5a9Ef\n4VW4pBgnNRYgZr6ctam48znh29bNCNeIUqPdAWfHAqCFdMvlNqgIY4QFENq/\n1bjazgJi5/GwqCx4yT7AjthnJ6zTkVkYFSlURNzloAJlZMcvnkBXb/j7yOp9\nNDdz+rvPiKwlZ6RphhD3I2ToRhQYYiBDDiQiehOzBM+dVnGgcibnG9bXSMji\ncEjqfMHGaHHdoLkw1DFJIhhj6tGDUAy4eishUzs7H9UiBiTKqIM25OfXbNZi\nyKGC48EghwYsmbw+AqBC4+i+gnNYCeDbqQnZm8YjnSaCsGG4z+2QaAEQhiGM\nU+p4J/9+1+65TVkRcDJdjM2DarN0N8AbhblLs2MyfpkbXNihQD4J1fi0ls0Y\nKmIZb+Irlz0XgH1AIoHZq/wTouUQw7/yFz/Pzbrovk30EJmHJgreTkPkCfqY\nUwX5niRzAvFyWYQ8GhonqFhLeFMI/DvjFyZqhXzrZlDom+lTGo70nWNnXGYl\nGmenyzRylFdn/0AUvwFFDhLyJmiDQTYWvBOf67jFiSynNAwivCp8GMe7UCPL\nRDje\r\n=ZEvI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIELdGNpweRWFGWbbfekA5UiDGiQEwGJ07JgGxhMjO2GgAiEA9LPuftE66hP02yDTQ/HKCOlNAn9dsHKmZneyilRgOiE="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.4-20191002070543_1569999958871_0.29383170023825733"},"_hasShrinkwrap":false},"0.80.4-20191002070725":{"name":"@accordproject/concerto","version":"0.80.4-20191002070725","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.2.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.4-20191002070725","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-Jh3HNlOyKiqJxoKQZ7VhaBF9rCF6nkE5S0ilDRUf0Znk1Qd+R13CGRraFl9ojCE4M60FIpQfBLE3UppSGbTF6Q==","shasum":"ddecde3e7d36af7e6fbe4e87a1e42c820f944d9d","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.4-20191002070725.tgz","fileCount":76,"unpackedSize":1301274,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdlEy7CRA9TVsSAnZWagAAGkYP/0HcfswVzgQXvbznF2aA\nGMnVTDh4+Jd7QWwEGytO8Yk2DrG5bM4WzppZHNiuS/5esISytJjkuwMLeLZk\nu8V/8lYn41yNIaa5Ic+Ze2jM+jOmmeTktu0NUHdkECrVlsr2CNdaxV+5uArM\noIqvzMYdA1FAmPh0UJq1FTpyKkqs9gwmg3TC0T+rDoGi30zgpALFeIHvKvmo\n9E764hopXExzghvli9cVBRPq32te7RSoiCYEuVGYwUysNt6iThLhPFGUQFy4\nph7NZrNlmy3FHVYbmGJfo3QbrpQb15GLJwWGUnx+UUalwZIQ/tDnAQTVE3J9\nATmjCJIs0lY0jvVTkmddga/5QlK84oG2IE8tBfmAAFDHEndTq0yG53D+u7+9\nAfC1HzbZo2z/zEEw+VI3xg3u+d6qOA8et3SejpoGvPNg7vF0vJMe6Ua0G972\nHASeQ/85SN9KorY/T/GQSO877hztfkUUkO74N/joqdzsRFHDvynGvVb6lwAe\nPziQx8H94ZIPHtkGfwDeC/rohQ1IkxP3LZ/D87KxLmCeOtr/+GJLXu5mLJlf\ngOwCidTyW1mdQf4OaAqZjZAFlh82q3zzlJHjpioyeN8FG/hlCKwdMuLtpZ67\nnRM+aJjYo5jTk8qUhD8Jh8TRd1paF+sxOP05s865rKPAMdSqF5Y0/bY/wU4m\nrqJf\r\n=b2hz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA6cjQ/VaEcrXE3fCUfOja9WOXDqUVOCfNSZZ670lA1tAiEAuAQEEuSMGeM7ApjkuOcHClS13zuyCBP9iV+jXMbeQRY="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.4-20191002070725_1570000058674_0.5156170853680069"},"_hasShrinkwrap":false},"0.80.4-20191002122338":{"name":"@accordproject/concerto","version":"0.80.4-20191002122338","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.3.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.4-20191002122338","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-aqBOl1SL/+QG3ib2tGNMr9M4rirWYvF+zlpucjK+2wktiNTh3Y6rwWOh9Dpp5bmHwJdS2i+gva5TLdLE+bgong==","shasum":"ff74e54f180582d4a5adb2a1d9b31cb81cc406df","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.4-20191002122338.tgz","fileCount":76,"unpackedSize":1301277,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdlJbZCRA9TVsSAnZWagAAKREP/1qH72Uo95UK6Fv22fZC\nFYfdofymY1kcjM6YiXr/rR6W75xTBg7Qz4/6N5kilX2VQWxOUYOz2pHU3Taq\n1DUWlb4u+fG11YsqzO+OE3A2+fLA+dk5TBqVOC22b7Blb4p4dGYf0EmDvoD3\nyQ2dvu35dw/8HDZuzknnzOcMJH0OwNz30PXYc8DpWdbnWROWL9B4JtLh8d1f\nEQaO3nhzBvGtMEgCLRnE8rvqGiG0pZo774GHM5icD5t4l/msonx1VBTgArWs\na4D8zGlKLfgy1Rc15GkyaQUe72Usc6O6xZKdSTSFHpgM1IRepSFQqjWLy365\n8eRGcN5m9JILg5pwco9Dkc6EQBmrriGdpEregAM4Y+pLQz2P95eJqkxi7Gpj\nF5nXa3yLvftaeg9M2k8rgvmeaew5sPlSzx87DyluAgoUvBGDFRGcpoIBbPkj\nBCQ9JTDWYXuQZ/932+tqM4nwBI1VscxezZbhdXESZbsR/8uewYxcqBBPJFdU\nEyZFSfvXTvw6Vsnqrr8FHeUPj45suW4sM+rN5ZzPr9n6OSObd+QHs1oaZfpP\nKYa7+s+sLncRU0rfZb4kHw3DObZmCUAkSUbAuQJjuI3rIR8Gui0CndHOMPRx\nds37wdXPYHwW21SBk2PqLydSjEu9LAbZD60TsYk9wl8C5TolZVeSdD7rYg7u\n4Hua\r\n=35GH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFvymIia9vzlSagndyWxJKd2KTrfHRQQpZ9gzaTARhrNAiAXPx0vI4Fin97l4WHYISDElXmHbuTbK9c0NoJw7TQygQ=="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.4-20191002122338_1570019032635_0.5062812792030749"},"_hasShrinkwrap":false},"0.80.4-20191003082908":{"name":"@accordproject/concerto","version":"0.80.4-20191003082908","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.3.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.4-20191003082908","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-+uQi4K6GgIKpN5oqHHhyZrvdgJ9p4QFTUqILE8Ks1tf1pi/XBwelTemOg43zqo+VZYpdGJQk//Vi3dqqHaq2DA==","shasum":"627cd62cbabdf787ef1a337efe0c6b0ba6842b54","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.4-20191003082908.tgz","fileCount":76,"unpackedSize":1301277,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdlbFjCRA9TVsSAnZWagAANxUQAJYcpX+jhGqCHoNwsfmb\nOznEitVXQ9hu8e0EAT/poXq3tywlP5gQ0GbnUv2pgLqKcqDPActAtq1NDTxh\nj/J8xCp0+qhL97s+cpX9rcwOzwHfByAticMJFHzABGqWldsJslNBvUiu9UCH\nBwQHiXvnkWIOAmIrxHOz0lHNVMrMnzSxQmMHkclooFCsvLjz7cRkppxH6ksk\nMTj8HyDNDrA/6Vjox9aEYGrW/n/8aXyFeRI+DqTrOPagBvDM7KHgpl1N5m6A\nygVDCR2k7ZLVfEP/US5Z2mysq4sTdM70d6H9u4o3EiplaJxnQAKROyJ0o30I\nguLmUPKHpvq41ECw/Wbo20B8R7mLOTuTLfz1R4V+98MP5XsybavRtDv0ZeQa\naKbVyFbCMTwEMsGBZu4CS4zbRn/m/MC63sxz5pN1g2qIjpYYcSQg3gbDtnfs\nO3n8xLyPBA+HfQ+FXhl8E9hAzZhhtPZ7bOr1GIxeCcEIqhHIKzago/901z/M\nvYlQFxvmNngnkyhmYWz7QY4iR8RlCaikC7eY8rVyjgKKRw/vMR0ImzfY6F2B\ntWMEgLzJAKZp7imgh/198KbG4oHXjnnZ9zQouL6Bm0P/p6odKpkY2CEbAki5\nTlN3QkygRQDuHCer4lRu0/zmSS4T76PD+KTWhlZWJGDcMQew4CX0LAzLDWSE\n6gwK\r\n=gmPN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDhoThgancIIEHwppsCX+mjAA6olFGQ6Lhd+5BI9B/SwgIhAPWkLiwmt27vJu1QAajCmq9Xs6uRAPoyKN+Hbm1GF2Xl"}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.4-20191003082908_1570091362330_0.22786232872737155"},"_hasShrinkwrap":false},"0.80.4-20191003114436":{"name":"@accordproject/concerto","version":"0.80.4-20191003114436","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"types/index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.3.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.4-20191003114436","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-XR8mxRONKID/XSZXyRlP+M1cHLfUL4RrGY0Xu/1mgucnNGAuMmcLaanuqvP2Y3GttBwxAljc6EGMnqDzeGkBrw==","shasum":"a6ae0ac12adf035c833d933da88e93c95fba58a4","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.4-20191003114436.tgz","fileCount":78,"unpackedSize":1316818,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdld8yCRA9TVsSAnZWagAApTsP/0LaDl0yXozfLWxRvciL\n7mRrBfr+PJXLrTT6J+nRpftkQf4k8txjS259w3agxTZ0+JuW1PZmSE8yGvAR\nG03apqR3JxeJXuPBPnTBHyi7ComXq27gcJe9VeZZ7DIIhqn05OC3mzc9UUC2\n3efa69Mh70w6Q0sxwJb5zbWvcLhIde1hZPuGXUT7WuQTtLhgudF1+tden9vb\n1ReWgqoxmxUbnR5ayRIWKxlgX6DJAF23wHdiFtnTjnt+KFAECkkVzmIgrjFI\nWNgqOujD1xCm1Az6LZBZjEqwCpwcBwOGA2L6zwIYLSwNgITUF4e7M4KqFS7A\nN/By4iwhjIKaR5yJtEsNNQeSxYNi/LaPavXmYkykoSs6qvQtNZu/PIRlt7Dt\n6MGJ4YtmJV0dNOk5caehoWei//MNHCwaI4GNUePcl6Yqs6sfqM+rNIpFkHXh\n5+XWVSRJS9ivSIbzZ8qmgPnvXF+9/b6DPQX4y/JP1dF+05WmJAEzGXHNZY66\nlq6wLLQ9WFI3S/Q3T9gTmSIFuuh1ZgkVIC/CUYwqn+v2rRyxfFESC82fxgzk\n/AfDeOPQUCezihrAG+uKl82wbWtN6ptUdHaEtg+TcKiwMDsElD5SfxLyi1fl\nzd7fGBsUySN10fSnWG0U86n7dsT/R6b9IdQJMVrkAs5Y/PK+QThkIKLnSF3b\n8GAv\r\n=xnfO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDhBbpNQMZ1BtjKkjl9e7TBP8KD8RsgSLci3gVy8lda+AiASND67jn0UDgrlKGdeZOORd6aVPfMpoEBEsMNbmaQRSg=="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.4-20191003114436_1570103090126_0.8437736343560027"},"_hasShrinkwrap":false},"0.80.4-20191003141535":{"name":"@accordproject/concerto","version":"0.80.4-20191003141535","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"types/index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","pkgcheck":"node ./scripts/pkgcheck.js","pkgstamp":"node ./scripts/pkgstamp.js","pkgbump":"node ./scripts/pkgbump.js && node ./scripts/pkgcheck.js --fix","pkgset":"node ./scripts/pkgset.js","depcheck":"node ./scripts/depcheck.js"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.3.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.4-20191003141535","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-24pwQp3IkdcvzJf2BuONJ3srO+SkYVqBppD1R2a09Xbnq9VcR0oB17yIipK6dJvZw/7C/a2CLjK2kilDs1Kl3A==","shasum":"04234c559843c094c4514445b6ff15311a9d4519","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.4-20191003141535.tgz","fileCount":78,"unpackedSize":1316818,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdlgKWCRA9TVsSAnZWagAAj2MP/ibwHDbEzdRTuJWA4vXH\nGEBU/9aJOrbxafpxhN5YSGgSW/ZaezVDPZ/opT7/cEWDFflFZVtVUq2exlKt\nfvyM3SXRaC30cg4Mk0YsCrc4ZP4XLcPzNKEZ1gPdjdg/RUxNlqUnxRUcV+Xz\nDfbJtos/JELVEcWKAV705kjcW5lL3hm1LYC72Oz3EHV2TK5e/UliGETzCQGi\nt7arPv3oviIuVGIhjY2xawud8fQX5Wr0/c9bPpCEtChK8nIFh3c7SLXMKQTp\nkFnU9S6vlZ4YbC2HizXLlpzK0n/NlOkG05SmKC01nrW1jn2m3DV/yzWAfCFw\nUjf0TRK/o8BYVOR6nkKhoLrJNkpvK1yan4/p0+Rg47ZQEl/hxQopcsOqRLqj\nH7NeK/JWejAQjU9Yu8HDLCZn4uLAWwFXPsBmX3Aom8XWk5Dfig1qJ58nmT00\nzcHc90eQQTUrAx1rhVeXOKzx6OanYmko4TWr2gABTjhnRv4GF2IcbOFeM6Zc\noPNPTN67gfY8gT3f/K4d36PxnfsCHkiH4FFIbODUjJevp+XjVpRCjwwrQiOc\neZX88FV9tOwnFSJIs0Da4pb61IIIuglV5r7G+52Mcnl43X8smTkiiIW+D12O\nM9m/gYHP4X/J8+2csdn+pNfeI+bZIUHI/CzbKPuw3lEysag/YCjinU9sQD8W\ngisf\r\n=fW5w\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnxtl5bWSy1NXMmQLEtSyeSJhQPTFI+dA3/veIjTSU5wIgJ+OGCa86RQTZMreSI+EZ78Q4yXjG7z/XjhveiO7ULwM="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.4-20191003141535_1570112149529_0.035529800979771986"},"_hasShrinkwrap":false},"0.80.4-20191003155034":{"name":"@accordproject/concerto","version":"0.80.4-20191003155034","description":"Concerto Modeling Language","engines":{"node":">=8","npm":">=5"},"main":"index.js","typings":"types/index.d.ts","scripts":{"prepublishOnly":"webpack --config webpack.config.js --mode production","prepare":"pegjs ./lib/introspect/parser.pegjs","pretest":"npm run lint","lint":"eslint .","postlint":"npm run licchk","licchk":"license-check-and-add","postlicchk":"npm run doc","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000"},"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"keywords":["blockchain","hyperledger","solutions"],"author":{"name":"accordproject.org"},"license":"Apache-2.0","devDependencies":{"babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1","chai":"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0","commander":"2.20.0","eslint":"6.0.1","fs-extra":"8.1.0","jsdoc":"3.6.3","klaw":"3.0.0","license-check-and-add":"2.3.6","mocha":"6.1.4","mockery":"2.1.0","moxios":"0.4.0","node-plantuml":"0.8.1","npm-paths":"2.0.0","nyc":"14.1.1","pegjs":"0.10.0","sinon":"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2","webpack":"4.35.2","webpack-cli":"3.3.5","yargs":"13.2.4"},"dependencies":{"acorn":"5.1.2","axios":"0.19.0","debug":"4.1.1","doctrine":"3.0.0","lorem-ipsum":"1.0.6","mkdirp":"0.5.1","moment-mini":"2.22.1","semver":"6.3.0","urijs":"1.19.1","uuid":"3.3.2"},"license-check-and-add-config":{"folder":"./lib","license":"HEADER","exact_paths_method":"EXCLUDE","exact_paths":["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],"file_type_method":"EXCLUDE","file_types":[".yml",".yaml",".zip",".tgz"],"insert_license":false,"license_formats":{"js|njk|pegjs|cto|acl|qry":{"prepend":"/*","append":" */","eachLine":{"prepend":" * "}},"npmrc|editorconfig|txt":{"eachLine":{"prepend":"# "}},"md":{"file":"HEADER.md"}}},"nyc":{"exclude":["coverage/**","index.js","webpack.config.js","lib/codegen/codegen.js","lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js","out/**","scripts/**","systest/**","test/**","umd/**"],"reporter":["text-summary","html","lcov"],"all":true,"check-coverage":true,"statements":100,"branches":99,"functions":100,"lines":100},"readme":"# Concerto\n\nConcerto is a lightweight 100% JavaScript schema language and runtime. It works in both a Node.js process and in your browser. The browserified version of Concerto is ±280KB. We are working on making it even smaller.\n\nThings you can do using Concerto:\n- Define an object-oriented model using a domain-specific language that is much easier to read and write than JSON/XML Schema, XMI or equivalents. The metamodel gives you \"just enough\" expressivity to capture real-world business models, while remaining easy to map to most runtime environments.\n- Optionall edit your models using a powerful [VS Code add-on](https://marketplace.visualstudio.com/items?itemName=accordproject.cicero-vscode-extension) with syntax highlighting and validation\n- Create runtime instances of your model\n- Serialize your instances to JSON\n- Deserialize (and optionally validate) instances from JSON\n- Instances are JS objects so they are easy to pass around your application\n- Introspect the model using a powerful set of APIs\n- Convert the model to other formats: JSON Schema, XML Schema, Java, Go, Typescript, Loopback, PlantUML using [concerto-tools](https://github.com/accordproject/concerto-tools).\n- Import models from URLs\n- Publish your reusable models to any website, including the Accord Project Open Source model repository, hosted at: https://models.accordproject.org\n\n# Installation\n\n```\nnpm install @accordproject/concerto --save\n```\n\n# Create a Concerto File\n\n```\nnamespace org.acme.address\n\n/**\n * This is a concept\n */\nconcept PostalAddress {\n  o String streetAddress optional\n  o String postalCode optional\n  o String postOfficeBoxNumber optional\n  o String addressRegion optional\n  o String addressLocality optional\n  o String addressCountry optional\n}\n```\n\n# Create a Model Manager\n\n```\nconst ModelManager = require('@accordproject/concerto').ModelManager;\n\nconst modelManager = new ModelManager();\nmodelManager.addModelFile( concertoFileText, 'filename.cto');\n```\n\n# Create an Instance\n\n```\nconst Factory = require('@accordproject/concerto').Factory;\n\nconst factory = new Factory(modelManager);\nconst postalAddress = factory.newConcept('org.acme.address', 'PostalAddress');\npostalAddress.streetAddress = '1 Maine Street';\n```\n\n# Serialize an Instance to JSON\n\n```\nconst Serializer = require('@accordproject/concerto').Serializer;\n\nconst serializer = new Serializer(factory, modelManager);\nconst plainJsObject = serializer.toJSON(postalAddress); // instance will be validated\nconsole.log(JSON.stringify(plainJsObject, null, 4);\n```\n\n# Deserialize an Instance from JSON\n\n```\nconst postalAddress = serializer.fromJSON(plainJsObject); // JSON will be validated\nconsole.log(postalAddress.streetAddress);\n```\n\n# Metamodel\n\nThe Concerto metamodel contains:\n- Namespaces\n- Imports\n- Concepts\n- Assets\n- Participants\n- Transactions\n- Enumerations & Enumeration Values\n- Properties & Meta Properties\n- Relationships\n- Decorators\n\n## Namespaces\n\n```\nnamespace foo\n```\n\nEvery Concerto file starts with the name of a single namespace. All the definitions within a single file therefore belong to the same namespace. The `ModelManager` will refuse to load two model files that have the same namespace.\n\n## Imports\n\nTo reference types defined in one namespace in another namespace the types must be imported.\n\nImports can either be qualified, or can use wildcards.\n\n```\nimport org.accordproject.address.PostalAddress\n```\n\n```\nimport org.accordproject.address.*\n```\n\nImports can also use the optional `from` declaration to import a model files that has been deployed to a URL.\n\n```\nimport org.accordproject.address.PostalAddress from https://models.accordproject.org/address.cto\n```\n\nImports that use a `from` declaration can be downloaded into the model manager by calling `modelManager.updateExternalModels`.\n\nThe Model Manager will resolve all imports to ensure that the set of declarations that have been loaded are globally consistent. \n\n## Concepts\n\nConcepts are similar to class declarations in most object-oriented languages, in that they may have a super-type and a set of typed properties:\n\n```\nabstract concept Animal {\n  o DateTime dob\n}\n\nconcept Dog extends Animal {\n o String breed\n}\n```\n\nA concept can be declared `abstract` is it should not be instantiated (must be subclassed).\n\n## Assets\n\nAn asset is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getAssetDeclarations` API to look up all assets.\n\n```\nasset Vehicle identified by vin {\n  o String vin\n}\n```\n\nAssets are typically used in your models for the long-lived identifiable Things (or nouns) in the model: cars, orders, shipping containers, products etc.\n\n## Participants\n\nAn participant is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getParticipantDeclarations` API to look up all participants.\n\n```\nparticipant Customer identified by email {\n  o String email\n}\n```\n\nParticipants are typically used in your models for the identifiable people or organizations in the model: person, customer, company, business, auditor etc.\n\n## Transactions\n\nAn transaction is a class declaration that has a single `String` property that acts as an identifier. Use the `modelManager.getTransactionDeclarations` API to look up all transactions.\n\n```\ntransaction Order identified by orderId {\n  o String orderId\n}\n```\n\nTransactions are typically used in your models for the identifiable business events or messages that are submitted by Participants to change the state of Assets: cart check out, change of address, identity verification, place order etc.\n\n## Enumerations & Enumeration Values\n\nUse enumerations to capture lists of domain values.\n\n```\nenum Gender {\n  o MALE\n  o FEMALE\n  o OTHER\n  o UNKNOWN\n}\n```\n\n## Properties and Meta Properties\n\nClass declarations contain properties. Each property has a type which can either be a type defined in the same namespace, an imported type or a primitive type.\n\n### Primitive types\n\nConcerto supports the following primitive types:\n- String: a UTF8 encoded String.\n- Double: a double precision 64 bit numeric value.\n- Integer: a 32 bit signed whole number.\n- Long: a 64 bit signed whole number.\n- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.\n- Boolean: a Boolean value, either true or false.\n\n### Meta Properties\n- [] : declares that the property is an array\n- optional : declares that the property is not required for the instance to be valid\n- default : declares a default value for the property, if not value is specified\n- range : declares a valid range for numeric properties\n- regex : declares a validation regex for string properties\n\nString fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Concerto to perform rich data validation, leading to fewer errors and less boilerplate application code.\n\nThe example below declares that the Farmer participant contains a field postcode that must conform to the regular expression for valid UK postcodes.\n\n```\nparticipant Farmer extends Participant {\n    o String firstName default=\"Old\"\n    o String lastName default=\"McDonald\"\n    o String address1\n    o String address2\n    o String county\n    o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/\n}\n```\n\nDouble, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.\n\nThe example below declared that the Vehicle asset has an Integer field year which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.\n\n```\nasset Vehicle extends Base {\n  // An asset contains Fields, each of which can have an optional default value\n  o String model default=\"F150\"\n  o String make default=\"FORD\"\n  o String reg default=\"ABC123\"\n  // A numeric field can have a range validation expression\n  o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher\n  o Integer[] integerArray\n  o State state\n  o Double value\n  o String colour\n  o String V5cID regex=/^[A-z][A-z][0-9]{7}/\n  o String LeaseContractID\n  o Boolean scrapped default=false\n  o DateTime lastUpdate optional\n  --> Participant owner //relationship to a Participant, with the field named 'owner'.\n  --> Participant[] previousOwners optional // Nary relationship\n  o Customer customer\n}\n```\n\n## Relationships\n\nA property of a class may be declared as a relationship using the `-->` syntax instead of the `o` syntax. The `o` syntax declares that the class contains (has-a) property of that type, whereas the `-->` syntax declares a typed pointer to an external identifiable instance.\n\nThis model declares that an `Order` has-an array of `OrderLine` concepts. When the `Order` is deleted all the `OrderLines` will also be deleted.\n\n```\nconcept OrderLine {\n  o String sku\n}\nasset Order identified by orderId {\n  o String orderId\n  o OrderLine[] orderlines\n}\n```\n\nWhereas this model declares that an `Order` has-an array of reference to `OrderLine`s. Deleting the `Order` has no impact on the `OrderLine`. When the `Order` is serialized the JSON only the IDs of the `OrderLines` are stored within the `Order`, not the `OrderLines` themselves.\n\n```\nasset OrderLine identified by orderLineId {\n  o String orderLineId\n  o String sku\n}\n\nasset Order identified by orderId {\n  o String orderId\n  --> OrderLine[] orderlines\n}\n```\n\nA relationship is a tuple composed of:\n\nThe namespace of the type being referenced\nThe type name of the type being referenced\nThe identifier of the instance being referenced\n\nHence a relationship could be to: `org.example.Vehicle#123456`\n\nThis would be a relationship to the `Vehicle` type declared in the `org.example` namespace with the identifier `123456`.\n\nRelationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.\n\nRelationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid. Resolution of relationships is outside of the scope of the Model Manager.\n\n## Decorators\n\nModel elements may have arbitrary decorators (aka annotations) placed on them. These are available via API and can be useful for tools to extend the model.\n\n```\n@foo(\"arg1\", 2)\nasset Order identified by orderId {\n  o String orderId\n}\n```\n\nDecorators have an arbitrary number of arguments. They support arguments of type:\n- String\n- Boolean\n- Number\n- Type reference\n\nResource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar decorator listed twice on the same element.\n\nDecorators are accessible at runtime via the `ModelManager` introspect APIs. This allows tools and utilities to use Concerto to describe a core model, while decorating it with sufficient metadata for their own purposes.\n\nThe example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:\n\n```\nconst val = myField.getDecorator('foo').getArguments()[2];\n```\n\n## License <a name=\"license\"></a>\n\nAccord Project source code files are made available under the [Apache License, Version 2.0][apache].\nAccord Project documentation files are made available under the [Creative Commons Attribution 4.0 International License][creativecommons] (CC-BY-4.0).\n\nCopyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See [LF Projects Trademark Policy](https://lfprojects.org/policies/trademark-policy/).\n\n[linuxfound]: https://www.linuxfoundation.org\n[charter]: https://github.com/accordproject/cicero/blob/master/CHARTER.md\n[apmain]: https://accordproject.org/ \n[apworkgroup]: https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MjZvYzIzZHVrYnI1aDVzbjZnMHJqYmtwaGlfMjAxNzExMTVUMjEwMDAwWiBkYW5AY2xhdXNlLmlv&tmsrc=dan%40clause.io\n[apblog]: https://medium.com/@accordhq\n[apnews]: https://www.accordproject.org/news/\n[apgit]:  https://github.com/accordproject/\n[apdoc]: https://docs.accordproject.org/\n[apslack]: https://accord-project-slack-signup.herokuapp.com\n\n[docspec]: https://docs.accordproject.org/docs/spec-overview.html\n[docwelcome]: https://docs.accordproject.org/docs/accordproject.html\n[dochighlevel]: https://docs.accordproject.org/docs/spec-concepts.html\n[docergo]: https://docs.accordproject.org/docs/logic-ergo.html\n[docstart]: https://docs.accordproject.org/docs/accordproject.html\n[doccicero]: https://docs.accordproject.org/docs/basic-use.html\n[docstudio]: https://docs.accordproject.org/docs/advanced-latedelivery.html\n\n[contributing]: https://github.com/accordproject/cicero/blob/master/CONTRIBUTING.md\n[developers]: https://github.com/accordproject/cicero/blob/master/DEVELOPERS.md\n\n[apache]: https://github.com/accordproject/template-studio-v2/blob/master/LICENSE\n[creativecommons]: http://creativecommons.org/licenses/by/4.0/\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/accordproject/concerto/issues"},"homepage":"https://github.com/accordproject/concerto#readme","_id":"@accordproject/concerto@0.80.4-20191003155034","_npmVersion":"6.4.1","_nodeVersion":"8.16.1","_npmUser":{"name":"mttrbrts","email":"matt@clause.io"},"dist":{"integrity":"sha512-Hd+X3O3fE0x6am2WOeiKsW6fnIlsYn5i2eqt0O2N2slpiw8D/hAwCsbAZvz5MI66RktOqOhuvC/PK9EgwdcCCQ==","shasum":"b53114f0a32faeb490c6a849ccb3c83d9e6fbf0f","tarball":"https://registry.npmjs.org/@accordproject/concerto/-/concerto-0.80.4-20191003155034.tgz","fileCount":81,"unpackedSize":1318133,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdlhjYCRA9TVsSAnZWagAAadkQAKEgMPvaJdhhB1jmQf5S\nlYxtA+3HgQ340ktO21e+6K4zOKOeqm5GAZL0CVj1Vv+Wd2SFkzRH9qCjCmi9\nVoy/RyuimcdJ5nTSooBN+W2JO5ZHvRDtu0bBLTKtFouqpxpKmJ3Fn4VrRVJ2\nbUEzZ1Cl9zTSePrbGy5j2rFc074A/w7PuTJWQFF9Zwm286hfF6Fe3rfkbBlK\n2IVoaleSsXyXM88EPjNv6xBRsDLxte3FyxCLgSBmm4TmaeNYv5I3aip0rY8n\nOqIqgF+ujszat9erFnJQSBuWnSEn9FieW22/BbIOiQsBb0IvlhpbERRC+O8R\nCI4+LRMXdqGlTee7YJhylmlssSxAHraTyG7KOVAsEnbMHV9Ic9wL5U+r2Sev\n2isRzC72YgoMs1HYl0OT4ocW4ovWMoztJghYCGDwIg8ZzNWW1gKnE3MkCjC8\n1fEO4ZJ5ZD9+MEKzUZVADJiPjbAG68OCXshmP2GLxNShUd6yQLEiL1rZme45\nTfzaMFD13c07uxlEdGCgRvh/YhFPXsImj4wHVMByZU3apTviLr73k0/Kij8T\n+LXYmUwstnlahCAtBEVvI632akRRBEWzOiavFfLoZtqGxsJNlfzZx/w0OT9W\nx1gvqDdoIJ85hiaxlU1Gm1bz7JCt/cIjxS2Q5Wd31KPjRR273FT2h3nd8tNP\nEf6+\r\n=mweD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFm4fg8D90BcgXhoOT1d+lxNfSLe+P01JjZ3nIjm4oz5AiEAxGmQdHI5y72ht39Jxrs+1JzfaTxUj3VkGf/b0SFoFQQ="}]},"maintainers":[{"name":"dianalease","email":"dianarlease@gmail.com"},{"name":"dselman","email":"danscode@selman.org"},{"name":"irmerk","email":"jolene@clause.io"},{"name":"jsimeon","email":"jerome@clause.io"},{"name":"mttrbrts","email":"matt@clause.io"},{"name":"petrgazarov","email":"petrgazarov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/concerto_0.80.4-20191003155034_1570117848003_0.7671346499417395"},"_hasShrinkwrap":false}},"time":{"created":"2019-09-15T09:06:12.689Z","0.71.8-20190915045234":"2019-09-15T09:06:12.936Z","modified":"2023-09-15T07:40:02.342Z","0.71.8-20190915091253":"2019-09-15T09:13:08.529Z","0.71.8-20190915202838":"2019-09-15T20:28:51.855Z","0.80.0":"2019-09-15T20:31:54.363Z","0.80.1-20190915203331":"2019-09-15T20:33:45.801Z","0.80.1-20190916195745":"2019-09-16T19:57:58.731Z","0.80.2-20190925200615":"2019-09-25T20:06:30.205Z","0.80.2-20190925202544":"2019-09-25T20:25:59.362Z","0.80.2-20190926121100":"2019-09-26T12:11:15.829Z","0.80.2-20190927134550":"2019-09-27T13:46:05.342Z","0.80.2-20190927152605":"2019-09-27T15:26:19.390Z","0.80.2-20190927153010":"2019-09-27T15:30:25.309Z","0.80.2":"2019-09-27T16:04:43.077Z","0.80.3-20190927160708":"2019-09-27T16:07:22.623Z","0.80.3-20190927160814":"2019-09-27T16:08:28.418Z","0.80.3-20190927165102":"2019-09-27T16:51:16.499Z","0.80.3":"2019-09-27T16:53:56.819Z","0.80.4-20190927165630":"2019-09-27T16:56:44.708Z","0.80.4-20191001132104":"2019-10-01T13:21:17.718Z","0.80.4-20191001132607":"2019-10-01T13:26:22.083Z","0.80.4-20191002062052":"2019-10-02T06:21:05.892Z","0.80.4-20191002070543":"2019-10-02T07:05:59.080Z","0.80.4-20191002070725":"2019-10-02T07:07:38.866Z","0.80.4-20191002122338":"2019-10-02T12:23:52.806Z","0.80.4-20191003082908":"2019-10-03T08:29:22.470Z","0.80.4-20191003114436":"2019-10-03T11:44:50.331Z","0.80.4-20191003141535":"2019-10-03T14:15:49.750Z","0.80.4-20191003155034":"2019-10-03T15:50:48.158Z"},"maintainers":[{"email":"matt@clause.io","name":"mttrbrts"},{"email":"danscode@selman.org","name":"dselman"},{"email":"dianarlease@gmail.com","name":"dianalease"}],"description":"Concerto Modeling Language","homepage":"https://github.com/accordproject/concerto#readme","keywords":["blockchain","hyperledger","solutions"],"repository":{"type":"git","url":"git+https://github.com/accordproject/concerto.git"},"author":{"name":"accordproject.org"},"bugs":{"url":"https://github.com/accordproject/concerto/issues"},"license":"Apache-2.0","readme":"","readmeFilename":""}