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