@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
@@ -0,0 +1,177 @@
1
+ import assert from 'node:assert/strict';
2
+ import test, { after } from 'node:test';
3
+
4
+ import {
5
+ loadGenerateDirectives
6
+ } from '../../../src/compile/loadSchemas.js';
7
+ import {
8
+ emitAttributeTreeTargetValueStandard,
9
+ attributeTreeTargetValueStandardManagedPaths
10
+ } from '../../../src/emit/schemas/attributeTree/emitAttributeTreeTargetValueStandard.js';
11
+ import { generate } from '../../../src/generate.js';
12
+ import {
13
+ createTestProject,
14
+ readProjectFile,
15
+ writeProjectFile,
16
+ cleanupTestProjects
17
+ } from '../../helpers/testProject.js';
18
+
19
+ after(async () => {
20
+ await cleanupTestProjects();
21
+ });
22
+
23
+ test('loadGenerateDirectives returns empty array when directory missing', async () => {
24
+ const rootPath = await createTestProject({
25
+ prefix: 'izara-no-directives-test-',
26
+ serviceTag: 'TestService'
27
+ });
28
+ const project = { schemaRoot: `${rootPath}/app/src/schemas` };
29
+ const directives = await loadGenerateDirectives(project);
30
+ assert.deepEqual(directives, []);
31
+ });
32
+
33
+ test('loadGenerateDirectives loads directives from GenerateDirectives folder', async () => {
34
+ const rootPath = await createTestProject({
35
+ prefix: 'izara-directives-load-test-',
36
+ serviceTag: 'SellOfferTermManager',
37
+ schemas: {
38
+ 'GenerateDirectives/sellOfferTermValueStandard.js': `export default {
39
+ type: 'attributeTreeTarget',
40
+ attributeTreeTag: 'sellOfferTerm'
41
+ };
42
+ `
43
+ }
44
+ });
45
+ const project = { schemaRoot: `${rootPath}/app/src/schemas` };
46
+ const directives = await loadGenerateDirectives(project);
47
+ assert.equal(directives.length, 1);
48
+ assert.equal(directives[0].type, 'attributeTreeTarget');
49
+ assert.equal(directives[0].attributeTreeTag, 'sellOfferTerm');
50
+ });
51
+
52
+ test('emitAttributeTreeTargetValueStandard emits expected schema with hook', () => {
53
+ const directives = [
54
+ {
55
+ type: 'attributeTreeTarget',
56
+ attributeTreeTag: 'sellOfferTerm'
57
+ }
58
+ ];
59
+
60
+ const managedPaths =
61
+ attributeTreeTargetValueStandardManagedPaths(directives);
62
+ assert.deepEqual(managedPaths, [
63
+ 'app/src/schemas/ObjectSchemas/generatedCode/attributeTree/sellOfferTermValueStandard.js'
64
+ ]);
65
+
66
+ const artifacts = emitAttributeTreeTargetValueStandard({ directives });
67
+ assert.equal(artifacts.length, 1);
68
+
69
+ const artifact = artifacts[0];
70
+ assert.equal(
71
+ artifact.path,
72
+ 'app/src/schemas/ObjectSchemas/generatedCode/attributeTree/sellOfferTermValueStandard.js'
73
+ );
74
+ assert.match(
75
+ artifact.content,
76
+ /objectType:\s*['"]sellOfferTermValueStandard['"]/
77
+ );
78
+ assert.match(artifact.content, /sellOfferTermValueStandardId/);
79
+ assert.match(
80
+ artifact.content,
81
+ /\/\/\(<addOnDataStructuresellOfferTermValueStandard>\)/
82
+ );
83
+ assert.match(
84
+ artifact.content,
85
+ /\/\/\(<\/addOnDataStructuresellOfferTermValueStandard>\)/
86
+ );
87
+ assert.match(artifact.content, /propertyValue/);
88
+ assert.match(artifact.content, /GraphHandler/);
89
+ });
90
+
91
+ test('managed paths and emitter return empty when no matching directives', () => {
92
+ assert.deepEqual(attributeTreeTargetValueStandardManagedPaths([]), []);
93
+ assert.deepEqual(
94
+ attributeTreeTargetValueStandardManagedPaths([{ type: 'other' }]),
95
+ []
96
+ );
97
+ assert.deepEqual(emitAttributeTreeTargetValueStandard({ directives: [] }), []);
98
+ });
99
+
100
+ test('generate commits and cleans up attributeTreeTarget dynamic schemas', async () => {
101
+ const rootPath = await createTestProject({
102
+ prefix: 'izara-directives-gen-test-',
103
+ serviceTag: 'SellOfferTermManager',
104
+ schemas: {
105
+ 'GenerateDirectives/sellOfferTermValueStandard.js': `export default {
106
+ type: 'attributeTreeTarget',
107
+ attributeTreeTag: 'sellOfferTerm'
108
+ };
109
+ `
110
+ }
111
+ });
112
+
113
+ await generate(rootPath);
114
+
115
+ const targetRelPath =
116
+ 'app/src/schemas/ObjectSchemas/generatedCode/attributeTree/sellOfferTermValueStandard.js';
117
+ const content = await readProjectFile(rootPath, targetRelPath);
118
+ assert.match(content, /sellOfferTermValueStandard/);
119
+ assert.match(
120
+ content,
121
+ /\/\/\(<addOnDataStructuresellOfferTermValueStandard>\)/
122
+ );
123
+
124
+ // Regeneration preserves user changes inside the hook
125
+ const modifiedContent = content.replace(
126
+ '//(<addOnDataStructuresellOfferTermValueStandard>)\n // {\n // type: \'propertyValue\',\n // propertyValuePrefix: \'sellOfferTermValueStandard\'\n // }\n //(</addOnDataStructuresellOfferTermValueStandard>)',
127
+ '//(<addOnDataStructuresellOfferTermValueStandard>)\n {\n type: \'propertyValue\',\n propertyValuePrefix: \'sellOfferTermValueStandard\'\n }\n //(</addOnDataStructuresellOfferTermValueStandard>)'
128
+ );
129
+ await writeProjectFile(rootPath, targetRelPath, modifiedContent);
130
+
131
+ await generate(rootPath);
132
+
133
+ const regeneratedContent = await readProjectFile(rootPath, targetRelPath);
134
+ assert.match(
135
+ regeneratedContent,
136
+ /type:\s*'propertyValue'/
137
+ );
138
+
139
+ // Cascading verification: PropertyValue schemas generated in phase 2
140
+ const propLabelPath =
141
+ 'app/src/schemas/ObjectSchemas/generatedCode/propertyValue/sellOfferTermValueStandardPropertyLabel.js';
142
+ const propValuePath =
143
+ 'app/src/schemas/ObjectSchemas/generatedCode/propertyValue/sellOfferTermValueStandardPropertyValue.js';
144
+ const hasPropRelPath =
145
+ 'app/src/schemas/RelationshipSchemas/generatedCode/propertyValue/hasSellOfferTermValueStandardPropertyValue.js';
146
+ const disPropRelPath =
147
+ 'app/src/schemas/RelationshipSchemas/generatedCode/propertyValue/disabledSellOfferTermValueStandardPropertyValue.js';
148
+ const isPropRelPath =
149
+ 'app/src/schemas/RelationshipSchemas/generatedCode/propertyValue/isSellOfferTermValueStandardPropertyLabel.js';
150
+
151
+ const propLabelContent = await readProjectFile(rootPath, propLabelPath);
152
+ assert.match(propLabelContent, /sellOfferTermValueStandardPropertyLabel/);
153
+
154
+ const propValueContent = await readProjectFile(rootPath, propValuePath);
155
+ assert.match(propValueContent, /sellOfferTermValueStandardPropertyValue/);
156
+
157
+ const hasPropRelContent = await readProjectFile(rootPath, hasPropRelPath);
158
+ assert.match(hasPropRelContent, /hasSellOfferTermValueStandardPropertyValue/);
159
+
160
+ const disPropRelContent = await readProjectFile(rootPath, disPropRelPath);
161
+ assert.match(disPropRelContent, /disabledSellOfferTermValueStandardPropertyValue/);
162
+
163
+ const isPropRelContent = await readProjectFile(rootPath, isPropRelPath);
164
+ assert.match(isPropRelContent, /isSellOfferTermValueStandardPropertyLabel/);
165
+
166
+ // When directive removed, file is cleaned up
167
+ await writeProjectFile(
168
+ rootPath,
169
+ 'app/src/schemas/GenerateDirectives/sellOfferTermValueStandard.js',
170
+ 'export default { type: "disabled" };\n'
171
+ );
172
+ await generate(rootPath);
173
+
174
+ await assert.rejects(readProjectFile(rootPath, targetRelPath), {
175
+ code: 'ENOENT'
176
+ });
177
+ });
@@ -1,5 +1,5 @@
1
1
  import assert from 'node:assert/strict';
2
- import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
2
+ import { mkdir, mkdtemp } from 'node:fs/promises';
3
3
  import { tmpdir } from 'node:os';
4
4
  import { join } from 'node:path';
5
5
  import test, { after } from 'node:test';
@@ -8,20 +8,19 @@ import {
8
8
  emitAttributeTreeObjectSchemas,
9
9
  emitAttributeTreeRelationshipSchemas,
10
10
  attributeTreeObjectSchemaManagedPaths,
11
- attributeTreeRelationshipSchemaManagedPaths,
12
- resolveTargetServicePath,
13
- emitAttributeTreeTargetSchemas
14
- } from '../src/emit/attributeTree/emitAttributeTreeSchemas.js';
15
- import { generate } from '../src/generate.js';
16
-
17
- const projectRoots = new Set();
11
+ attributeTreeRelationshipSchemaManagedPaths
12
+ } from '../../../src/emit/schemas/attributeTree/emitAttributeTreeSchemas.js';
13
+ import { generate } from '../../../src/generate.js';
14
+ import {
15
+ createTestProject,
16
+ readProjectFile,
17
+ writeProjectFile,
18
+ cleanupTestProjects,
19
+ trackTestProject
20
+ } from '../../helpers/testProject.js';
18
21
 
