Skip to content

Commit

Permalink
feat(dcs): optimize decorate models (accordproject#857)
Browse files Browse the repository at this point in the history
* feat(dcs): optimize decorate models

Signed-off-by: Sanket Shevkar <[email protected]>

* refactor(core): optimized decorateModels added

Signed-off-by: sanketshevkar <[email protected]>

* chore(core): code refactor and cleanup

Signed-off-by: sanketshevkar <[email protected]>

* chore(core): code refactor and cleanup

Signed-off-by: sanketshevkar <[email protected]>

* chore(core): new test added for validation of new and old methods used to decorate models

Signed-off-by: sanketshevkar <[email protected]>

* chore(core): code refactor

Signed-off-by: sanketshevkar <[email protected]>

* chore(core): resolve review comments and suggestions

Signed-off-by: sanketshevkar <[email protected]>

* chore(*): resolve PR suggestions and comments

Signed-off-by: sanketshevkar <[email protected]>

* chore(*): resolve PR suggestions and comments

Signed-off-by: sanketshevkar <[email protected]>

---------

Signed-off-by: Sanket Shevkar <[email protected]>
Signed-off-by: sanketshevkar <[email protected]>
  • Loading branch information
sanketshevkar authored Jul 24, 2024
1 parent c252d82 commit bf3385c
Show file tree
Hide file tree
Showing 11 changed files with 999 additions and 49 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/concerto-core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DecoratorManager {
+ void validateCommand(ModelManager,command)
+ Boolean falsyOrEqual(string||,string[])
+ void applyDecorator(decorated,string,newDecorator)
+ void executeCommand(string,declaration,command,boolean?)
+ void executeCommand(string,declaration,command,property?,object?,boolean?)
+ void executePropertyCommand(property,command)
}
+ string[] intersect()
Expand Down
4 changes: 4 additions & 0 deletions packages/concerto-core/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
# Note that the latest public API is documented using JSDocs and is available in api.txt.
#

Version 3.17.2 {eb3903401fdcf7c26cca1f3f8a029171} 2024-07-17
- Added new optimized methods for decorating models with decorator commandsets
- fixed other decorator command set bugs

Version 3.17.1 {ddc91ebd1ff660b421b60302d1e92271} 2024-06-21
- Added 'enableAliasedType' option to BaseModelManager
- Aliased types mapped to FQN in modelfile
Expand Down
243 changes: 202 additions & 41 deletions packages/concerto-core/lib/decoratormanager.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
namespace [email protected]

@Declaration()
@NamespaceDeclaration()
@NamespaceDeprecated()
@Namespace()
scalar SSN extends String

@Editable
@NamespaceDeprecated()
@Namespace()
concept Person {
@Custom
@Type("Property")
o String firstName
@Type("Property")
o String lastName
@Type("Property")
o String bio
o SSN ssn
@Type("Property")
o String address1
@Type("Property")
o String address2
@Type("Property")
o String city
@Property()
@DeclarationProperty()
@NamespaceDeclarationProperty()
@NamespaceProperty()
@NamespaceDeclarationPropertyType()
@NamespacePropertyType()
@DeclarationPropertyType()
@PropertyType()
@Type("Property")
@NamespaceDeclarationTypeProperties()
@Properties()
@DeclarationProperties()
@NamespaceDeclarationProperties()
@NamespaceProperties()
@NamespaceTypeProperties()
o String country
@Properties()
@DeclarationProperties()
@NamespaceDeclarationProperties()
@NamespaceProperties()
@DeclarationTypeProperties()
o Integer zip
o Dictionary dictionary
}

@NamespaceDeprecated()
@Namespace()
map Dictionary {
@MapElement()
@DeclarationMapElement()
@NamespaceDeclarationMapElement()
@NamespaceMapElement()
o String
@NamespaceDeclarationTypeMapElement()
@MapElement()
@NamespaceTypeMapElement()
@DeclarationTypeMapElement()
@Type("MapValue")
o String
}

@NamespaceDeprecated()
@Namespace()
map Rolodex {
@MapElement()
@NamespaceMapElement()
o String
@MapElement()
@NamespaceTypeMapElement()
@Type("MapValue")
o String
}

@NamespaceDeprecated()
@Namespace()
enum Miscellaneous {
@Property()
@NamespaceProperty()
@Properties()
@NamespaceProperties()
@PropertiesType()
o country
o USA
@Properties()
@NamespaceProperties()
@PropertiesType()
o zip
o dictionary
}
89 changes: 89 additions & 0 deletions packages/concerto-core/test/data/decoratorcommands/normal.cto
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
namespace [email protected]

@Declaration()
@NamespaceDeclaration()
@NamespaceDeprecated()
@MapElement()
@NamespaceMapElement()
@Namespace()
scalar SSN extends String

@Editable
@NamespaceDeprecated()
@MapElement()
@NamespaceMapElement()
@Namespace()
concept Person {
@Custom
@Type("Property")
o String firstName
@Type("Property")
o String lastName
@Type("Property")
o String bio
o SSN ssn
@Type("Property")
o String address1
@Type("Property")
@NamespaceDeclarationTypeProperties()
@Properties()
@DeclarationProperties()
@NamespaceDeclarationProperties()
@NamespaceProperties()
@NamespaceTypeProperties()
@DeclarationTypeProperties()
@PropertiesType()
o String address2
@Type("Property")
o String city
@Property()
@DeclarationProperty()
@NamespaceDeclarationProperty()
@NamespaceProperty()
@NamespaceDeclarationPropertyType()
@NamespacePropertyType()
@DeclarationPropertyType()
@PropertyType()
@Type("Property")
o String country
o Integer zip
o Dictionary dictionary
}

@NamespaceDeprecated()
@Property()
@NamespaceProperty()
@Properties()
@NamespaceProperties()
@Namespace()
map Dictionary {
@MapElement()
@DeclarationMapElement()
@NamespaceDeclarationMapElement()
@NamespaceMapElement()
o String
@NamespaceDeclarationTypeMapElement()
@MapElement()
@NamespaceTypeMapElement()
@DeclarationTypeMapElement()
@TypeMapElement()
@Type("MapValue")
o String
}

@NamespaceDeprecated()
@Property()
@NamespaceProperty()
@Properties()
@NamespaceProperties()
@Namespace()
map Rolodex {
@MapElement()
@NamespaceMapElement()
o String
@MapElement()
@NamespaceTypeMapElement()
@TypeMapElement()
@Type("MapValue")
o String
}
Loading

0 comments on commit bf3385c

Please sign in to comment.