@izara_project/izara-core-generate-service-code 1.0.68 → 1.0.69

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 (81) hide show
  1. package/package.json +1 -1
  2. package/scripts/format-ejs.js +1 -2
  3. package/src/compile/compileProject.js +26 -10
  4. package/src/compile/loadSchemas.js +47 -23
  5. package/src/emit/crud/emitCrudApplicationArtifacts.js +188 -41
  6. package/src/emit/crud/emitDynamicCrudFlowSchemas.js +34 -17
  7. package/src/emit/crud/generateCrudApplicationArtifacts.js +14 -6
  8. package/src/emit/crud/generateDynamicCrudFlowSchemas.js +4 -1
  9. package/src/emit/crud/templates/GetEndpoint_Main.ejs +1 -1
  10. package/src/emit/custom/customFlows.js +23 -13
  11. package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +515 -113
  12. package/src/emit/custom/generateCustomFlowApplicationArtifacts.js +28 -8
  13. package/src/emit/custom/templates/s3/FlowHandler_HdrS3.ejs +2 -2
  14. package/src/emit/custom/templates/s3/ReservedLimit_HdrSqs.ejs +1 -1
  15. package/src/emit/function/functionYamlArtifact.js +270 -97
  16. package/src/emit/function/templates/ApiFunction_Yaml.ejs +7 -0
  17. package/src/emit/function/templates/EventBridgeFunction_Yaml.ejs +6 -0
  18. package/src/emit/function/templates/InvFunction_Yaml.ejs +5 -0
  19. package/src/emit/function/templates/S3Function_Yaml.ejs +16 -0
  20. package/src/emit/function/templates/SqsFunction_Yaml.ejs +10 -0
  21. package/src/emit/function/templates/WbsFunction_Yaml.ejs +10 -0
  22. package/src/emit/rbac/emitDynamicRbacFlowSchemas.js +28 -30
  23. package/src/emit/rbac/emitRbacApplicationArtifacts.js +6 -6
  24. package/src/emit/rbac/generateCreateTargetRoleHandler.js +6 -4
  25. package/src/emit/rbac/generateDynamicRbacFlowSchemas.js +8 -2
  26. package/src/emit/rbac/rbacFlowTag.js +3 -1
  27. package/src/emit/rbac/templates/UserRbacFlow_Main.ejs +1 -1
  28. package/src/emit/relationship/emitDynamicRelationshipFlowSchemas.js +26 -10
  29. package/src/emit/relationship/emitRelationshipApplicationArtifacts.js +179 -37
  30. package/src/emit/relationship/generateDynamicRelationshipFlowSchemas.js +8 -2
  31. package/src/emit/relationship/generateRelationshipApplicationArtifacts.js +15 -6
  32. package/src/emit/resource/emitResourceArtifacts.js +187 -114
  33. package/src/emit/resource/generateResourceArtifacts.js +15 -6
  34. package/src/emit/resource/templates/DynamoDBTable_Yaml.ejs +18 -18
  35. package/src/emit/resource/templates/FlowOut_Yaml.ejs +5 -5
  36. package/src/emit/resource/templates/GeneratedLambdaRoleServiceConfig.ejs +10 -9
  37. package/src/emit/resource/templates/ResourceBeforeLogicalYaml.ejs +44 -44
  38. package/src/emit/resource/templates/ResourceSqsYaml.ejs +36 -36
  39. package/src/emit/resource/templates/ResourceYaml.ejs +48 -48
  40. package/src/emit/resource/templates/S3Subscription_Yaml.ejs +7 -0
  41. package/src/emit/resource/templates/SharedResource_Yaml.ejs +11 -11
  42. package/src/emit/resource/templates/SystemDynamoDB_Yaml.ejs +105 -105
  43. package/src/emit/resource/templates/WebSocketSubscription_Yaml.ejs +7 -0
  44. package/src/emit/system/emitSystemWebSocketArtifacts.js +61 -165
  45. package/src/emit/system/templates/WebSocketComplete_HdrSqs.ejs +32 -0
  46. package/src/emit/system/templates/WebSocketComplete_Main.ejs +46 -0
  47. package/src/emit/system/templates/WebSocketComplete_Yaml.ejs +19 -0
  48. package/src/emit/system/templates/WebSocketConnect.ejs +25 -0
  49. package/src/emit/system/templates/WebSocketConnect_Yaml.ejs +11 -0
  50. package/src/generate.js +136 -33
  51. package/src/generateIntTest.js +76 -28
  52. package/src/generateResourceIntTest.js +35 -12
  53. package/src/generateResources/IntTest/generateResources/generateResources.js +5 -2
  54. package/src/generateResources/IntTest/generateResources/templateResources.ejs +18 -30
  55. package/src/generateResources/IntTest/generateTests/events/events.js +1 -1
  56. package/src/generateResources/IntTest/generateTests/events/templateEvents.ejs +13 -10
  57. package/src/generateResources/IntTest/generateTests/generateTemplate.js +2 -2
  58. package/src/generateResources/IntTest/generateTests/pathIntTest/pathIntTest.js +2 -1
  59. package/src/generateResources/IntTest/generateTests/pathIntTest/template.ejs +1 -3
  60. package/src/generateResources/IntTest/generateTests/tests/templateTests.ejs +1 -1
  61. package/src/generateResources/IntTest/generateTests/tests/tests.js +7 -3
  62. package/src/generateResources/IntTest/libs/{libs.js → IntTestGenerateLib.js} +34 -23
  63. package/src/generateResources/IntTest/upload/uploadIntTest.js +33 -19
  64. package/src/intTestGeneratorShared.js +15 -10
  65. package/src/output/commitArtifacts.js +99 -39
  66. package/src/output/mergeHooks.js +24 -10
  67. package/src/output/validateArtifacts.js +37 -27
  68. package/src/plan/buildGenerationPlan.js +24 -13
  69. package/test/core.test.js +116 -49
  70. package/test/createTargetRoleHandler.test.js +1 -1
  71. package/test/crudApplicationArtifacts.test.js +128 -23
  72. package/test/customFlowApplicationArtifacts.test.js +353 -71
  73. package/test/dynamicCrudFlowSchemas.test.js +74 -26
  74. package/test/dynamicRbacFlowSchemas.test.js +61 -14
  75. package/test/dynamicRelationshipFlowSchemas.test.js +65 -18
  76. package/test/functionYamlArtifact.test.js +67 -10
  77. package/test/intTestApi.test.js +9 -10
  78. package/test/publicApi.test.js +176 -34
  79. package/test/relationshipApplicationArtifacts.test.js +90 -19
  80. package/test/resourceArtifacts.test.js +172 -32
  81. package/src/emit/relationship/dynamicRelationshipFlowSchemaTemplate.js +0 -11
