@izara_project/izara-core-generate-service-code 1.0.95 → 1.0.97

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 (210) hide show
  1. package/index.js +2 -2
  2. package/package.json +2 -1
  3. package/src/compile/loadSchemas.js +17 -318
  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/{custom → application/custom}/customFlowS3.js +1 -1
  10. package/src/emit/{custom → application/custom}/customFlowSteps.js +34 -5
  11. package/src/emit/{custom → application/custom}/customFlowTemplates.js +1 -1
  12. package/src/emit/{custom → application/custom}/emitCustomFlowApplicationArtifacts.js +1 -1
  13. package/src/emit/{custom → application/custom}/generateCustomFlowApplicationArtifacts.js +2 -2
  14. package/src/emit/{custom → application/custom}/templates/FlowEndpoint_Main.ejs +66 -4
  15. package/src/emit/{custom → application/custom}/templates/FlowStep_Main.ejs +27 -0
  16. package/src/emit/{rbac → application/rbac}/emitRbacApplicationArtifacts.js +2 -2
  17. package/src/emit/{rbac → application/rbac}/generateCreateTargetRoleHandler.js +2 -2
  18. package/src/emit/{rbac → application/rbac}/generateDynamicRbacFlowSchemas.js +2 -2
  19. package/src/emit/{relationship → application/relationship}/emitRelationshipApplicationArtifacts.js +3 -3
  20. package/src/emit/{relationship → application/relationship}/generateDynamicRelationshipFlowSchemas.js +2 -2
  21. package/src/emit/{relationship → application/relationship}/generateRelationshipApplicationArtifacts.js +2 -2
  22. package/src/emit/{system → application/system}/emitSystemFindDataArtifacts.js +1 -1
  23. package/src/emit/{resource → infrastructure/resources}/generateResourceArtifacts.js +2 -2
  24. package/src/emit/{resource → infrastructure/resources}/iamResourceArtifacts.js +2 -2
  25. package/src/emit/{resource → infrastructure/resources}/resourceState.js +4 -4
  26. package/src/emit/{attributeTree → schemas/attributeTree}/emitAttributeTreeSchemas.js +29 -48
  27. package/src/emit/schemas/attributeTree/emitAttributeTreeTargetSchemas.js +153 -0
  28. package/src/emit/schemas/attributeTree/resolveTargetServicePath.js +111 -0
  29. package/src/emit/schemas/ledger/emitLedgerSchemas.js +370 -0
  30. package/src/emit/{systemText → schemas/systemText}/emitSystemTextSchemas.js +1 -1
  31. package/src/generate.js +81 -240
  32. package/src/{generateIntTest.js → intTest/generateIntTest.js} +2 -2
  33. package/src/{generateResourceIntTest.js → intTest/generateResourceIntTest.js} +2 -2
  34. package/src/plan/domainRegistry.js +271 -0
  35. package/test/helpers/testProject.js +127 -0
  36. package/test/helpers/testProject.test.js +57 -0
  37. package/test/{core.test.js → integration/core.test.js} +3 -3
  38. package/test/{graphDrivenFlowSchema.test.js → integration/graphDrivenFlowSchema.test.js} +1 -1
  39. package/test/{intTestApi.test.js → integration/intTestApi.test.js} +1 -1
  40. package/test/{publicApi.test.js → integration/publicApi.test.js} +1 -1
  41. package/test/{createTargetRoleHandler.test.js → unit/application/createTargetRoleHandler.test.js} +1 -1
  42. package/test/{crudApplicationArtifacts.test.js → unit/application/crudApplicationArtifacts.test.js} +1 -1
  43. package/test/{customFlowApplicationArtifacts.test.js → unit/application/customFlowApplicationArtifacts.test.js} +139 -9
  44. package/test/{relationshipApplicationArtifacts.test.js → unit/application/relationshipApplicationArtifacts.test.js} +1 -1
  45. package/test/{systemFindDataArtifacts.test.js → unit/application/systemFindDataArtifacts.test.js} +1 -1
  46. package/test/{functionYamlArtifact.test.js → unit/infrastructure/functionYamlArtifact.test.js} +1 -1
  47. package/test/{resourceArtifacts.test.js → unit/infrastructure/resourceArtifacts.test.js} +1 -1
  48. package/test/{attributeTreeSchemas.test.js → unit/schemas/attributeTreeSchemas.test.js} +127 -50
  49. package/test/{dynamicCrudFlowSchemas.test.js → unit/schemas/dynamicCrudFlowSchemas.test.js} +2 -2
  50. package/test/{dynamicRbacFlowSchemas.test.js → unit/schemas/dynamicRbacFlowSchemas.test.js} +1 -1
  51. package/test/{dynamicRelationshipFlowSchemas.test.js → unit/schemas/dynamicRelationshipFlowSchemas.test.js} +11 -1
  52. package/test/{errorSchemas.test.js → unit/schemas/errorSchemas.test.js} +2 -2
  53. package/test/unit/schemas/ledgerSchemas.test.js +263 -0
  54. package/test/{systemTextSchemas.test.js → unit/schemas/systemTextSchemas.test.js} +24 -36
  55. package/src/emit/crud/loadLocalSchemaArrays.js +0 -4
  56. /package/src/emit/{coreFunction → application/coreFunction}/emitCoreFunctionArtifacts.js +0 -0
  57. /package/src/emit/{coreFunction → application/coreFunction}/templates/CoreFunction_Yaml.ejs +0 -0
  58. /package/src/emit/{coreFunction → application/coreFunction}/templates/CoreResource_Yaml.ejs +0 -0
  59. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataDynamo_HdrInv.ejs +0 -0
  60. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataDynamo_Main.ejs +0 -0
  61. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphData_HdrInv.ejs +0 -0
  62. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphData_Main.ejs +0 -0
  63. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphSchema_HdrInv.ejs +0 -0
  64. /package/src/emit/{coreFunction → application/coreFunction}/templates/GenerateSeedDataGraphSchema_Main.ejs +0 -0
  65. /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedGraphNodeSchemas.ejs +0 -0
  66. /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedGraphRelSchemas.ejs +0 -0
  67. /package/src/emit/{coreFunction → application/coreFunction}/templates/GeneratedTableConfigs.ejs +0 -0
  68. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupConfig.ejs +0 -0
  69. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner.ejs +0 -0
  70. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_initialSetup.ejs +0 -0
  71. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedDynamo.ejs +0 -0
  72. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedGraph.ejs +0 -0
  73. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_seedRemove.ejs +0 -0
  74. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetupRunner_uploadSchema.ejs +0 -0
  75. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetup_HdrInv.ejs +0 -0
  76. /package/src/emit/{coreFunction → application/coreFunction}/templates/InitialSetup_Main.ejs +0 -0
  77. /package/src/emit/{coreFunction → application/coreFunction}/templates/RemoveSeedDataDynamo_HdrInv.ejs +0 -0
  78. /package/src/emit/{coreFunction → application/coreFunction}/templates/RemoveSeedDataDynamo_Main.ejs +0 -0
  79. /package/src/emit/{coreFunction → application/coreFunction}/templates/UploadSchema_HdrInv.ejs +0 -0
  80. /package/src/emit/{coreFunction → application/coreFunction}/templates/UploadSchema_Main.ejs +0 -0
  81. /package/src/emit/{crud → application/crud}/crudActionPlan.js +0 -0
  82. /package/src/emit/{crud → application/crud}/dynamicCrudFlowSchemaTemplate.js +0 -0
  83. /package/src/emit/{crud → application/crud}/emitDynamicCrudFlowSchemas.js +0 -0
  84. /package/src/emit/{crud → application/crud}/templates/CreateAfterHookCallback_Main.ejs +0 -0
  85. /package/src/emit/{crud → application/crud}/templates/CreateBeforeHookCallback_Main.ejs +0 -0
  86. /package/src/emit/{crud → application/crud}/templates/CreateComplete_Main.ejs +0 -0
  87. /package/src/emit/{crud → application/crud}/templates/CreateConfirmComplete_Main.ejs +0 -0
  88. /package/src/emit/{crud → application/crud}/templates/CreateEndpoint_Main.ejs +0 -0
  89. /package/src/emit/{crud → application/crud}/templates/CreateLogicalLib.ejs +0 -0
  90. /package/src/emit/{crud → application/crud}/templates/CreateNodeCallback_Main.ejs +0 -0
  91. /package/src/emit/{crud → application/crud}/templates/DeleteAfterHookCallback_Main.ejs +0 -0
  92. /package/src/emit/{crud → application/crud}/templates/DeleteBeforeHookCallback_Main.ejs +0 -0
  93. /package/src/emit/{crud → application/crud}/templates/DeleteComplete_Main.ejs +0 -0
  94. /package/src/emit/{crud → application/crud}/templates/DeleteEndpoint_Main.ejs +0 -0
  95. /package/src/emit/{crud → application/crud}/templates/DeleteLogicalLib.ejs +0 -0
  96. /package/src/emit/{crud → application/crud}/templates/FlowEndpointRbacCallback_Main.ejs +0 -0
  97. /package/src/emit/{crud → application/crud}/templates/FlowEndpoint_HdrWbs.ejs +0 -0
  98. /package/src/emit/{crud → application/crud}/templates/FlowMain_Wbs.ejs +0 -0
  99. /package/src/emit/{crud → application/crud}/templates/GetEndpoint_Main.ejs +0 -0
  100. /package/src/emit/{crud → application/crud}/templates/GetRangeEndpoint_Main.ejs +0 -0
  101. /package/src/emit/{crud → application/crud}/templates/UpdateAfterHookCallback_Main.ejs +0 -0
  102. /package/src/emit/{crud → application/crud}/templates/UpdateBeforeHookCallback_Main.ejs +0 -0
  103. /package/src/emit/{crud → application/crud}/templates/UpdateComplete_Main.ejs +0 -0
  104. /package/src/emit/{crud → application/crud}/templates/UpdateEndpoint_Main.ejs +0 -0
  105. /package/src/emit/{crud → application/crud}/templates/UpdateLogicalLib.ejs +0 -0
  106. /package/src/emit/{custom → application/custom}/customFlowPaths.js +0 -0
  107. /package/src/emit/{custom → application/custom}/customFlows.js +0 -0
  108. /package/src/emit/{custom → application/custom}/templates/FlowEndpointRbacCallback_Main.ejs +0 -0
  109. /package/src/emit/{custom → application/custom}/templates/s3/ConfirmReserved_HdrSqs.ejs +0 -0
  110. /package/src/emit/{custom → application/custom}/templates/s3/ConfirmReserved_Main.ejs +0 -0
  111. /package/src/emit/{custom → application/custom}/templates/s3/CreateObject_HdrWbs.ejs +0 -0
  112. /package/src/emit/{custom → application/custom}/templates/s3/CreateObject_Main.ejs +0 -0
  113. /package/src/emit/{custom → application/custom}/templates/s3/CreatePreSignUrl_HdrSqs.ejs +0 -0
  114. /package/src/emit/{custom → application/custom}/templates/s3/CreatePreSignUrl_Main.ejs +0 -0
  115. /package/src/emit/{custom → application/custom}/templates/s3/FlowHandler_HdrS3.ejs +0 -0
  116. /package/src/emit/{custom → application/custom}/templates/s3/ProcessS3File_Main.ejs +0 -0
  117. /package/src/emit/{custom → application/custom}/templates/s3/ReservedLimit_HdrSqs.ejs +0 -0
  118. /package/src/emit/{custom → application/custom}/templates/s3/ReservedLimit_Main.ejs +0 -0
  119. /package/src/emit/{custom → application/custom}/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +0 -0
  120. /package/src/emit/{custom → application/custom}/templates/triggerCache/CheckTriggerCache_Main.ejs +0 -0
  121. /package/src/emit/{custom → application/custom}/templates/triggerCache/TriggerCacheComplete_Main.ejs +0 -0
  122. /package/src/emit/{custom → application/custom}/templates/triggerCache/TriggerCache_Main.ejs +0 -0
  123. /package/src/emit/{rbac → application/rbac}/emitDynamicRbacFlowSchemas.js +0 -0
  124. /package/src/emit/{rbac → application/rbac}/rbacFlowTag.js +0 -0
  125. /package/src/emit/{rbac → application/rbac}/templates/CancelUsage_Main.ejs +0 -0
  126. /package/src/emit/{rbac → application/rbac}/templates/ConfirmUsage_Main.ejs +0 -0
  127. /package/src/emit/{rbac → application/rbac}/templates/CreateTargetRole_HdrSqs.ejs +0 -0
  128. /package/src/emit/{rbac → application/rbac}/templates/CreateTargetRole_Main.ejs +0 -0
  129. /package/src/emit/{rbac → application/rbac}/templates/DeleteTargetRole_Main.ejs +0 -0
  130. /package/src/emit/{rbac → application/rbac}/templates/DynamicRbacFlowSchema.ejs +0 -0
  131. /package/src/emit/{rbac → application/rbac}/templates/GetMyPermissions_Main.ejs +0 -0
  132. /package/src/emit/{rbac → application/rbac}/templates/GetTargetRole_Main.ejs +0 -0
  133. /package/src/emit/{rbac → application/rbac}/templates/ListRbac_HdrApi.ejs +0 -0
  134. /package/src/emit/{rbac → application/rbac}/templates/ListRbac_HdrSqs.ejs +0 -0
  135. /package/src/emit/{rbac → application/rbac}/templates/ListRbac_Main.ejs +0 -0
  136. /package/src/emit/{rbac → application/rbac}/templates/RbacMutation_Main.ejs +0 -0
  137. /package/src/emit/{rbac → application/rbac}/templates/ReservedDynamicUsage_Main.ejs +0 -0
  138. /package/src/emit/{rbac → application/rbac}/templates/UpdateTargetRole_Main.ejs +0 -0
  139. /package/src/emit/{rbac → application/rbac}/templates/UserRbacFlow_HdrSqs.ejs +0 -0
  140. /package/src/emit/{rbac → application/rbac}/templates/UserRbacFlow_Main.ejs +0 -0
  141. /package/src/emit/{rbac → application/rbac}/templates/UserRoleMutation_Main.ejs +0 -0
  142. /package/src/emit/{relationship → application/relationship}/emitDynamicRelationshipFlowSchemas.js +0 -0
  143. /package/src/emit/{relationship → application/relationship}/templates/ChangeRelationshipComplete_HdrSqs.ejs +0 -0
  144. /package/src/emit/{relationship → application/relationship}/templates/ChangeRelationshipComplete_Main.ejs +0 -0
  145. /package/src/emit/{relationship → application/relationship}/templates/ChangeRelationship_Main.ejs +0 -0
  146. /package/src/emit/{relationship → application/relationship}/templates/CreateRelationshipComplete_HdrSqs.ejs +0 -0
  147. /package/src/emit/{relationship → application/relationship}/templates/CreateRelationshipComplete_Main.ejs +0 -0
  148. /package/src/emit/{relationship → application/relationship}/templates/CreateRelationship_Main.ejs +0 -0
  149. /package/src/emit/{relationship → application/relationship}/templates/DeleteRelationshipComplete_HdrSqs.ejs +0 -0
  150. /package/src/emit/{relationship → application/relationship}/templates/DeleteRelationshipComplete_Main.ejs +0 -0
  151. /package/src/emit/{relationship → application/relationship}/templates/DeleteRelationship_Main.ejs +0 -0
  152. /package/src/emit/{relationship → application/relationship}/templates/GetRelationshipComplete_HdrSqs.ejs +0 -0
  153. /package/src/emit/{relationship → application/relationship}/templates/GetRelationshipComplete_Main.ejs +0 -0
  154. /package/src/emit/{relationship → application/relationship}/templates/GetRelationship_Main.ejs +0 -0
  155. /package/src/emit/{relationship → application/relationship}/templates/MoveRelationshipComplete_HdrSqs.ejs +0 -0
  156. /package/src/emit/{relationship → application/relationship}/templates/MoveRelationshipComplete_Main.ejs +0 -0
  157. /package/src/emit/{relationship → application/relationship}/templates/MoveRelationship_Main.ejs +0 -0
  158. /package/src/emit/{relationship → application/relationship}/templates/UpdateRelationshipComplete_HdrSqs.ejs +0 -0
  159. /package/src/emit/{relationship → application/relationship}/templates/UpdateRelationshipComplete_Main.ejs +0 -0
  160. /package/src/emit/{relationship → application/relationship}/templates/UpdateRelationship_Main.ejs +0 -0
  161. /package/src/emit/{system → application/system}/emitSystemWebSocketArtifacts.js +0 -0
  162. /package/src/emit/{system → application/system}/templates/RegisterComplete_HdrSqs.ejs +0 -0
  163. /package/src/emit/{system → application/system}/templates/RegisterComplete_Main.ejs +0 -0
  164. /package/src/emit/{system → application/system}/templates/RegisterComplete_Yaml.ejs +0 -0
  165. /package/src/emit/{system → application/system}/templates/RegisterWbs_Yaml.ejs +0 -0
  166. /package/src/emit/{system → application/system}/templates/Register_HdrWbs.ejs +0 -0
  167. /package/src/emit/{system → application/system}/templates/Register_Main.ejs +0 -0
  168. /package/src/emit/{system → application/system}/templates/WebSocketComplete_HdrSqs.ejs +0 -0
  169. /package/src/emit/{system → application/system}/templates/WebSocketComplete_Main.ejs +0 -0
  170. /package/src/emit/{system → application/system}/templates/WebSocketComplete_Yaml.ejs +0 -0
  171. /package/src/emit/{system → application/system}/templates/WebSocketConnect.ejs +0 -0
  172. /package/src/emit/{system → application/system}/templates/WebSocketConnect_Yaml.ejs +0 -0
  173. /package/src/emit/{function → infrastructure/functions}/functionYamlArtifact.js +0 -0
  174. /package/src/emit/{function → infrastructure/functions}/templates/ApiFunction_Yaml.ejs +0 -0
  175. /package/src/emit/{function → infrastructure/functions}/templates/EventBridgeFunction_Yaml.ejs +0 -0
  176. /package/src/emit/{function → infrastructure/functions}/templates/InvFunction_Yaml.ejs +0 -0
  177. /package/src/emit/{function → infrastructure/functions}/templates/S3Function_Yaml.ejs +0 -0
  178. /package/src/emit/{function → infrastructure/functions}/templates/SqsFunction_Yaml.ejs +0 -0
  179. /package/src/emit/{function → infrastructure/functions}/templates/WbsFunction_Yaml.ejs +0 -0
  180. /package/src/emit/{resource → infrastructure/resources}/dynamoResourceArtifacts.js +0 -0
  181. /package/src/emit/{resource → infrastructure/resources}/emitResourceArtifacts.js +0 -0
  182. /package/src/emit/{resource → infrastructure/resources}/resourceTemplate.js +0 -0
  183. /package/src/emit/{resource → infrastructure/resources}/s3ResourceArtifacts.js +0 -0
  184. /package/src/emit/{resource → infrastructure/resources}/sqsResourceArtifacts.js +0 -0
  185. /package/src/emit/{resource → infrastructure/resources}/templates/DynamoDBTable_Yaml.ejs +0 -0
  186. /package/src/emit/{resource → infrastructure/resources}/templates/FlowOut_Yaml.ejs +0 -0
  187. /package/src/emit/{resource → infrastructure/resources}/templates/GeneratedLambdaRoleServiceConfig.ejs +0 -0
  188. /package/src/emit/{resource → infrastructure/resources}/templates/ResourceSqsYaml.ejs +0 -0
  189. /package/src/emit/{resource → infrastructure/resources}/templates/ResourceYaml.ejs +0 -0
  190. /package/src/emit/{resource → infrastructure/resources}/templates/S3Bucket_Yaml.ejs +0 -0
  191. /package/src/emit/{resource → infrastructure/resources}/templates/S3Subscription_Yaml.ejs +0 -0
  192. /package/src/emit/{resource → infrastructure/resources}/templates/SharedResource_Yaml.ejs +0 -0
  193. /package/src/emit/{resource → infrastructure/resources}/templates/SystemDynamoDB_Yaml.ejs +0 -0
  194. /package/src/emit/{resource → infrastructure/resources}/templates/WebSocketSubscription_Yaml.ejs +0 -0
  195. /package/src/emit/{error → schemas/error}/emitErrorSchemas.js +0 -0
  196. /package/src/emit/{error → schemas/error}/templates/errorSchema.ejs +0 -0
  197. /package/src/emit/{systemText → schemas/systemText}/templates/SystemTextSchemas.ejs +0 -0
  198. /package/src/{generateResources/IntTest → intTest/generators}/consts.js +0 -0
  199. /package/src/{generateResources/IntTest → intTest/generators}/generateResources/generateResources.js +0 -0
  200. /package/src/{generateResources/IntTest → intTest/generators}/generateResources/templateResources.ejs +0 -0
  201. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/events/events.js +0 -0
  202. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/events/templateEvents.ejs +0 -0
  203. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/generateTemplate.js +0 -0
  204. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/pathIntTest/pathIntTest.js +0 -0
  205. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/pathIntTest/template.ejs +0 -0
  206. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/tests/templateTests.ejs +0 -0
  207. /package/src/{generateResources/IntTest → intTest/generators}/generateTests/tests/tests.js +0 -0
  208. /package/src/{generateResources/IntTest → intTest/generators}/libs/IntTestGenerateLib.js +0 -0
  209. /package/src/{generateResources/IntTest → intTest/generators}/upload/uploadIntTest.js +0 -0
  210. /package/src/{intTestGeneratorShared.js → intTest/intTestGeneratorShared.js} +0 -0
