@izara_project/izara-core-generate-service-code 1.0.56 → 1.0.57
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 -1
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRelationships/RelationshipFlowGenerator.js +18 -2
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessCreateRelationship_Main.ejs +1 -1
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/WebSocketGenerator.js +4 -4
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowValidator.js +1 -1
- package/src/codeGenerators/resource/sls_yaml/FlowOutGenerator.js +0 -1
- package/src/codeGenerators/resource/sls_yaml/FlowResourceYamlGenerator.js +5 -2
- package/src/generateCode.js +8 -5
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/RelationshipFlowSchemaGenerator.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-core-generate-service-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"description": "Code for locally generating per service files",
|
|
5
5
|
"homepage": "https://bitbucket.org/izara-core-support-services/izara-core-support-services-generate-service-code#readme",
|
|
6
6
|
"repository": {
|
package/src/codeGenerators/app/src/generatedCode/Flow/FlowRelationships/RelationshipFlowGenerator.js
CHANGED
|
@@ -56,8 +56,13 @@ export async function generateRelationshipFlows(allSchemas, options) {
|
|
|
56
56
|
console.warn(` [RelationshipFlowGenerator] Warning: Action template not found for ${flowTag}. Skipping.`);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
// 2. Generate Action Step Handlers
|
|
60
|
-
const
|
|
59
|
+
// 2. Generate Action Step Handlers
|
|
60
|
+
const flowSchema = allSchemas.flows?.find(f => f.flowTag === flowTag);
|
|
61
|
+
let events = ['ownTopic'];
|
|
62
|
+
if (flowSchema && flowSchema.event) {
|
|
63
|
+
events = Array.isArray(flowSchema.event) ? flowSchema.event : [flowSchema.event];
|
|
64
|
+
}
|
|
65
|
+
|
|
61
66
|
for (const event of events) {
|
|
62
67
|
let handlerFileName, handlerContent, handlerFunctionName;
|
|
63
68
|
if (event === 'ownTopic' || event === 'extTopic') {
|
|
@@ -91,6 +96,17 @@ export async function generateRelationshipFlows(allSchemas, options) {
|
|
|
91
96
|
});
|
|
92
97
|
await fs.writeFile(path.join(flowOutputDir, `${handlerFunctionName}.js`), handlerContent, 'utf-8');
|
|
93
98
|
generatedCount++;
|
|
99
|
+
} else if (event === 'dsq') {
|
|
100
|
+
handlerFunctionName = `${processFunction}_HdrDsq`;
|
|
101
|
+
handlerContent = ejs.render(templates.sqs, {
|
|
102
|
+
flowTag: flowTag,
|
|
103
|
+
flowStepName: '',
|
|
104
|
+
mainFileName: actionFileName,
|
|
105
|
+
functionName: processFunction,
|
|
106
|
+
queueName: `${processFunction}HdrDsq`
|
|
107
|
+
});
|
|
108
|
+
await fs.writeFile(path.join(flowOutputDir, `${handlerFunctionName}.js`), handlerContent, 'utf-8');
|
|
109
|
+
generatedCount++;
|
|
94
110
|
}
|
|
95
111
|
}
|
|
96
112
|
|
|
@@ -22,7 +22,7 @@ export async function generateWebSocket(allLocalFlowSchemas, appPath, outputBase
|
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
console.log(' [WebSocketGenerator] Generated WebSocket files with
|
|
25
|
+
console.log(' [WebSocketGenerator] Generated WebSocket files with WebSocketComplete_Main convention.');
|
|
26
26
|
const templatesDir = path.join(__dirname, 'templates', 'webSocket');
|
|
27
27
|
const wsDir = path.join(outputBaseDir, 'app', 'src', 'generatedCode', 'SystemFlowSchemas', 'WebSocketMain', 'source');
|
|
28
28
|
await fs.mkdir(wsDir, { recursive: true });
|
|
@@ -79,8 +79,8 @@ export async function generateWebSocket(allLocalFlowSchemas, appPath, outputBase
|
|
|
79
79
|
upperFunctionName: upperCase(wsConnectName)
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
-
// 3.
|
|
83
|
-
const processFunctionName = '
|
|
82
|
+
// 3. WebSocketComplete
|
|
83
|
+
const processFunctionName = 'WebSocketComplete';
|
|
84
84
|
const processHandlerType = 'HdrSqs';
|
|
85
85
|
const queueName = processFunctionName + shortNameHandler(processHandlerType);
|
|
86
86
|
|
|
@@ -114,5 +114,5 @@ export async function generateWebSocket(allLocalFlowSchemas, appPath, outputBase
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
console.log(` [WebSocketGenerator] Generated WebSocket files with
|
|
117
|
+
console.log(` [WebSocketGenerator] Generated WebSocket files with WebSocketComplete_Main convention.`);
|
|
118
118
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const ALLOWED_MAIN_EVENTS = ['ownTopic', 'extTopic', 'lambdaSyncInv', 'lambdaSyncApi', 'eventBridge', 's3'];
|
|
1
|
+
const ALLOWED_MAIN_EVENTS = ['ownTopic', 'extTopic', 'lambdaSyncInv', 'lambdaSyncApi', 'eventBridge', 's3', 'dsq'];
|
|
2
2
|
const MAIN_ASYNC_EVENTS = ['ownTopic', 'extTopic', 's3'];
|
|
3
3
|
const ALLOWED_STEP_EVENTS = ['sqs', 'ownTopic', 'extTopic', 'dsq', 'lambdaSyncInv', 'lambdaSyncApi'];
|
|
4
4
|
const RESERVED_SYSTEM_FLOW_TAGS = new Set([
|
|
@@ -127,7 +127,6 @@ export async function generateFlowResourceYaml(allSchemas, options) {
|
|
|
127
127
|
|
|
128
128
|
const systemOwnTopicFlows = [
|
|
129
129
|
'ProcessLogical',
|
|
130
|
-
'PaginateProcessLogical',
|
|
131
130
|
'FindData',
|
|
132
131
|
'Create',
|
|
133
132
|
'Update',
|
|
@@ -135,6 +134,7 @@ export async function generateFlowResourceYaml(allSchemas, options) {
|
|
|
135
134
|
'CreateRelationship',
|
|
136
135
|
'UpdateRelationship',
|
|
137
136
|
'DeleteRelationship',
|
|
137
|
+
'GetRelationship',
|
|
138
138
|
'ChangeRelationship',
|
|
139
139
|
'MoveRelationship',
|
|
140
140
|
'CreateTargetRole',
|
|
@@ -163,14 +163,17 @@ export async function generateFlowResourceYaml(allSchemas, options) {
|
|
|
163
163
|
await appendUnique(queueName, resourceSqsYamlTpl, { queueName });
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
// ponytail: add Dsq queue for PaginateProcessLogical
|
|
167
|
+
await appendUnique('PaginateProcessLogicalHdrDsq', resourceSqsYamlTpl, { queueName: 'PaginateProcessLogicalHdrDsq' });
|
|
168
|
+
|
|
166
169
|
const systemQueues = [
|
|
167
170
|
'Register',
|
|
168
171
|
'WebSocket',
|
|
172
|
+
'PaginateProcessLogical',
|
|
169
173
|
'CreateComplete',
|
|
170
174
|
'UpdateComplete',
|
|
171
175
|
'DeleteComplete',
|
|
172
176
|
'GetComplete',
|
|
173
|
-
'GetRelationship',
|
|
174
177
|
'CreateRelationshipComplete',
|
|
175
178
|
'UpdateRelationshipComplete',
|
|
176
179
|
'DeleteRelationshipComplete',
|
package/src/generateCode.js
CHANGED
|
@@ -130,9 +130,11 @@ export async function generateCode(rootPath, options = {}) {
|
|
|
130
130
|
);
|
|
131
131
|
collectHookBackups(outputPath);
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
// ponytail: ensure hooks are restored even if generation fails
|
|
134
|
+
try {
|
|
135
|
+
console.log(
|
|
136
|
+
'[INFO] [generateCode] STATUS=CLEANUP | Removing old generatedCode directories...'
|
|
137
|
+
);
|
|
136
138
|
await fs.promises.rm(generatedCodePath, {
|
|
137
139
|
recursive: true,
|
|
138
140
|
force: true
|
|
@@ -258,8 +260,9 @@ export async function generateCode(rootPath, options = {}) {
|
|
|
258
260
|
}
|
|
259
261
|
}
|
|
260
262
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
+
} finally {
|
|
264
|
+
// Restore backed-up hooks
|
|
265
|
+
if (hookDirs.size > 0 || hookBackups.length > 0) {
|
|
263
266
|
console.log(
|
|
264
267
|
`[INFO] [generateCode] STATUS=RESTORE | Restoring ${hookBackups.length} hook files...`
|
|
265
268
|
);
|
|
@@ -65,8 +65,8 @@ export async function generateRelationshipFlowSchemas(
|
|
|
65
65
|
let outputTopic = true;
|
|
66
66
|
let hasCompleteStep = true;
|
|
67
67
|
|
|
68
|
-
if (action === '
|
|
69
|
-
events = "['lambdaSyncInv', 'lambdaSyncApi']";
|
|
68
|
+
if (action === 'GetRelationship') {
|
|
69
|
+
events = "['lambdaSyncInv', 'lambdaSyncApi', 'dsq', 'ownTopic']";
|
|
70
70
|
outputTopic = false;
|
|
71
71
|
hasCompleteStep = false;
|
|
72
72
|
}
|