@izara_project/izara-market-library-service-schemas 1.0.39 → 1.0.40

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 (37) hide show
  1. package/package.json +1 -1
  2. package/src/MainLibs/src/Consts.js +2 -2
  3. package/src/TemplateManager/src/libs/Consts.js +2 -1
  4. package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +2 -2
  5. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +1 -1
  6. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +1 -14
  7. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +82 -0
  8. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +1 -1
  9. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +1 -1
  10. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +2 -1
  11. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +16 -11
  12. package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +7 -7
  13. package/src/reStructure/TemplateData/flowSchema/register/dynamoDB/register.js +1 -1
  14. package/src/reStructure/TemplateData/flowSchema/register/subscriptionOutAll/data.js +2 -1
  15. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/webSocketComplete → webSocketComplete}/functionYaml/data.js +13 -7
  16. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/webSocketComplete → webSocketComplete}/handler/data.js +6 -6
  17. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/webSocketComplete → webSocketComplete}/mainFunction/data.js +5 -5
  18. package/src/reStructure/TemplateData/generateRole/createSharedResource.js +4 -4
  19. package/src/reStructure/TemplateData/propertyValueSchema/generateTemplateData.js +1 -0
  20. package/src/reStructure/TemplateData/propertyValueSchema/objectPropertyValueSchema/data.js +14 -14
  21. package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +27 -17
  22. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +2 -1
  23. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +3 -1
  24. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +2 -0
  25. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +4 -0
  26. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +5 -1
  27. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +5 -2
  28. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +5 -1
  29. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +5 -1
  30. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +5 -2
  31. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +5 -1
  32. package/src/reStructure/TemplateData/resourceYaml/dynamodb/generateDynamoPerLink.js +1 -2
  33. package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +4 -3
  34. package/src/reStructure/libs/ValidateAddOnDataStructure.js +0 -1
  35. /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/webSocketComplete → webSocketComplete}/functionYaml/template.ejs +0 -0
  36. /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/webSocketComplete → webSocketComplete}/handler/template.ejs +0 -0
  37. /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/webSocketComplete → webSocketComplete}/mainFunction/template.ejs +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-market-library-service-schemas",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "description": "Schemas for Izara Market project",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -520,8 +520,8 @@ function createDynamoDbComponentByLinks(link, relationshipTag) {
520
520
  let identifiersConcatFrom = `${link.from.objType.serviceTag}_${link.from.objType.objectType}__identifiersConcat`
521
521
  let identifiersConcatTo = `${link.to.objType.serviceTag}_${link.to.objType.objectType}__identifiersConcat`
522
522
 
