@izara_project/izara-core-generate-service-code 1.0.31 → 1.0.32
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 +2 -2
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/functionYaml/data.js +1 -1
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/handler/template.ejs +1 -1
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/mainFunction/template.ejs +1 -1
- package/src/generateCode/generateFlowSchema/flowStep/afterPluginHook/handler/templateDsq.ejs +1 -0
- package/src/generateCode/generateFlowSchema/flowStep/afterPluginHook/handler/templateSqs.ejs +2 -5
- package/src/generateCode/generateFlowSchema/flowStep/afterPluginHook/templateMain.ejs +3 -3
- package/src/generateCode/generateFlowSchema/flowStep/firstFlowStep/templateMain.ejs +2 -2
- package/src/generateCode/generateFlowSchema/libs/template.ejs +8 -8
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/create/main/template.ejs +14 -18
- package/src/libs/Utils.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.32",
|
|
4
4
|
"description": "Code for locally generating per service files",
|
|
5
5
|
"author": "Sven Mason <thebarbariansven@gmail.com>",
|
|
6
6
|
"license": "AGPL-3.0-or-later",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@izara_project/izara-core-library-core": "^1.0.31",
|
|
28
28
|
"@izara_project/izara-core-library-logger": "^1.0.8",
|
|
29
29
|
"@izara_project/izara-core-library-s3": "^1.0.5",
|
|
30
|
-
"@izara_project/izara-core-library-service-schemas": "^1.0.
|
|
30
|
+
"@izara_project/izara-core-library-service-schemas": "^1.0.135",
|
|
31
31
|
"@izara_project/izara-shared-core": "^1.0.9",
|
|
32
32
|
"ejs": "^5.0.1",
|
|
33
33
|
"js-beautify": "^1.15.4",
|
|
@@ -105,7 +105,7 @@ function createSourceParams(_izContext, flowSchema, appPath) {
|
|
|
105
105
|
templateData: {
|
|
106
106
|
resourceLocation:
|
|
107
107
|
savePath.flowSchemaFlowTag(flowSchema.flowTag) +
|
|
108
|
-
upperCase(flowSchema.flowTag) +
|
|
108
|
+
upperCase(flowSchema.flowTag) + "_" +
|
|
109
109
|
upperCase('hdrWbs'),
|
|
110
110
|
functionName: upperCase(flowSchema.flowTag),
|
|
111
111
|
handlerType: upperCase('hdrWbs'),
|
|
@@ -21,7 +21,7 @@ import { middlewareHandler as middleware, validatorSchema, consts, response } fr
|
|
|
21
21
|
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
22
22
|
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
23
23
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
24
|
-
import { postToConnection } from '
|
|
24
|
+
import { postToConnection } from '../../../../libs/source/GenerateCodeLibs.js';
|
|
25
25
|
import <%- functionName %> from './<%- functionName %>_Main.js';
|
|
26
26
|
import { utils, getObjectSchema } from "@izara_project/izara-core-library-service-schemas";
|
|
27
27
|
const { createFlowTypeConcat } = utils
|
|
@@ -29,7 +29,7 @@ import { NoRetryError } from '@izara_project/izara-core-library-core';
|
|
|
29
29
|
import { consts as coreConsts } from "@izara_project/izara-middleware";
|
|
30
30
|
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
31
31
|
const { TOPIC_NAME_GENERATE_CODE } = generateCodeConsts;
|
|
32
|
-
import { postToConnection } from '
|
|
32
|
+
import { postToConnection } from '../../../../libs/source/GenerateCodeLibs.js';
|
|
33
33
|
|
|
34
34
|
//(<optionalRequire>)
|
|
35
35
|
//(</optionalRequire>)
|
package/src/generateCode/generateFlowSchema/flowStep/afterPluginHook/handler/templateDsq.ejs
CHANGED
|
@@ -118,6 +118,7 @@ export const main = middleware.wrap(async (event, context, callback) => {
|
|
|
118
118
|
|
|
119
119
|
// add argument (to invoke lambda) to passOnProperties[]
|
|
120
120
|
passOnProperties.push(record.body.Message);
|
|
121
|
+
passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message)) // is Ok PassBackProperties
|
|
121
122
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
122
123
|
|
|
123
124
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
package/src/generateCode/generateFlowSchema/flowStep/afterPluginHook/handler/templateSqs.ejs
CHANGED
|
@@ -51,11 +51,8 @@ export const main = middleware.wrap(async (event, context) => {
|
|
|
51
51
|
|
|
52
52
|
// add argument (to invoke lambda) to passOnProperties[]
|
|
53
53
|
passOnProperties.push(record.body.Message);
|
|
54
|
-
passOnProperties.push(
|
|
55
|
-
|
|
56
|
-
record.body.Message
|
|
57
|
-
)
|
|
58
|
-
);
|
|
54
|
+
passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message));
|
|
55
|
+
|
|
59
56
|
record._izContext.logger.debug(
|
|
60
57
|
'passOnProperties in handler',
|
|
61
58
|
passOnProperties
|
|
@@ -43,18 +43,18 @@ export default async function <%- functionName %>Main (
|
|
|
43
43
|
requestParams,
|
|
44
44
|
//(<additionalParams>)
|
|
45
45
|
//(</additionalParams>)
|
|
46
|
-
|
|
46
|
+
passBackProperties = {},
|
|
47
47
|
) {
|
|
48
48
|
try {
|
|
49
49
|
_izContext.logger.debug('<%- functionName %> _izContext', _izContext);
|
|
50
50
|
_izContext.logger.debug('<%- functionName %> requestParams', requestParams);
|
|
51
|
-
_izContext.logger.debug('<%- functionName %>
|
|
51
|
+
_izContext.logger.debug('<%- functionName %> passBackProperties', passBackProperties);
|
|
52
52
|
|
|
53
53
|
const result = await receivePlugInHookTag(
|
|
54
54
|
_izContext,
|
|
55
55
|
'<%- plugInHookTag %>',
|
|
56
56
|
requestParams,
|
|
57
|
-
|
|
57
|
+
passBackProperties
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
let plugInIdentifiers = null;
|
|
@@ -40,12 +40,12 @@ export default async function <%- functionName %>Main (
|
|
|
40
40
|
requestParams,
|
|
41
41
|
//(<additionalParams>)
|
|
42
42
|
//(</additionalParams>)
|
|
43
|
-
|
|
43
|
+
passBackProperties = {},
|
|
44
44
|
) {
|
|
45
45
|
try {
|
|
46
46
|
_izContext.logger.debug('<%- functionName %> _izContext', _izContext);
|
|
47
47
|
_izContext.logger.debug('<%- functionName %> requestParams', requestParams);
|
|
48
|
-
_izContext.logger.debug('<%- functionName %>
|
|
48
|
+
_izContext.logger.debug('<%- functionName %> passBackProperties', passBackProperties);
|
|
49
49
|
|
|
50
50
|
//(<hookCode>)
|
|
51
51
|
//(</hookCode>)
|
|
@@ -96,14 +96,14 @@ function getNestObject(_izContext, nestedObj, paths) {
|
|
|
96
96
|
* @returns {string|null}
|
|
97
97
|
*/
|
|
98
98
|
function getResourcePart(arnString, index) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
99
|
+
try {
|
|
100
|
+
const resourceId = arnString.split(':').pop();
|
|
101
|
+
const parts = resourceId.split('_');
|
|
102
|
+
return parts[index] || null;
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error("Invalid ARN format", error);
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
export {
|
|
@@ -89,9 +89,7 @@ const PREFIX = {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// ── Detect invocation type ────────────────────────────────────────────────
|
|
92
|
-
const
|
|
93
|
-
const directInvoke = !userAgent &&
|
|
94
|
-
requestParams.hasOwnProperty('__context__') &&
|
|
92
|
+
const directInvoke = requestParams.hasOwnProperty('__context__') &&
|
|
95
93
|
requestParams.izEventSource?.eventSourceTag === 'DirectInvoke';
|
|
96
94
|
|
|
97
95
|
// ── Build createDataDetails ───────────────────────────────────────────────
|
|
@@ -220,17 +218,15 @@ const PREFIX = {
|
|
|
220
218
|
}
|
|
221
219
|
|
|
222
220
|
// ── Create awaiting multiple steps ────────────────────────────────────────
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
);
|
|
233
|
-
}
|
|
221
|
+
_izContext.logger.debug('not api will create awaitingStep');
|
|
222
|
+
await asyncFlowSharedLib.createAwaitingMultipleStepsWithAdditionalAttributes(
|
|
223
|
+
_izContext,
|
|
224
|
+
allAwaitingStepsId,
|
|
225
|
+
asyncFlowSharedLib.createPendingStepId(
|
|
226
|
+
hash({ objType, identifiers: objInstanceFull.identifiers }),
|
|
227
|
+
PREFIX.CREATE_OBJECT_ASYNC_COMPLETE
|
|
228
|
+
)
|
|
229
|
+
);
|
|
234
230
|
|
|
235
231
|
// ── Process graph objects ─────────────────────────────────────────────────
|
|
236
232
|
let messageObject = {};
|
|
@@ -244,7 +240,8 @@ const PREFIX = {
|
|
|
244
240
|
messageObject = {
|
|
245
241
|
objType,
|
|
246
242
|
objInstanceFull: objectForCreate.objInstanceFull,
|
|
247
|
-
|
|
243
|
+
setFieldConditionals: requestParams.setFieldConditionals || [],
|
|
244
|
+
relationships: requestParams.relationships || []
|
|
248
245
|
};
|
|
249
246
|
}
|
|
250
247
|
|
|
@@ -252,15 +249,14 @@ const PREFIX = {
|
|
|
252
249
|
|
|
253
250
|
Object.assign(messageObject, { settings: { updatePropertiesOnMatch: false }, originTimestamp: Date.now() });
|
|
254
251
|
|
|
255
|
-
if (
|
|
256
|
-
_izContext.logger.debug(
|
|
252
|
+
if (directInvoke) {
|
|
253
|
+
_izContext.logger.debug('DirectInvoke case will invoke GraphHandlerInv');
|
|
257
254
|
return await graphSharedLibs.createNodeV2(
|
|
258
255
|
_izContext, graphServiceName, objType, objInstanceFullForGraph,
|
|
259
256
|
requestParams.relationships || [], Date.now(), { updatePropertiesOnMatch: false }
|
|
260
257
|
);
|
|
261
258
|
}
|
|
262
259
|
|
|
263
|
-
_izContext.logger.debug('not have userAgent will send Message to GraphHandler');
|
|
264
260
|
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
265
261
|
messageObject,
|
|
266
262
|
callingFlowSharedLib.addParentCallingFlowConfig(
|
package/src/libs/Utils.js
CHANGED
|
@@ -82,7 +82,7 @@ function checkValidTableYaml(
|
|
|
82
82
|
if (
|
|
83
83
|
hash(
|
|
84
84
|
existsTableSetting[
|
|
85
|
-
|
|
85
|
+
firstLetterUpperCase(dynamoDbYamlSetting.templateData.tableName)
|
|
86
86
|
]
|
|
87
87
|
) === hash(dynamoDbYamlSetting.templateData.attributes.sort())
|
|
88
88
|
) {
|
|
@@ -144,7 +144,7 @@ const savePath = {
|
|
|
144
144
|
},
|
|
145
145
|
flowSchemaFlowTag: function (flowTag) {
|
|
146
146
|
return path.join(
|
|
147
|
-
SOURCE_PATH.
|
|
147
|
+
SOURCE_PATH.resourceLocationFlowSchema,
|
|
148
148
|
firstLetterUpperCase(flowTag),
|
|
149
149
|
'MainHandler/',
|
|
150
150
|
'source/'
|