@izara_project/izara-market-library-service-schemas 1.0.36 → 1.0.37

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 (83) hide show
  1. package/package.json +8 -7
  2. package/src/GenerateCodeLibs/src/Consts.js +2 -2
  3. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +1 -1
  4. package/src/MainLibs/src/GenerateCodeUtils.js +1 -1
  5. package/src/TemplateManager/src/flowSchema/DefaultWebSocketResource/webSocketConnect/handler/template.ejs +1 -1
  6. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/handler/template.ejs +1 -1
  7. package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/handler/template.ejs +1 -1
  8. package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/mainFunction/template.ejs +1 -1
  9. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/mainFunction/template.ejs +1 -1
  10. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/mainFunction/template.ejs +1 -1
  11. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/mainFunction/template.ejs +1 -1
  12. package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/libs/template.ejs +1 -1
  13. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/backupTemplate.ejs +1 -1
  14. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +1 -1
  15. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +1 -1
  16. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +1 -1
  17. package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +7 -7
  18. package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +1 -1
  19. package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +4 -2
  20. package/src/reStructure/TemplateData/findData/GetByStorage/getByGraph.ejs +4 -3
  21. package/src/reStructure/TemplateData/findData/handler/template.ejs +2 -1
  22. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/data.js +4 -10
  23. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/template.ejs +1 -1
  24. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +1 -1
  25. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +3 -2
  26. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +3 -12
  27. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +2 -2
  28. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +18 -2
  29. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +9 -6
  30. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +2 -2
  31. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/data.js +1 -1
  32. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +2 -2
  33. package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +1 -1
  34. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +1 -1
  35. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/data.js +0 -27
  36. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/data.js +3 -3
  37. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +71 -18
  38. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/dynamoDB/register.js +1 -1
  39. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +5 -5
  40. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/data.js +29 -19
  41. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/data.js +28 -50
  42. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/handler/template.ejs +1 -1
  43. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +10 -22
  44. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +5 -2
  45. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/template.ejs +1 -1
  46. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/template.ejs +72 -43
  47. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +1 -1
  48. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +85 -40
  49. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/template.ejs +1 -1
  50. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +8 -3
  51. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +5 -1
  52. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +7 -5
  53. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +4 -2
  54. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/data.js +3 -2
  55. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/handler/template.ejs +2 -2
  56. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/mainFunction/template.ejs +3 -1
  57. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +1 -1
  58. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +1 -1
  59. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +1 -1
  60. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +4 -3
  61. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +13 -4
  62. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +11 -9
  63. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +2 -5
  64. package/src/reStructure/TemplateData/generateRole/sharedResourceTemplate.ejs +0 -29
  65. package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/createObjectComplete_main.js +1 -1
  66. package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +1 -1
  67. package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +1 -1
  68. package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +1 -1
  69. package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +3 -2
  70. package/src/reStructure/TemplateData/perActionEndpoint/libs/template.ejs +1 -1
  71. package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/template.ejs +1 -1
  72. package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/delete/template.ejs +1 -1
  73. package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/template.ejs +1 -1
  74. package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +1 -1
  75. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +1 -1
  76. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +1 -1
  77. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +1 -1
  78. package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +1 -2
  79. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +1 -1
  80. package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +1 -1
  81. package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +1 -1
  82. package/src/reStructure/TemplateData/testTemplate/data.js +0 -27
  83. package/src/reStructure/TemplateData/testTemplate/template.ejs +0 -0
