@izara_project/izara-core-generate-service-code 1.0.80 → 1.0.81
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
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.81",
|
|
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": {
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"@izara_project/izara-shared-core": "^1.0.13",
|
|
27
27
|
"ejs": "^6.0.1",
|
|
28
28
|
"js-beautify": "^2.0.3",
|
|
29
|
-
"ws": "^8.21.
|
|
29
|
+
"ws": "^8.21.3",
|
|
30
30
|
"yaml": "^2.9.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@izara_project/izara-core-library-logger": "^1.0.11",
|
|
34
|
-
"@izara_project/izara-core-library-service-schemas": "1.0.
|
|
35
|
-
"@izara_project/izara-shared-service-schemas": "^1.0.
|
|
34
|
+
"@izara_project/izara-core-library-service-schemas": "1.0.162",
|
|
35
|
+
"@izara_project/izara-shared-service-schemas": "^1.0.71",
|
|
36
36
|
"jest": "^30.4.2",
|
|
37
37
|
"prettier": "^3.9.6",
|
|
38
38
|
"prettier-plugin-ejs": "^1.0.3"
|
|
@@ -146,6 +146,32 @@ const tableConfigs = {
|
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
148
|
|
|
149
|
+
const stepSubs = [];
|
|
150
|
+
const seenStepSubs = new Set();
|
|
151
|
+
(flows || []).forEach(function(flow) {
|
|
152
|
+
const flowTag = flow?.flowTag ? flow.flowTag[0].toUpperCase() + flow.flowTag.slice(1) : '';
|
|
153
|
+
(flow?.flowSteps || []).forEach(function(step) {
|
|
154
|
+
if (Array.isArray(step?.previousSteps)) {
|
|
155
|
+
const stepName = step?.stepName ? step.stepName[0].toUpperCase() + step.stepName.slice(1) : '';
|
|
156
|
+
const functionName = stepName.startsWith(flowTag) ? stepName : `${flowTag}${stepName}`;
|
|
157
|
+
const queueName = `${functionName}HdrSqs`;
|
|
158
|
+
step.previousSteps.forEach(function(prev) {
|
|
159
|
+
if (prev && prev.sourceType === 'extTopic' && prev.serviceTag && prev.topicName) {
|
|
160
|
+
const key = `${prev.serviceTag}:${prev.topicName}:${queueName}`;
|
|
161
|
+
if (!seenStepSubs.has(key)) {
|
|
162
|
+
seenStepSubs.add(key);
|
|
163
|
+
stepSubs.push({
|
|
164
|
+
serviceTag: prev.serviceTag,
|
|
165
|
+
topicName: prev.topicName,
|
|
166
|
+
sqsEndpoint: queueName
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
149
175
|
const rbacSubs = [];
|
|
150
176
|
if (crud && typeof rbacValidatorServiceTags !== 'undefined' && rbacValidatorServiceTags && rbacValidatorServiceTags.length > 0) {
|
|
151
177
|
const allRbacTags = Array.from(new Set(['Rbac', ...rbacValidatorServiceTags]));
|
|
@@ -200,6 +226,19 @@ const snsTopicSubscriptions = [
|
|
|
200
226
|
},
|
|
201
227
|
<% }); -%>
|
|
202
228
|
<% } -%>
|
|
229
|
+
<% if (stepSubs.length > 0) { -%>
|
|
230
|
+
|
|
231
|
+
// ------------------------------------------------------------
|
|
232
|
+
// Step Subscriptions (from previousSteps)
|
|
233
|
+
// ------------------------------------------------------------
|
|
234
|
+
<% stepSubs.forEach(function(sub, idx) { -%>
|
|
235
|
+
{
|
|
236
|
+
serviceTag: '<%= sub.serviceTag %>',
|
|
237
|
+
topicName: '<%= sub.topicName %>',
|
|
238
|
+
sqsEndpoint: '<%= sub.sqsEndpoint %>'
|
|
239
|
+
},
|
|
240
|
+
<% }); -%>
|
|
241
|
+
<% } -%>
|
|
203
242
|
<% if (rbacSubs.length > 0) { -%>
|
|
204
243
|
|
|
205
244
|
// ------------------------------------------------------------
|
|
@@ -1110,3 +1110,60 @@ test('renders multi-type array for mixed property and messageAttribute type in h
|
|
|
1110
1110
|
/Value:\s*\{\s*type:\s*\['string',\s*'number',\s*'integer',\s*'boolean',\s*'null',\s*'object',\s*'array'\]/
|
|
1111
1111
|
);
|
|
1112
1112
|
});
|
|
1113
|
+
|
|
1114
|
+
test('renders previousSteps extTopic subscriptions in InitialSetupConfig', async () => {
|
|
1115
|
+
const rootPath = await mkdtemp(
|
|
1116
|
+
join(tmpdir(), 'generate-service-code-v2-prevsteps-')
|
|
1117
|
+
);
|
|
1118
|
+
roots.add(rootPath);
|
|
1119
|
+
const schemas = join(rootPath, 'app/src/schemas/FlowSchemas');
|
|
1120
|
+
await mkdir(schemas, { recursive: true });
|
|
1121
|
+
await writeFile(
|
|
1122
|
+
join(schemas, 'Order.js'),
|
|
1123
|
+
`export default [
|
|
1124
|
+
{
|
|
1125
|
+
flowTag: 'order',
|
|
1126
|
+
event: ['ownTopic'],
|
|
1127
|
+
flowSteps: [
|
|
1128
|
+
{
|
|
1129
|
+
stepName: 'Start'
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
stepName: 'BuildOrderSellOfferLinkAndReserveOrderData',
|
|
1133
|
+
properties: ['returnValue', 'parentFlowId', 'status'],
|
|
1134
|
+
messageAttributes: [],
|
|
1135
|
+
event: ['extTopic'],
|
|
1136
|
+
previousSteps: [
|
|
1137
|
+
{
|
|
1138
|
+
sourceType: 'extTopic',
|
|
1139
|
+
serviceTag: 'GraphHandler',
|
|
1140
|
+
topicName: 'CreateNode_Out',
|
|
1141
|
+
fromStepNames: ['start']
|
|
1142
|
+
}
|
|
1143
|
+
]
|
|
1144
|
+
}
|
|
1145
|
+
]
|
|
1146
|
+
}
|
|
1147
|
+
];\n`
|
|
1148
|
+
);
|
|
1149
|
+
|
|
1150
|
+
const result = await generate(rootPath, {
|
|
1151
|
+
serviceTag: 'Order'
|
|
1152
|
+
});
|
|
1153
|
+
assert.ok(result);
|
|
1154
|
+
|
|
1155
|
+
const initialSetupConfigContent = await readFile(
|
|
1156
|
+
join(
|
|
1157
|
+
rootPath,
|
|
1158
|
+
'app/src/generatedCode/CoreFunctions/InitialSetupConfig.js'
|
|
1159
|
+
),
|
|
1160
|
+
'utf8'
|
|
1161
|
+
);
|
|
1162
|
+
|
|
1163
|
+
assert.match(initialSetupConfigContent, /serviceTag: 'GraphHandler'/);
|
|
1164
|
+
assert.match(initialSetupConfigContent, /topicName: 'CreateNode_Out'/);
|
|
1165
|
+
assert.match(
|
|
1166
|
+
initialSetupConfigContent,
|
|
1167
|
+
/sqsEndpoint: 'OrderBuildOrderSellOfferLinkAndReserveOrderDataHdrSqs'/
|
|
1168
|
+
);
|
|
1169
|
+
});
|