@@ -2,15 +2,23 @@ import { buildGenerationPlan } from '../../plan/buildGenerationPlan.js';
2
2
  import { commitArtifacts } from '../../output/commitArtifacts.js';
3
3
  import { compileProject } from '../../compile/compileProject.js';
4
4
  import { loadLocalSchemaArrays } from './loadLocalSchemaArrays.js';
5
- import { crudApplicationManagedPaths, emitCrudApplicationArtifacts } from './emitCrudApplicationArtifacts.js';
5
+ import {
6
+ crudApplicationManagedPaths,
7
+ emitCrudApplicationArtifacts
8
+ } from './emitCrudApplicationArtifacts.js';
6
9
 
7
10
  export async function generateCrudApplicationArtifacts(rootPath, options = {}) {
8
11
  const project = compileProject({ ...options, rootPath });
9
12
  const schemas = await loadLocalSchemaArrays(project);
10
- const artifacts = await emitCrudApplicationArtifacts({ ...schemas, serviceTag: project.serviceTag });
11
- const files = await commitArtifacts(buildGenerationPlan(project, artifacts, {
12
- managedPaths: crudApplicationManagedPaths(),
13
- managedScope: 'crud-application'
14
- }));
13
+ const artifacts = await emitCrudApplicationArtifacts({
14
+ ...schemas,
15
+ serviceTag: project.serviceTag
16
+ });
17
+ const files = await commitArtifacts(
18
+ buildGenerationPlan(project, artifacts, {
19
+ managedPaths: crudApplicationManagedPaths(),
20
+ managedScope: 'crud-application'
21
+ })
22
+ );
15
23
  return { project, files };
16
24
  }
