@izara_project/izara-market-library-service-schemas 1.0.70 → 1.0.72

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.
Files changed (14) hide show
  1. package/package.json +2 -2
  2. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +25 -3
  3. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrS3/template.ejs +5 -3
  4. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +12 -6
  5. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/checkTriggerCacheComplete/functionYaml/data.js +1 -1
  6. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/checkTriggerCacheComplete/handler/data.js +1 -2
  7. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/checkTriggerCacheComplete/mainFunction/data.js +1 -1
  8. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/functionYaml/data.js +1 -1
  9. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/handler/data.js +1 -2
  10. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/mainFunction/data.js +1 -1
  11. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/functionYaml/data.js +1 -1
  12. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/handler/data.js +1 -2
  13. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/mainFunction/data.js +1 -1
  14. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/handler/sqs/template.ejs +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-market-library-service-schemas",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
4
4
  "description": "Schemas for Izara Market project",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,7 +24,7 @@
24
24
  "@izara_project/izara-core-library-core": "^1.0.20",
25
25
  "@izara_project/izara-core-library-external-request": "^1.0.20",
26
26
  "@izara_project/izara-core-library-logger": "^1.0.7",
27
- "@izara_project/izara-core-library-service-schemas": "^1.0.95",
27
+ "@izara_project/izara-core-library-service-schemas": "^1.0.96",
28
28
  "@izara_project/izara-core-library-sns": "^1.0.6",
29
29
  "@izara_project/izara-core-library-sqs": "^1.0.4",
30
30
  "@izara_project/izara-shared": "^1.0.126",
@@ -133,8 +133,13 @@ module.exports.createMain = async (
133
133
  parentObject = await getObjectSchema.getObjSchemaS3WithHierarchy(_izContext, objectSchema.extendObjType)
134
134
  }
135
135
 
136
- let userAgent = _izContext.correlationIds.get(middlewareConsts.USER_AGENT)
137
- _izContext.logger.debug("userAgent::", userAgent);
136
+ let userAgent = false;
137
+ let directInvoke = false;
138
+ if (_izContext.correlationIds.get(middlewareConsts.USER_AGENT)) {
139
+ userAgent = true;
140
+ } else if (requestParams.hasOwnProperty("__context__") && requestParams.izEventSource.eventSourceTag === "DirectInvoke") {
141
+ directInvoke = true;
142
+ }
138
143
 