package/src/generate.js CHANGED
@@ -1,70 +1,17 @@
1
+ import path from 'node:path';
1
2
  import { buildGenerationPlan } from './plan/buildGenerationPlan.js';
3
+ import { resolveEmissionGroups } from './plan/domainRegistry.js';
2
4
  import { commitArtifacts } from './output/commitArtifacts.js';
3
5
  import { compileProject } from './compile/compileProject.js';
4
- import {
5
- crudApplicationManagedPaths,
6
- emitCrudApplicationArtifacts
7
- } from './emit/crud/emitCrudApplicationArtifacts.js';
8
- import {
9
- dynamicCrudFlowSchemaPaths,
10
- emitDynamicCrudFlowSchemas
11
- } from './emit/crud/emitDynamicCrudFlowSchemas.js';
12
- import {
13
- customFlowApplicationManagedPaths,
14
- emitCustomFlowApplicationArtifacts
15
- } from './emit/custom/emitCustomFlowApplicationArtifacts.js';
16
- import {
17
- emitDynamicRbacFlowSchemas,
18
- rbacFlowSchemaManagedPaths
19
- } from './emit/rbac/emitDynamicRbacFlowSchemas.js';
20
- import {
21
- emitRbacApplicationArtifacts,
22
- rbacApplicationManagedPaths
23
- } from './emit/rbac/emitRbacApplicationArtifacts.js';
24
- import {
25
- dynamicRelationshipFlowSchemaManagedPaths,
26
- emitDynamicRelationshipFlowSchemas
27
- } from './emit/relationship/emitDynamicRelationshipFlowSchemas.js';
28
- import {
29
- emitRelationshipApplicationArtifacts,
30
- relationshipApplicationManagedPaths
31
- } from './emit/relationship/emitRelationshipApplicationArtifacts.js';
32
- import {
33
- emitResourceArtifacts,
34
- resourceArtifactPaths
35
- } from './emit/resource/emitResourceArtifacts.js';
36
6
  import {
37
7
  loadLocalSchemaDirectory,
38
8
  resolveExtendedObjectSchemas,
39
9
  resolveGraphServiceTags
40
10
  } from './compile/loadSchemas.js';
