Skip to content

Commit

Permalink
fix: created decorator extractor class
Browse files Browse the repository at this point in the history
Signed-off-by: Muskan Bararia <[email protected]>
  • Loading branch information
Muskan Bararia committed Nov 14, 2023
1 parent bb83859 commit 578cbfa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 415 deletions.
3 changes: 3 additions & 0 deletions packages/concerto-core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class Concerto {
+ string getNamespace(obj)
}
+ object setCurrentTime()
class DecoratorExtractor {
+ void constructor(boolean,string,string,Object)
}
class DecoratorManager {
+ ModelManager validate(decoratorCommandSet,ModelFile[]) throws Error
+ ModelManager decorateModels(ModelManager,decoratorCommandSet,object?,boolean?,boolean?,boolean?)
Expand Down
2 changes: 1 addition & 1 deletion packages/concerto-core/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Note that the latest public API is documented using JSDocs and is available in api.txt.
#

Version 3.14.2 {c8e20253a3695fcaed97472d697e282d} 2023-11-07
Version 3.14.2 {4db54a25a7d712dc7e311c7c424bbe0e} 2023-11-07
- Added DCS and vocabulary extraction support for decoratorManager

Version 3.13.1 {f5a9a1ea6a64865843a3abb77798cbb0} 2023-10-18
Expand Down
12 changes: 7 additions & 5 deletions packages/concerto-core/lib/decoratormanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Factory = require('./factory');
const ModelUtil = require('./modelutil');
const { MetaModelNamespace } = require('@accordproject/concerto-metamodel');
const semver = require('semver');
const DecoratorUtil = require('./decoratorutil');
const DecoratorExtractor = require('./decoratorextractor');

// Types needed for TypeScript generation.
/* eslint-disable no-unused-vars */
Expand Down Expand Up @@ -55,14 +55,14 @@ enum CommandType {
/**
* Which models elements to add the decorator to. Any null
* elements are 'wildcards'.
* elements are 'wildcards'.
*/
concept CommandTarget {
o String namespace optional
o String declaration optional
o String property optional
o String[] properties optional // property and properties are mutually exclusive
o String type optional
o String type optional
o MapElement mapElement optional
}
Expand Down Expand Up @@ -278,7 +278,9 @@ class DecoratorManager {
locale:'en',
...options
};
const collectionResp = DecoratorUtil.collectExtractedDecoratorsAndProcessedModels(modelManager, options.removeDecoratorsFromModel, options.locale, DCS_VERSION);
const sourceAst = modelManager.getAst(true);
const decoratorExtrator = new DecoratorExtractor(options.removeDecoratorsFromModel, options.locale, DCS_VERSION, sourceAst);
const collectionResp = decoratorExtrator.extract();
return {
modelManager: collectionResp.updatedModelManager,
decoratorCommandSet: collectionResp.decoratorCommandSet,
Expand Down Expand Up @@ -509,4 +511,4 @@ class DecoratorManager {
}
}

module.exports = DecoratorManager;
module.exports = DecoratorManager;
Loading

0 comments on commit 578cbfa

Please sign in to comment.