@izara_project/izara-core-generate-service-code 1.0.53 → 1.0.55
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.
- package/package.json +1 -2
- package/src/codeGenerators/app/initial_setup/InitialSetupGenerator.js +1 -1
- package/src/codeGenerators/app/sls_yaml/FindDataYamlGenerator.js +23 -0
- package/src/codeGenerators/app/sls_yaml/FunctionYamlGenerator.js +16 -16
- package/src/codeGenerators/app/sls_yaml/ProcessLogicalYamlGenerator.js +11 -25
- package/src/codeGenerators/app/sls_yaml/RoleNameConfigGenerator.js +1 -1
- package/src/codeGenerators/app/sls_yaml/SharedResourceYamlGenerator.js +3 -3
- package/src/codeGenerators/app/sls_yaml/renderYamlTemplate.js +13 -0
- package/src/codeGenerators/app/sls_yaml/templates/SharedResource_Yaml.ejs +6 -2
- package/src/codeGenerators/app/src/generatedCode/FindData/FindDataGenerator.js +10 -44
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowEndpoints/EndpointsGenerator.js +119 -0
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/RbacFlowGenerator.js +91 -52
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRelationshipEndpoints/RelationshipFlowGenerator.js +20 -16
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/StatusFieldGenerator.js +2 -9
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/WebSocketGenerator.js +1 -7
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/BaseSqsHandler.js +3 -3
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/ConfirmAfterUploadS3Generator.js +2 -4
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/CreateObjectGenerator.js +2 -4
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/CreatePreSignUrlGenerator.js +2 -4
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/ProcessAfterUploadS3Generator.js +5 -5
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/ReservedLimitGenerator.js +2 -4
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowEntryPointBase.js +6 -6
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowMainFunctionBase.js +3 -3
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowStepBase.js +11 -11
- package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/triggerCacheBase.js +1 -7
- package/src/codeGenerators/app/src/generatedCode/ProcessLogical/ProcessLogicalGenerator.js +18 -15
- package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{PaginateProcessLogical_HdrDsq.js → PaginateProcessLogical_HdrDsq.ejs} +1 -1
- package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/RegisterGenerator.js +127 -149
- package/src/codeGenerators/app/src/generatedCode/libs/ConstsGenerator.js +16 -8
- package/src/codeGenerators/app/src/generatedCode/libs/GenerateCodeLibsGenerator.js +17 -9
- package/src/codeGenerators/resource/sls_yaml/DynamoDBGenerator.js +8 -8
- package/src/codeGenerators/resource/sls_yaml/FlowOutGenerator.js +60 -43
- package/src/codeGenerators/resource/sls_yaml/FlowResourceYamlGenerator.js +151 -151
- package/src/codeGenerators/resource/sls_yaml/templates/crud/ResourceYaml.ejs +10 -10
- package/src/core/renderTemplateFile.js +22 -0
- package/src/generateCode.js +146 -81
- package/src/generateIntTest.js +45 -69
- package/src/generateResourceIntTest.js +22 -47
- package/src/intTestGeneratorShared.js +36 -0
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/DynamicFlowSchemaTemplate.ejs +12 -10
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/RelationshipFlowSchemaTemplate.ejs +6 -5
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/data.js +0 -119
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/template.ejs +0 -89
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/templateByStatusType/statusFieldTemplate.ejs +0 -30
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/templateByStatusType/storedCacheTemplate.ejs +0 -26
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/templateByStatusType/triggerCacheTemplate.ejs +0 -44
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/index.js +0 -80
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/functionYaml/data.js +0 -129
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/functionYaml/template.ejs +0 -17
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/handler/data.js +0 -63
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/mainFunction/data.js +0 -54
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/mainFunction/template.ejs +0 -129
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/queue/data.js +0 -63
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/queue/template.ejs +0 -45
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/functionYaml/data.js +0 -117
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/functionYaml/template.ejs +0 -20
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/handler/data.js +0 -64
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/mainFunction/data.js +0 -64
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/mainFunction/template.ejs +0 -131
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/functionYaml/data.js +0 -122
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/functionYaml/template.ejs +0 -17
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/handler/data.js +0 -66
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/handler/template.ejs +0 -99
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/mainFunction/data.js +0 -64
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/mainFunction/template.ejs +0 -82
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/sns-sqs/data.js +0 -70
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/sns-sqs/template.ejs +0 -49
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/functionYaml/data.js +0 -139
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/functionYaml/template.ejs +0 -18
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/handler/data.js +0 -63
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/mainFunction/data.js +0 -63
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/mainFunction/template.ejs +0 -262
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/queue/data.js +0 -63
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/queue/template.ejs +0 -45
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/functionYaml/data.js +0 -146
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/functionYaml/template.ejs +0 -14
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/handler/data.js +0 -64
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/mainFunction/data.js +0 -59
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +0 -173
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/sqs/data.js +0 -67
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/sqs/template.ejs +0 -53
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/functionYml/HdrS3/data.js +0 -140
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/functionYml/HdrS3/template.ejs +0 -25
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/handler/handlerS3/data.js +0 -49
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/handler/handlerS3/template.ejs +0 -50
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/mainFunction/ProcessCsvtemplate.ejs +0 -182
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/mainFunction/data.js +0 -49
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/mainFunction/template.ejs +0 -66
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/queue/data.js +0 -77
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/queue/dsqTemplatePath.ejs +0 -32
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/queue/s3Template.ejs +0 -59
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/relate/S3/data.js +0 -61
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/relate/S3/template.ejs +0 -13
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/relate/sns-out/data.js +0 -70
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/websocket/dynamoDb/ReservedTableData.js +0 -69
- package/src/codeGenerators/app/src/generatedCode/Flow/SystemFlowDescriptorBuilder.js +0 -151
- /package/src/codeGenerators/app/{src/generatedCode/FindData → sls_yaml}/templates/FindData_Yaml.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared/endpoint → FlowEndpoints/templates}/FlowEndpointBeforeLogical_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowEndpoint_HdrWbs.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowEndpoint_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowEntryPoint_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowMain_Wbs.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/confirmReserved/handler/template.ejs → s3/ConfirmReserved_HdrSqs.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/createObject/handler/template.ejs → s3/CreateObject_HdrWbs.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/preSignUrl/createPreSignUrl/handler/template.ejs → s3/CreatePreSignUrl_HdrSqs.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/preSignUrl/reservedLimit/handler/template.ejs → s3/ReservedLimit_HdrSqs.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/FlowEndpointComplete_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/FlowStep_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_ByConfig_Awaiting_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_ByConfig_Paginated_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_PlugIn_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_RecievePlugIn_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/templateAwaitingStep.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/templateSendPlugin.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/eventBridge.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/extTopic.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/lambdaSyncApi.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/lambdaSyncInv.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/ownTopic.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/registry.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/handlers/FlowHandler_HdrApi.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/handlers/FlowHandler_HdrInv.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/handlers/FlowHandler_HdrSqs.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/eventTypes.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowClassifier.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowNaming.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowSelection.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowStepNormalizer.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowValidator.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/registry.js +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/CheckTriggerCache_HdrSqs.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/CheckTriggerCache_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/ProcessTriggerCache_HdrSqs.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/ProcessTriggerCache_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheComplete_HdrDsq.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheComplete_HdrSqs.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheComplete_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheQueue_Yaml.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/yaml/SharedFunctionSqs_Yaml.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{PaginateProcessLogical_HdrSqs.js → PaginateProcessLogical_HdrSqs.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{PaginateProcessLogical_Main.js → PaginateProcessLogical_Main.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{ProcessLogical_HdrSqs.js → ProcessLogical_HdrSqs.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{ProcessLogical_Main.js → ProcessLogical_Main.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/libs/templates/{Consts.js → Consts.ejs} +0 -0
- /package/src/codeGenerators/app/src/generatedCode/libs/templates/{GenerateCodeLibs.js → GenerateCodeLibs.ejs} +0 -0
|
@@ -2,10 +2,16 @@ import path from 'path';
|
|
|
2
2
|
import fs from 'fs/promises';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import ejs from 'ejs';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { processFunctionName, processMainFileName, upperFirst } from '../_shared/shared/flowNaming.js';
|
|
6
|
+
|
|
7
|
+
const RELATIONSHIP_ACTIONS = [
|
|
8
|
+
'CreateRelationship',
|
|
9
|
+
'UpdateRelationship',
|
|
10
|
+
'DeleteRelationship',
|
|
11
|
+
'GetRelationship',
|
|
12
|
+
'ChangeRelationship',
|
|
13
|
+
'MoveRelationship'
|
|
14
|
+
];
|
|
9
15
|
|
|
10
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
17
|
const __dirname = path.dirname(__filename);
|
|
@@ -18,22 +24,19 @@ export async function generateRelationshipFlows(allSchemas, options) {
|
|
|
18
24
|
|
|
19
25
|
// Read standard handler templates for reuse
|
|
20
26
|
const templates = {
|
|
21
|
-
sqs: await fs.readFile(path.join(templateDir, 'FlowHandler_HdrSqs.ejs'), 'utf-8'),
|
|
22
|
-
api: await fs.readFile(path.join(templateDir, 'FlowHandler_HdrApi.ejs'), 'utf-8'),
|
|
23
|
-
inv: await fs.readFile(path.join(templateDir, 'FlowHandler_HdrInv.ejs'), 'utf-8')
|
|
27
|
+
sqs: await fs.readFile(path.join(templateDir, '..', '..', '_shared', 'handlers', 'FlowHandler_HdrSqs.ejs'), 'utf-8'),
|
|
28
|
+
api: await fs.readFile(path.join(templateDir, '..', '..', '_shared', 'handlers', 'FlowHandler_HdrApi.ejs'), 'utf-8'),
|
|
29
|
+
inv: await fs.readFile(path.join(templateDir, '..', '..', '_shared', 'handlers', 'FlowHandler_HdrInv.ejs'), 'utf-8')
|
|
24
30
|
};
|
|
25
31
|
|
|
26
32
|
let generatedCount = 0;
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
if (!allSchemas.relationships || allSchemas.relationships.length === 0) return;
|
|
29
35
|
|
|
30
|
-
for (const
|
|
31
|
-
const flowTag = flow.flowTag;
|
|
36
|
+
for (const flowTag of RELATIONSHIP_ACTIONS) {
|
|
32
37
|
const upperFlowTag = upperFirst(flowTag);
|
|
33
38
|
const processFunction = processFunctionName(flowTag);
|
|
34
39
|
|
|
35
|
-
if (!isRelationshipFlow(flowTag)) continue;
|
|
36
|
-
|
|
37
40
|
const flowOutputDir = path.join(baseOutputDir, 'FlowRelationshipEndpoints', upperFlowTag, 'source');
|
|
38
41
|
await fs.mkdir(flowOutputDir, { recursive: true });
|
|
39
42
|
|
|
@@ -53,8 +56,9 @@ export async function generateRelationshipFlows(allSchemas, options) {
|
|
|
53
56
|
console.warn(` [RelationshipFlowGenerator] Warning: Action template not found for ${flowTag}. Skipping.`);
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
// 2. Generate Action Step Handlers (based on
|
|
57
|
-
|
|
59
|
+
// 2. Generate Action Step Handlers (based on fixed event ['ownTopic'])
|
|
60
|
+
const events = ['ownTopic'];
|
|
61
|
+
for (const event of events) {
|
|
58
62
|
let handlerFileName, handlerContent, handlerFunctionName;
|
|
59
63
|
if (event === 'ownTopic' || event === 'extTopic') {
|
|
60
64
|
handlerFunctionName = `${processFunction}_HdrSqs`;
|
|
@@ -90,8 +94,8 @@ export async function generateRelationshipFlows(allSchemas, options) {
|
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
96
|
|
|
93
|
-
// 3. Generate Complete Step (
|
|
94
|
-
if (
|
|
97
|
+
// 3. Generate Complete Step (Always generated for Relationship flows)
|
|
98
|
+
if (true) {
|
|
95
99
|
const completeFunction = `${processFunction}Complete`;
|
|
96
100
|
const completeFileName = `${completeFunction}_Main`;
|
|
97
101
|
const completeTemplatePath = path.join(templateDir, 'relationship', `${completeFileName}.ejs`);
|
|
@@ -17,14 +17,7 @@ function lowerCase(str) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function shortNameHandler(handlerType) {
|
|
20
|
-
|
|
21
|
-
const map = {
|
|
22
|
-
'HdrSqs': 'Sqs',
|
|
23
|
-
'HdrApi': 'Api',
|
|
24
|
-
'HdrWbs': 'Wbs',
|
|
25
|
-
'HdrDsq': 'Dsq'
|
|
26
|
-
};
|
|
27
|
-
return map[handlerType] || handlerType;
|
|
20
|
+
return handlerType;
|
|
28
21
|
}
|
|
29
22
|
|
|
30
23
|
export async function generateStatusField(flowSchema, appPath, outputBaseDir) {
|
|
@@ -38,7 +31,7 @@ export async function generateStatusField(flowSchema, appPath, outputBaseDir) {
|
|
|
38
31
|
const templatesDir = path.join(__dirname, 'templates', 'statusField');
|
|
39
32
|
const mainTpl = await fs.readFile(path.join(templatesDir, 'CompleteStatusField_Main.ejs'), 'utf-8');
|
|
40
33
|
const handlerTpl = await fs.readFile(path.join(templatesDir, 'CompleteStatusField_HdrSqs.ejs'), 'utf-8');
|
|
41
|
-
const yamlTpl = await fs.readFile(path.join(__dirname, '..', '
|
|
34
|
+
const yamlTpl = await fs.readFile(path.join(__dirname, '..', '_shared', 'yaml', 'SharedFunctionSqs_Yaml.ejs'), 'utf-8');
|
|
42
35
|
const snsTpl = await fs.readFile(path.join(templatesDir, 'CompleteStatusFieldSns_Yaml.ejs'), 'utf-8');
|
|
43
36
|
|
|
44
37
|
// Shared variables
|
|
@@ -12,13 +12,7 @@ function upperCase(str) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function shortNameHandler(handlerType) {
|
|
15
|
-
|
|
16
|
-
'HdrSqs': 'Sqs',
|
|
17
|
-
'HdrApi': 'Api',
|
|
18
|
-
'HdrWbs': 'Wbs',
|
|
19
|
-
'HdrDsq': 'Dsq'
|
|
20
|
-
};
|
|
21
|
-
return map[handlerType] || handlerType;
|
|
15
|
+
return handlerType;
|
|
22
16
|
}
|
|
23
17
|
|
|
24
18
|
export async function generateWebSocket(allLocalFlowSchemas, appPath, outputBaseDir) {
|
package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/BaseSqsHandler.js
RENAMED
|
@@ -14,9 +14,9 @@ export async function generateSqsHandler(flow, stepName, suffix, flowOutputDir,
|
|
|
14
14
|
// For steps: ${flowTag}${flowStepName} (e.g. OwnTopicFlowProcess)
|
|
15
15
|
const functionName = stepName ? `${flowTag}${stepName}` : `Process${upperCase(flowTag)}`;
|
|
16
16
|
|
|
17
|
-
// Queue name:
|
|
18
|
-
//
|
|
19
|
-
const queueNameSuffix = suffix
|
|
17
|
+
// Queue name: keep the full handler suffix so handler code matches
|
|
18
|
+
// the generated queue/resource names.
|
|
19
|
+
const queueNameSuffix = suffix;
|
|
20
20
|
let queueName = '';
|
|
21
21
|
if (stepName) {
|
|
22
22
|
queueName = `${flowTag}${stepName}${queueNameSuffix}`;
|
|
@@ -15,12 +15,10 @@ export default async function generateConfirmAfterUploadS3(flow, flowOutputDir)
|
|
|
15
15
|
const handlerFileName = `${functionName}_${handlerType}`;
|
|
16
16
|
|
|
17
17
|
const mainTemplatePath = path.join(
|
|
18
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', '
|
|
19
|
-
'upload', 'confirmReserved', 'mainFunction', 'template.ejs'
|
|
18
|
+
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'ConfirmReserved_Main.ejs'
|
|
20
19
|
);
|
|
21
20
|
const handlerTemplatePath = path.join(
|
|
22
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', '
|
|
23
|
-
'upload', 'confirmReserved', 'handler', 'template.ejs'
|
|
21
|
+
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'ConfirmReserved_HdrSqs.ejs'
|
|
24
22
|
);
|
|
25
23
|
|
|
26
24
|
let mainTemplateStr, handlerTemplateStr;
|
|
@@ -16,12 +16,10 @@ export default async function generateCreateObject(flow, flowOutputDir) {
|
|
|
16
16
|
const handlerFileName = `${functionName}_${handlerType}`;
|
|
17
17
|
|
|
18
18
|
const mainTemplatePath = path.join(
|
|
19
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', '
|
|
20
|
-
'upload', 'createObject', 'mainFunction', 'template.ejs'
|
|
19
|
+
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'CreateObject_Main.ejs'
|
|
21
20
|
);
|
|
22
21
|
const handlerTemplatePath = path.join(
|
|
23
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', '
|
|
24
|
-
'upload', 'createObject', 'handler', 'template.ejs'
|
|
22
|
+
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'CreateObject_HdrWbs.ejs'
|
|
25
23
|
);
|
|
26
24
|
|
|
27
25
|
let mainTemplateStr, handlerTemplateStr;
|
|
@@ -15,12 +15,10 @@ export default async function generateCreatePreSignUrl(flow, flowOutputDir) {
|
|
|
15
15
|
const handlerFileName = `${functionName}_${handlerType}`;
|
|
16
16
|
|
|
17
17
|
const mainTemplatePath = path.join(
|
|
18
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', '
|
|
19
|
-
'upload', 'preSignUrl', 'createPreSignUrl', 'mainFunction', 'template.ejs'
|
|
18
|
+
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'CreatePreSignUrl_Main.ejs'
|
|
20
19
|
);
|
|
21
20
|
const handlerTemplatePath = path.join(
|
|
22
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', '
|
|
23
|
-
'upload', 'preSignUrl', 'createPreSignUrl', 'handler', 'template.ejs'
|
|
21
|
+
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'CreatePreSignUrl_HdrSqs.ejs'
|
|
24
22
|
);
|
|
25
23
|
|
|
26
24
|
let mainTemplateStr, handlerTemplateStr;
|
|
@@ -15,12 +15,10 @@ export default async function generateProcessAfterUploadS3(flow, flowOutputDir)
|
|
|
15
15
|
const handlerFileName = `${functionName}_${handlerType}`;
|
|
16
16
|
|
|
17
17
|
const mainTemplatePath = path.join(
|
|
18
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', '
|
|
19
|
-
'upload', 'processFile', 'mainFunction', 'template.ejs'
|
|
18
|
+
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'ProcessS3File_Main.ejs'
|
|
20
19
|
);
|
|
21
20
|
const handlerTemplatePath = path.join(
|
|
22
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', '
|
|
23
|
-
'upload', 'processFile', 'handler', 'handlerS3', 'template.ejs'
|
|
21
|
+
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'FlowHandler_HdrS3.ejs'
|
|
24
22
|
);
|
|
25
23
|
|
|
26
24
|
let mainTemplateStr, handlerTemplateStr;
|
|
@@ -37,8 +35,10 @@ export default async function generateProcessAfterUploadS3(flow, flowOutputDir)
|
|
|
37
35
|
});
|
|
38
36
|
|
|
39
37
|
const handlerContent = ejs.render(handlerTemplateStr, {
|
|
38
|
+
flowTag: flow.flowTag,
|
|
40
39
|
functionName: functionName,
|
|
41
|
-
|
|
40
|
+
mainFileName,
|
|
41
|
+
s3Bucket: flow.bucketName || ''
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
const targetMainPath = path.join(flowOutputDir, `${mainFileName}.js`);
|
|
@@ -15,12 +15,10 @@ export default async function generateReservedLimit(flow, flowOutputDir) {
|
|
|
15
15
|
const handlerFileName = `${functionName}_${handlerType}`;
|
|
16
16
|
|
|
17
17
|
const mainTemplatePath = path.join(
|
|
18
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', '
|
|
19
|
-
'upload', 'preSignUrl', 'reservedLimit', 'mainFunction', 'template.ejs'
|
|
18
|
+
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'ReservedLimit_Main.ejs'
|
|
20
19
|
);
|
|
21
20
|
const handlerTemplatePath = path.join(
|
|
22
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', '
|
|
23
|
-
'upload', 'preSignUrl', 'reservedLimit', 'handler', 'template.ejs'
|
|
21
|
+
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'ReservedLimit_HdrSqs.ejs'
|
|
24
22
|
);
|
|
25
23
|
|
|
26
24
|
let mainTemplateStr, handlerTemplateStr;
|
|
@@ -17,12 +17,12 @@ export async function generateFlowEntryPoint(allSchemas, options) {
|
|
|
17
17
|
const baseOutputDir = path.join(options.outputPath, 'app', 'src', 'generatedCode');
|
|
18
18
|
|
|
19
19
|
const templates = {
|
|
20
|
-
sqs: await fs.readFile(path.join(__dirname, '..', '
|
|
21
|
-
api: await fs.readFile(path.join(__dirname, '..', '
|
|
22
|
-
inv: await fs.readFile(path.join(__dirname, '..', '
|
|
23
|
-
endpointMain: await fs.readFile(path.join(__dirname, '..', '
|
|
24
|
-
wbsMain: await fs.readFile(path.join(__dirname, '..', '
|
|
25
|
-
endpointHdrWbs: await fs.readFile(path.join(__dirname, '..', '
|
|
20
|
+
sqs: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrSqs.ejs'), 'utf-8'),
|
|
21
|
+
api: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrApi.ejs'), 'utf-8'),
|
|
22
|
+
inv: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrInv.ejs'), 'utf-8'),
|
|
23
|
+
endpointMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint', 'FlowEndpoint_Main.ejs'), 'utf-8'),
|
|
24
|
+
wbsMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint', 'FlowMain_Wbs.ejs'), 'utf-8'),
|
|
25
|
+
endpointHdrWbs: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint', 'FlowEndpoint_HdrWbs.ejs'), 'utf-8')
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
let generatedCount = 0;
|
|
@@ -62,7 +62,7 @@ export async function generateFlowMainFunction(allSchemas, options) {
|
|
|
62
62
|
// shared endpoint templates (FlowEndpoint_Main, FlowMain_Wbs) live under _internal/_shared/endpoint
|
|
63
63
|
const templateBaseDir = templateName.startsWith('crud/') || ['CreateEndpoint_Main.ejs', 'UpdateEndpoint_Main.ejs', 'DeleteEndpoint_Main.ejs', 'GetEndpoint_Main.ejs'].includes(templateName)
|
|
64
64
|
? path.join(__dirname, '..', '..', 'FlowEndpoints', 'templates', 'crud')
|
|
65
|
-
: path.join(__dirname, '..', '
|
|
65
|
+
: path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint');
|
|
66
66
|
const mainTemplateStr = await fs.readFile(
|
|
67
67
|
path.join(templateBaseDir, templateName),
|
|
68
68
|
'utf-8'
|
|
@@ -109,7 +109,7 @@ export async function generateFlowMainFunction(allSchemas, options) {
|
|
|
109
109
|
// For ownTopic flows: also generate Process${FlowTag}_Main.js (simple endpoint, triggered from SQS)
|
|
110
110
|
if (isOwnTopic) {
|
|
111
111
|
const processMainTemplateStr = await fs.readFile(
|
|
112
|
-
path.join(__dirname, '..', '
|
|
112
|
+
path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint', 'FlowEndpoint_Main.ejs'),
|
|
113
113
|
'utf-8'
|
|
114
114
|
);
|
|
115
115
|
const processMainContent = ejs.render(processMainTemplateStr, {
|
|
@@ -130,7 +130,7 @@ export async function generateFlowMainFunction(allSchemas, options) {
|
|
|
130
130
|
const beforeLogicalConfigs = generateCode.filter(c => c.codeHookTag === 'beforeLogical');
|
|
131
131
|
if (isCrud && beforeLogicalConfigs.length > 0) {
|
|
132
132
|
const beforeLogicalTemplateStr = await fs.readFile(
|
|
133
|
-
path.join(__dirname, '..', '
|
|
133
|
+
path.join(__dirname, '..', '..', 'FlowEndpoints', 'templates', 'FlowEndpointBeforeLogical_Main.ejs'),
|
|
134
134
|
'utf-8'
|
|
135
135
|
);
|
|
136
136
|
|
package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowStepBase.js
RENAMED
|
@@ -17,19 +17,19 @@ export async function generateFlowSteps(allSchemas, options) {
|
|
|
17
17
|
|
|
18
18
|
// Read templates
|
|
19
19
|
const templates = {
|
|
20
|
-
main: await fs.readFile(path.join(__dirname, '..', '
|
|
21
|
-
complete: await fs.readFile(path.join(__dirname, '..', '
|
|
22
|
-
sqs: await fs.readFile(path.join(__dirname, '..', '
|
|
23
|
-
api: await fs.readFile(path.join(__dirname, '..', '
|
|
24
|
-
inv: await fs.readFile(path.join(__dirname, '..', '
|
|
20
|
+
main: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'FlowStep_Main.ejs'), 'utf-8'),
|
|
21
|
+
complete: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'FlowEndpointComplete_Main.ejs'), 'utf-8'),
|
|
22
|
+
sqs: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrSqs.ejs'), 'utf-8'),
|
|
23
|
+
api: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrApi.ejs'), 'utf-8'),
|
|
24
|
+
inv: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrInv.ejs'), 'utf-8'),
|
|
25
25
|
|
|
26
26
|
// Advanced Custom Flow Logic Templates
|
|
27
|
-
pluginMain: await fs.readFile(path.join(__dirname, '..', '
|
|
28
|
-
recievePluginMain: await fs.readFile(path.join(__dirname, '..', '
|
|
29
|
-
byConfigAwaitingMain: await fs.readFile(path.join(__dirname, '..', '
|
|
30
|
-
byConfigPaginatedMain: await fs.readFile(path.join(__dirname, '..', '
|
|
31
|
-
templateAwaitingStep: path.join(__dirname, '..', '
|
|
32
|
-
templateSendPlugin: path.join(__dirname, '..', '
|
|
27
|
+
pluginMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'plugIns', 'FlowStep_PlugIn_Main.ejs'), 'utf-8').catch(() => ''),
|
|
28
|
+
recievePluginMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'plugIns', 'FlowStep_RecievePlugIn_Main.ejs'), 'utf-8').catch(() => ''),
|
|
29
|
+
byConfigAwaitingMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'plugIns', 'FlowStep_ByConfig_Awaiting_Main.ejs'), 'utf-8').catch(() => ''),
|
|
30
|
+
byConfigPaginatedMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'plugIns', 'FlowStep_ByConfig_Paginated_Main.ejs'), 'utf-8').catch(() => ''),
|
|
31
|
+
templateAwaitingStep: path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'plugIns', 'templateAwaitingStep.ejs'),
|
|
32
|
+
templateSendPlugin: path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'plugIns', 'templateSendPlugin.ejs')
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
let generatedCount = 0;
|
|
@@ -13,13 +13,7 @@ function upperCase(str) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function shortNameHandler(handlerType) {
|
|
16
|
-
|
|
17
|
-
'HdrSqs': 'Sqs',
|
|
18
|
-
'HdrApi': 'Api',
|
|
19
|
-
'HdrWbs': 'Wbs',
|
|
20
|
-
'HdrDsq': 'Dsq'
|
|
21
|
-
};
|
|
22
|
-
return map[handlerType] || handlerType;
|
|
16
|
+
return handlerType;
|
|
23
17
|
}
|
|
24
18
|
|
|
25
19
|
export async function generateTriggerCache(flowSchema, appPath, outputBaseDir) {
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
|
+
import { writeRenderedTemplate } from '../../../../../core/renderTemplateFile.js';
|
|
4
5
|
|
|
5
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
7
|
const __dirname = path.dirname(__filename);
|
|
7
8
|
|
|
8
9
|
export async function generateProcessLogical(options) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const outputDir = path.join(options.outputPath, 'app', 'src', 'generatedCode', 'ProcessLogical', 'source');
|
|
12
|
-
await fs.mkdir(outputDir, { recursive: true });
|
|
10
|
+
console.log(' [ProcessLogicalGenerator] Generating ProcessLogical flows...');
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const outputDir = path.join(options.outputPath, 'app', 'src', 'generatedCode', 'ProcessLogical', 'source');
|
|
13
|
+
const templatesDir = path.join(__dirname, 'templates');
|
|
14
|
+
const files = await fs.readdir(templatesDir);
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
let count = 0;
|
|
17
|
+
for (const file of files) {
|
|
18
|
+
if (!file.endsWith('.ejs')) continue;
|
|
19
|
+
|
|
20
|
+
await writeRenderedTemplate(
|
|
21
|
+
path.join(templatesDir, file),
|
|
22
|
+
path.join(outputDir, file.replace(/\.ejs$/, '.js')),
|
|
23
|
+
{}
|
|
24
|
+
);
|
|
25
|
+
count++;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
console.log(` [ProcessLogicalGenerator] Wrote ${count} ProcessLogical files.`);
|
|
26
29
|
}
|