@izara_project/izara-core-generate-service-code 1.0.96 → 1.0.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/index.js +2 -2
  2. package/package.json +2 -1
  3. package/src/compile/loadSchemas.js +44 -322
  4. package/src/compile/loadSchemasRemote.js +195 -0
  5. package/src/compile/schemaValidatorSetup.js +143 -0
  6. package/src/emit/{crud → application/crud}/emitCrudApplicationArtifacts.js +2 -2
  7. package/src/emit/{crud → application/crud}/generateCrudApplicationArtifacts.js +2 -2
  8. package/src/emit/{crud → application/crud}/generateDynamicCrudFlowSchemas.js +2 -2
  9. package/src/emit/{crud → application/crud}/templates/FlowEndpoint_HdrWbs.ejs +2 -2
  10. package/src/emit/{crud → application/crud}/templates/FlowMain_Wbs.ejs +2 -2
  11. package/src/emit/{custom → application/custom}/customFlowS3.js +1 -1
  12. package/src/emit/{custom → application/custom}/customFlowSteps.js +1 -1
  13. package/src/emit/{custom → application/custom}/customFlowTemplates.js +1 -1
  14. package/src/emit/{custom → application/custom}/emitCustomFlowApplicationArtifacts.js +1 -1
  15. package/src/emit/{custom → application/custom}/generateCustomFlowApplicationArtifacts.js +2 -2
  16. package/src/emit/{custom → application/custom}/templates/s3/CreateObject_Main.ejs +5 -2
  17. package/src/emit/{custom → application/custom}/templates/triggerCache/CheckTriggerCache_Main.ejs +2 -2
  18. package/src/emit/{rbac → application/rbac}/emitRbacApplicationArtifacts.js +2 -2
  19. package/src/emit/{rbac → application/rbac}/generateCreateTargetRoleHandler.js +2 -2
  20. package/src/emit/{rbac → application/rbac}/generateDynamicRbacFlowSchemas.js +2 -2
  21. package/src/emit/{relationship → application/relationship}/emitRelationshipApplicationArtifacts.js +3 -3
  22. package/src/emit/{relationship → application/relationship}/generateDynamicRelationshipFlowSchemas.js +2 -2
  23. package/src/emit/{relationship → application/relationship}/generateRelationshipApplicationArtifacts.js +2 -2
  24. package/src/emit/{relationship → application/relationship}/templates/ChangeRelationship_Main.ejs +3 -2
  25. package/src/emit/{relationship → application/relationship}/templates/CreateRelationship_Main.ejs +3 -2
  26. package/src/emit/{relationship → application/relationship}/templates/DeleteRelationship_Main.ejs +3 -2
  27. package/src/emit/{relationship → application/relationship}/templates/GetRelationship_Main.ejs +3 -2
  28. package/src/emit/{relationship → application/relationship}/templates/MoveRelationship_Main.ejs +3 -2
  29. package/src/emit/{relationship → application/relationship}/templates/UpdateRelationship_Main.ejs +3 -2
  30. package/src/emit/{system → application/system}/emitSystemFindDataArtifacts.js +1 -1
  31. package/src/emit/{system → application/system}/templates/RegisterComplete_Main.ejs +6 -2
  32. package/src/emit/{system → application/system}/templates/Register_Main.ejs +6 -2
  33. package/src/emit/{system → application/system}/templates/WebSocketComplete_Main.ejs +3 -3
  34. package/src/emit/{resource → infrastructure/resources}/generateResourceArtifacts.js +2 -2
  35. package/src/emit/{resource → infrastructure/resources}/iamResourceArtifacts.js +3 -3
  36. package/src/emit/{resource → infrastructure/resources}/resourceState.js +4 -4
  37. package/src/emit/{attributeTree → schemas/attributeTree}/emitAttributeTreeSchemas.js +14 -22
  38. package/src/emit/schemas/attributeTree/emitAttributeTreeTargetValueStandard.js +132 -0
  39. package/src/emit/schemas/ledger/emitLedgerSchemas.js +392 -0
  40. package/src/emit/schemas/ledger/templates/LedgerObjectSchema.ejs +3 -0
  41. package/src/emit/schemas/ledger/templates/LedgerRelationshipSchema.ejs +1 -0
  42. package/src/emit/schemas/propertyValue/emitPropertyValueSchemas.js +329 -0
  43. package/src/emit/{systemText → schemas/systemText}/emitSystemTextSchemas.js +1 -1
  44. package/src/generate.js +34 -308
  45. package/src/{generateIntTest.js → intTest/generateIntTest.js} +2 -2
  46. package/src/{generateResourceIntTest.js → intTest/generateResourceIntTest.js} +2 -2
  47. package/src/output/mergeHooks.js +69 -15
  48. package/src/plan/domainRegistry.js +307 -0
  49. package/task.md +132 -0
  50. package/test/helpers/testProject.js +127 -0
  51. package/test/helpers/testProject.test.js +57 -0
  52. package/test/{core.test.js → integration/core.test.js} +3 -3
  53. package/test/{graphDrivenFlowSchema.test.js → integration/graphDrivenFlowSchema.test.js} +1 -1
  54. package/test/{intTestApi.test.js → integration/intTestApi.test.js} +1 -1
  55. package/test/{publicApi.test.js → integration/publicApi.test.js} +55 -2
  56. package/test/{createTargetRoleHandler.test.js → unit/application/createTargetRoleHandler.test.js} +1 -1
  57. package/test/{crudApplicationArtifacts.test.js → unit/application/crudApplicationArtifacts.test.js} +1 -1
  58. package/test/{customFlowApplicationArtifacts.test.js → unit/application/customFlowApplicationArtifacts.test.js} +18 -9
  59. package/test/{relationshipApplicationArtifacts.test.js → unit/application/relationshipApplicationArtifacts.test.js} +31 -1
  60. package/test/{systemFindDataArtifacts.test.js → unit/application/systemFindDataArtifacts.test.js} +1 -1
  61. package/test/{functionYamlArtifact.test.js → unit/infrastructure/functionYamlArtifact.test.js} +1 -1
  62. package/test/{resourceArtifacts.test.js → unit/infrastructure/resourceArtifacts.test.js} +2 -1
  63. package/test/unit/output/mergeHooks.test.js +268 -0
  64. package/test/unit/schemas/attributeTreeDirectives.test.js +177 -0
  65. package/test/{attributeTreeSchemas.test.js → unit/schemas/attributeTreeSchemas.test.js} +46 -102
  66. package/test/{dynamicCrudFlowSchemas.test.js → unit/schemas/dynamicCrudFlowSchemas.test.js} +2 -2
  67. package/test/{dynamicRbacFlowSchemas.test.js → unit/schemas/dynamicRbacFlowSchemas.test.js} +1 -1
  68. package/test/{dynamicRelationshipFlowSchemas.test.js → unit/schemas/dynamicRelationshipFlowSchemas.test.js} +11 -1
  69. package/test/{errorSchemas.test.js → unit/schemas/errorSchemas.test.js} +2 -2
  70. package/test/unit/schemas/ledgerSchemas.test.js +289 -0
  71. package/test/unit/schemas/propertyValueSchemas.test.js +265 -0
  72. package/test/{systemTextSchemas.test.js → unit/schemas/systemTextSchemas.test.js} +24 -36
  73. package/src/emit/attributeTree/emitAttributeTreeTargetSchemas.js +0 -153
  74. package/src/emit/attributeTree/resolveTargetServicePath.js +0 -111
  75. package/src/emit/crud/loadLocalSchemaArrays.js +0 -4
  76. /package/src/emit/{coreFunction → application/coreFunction}/emitCoreFunctionArtifacts.js +0 -0
  77. /package/src/emit/{coreFunction → application/coreFunction}/templates/CoreFunction_Yaml.ejs +0 -0
  78. /package/src/emit/{coreFunction → application/coreFunction}/templates/CoreResource_Yaml.ejs +0 -0
  79. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataDynamo_HdrInv.ejs +0 -0
  80. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataDynamo_Main.ejs +0 -0
  81. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphData_HdrInv.ejs +0 -0
  82. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphData_Main.ejs +0 -0
  83. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphSchema_HdrInv.ejs +0 -0
  84. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphSchema_Main.ejs +0 -0
  85. /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedGraphNodeSchemas.ejs +0 -0
  86. /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedGraphRelSchemas.ejs +0 -0
  87. /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedTableConfigs.ejs +0 -0
  88. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupConfig.ejs +0 -0
  89. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner.ejs +0 -0
  90. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_initialSetup.ejs +0 -0
  91. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedDynamo.ejs +0 -0
  92. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedGraph.ejs +0 -0
  93. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedRemove.ejs +0 -0
  94. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_uploadSchema.ejs +0 -0
  95. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetup_HdrInv.ejs +0 -0
  96. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetup_Main.ejs +0 -0
  97. /package/src/emit/{coreFunction → application/coreFunction}/templates/RemoveSeedDataDynamo_HdrInv.ejs +0 -0
  98. /package/src/emit/{coreFunction → application/coreFunction}/templates/RemoveSeedDataDynamo_Main.ejs +0 -0
  99. /package/src/emit/{coreFunction → application/coreFunction}/templates/UploadSchema_HdrInv.ejs +0 -0
  100. /package/src/emit/{coreFunction → application/coreFunction}/templates/UploadSchema_Main.ejs +0 -0
  101. /package/src/emit/{crud → application/crud}/crudActionPlan.js +0 -0
  102. /package/src/emit/{crud → application/crud}/dynamicCrudFlowSchemaTemplate.js +0 -0
  103. /package/src/emit/{crud → application/crud}/emitDynamicCrudFlowSchemas.js +0 -0
  104. /package/src/emit/{crud → application/crud}/templates/CreateAfterHookCallback_Main.ejs +0 -0
  105. /package/src/emit/{crud → application/crud}/templates/CreateBeforeHookCallback_Main.ejs +0 -0
  106. /package/src/emit/{crud → application/crud}/templates/CreateComplete_Main.ejs +0 -0
  107. /package/src/emit/{crud → application/crud}/templates/CreateConfirmComplete_Main.ejs +0 -0
  108. /package/src/emit/{crud → application/crud}/templates/CreateEndpoint_Main.ejs +0 -0
  109. /package/src/emit/{crud → application/crud}/templates/CreateLogicalLib.ejs +0 -0
  110. /package/src/emit/{crud → application/crud}/templates/CreateNodeCallback_Main.ejs +0 -0
  111. /package/src/emit/{crud → application/crud}/templates/DeleteAfterHookCallback_Main.ejs +0 -0
  112. /package/src/emit/{crud → application/crud}/templates/DeleteBeforeHookCallback_Main.ejs +0 -0
  113. /package/src/emit/{crud → application/crud}/templates/DeleteComplete_Main.ejs +0 -0
  114. /package/src/emit/{crud → application/crud}/templates/DeleteEndpoint_Main.ejs +0 -0
  115. /package/src/emit/{crud → application/crud}/templates/DeleteLogicalLib.ejs +0 -0
  116. /package/src/emit/{crud → application/crud}/templates/FlowEndpointRbacCallback_Main.ejs +0 -0
  117. /package/src/emit/{crud → application/crud}/templates/GetEndpoint_Main.ejs +0 -0
  118. /package/src/emit/{crud → application/crud}/templates/GetRangeEndpoint_Main.ejs +0 -0
  119. /package/src/emit/{crud → application/crud}/templates/UpdateAfterHookCallback_Main.ejs +0 -0
  120. /package/src/emit/{crud → application/crud}/templates/UpdateBeforeHookCallback_Main.ejs +0 -0
  121. /package/src/emit/{crud → application/crud}/templates/UpdateComplete_Main.ejs +0 -0
  122. /package/src/emit/{crud → application/crud}/templates/UpdateEndpoint_Main.ejs +0 -0
  123. /package/src/emit/{crud → application/crud}/templates/UpdateLogicalLib.ejs +0 -0
  124. /package/src/emit/{custom → application/custom}/customFlowPaths.js +0 -0
  125. /package/src/emit/{custom → application/custom}/customFlows.js +0 -0
  126. /package/src/emit/{custom → application/custom}/templates/FlowEndpointRbacCallback_Main.ejs +0 -0
  127. /package/src/emit/{custom → application/custom}/templates/FlowEndpoint_Main.ejs +0 -0
  128. /package/src/emit/{custom → application/custom}/templates/FlowStep_Main.ejs +0 -0
  129. /package/src/emit/{custom → application/custom}/templates/s3/ConfirmReserved_HdrSqs.ejs +0 -0
  130. /package/src/emit/{custom → application/custom}/templates/s3/ConfirmReserved_Main.ejs +0 -0
  131. /package/src/emit/{custom → application/custom}/templates/s3/CreateObject_HdrWbs.ejs +0 -0
  132. /package/src/emit/{custom → application/custom}/templates/s3/CreatePreSignUrl_HdrSqs.ejs +0 -0
  133. /package/src/emit/{custom → application/custom}/templates/s3/CreatePreSignUrl_Main.ejs +0 -0
  134. /package/src/emit/{custom → application/custom}/templates/s3/FlowHandler_HdrS3.ejs +0 -0
  135. /package/src/emit/{custom → application/custom}/templates/s3/ProcessS3File_Main.ejs +0 -0
  136. /package/src/emit/{custom → application/custom}/templates/s3/ReservedLimit_HdrSqs.ejs +0 -0
  137. /package/src/emit/{custom → application/custom}/templates/s3/ReservedLimit_Main.ejs +0 -0
  138. /package/src/emit/{custom → application/custom}/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +0 -0
  139. /package/src/emit/{custom → application/custom}/templates/triggerCache/TriggerCacheComplete_Main.ejs +0 -0
  140. /package/src/emit/{custom → application/custom}/templates/triggerCache/TriggerCache_Main.ejs +0 -0
  141. /package/src/emit/{rbac → application/rbac}/emitDynamicRbacFlowSchemas.js +0 -0
  142. /package/src/emit/{rbac → application/rbac}/rbacFlowTag.js +0 -0
  143. /package/src/emit/{rbac → application/rbac}/templates/CancelUsage_Main.ejs +0 -0
  144. /package/src/emit/{rbac → application/rbac}/templates/ConfirmUsage_Main.ejs +0 -0
  145. /package/src/emit/{rbac → application/rbac}/templates/CreateTargetRole_HdrSqs.ejs +0 -0
  146. /package/src/emit/{rbac → application/rbac}/templates/CreateTargetRole_Main.ejs +0 -0
  147. /package/src/emit/{rbac → application/rbac}/templates/DeleteTargetRole_Main.ejs +0 -0
  148. /package/src/emit/{rbac → application/rbac}/templates/DynamicRbacFlowSchema.ejs +0 -0
  149. /package/src/emit/{rbac → application/rbac}/templates/GetMyPermissions_Main.ejs +0 -0
  150. /package/src/emit/{rbac → application/rbac}/templates/GetTargetRole_Main.ejs +0 -0
  151. /package/src/emit/{rbac → application/rbac}/templates/ListRbac_HdrApi.ejs +0 -0
  152. /package/src/emit/{rbac → application/rbac}/templates/ListRbac_HdrSqs.ejs +0 -0
  153. /package/src/emit/{rbac → application/rbac}/templates/ListRbac_Main.ejs +0 -0
  154. /package/src/emit/{rbac → application/rbac}/templates/RbacMutation_Main.ejs +0 -0
  155. /package/src/emit/{rbac → application/rbac}/templates/ReservedDynamicUsage_Main.ejs +0 -0
  156. /package/src/emit/{rbac → application/rbac}/templates/UpdateTargetRole_Main.ejs +0 -0
  157. /package/src/emit/{rbac → application/rbac}/templates/UserRbacFlow_HdrSqs.ejs +0 -0
  158. /package/src/emit/{rbac → application/rbac}/templates/UserRbacFlow_Main.ejs +0 -0
  159. /package/src/emit/{rbac → application/rbac}/templates/UserRoleMutation_Main.ejs +0 -0
  160. /package/src/emit/{relationship → application/relationship}/emitDynamicRelationshipFlowSchemas.js +0 -0
  161. /package/src/emit/{relationship → application/relationship}/templates/ChangeRelationshipComplete_HdrSqs.ejs +0 -0
  162. /package/src/emit/{relationship → application/relationship}/templates/ChangeRelationshipComplete_Main.ejs +0 -0
  163. /package/src/emit/{relationship → application/relationship}/templates/CreateRelationshipComplete_HdrSqs.ejs +0 -0
  164. /package/src/emit/{relationship → application/relationship}/templates/CreateRelationshipComplete_Main.ejs +0 -0
  165. /package/src/emit/{relationship → application/relationship}/templates/DeleteRelationshipComplete_HdrSqs.ejs +0 -0
  166. /package/src/emit/{relationship → application/relationship}/templates/DeleteRelationshipComplete_Main.ejs +0 -0
  167. /package/src/emit/{relationship → application/relationship}/templates/GetRelationshipComplete_HdrSqs.ejs +0 -0
  168. /package/src/emit/{relationship → application/relationship}/templates/GetRelationshipComplete_Main.ejs +0 -0
  169. /package/src/emit/{relationship → application/relationship}/templates/MoveRelationshipComplete_HdrSqs.ejs +0 -0
  170. /package/src/emit/{relationship → application/relationship}/templates/MoveRelationshipComplete_Main.ejs +0 -0
  171. /package/src/emit/{relationship → application/relationship}/templates/UpdateRelationshipComplete_HdrSqs.ejs +0 -0
  172. /package/src/emit/{relationship → application/relationship}/templates/UpdateRelationshipComplete_Main.ejs +0 -0
  173. /package/src/emit/{system → application/system}/emitSystemWebSocketArtifacts.js +0 -0
  174. /package/src/emit/{system → application/system}/templates/RegisterComplete_HdrSqs.ejs +0 -0
  175. /package/src/emit/{system → application/system}/templates/RegisterComplete_Yaml.ejs +0 -0
  176. /package/src/emit/{system → application/system}/templates/RegisterWbs_Yaml.ejs +0 -0
  177. /package/src/emit/{system → application/system}/templates/Register_HdrWbs.ejs +0 -0
  178. /package/src/emit/{system → application/system}/templates/WebSocketComplete_HdrSqs.ejs +0 -0
  179. /package/src/emit/{system → application/system}/templates/WebSocketComplete_Yaml.ejs +0 -0
  180. /package/src/emit/{system → application/system}/templates/WebSocketConnect.ejs +0 -0
  181. /package/src/emit/{system → application/system}/templates/WebSocketConnect_Yaml.ejs +0 -0
  182. /package/src/emit/{function → infrastructure/functions}/functionYamlArtifact.js +0 -0
  183. /package/src/emit/{function → infrastructure/functions}/templates/ApiFunction_Yaml.ejs +0 -0
  184. /package/src/emit/{function → infrastructure/functions}/templates/EventBridgeFunction_Yaml.ejs +0 -0
  185. /package/src/emit/{function → infrastructure/functions}/templates/InvFunction_Yaml.ejs +0 -0
  186. /package/src/emit/{function → infrastructure/functions}/templates/S3Function_Yaml.ejs +0 -0
  187. /package/src/emit/{function → infrastructure/functions}/templates/SqsFunction_Yaml.ejs +0 -0
  188. /package/src/emit/{function → infrastructure/functions}/templates/WbsFunction_Yaml.ejs +0 -0
  189. /package/src/emit/{resource → infrastructure/resources}/dynamoResourceArtifacts.js +0 -0
  190. /package/src/emit/{resource → infrastructure/resources}/emitResourceArtifacts.js +0 -0
  191. /package/src/emit/{resource → infrastructure/resources}/resourceTemplate.js +0 -0
  192. /package/src/emit/{resource → infrastructure/resources}/s3ResourceArtifacts.js +0 -0
  193. /package/src/emit/{resource → infrastructure/resources}/sqsResourceArtifacts.js +0 -0
  194. /package/src/emit/{resource → infrastructure/resources}/templates/DynamoDBTable_Yaml.ejs +0 -0
  195. /package/src/emit/{resource → infrastructure/resources}/templates/FlowOut_Yaml.ejs +0 -0
  196. /package/src/emit/{resource → infrastructure/resources}/templates/GeneratedLambdaRoleServiceConfig.ejs +0 -0
  197. /package/src/emit/{resource → infrastructure/resources}/templates/ResourceSqsYaml.ejs +0 -0
  198. /package/src/emit/{resource → infrastructure/resources}/templates/ResourceYaml.ejs +0 -0
  199. /package/src/emit/{resource → infrastructure/resources}/templates/S3Bucket_Yaml.ejs +0 -0
  200. /package/src/emit/{resource → infrastructure/resources}/templates/S3Subscription_Yaml.ejs +0 -0
  201. /package/src/emit/{resource → infrastructure/resources}/templates/SharedResource_Yaml.ejs +0 -0
  202. /package/src/emit/{resource → infrastructure/resources}/templates/SystemDynamoDB_Yaml.ejs +0 -0
  203. /package/src/emit/{resource → infrastructure/resources}/templates/WebSocketSubscription_Yaml.ejs +0 -0
  204. /package/src/emit/{error → schemas/error}/emitErrorSchemas.js +0 -0
  205. /package/src/emit/{error → schemas/error}/templates/errorSchema.ejs +0 -0
  206. /package/src/emit/{systemText → schemas/systemText}/templates/SystemTextSchemas.ejs +0 -0
  207. /package/src/{generateResources/IntTest → intTest/generators}/consts.js +0 -0
  208. /package/src/{generateResources/IntTest → intTest/generators}/generateResources/generateResources.js +0 -0
  209. /package/src/{generateResources/IntTest → intTest/generators}/generateResources/templateResources.ejs +0 -0
  210. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/events/events.js +0 -0
  211. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/events/templateEvents.ejs +0 -0
  212. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/generateTemplate.js +0 -0
  213. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/pathIntTest/pathIntTest.js +0 -0
  214. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/pathIntTest/template.ejs +0 -0
  215. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/tests/templateTests.ejs +0 -0
  216. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/tests/tests.js +0 -0
  217. /package/src/{generateResources/IntTest → intTest/generators}/libs/IntTestGenerateLib.js +0 -0
  218. /package/src/{generateResources/IntTest → intTest/generators}/upload/uploadIntTest.js +0 -0
  219. /package/src/{intTestGeneratorShared.js → intTest/intTestGeneratorShared.js} +0 -0
