diff --git a/packages/concerto-core/lib/decoratormanager.js b/packages/concerto-core/lib/decoratormanager.js index f45966fe6..f115841c0 100644 --- a/packages/concerto-core/lib/decoratormanager.js +++ b/packages/concerto-core/lib/decoratormanager.js @@ -813,3 +813,4 @@ class DecoratorManager { } module.exports = DecoratorManager; +module.exports.DCS_MODEL = DCS_MODEL; \ No newline at end of file diff --git a/packages/concerto-types/scripts/codegen.js b/packages/concerto-types/scripts/codegen.js index 6e551b09d..fd35f1b69 100644 --- a/packages/concerto-types/scripts/codegen.js +++ b/packages/concerto-types/scripts/codegen.js @@ -4,12 +4,14 @@ const { ModelManager } = require('@accordproject/concerto-core'); const { CodeGen: { TypescriptVisitor }} = require('@accordproject/concerto-codegen'); const { FileWriter } = require('@accordproject/concerto-util'); const path = require('path'); +const { DCS_MODEL }= require('@accordproject/concerto-core'); /** * Generate TypeScript files from the metamodel. */ async function main() { const modelManager = new ModelManager({addMetamodel:true, strict: true}); + modelManager.addCTOModel(DCS_MODEL, 'decoratorcommands@0.4.0.cto'); const visitor = new TypescriptVisitor(); const fileWriter = new FileWriter(path.resolve(__dirname, '..', 'src', 'generated')); diff --git a/packages/concerto-types/src/generated/unions/concerto@1.0.0.ts b/packages/concerto-types/src/generated/unions/concerto@1.0.0.ts index 5a81da532..b0826b3ec 100644 --- a/packages/concerto-types/src/generated/unions/concerto@1.0.0.ts +++ b/packages/concerto-types/src/generated/unions/concerto@1.0.0.ts @@ -26,6 +26,14 @@ import type { IModel, IModels } from './concerto.metamodel@1.0.0'; +import type { + IDecoratorCommandSetReference, + CommandType, + ICommandTarget, + MapElement, + ICommand, + IDecoratorCommandSet +} from './org.accordproject.decoratorcommands@0.4.0'; // interfaces export interface IConcept { @@ -51,7 +59,11 @@ ILongDomainValidator | IAliasedType | IImport | IModel | -IModels; +IModels | +IDecoratorCommandSetReference | +ICommandTarget | +ICommand | +IDecoratorCommandSet; export interface IAsset extends IConcept { $identifier: string; diff --git a/packages/concerto-types/src/generated/unions/org.accordproject.decoratorcommands@0.4.0.ts b/packages/concerto-types/src/generated/unions/org.accordproject.decoratorcommands@0.4.0.ts new file mode 100644 index 000000000..7f97a946e --- /dev/null +++ b/packages/concerto-types/src/generated/unions/org.accordproject.decoratorcommands@0.4.0.ts @@ -0,0 +1,47 @@ +/* eslint-disable @typescript-eslint/no-empty-interface */ +// Generated code for namespace: org.accordproject.decoratorcommands@0.4.0 + +// imports +import {IDecorator} from './concerto.metamodel@1.0.0'; +import {IConcept} from './concerto@1.0.0'; + +// interfaces +export interface IDecoratorCommandSetReference extends IConcept { + name: string; + version: string; +} + +export enum CommandType { + UPSERT = 'UPSERT', + APPEND = 'APPEND', +} + +export interface ICommandTarget extends IConcept { + namespace?: string; + declaration?: string; + property?: string; + properties?: string[]; + type?: string; + mapElement?: MapElement; +} + +export enum MapElement { + KEY = 'KEY', + VALUE = 'VALUE', + KEY_VALUE = 'KEY_VALUE', +} + +export interface ICommand extends IConcept { + target: ICommandTarget; + decorator: IDecorator; + type: CommandType; + decoratorNamespace?: string; +} + +export interface IDecoratorCommandSet extends IConcept { + name: string; + version: string; + includes?: IDecoratorCommandSetReference[]; + commands: ICommand[]; +} +