139
144
  let createDataDetails = await createDataDetailsLib(
140
145
  _izContext,
@@ -472,10 +477,27 @@ module.exports.createMain = async (
472
477
  objInstanceFullForGraph,
473
478
  requestParams.relationships || [],
474
479
  Date.now(),
475
- { updatePropertiesOnMatch: false }
480
+ {
481
+ updatePropertiesOnMatch: false
482
+ }
476
483
  )
477
484
  return createNodeResult
478
485
 
486
+ } else if (directInvoke) {
487
+ _izContext.logger.debug("Direction Invoke case will invoke GraphHandlerInv")
488
+ let createNodeResult = await graphSharedLibs.createNodeV2(
489
+ _izContext,
490
+ graphServiceName,
491
+ objType,
492
+ objInstanceFullForGraph,
493
+ requestParams.relationships,
494
+ Date.now(),
495
+ {
496
+ updatePropertiesOnMatch: false
497
+ }
498
+ );
499
+
500
+ return createNodeResult;
479
501
  } else {
480
502
  _izContext.logger.debug("not have userAgent will send Message to GraphHandler")
481
503
  messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
@@ -7,9 +7,11 @@
7
7
  bucket: <%- bucketName %>
8
8
  event: s3:ObjectCreated:*
9
9
  existing: true
10
- # rules:
11
- # - prefix: uploads/
12
- # - suffix: .csv
10
+ rules:
11
+ #<#<%- functionName %><%- handlerType %>rules#>
12
+ #<#/<%- functionName %><%- handlerType %>rules#>
13
+ - prefix: uploads/
14
+ - suffix: .csv
13
15
  forceDeploy: true
14
16
  role: <%- roleName %>Role
15
17
  #<#<%- functionName %><%- handlerType %>IamRole#>
@@ -197,7 +197,6 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
197
197
  for (const flowSchema of allLocalFlowSchemas.records) {
198
198
  // console.log("flowSchema in Generate TemplateData", flowSchema);
199
199
  const webSocketGenerateCodeLibs = createWebSocketGenerateCodeLibs(_izContext, flowSchema, saveFilePath)
200
-
201
200
  createSourceParams.push(...webSocketGenerateCodeLibs)
202
201
  if (!flowSchema.event.includes("s3")) {
203
202
  const flowSchemaEndpointMainFunction = await createFlowSchemaEndpointMainFunction(_izContext, flowSchema, saveFilePath);
@@ -207,6 +206,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
207
206
  // event has [s3, extTopic, ownTopic, eventBridge, lambdaSync]
208
207
  for (const event of flowSchema.event) {
209
208
  if (event.includes("s3")) {
209
+
210
210
  const reservedDataTable = createReservedDataMainTable(_izContext, saveFilePath);
211
211
  const bucketS3 = createBucketS3(_izContext, flowSchema, saveFilePath)
212
212
 
@@ -232,7 +232,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
232
232
 
233
233
  const processAfterUploadFunctionYmlS3 = createProcessAfterUploadS3FunctionYmlS3(_izContext, flowSchema, saveFilePath);
234
234
  // const processAfterUploadFunctionYamlHdrDsq = createProcessAfterUploadS3FunctionYmlDsq(_izContext, saveFilePath);
235
- const processAfterUploadSqs = createProcessAfterUploadS3Queue(_izContext, saveFilePath);
235
+ // const processAfterUploadSqs = createProcessAfterUploadS3Queue(_izContext, saveFilePath);
236
236
  const processAfterUploadHandlerS3 = createProcessAfterUploadS3HandlerS3(_izContext, flowSchema, saveFilePath);
237
237
  // const processAfterUploadHandlerDsq = createProcessAfterUploadS3HandlerDsq(_izContext, saveFilePath);
238
238
  const processAfterUploadMainFunction = createProcessAfterUploadS3MainFunction(_izContext, flowSchema, saveFilePath);
@@ -270,7 +270,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
270
270
 
271
271
  const processAfterUploadResources = [
272
272
  ...processAfterUploadFunctionYmlS3,
273
- ...processAfterUploadSqs,
273
+ // ...processAfterUploadSqs,
274
274
  ...processAfterUploadHandlerS3,
275
275
  ...processAfterUploadMainFunction
276
276
  // Commented resources kept for reference
@@ -303,6 +303,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
303
303
  );
304
304
 
305
305
  } else if (event.includes("extTopic")) {
306
+
306
307
  // ** External Topic ** //
307
308
  const externalSqsFunctionYaml = await createExternalSqsFunctionYaml(_izContext, flowSchema, saveFilePath);
308
309
  const externalSqsHandler = await createExternalSqsHandler(_izContext, flowSchema, saveFilePath);
@@ -358,6 +359,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
358
359
  createSourceParams.push(...ownTopicResources);
359
360
 
360
361
  } else if (event.includes("eventBridge")) {
362
+
361
363
  const flowSchemaEventBridgeHandler = createFlowSchemaEventBridgeHandler(_izContext, flowSchema, saveFilePath);
362
364
  const flowSchemaEventBridgeMainFunction = createFlowSchemaEventBridgeMainFunction(_izContext, flowSchema, saveFilePath);
363
365
  const flowSchemaEventBridgeFunctionYaml = createFlowSchemaEventBridgeFunctionYaml(_izContext, flowSchema, saveFilePath);
@@ -373,6 +375,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
373
375
  console.log("event eventBridge generated")
374
376
  createSourceParams.push(...eventBridgeResources);
375
377
  } else if (event.includes("lambdaSyncInv")) {
378
+
376
379
  const flowSchemaLambdaSyncFunctionYamlInv = createFlowSchemaLambdaSyncFunctionYamlInv(_izContext, flowSchema, saveFilePath);
377
380
  const flowSchemaLambdaSyncHandlerInv = createFlowSchemaLambdaSyncHandlerInv(_izContext, flowSchema, saveFilePath);
378
381
  // const flowSchemaLambdaSyncMainFunctionInv = createFlowSchemaLambdaSyncMainFunctionInv(_izContext, flowSchema, saveFilePath);
@@ -434,18 +437,21 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
434
437
  createSourceParams.push(...flowSchemaOwnTopicFlowStep)
435
438
 
436
439
  if (flowSchema.statusType === "triggerCache") {
437
- const functionYaml = await Promise.all(
438
- Object.entries(createFlowSchemaTriggerCacheFunctionYaml).flatMap(([type, functionYaml]) => functionYaml(_izContext, flowSchema, saveFilePath)));
440
+ const functionYaml = (await Promise.all(Object.entries(createFlowSchemaTriggerCacheFunctionYaml).map(([type, functionYaml]) => functionYaml(_izContext, flowSchema, saveFilePath)))).flat();
439
441
  const mainFunction = Object.entries(createFlowSchemaTriggerCacheMainFunction).flatMap(([type, mainFunction]) => mainFunction(_izContext, flowSchema, saveFilePath));
440
442
  const handler = Object.entries(createFlowSchemaTriggerCacheHandler).flatMap(([type, handler]) => handler(_izContext, flowSchema, saveFilePath));
441
443
  const queue = createFlowSchemaTriggerCacheQueue(flowSchema, saveFilePath);
442
-
444
+ // console.log("functionYaml", JSON.stringify(...functionYaml, null, 2))
443
445
  createSourceParams.push(...functionYaml, ...mainFunction, ...handler, ...queue)
446
+ // console.log("createSourceParams triggerCache", JSON.stringify(createSourceParams, null, 2))
447
+ console.log("mainFunction triggerCache", JSON.stringify(mainFunction, null, 2))
448
+ console.log("handler triggerCache", JSON.stringify(handler, null, 2))
444
449
  console.log("Generate triggerCache component")
445
450
  }
446
451
  }
447
452
 
448
453
  if (allLocalFlowSchemas.records.length) {
454
+
449
455
  console.log("flowSchema Register");
450
456
  const flowSchemaRegisterHandlerComplete = createFlowSchemaRegisterHandlerComplete(_izContext, saveFilePath);
451
457
  const flowSchemaRegisterMainComplete = await createFlowSchemaRegisterMainCompleteFunc(_izContext, allLocalFlowSchemas, saveFilePath);
@@ -81,7 +81,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
81
81
  return {
82
82
  templatePath: templatePath,
83
83
  templateData: {
84
- resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(functionName), "source/"),
84
+ resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(flowSchema.flowTag), "source/"),
85
85
  functionName,
86
86
  handlerType,
87
87
  additionalResourcePermission,
@@ -46,12 +46,11 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
46
46
  return {
47
47
  templatePath: templatePath,
48
48
  templateData: {
49
- resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(functionName), "source/"),
50
49
  functionName,
51
50
  queueName
52
51
  },
53
52
  setting: {
54
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag)),
53
+ savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), 'source/'),
55
54
  saveFileName: `${upperCase(functionName)}_${upperCase(handlerType)}`,
56
55
  fileExtension: ".js",
57
56
  isAppend: true
@@ -49,7 +49,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
49
49
  flowTag: flowSchema.flowTag
50
50
  },
51
51
  setting: {
52
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag)),
52
+ savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), 'source/'),
53
53
  saveFileName: `${upperCase(functionName)}_Main`,
