Skip to content

Commit d5fcd46

Browse files
committed
fix : Modify code generation script to include DCS Concerto model types
Signed-off-by: Ayush1404 <ayushkadam1404@gmail.com>
1 parent ce4462c commit d5fcd46

File tree

4 files changed

+63
-2
lines changed

4 files changed

+63
-2
lines changed

packages/concerto-core/lib/decoratormanager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -812,4 +812,4 @@ class DecoratorManager {
812812
}
813813
}
814814

815-
module.exports = DecoratorManager;
815+
module.exports = {DecoratorManager,DCS_MODEL};

packages/concerto-types/scripts/codegen.js

+2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ const { ModelManager } = require('@accordproject/concerto-core');
44
const { CodeGen: { TypescriptVisitor }} = require('@accordproject/concerto-codegen');
55
const { FileWriter } = require('@accordproject/concerto-util');
66
const path = require('path');
7+
const {DCS_MODEL }= require('@accordproject/concerto-core/lib/decoratormanager');
78

89
/**
910
* Generate TypeScript files from the metamodel.
1011
*/
1112
async function main() {
1213
const modelManager = new ModelManager({addMetamodel:true, strict: true});
14+
modelManager.addCTOModel(DCS_MODEL, 'decoratorcommands@0.4.0.cto');
1315
const visitor = new TypescriptVisitor();
1416

1517
const fileWriter = new FileWriter(path.resolve(__dirname, '..', 'src', 'generated'));

packages/concerto-types/src/generated/unions/concerto@1.0.0.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ import type {
2626
IModel,
2727
IModels
2828
} from './concerto.metamodel@1.0.0';
29+
import type {
30+
IDecoratorCommandSetReference,
31+
CommandType,
32+
ICommandTarget,
33+
MapElement,
34+
ICommand,
35+
IDecoratorCommandSet
36+
} from './org.accordproject.decoratorcommands@0.4.0';
2937

3038
// interfaces
3139
export interface IConcept {
@@ -51,7 +59,11 @@ ILongDomainValidator |
5159
IAliasedType |
5260
IImport |
5361
IModel |
54-
IModels;
62+
IModels |
63+
IDecoratorCommandSetReference |
64+
ICommandTarget |
65+
ICommand |
66+
IDecoratorCommandSet;
5567

5668
export interface IAsset extends IConcept {
5769
$identifier: string;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/* eslint-disable @typescript-eslint/no-empty-interface */
2+
// Generated code for namespace: org.accordproject.decoratorcommands@0.4.0
3+
4+
// imports
5+
import {IDecorator} from './concerto.metamodel@1.0.0';
6+
import {IConcept} from './concerto@1.0.0';
7+
8+
// interfaces
9+
export interface IDecoratorCommandSetReference extends IConcept {
10+
name: string;
11+
version: string;
12+
}
13+
14+
export enum CommandType {
15+
UPSERT = 'UPSERT',
16+
APPEND = 'APPEND',
17+
}
18+
19+
export interface ICommandTarget extends IConcept {
20+
namespace?: string;
21+
declaration?: string;
22+
property?: string;
23+
properties?: string[];
24+
type?: string;
25+
mapElement?: MapElement;
26+
}
27+
28+
export enum MapElement {
29+
KEY = 'KEY',
30+
VALUE = 'VALUE',
31+
KEY_VALUE = 'KEY_VALUE',
32+
}
33+
34+
export interface ICommand extends IConcept {
35+
target: ICommandTarget;
36+
decorator: IDecorator;
37+
type: CommandType;
38+
decoratorNamespace?: string;
39+
}
40+
41+
export interface IDecoratorCommandSet extends IConcept {
42+
name: string;
43+
version: string;
44+
includes?: IDecoratorCommandSetReference[];
45+
commands: ICommand[];
46+
}
47+

0 commit comments

Comments
 (0)