@@ -1,6 +1,3 @@
1
- import { resolveTargetServicePath } from './resolveTargetServicePath.js';
2
- import { emitAttributeTreeTargetSchemas } from './emitAttributeTreeTargetSchemas.js';
3
-
4
1
  /**
5
2
  * Emits dynamic ObjectSchemas and RelationshipSchemas for attributeTree add-ons
6
3
  */
@@ -72,9 +69,9 @@ export function attributeTreeObjectSchemaManagedPaths(objects = []) {
72
69
  for (const { attributeTreeTag } of trees) {
73
70
  const tag = attributeTreeTag;
74
71
  paths.push(
75
- `app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}Link.js`,
76
- `app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}Value.js`,
77
- `app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}Label.js`
72
+ `app/src/schemas/ObjectSchemas/generatedCode/attributeTree/${tag}Link.js`,
73
+ `app/src/schemas/ObjectSchemas/generatedCode/attributeTree/${tag}Value.js`,
74
+ `app/src/schemas/ObjectSchemas/generatedCode/attributeTree/${tag}Label.js`
78
75
  );
79
76
  }
80
77
 
@@ -89,10 +86,10 @@ export function attributeTreeRelationshipSchemaManagedPaths(objects = []) {
89
86
  const tag = attributeTreeTag;
90
87
  const tagCap = _capitalize(tag);
91
88
  paths.push(
92
- `app/src/schemas/RelationshipSchemas/generatedAttributeTree/has${tagCap}Link.js`,
93
- `app/src/schemas/RelationshipSchemas/generatedAttributeTree/disabled${tagCap}Link.js`,
94
- `app/src/schemas/RelationshipSchemas/generatedAttributeTree/is${tagCap}.js`,
95
- `app/src/schemas/RelationshipSchemas/generatedAttributeTree/is${tagCap}Label.js`
89
+ `app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/has${tagCap}Link.js`,
90
+ `app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/disabled${tagCap}Link.js`,
91
+ `app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/is${tagCap}.js`,
92
+ `app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/is${tagCap}Label.js`
96
93
  );
97
94
  }
98
95
 
@@ -141,7 +138,7 @@ export function emitAttributeTreeObjectSchemas({ objects = [] } = {}) {
141
138
  ]
142
139
  };