19
22
  after(async () => {
20
- await Promise.all(
21
- [...projectRoots].map((rootPath) =>
22
- rm(rootPath, { recursive: true, force: true })
23
- )
24
- );
23
+ await cleanupTestProjects();
25
24
  });
26
25
 
27
26
  test('emitAttributeTreeObjectSchemas returns 3 object schemas per attributeTree tag', () => {
@@ -53,9 +52,9 @@ test('emitAttributeTreeObjectSchemas returns 3 object schemas per attributeTree
53
52
 
54
53
  const paths = artifacts.map((a) => a.path);
55
54
  assert.deepEqual(paths, [
56
- 'app/src/schemas/ObjectSchemas/generatedAttributeTree/sellOfferTermLink.js',
57
- 'app/src/schemas/ObjectSchemas/generatedAttributeTree/sellOfferTermValue.js',
58
- 'app/src/schemas/ObjectSchemas/generatedAttributeTree/sellOfferTermLabel.js'
55
+ 'app/src/schemas/ObjectSchemas/generatedCode/attributeTree/sellOfferTermLink.js',
56
+ 'app/src/schemas/ObjectSchemas/generatedCode/attributeTree/sellOfferTermValue.js',
57
+ 'app/src/schemas/ObjectSchemas/generatedCode/attributeTree/sellOfferTermLabel.js'
59
58
  ]);
60
59
 
61
60
  const valueArtifact = artifacts.find((a) =>
@@ -102,10 +101,10 @@ test('emitAttributeTreeRelationshipSchemas returns 4 relationship schemas per at
102
101
 
103
102
  const paths = artifacts.map((a) => a.path);
104
103
  assert.deepEqual(paths, [
105
- 'app/src/schemas/RelationshipSchemas/generatedAttributeTree/hasSellOfferTermLink.js',
106
- 'app/src/schemas/RelationshipSchemas/generatedAttributeTree/disabledSellOfferTermLink.js',
107
- 'app/src/schemas/RelationshipSchemas/generatedAttributeTree/isSellOfferTerm.js',
108
- 'app/src/schemas/RelationshipSchemas/generatedAttributeTree/isSellOfferTermLabel.js'
104
+ 'app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/hasSellOfferTermLink.js',
105
+ 'app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/disabledSellOfferTermLink.js',
106
+ 'app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/isSellOfferTerm.js',
107
+ 'app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/isSellOfferTermLabel.js'
109
108
  ]);
110
109
 
111
110
  const hasRel = artifacts.find((a) => a.path.endsWith('hasSellOfferTermLink.js'));
@@ -149,23 +148,19 @@ test('managed paths return empty array when no attributeTree is present', () =>
149
148
 
150
149
  test('generate commits and cleans up attributeTree dynamic schemas', async () => {
151
150
  const rootPath = await createProjectWithAttributeTree({ hasAddOn: true });
152
- const result = await generate(rootPath);
151
+ await generate(rootPath);
153
152
 
154
- const expectedObjectPath = join(
155
- rootPath,
156
- 'app/src/schemas/ObjectSchemas/generatedAttributeTree/sellOfferTermLink.js'
157
- );
158
- const expectedRelPath = join(
159
- rootPath,
160
- 'app/src/schemas/RelationshipSchemas/generatedAttributeTree/hasSellOfferTermLink.js'
161
- );
153
+ const objectRelPath =
154
+ 'app/src/schemas/ObjectSchemas/generatedCode/attributeTree/sellOfferTermLink.js';
155
+ const relRelPath =
156
+ 'app/src/schemas/RelationshipSchemas/generatedCode/attributeTree/hasSellOfferTermLink.js';
162
157
 
163
- const objectContent = await readFile(expectedObjectPath, 'utf8');
158
+ const objectContent = await readProjectFile(rootPath, objectRelPath);
164
159
  assert.match(objectContent, /sellOfferTermLink/);
165
160
  assert.match(objectContent, /GraphHandler/);
166
161
  assert.doesNotMatch(objectContent, /dynamoDB/);
167
162
 
168
- const relContent = await readFile(expectedRelPath, 'utf8');
163
+ const relContent = await readProjectFile(rootPath, relRelPath);
169
164
  assert.match(relContent, /hasSellOfferTermLink/);
170
165
  assert.match(relContent, /sellOfferTermLink/);
171
166
 
@@ -173,10 +168,10 @@ test('generate commits and cleans up attributeTree dynamic schemas', async () =>
173
168
  await createProjectWithAttributeTree({ rootPath, hasAddOn: false });
174
169
  await generate(rootPath);
175
170
 
176
- await assert.rejects(readFile(expectedObjectPath, 'utf8'), {
171
+ await assert.rejects(readProjectFile(rootPath, objectRelPath), {
177
172
  code: 'ENOENT'
178
173
  });
179
- await assert.rejects(readFile(expectedRelPath, 'utf8'), {
174
+ await assert.rejects(readProjectFile(rootPath, relRelPath), {
180
175
  code: 'ENOENT'
181
176
  });
182
177
  });
@@ -185,21 +180,6 @@ async function createProjectWithAttributeTree({
185
180
  rootPath: existingRoot,
186
181
  hasAddOn = true
187
182
  } = {}) {
188
- const rootPath =
189
- existingRoot || (await mkdtemp(join(tmpdir(), 'izara-attr-tree-test-')));
190
- projectRoots.add(rootPath);
191
-
192
- const schemaRoot = join(rootPath, 'app/src/schemas');
193
- await mkdir(join(schemaRoot, 'ObjectSchemas'), { recursive: true });
194
- await mkdir(join(schemaRoot, 'RelationshipSchemas'), { recursive: true });
195
- await mkdir(join(schemaRoot, 'FlowSchemas'), { recursive: true });
196
- await mkdir(join(rootPath, 'config'), { recursive: true });
197
-
198
- await writeFile(
199
- join(rootPath, 'config/serverless.config.yml'),
200
- 'service: SellOfferManager\ncustom:\n serviceTag: SellOfferManager\n'
201
- );
202
-
203
183
  const addOnContent = hasAddOn
204
184
  ? `
205
185
  addOnDataStructure: [
@@ -210,9 +190,7 @@ async function createProjectWithAttributeTree({
210
190
  ],`
211
191
  : ' addOnDataStructure: [],';
212
192
 
213
- await writeFile(
214
- join(schemaRoot, 'ObjectSchemas/SellOffer.js'),
215
- `export default [
193
+ const schemaContent = `export default [
216
194
  {
217
195
  objectType: 'sellOffer',
218
196
  canDelete: false,
@@ -244,58 +222,24 @@ async function createProjectWithAttributeTree({
244
222
  ]
245
223
  }
246
224
  ];
247
- `
248
- );
249
-
250
- return rootPath;
251
- }
252
-
253
- test('resolveTargetServicePath prioritizes dev suffix and matches attributeTag', async () => {
254
- const tmpRoot = await mkdtemp(join(tmpdir(), 'izara-services-test-'));
255
- projectRoots.add(tmpRoot);
256
-
257
- const currentServiceDir = join(
258
- tmpRoot,
259
- 'izara-market-products-sell-offer-manager-pong'
260
- );
261
- const targetWithSuffix = join(
262
- tmpRoot,
263
- 'izara-market-products-sell-offer-term-pong'
264
- );
265
- const targetOtherDev = join(
266
- tmpRoot,
267
- 'izara-market-products-sell-offer-term-alice'
268
- );
269
- const unrelatedService = join(
270
- tmpRoot,
271
- 'izara-market-products-cart-pong'
272
- );
273
-
274
- await mkdir(join(currentServiceDir, 'app/src'), { recursive: true });
275
- await mkdir(join(targetWithSuffix, 'app/src'), { recursive: true });
276
- await mkdir(join(targetOtherDev, 'app/src'), { recursive: true });
277
- await mkdir(join(unrelatedService, 'app/src'), { recursive: true });
278
-
279
- const resolved = resolveTargetServicePath({
280
- currentServiceRoot: currentServiceDir,
281
- attributeTag: 'sellOfferTerm'
282
- });
283
-
284
- assert.equal(resolved, targetWithSuffix);
285
- });
225
+ `;
226
+
227
+ if (existingRoot) {
228
+ await writeProjectFile(
229
+ existingRoot,
230
+ 'app/src/schemas/ObjectSchemas/SellOffer.js',
231
+ schemaContent
232
+ );
233
+ return existingRoot;
234
+ }
286
235
 
287
- test('emitAttributeTreeTargetSchemas produces expected standard schemas', () => {
288
- const targetDir = '/dummy/path/izara-market-products-sellOfferTerm';
289
- const artifacts = emitAttributeTreeTargetSchemas({
290
- attributeTag: 'sellOfferTerm',
291
- targetServiceRoot: targetDir
236
+ return await createTestProject({
237
+ prefix: 'izara-attr-tree-test-',
238
+ serviceTag: 'SellOfferManager',
239
+ schemas: {
240
+ 'ObjectSchemas/SellOffer.js': schemaContent
241
+ }
292
242
  });
243
+ }
293
244
 
294
- assert.equal(artifacts.length, 3);
295
- const paths = artifacts.map((a) => a.path);
296
-
297
- assert.ok(paths.some((p) => p.endsWith('sellOfferTermValueStandardPropertyLabel.js')));
298
- assert.ok(paths.some((p) => p.endsWith('sellOfferTermValueStandardPropertyValue.js')));
299
- assert.ok(paths.some((p) => p.endsWith('sellOfferTermValueStandard.js')));
300
- });
301
245
 
@@ -5,8 +5,8 @@ import { join } from 'node:path';
5
5
  import test from 'node:test';
6
6
  import { pathToFileURL } from 'node:url';
7
7
 
8
- import { generateDynamicCrudFlowSchemas } from '../src/emit/crud/generateDynamicCrudFlowSchemas.js';
9
- import { createCrudActionPlans } from '../src/emit/crud/crudActionPlan.js';
8
+ import { generateDynamicCrudFlowSchemas } from '../../../src/emit/application/crud/generateDynamicCrudFlowSchemas.js';
9
+ import { createCrudActionPlans } from '../../../src/emit/application/crud/crudActionPlan.js';
10
10
 
11
11
  test('generates dynamic CRUD schemas from local schema modules', async () => {
12
12
  const rootPath = await createProject({
@@ -5,7 +5,7 @@ import { join } from 'node:path';
5
5
  import test, { after } from 'node:test';
6
6
  import { pathToFileURL } from 'node:url';
7
7
 
8
- import { generateDynamicRbacFlowSchemas } from '../src/emit/rbac/generateDynamicRbacFlowSchemas.js';
8
+ import { generateDynamicRbacFlowSchemas } from '../../../src/emit/application/rbac/generateDynamicRbacFlowSchemas.js';
9
9
 
10
10
  const projectRoots = new Set();
11
11
  const STATIC_RBAC_ACTIONS = [
@@ -5,7 +5,7 @@ import { join } from 'node:path';
5
5
  import test, { after } from 'node:test';
6
6
  import { pathToFileURL } from 'node:url';
7
7
 
8
- import { generateDynamicRelationshipFlowSchemas } from '../src/emit/relationship/generateDynamicRelationshipFlowSchemas.js';
8
+ import { generateDynamicRelationshipFlowSchemas } from '../../../src/emit/application/relationship/generateDynamicRelationshipFlowSchemas.js';
9
9
 
10
10
  const RELATIONSHIP_ACTIONS = [
11
11
  'CreateRelationship',
@@ -60,6 +60,16 @@ test('generates dynamic relationship schemas when declared relationships exist',
60
60
  'userId',
61
61
  'correlationId'
62
62
  ]);
63
+ const completeStep = create.flowSteps.find(
64
+ (step) => step.stepName === 'Complete'
65
+ );
66
+ assert.deepEqual(completeStep.properties, [
67
+ 'returnValue',
68
+ 'parentFlowId',
69
+ 'status',
70
+ 'foundErrors',
71
+ 'graphServiceTag'
72
+ ]);
63
73
  assert.deepEqual(get.event, [
64
74
  'lambdaSyncInv',
65
75
  'lambdaSyncApi',
@@ -8,8 +8,8 @@ import {
8
8
  emitErrorSchemas,
9
9
  errorSchemaManagedPaths,
10
10
  ERROR_SCHEMA_PATH
11
- } from '../src/emit/error/emitErrorSchemas.js';
12
- import { generate } from '../src/generate.js';
11
+ } from '../../../src/emit/schemas/error/emitErrorSchemas.js';
12
+ import { generate } from '../../../src/generate.js';
13
13
 
14
14
  const roots = new Set();
15
15
  after(() =>