41
11
  import {
42
- emitSystemWebSocketArtifacts,
43
- hasSystemWebSocket,
44
- systemWebSocketManagedPaths
45
- } from './emit/system/emitSystemWebSocketArtifacts.js';
46
- import {
47
- emitSystemFindDataArtifacts,
48
- findDataManagedPaths
49
- } from './emit/system/emitSystemFindDataArtifacts.js';
50
- import {
51
- emitCoreFunctionArtifacts,
52
- coreFunctionManagedPaths
53
- } from './emit/coreFunction/emitCoreFunctionArtifacts.js';
54
- import {
55
- emitSystemTextSchemas,
56
- systemTextSchemaManagedPaths
57
- } from './emit/systemText/emitSystemTextSchemas.js';
58
- import {
59
- emitAttributeTreeObjectSchemas,
60
- emitAttributeTreeRelationshipSchemas,
61
- attributeTreeObjectSchemaManagedPaths,
62
- attributeTreeRelationshipSchemaManagedPaths
63
- } from './emit/attributeTree/emitAttributeTreeSchemas.js';
64
- import {
65
- emitErrorSchemas,
66
- errorSchemaManagedPaths
67
- } from './emit/error/emitErrorSchemas.js';
12
+ resolveTargetServicePath,
13
+ emitAttributeTreeTargetSchemas
14
+ } from './emit/schemas/attributeTree/emitAttributeTreeSchemas.js';
68
15
 
