-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix : Modify code generation script to include DCS Concerto model types
Signed-off-by: Ayush1404 <[email protected]>
- Loading branch information
Showing
4 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/lib/decoratormanager'); | ||
|
||
/** | ||
* Generate TypeScript files from the metamodel. | ||
*/ | ||
async function main() { | ||
const modelManager = new ModelManager({addMetamodel:true, strict: true}); | ||
modelManager.addCTOModel(DCS_MODEL, '[email protected]'); | ||
const visitor = new TypescriptVisitor(); | ||
|
||
const fileWriter = new FileWriter(path.resolve(__dirname, '..', 'src', 'generated')); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,14 @@ import type { | |
IModel, | ||
IModels | ||
} from './[email protected]'; | ||
import type { | ||
IDecoratorCommandSetReference, | ||
CommandType, | ||
ICommandTarget, | ||
MapElement, | ||
ICommand, | ||
IDecoratorCommandSet | ||
} from './[email protected]'; | ||
|
||
// 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; | ||
|
47 changes: 47 additions & 0 deletions
47
packages/concerto-types/src/generated/unions/[email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* eslint-disable @typescript-eslint/no-empty-interface */ | ||
// Generated code for namespace: [email protected] | ||
|
||
// imports | ||
import {IDecorator} from './[email protected]'; | ||
import {IConcept} from './[email protected]'; | ||
|
||
// 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[]; | ||
} | ||
|