@@ -1,40 +1,85 @@
1
- /* Copyright (C) 2021 Sven Mason <http://izara.io> This program is free
2
- software: you can redistribute it and/or modify it under the terms of the GNU
3
- Affero General Public License as published by the Free Software Foundation,
4
- either version 3 of the License, or (at your option) any later version. This
5
- program is distributed in the hope that it will be useful, but WITHOUT ANY
6
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
7
- PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
8
- You should have received a copy of the GNU Affero General Public License along
9
- with this program. If not, see <http://www.gnu.org/licenses/>. */ 'use strict';
10
- const { middlewareHandler, consts } =
11
- require("@izara_project/izara-middleware"); // const AWS = require('aws-sdk');
12
- // const api = new AWS.ApiGatewayManagementApi({ endpoint:
13
- process.env.iz_webSocketEndpoint }); const dynamodbSharedLib =
14
- require('@izara_project/izara-core-library-dynamodb'); const
15
- callingFlowSharedLib =
16
- require('@izara_project/izara-core-library-calling-flow'); const hash =
17
- require('object-hash'); // const coreConsts =
18
- require("@izara_project/izara-core-library-core/src/Consts"); const {
19
- postToConnection } = require("../../../libs/source/GenerateCodeLibs"); const {
20
- <%- functionName%>Main } = require("./<%- fileName%>_Main"); module.exports.main
21
- = middlewareHandler.wrap(async (event, context, callback) => {
22
- event._izContext.logger.debug('Event:', event); try { if (event.requestContext)
23
- { const route = event.requestContext.routeKey; const connectionId =
24
- event.requestContext.connectionId; let correlationId =
25
- event._izContext.correlationIds.get(consts.X_CORRELATION_ID) switch (route) {
26
- case '<%- flowTag%>': console.log("event in route <%- flowTag%>", event); let
27
- eventParams = JSON.parse(event.body) await dynamodbSharedLib.putItem(
28
- event._izContext, await dynamodbSharedLib.tableName(event._izContext,
29
- "WebSocketTask"), { taskKey: correlationId, connectionId: connectionId,
30
- originTimestamp: Date.now() } ) let callingFlow = eventParams?.callingFlow ?
31
- eventParams.callingFlow : {}; await <%- functionName%>Main( event._izContext,
32
- eventParams, callingFlowSharedLib.addCallingFlowToPassOnProperties(callingFlow)
33
- //(<additionalParams>) //(</additionalParams>) ) break } } else { const connId =
34
- event.connId; // await postMessage({ message: event.message }, connId); await
35
- postToConnection({ message: event.message }, connId); } } catch (err) { const
36
- connId = event.requestContext.connectionId event._izContext.logger.error('Error,
37
- WebSocket: ', err); // await sendErrorMessage({ message: err.message }, connId);
38
- await postToConnection({ message: err.message }, connId); } }); <%_ const join =
39
- require('path').join _%> <%_ function upperCase (text) { return
40
- text.charAt(0).toUpperCase() + text.slice(1) } _%>
1
+ /*
2
+ * Copyright (C) 2021 Sven Mason <http://izara.io>
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify it under the terms
5
+ * of the GNU Affero General Public License as published by the Free Software Foundation,
6
+ * either version 3 of the License, or (at your option) any later version.
7
+ *
8
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
+ * See the GNU Affero General Public License for more details.
11
+ *
12
+ * You should have received a copy of the GNU Affero General Public License along with this program.
13
+ * If not, see <http://www.gnu.org/licenses/>.
14
+ */
15
+
16
+ 'use strict';
17
+
18
+ const { middlewareHandler, consts } = require("@izara_project/izara-middleware");
19
+ // const AWS = require('aws-sdk');
20
+ // const api = new AWS.ApiGatewayManagementApi({ endpoint: process.env.iz_webSocketEndpoint });
21
+
22
+ const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
23
+ const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
24
+ const hash = require('@izara_project/izara-shared-core').objectHash;
25
+ // const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
26
+
27
+ const { postToConnection } = require("../../../libs/source/GenerateCodeLibs");
28
+ const { <%- functionName %>Main } = require("./<%- fileName %>_Main");
29
+
30
+ module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
31
+ event._izContext.logger.debug('Event:', event);
32
+
33
+ try {
34
+ if (event.requestContext) {
35
+ const route = event.requestContext.routeKey;
36
+ const connectionId = event.requestContext.connectionId;
37
+ let correlationId = event._izContext.correlationIds.get(consts.X_CORRELATION_ID);
38
+
39
+ switch (route) {
40
+ case '<%- flowTag %>':
41
+ console.log("event in route <%- flowTag %>", event);
42
+
43
+ let eventParams = JSON.parse(event.body);
44
+
45
+ await dynamodbSharedLib.putItem(
46
+ event._izContext,
47
+ await dynamodbSharedLib.tableName(event._izContext, "WebSocketTask"),
48
+ {
49
+ taskKey: correlationId,
50
+ connectionId: connectionId,
51
+ originTimestamp: Date.now()
52
+ }
53
+ );
54
+
55
+ let callingFlow = eventParams?.callingFlow ? eventParams.callingFlow : {};
56
+
57
+ await <%- functionName %>Main(
58
+ event._izContext,
59
+ eventParams,
60
+ callingFlowSharedLib.addCallingFlowToPassOnProperties(callingFlow)
61
+ // (<additionalParams>)
62
+ // (</additionalParams>)
63
+ );
64
+
65
+ break;
66
+ }
67
+ } else {
68
+ const connId = event.connId;
69
+ // await postMessage({ message: event.message }, connId);
70
+ await postToConnection({ message: event.message }, connId);
71
+ }
72
+ } catch (err) {
73
+ const connId = event.requestContext?.connectionId;
74
+ event._izContext.logger.error('Error, WebSocket: ', err);
75
+ // await sendErrorMessage({ message: err.message }, connId);
76
+ await postToConnection({ message: err.message }, connId);
77
+ }
78
+ });
79
+
80
+ <%_
81
+ const join = require('path').join;
82
+ function upperCase(text) {
83
+ return text.charAt(0).toUpperCase() + text.slice(1);
84
+ }
85
+ _%>
@@ -18,7 +18,7 @@ along with this program. If not, see
18
18
 
19
19
  'use strict';
20
20
 
21
- const hash = require("object-hash");
21
+ const hash = require('@izara_project/izara-shared-core').objectHash;
22
22
  const { getObjectSchema } = require('@izara_project/izara-core-library-service-schemas');
23
23
 
24
24
  const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
@@ -37,6 +37,7 @@ const {
37
37
  LAMBDA_RESOURCE
38
38
  } = require('../../../../../../MainLibs/src/Consts');
39
39
  const { TOPIC_NAME_GENERATE_CODE } = require('../../../../../../GenerateCodeLibs/src/Consts');
40
+ const { NoRetryError } = require('@izara_project/izara-core-library-core');
40
41
  const getObjectSchema = require('@izara_project/izara-core-library-service-schemas').getObjectSchema;
41
42
 
42
43
  const templatePath = path.join(__dirname, "template.ejs");
@@ -59,15 +60,16 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
59
60
  let route = flowSchema.flowTag;
60
61
  let flowSteps = Object.keys(flowSchema.flowSteps)
61
62
  let flowStepsIn = flowSteps[0];
62
- let splitFlowStepsOut = flowStepsIn.split("_");
63
- let queueName = splitFlowStepsOut[3] + handlerType
63
+ let splitFlowStepsIn = flowStepsIn.split("_");
64
+ let queueName = splitFlowStepsIn[2] + handlerType;
64
65
  additionalResourcePermission.push(
65
66
  createIamRole(
66
67
  {
67
68
  [RESOURCE_CLASSES.sqs]: Object.values(SQS_RESOURCE)
68
69
  },
69
70
  [
70
- resourceNames(RESOURCE_CLASSES.sqs, queueName)
71
+ resourceNames(RESOURCE_CLASSES.sqs, queueName),
72
+ resourceNames(RESOURCE_CLASSES.sqs, queueName + "DLQ")
71
73
  ]
72
74
  ),
73
75
  createIamRole(
@@ -84,6 +86,9 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
84
86
  let tableStroedCaches = [];
85
87
  const objectSchemaPath = path.join(srcPath, "./schemas")
86
88
  let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], objectSchemaPath).then(res => res.records[0])
89
+ if (!objectSchema) {
90
+ throw new NoRetryError('ObjectSchema not found')
91
+ }
87
92
  for (const storageResource of Object.values(objectSchema.storageResources)) {
88
93
  if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
89
94
  if (!tableStroedCaches.includes(storageResource.tableName)) {
@@ -39,7 +39,11 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
39
39
  let functionName = "Process" + upperCase(flowSchema.flowTag)
40
40
  let handlerType = upperCase(HANDLER.hdrSqs)
41
41
  let route = flowSchema.flowTag;
42
- let queueName = functionName
42
+ let flowSteps = Object.keys(flowSchema.flowSteps)
43
+ let flowStepsIn = flowSteps[0];
44
+ let splitFlowStepsIn = flowStepsIn.split("_");
45
+ let queueName = splitFlowStepsIn[2] + handlerType
46
+
43
47
  return {
44
48
  templatePath: templatePath,
45
49
  templateData: {
@@ -41,11 +41,13 @@ async function data(_izContext, flowSchema, srcPath) {
41
41
 
42
42
  async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
43
43
  let functionName = "Process" + upperCase(flowSchema.flowTag);
44
- let tableName;
45
- let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0]);
46
- for (const storageResource of Object.values(objectSchema.storageResources)) {
47
- if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
48
- tableName = storageResource.tableName
44
+ let tableName = null;
45
+ if (flowSchema.statusType === "storedCache") {
46
+ let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0]);
47
+ for (const storageResource of Object.values(objectSchema.storageResources)) {
48
+ if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
49
+ tableName = storageResource.tableName
50
+ }
49
51
  }
50
52
  }
51
53
  let flowSchemaComplete = upperCase(flowSchema.flowTag) + "Complete"
@@ -18,7 +18,7 @@ along with this program. If not, see
18
18
 
19
19
  'use strict';
20
20
 
21
- const hash = require("object-hash");
21
+ const hash = require('@izara_project/izara-shared-core').objectHash;
22
22
  const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
23
23
 
24
24
  const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
@@ -27,6 +27,7 @@ const sqsSharedLib = require('@izara_project/izara-core-library-sqs');
27
27
  const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
28
28
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
29
29
  const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
30
+ const storedCacheSharedLib = require('@izara_project/izara-core-library-stored-cache')
30
31
 
31
32
  const externalRequest = require('@izara_project/izara-core-library-external-request');
32
33
  const sns = externalRequest.sns
@@ -40,7 +41,8 @@ const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
40
41
  const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
41
42
  const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
42
43
  const { createFieldNamesFromRequestParamsByObjectSchema } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs.js')
43
-
44
+ //(<optionalRequire>)
45
+ //(</optionalRequire>)
44
46
  /**
45
47
  *
46
48
  *
@@ -59,7 +59,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
59
59
  let flowStep = Object.keys(flowSchema.flowSteps)
60
60
  let flowStepsIn = flowStep[0];
61
61
  let splitFlowStepsIn = flowStepsIn.split("_");
62
- let topicIn = `${splitFlowStepsIn[3]}_${splitFlowStepsIn[4]}`
62
+ let topicIn = `${splitFlowStepsIn[2]}_${splitFlowStepsIn[3]}`
63
63
  let queueName = functionName + handlerType
64
64
 
65
65
  additionalResourcePermission.push(
@@ -102,7 +102,8 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
102
102
  [RESOURCE_CLASSES.sqs]: [SQS_RESOURCE.sendMessage, SQS_RESOURCE.receiveMessage, SQS_RESOURCE.deleteMessage, SQS_RESOURCE.getQueueAttributes]
103
103
  },
104
104
  [
105
- resourceNames(RESOURCE_CLASSES.sqs, queueName)
105
+ resourceNames(RESOURCE_CLASSES.sqs, queueName),
106
+ resourceNames(RESOURCE_CLASSES.sqs, queueName + "DLQ")
106
107
  ]
107
108
  )
108
109
  )
@@ -45,7 +45,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
45
45
  //validate message (and MessageAttributes)
46
46
  await recordHandlerSharedLib.validateRecord(
47
47
  record, // one record will send to mainFunction
48
- "<%- functionName %>", // queue name that need to retry or send to dlq
48
+ "<%- queueName %>", // queue name that need to retry or send to dlq
49
49
  perRecordsValidatorSchema, // schema for record.Message
50
50
  // messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
51
51
  );
@@ -58,7 +58,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
58
58
  let recordPromise = recordHandlerSharedLib.recordHandler(
59
59
  record, // one record will send to mainFunction
60
60
  <%- functionName %>.<%- functionName %>, // mainFunction that need to invoke.
61
- "<%- functionName %>", // queue name that need to retry or send to dlq
61
+ "<%- queueName %>", // queue name that need to retry or send to dlq
62
62
  passOnProperties, // all parameters that mainFunction needed.
63
63
  );
64
64
  record._izContext.logger.debug('after recordPromise in handler');
@@ -18,7 +18,7 @@ along with this program. If not, see
18
18
 
19
19
  'use strict';
20
20
 
21
- const hash = require("object-hash");
21
+ const hash = require('@izara_project/izara-shared-core').objectHash;
22
22
  const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
23
23
 
24
24
  const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
@@ -37,6 +37,8 @@ const { v4: uuidv4 } = require('uuid')
37
37
  const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
38
38
  const consts = require("@izara_project/izara-middleware").consts
39
39
  const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
40
+ //(<optionalRequire>)
41
+ //(</optionalRequire>)
40
42
  /**
41
43
  *
42
44
  *
@@ -58,7 +58,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
58
58
  let flowStep = Object.keys(flowSchema.flowSteps)
59
59
  let flowStepsOut = flowStep[0];
60
60
  let splitFlowStepsIn = flowStepsOut.split("_");
61
- let topicIn = `${splitFlowStepsIn[3]}_${splitFlowStepsIn[4]}`
61
+ let topicIn = `${splitFlowStepsIn[2]}_${splitFlowStepsIn[3]}`
62
62
  additionalResourcePermission.push(
63
63
  createIamRole(
64
64
  {
@@ -23,7 +23,7 @@ const middleware = izara.middlewareHandler;
23
23
  // const api = new AWS.ApiGatewayManagementApi({ endpoint: process.env.iz_webSocketEndpoint });
24
24
  const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb')
25
25
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow')
26
- const hash = require('object-hash')
26
+ const hash = require('@izara_project/izara-shared-core').objectHash;
27
27
  // const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
28
28
  const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
29
29
  const { postToConnection } = require('../../../libs/source/GenerateCodeLibs')
@@ -54,7 +54,7 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
54
54
  let flowStep = Object.keys(flowSchema.flowSteps)
55
55
  let flowStepsIn = flowStep[0];
56
56
  let splitFlowStepsIn = flowStepsIn.split("_");
57
- let topicArn = `${splitFlowStepsIn[3]}_${splitFlowStepsIn[4]}`
57
+ let topicArn = `${splitFlowStepsIn[2]}_${splitFlowStepsIn[3]}`
58
58
  return {
59
59
  templatePath: templatePath,
60
60
  templateData: {
@@ -18,7 +18,7 @@ along with this program. If not, see
18
18
 
19
19
  'use strict';
20
20
 
21
- const hash = require("object-hash");
21
+ const hash = require('@izara_project/izara-shared-core').objectHash;
22
22
  const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
23
23
 
24
24
  const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
@@ -26,7 +26,7 @@ const snsSharedLib = require('@izara_project/izara-core-library-sns');
26
26
  const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
27
27
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
28
28
  const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
29
-
29
+ const storedCacheSharedLib = require('@izara_project/izara-core-library-stored-cache')
30
30
  const externalRequest = require('@izara_project/izara-core-library-external-request');
31
31
  const sns = externalRequest.sns
32
32
 
@@ -35,7 +35,8 @@ const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryEr
35
35
  const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
36
36
  const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
37
37
  const { postToConnection } = require('../../../libs/source/GenerateCodeLibs')
38
-
38
+ //(<optionalRequire>)
39
+ //(</optionalRequire>)
39
40
  /**
40
41
  *
41
42
  *
@@ -59,11 +59,20 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
59
59
  // GCTpBasTestInPersonCreate => GCTpBas_Test_PersonCreate_In
60
60
  let flowSteps = Object.keys(flowSchema.flowSteps)
61
61
  let flowStepsIn = flowSteps[0];
62
- let flowStepOut = flowSteps[1];
63
62
  let splitFlowStepsIn = flowStepsIn.split("_");
64
- let splitFlowStepsOut = flowStepOut.split("_")
65
- let topicIn = splitFlowStepsIn[3]
66
- let topicOut = splitFlowStepsOut[3]
63
+ let topicIn = splitFlowStepsIn[2]
64
+
65
+ let splitFlowStepsOut;
66
+ let topicOut;
67
+ if (flowSchema.outputTopic) {
68
+ let flowStepOut = flowSteps[1];
69
+ splitFlowStepsOut = flowStepOut.split("_")
70
+ topicOut = splitFlowStepsOut[2]
71
+ } else {
72
+ splitFlowStepsOut = null
73
+ topicOut = null
74
+ }
75
+
67
76
  const generatedSnsTopicInForFlowSchema = [
68
77
  {
69
78
  queueName: upperCase(topicIn),
@@ -47,16 +47,18 @@ const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = require('../../.
47
47
  function createDataForSnsOut(_izContext, flowSchema, srcPath) {
48
48
  let resultsForCreateDefaultSnsInSqs = [];
49
49
 
50
- // GCTpBasTestInPersonCreate => GCTpBas_Test_PersonCreate_In
51
50
  let flowSteps = Object.keys(flowSchema.flowSteps)
52
- let flowStepsOut = flowSteps[0];
53
- let splitFlowStepsIn = flowStepsOut.split("_");
54
- let topicOut = splitFlowStepsIn[3]
55
- const generatedSnsTopicOutForFlowSchema = [
56
- {
57
- queueName: upperCase(topicOut)
58
- }
59
- ];
51
+ let generatedSnsTopicOutForFlowSchema = []
52
+ if (flowSchema.outputTopic) {
53
+ let flowStepsOut = flowSteps[1];
54
+ let splitFlowStepsOut = flowStepsOut.split("_");
55
+ let topicOut = splitFlowStepsOut[2]
56
+ generatedSnsTopicOutForFlowSchema.push(
57
+ {
58
+ queueName: upperCase(topicOut)
59
+ }
60
+ )
61
+ }
60
62
 
61
63
 
62
64
  for (let defaultSnsOutData of generatedSnsTopicOutForFlowSchema) {
@@ -159,9 +159,6 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
159
159
  const webSocketGenerateCodeLibs = createWebSocketGenerateCodeLibs(_izContext, flowSchema, saveFilePath)
160
160
  createSourceParams.push(...webSocketGenerateCodeLibs)
161
161
 
162
- if (flowSchema.statusType === "none" || flowSchema.handlerObj === "multi") {
163
- continue;
164
- }
165
162
  for (const event of flowSchema.event) {
166
163
  if (event.includes("s3")) {
167
164
  const reservedDataTable = createReservedDataMainTable(_izContext, saveFilePath);
@@ -361,11 +358,11 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
361
358
  if (allLocalFlowSchemas.records.length) {
362
359
  console.log("flowSchema Register");
363
360
  const flowSchemaRegisterHandlerComplete = createFlowSchemaRegisterHandlerComplete(_izContext, saveFilePath);
364
- const flowSchemaRegisterMainComplete = createFlowSchemaRegisterMainCompleteFunc(_izContext, saveFilePath);
361
+ const flowSchemaRegisterMainComplete = await createFlowSchemaRegisterMainCompleteFunc(_izContext, allLocalFlowSchemas, saveFilePath);
365
362
  const flowSchemaRegisterHandlerWbs = createFlowSchemaRegisterHandlerWbsFunc(_izContext, saveFilePath);
366
363
  const flowSchemaRegisterMainWbs = createFlowSchemaRegisterMainWbsFunc(_izContext, saveFilePath);
367
364
  const flowSchemaRegisterFunctionYamlComplete = createFlowSchemaRegisterMainCompleteFuncYaml(_izContext, saveFilePath);
368
- const flowSchemaRegisterFunctionYamlWbs = createFlowSchemaRegisterMainWbsFuncYaml(_izContext, allLocalFlowSchemas, saveFilePath);
365
+ const flowSchemaRegisterFunctionYamlWbs = await createFlowSchemaRegisterMainWbsFuncYaml(_izContext, allLocalFlowSchemas, saveFilePath);
369
366
  const flowSchemaRegisterSubscribeOutAll = createFlowSchemaRegisterSubscribeOutAll(_izContext, allLocalFlowSchemas, saveFilePath);
370
367
  const flowSchemaRegisterSnsInSqs = createFlowSchemaRegisterSnsInSqs(_izContext, saveFilePath);
371
368
 
@@ -1,33 +1,4 @@
1
1
  #IAM Role for Upload Schema functionality
2
- UploadSchemaRole:
3
- Type: AWS::IAM::Role
4
- Properties:
5
- RoleName: ${self:custom.iz_resourcePrefix}UploadSchemaRole
6
- AssumeRolePolicyDocument:
7
- Version: "2012-10-17"
8
- Statement:
9
- - Effect: Allow
10
- Principal:
11
- Service: "lambda.amazonaws.com"
12
- Action: sts:AssumeRole
13
- # this is the managed policy for lambda basic execution ex. logging to cloudwatch
14
- ManagedPolicyArns:
15
- - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
16
- - arn:aws:iam::${self:custom.iz_accountId}:policy/UploadSchemaSharedPolicy
17
- Policies:
18
- - PolicyName: ${self:custom.iz_resourcePrefix}UploadSchemaPolicy
19
- PolicyDocument:
20
- Version: "2012-10-17"
21
- Statement:
22
- - Effect: Allow
23
- Action:
24
- - s3:PutObject
25
- - s3:GetObject
26
- - s3:ListBucket
27
- - s3:DeleteObject
28
- Resource:
29
- - arn:aws:s3:::object-schema/*
30
- - arn:aws:s3:::object-schema/perServiceSchemas/${self:custom.iz_serviceTag}/*
31
2
  <% if (roles && roles.length > 0) { -%>
32
3
  <% roles.forEach(function(role) { %>
33
4
  <%= role.roleName %>Role:
@@ -21,7 +21,7 @@ const snsSharedLib = require('@izara_project/izara-shared/src/SnsSharedLib');
21
21
  const sns = require('@izara_project/izara-core-library-external-request/src/resources/Sns');
22
22
  const callingFlowSharedLib = require('@izara_project/izara-shared/src/CallingFlowSharedLib');
23
23
  const _ = require('lodash');
24
- const hash = require("object-hash")
24
+ const hash = require('@izara_project/izara-shared-core').objectHash;
25
25
 
26
26
 
27
27
  const PREFIX = {
@@ -21,7 +21,7 @@ const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
21
21
  const snsSharedLib = require('@izara_project/izara-core-library-sns');
22
22
  const sns = require('@izara_project/izara-core-library-external-request/src/resources/Sns');
23
23
  const _ = require('lodash');
24
- const hash = require("object-hash")
24
+ const hash = require('@izara_project/izara-shared-core').objectHash;
25
25
  const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
26
26
  const PREFIX = {
27
27
  CREATE_OBJECT_ASYNC: "createObjectAsync",
@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  'use strict';
19
- const hash = require("object-hash");
19
+ const hash = require('@izara_project/izara-shared-core').objectHash;
20
20
 
21
21
  const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
22
22
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  'use strict';
19
- const hash = require("object-hash");
19
+ const hash = require('@izara_project/izara-shared-core').objectHash;
20
20
 
21
21
  const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
22
22
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
@@ -16,8 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  'use strict';
19
- const hash = require("object-hash");
20
-
19
+ const hash = require('@izara_project/izara-shared-core').objectHash;
21
20
  const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
22
21
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
23
22
  const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
@@ -33,6 +32,8 @@ const {
33
32
  TOPIC_NAME_GRAPH_HANDLER,
34
33
  PREFIX
35
34
  } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
35
+ //(<optionalRequire>)
36
+ //(</optionalRequire>)
36
37
 
37
38
  module.exports.updateNodeComplete = async (
38
39
  _izContext,
@@ -21,7 +21,7 @@ const externalRequest = require('@izara_project/izara-core-library-external-requ
21
21
  const lambda = externalRequest.lambda;
22
22
 
23
23
  const inMemoryCacheLib = require('@izara_project/izara-shared/src/InMemoryCacheLib');
24
- const hash = require('object-hash')
24
+ const hash = require('@izara_project/izara-shared-core').objectHash;
25
25
 
26
26
  async function checkPermission(_izContext, functionName, payload) {
27
27
  return await lambda.invokeSync(_izContext, functionName, payload)
@@ -31,7 +31,7 @@ const serviceConfigLib = require('@izara_project/izara-core-library-service-sche
31
31
 
32
32
  const uploadUseCase = require('@izara_project/izara-core-library-service-schemas/src/libs/UploadUseCase')
33
33
 
34
- const hash = require("object-hash")
34
+ const hash = require('@izara_project/izara-shared-core').objectHash;
35
35
  const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
36
36
  const path = require('path')
37
37
  const schemasPath = path.join(__dirname, '../schemas');
@@ -29,7 +29,7 @@ const serviceConfigLib = require('@izara_project/izara-core-library-service-sche
29
29
 
30
30
  const uploadUseCase = require('@izara_project/izara-core-library-service-schemas/src/libs/UploadUseCase')
31
31
 
32
- const hash = require("object-hash")
32
+ const hash = require('@izara_project/izara-shared-core').objectHash;
33
33
  const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
34
34
  const path = require('path')
35
35
  const schemasPath = path.join(__dirname, '../schemas');
@@ -18,7 +18,7 @@ along with this program. If not, see
18
18
 
19
19
  'use strict';
20
20
 
21
- const hash = require("object-hash");
21
+ const hash = require('@izara_project/izara-shared-core').objectHash;
22
22
  const {
23
23
  getObjSchemaS3WithHierarchy,
24
24
  } = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
  'use strict';
19
19
 
20
- const hash = require("object-hash");
20
+ const hash = require('@izara_project/izara-shared-core').objectHash;
21
21
 
22
22
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
23
23
  const lambdaSharedLib = require("@izara_project/izara-core-library-lambda");
@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  'use strict';
19
- const hash = require("object-hash");
19
+ const hash = require('@izara_project/izara-shared-core').objectHash;
20
20
 
21
21
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
22
22
  const lambdaSharedLib = require("@izara_project/izara-core-library-lambda");
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
  'use strict';
19
19
 
20
- const hash = require("object-hash");
20
+ const hash = require('@izara_project/izara-shared-core').objectHash;
21
21
 
22
22
 
23
23
  const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  'use strict';
19
- const hash = require("object-hash");
19
+ const hash = require('@izara_project/izara-shared-core').objectHash;
20
20
 
21
21
  const izaraShared = require('@izara_project/izara-shared');
22
22
  const callingFlowSharedLib = izaraShared.callingFlowSharedLib;