@izara_project/izara-market-library-service-schemas 1.0.81 → 1.0.83

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 (39) hide show
  1. package/package.json +11 -10
  2. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +2 -2
  3. package/src/MainLibs/src/Utils.js +2 -2
  4. package/src/reStructure/GenerateTests.js +10 -7
  5. package/src/reStructure/TemplateData/IntTest/generateResources/templateResources.ejs +19 -17
  6. package/src/reStructure/TemplateData/IntTest/generateTests/generateTemplate.js +8 -3
  7. package/src/reStructure/TemplateData/IntTest/generateTests/pathIntTest/data.js +46 -0
  8. package/src/reStructure/TemplateData/IntTest/generateTests/pathIntTest/template.ejs +5 -0
  9. package/src/reStructure/TemplateData/IntTest/generateTests/tests/data.js +4 -1
  10. package/src/reStructure/TemplateData/IntTest/libs/libs.js +1 -0
  11. package/src/reStructure/TemplateData/IntTest/upload/uploadIntTest.js +59 -27
  12. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/functionYaml/data.js +2 -1
  13. package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +1 -1
  14. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +3 -3
  15. package/src/reStructure/TemplateData/flowSchema/flowSchemaMainFunction/data.js +4 -3
  16. package/src/reStructure/TemplateData/flowSchema/flowSchemaMainFunction/template.ejs +1 -4
  17. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +1 -2
  18. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +1 -1
  19. package/src/reStructure/TemplateData/flowSchema/register/complete/handler/template.ejs +2 -2
  20. package/src/reStructure/TemplateData/flowSchema/templateByStatusType/triggerCacheTemplate.ejs +30 -24
  21. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/checkTriggerCacheComplete/mainFunction/template.ejs +8 -8
  22. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/functionYaml/data.js +9 -4
  23. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/functionYaml/template.ejs +1 -0
  24. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/handler/data.js +10 -5
  25. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/mainFunction/data.js +7 -7
  26. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/mainFunction/template.ejs +3 -1
  27. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/triggerCacheQueue/data.js +9 -5
  28. package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/triggerCacheQueue/template.ejs +12 -6
  29. package/src/reStructure/TemplateData/flowSchema/webSocketComplete/handler/template.ejs +1 -1
  30. package/src/reStructure/TemplateData/flowSchema/webSocketComplete/mainFunction/template.ejs +2 -3
  31. package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +3 -0
  32. package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/data.js +1 -1
  33. package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/mainFunction/template.ejs +17 -13
  34. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/data.js +1 -1
  35. package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +1 -1
  36. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/data.js +1 -1
  37. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/data.js +1 -1
  38. package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/data.js +1 -1
  39. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/data.js +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.81",
3
+ "version": "1.0.83",
4
4
  "description": "Schemas for Izara Market project",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,24 +21,25 @@
21
21
  },
22
22
  "type": "module",
23
23
  "dependencies": {
24
+ "@izara_project/izara-core-library-asynchronous-flow": "^1.0.19",
24
25
  "@izara_project/izara-core-library-calling-flow": "^1.0.4",
25
- "@izara_project/izara-core-library-core": "^1.0.28",
26
- "@izara_project/izara-core-library-dynamodb": "^1.0.12",
27
- "@izara_project/izara-core-library-external-request": "^1.0.22",
28
- "@izara_project/izara-core-library-graph-service": "1.0.16",
26
+ "@izara_project/izara-core-library-core": "^1.0.31",
27
+ "@izara_project/izara-core-library-dynamodb": "^1.0.13",
28
+ "@izara_project/izara-core-library-external-request": "^1.0.23",
29
+ "@izara_project/izara-core-library-graph-service": "1.0.17",
29
30
  "@izara_project/izara-core-library-lambda": "^1.0.6",
30
31
  "@izara_project/izara-core-library-logger": "^1.0.8",
31
- "@izara_project/izara-core-library-s3": "^1.0.3",
32
- "@izara_project/izara-core-library-service-schemas": "^1.0.102",
32
+ "@izara_project/izara-core-library-s3": "^1.0.5",
33
+ "@izara_project/izara-core-library-service-schemas": "^1.0.104",
33
34
  "@izara_project/izara-core-library-sns": "^1.0.7",
34
35
  "@izara_project/izara-core-library-sqs": "^1.0.5",
35
36
  "@izara_project/izara-shared": "^1.0.126",
36
- "@izara_project/izara-shared-core": "^1.0.6",
37
- "@izara_project/izara-shared-service-schemas": "^1.0.33",
37
+ "@izara_project/izara-shared-core": "^1.0.8",
38
+ "@izara_project/izara-shared-service-schemas": "^1.0.35",
38
39
  "ejs": "^3.1.10",
39
40
  "js-beautify": "^1.15.4",
40
41
  "lodash": "^4.17.21",
41
42
  "object-hash": "^3.0.0",
42
- "yaml": "^2.8.1"
43
+ "yaml": "^2.8.2"
43
44
  }
44
45
  }
@@ -19,13 +19,13 @@ along with this program.If not, see < http://www.gnu.org/licenses/>.
19
19
 
20
20
  import lodash from 'lodash';
21
21
  import { objectHash as hash } from '@izara_project/izara-shared-core';
22
- import { NoRetryError, inMemoryCacheLib } from '@izara_project/izara-core-library-core';
22
+ import { NoRetryError, inMemoryCacheLib, validator as validateObject } from '@izara_project/izara-core-library-core';
23
23
  import { sns, sqs } from '@izara_project/izara-core-library-external-request';
24
24
  import { getObjectSchema, validator as validatorSchema, serviceConfig, utils, consts as coreConsts, explodedReqParams, deliminatorTree } from '@izara_project/izara-core-library-service-schemas'
25
25
  import Logger from "@izara_project/izara-core-library-logger";
26
26
 
27
27
  import { validateObjType } from '@izara_project/izara-shared-service-schemas';
28
- import { validator as validateObject } from "@izara_project/izara-core-library-core"
28
+
29
29
  // core libs
30
30
  import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
31
31
  import asyncFlowSharedLib from '@izara_project/izara-core-library-asynchronous-flow'
@@ -39,8 +39,8 @@ function checkOverWriteGenerateMainFunction(objectSchema, action) {
39
39
  return overWriteStatus
40
40
  }
41
41
 