143
140
  artifacts.push({
144
- path: `app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}Link.js`,
141
+ path: `app/src/schemas/ObjectSchemas/generatedCode/attributeTree/${tag}Link.js`,
145
142
  content: _renderObjectSchema(linkSchema)
146
143
  });
147
144
 
@@ -173,7 +170,7 @@ export function emitAttributeTreeObjectSchemas({ objects = [] } = {}) {
173
170
  ]
174
171
  };
175
172
  artifacts.push({
176
- path: `app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}Value.js`,
173
+ path: `app/src/schemas/ObjectSchemas/generatedCode/attributeTree/${tag}Value.js`,
177
174
  content: _renderObjectSchema(valueSchema)
178
175
  });
179
176
 
@@ -205,7 +202,7 @@ export function emitAttributeTreeObjectSchemas({ objects = [] } = {}) {
205
202
  ]
206
203
  };
207
204
  artifacts.push({
208
- path: `app/src/schemas/ObjectSchemas/generatedAttributeTree/${tag}Label.js`,
205
+ path: `app/src/schemas/ObjectSchemas/generatedCode/attributeTree/${tag}Label.js`,
209
206
  content: _renderObjectSchema(labelSchema)
210
207
  });
211
208
  }
@@ -260,7 +257,7 @@ export function emitAttributeTreeRelationshipSchemas({
260
257
  ]
261
258
  };