54
54
  fileExtension: ".js",
55
55
  isAppend: true
@@ -81,7 +81,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
81
81
  return {
82
82
  templatePath: templatePath,
83
83
  templateData: {
84
- resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(functionName), "source/"),
84
+ resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(flowSchema.flowTag), "source/"),
85
85
  functionName,
86
86
  handlerType,
87
87
  additionalResourcePermission,
@@ -46,12 +46,11 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
46
46
  return {
47
47
  templatePath: templatePath,
48
48
  templateData: {
49
- resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(functionName), "source/"),
50
49
  functionName,
51
50
  queueName
52
51
  },
53
52
  setting: {
54
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag)),
53
+ savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), 'source/'),
55
54
  saveFileName: `${upperCase(functionName)}_${upperCase(handlerType)}`,
56
55
  fileExtension: ".js",
57
56
  isAppend: true
@@ -48,7 +48,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
48
48
  queueName
49
49
  },
50
50
  setting: {
51
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag)),
51
+ savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), 'source/'),
52
52
  saveFileName: `${upperCase(functionName)}_Main`,
53
53
  fileExtension: ".js",
54
54
  isAppend: true
@@ -81,7 +81,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
81
81
  return {
82
82
  templatePath: templatePath,
83
83
  templateData: {
84
- resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(functionName), "source/"),
84
+ resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(flowSchema.flowTag), "source/"),
85
85
  functionName,
86
86
  handlerType,
87
87
  additionalResourcePermission,
@@ -46,12 +46,11 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
46
46
  return {
47
47
  templatePath: templatePath,
48
48
  templateData: {
49
- resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(functionName), "source/"),
50
49
  functionName,
51
50
  queueName
52
51
  },
53
52
  setting: {
54
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag)),
53
+ savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), 'source/'),
55
54
  saveFileName: `${upperCase(functionName)}_${upperCase(handlerType)}`,
56
55
  fileExtension: ".js",
57
56
  isAppend: true
@@ -49,7 +49,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
49
49
  flowTag: flowSchema.flowTag
50
50
  },
51
51
  setting: {
52
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag)),
52
+ savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), 'source/'),
53
53
  saveFileName: `${upperCase(functionName)}_Main`,
54
54
  fileExtension: ".js",
55
55
  isAppend: true
@@ -96,7 +96,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
96
96
  passOnProperties.push(record.body.Message.errorsFound)
97
97
  passOnProperties.push(record.body.Message.graphServiceTag)
98
98
  passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message)) // is Ok PassBackProperties
99
- // passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message)) // is Ok callinfFlow
99
+ // passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message)) // is Ok callingFlow
100
100
  record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
101
101
 
102
102
  // call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)