69
16
  export async function generate(rootPath, options = {}) {
70
17
  const startedAt = Date.now();
@@ -101,21 +48,28 @@ export async function generate(rootPath, options = {}) {
101
48
  relationships,
102
49
  schemaBucketName
103
50
  );
51
+ const objectNames = objects.map((obj) => obj.objectType).filter(Boolean);
52
+ let objectSummary = '';
53
+ if (objectNames.length > 0) {
54
+ objectSummary = ` (${objectNames.join(', ')})`;
55
+ }
104
56
  console.log(
105
- `[DEBUG] [Generate] STATUS=SCHEMAS_LOADED | ` +
106
- `objects=${objects.length} ` +
57
+ `[INFO] [Generate] STATUS=SCHEMAS_LOADED | ` +
58
+ `objects=${objects.length}${objectSummary} ` +
107
59
  `relationships=${relationships.length} flows=${flows.length} ` +
108
60
  `notifications=${notifications.length} ` +
109
61
  `errors=${errors.length}`
110
62
  );
111
- for (const objectSchema of objects) {
112
- const objectType = objectSchema.objectType || 'unknown';
113
- console.log(
114
- `[DEBUG] [Generate] OBJECT_SCHEMA | objectType=${objectType}\n` +
115
- JSON.stringify(objectSchema, null, 2)
116
- );
63
+ if (options.verbose || process.env.GENERATE_VERBOSE) {
64
+ for (const objectSchema of objects) {
65
+ const objectType = objectSchema.objectType || 'unknown';
66
+ console.log(
67
+ `[DEBUG] [Generate] OBJECT_SCHEMA | objectType=${objectType}\n` +
68
+ JSON.stringify(objectSchema, null, 2)
69
+ );
70
+ }
117
71
  }
118
- const groups = await _emitGroups({
72
+ const groups = await resolveEmissionGroups({
119
73
  project,
120
74
  objects,
121
75
  relationships,
@@ -131,7 +85,7 @@ export async function generate(rootPath, options = {}) {
131
85
  });
132
86
  const emittedScopeSummary = scopeCounts.join(' ');
133
87
  console.log(
134
- `[DEBUG] [Generate] STATUS=ARTIFACTS_EMITTED | ${emittedScopeSummary}`
88
+ `[INFO] [Generate] STATUS=ARTIFACTS_EMITTED | ${emittedScopeSummary}`
135
89
  );
136
90
  let files = [];
137
91
  if (groups.length > 0) {
@@ -147,6 +101,14 @@ export async function generate(rootPath, options = {}) {
147
101
  )
148
102
  );
149
103
  }
104
+ const targetFiles = await _emitTargetServiceAttributeTreeSchemas({
105
+ project,
106
+ objects,
107
+ logger: options.logger
108
+ });
109
+ for (const targetFile of targetFiles) {
110
+ files.push(targetFile);
111
+ }
150
112
  const durationMs = Date.now() - startedAt;
151
113
  console.log(
152
114
  `[INFO] [Generate] STATUS=FINISHED | ` +
@@ -164,182 +126,61 @@ export async function generate(rootPath, options = {}) {
164
126
  }
165
127
  }
166
128
 
167
- async function _emitGroups({
129
+ async function _emitTargetServiceAttributeTreeSchemas({
168
130
  project,
169
131
  objects,
170
- relationships,
171
- flows,
172
- notifications,
173
- errors,
174
- objectGraphServiceTags,
175
- relationshipGraphServiceTags,
176
132
  logger
177
133
  }) {
178
- const [
179
- crud,
180
- relationship,
181
- rbac,
182
- system,
183
- findData,
184
- resource,
185
- coreFunction,
186
- systemText,
187
- errorSchemas
188
- ] = await Promise.all([
189
- emitCrudApplicationArtifacts({
190
- objects,
191
- flows,
192
- serviceTag: project.serviceTag,
193
- logger
194
- }),
195
- emitRelationshipApplicationArtifacts({
196
- relationships,
197
- flows,
198
- serviceTag: project.serviceTag
199
- }),
200
- emitRbacApplicationArtifacts(objects),
201
- emitSystemWebSocketArtifacts(flows, {
202
- includeRelationshipOwnTopic: true,
203
- objects,
204
- relationships
205
- }),
206
- emitSystemFindDataArtifacts(objects),
207
- emitResourceArtifacts({ objects, relationships, flows }),
208
- emitCoreFunctionArtifacts({
209
- project,
210
- objects,
211
- relationships,
212
- flows,
213
- objectGraphServiceTags,
214
- relationshipGraphServiceTags
215
- }),
216
- emitSystemTextSchemas({
217
- project,
218
- objects,
219
- relationships,
220
- flows,
221
- notifications
222
- }),
223
- emitErrorSchemas({
224
- project,
225
- errors,
226
- objectGraphServiceTags
227
- })
228
- ]);
229
- const custom = await emitCustomFlowApplicationArtifacts(flows, {
230
- objects
231
- });
232
-
233
- const systemFunctions = [
234
- ...(system.functions ?? []),
235
- ...(findData.functions ?? [])
236
- ].filter(Boolean);
237
-
238
- const findDataArtifacts = [...(findData.artifacts ?? [])];
239
-
240
- if (systemFunctions.length > 0) {
241
- findDataArtifacts.push({
242
- path: 'app/sls_yaml/generatedCode/source/flow-system.yml',
243
- content: systemFunctions.join('\n\n')
244
- });
134
+ if (!Array.isArray(objects)) {
135
+ return [];
245
136
  }
246
-
247
- let resolvedCoreFunctionManagedPaths = coreFunctionManagedPaths;
248
- if (typeof coreFunctionManagedPaths === 'function') {
249
- resolvedCoreFunctionManagedPaths = coreFunctionManagedPaths({
250
- project,
251
- objects,
252
- relationships,
253
- flows,
254
- objectGraphServiceTags,
255
- relationshipGraphServiceTags
256
- });
257
- }
258
-
259
- return [
260
- {
261
- scope: 'crud-flow-schemas',
262
- managedPaths: dynamicCrudFlowSchemaPaths,
263
- artifacts: emitDynamicCrudFlowSchemas({ objects, flows, logger })
264
- },
265
- {
266
- scope: 'relationship-flow-schemas',
267
- managedPaths: dynamicRelationshipFlowSchemaManagedPaths(relationships),
268
- artifacts: emitDynamicRelationshipFlowSchemas({ relationships })
269
- },
270
- {
271
- scope: 'rbac-flow-schemas',
272
- managedPaths: rbacFlowSchemaManagedPaths(objects),
273
- artifacts: await emitDynamicRbacFlowSchemas({
274
- objects,
275
- serviceTag: project.serviceTag
276
- })
277
- },
278
- {
279
- scope: 'attribute-tree-object-schemas',
280
- managedPaths: attributeTreeObjectSchemaManagedPaths(objects),
281
- artifacts: emitAttributeTreeObjectSchemas({
282
- objects,
283
- serviceTag: project.serviceTag
284
- })
285
- },
286
- {
287
- scope: 'attribute-tree-relationship-schemas',
288
- managedPaths: attributeTreeRelationshipSchemaManagedPaths(objects),
289
- artifacts: emitAttributeTreeRelationshipSchemas({
290
- objects,
291
- serviceTag: project.serviceTag
292
- })
293
- },
294
- {
295
- scope: 'crud-application',
296
- managedPaths: crudApplicationManagedPaths(),
297
- artifacts: crud
298
- },
299
- {
300
- scope: 'relationship-application',
301
- managedPaths: relationshipApplicationManagedPaths(),
302
- artifacts: relationship
303
- },
304
- {
305
- scope: 'rbac-application',
306
- managedPaths: rbacApplicationManagedPaths(objects),
307
- artifacts: rbac
308
- },
309
- {
310
- scope: 'system-websocket',
311
- managedPaths: systemWebSocketManagedPaths(),
312
- artifacts: system.artifacts
313
- },
314
- {
315
- scope: 'system-find-data',
316
- managedPaths: findDataManagedPaths(),
317
- artifacts: findDataArtifacts
318
- },
319
- {
320
- scope: 'custom-flow-application',
321
- managedPaths: customFlowApplicationManagedPaths(flows, { objects }),
322
- artifacts: custom
323
- },
324
- {
325
- scope: 'shared-resources',
326
- managedPaths: resourceArtifactPaths,
327
- artifacts: resource
328
- },
329
- {
330
- scope: 'core-function',
331
- managedPaths: resolvedCoreFunctionManagedPaths,
332
- artifacts: coreFunction
333
- },
334
- {
335
- scope: 'system-text-schemas',
336
- managedPaths: systemTextSchemaManagedPaths(),
337
- artifacts: systemText
338
- },
339
- {
340
- scope: 'error-schemas',
341
- managedPaths: errorSchemaManagedPaths(errors),
342
- artifacts: errorSchemas
137
+ const committedFiles = [];
138
+ for (const object of objects) {
139
+ if (!Array.isArray(object?.addOnDataStructure)) {
140
+ continue;
141
+ }
142
+ for (const addOn of object.addOnDataStructure) {
143
+ if (addOn?.type === 'attributeTree' && addOn?.attributeTreeTag) {
144
+ const attributeTag = addOn.attributeTreeTag;
145
+ const targetServiceRoot = resolveTargetServicePath({
146
+ currentServiceRoot: project.rootPath,
147
+ attributeTag
148
+ });
149
+ if (targetServiceRoot) {
150
+ const artifacts = emitAttributeTreeTargetSchemas({
151
+ attributeTag,
152
+ targetServiceRoot
153
+ });
154
+ const relativeArtifacts = artifacts.map((artifact) => {
155
+ return {
156
+ path: path.relative(targetServiceRoot, artifact.path),
157
+ content: artifact.content
158
+ };
159
+ });
160
+ const targetPlan = buildGenerationPlan(
161
+ { outputPath: targetServiceRoot },
162
+ relativeArtifacts,
163
+ {
164
+ managedScopes: {
165
+ 'attribute-tree-target-schemas': relativeArtifacts.map(
166
+ (a) => a.path
167
+ )
168
+ }
169
+ }
170
+ );
171
+ const targetFiles = await commitArtifacts(targetPlan);
172
+ for (const targetFile of targetFiles) {
173
+ committedFiles.push(targetFile);
174
+ }
175
+ if (logger && typeof logger.info === 'function') {
176
+ logger.info(
177
+ `[INFO] [AttributeTree] Target schemas emitted for ` +
178
+ `tag=${attributeTag} to ${targetServiceRoot}`
179
+ );
180
+ }
181
+ }
182
+ }
343
183
  }
344
- ];
184
+ }
185
+ return committedFiles;
345
186
  }
@@ -25,11 +25,11 @@ import { join } from 'path';
25
25
  import ejsLib from 'ejs';
26
26
  import beautify from 'js-beautify/js/index.js';
27
27
 
28
- import generateTestTemplate from './generateResources/IntTest/generateTests/generateTemplate.js';
28
+ import generateTestTemplate from './generators/generateTests/generateTemplate.js';
29
29
  import {
30
30
  DEFAULT_BUCKET,
31
31
  uploadToS3
32
- } from './generateResources/IntTest/upload/uploadIntTest.js';
32
+ } from './generators/upload/uploadIntTest.js';
33
33
  import {
34
34
  getIntTestOutputPath,
35
35
  getServiceTag,
@@ -18,11 +18,11 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
18
18
  import { join } from 'path';
19
19
  import ejsLib from 'ejs';
20
20
 
21
- import generateResourceTemplate from './generateResources/IntTest/generateResources/generateResources.js';
21
+ import generateResourceTemplate from './generators/generateResources/generateResources.js';
22
22
  import {
23
23
  DEFAULT_BUCKET,
24
24
  uploadToS3
25
- } from './generateResources/IntTest/upload/uploadIntTest.js';
25
+ } from './generators/upload/uploadIntTest.js';
26
26
  import {
27
27
  getIntTestOutputPath,
28
28
  getServiceTag,
@@ -0,0 +1,271 @@
1
+ import {
2
+ crudApplicationManagedPaths,
3
+ emitCrudApplicationArtifacts
4
+ } from '../emit/application/crud/emitCrudApplicationArtifacts.js';
5
+ import {
6
+ dynamicCrudFlowSchemaPaths,
7
+ emitDynamicCrudFlowSchemas
8
+ } from '../emit/application/crud/emitDynamicCrudFlowSchemas.js';
9
+ import {
10
+ customFlowApplicationManagedPaths,
11
+ emitCustomFlowApplicationArtifacts
12
+ } from '../emit/application/custom/emitCustomFlowApplicationArtifacts.js';
13
+ import {
14
+ emitDynamicRbacFlowSchemas,
15
+ rbacFlowSchemaManagedPaths
16
+ } from '../emit/application/rbac/emitDynamicRbacFlowSchemas.js';
17
+ import {
18
+ emitRbacApplicationArtifacts,
19
+ rbacApplicationManagedPaths
20
+ } from '../emit/application/rbac/emitRbacApplicationArtifacts.js';
21
+ import {
22
+ dynamicRelationshipFlowSchemaManagedPaths,
23
+ emitDynamicRelationshipFlowSchemas
24
+ } from '../emit/application/relationship/emitDynamicRelationshipFlowSchemas.js';
25
+ import {
26
+ emitRelationshipApplicationArtifacts,
27
+ relationshipApplicationManagedPaths
28
+ } from '../emit/application/relationship/emitRelationshipApplicationArtifacts.js';
29
+ import {
30
+ emitSystemWebSocketArtifacts,
31
+ systemWebSocketManagedPaths
32
+ } from '../emit/application/system/emitSystemWebSocketArtifacts.js';
33
+ import {
34
+ emitSystemFindDataArtifacts,
35
+ findDataManagedPaths
36
+ } from '../emit/application/system/emitSystemFindDataArtifacts.js';
37
+ import {
38
+ emitCoreFunctionArtifacts,
39
+ coreFunctionManagedPaths
40
+ } from '../emit/application/coreFunction/emitCoreFunctionArtifacts.js';
41
+ import {
42
+ emitResourceArtifacts,
43
+ resourceArtifactPaths
44
+ } from '../emit/infrastructure/resources/emitResourceArtifacts.js';
45
+ import {
46
+ emitSystemTextSchemas,
47
+ systemTextSchemaManagedPaths
48
+ } from '../emit/schemas/systemText/emitSystemTextSchemas.js';
49
+ import {
50
+ emitAttributeTreeObjectSchemas,
51
+ emitAttributeTreeRelationshipSchemas,
52
+ attributeTreeObjectSchemaManagedPaths,
53
+ attributeTreeRelationshipSchemaManagedPaths
54
+ } from '../emit/schemas/attributeTree/emitAttributeTreeSchemas.js';
55
+ import {
56
+ emitLedgerObjectSchemas,
57
+ emitLedgerRelationshipSchemas,
58
+ ledgerObjectSchemaManagedPaths,
59
+ ledgerRelationshipSchemaManagedPaths
60
+ } from '../emit/schemas/ledger/emitLedgerSchemas.js';
61
+ import {
62
+ emitErrorSchemas,
63
+ errorSchemaManagedPaths
64
+ } from '../emit/schemas/error/emitErrorSchemas.js';
65
+
66
+ export async function resolveEmissionGroups(context) {
67
+ const {
68
+ project,
69
+ objects,
70
+ relationships,
71
+ flows,
72
+ notifications,
73
+ errors,
74
+ objectGraphServiceTags,
75
+ relationshipGraphServiceTags,
76
+ logger
77
+ } = context;
78
+
79
+ const [
80
+ crud,
81
+ relationship,
82
+ rbac,
83
+ system,
84
+ findData,
85
+ resource,
86
+ coreFunction,
87
+ systemText,
88
+ errorSchemas
89
+ ] = await Promise.all([
90
+ emitCrudApplicationArtifacts({
91
+ objects,
92
+ flows,
93
+ serviceTag: project.serviceTag,
94
+ logger
95
+ }),
96
+ emitRelationshipApplicationArtifacts({
97
+ relationships,
98
+ flows,
99
+ serviceTag: project.serviceTag
100
+ }),
101
+ emitRbacApplicationArtifacts(objects),
102
+ emitSystemWebSocketArtifacts(flows, {
103
+ includeRelationshipOwnTopic: true,
104
+ objects,
105
+ relationships
106
+ }),
107
+ emitSystemFindDataArtifacts(objects),
108
+ emitResourceArtifacts({ objects, relationships, flows }),
109
+ emitCoreFunctionArtifacts({
110
+ project,
111
+ objects,
112
+ relationships,
113
+ flows,
114
+ objectGraphServiceTags,
115
+ relationshipGraphServiceTags
116
+ }),
117
+ emitSystemTextSchemas({
118
+ project,
119
+ objects,
120
+ relationships,
121
+ flows,
122
+ notifications
123
+ }),
124
+ emitErrorSchemas({
125
+ project,
126
+ errors,
127
+ objectGraphServiceTags
128
+ })
129
+ ]);
130
+
131
+ const custom = await emitCustomFlowApplicationArtifacts(flows, {
132
+ objects
133
+ });
134
+
135
+ let systemFunctions = [];
136
+ if (system.functions) {
137
+ systemFunctions = systemFunctions.concat(system.functions);
138
+ }
139
+ if (findData.functions) {
140
+ systemFunctions = systemFunctions.concat(findData.functions);
141
+ }
142
+
143
+ let findDataArtifacts = [];
144
+ if (findData.artifacts) {
145
+ findDataArtifacts = [...findData.artifacts];
146
+ }
147
+
148
+ if (systemFunctions.length > 0) {
149
+ findDataArtifacts.push({
150
+ path: 'app/sls_yaml/generatedCode/source/flow-system.yml',
151
+ content: systemFunctions.join('\n\n')
152
+ });
153
+ }
154
+
155
+ let resolvedCoreFunctionManagedPaths = coreFunctionManagedPaths;
156
+ if (typeof coreFunctionManagedPaths === 'function') {
157
+ resolvedCoreFunctionManagedPaths = coreFunctionManagedPaths({
158
+ project,
159
+ objects,
160
+ relationships,
161
+ flows,
162
+ objectGraphServiceTags,
163
+ relationshipGraphServiceTags
164
+ });
165
+ }
166
+
167
+ const rbacFlowArtifacts = await emitDynamicRbacFlowSchemas({
168
+ objects,
169
+ serviceTag: project.serviceTag
170
+ });
171
+
172
+ return [
173
+ {
174
+ scope: 'crud-flow-schemas',
175
+ managedPaths: dynamicCrudFlowSchemaPaths,
176
+ artifacts: emitDynamicCrudFlowSchemas({ objects, flows, logger })
177
+ },
178
+ {
179
+ scope: 'relationship-flow-schemas',
180
+ managedPaths: dynamicRelationshipFlowSchemaManagedPaths(relationships),
181
+ artifacts: emitDynamicRelationshipFlowSchemas({ relationships })
182
+ },
183
+ {
184
+ scope: 'rbac-flow-schemas',
185
+ managedPaths: rbacFlowSchemaManagedPaths(objects),
186
+ artifacts: rbacFlowArtifacts
187
+ },
188
+ {
189
+ scope: 'attribute-tree-object-schemas',
190
+ managedPaths: attributeTreeObjectSchemaManagedPaths(objects),
191
+ artifacts: emitAttributeTreeObjectSchemas({
192
+ objects,
193
+ serviceTag: project.serviceTag
194
+ })
195
+ },
196
+ {
197
+ scope: 'attribute-tree-relationship-schemas',
198
+ managedPaths: attributeTreeRelationshipSchemaManagedPaths(objects),
199
+ artifacts: emitAttributeTreeRelationshipSchemas({
200
+ objects,
201
+ serviceTag: project.serviceTag
202
+ })
203
+ },
204
+ {
205
+ scope: 'ledger-object-schemas',
206
+ managedPaths: ledgerObjectSchemaManagedPaths(objects),
207
+ artifacts: emitLedgerObjectSchemas({
208
+ objects,
209
+ serviceTag: project.serviceTag
210
+ })
211
+ },
212
+ {
213
+ scope: 'ledger-relationship-schemas',
214
+ managedPaths: ledgerRelationshipSchemaManagedPaths(objects),
215
+ artifacts: emitLedgerRelationshipSchemas({
216
+ objects,
217
+ serviceTag: project.serviceTag
218
+ })
219
+ },
220
+ {
221
+ scope: 'crud-application',
222
+ managedPaths: crudApplicationManagedPaths(),
223
+ artifacts: crud
224
+ },
225
+ {
226
+ scope: 'relationship-application',
227
+ managedPaths: relationshipApplicationManagedPaths(),
228
+ artifacts: relationship
229
+ },
230
+ {
231
+ scope: 'rbac-application',
232
+ managedPaths: rbacApplicationManagedPaths(objects),
233
+ artifacts: rbac
234
+ },
235
+ {
236
+ scope: 'system-websocket',
237
+ managedPaths: systemWebSocketManagedPaths(),
238
+ artifacts: system.artifacts
239
+ },
240
+ {
241
+ scope: 'system-find-data',
242
+ managedPaths: findDataManagedPaths(),
243
+ artifacts: findDataArtifacts
244
+ },
245
+ {
246
+ scope: 'custom-flow-application',
247
+ managedPaths: customFlowApplicationManagedPaths(flows, { objects }),
248
+ artifacts: custom
249
+ },
250
+ {
251
+ scope: 'shared-resources',
252
+ managedPaths: resourceArtifactPaths,
253
+ artifacts: resource
254
+ },
255
+ {
256
+ scope: 'core-function',
257
+ managedPaths: resolvedCoreFunctionManagedPaths,
258
+ artifacts: coreFunction
259
+ },
260
+ {
261
+ scope: 'system-text-schemas',
262
+ managedPaths: systemTextSchemaManagedPaths(),
263
+ artifacts: systemText
264
+ },
265
+ {
266
+ scope: 'error-schemas',
267
+ managedPaths: errorSchemaManagedPaths(errors),
268
+ artifacts: errorSchemas
269
+ }
270
+ ];
271
+ }