@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-core-generate-service-code",
3
- "version": "1.0.31",
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.133",
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 '../../../libs/source/GenerateCodeLibs.js';
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 '../../../libs/source/GenerateCodeLibs.js'
32
+ import { postToConnection } from '../../../../libs/source/GenerateCodeLibs.js';
33
33
 
34
34
  //(<optionalRequire>)
35
35
  //(</optionalRequire>)
@@ -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)
@@ -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
- callingFlowSharedLib.addCallingFlowToPassOnProperties(
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
- callingFlowConfig = {},
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 %> callingFlowConfig', callingFlowConfig);
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
- callingFlowConfig
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
- callingFlowConfig = {},
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 %> callingFlowConfig', callingFlowConfig);
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
- 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
- }
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 userAgent = !!_izContext.correlationIds.get(middlewareConsts.USER_AGENT);
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
- if (!userAgent) {
224
- _izContext.logger.debug('not api will create awaitingStep');
225
- await asyncFlowSharedLib.createAwaitingMultipleStepsWithAdditionalAttributes(
226
- _izContext,
227
- allAwaitingStepsId,
228
- asyncFlowSharedLib.createPendingStepId(
229
- hash({ objType, identifiers: objInstanceFull.identifiers }),
230
- PREFIX.CREATE_OBJECT_ASYNC_COMPLETE
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
- relationships: requestParams.relationships || []
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 (userAgent || directInvoke) {
256
- _izContext.logger.debug(userAgent ? 'have userAgent will invoke GraphHandler' : 'DirectInvoke case will invoke GraphHandlerInv');
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
- firstLetterUpperCase(dynamoDbYamlSetting.templateData.tableName)
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.flowSchema,
147
+ SOURCE_PATH.resourceLocationFlowSchema,
148
148
  firstLetterUpperCase(flowTag),
149
149
  'MainHandler/',
150
150
  'source/'