@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
@@ -7,7 +7,7 @@ import test from 'node:test';
7
7
 
8
8
  process.env.NODE_ENV = 'test';
9
9
 
10
- import * as publicApi from '../index.js';
10
+ import * as publicApi from '../../index.js';
11
11
 
12
12
  const { generate } = publicApi;
13
13
 
@@ -208,7 +208,7 @@ test('generate commits the system WebSocket completion path for own-topic flows'
208
208
  assert.match(webSocketComplete, /\(\<createIdentifiersFlow\>\)/);
209
209
  assert.match(webSocketComplete, /\(\<beforePostMessage\>\)/);
210
210
  assert.match(webSocketComplete, /postToConnection\(_izContext,/);
211
- const webSocketHandler = await readFile(
211
+ const webSocketHandler = await readFile(
212
212
  join(
213
213
  rootPath,
214
214
  'app/src/generatedCode/SystemFlowSchemas/WebSocketMain/source/WebSocketComplete_HdrSqs.js'
@@ -217,6 +217,49 @@ test('generate commits the system WebSocket completion path for own-topic flows'
217
217
  );
218
218
  assert.match(webSocketHandler, /record\.body\.TopicArn/);
219
219
  assert.match(webSocketHandler, /addCallingFlowToPassOnProperties/);
220
+
221
+ const registerComplete = await readFile(
222
+ join(
223
+ rootPath,
224
+ 'app/src/generatedCode/SystemFlowSchemas/Register/source/RegisterComplete_Main.js'
225
+ ),
226
+ 'utf8'
227
+ );
228
+ assert.match(registerComplete, /getFlowSchema\.getFlowSchemaS3WithCache/);
229
+ assert.doesNotMatch(registerComplete, /getObjectSchema\.getFlowSchemaS3WithCache/);
230
+
231
+ const registerMain = await readFile(
232
+ join(
233
+ rootPath,
234
+ 'app/src/generatedCode/SystemFlowSchemas/Register/source/Register_Main.js'
235
+ ),
236
+ 'utf8'
237
+ );
238
+ assert.match(registerMain, /getFlowSchema\.getFlowSchemaS3WithCache/);
239
+ assert.doesNotMatch(registerMain, /getObjectSchema\.getFlowSchemaS3WithCache/);
240
+
241
+ assert.match(webSocketComplete, /getFlowSchema\.getFlowSchemaS3WithCache/);
242
+ assert.doesNotMatch(webSocketComplete, /getObjectSchema\.getFlowSchemaS3WithCache/);
243
+
244
+ const trackHdrWbs = await readFile(
245
+ join(
246
+ rootPath,
247
+ 'app/src/generatedCode/FlowSchemas/Track/source/Track_HdrWbs.js'
248
+ ),
249
+ 'utf8'
250
+ );
251
+ assert.match(trackHdrWbs, /getFlowSchema\.getFlowSchemaS3WithCache/);
252
+ assert.doesNotMatch(trackHdrWbs, /getObjectSchema\.getFlowSchemaS3WithCache/);
253
+
254
+ const trackWbsMain = await readFile(
255
+ join(
256
+ rootPath,
257
+ 'app/src/generatedCode/FlowSchemas/Track/source/Track_WbsMain.js'
258
+ ),
259
+ 'utf8'
260
+ );
261
+ assert.match(trackWbsMain, /getFlowSchema\.getFlowSchemaS3WithCache/);
262
+ assert.doesNotMatch(trackWbsMain, /getObjectSchema\.getFlowSchemaS3WithCache/);
220
263
  });
221
264
 
222
265
  test('generate commits the trigger-cache suite with its queues when triggerFlowTypes is set', async () => {
@@ -245,6 +288,16 @@ test('generate commits the trigger-cache suite with its queues when triggerFlowT
245
288
  ),
246
289
  /CartCheckTriggerFlowsHdrSqs/
247
290
  );
291
+
292
+ const cartCheckTrigger = await readFile(
293
+ join(
294
+ rootPath,
295
+ 'app/src/generatedCode/FlowSchemas/Cart/source/CartCheckTriggerFlows_Main.js'
296
+ ),
297
+ 'utf8'
298
+ );
299
+ assert.match(cartCheckTrigger, /getFlowSchema\.getFlowSchemaS3WithCache/);
300
+ assert.doesNotMatch(cartCheckTrigger, /getObjectSchema\.getFlowSchemaS3WithCache/);
248
301
  });
249
302
 
250
303
  test('generate removes the system WebSocket path when the last own-topic flow is removed', async () => {
@@ -4,7 +4,7 @@ import { tmpdir } from 'node:os';
4
4
  import { join } from 'node:path';
5
5
  import test, { after } from 'node:test';
6
6
 
7
- import { generateCreateTargetRoleHandler } from '../src/emit/rbac/generateCreateTargetRoleHandler.js';
7
+ import { generateCreateTargetRoleHandler } from '../../../src/emit/application/rbac/generateCreateTargetRoleHandler.js';
8
8
 
9
9
  const roots = new Set();
10
10
  const OWN_TOPIC_FLOWS = [
@@ -7,7 +7,7 @@ import test, { after } from 'node:test';
7
7
 
8
8
  process.env.NODE_ENV = 'test';
9
9
 
10
- import { generateCrudApplicationArtifacts } from '../src/emit/crud/generateCrudApplicationArtifacts.js';
10
+ import { generateCrudApplicationArtifacts } from '../../../src/emit/application/crud/generateCrudApplicationArtifacts.js';
11
11
 
12
12
  const roots = new Set();
13
13
  after(() =>
@@ -13,10 +13,10 @@ import { dirname, join, resolve } from 'node:path';
13
13
  import { promisify } from 'node:util';
14
14
  import test, { after } from 'node:test';
15
15
 
16
- import { generate } from '../src/generate.js';
17
- import { generateCustomFlowApplicationArtifacts } from '../src/emit/custom/generateCustomFlowApplicationArtifacts.js';
18
- import { generateResourceArtifacts } from '../src/emit/resource/generateResourceArtifacts.js';
19
- import { renderEventBridgeFunctionYaml } from '../src/emit/function/functionYamlArtifact.js';
16
+ import { generate } from '../../../src/generate.js';
17
+ import { generateCustomFlowApplicationArtifacts } from '../../../src/emit/application/custom/generateCustomFlowApplicationArtifacts.js';
18
+ import { generateResourceArtifacts } from '../../../src/emit/infrastructure/resources/generateResourceArtifacts.js';
19
+ import { renderEventBridgeFunctionYaml } from '../../../src/emit/infrastructure/functions/functionYamlArtifact.js';
20
20
 
21
21
  const roots = new Set();
22
22
  const execFileAsync = promisify(execFile);
@@ -232,6 +232,15 @@ test('emits handlers, function YAML, and IAM roles for supported custom flow eve
232
232
  join(rootPath, `app/src/generatedCode/FlowSchemas/Upload/source/${path}`)
233
233
  );
234
234
  }
235
+ const uploadCreateObject = await readFile(
236
+ join(
237
+ rootPath,
238
+ 'app/src/generatedCode/FlowSchemas/Upload/source/UploadCreateObject_Main.js'
239
+ ),
240
+ 'utf8'
241
+ );
242
+ assert.match(uploadCreateObject, /getFlowSchema\.getFlowSchemaS3WithCache/);
243
+ assert.doesNotMatch(uploadCreateObject, /getObjectSchema\.getFlowSchemaS3WithCache/);
235
244
  for (const path of [
236
245
  'UploadReservedLimit_Main.js',
237
246
  'UploadCreatePreSignUrl_Main.js',
@@ -865,7 +874,7 @@ test(
865
874
  );
866
875
 
867
876
  test('renders nextSteps IAM permissions in InitialSetupConfig', async () => {
868
- const { generate } = await import('../src/generate.js');
877
+ const { generate } = await import('../../../src/generate.js');
869
878
  const rootPath = await mkdtemp(
870
879
  join(tmpdir(), 'generate-service-code-v2-nextsteps-')
871
880
  );
@@ -935,7 +944,7 @@ test('renders nextSteps IAM permissions in InitialSetupConfig', async () => {
935
944
  });
936
945
 
937
946
  test('registers SQS queue, SNS subscription, and SNS out topic for custom flowSchema with outputTopic set to true', async () => {
938
- const { generate } = await import('../src/generate.js');
947
+ const { generate } = await import('../../../src/generate.js');
939
948
  const rootPath = await mkdtemp(
940
949
  join(tmpdir(), 'generate-service-code-v2-outputtopic-')
941
950
  );
@@ -1030,7 +1039,7 @@ test('uses synchronous RBAC without obsolete callback SQS subscriptions in Initi
1030
1039
  });
1031
1040
 
1032
1041
  test('deduplicates duplicate nextSteps topics across flowSteps in InitialSetupConfig', async () => {
1033
- const { generate } = await import('../src/generate.js');
1042
+ const { generate } = await import('../../../src/generate.js');
1034
1043
  const rootPath = await mkdtemp(
1035
1044
  join(tmpdir(), 'generate-service-code-v2-dedupe-nextsteps-')
1036
1045
  );
@@ -1466,7 +1475,7 @@ test('emits canonical checkStatusField and hooks in FlowEndpoint_Main for status
1466
1475
  });
1467
1476
 
1468
1477
  test('does not emit RbacCallback artifacts or duplicate artifact paths for custom flow with RBAC', async () => {
1469
- const { generate } = await import('../src/generate.js');
1478
+ const { generate } = await import('../../../src/generate.js');
1470
1479
  const rootPath = await createProject();
1471
1480
  await writeFile(
1472
1481
  join(rootPath, 'app/src/schemas/ObjectSchemas/ComAcc.js'),
@@ -1539,7 +1548,7 @@ test('does not emit RbacCallback artifacts or duplicate artifact paths for custo
1539
1548
  });
1540
1549
 
1541
1550
  test('skips checkRbacPermission in FlowEndpoint_Main when initiateBy is systemNoUser', async () => {
1542
- const { generate } = await import('../src/generate.js');
1551
+ const { generate } = await import('../../../src/generate.js');
1543
1552
  const rootPath = await createProject();
1544
1553
  await writeFile(
1545
1554
  join(rootPath, 'app/src/schemas/ObjectSchemas/ComAcc.js'),
@@ -4,7 +4,7 @@ import { tmpdir } from 'node:os';
4
4
  import { join } from 'node:path';
5
5
  import test, { after } from 'node:test';
6
6
 
7
- import { generateRelationshipApplicationArtifacts } from '../src/emit/relationship/generateRelationshipApplicationArtifacts.js';
7
+ import { generateRelationshipApplicationArtifacts } from '../../../src/emit/application/relationship/generateRelationshipApplicationArtifacts.js';
8
8
 
9
9
  const roots = new Set();
10
10
  after(() =>
@@ -154,6 +154,36 @@ test('emits valid hook tags without trailing periods and with correct callingFlo
154
154
  assert.doesNotMatch(changeMain, /\/\/\(<requestParamCreateRel>\)/);
155
155
  });
156
156
 
157
+ test('imports getRelSchema and uses getRelationshipSchemaWithCache from getRelSchema in all relationship Main files', async () => {
158
+ const rootPath = await createProject(true);
159
+ await generateRelationshipApplicationArtifacts(rootPath, {
160
+ serviceTag: 'orders'
161
+ });
162
+
163
+ const actions = ['Create', 'Update', 'Delete', 'Get', 'Change', 'Move'];
164
+ for (const action of actions) {
165
+ const mainContent = await readFile(
166
+ join(
167
+ rootPath,
168
+ `app/src/generatedCode/FlowRelationships/${action}Relationship/source/${action}Relationship_Main.js`
169
+ ),
170
+ 'utf8'
171
+ );
172
+ assert.match(
173
+ mainContent,
174
+ /import\s*\{[^}]*getRelSchema[^}]*\}\s*from\s*'@izara_project\/izara-core-library-service-schemas'/
175
+ );
176
+ assert.match(
177
+ mainContent,
178
+ /const\s*\{[^}]*getRelationshipSchemaWithCache[^}]*\}\s*=\s*getRelSchema/
179
+ );
180
+ assert.doesNotMatch(
181
+ mainContent,
182
+ /const\s*\{[^}]*getRelationshipSchemaWithCache[^}]*\}\s*=\s*getObjectSchema/
183
+ );
184
+ }
185
+ });
186
+
157
187
  test('removes managed relationship artifacts after relationships are removed', async () => {
158
188
  const rootPath = await createProject(true);
159
189
  await generateRelationshipApplicationArtifacts(rootPath, {
@@ -1,7 +1,7 @@
1
1
  import assert from 'node:assert/strict';
2
2
  import test from 'node:test';
3
3
 
4
- import { emitSystemFindDataArtifacts } from '../src/emit/system/emitSystemFindDataArtifacts.js';
4
+ import { emitSystemFindDataArtifacts } from '../../../src/emit/application/system/emitSystemFindDataArtifacts.js';
5
5
 
6
6
  test('emitSystemFindDataArtifacts returns empty when no objects have storage resources', async () => {
7
7
  const result = await emitSystemFindDataArtifacts([
@@ -7,7 +7,7 @@ import {
7
7
  renderInvFunctionYaml,
8
8
  renderSqsFunctionYaml,
9
9
  renderWbsFunctionYaml
10
- } from '../src/emit/function/functionYamlArtifact.js';
10
+ } from '../../../src/emit/infrastructure/functions/functionYamlArtifact.js';
11
11
 
12
12
  test('renders function-setting hooks for every function transport', () => {
13
13
  const functions = [
@@ -6,7 +6,7 @@ import test, { after } from 'node:test';
6
6
 
7
7
  process.env.NODE_ENV = 'test';
8
8
 
9
- import { generateResourceArtifacts } from '../src/emit/resource/generateResourceArtifacts.js';
9
+ import { generateResourceArtifacts } from '../../../src/emit/infrastructure/resources/generateResourceArtifacts.js';
10
10
 
11
11
  const roots = new Set();
12
12
  after(() =>
@@ -167,6 +167,7 @@ test('emits queues, topics, tables, and IAM roles from schema data', async () =>
167
167
  assert.match(procFindDataRole, /dynamodb:Query/);
168
168
  assert.match(procFindDataRole, /sns:Publish/);
169
169
  assert.match(procFindDataRole, /FindData_Out/);
170
+ assert.match(procFindDataRole, /ProcessLogical_Out/);
170
171
  assert.doesNotMatch(
171
172
  iam,
172
173
  /s3:GetObjectVersion|sqs:DeleteMessageBatch|sqs:GetQueueUrl/
@@ -0,0 +1,268 @@
1
+ import assert from 'node:assert/strict';
2
+ import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import test from 'node:test';
6
+
7
+ import { mergeHooks } from '../../../src/output/mergeHooks.js';
8
+
9
+ async function writeTestFile(tmpDir, relativePath, content) {
10
+ const fullPath = path.join(tmpDir, relativePath);
11
+ await mkdir(path.dirname(fullPath), { recursive: true });
12
+ await writeFile(fullPath, content, 'utf8');
13
+ }
14
+
15
+ test('merges single hook in JS file when source content has custom code', async () => {
16
+ const tmpDir = await mkdtemp(path.join(os.tmpdir(), 'mergeHooks-test-'));
17
+ try {
18
+ const filePath = 'app/src/sample.js';
19
+ await writeTestFile(
20
+ tmpDir,
21
+ filePath,
22
+ '//(<customHook>)\nconst custom = true;\n//(</customHook>)\n'
23
+ );
24
+
25
+ const artifacts = [
26
+ {
27
+ path: filePath,
28
+ content: '//(<customHook>)\n//(</customHook>)\n'
29
+ }
30
+ ];
31
+
32
+ const result = await mergeHooks(tmpDir, artifacts);
33
+ assert.equal(
34
+ result[0].content,
35
+ '//(<customHook>)\nconst custom = true;\n//(</customHook>)\n'
36
+ );
37
+ } finally {
38
+ await rm(tmpDir, { recursive: true, force: true });
39
+ }
40
+ });
41
+
42
+ test('merges multiple occurrences of the same hook tag without losing occurrences', async () => {
43
+ const tmpDir = await mkdtemp(path.join(os.tmpdir(), 'mergeHooks-test-'));
44
+ try {
45
+ const filePath = 'app/src/Flow_Main.js';
46
+ const diskContent = [
47
+ 'function test() {',
48
+ ' //(<identifiers>)',
49
+ ' firstIdentifier: true',
50
+ ' //(</identifiers>)',
51
+ '',
52
+ ' //(<identifiers>)',
53
+ ' secondIdentifier: "customValue"',
54
+ ' //(</identifiers>)',
55
+ '}'
56
+ ].join('\n');
57
+ await writeTestFile(tmpDir, filePath, diskContent);
58
+
59
+ const templateContent = [
60
+ 'function test() {',
61
+ ' //(<identifiers>)',
62
+ ' //(</identifiers>)',
63
+ '',
64
+ ' //(<identifiers>)',
65
+ ' //(</identifiers>)',
66
+ '}'
67
+ ].join('\n');
68
+
69
+ const artifacts = [
70
+ {
71
+ path: filePath,
72
+ content: templateContent
73
+ }
74
+ ];
75
+
76
+ const result = await mergeHooks(tmpDir, artifacts);
77
+ assert.equal(result[0].content, diskContent);
78
+ } finally {
79
+ await rm(tmpDir, { recursive: true, force: true });
80
+ }
81
+ });
82
+
83
+ test('preserves second hook when the first occurrence of a duplicate hook is empty on disk', async () => {
84
+ const tmpDir = await mkdtemp(path.join(os.tmpdir(), 'mergeHooks-test-'));
85
+ try {
86
+ const filePath = 'app/src/Flow_Main.js';
87
+ const diskContent = [
88
+ 'function test() {',
89
+ ' //(<identifiers>)',
90
+ ' //(</identifiers>)',
91
+ '',
92
+ ' //(<identifiers>)',
93
+ ' orderId: requestParams.orderId',
94
+ ' //(</identifiers>)',
95
+ '}'
96
+ ].join('\n');
97
+ await writeTestFile(tmpDir, filePath, diskContent);
98
+
99
+ const templateContent = [
100
+ 'function test() {',
101
+ ' //(<identifiers>)',
102
+ ' //(</identifiers>)',
103
+ '',
104
+ ' //(<identifiers>)',
105
+ ' //(</identifiers>)',
106
+ '}'
107
+ ].join('\n');
108
+
109
+ const artifacts = [
110
+ {
111
+ path: filePath,
112
+ content: templateContent
113
+ }
114
+ ];
115
+
116
+ const result = await mergeHooks(tmpDir, artifacts);
117
+ assert.equal(result[0].content, diskContent);
118
+ } finally {
119
+ await rm(tmpDir, { recursive: true, force: true });
120
+ }
121
+ });
122
+
123
+ test('merges hooks with relaxed whitespace around comment slashes and tags', async () => {
124
+ const tmpDir = await mkdtemp(path.join(os.tmpdir(), 'mergeHooks-test-'));
125
+ try {
126
+ const filePath = 'app/src/sample.js';
127
+ await writeTestFile(
128
+ tmpDir,
129
+ filePath,
130
+ '// (<spacedHook>)\nconst spaced = 1;\n// (</spacedHook>)\n'
131
+ );
132
+
133
+ const artifacts = [
134
+ {
135
+ path: filePath,
136
+ content: '//(<spacedHook>)\n//(</spacedHook>)\n'
137
+ }
138
+ ];
139
+
140
+ const result = await mergeHooks(tmpDir, artifacts);
141
+ assert.equal(
142
+ result[0].content,
143
+ '// (<spacedHook>)\nconst spaced = 1;\n// (</spacedHook>)\n'
144
+ );
145
+ } finally {
146
+ await rm(tmpDir, { recursive: true, force: true });
147
+ }
148
+ });
149
+
150
+ test('merges hooks with hyphens and dots in tag names', async () => {
151
+ const tmpDir = await mkdtemp(path.join(os.tmpdir(), 'mergeHooks-test-'));
152
+ try {
153
+ const filePath = 'app/src/sample.js';
154
+ await writeTestFile(
155
+ tmpDir,
156
+ filePath,
157
+ '//(<custom-hook.name>)\nconst customName = "valid";\n//(</custom-hook.name>)\n'
158
+ );
159
+
160
+ const artifacts = [
161
+ {
162
+ path: filePath,
163
+ content: '//(<custom-hook.name>)\n//(</custom-hook.name>)\n'
164
+ }
165
+ ];
166
+
167
+ const result = await mergeHooks(tmpDir, artifacts);
168
+ assert.equal(
169
+ result[0].content,
170
+ '//(<custom-hook.name>)\nconst customName = "valid";\n//(</custom-hook.name>)\n'
171
+ );
172
+ } finally {
173
+ await rm(tmpDir, { recursive: true, force: true });
174
+ }
175
+ });
176
+
177
+ test('merges hooks in YAML files with relaxed whitespace and hyphens', async () => {
178
+ const tmpDir = await mkdtemp(path.join(os.tmpdir(), 'mergeHooks-test-'));
179
+ try {
180
+ const filePath = 'app/sls_yaml/test.yml';
181
+ const diskContent = [
182
+ '# <#custom-filter-patterns#>',
183
+ 'filterPatterns:',
184
+ ' - body: custom',
185
+ '# <#/custom-filter-patterns#>'
186
+ ].join('\n');
187
+ await writeTestFile(tmpDir, filePath, diskContent);
188
+
189
+ const templateContent = [
190
+ '#<#custom-filter-patterns#>',
191
+ '#<#/custom-filter-patterns#>'
192
+ ].join('\n');
193
+
194
+ const artifacts = [
195
+ {
196
+ path: filePath,
197
+ content: templateContent
198
+ }
199
+ ];
200
+
201
+ const result = await mergeHooks(tmpDir, artifacts);
202
+ assert.equal(result[0].content, diskContent);
203
+ } finally {
204
+ await rm(tmpDir, { recursive: true, force: true });
205
+ }
206
+ });
207
+
208
+ test('merges hooks in .mjs and .cjs files', async () => {
209
+ const tmpDir = await mkdtemp(path.join(os.tmpdir(), 'mergeHooks-test-'));
210
+ try {
211
+ const mjsPath = 'app/src/sample.mjs';
212
+ const cjsPath = 'app/src/sample.cjs';
213
+ await writeTestFile(
214
+ tmpDir,
215
+ mjsPath,
216
+ '//(<mjsHook>)\nexport default 1;\n//(</mjsHook>)\n'
217
+ );
218
+ await writeTestFile(
219
+ tmpDir,
220
+ cjsPath,
221
+ '//(<cjsHook>)\nmodule.exports = 2;\n//(</cjsHook>)\n'
222
+ );
223
+
224
+ const artifacts = [
225
+ {
226
+ path: mjsPath,
227
+ content: '//(<mjsHook>)\n//(</mjsHook>)\n'
228
+ },
229
+ {
230
+ path: cjsPath,
231
+ content: '//(<cjsHook>)\n//(</cjsHook>)\n'
232
+ }
233
+ ];
234
+
235
+ const result = await mergeHooks(tmpDir, artifacts);
236
+ assert.equal(
237
+ result[0].content,
238
+ '//(<mjsHook>)\nexport default 1;\n//(</mjsHook>)\n'
239
+ );
240
+ assert.equal(
241
+ result[1].content,
242
+ '//(<cjsHook>)\nmodule.exports = 2;\n//(</cjsHook>)\n'
243
+ );
244
+ } finally {
245
+ await rm(tmpDir, { recursive: true, force: true });
246
+ }
247
+ });
248
+
249
+ test('respects writeWhenFileExist false flag by returning disk content unchanged', async () => {
250
+ const tmpDir = await mkdtemp(path.join(os.tmpdir(), 'mergeHooks-test-'));
251
+ try {
252
+ const filePath = 'app/src/immutable.js';
253
+ await writeTestFile(tmpDir, filePath, '// existing disk content\n');
254
+
255
+ const artifacts = [
256
+ {
257
+ path: filePath,
258
+ content: '// new template content\n',
259
+ writeWhenFileExist: false
260
+ }
261
+ ];
262
+
263
+ const result = await mergeHooks(tmpDir, artifacts);
264
+ assert.equal(result[0].content, '// existing disk content\n');
265
+ } finally {
266
+ await rm(tmpDir, { recursive: true, force: true });
267
+ }
268
+ });