523
- let resourceNameFrom = `${upperCase(link.from.objType.objectType) + upperCase(link.to.objType.objectType)}Relationship`
524
- let resourceNameTo = `${upperCase(link.to.objType.objectType) + upperCase(link.from.objType.objectType)}Relationship`
523
+ let resourceNameFrom = `${upperCase(link.from.objType.objectType) + upperCase(link.to.objType.objectType)}${upperCase(relationshipTag)}`
524
+ let resourceNameTo = `${upperCase(link.to.objType.objectType) + upperCase(link.from.objType.objectType)}${upperCase(relationshipTag)}`
525
525
  return {
526
526
  tableNameFrom,
527
527
  tableNameTo,
@@ -370,7 +370,8 @@ const SOURCE_GENERATE_IAM_ROLE = {
370
370
 
371
371
  const ADD_ON_DATA_STRUCTURE_TYPE = {
372
372
  versionedData: "versionedData",
373
- attributeTree: "attributeTree"
373
+ attributeTree: "attributeTree",
374
+ propertyValue: "propertyValue"
374
375
  };
375
376
 
376
377
  const ATTRIBUTE_TAG = {
@@ -76,8 +76,8 @@ const createExternalLambdaRole = async (_izContext, allObjSchemas, allRelSchemas
76
76
  const externalLambdaIamRoleGetPresignUrl = await externalLambdaIamRoleUploadS3(_izContext);
77
77
  externalLambdaIamRoleGetPresignUrl && externalLambdaIamRoleArray.push(externalLambdaIamRoleGetPresignUrl);
78
78
  } else if (event.includes("extTopic")) {
79
- const externalSnsPublish = await externalRoleSnsPublish(_izContext, localFlowSchema);
80
- externalSnsPublish && externalLambdaIamRoleArray.push(externalSnsPublish);
79
+ // const externalSnsPublish = await externalRoleSnsPublish(_izContext, localFlowSchema);
80
+ // externalSnsPublish && externalLambdaIamRoleArray.push(externalSnsPublish);
81
81
  }
82
82
  }
83
83
  }
@@ -71,7 +71,7 @@ function createWebSocketConnectYaml(_izContext, srcPath) {
71
71
  functionName,
72
72
  resourceLocation: SOURCE_PATH.resourceLocationWebSocketMain,
73
73
  additionalResourcePermission,
74
- roleName: "WebsocketConnect"
74
+ roleName: "WebsocketMain"
75
75
 
76
76
  },
77
77
  setting: {
@@ -63,25 +63,12 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
63
63
  if (flowSteps.includes("In")) {
64
64
  generatedSnsTopicInForFlowSchema.push(
65
65
  {
66
- queueName: "Process" + upperCase(topicIn) + upperCase(HANDLER.hdrSqs)
66
+ queueName: upperCase(topicIn) + "Complete" + upperCase(HANDLER.hdrSqs)
67
67
 
68
68
  }
69
69
  )
70
70
  }
71
71
 
72
-
73
-
74
- if (flowSchema.outputTopic) {
75
- if (flowSteps.includes("Out")) {
76
- let topicOut = `${upperCase(flowSchema.flowTag)}`;
77
- defaultDsqQueueDataList.push({
78
- queueName: `WebSocketComplete` + upperCase(HANDLER.hdrSqs),
79
- subscribeTo: topicOut
80
- }
81
- )
82
- }
83
- }
84
-
85
72
  for (let defaultSnsInSqsData of generatedSnsTopicInForFlowSchema) {
86
73
  resultsForCreateDefaultSnsInSqs.push({
87
74
  templatePath: snsTemplatePath,
@@ -0,0 +1,82 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ const path = require("path")
21
+
22
+
23
+ // const {
24
+ // HANDLER,
25
+ // STORAGE_TYPES
26
+ // } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
27
+
28
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../MainLibs/src/Utils.js");
29
+ const STORAGE_TYPES = {
30
+ dynamoDB: "dynamoDB",
31
+ graph: "graph"
32
+ }
33
+
34
+ const templatePath = path.join(__dirname, '../../../resourceYaml/sns-out/template.ejs');
35
+
36
+ const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = require('../../../../../MainLibs/src/Consts.js');
37
+
38
+ /**
39
+ * create data for dynamoDbYaml tempalte from objectSchema
40
+ * return array of dynamoDb data
41
+ * because one objectSchema can create multiple dynamoDb table
42
+ *
43
+ * @param {Object} _izContext
44
+ * @param {String} saveFilePath
45
+ * @returns {Object[]} - data of multiple dynamoDb template
46
+ */
47
+
48
+ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
49
+ let resultsForCreateDefaultSnsInSqs = [];
50
+ let flowSteps = Object.keys(flowSchema.flowSteps);
51
+ const setting = {
52
+ initialData: "Resources:\n",
53
+ savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
54
+ saveFileName: SAVE_FILE_NAME.snsOutYaml,
55
+ fileExtension: ".yml",
56
+ isAppend: true
57
+ }
58
+
59
+ let topicOut = `${upperCase(flowSchema.flowTag)}`;
60
+
61
+ const generatedSnsTopicInForFlowSchema = [];
62
+ if (flowSteps.includes("Out")) {
63
+ generatedSnsTopicInForFlowSchema.push(
64
+ {
65
+ queueName: upperCase(topicOut) + "Complete"
66
+
67
+ }
68
+ )
69
+ }
70
+
71
+ for (let defaultSnsInSqsData of generatedSnsTopicInForFlowSchema) {
72
+ resultsForCreateDefaultSnsInSqs.push({
73
+ templatePath: templatePath,
74
+ templateData: defaultSnsInSqsData,
75
+ setting: setting
76
+ })
77
+ }
78
+
79
+ return resultsForCreateDefaultSnsInSqs;
80
+ }
81
+
82
+ module.exports = createDataForDefaultSnsInSqs;
@@ -91,7 +91,7 @@ module.exports.<%- functionName %> = async (
91
91
  callingFlowSharedLib.addParentCallingFlowConfig(
92
92
  callingFlowConfig,
93
93
  callingFlowSharedLib.createCallingFlowConfig(
94
- await lambdaSharedLib.lambdaFunctionName(_izContext, TOPIC_NAME_GENERATE_CODE.flowSchemaOwnTopicComplete), {}
94
+ await lambdaSharedLib.lambdaFunctionName(_izContext, "WebSocketCompleteHdrSqs"), {}
95
95
  )
96
96
  )
97
97
  )
@@ -75,7 +75,7 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
75
75
  if (flowSchema.outputTopic) {
76
76
  if (flowSteps.includes("Out")) {
77
77
  if (flowSchema.outputTopic) {
78
- let topicOut = `${upperCase(flowSchema.flowTag)}`;
78
+ let topicOut = `${upperCase(flowSchema.flowTag)}Complete`;
79
79
  defaultDsqQueueDataList.push({
80
80
  queueName: `WebSocketComplete` + upperCase(HANDLER.hdrSqs),
81
81
  subscribeTo: topicOut
@@ -50,11 +50,12 @@ function createDataForSnsOut(_izContext, flowSchema, srcPath) {
50
50
  let generatedSnsTopicOutForFlowSchema = []
51
51
  let flowSteps = Object.keys(flowSchema.flowSteps);
52
52
  let topicOut = `${upperCase(flowSchema.flowTag)}`
53
+
53
54
  if (flowSteps.includes("Out")) {
54
55
  if (flowSchema.outputTopic) {
55
56
  generatedSnsTopicOutForFlowSchema.push(
56
57
  {
57
- queueName: upperCase(topicOut)
58
+ queueName: upperCase(topicOut) + "Complete"
58
59
  }
59
60
  )
60
61
  }
@@ -75,6 +75,7 @@ const createExternalSqsFunctionYaml = require('./externalTopic/functionYaml/data
75
75
  const createExternalSqsHandler = require('./externalTopic/handler/data');
76
76
  const createExternalSqsMainFunction = require('./externalTopic/mainFunction/data');
77
77
  const createExternalTopicSnsInSqs = require('./externalTopic/sns-in-sqs/data');
78
+ const createExternalTopicSnsOut = require('./externalTopic/sns-out/data')
78
79
 
79
80
  // flowSchema OwnTopic component
80
81
  const createFlowSchemaOwnTopicFunctionYaml = require('./flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data');
@@ -82,9 +83,9 @@ const createFlowSchemaOwnTopicHandler = require('./flowSchemaOwnTopic/FlowSchema
82
83
  const createFlowSchemaOwnTopicMainFunction = require('./flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data');
83
84
 
84
85
  // flowSchema OwnTopicComplete component
85
- const createFlowSchemaOwnTopicCompleteFunctionYaml = require("./flowSchemaOwnTopic/webSocketComplete/functionYaml/data");
86
- const createFlowSchemaOwnTopicCompleteHandler = require("./flowSchemaOwnTopic/webSocketComplete/handler/data");
87
- const createFlowSchemaOwnTopicCompleteMainFunction = require("./flowSchemaOwnTopic/webSocketComplete/mainFunction/data");
86
+ const createFlowSchemaOwnTopicCompleteFunctionYaml = require("./webSocketComplete/functionYaml/data");
87
+ const createFlowSchemaOwnTopicCompleteHandler = require("./webSocketComplete/handler/data");
88
+ const createFlowSchemaOwnTopicCompleteMainFunction = require("./webSocketComplete/mainFunction/data");
88
89
 
89
90
  // flowSchema OwnTopicEndpoint component
90
91
  const createFlowSchemaOwnTopicEndpointFuntionYaml = require('./flowSchemaOwnTopic/EndpointComponent/functionYaml/data');
@@ -144,10 +145,17 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
144
145
  const webSocketConnectYaml = createWebSocketConnectYaml(_izContext, saveFilePath);
145
146
  const webSocketConnectHandler = createWebSocketConnectHandler(_izContext, saveFilePath);
146
147
 
148
+ // flowSchema OwnTopic Complete component
149
+ const flowSchemaOwnTopicCompleteFunctionYaml = createFlowSchemaOwnTopicCompleteFunctionYaml(_izContext, allLocalFlowSchemas, saveFilePath);
150
+ const flowSchemaOwnTopicCompleteHandler = createFlowSchemaOwnTopicCompleteHandler(_izContext, saveFilePath);
151
+ const flowSchemaOwnTopicCompleteMainFunction = createFlowSchemaOwnTopicCompleteMainFunction(_izContext, saveFilePath);
152
+ const flowSchemaOwnTopicCompleteComponent = [...flowSchemaOwnTopicCompleteFunctionYaml, ...flowSchemaOwnTopicCompleteHandler, ...flowSchemaOwnTopicCompleteMainFunction]
153
+
147
154
  const webSocketResource = [...webSocketTaskTable, ...webSocketConnectYaml, ...webSocketConnectHandler]
148
155
  if (allLocalFlowSchemas.records.length) {
149
156
  createSourceParams.push(
150
157
  ...webSocketResource,
158
+ ...flowSchemaOwnTopicCompleteComponent
151
159
  )
152
160
  }
153
161
 
@@ -258,13 +266,14 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
258
266
  const externalSqsHandler = await createExternalSqsHandler(_izContext, flowSchema, saveFilePath);
259
267
  const externalSqsMainFunction = await createExternalSqsMainFunction(_izContext, flowSchema, saveFilePath);
260
268
  const externalTopicSnsInSqs = createExternalTopicSnsInSqs(_izContext, flowSchema, saveFilePath);
261
-
269
+ const externalTopicSnsOut = createExternalTopicSnsOut(_izContext, flowSchema, saveFilePath);
262
270
  // Group related resources for better organization
263
271
  const externalTopic = [
264
272
  ...externalSqsFunctionYaml,
265
273
  ...externalSqsHandler,
266
274
  ...externalSqsMainFunction,
267
- ...externalTopicSnsInSqs
275
+ ...externalTopicSnsInSqs,
276
+ ...externalTopicSnsOut
268
277
  ];
269
278
 
270
279
  createSourceParams.push(...externalTopic)
@@ -276,11 +285,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
276
285
  const flowSchemaOwnTopicHandler = createFlowSchemaOwnTopicHandler(_izContext, flowSchema, saveFilePath);
277
286
  const flowSchemaOwnTopicMainFunction = await createFlowSchemaOwnTopicMainFunction(_izContext, flowSchema, saveFilePath);
278
287
  const flowSchemaOwnTopicComponent = [...flowSchemaOwnTopicFunctionYaml, ...flowSchemaOwnTopicHandler, ...flowSchemaOwnTopicMainFunction]
279
- // flowSchema OwnTopic Complete component
280
- const flowSchemaOwnTopicCompleteFunctionYaml = createFlowSchemaOwnTopicCompleteFunctionYaml(_izContext, saveFilePath);
281
- const flowSchemaOwnTopicCompleteHandler = createFlowSchemaOwnTopicCompleteHandler(_izContext, flowSchema, saveFilePath);
282
- const flowSchemaOwnTopicCompleteMainFunction = createFlowSchemaOwnTopicCompleteMainFunction(_izContext, flowSchema, saveFilePath);
283
- const flowSchemaOwnTopicCompleteComponent = [...flowSchemaOwnTopicCompleteFunctionYaml, ...flowSchemaOwnTopicCompleteHandler, ...flowSchemaOwnTopicCompleteMainFunction]
288
+
284
289
  // flowSchemaOwnTopic Endpoint
285
290
  const flowSchemaOwnTopicEndpointFuntionYaml = await createFlowSchemaOwnTopicEndpointFuntionYaml(_izContext, flowSchema, saveFilePath);
286
291
  const flowSchemaOwnTopicEndpointHandler = createFlowSchemaOwnTopicEndpointHandler(_izContext, flowSchema, saveFilePath);
@@ -302,7 +307,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
302
307
  const flowSchemaOwnTopicFlowStep = [...flowSchemaOwnTopicFlowStepYml, ...flowSchemaOwnTopicFlowStepHandler, ...flowSchemaOwnTopicFlowStepMainFunction]
303
308
  // Group the resources
304
309
  const ownTopicResources = [
305
- ...flowSchemaOwnTopicComponent, ...flowSchemaOwnTopicCompleteComponent, ...flowSchemaOwnTopicEndpointComponent, ...flowSchemaOwnTopicQueue, ...flowSchemaOwnTopicSnsOut, ...flowSchemaOwnTopicFlowStep
310
+ ...flowSchemaOwnTopicComponent, ...flowSchemaOwnTopicEndpointComponent, ...flowSchemaOwnTopicQueue, ...flowSchemaOwnTopicSnsOut, ...flowSchemaOwnTopicFlowStep
306
311
  // ...flowSchemaOwnTopicEndpointCompleteComponent
307
312
  ];
308
313
 
@@ -19,7 +19,7 @@ along with this program. If not, see
19
19
  'use strict';
20
20
 
21
21
  const hash = require('@izara_project/izara-shared-core').objectHash;
22
- const { getObjectSchema } = require('@izara_project/izara-core-library-service-schemas');
22
+ const { getObjectSchema, identifiersObject } = require('@izara_project/izara-core-library-service-schemas');
23
23
 
24
24
  const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
25
25
  const snsSharedLib = require('@izara_project/izara-core-library-sns');
@@ -37,7 +37,7 @@ const { v4: uuidv4 } = require('uuid')
37
37
  const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
38
38
  // const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
39
39
  const { generateCodeLibs: { consts: TOPIC_NAME_GENERATE_CODE } } = require('@izara_project/izara-market-library-service-schemas')
40
-
40
+ const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
41
41
  /**
42
42
  * description of function.
43
43
  * @param {Object} _izContext
@@ -79,12 +79,12 @@ module.exports.registerCompleteMain = async (
79
79
 
80
80
  let correlationId = _izContext.correlationIds.get(consts.X_CORRELATION_ID);
81
81
 
82
- const getResult = async (objectType) => {
82
+ const getResult = async (objType) => {
83
83
  const objectSchema = await getObjectSchema.getObjSchemaS3WithCache(
84
84
  _izContext,
85
85
  {
86
- objectType: objectType,
87
- serviceTag: process.env.iz_serviceTag,
86
+ objectType: objType.objectType,
87
+ serviceTag: objType.serviceTag
88
88
  })
89
89
 
90
90
  _izContext.logger.debug("==> objectSchema", objectSchema)
@@ -92,8 +92,8 @@ module.exports.registerCompleteMain = async (
92
92
  const result = await externalRequest.lambda.invokeSync(_izContext,
93
93
  await lambdaSharedLib.lambdaFunctionName(_izContext, "GetHdrInv"),
94
94
  {
95
- identifiers: identifiersLibs.identifiersFromIdentifiersConcat(_izContext, objectType, requestParams.identifiersTask),
96
- objectType: objectType
95
+ identifiers: await identifiersObject.identifiersLibs.identifiersFromIdentifiersConcat(_izContext, objType.objectType, requestParams.identifiersTask),
96
+ objectType: objType.objectType
97
97
  }
98
98
  )
99
99
 
@@ -59,7 +59,7 @@ const createRegisterTable = (_izContext, srcPath) => {
59
59
  attributes: [
60
60
  {
61
61
  keyType: "partitionKey",
62
- AttributeName: "identifierTask",
62
+ AttributeName: "identifiersTask",
63
63
  AttributeType: "S"
64
64
  },
65
65
  {
@@ -57,7 +57,8 @@ function createDataForSubscriptionOutAll(_izContext, allLocalFlowSchemas, srcPat
57
57
  let queueName;
58
58
  if (flowSchema.outputTopic) {
59
59
  let flowStepOut = Object.keys(flowSchema.flowSteps)[1].split("_")
60
- queueName = flowStepOut[3] + flowStepOut[2]
60
+ // queueName = flowStepOut[3] + flowStepOut[2]
61
+ queueName = flowStepOut[0] + flowSchema.flowTag + "Complete";
61
62
  }
62
63
 
63
64
  if (queueName) {
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
  const path = require('path');
20
20
 
21
21
  const { FLOW_SCHEMA_HOOK_STATE, ACTIONS, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
22
- const { firstLetterUpperCase: upperCase } = require('../../../../../../MainLibs/src/Utils')
22
+ const { firstLetterUpperCase: upperCase } = require('../../../../../MainLibs/src/Utils')
23
23
  const {
24
24
  SOURCE_PATH,
25
25
  defaultIamRolePerAction,
@@ -34,8 +34,8 @@ const {
34
34
  externalResourceYaml,
35
35
  SOURCE_GENERATE_IAM_ROLE,
36
36
  SQS_RESOURCE
37
- } = require('../../../../../../MainLibs/src/Consts');
38
- const { TOPIC_NAME_GENERATE_CODE } = require('../../../../../../GenerateCodeLibs/src/Consts');
37
+ } = require('../../../../../MainLibs/src/Consts');
38
+ const { TOPIC_NAME_GENERATE_CODE } = require('../../../../../GenerateCodeLibs/src/Consts');
39
39
 
40
40
  const templatePath = path.join(__dirname, "template.ejs");
41
41
  const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
@@ -47,11 +47,11 @@ const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
47
47
  * @return {{templatePath, templateData,setting}}
48
48
  */
49
49
 
50
- function data(_izContext, srcPath) {
51
- return [createSourceParams(_izContext, srcPath)]
50
+ function data(_izContext, allLocalFlowSchemas, srcPath) {
51
+ return [createSourceParams(_izContext, allLocalFlowSchemas, srcPath)]
52
52
  }
53
53
 
54
- function createSourceParams(_izContext, srcPath) {
54
+ function createSourceParams(_izContext, allLocalFlowSchemas, srcPath) {
55
55
  let functionName = "WebSocketComplete"
56
56
  let handlerType = upperCase(HANDLER.hdrSqs)
57
57
  let additionalResourcePermission = defaultIamRolePerAction();
@@ -90,6 +90,12 @@ function createSourceParams(_izContext, srcPath) {
90
90
  resourceNames(RESOURCE_CLASSES.sqs, queueName),
91
91
  resourceNames(RESOURCE_CLASSES.sqs, queueName + "DLQ")
92
92
  ]
93
+ ),
94
+ createIamRole(
95
+ {
96
+ [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.subscribe]
97
+ },
98
+ allLocalFlowSchemas.records.map(flowSchema => resourceNames(RESOURCE_CLASSES.sns, flowSchema.flowTag + "Complete_Out"))
93
99
  )
94
100
  )
95
101
 
@@ -102,7 +108,7 @@ function createSourceParams(_izContext, srcPath) {
102
108
  handlerType,
103
109
  additionalResourcePermission,
104
110
  functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
105
- roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaOwnTopic,
111
+ roleName: "WebSocketMain",
106
112
  queueName: queueName
107
113
  },
108
114
  setting: {
@@ -17,9 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
  'use strict';
19
19
  const path = require('path');
20
- const { FLOW_SCHEMA_HOOK_STATE, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
21
- const { SOURCE_PATH, FUNCTION_NAME } = require('../../../../../../MainLibs/src/Consts');
22
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
20
+ const { HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
21
+ const { firstLetterUpperCase: upperCase } = require('../../../../../MainLibs/src/Utils')
22
+ const { SOURCE_PATH } = require('../../../../../MainLibs/src/Consts');
23
23
  const templatePath = path.join(__dirname, "template.ejs")
24
24
 
25
25
  /**
@@ -31,11 +31,11 @@ const templatePath = path.join(__dirname, "template.ejs")
31
31
  */
32
32
 
33
33
 
34
- function data(_izContext, flowSchema, srcPath) {
35
- return [createParamsForCreateSource(_izContext, flowSchema, srcPath)]
34
+ function data(_izContext, srcPath) {
35
+ return [createParamsForCreateSource(_izContext, srcPath)]
36
36
  }
37
37
 
38
- function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
38
+ function createParamsForCreateSource(_izContext, srcPath) {
39
39
  let functionName = "WebSocketComplete"
40
40
  let handlerType = upperCase(HANDLER.hdrSqs)
41
41
  let queueName = upperCase(functionName) + upperCase(handlerType);
@@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
  'use strict';
19
19
  const path = require('path');
20
20
 
21
- const { SOURCE_PATH, FUNCTION_NAME } = require('../../../../../../MainLibs/src/Consts');
22
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
21
+ const { HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
22
+ const { SOURCE_PATH } = require('../../../../../MainLibs/src/Consts');
23
23
  const templatePath = path.join(__dirname, "template.ejs");
24
24
  const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
25
25
 
@@ -32,11 +32,11 @@ const getObjectSchema = require('@izara_project/izara-core-library-service-schem
32
32
  */
33
33
 
34
34
 
35
- function data(_izContext, flowSchema, srcPath) {
36
- return [createParamsForCreateSource(_izContext, flowSchema, srcPath)]
35
+ function data(_izContext, srcPath) {
36
+ return [createParamsForCreateSource(_izContext, srcPath)]
37
37
  }
38
38
 
39
- function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
39
+ function createParamsForCreateSource(_izContext, srcPath) {
40
40
  let functionName = "WebSocketComplete"
41
41
  return {
42
42
  templatePath: templatePath,
@@ -118,7 +118,7 @@ const createSharedResource = (_izContext, createSourceParams, srcPath) => {
118
118
  handlerType: [],
119
119
  resources: {}
120
120
  },
121
- "WebsocketConnect": {
121
+ "WebSocketMain": {
122
122
  handlerType: [],
123
123
  resources: {}
124
124
  },
@@ -233,11 +233,11 @@ const createSharedResource = (_izContext, createSourceParams, srcPath) => {
233
233
  templateData.additionalResourcePermission,
234
234
  groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.ExternalTopicRole].resources
235
235
  )
236
- } else if (templateData?.roleName?.includes("WebsocketConnect")) {
237
- groupedByObjectType["WebsocketConnect"].handlerType.push(templateData);
236
+ } else if (templateData?.roleName?.includes("WebSocketMain")) {
237
+ groupedByObjectType["WebSocketMain"].handlerType.push(templateData);
238
238
  processResourcePermissions(
239
239
  templateData.additionalResourcePermission,
240
- groupedByObjectType["WebsocketConnect"].resources
240
+ groupedByObjectType["WebSocketMain"].resources
241
241
  )
242
242
  } else if (templateData?.roleName?.includes(SOURCE_GENERATE_IAM_ROLE.EventBridge)) {
243
243
  groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.EventBridge].handlerType.push(templateData);
@@ -34,6 +34,7 @@ const modules = {
34
34
  */
35
35
  async function generateCodeWithTemplate(_izContext, objSchemaPath, settings) {
36
36
  try {
37
+ console.log("settings generateCodeWithTemplate", settings)
37
38
  let allCreateSource = [];
38
39
  const srcPath = join(objSchemaPath, '../');
39
40
 
@@ -34,18 +34,17 @@ const templatePath = path.join(__dirname, "./templateObjectPropertyValueSchema.e
34
34
  const modules = {
35
35
  validateAddOnDataStructure: require('../../../libs/ValidateAddOnDataStructure')
36
36
  };
37
- const yaml = require("yaml")
38
37
  const objectschemaLocalByPath = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
39
- const Consts = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Consts')
40
38
  // const objectSchemasBySrc = srcPath
41
39
 
42
40
 
43
41
  async function data(_izContext, settings, srcPath) {
44
42
 
45
- let objectSchema = await objectschemaLocalByPath.getObjSchemaS3(
43
+ let objectSchema = await objectschemaLocalByPath.getLocalObjectSchemasWithHierarchy(
46
44
  _izContext,
47
- settings.objType
48
- );
45
+ settings.objType.objectType,
46
+ path.join(srcPath, "./schemas")
47
+ ).then(res => res.records[0]);
49
48
  _izContext.logger.debug("objectSchema objectSchema::", objectSchema)
50
49
 
51
50
  if (!objectSchema) {
@@ -55,12 +54,13 @@ async function data(_izContext, settings, srcPath) {
55
54
  let propertyValueObjectSchemas = [];
56
55
  let createSources = [];
57
56
 
58
- let objectType = settings.objType.objectType;
57
+ // let objectType = settings.objType.objectType;
58
+ let propertyValueTag = settings.propertyValueTag
59
59
  // validate only addOnndataStructure is type propertyNode.
60
60
 
61
61
  if (!objectSchema.hasOwnProperty("addOnDataStructure") || !Array.isArray(objectSchema.addOnDataStructure) || !objectSchema.addOnDataStructure.length) {
62
- console.log(`Not have data in addOnDataStructure in objectType:${objectType}`);
63
- throw Error(`Not have data in addOnDataStructure in objectType:${objectType}`)
62
+ console.log(`Not have data in addOnDataStructure in objectType:${objectSchema.objectType}`);
63
+ throw Error(`Not have data in addOnDataStructure in objectType:${objectSchema.objectType}`)
64
64
 
65
65
  };
66
66
 
@@ -70,26 +70,26 @@ async function data(_izContext, settings, srcPath) {
70
70
 
71
71
  propertyValueObjectSchemas.push(
72
72
  { // {subject}property
73
- objectType: objectType + PROPERTYVALUE_TAG.property,
73
+ objectType: propertyValueTag + PROPERTYVALUE_TAG.property,
74
74
  fieldNames: {
75
- [objectType + PROPERTYVALUE_TAG.property + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
75
+ [propertyValueTag + PROPERTYVALUE_TAG.property + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
76
76
  },
77
77
  identifiers: [
78
78
  {
79
79
  type: "identifier",
80
- fieldName: objectType + PROPERTYVALUE_TAG.property + "Id"
80
+ fieldName: propertyValueTag + PROPERTYVALUE_TAG.property + "Id"
81
81
  }
82
82
  ]
83
83
  },
84
84
  { // {subject}propertyLabel
85
- objectType: objectType + PROPERTYVALUE_TAG.propertyLabel,
85
+ objectType: propertyValueTag + PROPERTYVALUE_TAG.propertyLabel,
86
86
  fieldNames: {
87
- [objectType + PROPERTYVALUE_TAG.propertyLabel + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
87
+ [propertyValueTag + PROPERTYVALUE_TAG.propertyLabel + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
88
88
  },
89
89
  identifiers: [
90
90
  {
91
91
  type: "identifier",
92
- fieldName: objectType + PROPERTYVALUE_TAG.propertyLabel + "Id"
92
+ fieldName: propertyValueTag + PROPERTYVALUE_TAG.propertyLabel + "Id"
93
93
  }
94
94
  ]
95
95
  }
@@ -27,31 +27,39 @@ const {
27
27
  } = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Consts');
28
28
 
29
29
  const templatePath = path.join(__dirname, "./tempRelationship.ejs");
30
- const yaml = require("yaml")
31
30
 
32
31
  const objectschemaLocalByPath = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
33
32
 
34
33
  const { firstLetterUpperCase: upperCase, getLocalServiceTag } = require("../../../../MainLibs/src/Utils");
35
- const { createBasicRelationshipsProperties } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
36
-
34
+ const { createBasicRelationshipsProperties } = require('../../../../GenerateCodeLibs/src/GenerateCodeLibs');
35
+ const { ADD_ON_DATA_STRUCTURE_TYPE } = require('../../../../TemplateManager/src/libs/Consts');
37
36
  async function data(_izContext, settings, srcPath) {
38
37
 
39
38
 
40
- let objectSchema = await objectschemaLocalByPath.getObjSchemaS3(
39
+ let objectSchema = await objectschemaLocalByPath.getLocalObjectSchemasWithHierarchy(
41
40
  _izContext,
42
- settings.objType
43
- );
41
+ settings.objType.objectType,
42
+ path.join(srcPath, "./schemas")
43
+ ).then(res => res.records[0]);
44
44
 
45
45
  if (!objectSchema) {
46
46
  throw Error(`Invalid objType:${objTypeString(objType)}, cannot generate attribute tree schema cause objectSchema is not exists`)
47
47
  };
48
48
 
49
-
49
+ // validate addOnData type PropertyValues
50
+ let addOn = objectSchema.addOnDataStructure.find(addOn => {
51
+ return addOn.type === ADD_ON_DATA_STRUCTURE_TYPE.propertyValue && objectSchema.objectType === settings.objType.objectType
52
+ })
53
+ console.log("addOn in generate Relationship", addOn)
54
+ if (!addOn) {
55
+ throw Error(`Invalid objType:${objTypeString(objType)}, not have setting for generate propertyValues`)
56
+ }
50
57
 
51
58
  let createSourceRecords = []
52
59
  let generateRelationships = createSourceParams(
53
60
  _izContext,
54
61
  objectSchema,
62
+ settings,
55
63
  srcPath
56
64
  );
57
65
  createSourceRecords.push(...generateRelationships);
@@ -77,26 +85,28 @@ async function data(_izContext, settings, srcPath) {
77
85
  function createSourceParams(
78
86
  _izContext,
79
87
  objectSchema,
88
+ settings,
80
89
  srcPath
81
90
  ) {
82
91
  const attributeRelationships = [];
83
- const objectType = objectSchema.objectType; // main objectType
92
+ // const objectType = objectSchema.objectType; // main objectType
93
+ let propertyValue = settings.propertyValueTag
84
94
  const storageResources = objectSchema.storageResources // storageResource from main objectType
85
95
  const serviceTag = getLocalServiceTag(srcPath)
86
96
 
87
97
  attributeRelationships.push(
88
98
  { // has{objectType}propertyValue
89
- relationshipTag: PREFIX_RELATIONSHIP.has + upperCase(objectType) + PROPERTYVALUE_TAG.property,
99
+ relationshipTag: PREFIX_RELATIONSHIP.has + upperCase(propertyValue) + PROPERTYVALUE_TAG.property,
90
100
  relationshipProperties: createBasicRelationshipsProperties(
91
101
  {
92
102
  serviceTag: serviceTag,
93
- objectType: objectType,
103
+ objectType: propertyValue,
94
104
  linkType: "one",
95
105
  requiredOnCreate: false
96
106
  },
97
107
  {
98
108
  serviceTag: serviceTag,
99
- objectType: upperCase(objectType) + PROPERTYVALUE_TAG.property,
109
+ objectType: propertyValue + PROPERTYVALUE_TAG.property,
100
110
  linkType: "many",
101
111
  requiredOnCreate: true
102
112
  },
@@ -106,17 +116,17 @@ function createSourceParams(
106
116
  },
107
117
  // disabled{objectType}propertyValue
108
118
  {
109
- relationshipTag: PREFIX_RELATIONSHIP.disabled + upperCase(objectType) + PROPERTYVALUE_TAG.property,
119
+ relationshipTag: PREFIX_RELATIONSHIP.disabled + upperCase(propertyValue) + PROPERTYVALUE_TAG.property,
110
120
  relationshipProperties: createBasicRelationshipsProperties(
111
121
  {
112
122
  serviceTag: serviceTag,
113
- objectType: objectType,
123
+ objectType: propertyValue,
114
124
  linkType: "one",
115
125
  requiredOnCreate: false
116
126
  },
117
127
  {
118
128
  serviceTag: serviceTag,
119
- objectType: upperCase(objectType) + PROPERTYVALUE_TAG.property,
129
+ objectType: propertyValue + PROPERTYVALUE_TAG.property,
120
130
  linkType: "many",
121
131
  requiredOnCreate: true
122
132
  },
@@ -126,17 +136,17 @@ function createSourceParams(
126
136
  },
127
137
 
128
138
  { // is{objectType}PropertyLabel
129
- relationshipTag: PREFIX_RELATIONSHIP.is + upperCase(objectType) + PROPERTYVALUE_TAG.propertyLabel,
139
+ relationshipTag: PREFIX_RELATIONSHIP.is + upperCase(propertyValue) + PROPERTYVALUE_TAG.propertyLabel,
130
140
  relationshipProperties: createBasicRelationshipsProperties(
131
141
  {
132
142
  serviceTag: serviceTag,
133
- objectType: upperCase(objectType) + PROPERTYVALUE_TAG.property,
143
+ objectType: propertyValue + PROPERTYVALUE_TAG.property,
134
144
  linkType: "many",
135
145
  requiredOnCreate: true
136
146
  },
137
147
  {
138
148
  serviceTag: serviceTag,
139
- objectType: upperCase(objectType) + PROPERTYVALUE_TAG.propertyLabel,
149
+ objectType: propertyValue + PROPERTYVALUE_TAG.propertyLabel,
140
150
  linkType: "one",
141
151
  requiredOnCreate: false
142
152
  },
@@ -83,6 +83,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
83
83
  [
84
84
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
85
85
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
86
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq)),
87
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ"),
86
88
  ]
87
89
  ),
88
90
  createIamRole(
@@ -96,7 +98,6 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
96
98
  ]
97
99
  )
98
100
  )
99
-
100
101
  for (const relationship of allObjectRelationships) {
101
102
  let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
102
103
  if (storageType === STORAGE_TYPES.dynamoDB) {
@@ -38,7 +38,7 @@ const {
38
38
  checkDynamoTypeRelationship,
39
39
  createDynamoDbComponentByLinks,
40
40
  DYNAMO_RESOURCE
41
- } = require("../../../../../../../MainLibs/index.js").consts;
41
+ } = require("../../../../../../../MainLibs/src/Consts");
42
42
 
43
43
  const templatePath = path.join(__dirname, './template.ejs')
44
44
 
@@ -81,6 +81,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
81
81
  [
82
82
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
83
83
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
84
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq)),
85
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ"),
84
86
  ]
85
87
  ),
86
88
  createIamRole(
@@ -83,6 +83,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
83
83
  [
84
84
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
85
85
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
86
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq)),
87
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ"),
86
88
  ]
87
89
  ),
88
90
  createIamRole(
@@ -65,6 +65,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
65
65
  let functionName = FUNCTION_NAME.createRel
66
66
  let additionalResourcePermission = defaultIamRolePerAction();
67
67
 
68
+ additionalResourcePermission.push(awaitingMultipleStepsRole())
69
+
68
70
  additionalResourcePermission.push(
69
71
  createIamRole(
70
72
  {
@@ -80,6 +82,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
80
82
  [
81
83
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
82
84
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
85
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq)),
86
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ"),
83
87
  ]
84
88
  ),
85
89
  createIamRole(
@@ -68,6 +68,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
68
68
 
69
69
  additionalResourcePermission.push(awaitingMultipleStepsRole())
70
70
 
71
+ additionalResourcePermission.push(awaitingMultipleStepsRole())
72
+
71
73
  additionalResourcePermission.push(
72
74
  createIamRole(
73
75
  {
@@ -83,6 +85,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
83
85
  [
84
86
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
85
87
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
88
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq)),
89
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ"),
86
90
  ]
87
91
  ),
88
92
  createIamRole(
@@ -90,7 +94,7 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
90
94
  [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
91
95
  },
92
96
  [
93
- resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.deleteRelComplete) + "_Out"),
97
+ resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out"),
94
98
  resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
95
99
  resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
96
100
  ]
@@ -66,6 +66,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
66
66
  let functionName = FUNCTION_NAME.deleteRel
67
67
  let additionalResourcePermission = defaultIamRolePerAction();
68
68
 
69
+ additionalResourcePermission.push(awaitingMultipleStepsRole())
70
+
69
71
  additionalResourcePermission.push(
70
72
  createIamRole(
71
73
  {
@@ -81,6 +83,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
81
83
  [
82
84
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
83
85
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
86
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq)),
87
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ"),
84
88
  ]
85
89
  ),
86
90
  createIamRole(
@@ -88,13 +92,12 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
88
92
  [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
89
93
  },
90
94
  [
91
- resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.deleteRelComplete) + "_Out"),
95
+ resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out"),
92
96
  resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
93
97
  resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
94
98
  ]
95
99
  )
96
100
  )
97
-
98
101
  additionalResourcePermission.push(awaitingMultipleStepsRole())
99
102
 
100
103
  for (const relationship of allObjectRelationships) {
@@ -68,6 +68,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
68
68
 
69
69
  additionalResourcePermission.push(awaitingMultipleStepsRole())
70
70
 
71
+ additionalResourcePermission.push(awaitingMultipleStepsRole())
72
+
71
73
  additionalResourcePermission.push(
72
74
  createIamRole(
73
75
  {
@@ -83,6 +85,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
83
85
  [
84
86
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
85
87
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
88
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq)),
89
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ"),
86
90
  ]
87
91
  ),
88
92
  createIamRole(
@@ -90,7 +94,7 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
90
94
  [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
91
95
  },
92
96
  [
93
- resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.deleteRelComplete) + "_Out"),
97
+ resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out"),
94
98
  resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
95
99
  resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
96
100
  ]
@@ -65,6 +65,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
65
65
  let functionName = FUNCTION_NAME.deleteRel
66
66
  let additionalResourcePermission = defaultIamRolePerAction();
67
67
 
68
+ additionalResourcePermission.push(awaitingMultipleStepsRole())
69
+
68
70
  additionalResourcePermission.push(
69
71
  createIamRole(
70
72
  {
@@ -80,6 +82,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
80
82
  [
81
83
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
82
84
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
85
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq)),
86
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ"),
83
87
  ]
84
88
  ),
85
89
  createIamRole(
@@ -87,7 +91,7 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
87
91
  [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
88
92
  },
89
93
  [
90
- resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.deleteRelComplete) + "_Out"),
94
+ resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out"),
91
95
  resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
92
96
  resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
93
97
  ]
@@ -66,6 +66,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
66
66
  let functionName = FUNCTION_NAME.getRel
67
67
  let additionalResourcePermission = defaultIamRolePerAction();
68
68
 
69
+ additionalResourcePermission.push(awaitingMultipleStepsRole())
70
+
69
71
  additionalResourcePermission.push(
70
72
  createIamRole(
71
73
  {
@@ -81,6 +83,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
81
83
  [
82
84
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
83
85
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
86
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq)),
87
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ"),
84
88
  ]
85
89
  ),
86
90
  createIamRole(
@@ -88,13 +92,12 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
88
92
  [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
89
93
  },
90
94
  [
91
- resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.getRelComplete) + "_Out"),
95
+ resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out"),
92
96
  resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
93
97
  resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
94
98
  ]
95
99
  )
96
100
  )
97
-
98
101
  additionalResourcePermission.push(awaitingMultipleStepsRole())
99
102
 
100
103
  for (const relationship of allObjectRelationships) {
@@ -87,6 +87,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
87
87
  let functionName = FUNCTION_NAME.updateRel
88
88
  let additionalResourcePermission = defaultIamRolePerAction();
89
89
 
90
+ additionalResourcePermission.push(awaitingMultipleStepsRole())
91
+
90
92
  additionalResourcePermission.push(
91
93
  createIamRole(
92
94
  {
@@ -102,6 +104,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
102
104
  [
103
105
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
104
106
  resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
107
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq)),
108
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ"),
105
109
  ]
106
110
  ),
107
111
  createIamRole(
@@ -109,7 +113,7 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
109
113
  [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
110
114
  },
111
115
  [
112
- resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.updateRelComplete) + "_Out"),
116
+ resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out"),
113
117
  resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
114
118
  resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
115
119
  ]
@@ -24,7 +24,7 @@ const STORAGE_TYPES = {
24
24
  graph: "graph"
25
25
  }
26
26
  const templatePath = path.join(__dirname, './template.ejs')
27
- const { SOURCE_PATH, SAVE_FILE_NAME, checkDynamoTypeRelationship, createDynamoDbComponentByLinks } = require('../../../../MainLibs').consts
27
+ const { SOURCE_PATH, SAVE_FILE_NAME, checkDynamoTypeRelationship, createDynamoDbComponentByLinks } = require('../../../../MainLibs/src/Consts');
28
28
 
29
29
  /**
30
30
  * create param of crateSouce for FindData And processLogical
@@ -79,7 +79,6 @@ const createDynamoPerRelationshipLink = (_izContext, allObjectRelationships, src
79
79
  }
80
80
  }
81
81
  }
82
-
83
82
  for (let dynamoTablePerLink of dynamoTablePerLinks) {
84
83
  resultsForCreateSource.push({
85
84
  templatePath: templatePath,
@@ -39,9 +39,9 @@ async function filterCreateResourceYaml(_izContext, createSourceParams, objSchem
39
39
  const allLocalFlowSchema = await getObjectSchema.getAllLocalFlowSchemas(_izContext, objSchemaPath);
40
40
  await Promise.all(allLocalFlowSchema.records.map(async (flowSchema) => {
41
41
  if (flowSchema.statusType === "storedCache") {
42
- tableNamesToFilter.add(...await getStoredCacheTableFromFlowSchema(_izContext, flowSchema))
42
+ tableNamesToFilter.add(...await getStoredCacheTableFromFlowSchema(_izContext, flowSchema, objSchemaPath))
43
43
  } else if (flowSchema.statusType === "triggerCache" && flowSchema?.triggerType === "storedCache") {
44
- tableNamesToFilter.add(...await getStoredCacheTableFromFlowSchema(_izContext, flowSchema))
44
+ tableNamesToFilter.add(...await getStoredCacheTableFromFlowSchema(_izContext, flowSchema, objSchemaPath))
45
45
  }
46
46
  }))
47
47
 
@@ -55,7 +55,7 @@ async function filterCreateResourceYaml(_izContext, createSourceParams, objSchem
55
55
 
56
56
  module.exports = filterCreateResourceYaml;
57
57
 
58
- async function getStoredCacheTableFromFlowSchema(_izContext, flowSchema) {
58
+ async function getStoredCacheTableFromFlowSchema(_izContext, flowSchema, objSchemaPath) {
59
59
  let tableNameStoredCache = new Set();
60
60
  const objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], objSchemaPath).then(res => res.records[0])
61
61
  if (objectSchema) {
@@ -67,4 +67,5 @@ async function getStoredCacheTableFromFlowSchema(_izContext, flowSchema) {
67
67
  } else {
68
68
  throw new NoRetryError('not have objectSchema in service to get')
69
69
  }
70
+ return tableNameStoredCache;
70
71
  }
@@ -16,7 +16,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  'use strict';
19
- const Consts = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Consts')
20
19
  const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
21
20
  const { ADD_ON_DATA_STRUCTURE_TYPE } = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Consts');
22
21