@@ -13,7 +13,10 @@ export async function generateDynamicCrudFlowSchemas(rootPath, options = {}) {
13
13
  const plan = buildGenerationPlan(
14
14
  project,
15
15
  emitDynamicCrudFlowSchemas(schemaInputs),
16
- { managedPaths: dynamicCrudFlowSchemaPaths, managedScope: 'crud-flow-schemas' }
16
+ {
17
+ managedPaths: dynamicCrudFlowSchemaPaths,
18
+ managedScope: 'crud-flow-schemas'
19
+ }
17
20
  );
18
21
  const files = await commitArtifacts(plan);
19
22
 
@@ -94,7 +94,7 @@ export default async function <%- flowTag %>(
94
94
  // ── Process storage resources ─────────────────────────────────────────────
95
95
  const getResults = [];
96
96
  const recordStatus = { foundAtLeastOne: false, missingAtLeastOne: false };
97
- let lastObjInstanceFull = undefined;
97
+ let lastObjInstanceFull = null;
98
98
 
99
99
  await Promise.all(
100
100
  Object.entries(getDataDetails).map(async ([, getDataDetail]) => {
@@ -13,12 +13,12 @@ export function supportedCustomFlows(flows) {
13
13
  throw new TypeError('flows must be an array');
14
14
  }
15
15
  return flows.filter(
16
- flow =>
16
+ (flow) =>
17
17
  typeof flow?.flowTag === 'string' &&
18
18
  flow.flowTag !== '' &&
19
19
  !flow.generatedCodeConfig &&
20
20
  Array.isArray(flow.event) &&
21
- flow.event.some(event => SUPPORTED_EVENTS.has(event))
21
+ flow.event.some((event) => SUPPORTED_EVENTS.has(event))
22
22
  );
23
23
  }
24
24
 
@@ -30,17 +30,20 @@ export function flowExtTopicSteps(flows) {
30
30
  if (!Array.isArray(flows)) {
31
31
  throw new TypeError('flows must be an array');
32
32
  }
33
- return flows.flatMap(flow => {
33
+ return flows.flatMap((flow) => {
34
34
  if (typeof flow?.flowTag !== 'string' || flow.flowTag === '') {
35
35
  return [];
36
36
  }
37
- const hasTriggerFlowTypes = Array.isArray(flow.triggerFlowTypes) && flow.triggerFlowTypes.length > 0;
37
+ const hasTriggerFlowTypes =
38
+ Array.isArray(flow.triggerFlowTypes) && flow.triggerFlowTypes.length > 0;
38
39
  const steps = flow.flowSteps ?? [];
39
40
  const hasCheckStep = steps.some(
40
- step => typeof step?.stepName === 'string' && step.stepName.toLowerCase().includes('checktrigger')
41
+ (step) =>
42
+ typeof step?.stepName === 'string' &&
43
+ step.stepName.toLowerCase().includes('checktrigger')
41
44
  );
42
45
 
43
- const result = steps.flatMap(step => {
46
+ const result = steps.flatMap((step) => {
44
47
  if (
45
48
  typeof step?.stepName !== 'string' ||
46
49
  step.stepName === '' ||
@@ -82,11 +85,11 @@ export function flowDsqSteps(flows) {
82
85
  if (!Array.isArray(flows)) {
83
86
  throw new TypeError('flows must be an array');
84
87
  }
85
- return flows.flatMap(flow => {
88
+ return flows.flatMap((flow) => {
86
89
  if (typeof flow?.flowTag !== 'string' || flow.flowTag === '') {
87
90
  return [];
88
91
  }
89
- return (flow.flowSteps ?? []).flatMap(step =>
92
+ return (flow.flowSteps ?? []).flatMap((step) =>
90
93
  typeof step?.stepName === 'string' &&
91
94
  step.stepName !== '' &&
92
95
  step.stepName.toLowerCase() !== 'start' &&
@@ -110,7 +113,7 @@ export function generatedOwnTopicFlows(flows) {
110
113
  throw new TypeError('flows must be an array');
111
114
  }
112
115
  return flows.filter(
113
- flow =>
116
+ (flow) =>
114
117
  typeof flow?.flowTag === 'string' &&
115
118
  flow.flowTag !== '' &&
116
119
  flow.generatedCodeConfig &&
@@ -128,7 +131,7 @@ export function triggerCacheFlows(flows) {
128
131
  throw new TypeError('flows must be an array');
129
132
  }
130
133
  return flows.filter(
131
- flow =>
134
+ (flow) =>
132
135
  typeof flow?.flowTag === 'string' &&
133
136
  flow.flowTag !== '' &&
134
137
  flow.statusType === 'triggerCache'
@@ -138,12 +141,19 @@ export function triggerCacheFlows(flows) {
138
141
  export function triggerCacheQueueNames(flow) {
139
142
  const tag = upperFirst(flow.flowTag);
140
143
  const queues = [`TriggerCache${tag}HdrDsq`];
141
- if (Array.isArray(flow.triggerFlowTypes) && flow.triggerFlowTypes.length > 0) {
144
+ if (
145
+ Array.isArray(flow.triggerFlowTypes) &&
146
+ flow.triggerFlowTypes.length > 0
147
+ ) {
142
148
  const customCheckStep = (flow.flowSteps ?? []).find(
143
- s => typeof s?.stepName === 'string' && s.stepName.toLowerCase().includes('checktrigger')
149
+ (s) =>
150
+ typeof s?.stepName === 'string' &&
151
+ s.stepName.toLowerCase().includes('checktrigger')
144
152
  );
145
153
  const checkStepName = customCheckStep
146
- ? (upperFirst(customCheckStep.stepName).startsWith(tag) ? upperFirst(customCheckStep.stepName) : `${tag}${upperFirst(customCheckStep.stepName)}`)
154
+ ? upperFirst(customCheckStep.stepName).startsWith(tag)
155
+ ? upperFirst(customCheckStep.stepName)
156
+ : `${tag}${upperFirst(customCheckStep.stepName)}`
147
157
  : `${tag}CheckTriggerFlows`;
148
158
  queues.push(`${checkStepName}HdrSqs`);
149
159
  }