42
- function getLocalConfig(srcPath, params) {
43
- const configPath = path.join(srcPath, '../config/serverless.config.yml');
42
+ function getLocalConfig(params) {
43
+ const configPath = path.join(process.cwd(), '../config/serverless.config.yml');
44
44
  const serverlessConfig = fs.readFileSync(configPath, 'utf8');
45
45
  const config = yaml.parse(serverlessConfig);
46
46
  const returnConfig = config.main_config[params];
@@ -30,10 +30,11 @@ import generateTest from './TemplateData/IntTest/generateTests/generateTemplate.
30
30
 
31
31
  import lib from '../reStructure/TemplateData/IntTest/libs/libs.js';
32
32
  const { getLocalConfig } = lib;
33
+ import uploadLib from '../reStructure/TemplateData/IntTest/upload/uploadIntTest.js'
33
34
  async function generateCodeWithTemplate(_izContext, savePath, settings) {
34
35
  _izContext.logger.debug("START", { savePath, settings })
35
36
  try {
36
-
37
+ const serviceTag = getLocalConfig("iz_serviceTag")
37
38
  let packagePath = path.join(__dirname, "../../")
38
39
  // console.log({ packagePath });
39
40
  // --------- Prepare path -------------
@@ -48,9 +49,9 @@ async function generateCodeWithTemplate(_izContext, savePath, settings) {
48
49
  // collect all result of template data for execute createSource
49
50
  let allCreateSource = []
50
51
 
51
-
52
+ // console.log({ intTestPath })
52
53
  // let generateTemplateData = (await import(join(__dirname, IntTestConfig.TemplateAndData[templateName]))).default;
53
- let createSourceResult = await generateTest(_izContext, savePath);
54
+ let createSourceResult = await generateTest(_izContext, savePath, { serviceTag, s3Prefix: settings });
54
55
  // console.log({ createSourceResult })
55
56
  // Filter out empty or invalid objects before adding to allCreateSource
56
57
  if (Array.isArray(createSourceResult)) {
@@ -84,7 +85,7 @@ async function generateCodeWithTemplate(_izContext, savePath, settings) {
84
85
  }
85
86
 
86
87
  // validatePathWithRootServicePath(localServicePath, setting.savePath)
87
- await deleteFileInDir(setting.savePath);
88
+ // await deleteFileInDir(setting.savePath);
88
89
  }
89
90
 
90
91
  // generate all source
@@ -108,10 +109,12 @@ async function generateCodeWithTemplate(_izContext, savePath, settings) {
108
109
  console.log('Generated all source files successfully');
109
110
 
110
111
  console.log("upload file to S3")
111
- const intTestPath = join(saveFilePath, `../../src/generateIntegrationTest/${getLocalConfig("iz_serviceTag")}`)
112
- console.log({ intTestPath })
113
112
 
114
- // uploadLib(intTestPath, settings)
113
+
114
+ await uploadLib.uploadTos3(
115
+ join(saveFilePath, `../../src/generateIntegrationTest/${serviceTag}`), //intTest path
116
+ { s3Prefix: settings, serviceTag: serviceTag } // settings
117
+ )
115
118
 
116
119
 
117
120
  // exec(`bash ${ path.join(packagePath, "./frontEnd/NpmBash.bash") } `, (error, stdout, stderr) => {
@@ -1,31 +1,33 @@
1
1
  {
2
2
  "Lambda": {
3
- <% Object.entries(functionComponent).forEach(([funcName, filePath], index, array) => { -%>
3
+ <% Object.entries(functionComponent).forEach(([funcName, filePath], index, array) => { %>
4
4
  "<%= funcName %>": {
5
5
  "localLocation": "/<%= filePath %>.js",
6
6
  "localHandler": "main",
7
7
  "functionName": "<%= funcName %>"
8
- }<%= index !== array.length - 1 ? ',' : '' %>
9
- <% }); -%>
10
- }, <% Object.keys(s3Component).length ? "," : "" %>
11
- <% if (Object.keys(s3Component).length) { -%>
8
+ }<%= index < array.length - 1 ? "," : "" %>
9
+ <% }) %>
10
+ }<%= Object.keys(s3Component).length || Object.keys(tableNames).length ? "," : "" %>
11
+
12
+ <% if (Object.keys(s3Component).length) { %>
12
13
  "S3": {
13
- <% Object.entries(s3Component).forEach(([functionName,filePath],index) => { -%>
14
- "<%- functionName %>": {
15
- "localLocation": "/<%- filePath %>",
14
+ <% Object.entries(s3Component).forEach(([functionName, filePath], index, array) => { %>
15
+ "<%= functionName %>": {
16
+ "localLocation": "/<%= filePath %>",
16
17
  "localHandler": "main",
17
- "functionName": "<%- functionName %>"
18
- }<%= index < Object.keys(s3Component).length - 1 ? "," : "" %>
19
- <% }); -%>
20
- } <% Object.keys(tableNames).length ? "," : "" -%>
21
- <% } -%>
22
- <% if (Object.keys(tableNames).length) { -%>
18
+ "functionName": "<%= functionName %>"
19
+ }<%= index < array.length - 1 ? "," : "" %>
20
+ <% }) %>
21
+ }<%= Object.keys(tableNames).length ? "," : "" %>
22
+ <% } %>
23
+
24
+ <% if (Object.keys(tableNames).length) { %>
23
25
  "Dynamodb": {
24
- <% tableNames.forEach(function(tableName, index) { %>
26
+ <% tableNames.forEach((tableName, index) => { %>
25
27
  "<%= tableName %>": {
26
28
  "tableName": "<%= tableName %>"
27
- }<% if (index < tableNames.length - 1) { %>,<% } %>
28
- <% }); %>
29
+ }<%= index < tableNames.length - 1 ? "," : "" %>
30
+ <% }) %>
29
31
  }
30
32
  <% } %>
31
33
  }
@@ -20,17 +20,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  import { join } from 'path';
21
21
  import generateEvent from './events/data.js'
22
22
  import generateTest from "./tests/data.js"
23
+ import generatePathIntTest from './pathIntTest/data.js';
23
24
  // import generateBashScript from './bashScript/data.js'
24
25
  import libs from '../libs/libs.js'
25
- const { getIntTestConfig } = libs;
26
+ const { getIntTestConfig, getLocalConfig } = libs;
26
27
  /**
27
28
  * Generates code with templates for different actions
28
29
  * @param {Object} _izContext - Context object
29
30
  * @param {string} savePath - Path to the schema
30
31
  * @returns {Array} Array of generated code parameters
31
32
  */
32
- async function generateCodeWithTemplate(_izContext, savePath) {
33
+ async function generateCodeWithTemplate(_izContext, savePath, settings) {
33
34
  try {
35
+ console.log("settingsInGenerateCodeWithTemplate", settings)
36
+ let serviceTag = getLocalConfig("iz_serviceTag")
34
37
  // console.log({ savePath })
35
38
  // console.log("settings generateCodeWithTemplate", settings)
36
39
  let allCreateSource = [];
@@ -42,10 +45,12 @@ async function generateCodeWithTemplate(_izContext, savePath) {
42
45
  // console.log("event", JSON.stringify(event, null, 2))
43
46
  const test = await generateTest(_izContext, allIntTestConfig, savePath)
44
47
  // console.log("test", JSON.stringify(test, null, 2));
48
+ const intTestBucketPath = await generatePathIntTest(_izContext, savePath, { serviceTag, s3Prefix: settings.s3Prefix })
45
49
 
46
50
  allCreateSource.push(
47
51
  ...event,
48
- ...test
52
+ ...test,
53
+ intTestBucketPath
49
54
  )
50
55
 
51
56
  // console.log("allCreateSource", allCreateSource)
@@ -0,0 +1,46 @@
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
+ import path, { join } from 'path';
21
+ import { fileURLToPath } from 'url';
22
+ const __filename = fileURLToPath(import.meta.url);
23
+ const __dirname = path.dirname(__filename);
24
+ const templatePath = path.join(__dirname, "./template.ejs")
25
+ import uploadIntTest from '../../upload/uploadIntTest.js';
26
+ const { bucketPathForUpload } = uploadIntTest;
27
+
28
+ async function data(_izContext, srcPath, settings) {
29
+ console.log("settingsInData", settings)
30
+ let pathIntTestInBuckets = await bucketPathForUpload(join(srcPath, `../../src/generateIntegrationTest/${settings.serviceTag}`), settings)
31
+ console.log({ pathIntTestInBuckets })
32
+
33
+ return {
34
+ templateData: { pathIntTestInBuckets },
35
+ templatePath: templatePath,
36
+ setting: {
37
+ generateHookFile: false,
38
+ savePath: path.join(srcPath, `./libs/`),
39
+ saveFileName: 'IntTestPath',
40
+ fileExtension: ".js",
41
+ isAppend: false
42
+ }
43
+ }
44
+ }
45
+
46
+ export default data
@@ -0,0 +1,5 @@
1
+ let intTestPath = [
2
+ <% pathIntTestInBuckets.forEach((item, index) => { %>
3
+ "<%- item.key %>"<%= index < pathIntTestInBuckets.length - 1 ? "," : "" -%>
4
+ <% }) %>
5
+ ]
@@ -104,6 +104,9 @@ async function data(_izContext, allIntTestConfig, srcPath) {
104
104
  // baseIntTest.stage[currentStageIdx].initialStage = true;
105
105
  stages[currentStageIdx].initialStage = true;
106
106
  if (handler === HANDLER.hdrSqs) {
107
+ if (functionName.startsWith("Process")) {
108
+ functionName = functionName.split("Process")[1]
109
+ }
107
110
  // Object.assign(baseIntTest.stage[currentStageIdx], {
108
111
  Object.assign(stages[currentStageIdx], {
109
112
  resourceName,
@@ -153,7 +156,7 @@ async function data(_izContext, allIntTestConfig, srcPath) {
153
156
  }
154
157
  }
155
158
 
156
- Object.assign(baseIntTest, { stage: stages })
159
+ Object.assign(baseIntTest, { stages: stages })
157
160
 
158
161
  // console.log("baseIntTest", JSON.stringify(baseIntTest, null, 2));
159
162
 
@@ -4,6 +4,7 @@ import yaml from "yaml";
4
4
  import fs from 'fs';
5
5
  import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
6
6
  const { getDataFromPath } = getObjectSchema;
7
+
7
8
  function lowercaseFirst(str) {
8
9
  if (!str) return "";
9
10
  return str[0].toLowerCase() + str.slice(1);
@@ -25,36 +25,68 @@ import Logger from "@izara_project/izara-core-library-logger";
25
25
 
26
26
  const _izContext = { Logger }
27
27
 
28
- async function uploadFolder(folderPath, s3Prefix) {
29
- let objectToUploads = [];
30
- const entries = fs.readdirSync(folderPath, { withFileTypes: true });
31
- for (const entry of entries) {
32
- const fullPath = path.join(folderPath, entry.name);
33
- const s3Key = path.join(s3Prefix, entry.name).replace(/\\/g, "/"); // path for user upload
34
-
35
- if (entry.isDirectory()) {
36
- await uploadFolder(fullPath, s3Key);
37
- } else {
28
+ async function bucketPathForUpload(folderPath, settings) {
29
+ console.log({ folderPath, settings })
30
+ let dataToUploads = [];
31
+ try {
32
+
33
+ const files = getAllFiles(folderPath);
34
+ // console.log({ files })
35
+ for (const filePath of files) {
36
+ const fileContent = fs.readFileSync(filePath);
37
+ const index = filePath.indexOf(settings.serviceTag);
38
38
 
39
- const fileStream = fs.createReadStream(fullPath);
40
- const params = {
41
- Bucket: "integrationtest-config-us-east-2",
42
- Key: `test_config/${s3Key}`,
43
- Body: fileStream,
44
- };
45
-
46
- objectToUploads.push(s3.putObjectS3(_izContext, params));
47
-
48
- try {
49
- await Promise.all(objectToUploads)
50
- console.log("uploadComplete to", s3Key)
51
- // console.log("Upload-Succuss:", s3Key, "ETag:", result.ETag);
52
- } catch (err) {
53
- // console.error("Upload-Failed:", s3Key, err);
54
- console.log("Upload-Failed");
39
+ let relativePath;
40
+ if (index !== -1) {
41
+ relativePath = filePath.substring(index);
42
+ } else {
43
+ relativePath = path.basename(filePath);
55
44
  }
45
+
46
+ let s3Key = path.join('test_config', settings.s3Prefix, relativePath).split(path.sep).join('/');
47
+
48
+ dataToUploads.push({ key: s3Key, fileContent })
56
49
  }
50
+
51
+ return dataToUploads
52
+
53
+ } catch (err) {
54
+ console.error("prepare data to upload fail", err);
57
55
  }
58
56
  }
59
57
 
60
- export default uploadFolder;
58
+ function getAllFiles(dirPath, filePaths) {
59
+ const files = fs.readdirSync(dirPath);
60
+
61
+ filePaths = filePaths || [];
62
+
63
+ files.forEach(function (file) {
64
+ const fullPath = path.join(dirPath, file);
65
+
66
+ if (fs.statSync(fullPath).isDirectory()) {
67
+ filePaths = getAllFiles(fullPath, filePaths);
68
+ } else {
69
+ filePaths.push(fullPath);
70
+ }
71
+ });
72
+
73
+ return filePaths;
74
+ }
75
+
76
+ async function uploadTos3(folderPath, settings) {
77
+ let uploadLists = [];
78
+ let datas = await bucketPathForUpload(folderPath, settings)
79
+ // console.log({ keys })
80
+ await Promise.all(datas.map(async (data) => {
81
+ uploadLists.push(s3.putObjectS3(_izContext, {
82
+ Bucket: 'integrationtest-config-us-east-2',
83
+ Key: data.key,
84
+ Body: data.fileContent,
85
+ ContentType: 'application/json'
86
+ }));
87
+ }))
88
+
89
+ await Promise.all(uploadLists);
90
+ }
91
+
92
+ export default { uploadTos3, bucketPathForUpload };
@@ -36,7 +36,8 @@ const {
36
36
  SAVE_FILE_NAME,
37
37
  DYNAMO_RESOURCE,
38
38
  SOURCE_GENERATE_IAM_ROLE,
39
- ACTIONS
39
+ ACTIONS,
40
+ FUNCTION_NAME
40
41
  } = consts;
41
42
 
42
43
  const templatePath = path.join(__dirname, 'template.ejs')
@@ -21,7 +21,7 @@ import { lambda } from '@izara_project/izara-core-library-external-request';
21
21
  import { ApiGatewayManagementApiClient, PostToConnectionCommand } from "@aws-sdk/client-apigatewaymanagementapi";
22
22
  import { objectHash as hash } from '@izara_project/izara-shared-core';
23
23
 
24
- const { NoRetryError, inMemoryCacheLib } = require('@izara_project/izara-core-library-core');
24
+ import { NoRetryError, inMemoryCacheLib } from '@izara_project/izara-core-library-core';
25
25
 
26
26
  const client = new ApiGatewayManagementApiClient({
27
27
  endpoint: `https://${process.env.iz_webSocketEndpoint}`
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
  'use strict';
19
19
 
20
20
  import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
21
- import { middlewareHandler as middleware } from "@izara_project/izara-middleware";
21
+ import { middlewareHandler as middleware, response } from "@izara_project/izara-middleware";
22
22
 
23
23
  export const main = middleware.wrap(async (event, context) => {
24
24
 
@@ -63,10 +63,10 @@ export const main = middleware.wrap(async (event, context) => {
63
63
  }
64
64
 
65
65
 
66
- return (izara.response.webSocketSuccess());
66
+ return (response.webSocketSuccess());
67
67
 
68
68
  } catch (err) {
69
69
  event._izContext.logger.error('Error, WebSocketConnect: ', err);
70
- return (izara.response.failure(err));
70
+ return (response.failure(err));
71
71
  }
72
72
  });
@@ -22,11 +22,11 @@ const __filename = fileURLToPath(import.meta.url);
22
22
  const __dirname = path.dirname(__filename);
23
23
 
24
24
  import { NoRetryError } from '@izara_project/izara-core-library-core';
25
- import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
26
-
25
+ import { getObjectSchema, utils as coreUtils } from '@izara_project/izara-core-library-service-schemas';
26
+ const { createFlowTypeConcat } = coreUtils
27
27
  import { consts, utils } from '../../../../MainLibs/index.js';
28
28
  const { SOURCE_PATH, STORAGE_TYPES } = consts;
29
- const { firstLetterUpperCase: upperCase } = utils;
29
+ const { firstLetterUpperCase: upperCase, getLocalConfig } = utils;
30
30
 
31
31
  const templatePath = path.join(__dirname, "template.ejs");
32
32
  const statusFieldTemplate = path.join(__dirname, "../templateByStatusType/statusFieldTemplate.ejs")
@@ -77,6 +77,7 @@ async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
77
77
  tableName,
78
78
  flowSchemaComplete,
79
79
  triggerType,
80
+ queueName: `${createFlowTypeConcat(_izContext, { serviceTag: getLocalConfig("iz_serviceTag"), flowTag: flowSchema.flowTag })}_Main`
80
81
  },
81
82
  setting: {
82
83
  savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), "source/"),
@@ -30,11 +30,7 @@ import { NoRetryError } from '@izara_project/izara-core-library-core';
30
30
  import { utils} from '@izara_project/izara-core-library-service-schemas';
31
31
  const { createFlowTypeConcat } = utils;
32
32
  <% if (statusType === "triggerCache") { -%>
33
- <<<<<<< HEAD
34
- import triggeredCacheSharedLibV2 from '@izara_project/izara-core-library-trigger-cache';
35
- =======
36
33
  import { triggeredCacheSharedLibV2 } from '@izara_project/izara-core-library-trigger-cache';
37
- >>>>>>> 80dda49 (- fix bug: fix template for triggerCahce flowSchema, main function and handler)
38
34
  <% } else if (statusType === "statusField") { -%>
39
35
  import statusFieldSharedLib from '@izara_project/izara-core-library-status-field';
40
36
  <% } else if (statusType === "storedCache") { -%>
@@ -82,6 +78,7 @@ export default async function <%- functionName %> (
82
78
  flowSchemaComplete: flowSchemaComplete,
83
79
  triggerType: triggerType,
84
80
  flowTag,
81
+ queueName
85
82
  }) %>
86
83
  <% } %>
87
84
 
@@ -17,11 +17,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
  'use strict';
19
19
 
20
- import { middlewareHandler as middleware, validatorSchema } from "@izara_project/izara-middleware";
20
+ import { middlewareHandler as middleware, validatorSchema, consts } from "@izara_project/izara-middleware";
21
21
  import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
22
22
  import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
23
23
  import { objectHash as hash } from '@izara_project/izara-shared-core';
24
- import consts from '@izara_project/izara-middleware';
25
24
  import { postToConnection } from '../../../libs/source/GenerateCodeLibs.js';
26
25
  import <%- functionName %> from './<%- functionName %>_Main.js';
27
26
  import { utils} from "@izara_project/izara-core-library-service-schemas";
@@ -461,7 +461,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
461
461
  const functionYaml = (await Promise.all(Object.entries(createFlowSchemaTriggerCacheFunctionYaml).map(([type, functionYaml]) => functionYaml(_izContext, flowSchema, saveFilePath)))).flat();
462
462
  const mainFunction = Object.entries(createFlowSchemaTriggerCacheMainFunction).flatMap(([type, mainFunction]) => mainFunction(_izContext, flowSchema, saveFilePath));
463
463
  const handler = Object.entries(createFlowSchemaTriggerCacheHandler).flatMap(([type, handler]) => handler(_izContext, flowSchema, saveFilePath));
464
- const queue = createFlowSchemaTriggerCacheQueue(flowSchema, saveFilePath);
464
+ const queue = createFlowSchemaTriggerCacheQueue(_izContext, flowSchema, saveFilePath);
465
465
  // console.log("functionYaml", JSON.stringify(...functionYaml, null, 2))
466
466
  createSourceParams.push(...functionYaml, ...mainFunction, ...handler, ...queue)
467
467
  // console.log("Generate triggerCache component")
@@ -17,12 +17,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
  'use strict';
19
19
 
20
- import { middlewareHandler as middleware } from "@izara_project/izara-middleware";
20
+ import { middlewareHandler } from "@izara_project/izara-middleware";
21
21
  import Logger from '@izara_project/izara-core-library-logger';
22
22
  import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
23
23
  import { recordHandlerSharedLib } from "@izara_project/izara-core-library-record-handler";
24
24
 
25
- import <%- functionName %> from './<%- functionName %>_Main.js';
25
+ import <%- functionName %> from './<%- firstLetterUpperCase(functionName) %>_Main.js';
26
26
 
27
27
  // validate event properties in body.Message of sqs event
28
28
  middlewareHandler.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
@@ -1,20 +1,20 @@
1
- let [triggerCacheStatus, triggerCache] = await triggeredCacheSharedLib.checkTriggeredCacheV2(
2
- _izContext,
3
- {
4
- serviceTag: process.env.iz_serviceTag,
5
- flowTag: "<%- flowTag %>"
6
- },
7
- {
8
- //(<identifiersTriggerCacheTable>)
9
- //(</identifiersTriggerCacheTable>)
10
- },
11
- //(<additionalCheckTriggerCacheSetting>)
12
- "", // overWriteUniqueRequestId
13
- {}, //flowParams
14
- false, // createIfNotHave
15
- {} // triggerFlowIdentifiers
16
- //(</additionalCheckTriggerCacheSetting>)
17
- )
1
+ let [triggerCacheStatus, triggerCache] = await triggeredCacheSharedLibV2.checkTriggeredCacheV2(
2
+ _izContext,
3
+ {
4
+ serviceTag: process.env.iz_serviceTag,
5
+ flowTag: "<%- flowTag %>"
6
+ },
7
+ {
8
+ //(<identifiersTriggerCacheTable>)
9
+ //(</identifiersTriggerCacheTable>)
10
+ },
11
+ //(<additionalCheckTriggerCacheSetting>)
12
+ "", // overWriteUniqueRequestId
13
+ {}, //flowParams
14
+ false, // createIfNotHave
15
+ {} // triggerFlowIdentifiers
16
+ //(</additionalCheckTriggerCacheSetting>)
17
+ )
18
18
 
19
19
  //(<afterCheckTriggerCache>)
20
20
  //(</afterCheckTriggerCache>)
@@ -28,11 +28,17 @@ if (triggerCacheStatus !== "process") {
28
28
  //(</checkTriggerCacheHook>)
29
29
 
30
30
  // send message to ProcessTriggerCache
31
- let sendMessageToProcessTriggerCache = {
32
- MessageBody: JSON.stringify(
33
- //(<messageBody>)
34
- //(</messageBody>)
35
- ),
36
- QueueUrl: await sqsSharedLib.sqsQueueUrl(_izContext, "ProcessTriggerCache<%- flowTag %>HdrSqs")
37
- }
38
31
  }
32
+
33
+ //(<processTriggerCacheHook>)
34
+ //(</processTriggerCacheHook>)
35
+ let sendMessageToProcessTriggerCache = {
36
+ MessageBody: JSON.stringify(
37
+ //(<messageBody>)
38
+ //(</messageBody>)
39
+ ),
40
+ QueueUrl: await sqsSharedLib.sqsQueueUrl(_izContext, "<%- queueName %>")
41
+ }
42
+
43
+ await sqs.sendMessage(_izContext, sendMessageToProcessTriggerCache)
44
+ _izContext.logger.debug("after send message to <%- queueName %>", sendMessageToProcessTriggerCache)
@@ -19,6 +19,8 @@ along with this program. If not, see
19
19
  'use strict';
20
20
 
21
21
  const { getObjectSchema } = require('@izara_project/izara-core-library-service-schemas');
22
+ import { triggeredCacheSharedLibV2 } from '@izara_project/izara-core-library-trigger-cache';
23
+
22
24
  //(<optionalRequire>)
23
25
  //(</optionalRequire>)
24
26
  /**
@@ -36,7 +38,7 @@ const { getObjectSchema } = require('@izara_project/izara-core-library-service-s
36
38
  * @returns {object} description of return value
37
39
  */
38
40
 
39
- export default async function <%- functionName %> (
41
+ export default async function <% - functionName %> (
40
42
  _izContext,
41
43
  identifiers,
42
44
  topicArn,
@@ -58,19 +60,17 @@ export default async function <%- functionName %> (
58
60
  serviceTag: topicName[0]
59
61
  })
60
62
 
61
- let checkTriggerCache = await triggeredCacheSharedLib.checkTriggeredCacheV2(
63
+ let checkTriggerCache = await triggeredCacheSharedLibV2.checkTriggeredCacheV2(
62
64
  _izContext,
63
65
  { // flowType
64
66
  serviceTag: topicName[0],
65
67
  flowTag: flowTag
66
68
  },
67
69
  ...identifiers,
68
- //(<triggerCacheAdditionalParam>)
69
- "", // overwriteUniqueRequestId,
70
- {}, // flowParams
71
- true, // createIfNotExists
72
- {}, // triggerFlowIdentifiers
73
- //(</triggerCacheAdditionalParam>)
70
+ {
71
+ flowTag: <%- flowTag %>,
72
+ serviceTag: process.env.iz_serviceTag
73
+ }
74
74
  )
75
75
 
76
76
  _izContext.logger.debug("checkTriggerCache: ", checkTriggerCache)
@@ -21,7 +21,8 @@ import { fileURLToPath } from 'url';
21
21
  const __filename = fileURLToPath(import.meta.url);
22
22
  const __dirname = path.dirname(__filename);;
23
23
  import { NoRetryError } from '@izara_project/izara-core-library-core';
24
- import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
24
+ import { getObjectSchema, utils as coreUtils } from '@izara_project/izara-core-library-service-schemas';
25
+ const { createFlowTypeConcat } = coreUtils;
25
26
  import { consts, utils } from '../../../../../../MainLibs/index.js';
26
27
 
27
28
  const {
@@ -38,7 +39,7 @@ const {
38
39
  shortNameHandler,
39
40
  STORAGE_TYPES
40
41
  } = consts;
41
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = utils;
42
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, getLocalConfig } = utils;
42
43
  const templatePath = path.join(__dirname, './template.ejs')
43
44
 
44
45
  /**
@@ -55,9 +56,13 @@ async function data(_izContext, flowSchema, srcPath) {
55
56
 
56
57
  async function createSourceParams(_izContext, flowSchema, srcPath) {
57
58
  let functionName = "ProcessTriggerCache" + upperCase(flowSchema.flowTag)
58
- let handlerType = upperCase(HANDLER.hdrSqs)
59
+ // let functionName = createFlowTypeConcat(_izContext, { serviceTag: getLocalConfig("iz_serviceTag"), flowTag: upperCase(flowSchema.flowTag) })
60
+ let handlerType = upperCase(HANDLER.hdrDsq)
59
61
  let additionalResourcePermission = defaultIamRolePerAction();
60
- let queueName = "ProcessTriggerCache" + upperCase(flowSchema.flowTag) + handlerType;
62
+ // let queueName = "ProcessTriggerCache" + upperCase(flowSchema.flowTag) + handlerType;
63
+
64
+ let queueName = `${createFlowTypeConcat(_izContext, { serviceTag: getLocalConfig("iz_serviceTag"), flowTag: upperCase(flowSchema.flowTag) })}_Main`
65
+
61
66
 
62
67
  additionalResourcePermission.push(
63
68
  createIamRole(
@@ -5,6 +5,7 @@
5
5
  role: <%- roleName %>Role
6
6
  #<#<%- functionName %><%- handlerType %>FunctionSetting#>
7
7
  #<#/<%- functionName %><%- handlerType %>FunctionSetting#>
8
+ events:
8
9
  - sqs:
9
10
  arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>
10
11
  batchSize: 10
@@ -16,17 +16,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  'use strict';
19
- import path from 'path';;
19
+ import path from 'path';
20
+ import path from 'path';
20
21
  import { fileURLToPath } from 'url';
21
22
  const __filename = fileURLToPath(import.meta.url);
22
- const __dirname = path.dirname(__filename);;
23
+ const __dirname = path.dirname(__filename);
24
+ import { utils as coreUtils } from '@izara_project/izara-core-library-service-schemas';
25
+ const { createFlowTypeConcat } = coreUtils;
26
+
23
27
  import { consts, utils } from '../../../../../../MainLibs/index.js';
24
28
 
25
29
  const {
26
30
  SOURCE_PATH,
27
31
  HANDLER,
28
32
  } = consts;
29
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = utils;
33
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, getLocalConfig } = utils;
30
34
  const templatePath = path.join(__dirname, 'template.ejs');
31
35
 
32
36
  /**
@@ -43,8 +47,9 @@ function data(_izContext, flowSchema, srcPath) {
43
47
 
44
48
  function createSourceParams(_izContext, flowSchema, srcPath) {
45
49
  let functionName = "ProcessTriggerCache" + upperCase(flowSchema.flowTag)
46
- let handlerType = upperCase(HANDLER.hdrSqs)
47
- let queueName = "ProcessTriggerCache" + upperCase(flowSchema.flowTag) + handlerType;
50
+ // let functionName = createFlowTypeConcat(_izContext, { serviceTag: getLocalConfig("iz_serviceTag"), flowTag: upperCase(flowSchema.flowTag) })
51
+ let handlerType = upperCase(HANDLER.hdrDsq)
52
+ let queueName = `${createFlowTypeConcat(_izContext, { serviceTag: getLocalConfig("iz_serviceTag"), flowTag: upperCase(flowSchema.flowTag) })}_Main`
48
53
 
49
54
 
50
55
  return {
@@ -16,16 +16,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  'use strict';
19
- import path from 'path';;
19
+ import path from 'path';
20
20
  import { fileURLToPath } from 'url';
21
21
  const __filename = fileURLToPath(import.meta.url);
22
- const __dirname = path.dirname(__filename);;
22
+ const __dirname = path.dirname(__filename);
23
+ import { utils as coreUtils } from '@izara_project/izara-core-library-service-schemas';
24
+ const { createFlowTypeConcat } = coreUtils;
25
+
23
26
  import { consts, utils } from '../../../../../../MainLibs/index.js';
24
27
  const {
25
28
  SOURCE_PATH,
26
29
  HANDLER,
27
30
  } = consts;
28
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = utils;
31
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, getLocalConfig } = utils;
29
32
  const templatePath = path.join(__dirname, './template.ejs')
30
33
 
31
34
  /**
@@ -42,15 +45,12 @@ function data(_izContext, flowSchema, srcPath) {
42
45
 
43
46
  function createSourceParams(_izContext, flowSchema, srcPath) {
44
47
  let functionName = "ProcessTriggerCache" + upperCase(flowSchema.flowTag)
45
- let handlerType = upperCase(HANDLER.hdrSqs)
46
- let queueName = "ProcessTriggerCache" + upperCase(flowSchema.flowTag) + handlerType;
47
-
48
+ // let functionName = createFlowTypeConcat(_izContext, { serviceTag: getLocalConfig("iz_serviceTag"), flowTag: upperCase(flowSchema.flowTag) })
48
49
 
49
50
  return {
50
51
  templatePath: templatePath,
51
52
  templateData: {
52
53
  functionName,
53
- queueName
54
54
  },
55
55
  setting: {
56
56
  savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), 'source/'),
@@ -18,6 +18,8 @@ along with this program. If not, see
18
18
 
19
19
  'use strict';
20
20
 
21
+ import { triggeredCacheSharedLibV2 } from '@izara_project/izara-core-library-trigger-cache';
22
+
21
23
  //(<optionalRequire>)
22
24
  //(</optionalRequire>)
23
25
  /**
@@ -48,7 +50,7 @@ export default async function <%- functionName %>(
48
50
  _izContext.logger.debug("<%- functionName %> requestParams", requestParams)
49
51
  _izContext.logger.debug("<%- functionName %> callingFlowConfig", callingFlowConfig)
50
52
 
51
- let checkTriggerResetedV2 = await triggeredCacheSharedLib.checkTriggerResetedV2(
53
+ let checkTriggerResetedV2 = await triggeredCacheSharedLibV2.checkTriggerResetedV2(
52
54
  _izContext,
53
55
  { // flowType
54
56
  serviceTag: process.env.iz_serviceTag,
@@ -17,10 +17,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
  'use strict';
19
19
 
20
- import path from 'path';;
20
+ import path from 'path';
21
21
  import { fileURLToPath } from 'url';
22
22
  const __filename = fileURLToPath(import.meta.url);
23
- const __dirname = path.dirname(__filename);;
23
+ const __dirname = path.dirname(__filename);
24
+ import { utils as coreUtils } from '@izara_project/izara-core-library-service-schemas';
25
+ const { createFlowTypeConcat } = coreUtils;
24
26
  import { consts, utils } from '../../../../../MainLibs/index.js';
25
27
 
26
28
  const {
@@ -29,7 +31,7 @@ const {
29
31
  SAVE_FILE_NAME
30
32
  } = consts;
31
33
 
32
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = utils;
34
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, getLocalConfig } = utils;
33
35
  const templatePath = path.join(__dirname, 'template.ejs');
34
36
 
35
37
  /**
@@ -42,9 +44,10 @@ const templatePath = path.join(__dirname, 'template.ejs');
42
44
  * @returns {Object[]} - data of multiple dynamoDb template
43
45
  */
44
46
 
45
- function createDataForDefaultSnsInSqs(flowSchema, srcPath) {
47
+ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
46
48
  let resultsForCreateDefaultSnsInSqs = [];
47
49
  let flowTag = upperCase(flowSchema.flowTag)
50
+ let serviceTag = getLocalConfig("iz_serviceTag")
48
51
  // console.log("create topic by flowSteps", flowSteps)
49
52
  const setting = {
50
53
  initialData: "Resources:\n",
@@ -56,7 +59,8 @@ function createDataForDefaultSnsInSqs(flowSchema, srcPath) {
56
59
 
57
60
  let generateTriggerCacheQueueNames = [
58
61
  {
59
- queueName: "ProcessTriggerCache" + upperCase(flowTag) + upperCase(HANDLER.hdrSqs)
62
+ // queueName: "ProcessTriggerCache" + upperCase(flowTag) + upperCase(HANDLER.hdrSqs)
63
+ queueName: `${createFlowTypeConcat(_izContext, { serviceTag: serviceTag, flowTag: upperCase(flowTag) })}_Main`
60
64
  },
61
65
  {
62
66
  queueName: "CheckTriggerCache" + upperCase(flowTag) + "Complete" + upperCase(HANDLER.hdrSqs)
@@ -1,22 +1,22 @@
1
1
  #------- queue ---------
2
- <%- queueName %>:
2
+ <%- resourceNameFromQueueName(queueName) %>:
3
3
  Type: "AWS::SQS::Queue"
4
4
  Properties:
5
5
  QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
6
6
  RedrivePolicy:
7
7
  deadLetterTargetArn: #!GetAtt
8
8
  Fn::GetAtt:
9
- - <%- queueName %>DLQ
9
+ - <%- resourceNameFromQueueName(queueName) %>DLQ
10
10
  - Arn
11
11
  maxReceiveCount: 3
12
12
  VisibilityTimeout: 120
13
13
 
14
- <%- queueName %>DLQ:
14
+ <%- resourceNameFromQueueName(queueName) %>DLQ:
15
15
  Type: AWS::SQS::Queue
16
16
  Properties:
17
17
  QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
18
18
 
19
- <%- queueName %>Policy:
19
+ <%- resourceNameFromQueueName(queueName) %>Policy:
20
20
  Type: AWS::SQS::QueuePolicy
21
21
  Properties:
22
22
  PolicyDocument:
@@ -27,14 +27,20 @@
27
27
  Principal: "*"
28
28
  Resource: #!GetAtt
29
29
  Fn::GetAtt:
30
- - <%- queueName %>
30
+ - <%- resourceNameFromQueueName(queueName) %>
31
31
  - Arn
32
32
  Action: "SQS:SendMessage"
33
33
  Queues:
34
- - Ref: <%- queueName %>
34
+ - Ref: <%- resourceNameFromQueueName(queueName) %>
35
35
  #<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
36
36
  #<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
37
37
 
38
+ <% function resourceNameFromQueueName(queueName) {
39
+ if (queueName.includes("_")) {
40
+ queueName = queueName.split("_").join("")
41
+ }
42
+ return queueName
43
+ } %>
38
44
  <%_ function firstLetterUpperCase(text){
39
45
  return text.charAt(0).toUpperCase() + text.slice(1)
40
46
  } _%>
@@ -27,7 +27,7 @@ import <%- functionName %> from './<%- functionName %>_Main.js';
27
27
  // validate event properties in body.Message of sqs event
28
28
  middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
29
29
  let perRecordsValidatorSchema = {}
30
- module.exports.main = middleware.wrap(async (event, context, callback) => {
30
+ export const main = middleware.wrap(async (event, context, callback) => {
31
31
 
32
32
  try {
33
33
 
@@ -20,12 +20,11 @@ along with this program. If not, see
20
20
 
21
21
  import { NoRetryError } from '@izara_project/izara-core-library-core';
22
22
  import { consts } from "@izara_project/izara-middleware"
23
- import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas/src/GetObjectSchema';
24
- import { utils } from "@izara_project/izara-core-library-service-schemas"
23
+ import { getObjectSchema, utils } from '@izara_project/izara-core-library-service-schemas';
25
24
  const { createFlowTypeConcat } = utils;
26
25
  import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
27
26
 
28
- import { postToConnection } from "../../../libs/source/GenerateCodeLibs";
27
+ import { postToConnection } from "../../../libs/source/GenerateCodeLibs.js";
29
28
 
30
29
  //(<optionalRequire>)
31
30
  //(</optionalRequire>)
@@ -145,6 +145,9 @@ export default async function createObjectComplete (
145
145
  errorsFound: errorsFound
146
146
  }
147
147
 
148
+ //(<beforeSendMessage>)
149
+ //(</beforeSendMessage>)
150
+
148
151
  messageObject = callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(passBackProperties, messageObject)
149
152
  let messageAttributes = callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(passBackProperties, {})
150
153
 
@@ -118,7 +118,7 @@ function createParamForCreateSource(handlerType, srcPath) {
118
118
  resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
119
119
  functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.changeRel)) + upperCase(shortNameHandler(handlerType)),
120
120
  roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole,
121
- serviceTag: getLocalConfig(path.join(srcPath, "../"), "iz_serviceTag"),
121
+ serviceTag: getLocalConfig("iz_serviceTag"),
122
122
  apiTemplate,
123
123
  dsqTemplate,
124
124
  invTemplate,
@@ -26,25 +26,29 @@ import asyncFlowSharedLib from "@izara_project/izara-core-library-asynchronous-f
26
26
 
27
27
  import { sns } from "@izara_project/izara-core-library-external-request";
28
28
 
29
- import { getObjectSchema, utils, serviceConfig, consts, relSchemaLib as findLinksByObjTypes } from '@izara_project/izara-core-library-service-schemas'
29
+ import {
30
+ getObjectSchema,
31
+ utils,
32
+ serviceConfig,
33
+ consts,
34
+ relSchemaLib
35
+ } from '@izara_project/izara-core-library-service-schemas';
30
36
 
31
- const {
32
- getRelationshipSchemaWithCache,
33
- getObjSchemaS3WithHierarchy
34
- } = getObjectSchema
37
+ const { getRelationshipSchemaWithCache, getObjSchemaS3WithHierarchy } = getObjectSchema;
35
38
 
36
- const {
37
- createLinkTypeId
38
- } = utils;
39
+ const { createLinkTypeId } = utils;
39
40
 
40
- const {
41
- getGraphServiceTagWithCache
42
- } = serviceConfig;
41
+ const { getGraphServiceTagWithCache } = serviceConfig;
42
+
43
+ const { findLinksByObjTypes } = relSchemaLib;
43
44
 
44
45
  import { constsGenerateCodeLibs } from '@izara_project/izara-market-library-service-schemas';
45
- const { PREFIX,
46
+ const {
47
+ PREFIX,
46
48
  TOPIC_NAME_GENERATE_CODE,
47
- TOPIC_NAME_GRAPH_HANDLER } = constsGenerateCodeLibs;
49
+ TOPIC_NAME_GRAPH_HANDLER
50
+ } = constsGenerateCodeLibs;
51
+
48
52
  import { const as coreConsts } from '@izara_project/izara-core-library-core';
49
53
 
50
54
  //(<optionalRequire>)
@@ -143,7 +143,7 @@ function createParamForCreateSource(allObjectRelationships, handlerType, srcPath
143
143
  resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
144
144
  functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.createRel)) + upperCase(shortNameHandler(handlerType)),
145
145
  roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole,
146
- serviceTag: getLocalConfig(path.join(srcPath, "../"), "iz_serviceTag"),
146
+ serviceTag: getLocalConfig("iz_serviceTag"),
147
147
  apiTemplate,
148
148
  dsqTemplate,
149
149
  invTemplate,
@@ -130,7 +130,7 @@ export default async function createRelationship(
130
130
  const relationshipSchema = await getRelationshipSchemaWithCache(_izContext, relType);
131
131
  _izContext.logger.debug("relationshipSchema: ", relationshipSchema);
132
132
 
133
- const links = await findLinksByObjTypes.findLinksByObjTypes(_izContext, [firstObject.objType, secondObject.objType], relationshipSchema.links)
133
+ const links = await findLinksByObjTypes(_izContext, [firstObject.objType, secondObject.objType], relationshipSchema.links)
134
134
  _izContext.logger.debug("links", links)
135
135
  if (!links.length) {
136
136
  errorsFound.push(`not found link between ${JSON.stringify({ firstObject: firstObject.objType })} ${JSON.stringify({ secondObject: secondObject.objType })}`)
@@ -144,7 +144,7 @@ function createParamForCreateSource(allObjectRelationships, handlerType, srcPath
144
144
  resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
145
145
  functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.deleteRel)) + upperCase(shortNameHandler(handlerType)),
146
146
  roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole,
147
- serviceTag: getLocalConfig(path.join(srcPath, "../"), "iz_serviceTag"),
147
+ serviceTag: getLocalConfig("iz_serviceTag"),
148
148
  apiTemplate,
149
149
  dsqTemplate,
150
150
  invTemplate,
@@ -145,7 +145,7 @@ function createParamForCreateSource(allObjectRelationships, handlerType, srcPath
145
145
  resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
146
146
  functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.getRel)) + upperCase(shortNameHandler(handlerType)),
147
147
  roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole,
148
- serviceTag: getLocalConfig(path.join(srcPath, "../"), "iz_serviceTag"),
148
+ serviceTag: getLocalConfig("iz_serviceTag"),
149
149
  apiTemplate,
150
150
  dsqTemplate,
151
151
  invTemplate,
@@ -121,7 +121,7 @@ function createParamForCreateSource(allObjectRelationships, handlerType, srcPath
121
121
  resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
122
122
  functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.moveRel)) + upperCase(shortNameHandler(handlerType)),
123
123
  roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole,
124
- serviceTag: getLocalConfig(path.join(srcPath, "../"), "iz_serviceTag"),
124
+ serviceTag: getLocalConfig("iz_serviceTag"),
125
125
  apiTemplate,
126
126
  dsqTemplate,
127
127
  invTemplate,
@@ -138,7 +138,7 @@ function createParamForCreateSource(allObjectRelationships, handlerType, srcPath
138
138
  resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
139
139
  functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.updateRel)) + upperCase(shortNameHandler(handlerType)),
140
140
  roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole,
141
- serviceTag: getLocalConfig(path.join(srcPath, "../"), "iz_serviceTag"),
141
+ serviceTag: getLocalConfig("iz_serviceTag"),
142
142
  apiTemplate,
143
143
  dsqTemplate,
144
144
  invTemplate,