262
259
  artifacts.push({
263
- path: `app/src/schemas/RelationshipSchemas/generatedAttributeTree/has${tagCap}Link.js`,
260
+ path: `app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/has${tagCap}Link.js`,
264
261
  content: _renderRelationshipSchema(`has${tagCap}Link`, hasLinkRel)
265
262
  });
266
263
 
@@ -290,7 +287,7 @@ export function emitAttributeTreeRelationshipSchemas({
290
287
  ]
291
288
  };
292
289
  artifacts.push({
293
- path: `app/src/schemas/RelationshipSchemas/generatedAttributeTree/disabled${tagCap}Link.js`,
290
+ path: `app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/disabled${tagCap}Link.js`,
294
291
  content: _renderRelationshipSchema(
295
292
  `disabled${tagCap}Link`,
296
293
  disabledLinkRel
@@ -324,7 +321,7 @@ export function emitAttributeTreeRelationshipSchemas({
324
321
  ]
325
322
  };
326
323
  artifacts.push({
327
- path: `app/src/schemas/RelationshipSchemas/generatedAttributeTree/is${tagCap}.js`,
324
+ path: `app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/is${tagCap}.js`,
328
325
  content: _renderRelationshipSchema(`is${tagCap}`, isRel)
329
326
  });
330
327
 
@@ -355,15 +352,10 @@ export function emitAttributeTreeRelationshipSchemas({
355
352
  ]
356
353
  };
357
354
  artifacts.push({
358
- path: `app/src/schemas/RelationshipSchemas/generatedAttributeTree/is${tagCap}Label.js`,
355
+ path: `app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/is${tagCap}Label.js`,
359
356
  content: _renderRelationshipSchema(`is${tagCap}Label`, isLabelRel)
360
357
  });
361
358
  }
362
359
 
363
360
  return artifacts;
364
361
  }
365
-
366
- export {
367
- resolveTargetServicePath,
368
- emitAttributeTreeTargetSchemas
369
- };
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Emits target ValueStandard ObjectSchema for attributeTreeTarget directives
3
+ */
4
+
5
+ function _extractTargetDirectives(directives = []) {
6
+ if (!Array.isArray(directives)) {
7
+ return [];
8
+ }
9
+ const results = [];
10
+ const seenTags = new Set();
11
+
12
+ for (const directive of directives) {
13
+ if (
14
+ directive?.type === 'attributeTreeTarget' &&
15
+ directive?.attributeTreeTag
16
+ ) {
17
+ const tag = directive.attributeTreeTag;
18
+ if (seenTags.has(tag)) {
19
+ continue;
20
+ }
21
+ seenTags.add(tag);
22
+ results.push(directive);
23
+ }
24
+ }
25
+
26
+ return results;
27
+ }
28
+
29
+ function _extractStorageResources(directive) {
30
+ if (directive?.storageResources) {
31
+ return directive.storageResources;
32
+ }
33
+ return {
34
+ myGraph: {
35
+ storageType: 'graph',
36
+ graphServerTag: 'GraphHandler'
37
+ }
38
+ };
39
+ }
40
+
41
+ function _renderTargetValueStandardSchema(tag, storageResources) {
42
+ const storageResourceTags = Object.keys(storageResources);
43
+ if (storageResourceTags.length === 0) {
44
+ storageResourceTags.push('myGraph');
45
+ }
46
+
47
+ const storageJson = JSON.stringify(storageResources, null, 2)
48
+ .replace(/\n/g, '\n ');
49
+ const tagsJson = JSON.stringify(storageResourceTags);
50
+
51
+ return `export default [
52
+ {
53
+ objectType: '${tag}ValueStandard',
54
+ canDelete: true,
55
+ generatedBy: 'user',
56
+ storageResources: ${storageJson},
57
+ addOnDataStructure: [
58
+ //(<addOnDataStructure${tag}ValueStandard>)
59
+ // {
60
+ // type: 'propertyValue',
61
+ // propertyValuePrefix: '${tag}ValueStandard'
62
+ // }
63
+ //(</addOnDataStructure${tag}ValueStandard>)
64
+ ],
65
+ fieldNames: {
66
+ ${tag}ValueStandardId: {
67
+ type: 'string',
68
+ randomOnCreate: true,
69
+ canUpdate: false,
70
+ storageResourceTags: ${tagsJson}
71
+ },
72
+ label: {
73
+ type: 'string',
74
+ canUpdate: true,
75
+ storageResourceTags: ${tagsJson}
76
+ },
77
+ value: {
78
+ type: 'string',
79
+ requiredOnCreate: true,
80
+ canUpdate: true,
81
+ storageResourceTags: ${tagsJson}
82
+ }
83
+ },
84
+ identifiers: [
85
+ {
86
+ type: 'identifier',
87
+ fieldName: '${tag}ValueStandardId'
88
+ }
89
+ ]
90
+ }
91
+ ];
92
+ `;
93
+ }
94
+
95
+ export function attributeTreeTargetValueStandardManagedPaths(directives = []) {
96
+ const targets = _extractTargetDirectives(directives);
97
+ const paths = [];
98
+
99
+ for (const directive of targets) {
100
+ const tag = directive.attributeTreeTag;
101
+ paths.push(
102
+ `app/src/schemas/ObjectSchemas/generatedCode/attributeTree/` +
103
+ `${tag}ValueStandard.js`
104
+ );
105
+ }
106
+
107
+ return paths;
108
+ }
109
+
110
+ export function emitAttributeTreeTargetValueStandard({
111
+ directives = []
112
+ } = {}) {
113
+ const targets = _extractTargetDirectives(directives);
114
+ if (targets.length === 0) {
115
+ return [];
116
+ }
117
+
118
+ const artifacts = [];
119
+
120
+ for (const directive of targets) {
121
+ const tag = directive.attributeTreeTag;
122
+ const storageResources = _extractStorageResources(directive);
123
+ artifacts.push({
124
+ path:
125
+ `app/src/schemas/ObjectSchemas/generatedCode/attributeTree/` +
126
+ `${tag}ValueStandard.js`,
127
+ content: _renderTargetValueStandardSchema(tag, storageResources)
128
+ });
129
+ }
130
+
131
+ return artifacts;
132
+ }
@@ -0,0 +1,392 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import ejsLib from 'ejs';
3
+
4
+ const TEMPLATE_URL = new URL('./templates/', import.meta.url);
5
+
6
+ /**
7
+ * Emits dynamic ObjectSchemas and RelationshipSchemas for ledger add-ons
8
+ */
9
+
10
+ function _capitalize(str) {
11
+ if (!str || typeof str !== 'string') {
12
+ return '';
13
+ }
14
+ return str.charAt(0).toUpperCase() + str.slice(1);
15
+ }
16
+
17
+ function _createLedgerComponent(prefix) {
18
+ const cap = _capitalize(prefix);
19
+ return {
20
+ oldRelationshipTag: `old${cap}`,
21
+ newRelationshipTag: `current${cap}`,
22
+ objectType: `${prefix}Entry`
23
+ };
24
+ }
25
+
26
+ function _extractLedgers(objects = []) {
27
+ if (!Array.isArray(objects)) {
28
+ return [];
29
+ }
30
+ const results = [];
31
+ const seenPrefixes = new Set();
32
+
33
+ for (const object of objects) {
34
+ if (!Array.isArray(object?.addOnDataStructure)) {
35
+ continue;
36
+ }
37
+ for (const addOn of object.addOnDataStructure) {
38
+ if (addOn?.type === 'ledger' && addOn?.prefix) {
39
+ if (seenPrefixes.has(addOn.prefix)) {
40
+ continue;
41
+ }
42
+ seenPrefixes.add(addOn.prefix);
43
+ results.push({
44
+ parentObject: object,
45
+ addOn,
46
+ prefix: addOn.prefix,
47
+ component: _createLedgerComponent(addOn.prefix)
48
+ });
49
+ }
50
+ }
51
+ }
52
+
53
+ return results;
54
+ }
55
+
56
+ function _extractGraphStorageResources(object, storageResourceTag) {
57
+ const result = {};
58
+ if (object?.storageResources) {
59
+ if (
60
+ storageResourceTag &&
61
+ object.storageResources[storageResourceTag]?.storageType === 'graph'
62
+ ) {
63
+ let graphServerTag = 'GraphHandler';
64
+ if (object.storageResources[storageResourceTag].graphServerTag) {
65
+ graphServerTag =
66
+ object.storageResources[storageResourceTag].graphServerTag;
67
+ }
68
+ result[storageResourceTag] = {
69
+ storageType: 'graph',
70
+ graphServerTag
71
+ };
72
+ return result;
73
+ }
74
+ for (const [tag, res] of Object.entries(object.storageResources)) {
75
+ if (res?.storageType === 'graph') {
76
+ let graphServerTag = 'GraphHandler';
77
+ if (res.graphServerTag) {
78
+ graphServerTag = res.graphServerTag;
79
+ }
80
+ result[tag] = {
81
+ storageType: 'graph',
82
+ graphServerTag
83
+ };
84
+ }
85
+ }
86
+ }
87
+ if (Object.keys(result).length === 0) {
88
+ let defaultTag = 'graph';
89
+ if (storageResourceTag) {
90
+ defaultTag = storageResourceTag;
91
+ }
92
+ result[defaultTag] = {
93
+ storageType: 'graph',
94
+ graphServerTag: 'GraphHandler'
95
+ };
96
+ }
97
+ return result;
98
+ }
99
+
100
+ function _renderObjectSchema(template, schema) {
101
+ return ejsLib.render(template, { schema });
102
+ }
103
+
104
+ function _renderRelationshipSchema(template, relationshipTag, content) {
105
+ const wrapper = [{ [relationshipTag]: content }];
106
+ return ejsLib.render(template, {
107
+ relationshipTag,
108
+ content,
109
+ wrapper
110
+ });
111
+ }
112
+
113
+ function _buildParentToEntryLinks({
114
+ storageResourceTags,
115
+ effectiveServiceTag,
116
+ parentObjectType,
117
+ entryObjectType
118
+ }) {
119
+ return [
120
+ {
121
+ storageResourceTags,
122
+ canDelete: true,
123
+ from: {
124
+ objType: {
125
+ serviceTag: effectiveServiceTag,
126
+ objectType: parentObjectType
127
+ },
128
+ linkType: 'many',
129
+ requiredOnCreate: false,
130
+ belongTo: true
131
+ },
132
+ to: {
133
+ objType: {
134
+ serviceTag: effectiveServiceTag,
135
+ objectType: entryObjectType
136
+ },
137
+ linkType: 'one',
138
+ requiredOnCreate: false
139
+ }
140
+ }
141
+ ];
142
+ }
143
+
144
+ export function ledgerObjectSchemaManagedPaths(objects = []) {
145
+ const ledgers = _extractLedgers(objects);
146
+ const paths = [];
147
+
148
+ for (const { component } of ledgers) {
149
+ paths.push(
150
+ `app/src/schemas/ObjectSchemas/generatedLedger/${component.objectType}.js`
151
+ );
152
+ }
153
+
154
+ return paths;
155
+ }
156
+
157
+ export function ledgerRelationshipSchemaManagedPaths(objects = []) {
158
+ const ledgers = _extractLedgers(objects);
159
+ const paths = [];
160
+
161
+ for (const { component, addOn } of ledgers) {
162
+ paths.push(
163
+ `app/src/schemas/RelationshipSchemas/generatedLedger/${component.newRelationshipTag}.js`,
164
+ `app/src/schemas/RelationshipSchemas/generatedLedger/${component.oldRelationshipTag}.js`
165
+ );
166
+
167
+ let hasTargets = false;
168
+ if (addOn?.targetObjType) {
169
+ hasTargets = true;
170
+ } else if (
171
+ Array.isArray(addOn?.moveToTargetObjTypes) &&
172
+ addOn.moveToTargetObjTypes.length > 0
173
+ ) {
174
+ hasTargets = true;
175
+ }
176
+
177
+ if (hasTargets) {
178
+ const isRelTag = `is${_capitalize(component.objectType)}`;
179
+ paths.push(
180
+ `app/src/schemas/RelationshipSchemas/generatedLedger/${isRelTag}.js`
181
+ );
182
+ }
183
+ }
184
+
185
+ return paths;
186
+ }
187
+
188
+ export async function emitLedgerObjectSchemas({ objects = [] } = {}) {
189
+ const ledgers = _extractLedgers(objects);
190
+ if (ledgers.length === 0) {
191
+ return [];
192
+ }
193
+
194
+ const template = await readFile(
195
+ new URL('LedgerObjectSchema.ejs', TEMPLATE_URL),
196
+ 'utf8'
197
+ );
198
+ const artifacts = [];
199
+
200
+ for (const { parentObject, addOn, component } of ledgers) {
201
+ const objectType = component.objectType;
202
+ const graphStorageResources = _extractGraphStorageResources(
203
+ parentObject,
204
+ addOn.storageResourceTag
205
+ );
206
+ const storageResourceTags = Object.keys(graphStorageResources);
207
+
208
+ const schema = {
209
+ objectType,
210
+ generatedBy: 'systemNoUser',
211
+ canDelete: false,
212
+ storageResources: graphStorageResources,
213
+ fieldNames: {
214
+ [`${objectType}Id`]: {
215
+ storageResourceTags,
216
+ type: 'string',
217
+ randomOnCreate: true,
218
+ canUpdate: false,
219
+ requiredOnCreate: false,
220
+ optionalOnCreate: false
221
+ }
222
+ },
223
+ identifiers: [
224
+ {
225
+ type: 'identifier',
226
+ fieldName: `${objectType}Id`
227
+ }
228
+ ]
229
+ };
230
+
231
+ artifacts.push({
232
+ path: `app/src/schemas/ObjectSchemas/generatedLedger/${objectType}.js`,
233
+ content: _renderObjectSchema(template, schema)
234
+ });
235
+ }
236
+
237
+ return artifacts;
238
+ }
239
+
240
+ export async function emitLedgerRelationshipSchemas({
241
+ objects = [],
242
+ serviceTag = ''
243
+ } = {}) {
244
+ const ledgers = _extractLedgers(objects);
245
+ if (ledgers.length === 0) {
246
+ return [];
247
+ }
248
+
249
+ const template = await readFile(
250
+ new URL('LedgerRelationshipSchema.ejs', TEMPLATE_URL),
251
+ 'utf8'
252
+ );
253
+ const artifacts = [];
254
+
255
+ for (const { parentObject, addOn, component } of ledgers) {
256
+ let effectiveServiceTag = 'CurrentService';
257
+ if (parentObject?.serviceTag) {
258
+ effectiveServiceTag = parentObject.serviceTag;
259
+ } else if (serviceTag) {
260
+ effectiveServiceTag = serviceTag;
261
+ }
262
+
263
+ const graphStorageResources = _extractGraphStorageResources(
264
+ parentObject,
265
+ addOn.storageResourceTag
266
+ );
267
+ const storageResourceTags = Object.keys(graphStorageResources);
268
+
269
+ const parentToEntryLinks = _buildParentToEntryLinks({
270
+ storageResourceTags,
271
+ effectiveServiceTag,
272
+ parentObjectType: parentObject.objectType,
273
+ entryObjectType: component.objectType
274
+ });
275
+
276
+ // 1. current<Prefix>.js
277
+ const currentRel = {
278
+ generatedBy: 'user',
279
+ storageResources: graphStorageResources,
280
+ canChangeToRelTypes: [
281
+ {
282
+ relType: {
283
+ serviceTag: effectiveServiceTag,
284
+ relationshipTag: component.oldRelationshipTag
285
+ },
286
+ changeBy: 'systemWithUser'
287
+ }
288
+ ],
289
+ fieldNames: {
290
+ fromTimestamp: {
291
+ type: 'number',
292
+ requiredOnCreate: true,
293
+ canUpdate: false
294
+ }
295
+ },
296
+ links: parentToEntryLinks
297
+ };
298
+ artifacts.push({
299
+ path: `app/src/schemas/RelationshipSchemas/generatedLedger/${component.newRelationshipTag}.js`,
300
+ content: _renderRelationshipSchema(
301
+ template,
302
+ component.newRelationshipTag,
303
+ currentRel
304
+ )
305
+ });
306
+
307
+ // 2. old<Prefix>.js
308
+ const oldRel = {
309
+ generatedBy: 'systemWithUser',
310
+ storageResources: graphStorageResources,
311
+ fieldNames: {
312
+ fromTimestamp: {
313
+ type: 'number',
314
+ requiredOnCreate: true,
315
+ canUpdate: false
316
+ },
317
+ toTimestamp: {
318
+ type: 'number',
319
+ requiredOnCreate: true,
320
+ canUpdate: false
321
+ }
322
+ },
323
+ links: parentToEntryLinks
324
+ };
325
+ artifacts.push({
326
+ path: `app/src/schemas/RelationshipSchemas/generatedLedger/${component.oldRelationshipTag}.js`,
327
+ content: _renderRelationshipSchema(
328
+ template,
329
+ component.oldRelationshipTag,
330
+ oldRel
331
+ )
332
+ });
333
+
334
+ // 3. is<Prefix>Entry.js (if targetObjType or moveToTargetObjTypes is present)
335
+ const targetObjTypes = [];
336
+ if (addOn.targetObjType?.objectType) {
337
+ targetObjTypes.push(addOn.targetObjType);
338
+ }
339
+ if (Array.isArray(addOn.moveToTargetObjTypes)) {
340
+ for (const target of addOn.moveToTargetObjTypes) {
341
+ if (target?.objectType) {
342
+ targetObjTypes.push(target);
343
+ }
344
+ }
345
+ }
346
+
347
+ if (targetObjTypes.length > 0) {
348
+ const isRelTag = `is${_capitalize(component.objectType)}`;
349
+ const isLinks = [];
350
+
351
+ for (const target of targetObjTypes) {
352
+ let targetServiceTag = effectiveServiceTag;
353
+ if (target.serviceTag) {
354
+ targetServiceTag = target.serviceTag;
355
+ }
356
+
357
+ isLinks.push({
358
+ storageResourceTags,
359
+ canDelete: true,
360
+ from: {
361
+ objType: {
362
+ serviceTag: effectiveServiceTag,
363
+ objectType: component.objectType
364
+ },
365
+ linkType: 'many',
366
+ requiredOnCreate: false
367
+ },
368
+ to: {
369
+ objType: {
370
+ serviceTag: targetServiceTag,
371
+ objectType: target.objectType
372
+ },
373
+ linkType: 'one',
374
+ requiredOnCreate: false
375
+ }
376
+ });
377
+ }
378
+
379
+ const isRel = {
380
+ generatedBy: 'systemNoUser',
381
+ storageResources: graphStorageResources,
382
+ links: isLinks
383
+ };
384
+ artifacts.push({
385
+ path: `app/src/schemas/RelationshipSchemas/generatedLedger/${isRelTag}.js`,
386
+ content: _renderRelationshipSchema(template, isRelTag, isRel)
387
+ });
388
+ }
389
+ }
390
+
391
+ return artifacts;
392
+ }
@@ -0,0 +1,3 @@
1
+ export default [
2
+ <%- JSON.stringify(schema, null, 2).replace(/\n/g, '\n ') %>
3
+ ];
@@ -0,0 +1 @@
1
+ export default <%- JSON.stringify(wrapper, null, 2) %>;