@izara_project/izara-core-generate-service-code 1.0.22 → 1.0.24

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 (106) hide show
  1. package/package.json +1 -1
  2. package/src/generateCode/generateFlowSchema/GenerateCodeFlowSchema.js +11 -8
  3. package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/functionYaml/data.js +2 -2
  4. package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/functionYaml/template.ejs +3 -10
  5. package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/handler/inv/data.js +5 -4
  6. package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/handler/inv/template.ejs +5 -14
  7. package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/index.js +4 -13
  8. package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/mainFunction/data.js +2 -2
  9. package/src/generateCode/generateFlowSchema/event/extTopicComponent/index.js +5 -9
  10. package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/functionYaml/data.js +6 -10
  11. package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/functionYaml/template.ejs +4 -11
  12. package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/handler/data.js +2 -2
  13. package/src/generateCode/generateFlowSchema/event/extTopicComponent/sns-in-sqs/data.js +2 -2
  14. package/src/generateCode/generateFlowSchema/event/extTopicComponent/sns-out/data.js +4 -3
  15. package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/data.js +4 -8
  16. package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/template.ejs +12 -21
  17. package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/handler/data.js +2 -2
  18. package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/index.js +3 -7
  19. package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/data.js +11 -9
  20. package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/template.ejs +3 -10
  21. package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/handler/data.js +2 -2
  22. package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/index.js +3 -7
  23. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/functionYaml/data.js +4 -3
  24. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/handler/data.js +3 -3
  25. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/functionYaml/data.js +8 -11
  26. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/handler/data.js +2 -2
  27. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/mainFunction/data.js +2 -2
  28. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/index.js +8 -24
  29. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/sns-in/data.js +2 -2
  30. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/sns-out/data.js +4 -3
  31. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/data.js +14 -12
  32. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/template.ejs +5 -8
  33. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/statusFieldTemplate.ejs +30 -0
  34. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/storedCacheTemplate.ejs +26 -0
  35. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/triggerCacheTemplate.ejs +44 -0
  36. package/src/generateCode/generateFlowSchema/event/s3Component/index.js +23 -55
  37. package/src/generateCode/generateFlowSchema/event/s3Component/upload/confirmReserved/functionYaml/data.js +3 -7
  38. package/src/generateCode/generateFlowSchema/event/s3Component/upload/confirmReserved/handler/data.js +3 -7
  39. package/src/generateCode/generateFlowSchema/event/s3Component/upload/confirmReserved/mainFunction/data.js +3 -7
  40. package/src/generateCode/generateFlowSchema/event/s3Component/upload/confirmReserved/queue/data.js +2 -2
  41. package/src/generateCode/generateFlowSchema/event/s3Component/upload/createObject/functionYaml/data.js +3 -7
  42. package/src/generateCode/generateFlowSchema/event/s3Component/upload/createObject/handler/data.js +3 -7
  43. package/src/generateCode/generateFlowSchema/event/s3Component/upload/createObject/mainFunction/data.js +3 -7
  44. package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/createPreSignUrl/functionYaml/data.js +3 -7
  45. package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/createPreSignUrl/handler/data.js +3 -7
  46. package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/createPreSignUrl/mainFunction/data.js +3 -7
  47. package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/createPreSignUrl/queue/data.js +2 -2
  48. package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/reservedLimit/functionYaml/data.js +6 -10
  49. package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/reservedLimit/handler/data.js +3 -7
  50. package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/reservedLimit/mainFunction/data.js +3 -7
  51. package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/reservedLimit/sqs/data.js +2 -2
  52. package/src/generateCode/generateFlowSchema/event/s3Component/upload/processFile/functionYml/HdrS3/data.js +3 -7
  53. package/src/generateCode/generateFlowSchema/event/s3Component/upload/processFile/handler/handlerS3/data.js +3 -7
  54. package/src/generateCode/generateFlowSchema/event/s3Component/upload/processFile/mainFunction/data.js +3 -7
  55. package/src/generateCode/generateFlowSchema/event/s3Component/upload/relate/S3/data.js +4 -4
  56. package/src/generateCode/generateFlowSchema/event/s3Component/upload/relate/sns-out/data.js +5 -3
  57. package/src/generateCode/generateFlowSchema/event/s3Component/websocket/dynamoDb/ReservedTableData.js +3 -3
  58. package/src/generateCode/generateFlowSchema/flowSchemaMainFunction/data.js +4 -8
  59. package/src/generateCode/generateFlowSchema/flowSchemaMainFunction/template.ejs +3 -5
  60. package/src/generateCode/generateFlowSchema/flowStep/flowStep.js +7 -2
  61. package/src/generateCode/generateFlowSchema/libs/data.js +3 -7
  62. package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/functionYaml/data.js +9 -9
  63. package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/handler/data.js +1 -5
  64. package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/index.js +6 -18
  65. package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/mainFunction/data.js +15 -14
  66. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/functionYaml/data.js +4 -8
  67. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/handler/data.js +15 -15
  68. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/mainFunction/data.js +15 -15
  69. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/index.js +13 -33
  70. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/functionYaml/data.js +4 -8
  71. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/handler/data.js +12 -14
  72. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/mainFunction/data.js +11 -14
  73. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/functionYaml/dsq/data.js +4 -9
  74. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/functionYaml/sqs/data.js +4 -9
  75. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/handler/dsq/data.js +11 -14
  76. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/handler/sqs/data.js +11 -14
  77. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/mainFunction/data.js +15 -15
  78. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheQueue/data.js +2 -3
  79. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/create/mainFunction/template.ejs +185 -103
  80. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/create/sns-out/data.js +2 -1
  81. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/delete/sns-out/data.js +2 -1
  82. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/get/sns-out/data.js +2 -1
  83. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/mainFunction/template.ejs +137 -71
  84. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/sns-out/data.js +2 -1
  85. package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/create/main/template.ejs +1 -1
  86. package/src/generateCode/generateSchema/actionEndpointComponent/yaml/data.js +6 -4
  87. package/src/generateCode/generateSchema/findDataComponent/mainFunction/data.js +1 -1
  88. package/src/generateCode/generateSchema/relationshipPerActionComponent/changeRelationship/complete/sns-out/data.js +2 -1
  89. package/src/generateCode/generateSchema/relationshipPerActionComponent/create/action/functionYaml/data.js +1 -0
  90. package/src/generateCode/generateSchema/relationshipPerActionComponent/create/complete/sns-out/data.js +2 -1
  91. package/src/generateCode/generateSchema/relationshipPerActionComponent/delete/action/functionYaml/data.js +1 -0
  92. package/src/generateCode/generateSchema/relationshipPerActionComponent/delete/complete/sns-out/data.js +2 -1
  93. package/src/generateCode/generateSchema/relationshipPerActionComponent/get/action/functionYaml/data.js +1 -0
  94. package/src/generateCode/generateSchema/relationshipPerActionComponent/get/complete/sns-out/data.js +2 -1
  95. package/src/generateCode/generateSchema/relationshipPerActionComponent/moveRelationship/complete/sns-out/data.js +2 -1
  96. package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/functionYaml/data.js +1 -0
  97. package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/sns-out/data.js +2 -1
  98. package/src/generateCode/generateSchema/relationshipPerActionComponent/update/complete/sns-out/data.js +2 -1
  99. package/src/generateCode/resourceYamlComponent/sns-out/data.js +2 -1
  100. package/src/generateCode/resourceYamlComponent/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +2 -1
  101. package/src/generateCode/resourceYamlComponent/sns-out/template.ejs +2 -6
  102. package/src/generateCode.js +9 -7
  103. package/src/libs/Consts.js +9 -12
  104. package/src/libs/Utils.js +26 -1
  105. package/src/__TemplateData/flowSchema/event/externalTopic/Process/handler/data.js +0 -64
  106. package/src/__TemplateData/flowSchema/event/externalTopic/sns-out/data.js +0 -75
@@ -39,7 +39,7 @@ const {
39
39
  createIamRole
40
40
  } = libs;
41
41
 
42
- const { firstLetterUpperCase: upperCase } = utils;
42
+ const { firstLetterUpperCase: upperCase, savePath } = utils;
43
43
 
44
44
  const templatePath = path.join(__dirname, 'template.ejs');
45
45
 
@@ -48,13 +48,13 @@ const templatePath = path.join(__dirname, 'template.ejs');
48
48
  *
49
49
  * @param {object} _izContext - Izara context object, carrying environment and configuration info.
50
50
  * @param {object} flowSchema - The schema object describing the flow; should at least contain `flowTag` and relevant route information.
51
- * @param {string} rootServicePath - The file path for saving or referencing generated source artifacts.
51
+ * @param {string} appPath - The file path for saving or referencing generated source artifacts.
52
52
  * @returns {Array<Object>} Array of objects, each containing:
53
53
  * - {string} templatePath: Path to the function EJS template.
54
54
  * - {Object} templateData: Data passed to EJS when generating the function yaml.
55
55
  * - {Object} setting: Save file and related parameters.
56
56
  */
57
- function createSourceParams(_izContext, flowSchema, rootServicePath) {
57
+ function createSourceParams(_izContext, flowSchema, appPath) {
58
58
  const additionalResourcePermission = defaultIamRolePerAction();
59
59
 
60
60
  additionalResourcePermission.push(
@@ -103,13 +103,10 @@ function createSourceParams(_izContext, flowSchema, rootServicePath) {
103
103
  return {
104
104
  templatePath: templatePath,
105
105
  templateData: {
106
- resourceLocation: path.join(
107
- SOURCE_PATH.resourceLocationFlowSchema,
108
- upperCase(flowSchema.flowTag),
109
- 'source/',
110
- upperCase(flowSchema.flowTag),
111
- upperCase('hdrWbs')
112
- ),
106
+ resourceLocation:
107
+ savePath.flowSchemaFlowTag(flowSchema.flowTag) +
108
+ upperCase(flowSchema.flowTag) +
109
+ upperCase('hdrWbs'),
113
110
  functionName: upperCase(flowSchema.flowTag),
114
111
  handlerType: upperCase('hdrWbs'),
115
112
  additionalResourcePermission,
@@ -119,7 +116,7 @@ function createSourceParams(_izContext, flowSchema, rootServicePath) {
119
116
  roleName: upperCase(flowSchema.flowTag)
120
117
  },
121
118
  setting: {
122
- savePath: path.join(rootServicePath, SOURCE_PATH.appYaml),
119
+ savePath: path.join(appPath, SOURCE_PATH.appYaml),
123
120
  saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
124
121
  fileExtension: '.yml',
125
122
  isAppend: true
@@ -36,7 +36,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
36
36
  * @return {{templatePath, templateData,setting}}
37
37
  */
38
38
 
39
- function createParamsForCreateSource(_izContext, flowSchema, rootServicePath) {
39
+ function createParamsForCreateSource(_izContext, flowSchema, appPath) {
40
40
  let functionName = upperCase(flowSchema.flowTag);
41
41
  let handlerType = 'HdrWbs';
42
42
  let route = flowSchema.flowTag;
@@ -49,7 +49,7 @@ function createParamsForCreateSource(_izContext, flowSchema, rootServicePath) {
49
49
  },
50
50
  setting: {
51
51
  savePath: path.join(
52
- rootServicePath,
52
+ appPath,
53
53
  SOURCE_PATH.flowSchema,
54
54
  upperCase(flowSchema.flowTag),
55
55
  'MainHandler/',
@@ -36,7 +36,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
36
36
  * @return {{templatePath, templateData,setting}}
37
37
  */
38
38
 
39
- function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
39
+ function createParamsForCreateSource(_izContext, flowSchema, appPath) {
40
40
  let functionName = upperCase(flowSchema.flowTag);
41
41
  let topicArn = `${upperCase(flowSchema.flowTag)}_In`;
42
42
 
@@ -49,7 +49,7 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
49
49
  },
50
50
  setting: {
51
51
  savePath: path.join(
52
- srcPath,
52
+ appPath,
53
53
  SOURCE_PATH.flowSchema,
54
54
  upperCase(flowSchema.flowTag),
55
55
  'MainHandler/',
@@ -9,38 +9,22 @@ import createFlowSchemaOwnTopicEndpointHandler from './endpointComponent/handler
9
9
  import createFlowSchemaOwnTopicQueue from './sns-in/data.js';
10
10
  import createFlowSchemaOwnTopicSnsOut from './sns-out/data.js';
11
11
 
12
- async function createOwnTopicComponent(
13
- _izContext,
14
- flowSchema,
15
- rootServicePath
16
- ) {
12
+ async function createOwnTopicComponent(_izContext, flowSchema, appPath) {
17
13
  const component = [
18
14
  // * OwnTopic
19
- createFlowSchemaOwnTopicFunctionYaml(
20
- _izContext,
21
- flowSchema,
22
- rootServicePath
23
- ),
24
- createFlowSchemaOwnTopicHandler(_izContext, flowSchema, rootServicePath),
25
- createFlowSchemaOwnTopicMainFunction(
26
- _izContext,
27
- flowSchema,
28
- rootServicePath
29
- ),
15
+ createFlowSchemaOwnTopicFunctionYaml(_izContext, flowSchema, appPath),
16
+ createFlowSchemaOwnTopicHandler(_izContext, flowSchema, appPath),
17
+ createFlowSchemaOwnTopicMainFunction(_izContext, flowSchema, appPath),
30
18
  // * Endpoint
31
19
  ...(await createFlowSchemaOwnTopicEndpointFunctionYaml(
32
20
  _izContext,
33
21
  flowSchema,
34
- rootServicePath
22
+ appPath
35
23
  )),
36
- ...createFlowSchemaOwnTopicEndpointHandler(
37
- _izContext,
38
- flowSchema,
39
- rootServicePath
40
- ),
24
+ ...createFlowSchemaOwnTopicEndpointHandler(_izContext, flowSchema, appPath),
41
25
  // * SNS Resources
42
- ...createFlowSchemaOwnTopicQueue(_izContext, flowSchema, rootServicePath),
43
- ...createFlowSchemaOwnTopicSnsOut(_izContext, flowSchema, rootServicePath)
26
+ ...createFlowSchemaOwnTopicQueue(_izContext, flowSchema, appPath),
27
+ ...createFlowSchemaOwnTopicSnsOut(_izContext, flowSchema, appPath)
44
28
  ];
45
29
 
46
30
  return component;
@@ -43,13 +43,13 @@ const subscriptionSqsTemplatePath = path.join(__dirname, './sqsTemplate.ejs');
43
43
  * @returns {Object[]} - data of multiple dynamoDb template
44
44
  */
45
45
 
46
- function createDataForDefaultSnsInSqs(_izContext, flowSchema, rootServicePath) {
46
+ function createDataForDefaultSnsInSqs(_izContext, flowSchema, appPath) {
47
47
  let resultsForCreateDefaultSnsInSqs = [];
48
48
  let flowSteps = Object.keys(flowSchema.flowSteps);
49
49
  // console.log("create topic by flowSteps", flowSteps)
50
50
  const setting = {
51
51
  initialData: 'Resources:\n',
52
- savePath: path.join(rootServicePath, SOURCE_PATH.resourceYaml),
52
+ savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
53
53
  saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
54
54
  fileExtension: '.yml',
55
55
  isAppend: true
@@ -42,7 +42,7 @@ const templatePath = path.join(
42
42
  * @returns {Object[]} - data of multiple dynamoDb template
43
43
  */
44
44
 
45
- function createDataForSnsOut(_izContext, flowSchema, rootServicePath) {
45
+ function createDataForSnsOut(_izContext, flowSchema, appPath) {
46
46
  const resultsForCreateDefaultSnsInSqs = [];
47
47
 
48
48
  const generatedSnsTopicOutForFlowSchema = [];
@@ -61,10 +61,11 @@ function createDataForSnsOut(_izContext, flowSchema, rootServicePath) {
61
61
  templateData: defaultSnsOutData,
62
62
  setting: {
63
63
  initialData: 'Resources:\n',
64
- savePath: path.join(rootServicePath, SOURCE_PATH.resourceYaml),
64
+ savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
65
65
  saveFileName: SAVE_FILE_NAME.snsOutYaml,
66
66
  fileExtension: '.yml',
67
- isAppend: true
67
+ isAppend: true,
68
+ fromFile: 'ownTopic/sns-out/data.js'
68
69
  }
69
70
  });
70
71
  }
@@ -30,20 +30,20 @@ const { createFlowTypeConcat } = coreUtils;
30
30
  import consts from '#libs/Consts.js';
31
31
  import utils from '#libs/Utils.js';
32
32
  const { SOURCE_PATH, STORAGE_TYPES } = consts;
33
- const { firstLetterUpperCase: upperCase, getLocalConfig } = utils;
33
+ const { firstLetterUpperCase: upperCase, getLocalConfig, savePath } = utils;
34
34
 
35
35
  const templatePath = path.join(__dirname, 'template.ejs');
36
36
  const statusFieldTemplate = path.join(
37
37
  __dirname,
38
- '../templateByStatusType/statusFieldTemplate.ejs'
38
+ './templateByStatusType/statusFieldTemplate.ejs'
39
39
  );
40
40
  const storedCacheTemplate = path.join(
41
41
  __dirname,
42
- '../templateByStatusType/storedCacheTemplate.ejs'
42
+ './templateByStatusType/storedCacheTemplate.ejs'
43
43
  );
44
44
  const triggerCacheTemplate = path.join(
45
45
  __dirname,
46
- '../templateByStatusType/triggerCacheTemplate.ejs'
46
+ './templateByStatusType/triggerCacheTemplate.ejs'
47
47
  );
48
48
 
49
49
  /**
@@ -53,7 +53,7 @@ const triggerCacheTemplate = path.join(
53
53
  * @param {Object} objectSchema
54
54
  * @return {{templatePath, templateData,setting}}
55
55
  */
56
- async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
56
+ async function createParamsForCreateSource(_izContext, flowSchema, appPath) {
57
57
  let functionName = 'Process' + upperCase(flowSchema.flowTag);
58
58
  let tableName = null;
59
59
  if (
@@ -64,7 +64,7 @@ async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
64
64
  .getLocalObjectSchemas(
65
65
  _izContext,
66
66
  [flowSchema.objType.objectType],
67
- path.join(srcPath, './schemas')
67
+ path.join(appPath, 'src/schemas')
68
68
  )
69
69
  .then(res => res.records[0]);
70
70
  if (!objectSchema)
@@ -102,12 +102,14 @@ async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
102
102
  queueName: `${createFlowTypeConcat(_izContext, { serviceTag: getLocalConfig('iz_serviceTag'), flowTag: upperCase(flowSchema.flowTag) })}_Main`
103
103
  },
104
104
  setting: {
105
- savePath: path.join(
106
- srcPath,
107
- SOURCE_PATH.flowSchema,
108
- upperCase(flowSchema.flowTag),
109
- 'source/'
110
- ),
105
+ savePath:
106
+ // path.join(
107
+ // appPath,
108
+ // SOURCE_PATH.flowSchema,
109
+ // upperCase(flowSchema.flowTag),
110
+ // 'source/'
111
+ // ),
112
+ savePath.resourceYamlFlowSchemaFlowTag(appPath, flowSchema.flowTag),
111
113
  saveFileName: `${functionName}_Main`,
112
114
  fileExtension: '.js',
113
115
  isAppend: false
@@ -16,8 +16,6 @@ along with this program. If not, see
16
16
  <http: //www.gnu.org/licenses />.
17
17
  */
18
18
 
19
-
20
-
21
19
  import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
22
20
  import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
23
21
  import snsSharedLib from '@izara_project/izara-core-library-sns';
@@ -27,7 +25,7 @@ import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow
27
25
  import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
28
26
  import { lambda,sns,sqs } from '@izara_project/izara-core-library-external-request';
29
27
  import { NoRetryError } from '@izara_project/izara-core-library-core';
30
- import { utils} from '@izara_project/izara-core-library-service-schemas';
28
+ import { utils } from '@izara_project/izara-core-library-service-schemas';
31
29
  const { createFlowTypeConcat } = utils;
32
30
  <% if (statusType === "triggerCache") { -%>
33
31
  import { triggeredCacheSharedLibV2 } from '@izara_project/izara-core-library-trigger-cache';
@@ -68,18 +66,17 @@ export default async function <%- functionName %> (
68
66
  _izContext.logger.debug("<%- functionName %> callingFlowConfig", callingFlowConfig)
69
67
 
70
68
  <% if (statusType === "statusField") { %>
71
- <%- include(statusFieldTemplate, { tableName:tableName, flowTag: flowTag }) %>
69
+ <% include(statusFieldTemplate, { tableName:tableName, flowTag: flowTag }) %>
72
70
  <% } else if (statusType === "storedCache") { %>
73
- <%- include(storedCacheTemplate, { tableName:tableName, flowSchemaComplete:flowSchemaComplete,flowTag }) %>
74
-
71
+ <% include(storedCacheTemplate, { tableName:tableName, flowSchemaComplete:flowSchemaComplete, flowTag }) %>
75
72
  <% } else if (statusType === "triggerCache") { %>
76
- <%- include(triggerCacheTemplate, {
73
+ <% include(triggerCacheTemplate, {
77
74
  tableName: tableName,
78
75
  flowSchemaComplete: flowSchemaComplete,
79
76
  triggerType: triggerType,
80
77
  flowTag,
81
78
  queueName
82
- }) %>
79
+ }) %>
83
80
  <% } %>
84
81
 
85
82
  //(<endpointHook>)
@@ -0,0 +1,30 @@
1
+ //(<beforeCheckedStatusField>)
2
+ //(</beforeCheckedStatusField>)
3
+
4
+ let [status, flowStatusFieldRecord] = await statusFieldSharedLib.checkStatusField(
5
+ _izContext,
6
+ {
7
+ flowTag: "<%- flowTag %>",
8
+ serviceTag: process.env.iz_serviceTag
9
+ },
10
+ {
11
+ //(<identifiers>)
12
+ //(</identifiers>)
13
+ },
14
+ //(<errorsFounds>)
15
+ //(<errorsFounds>)
16
+ //(<overwriteUniqueRequestId>)
17
+ //(</overwriteUniqueRequestId>)
18
+ )
19
+
20
+ //(<afterCheckStatusField>)
21
+ //(</afterCheckStatusField>)
22
+
23
+ if (status !== "process") {
24
+ if (status === "error" || status === "complete") {
25
+ //(<afterValidateStatusField>)
26
+ //(</afterValidateStatusField>)
27
+ }
28
+ //(<checkStatusFieldHook>)
29
+ //(</checkStatusFieldHook>)
30
+ }
@@ -0,0 +1,26 @@
1
+ let [ cacheMainStatus, cacheMain, cacheExist ] = await storedCacheSharedLib.checkStoredCacheStatus(
2
+ _izContext,
3
+ "<%- tableName %>",
4
+ {
5
+ //(<keyValueStoredCacheTable>)
6
+ //(</keyValueStoredCacheTable>)
7
+ },
8
+ //(<additionalAttributesWhenCreateStoredCache>)
9
+ //(</additionalAttributesWhenCreateStoredCache>),
10
+ createFlowTypeConcat(_izContext,{flowTag: "<%- flowTag %>", serviceTag: process.env.iz_serviceTag}),
11
+ //(<storedCacheConfig>)
12
+ //(</storedCacheConfig>)
13
+ )
14
+
15
+ //(<afterCheckStoredCache>)
16
+ //(</afterCheckStoredCache>)
17
+
18
+ if (cacheMainStatus !== "process") {
19
+ if (cacheMainStatus === "error" || cacheMainStatus === "complete") {
20
+ //(<afterValidateStoredCacheStatus>)
21
+ //(</afterValidateStoredCacheStatus>)
22
+ }
23
+
24
+ //(<checkStoredCacheHook>)
25
+ //(</checkStoredCacheHook>)
26
+ }
@@ -0,0 +1,44 @@
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
+
19
+ //(<afterCheckTriggerCache>)
20
+ //(</afterCheckTriggerCache>)
21
+
22
+ if (triggerCacheStatus !== "process") {
23
+ if (triggerCacheStatus === "error" || triggerCacheStatus === "complete") {
24
+ //(<afterValidateTriggerCacheStatus>)
25
+ //(</afterValidateTriggerCacheStatus>)
26
+ }
27
+ //(<checkTriggerCacheHook>)
28
+ //(</checkTriggerCacheHook>)
29
+
30
+ // send message to ProcessTriggerCache
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)
@@ -32,78 +32,46 @@ import createSnsTopicForUploadS3 from './upload/relate/sns-out/data.js';
32
32
  //
33
33
  import createFlowSchemaEndpointMainFunction from './flowSchemaMainFunction/data.js';
34
34
 
35
- async function createS3Component(_izContext, flowSchema, saveFilePath) {
35
+ async function createS3Component(_izContext, flowSchema, appPath) {
36
36
  const component = [
37
37
  // * Create Object WebSocket
38
- ...createFunctionYamlCreateObjectWebSocket(
39
- _izContext,
40
- flowSchema,
41
- saveFilePath
42
- ),
43
- ...createHandlerCreateObjectWebSocket(_izContext, flowSchema, saveFilePath),
44
- ...createMainFunctionCreateObjectWebSocket(
45
- _izContext,
46
- flowSchema,
47
- saveFilePath
48
- ),
38
+ createFunctionYamlCreateObjectWebSocket(_izContext, flowSchema, appPath),
39
+ createHandlerCreateObjectWebSocket(_izContext, flowSchema, appPath),
40
+ createMainFunctionCreateObjectWebSocket(_izContext, flowSchema, appPath),
49
41
 
50
42
  // * PreSigned URL WebSocket
51
43
  // reservedLimit
52
- ...(await createReservedLimitFunctionYaml(
53
- _izContext,
54
- flowSchema,
55
- saveFilePath
56
- )),
57
- ...createReservedLimitHandler(_izContext, flowSchema, saveFilePath),
58
- ...createReservedLimitMainFunction(_izContext, flowSchema, saveFilePath),
59
- ...createReservedLimitQueueName(_izContext, saveFilePath),
44
+ await createReservedLimitFunctionYaml(_izContext, flowSchema, appPath),
45
+ createReservedLimitHandler(_izContext, flowSchema, appPath),
46
+ createReservedLimitMainFunction(_izContext, flowSchema, appPath),
47
+ ...createReservedLimitQueueName(_izContext, appPath),
60
48
 
61
49
  // createPreSignUrl
62
- ...createPreSignUrlFunctionYaml(_izContext, flowSchema, saveFilePath),
63
- ...createPreSignUrlHandler(_izContext, flowSchema, saveFilePath),
64
- ...createPreSignUrlMainFunction(_izContext, flowSchema, saveFilePath),
65
- ...createPreSignUrlQueueName(_izContext, saveFilePath),
50
+ createPreSignUrlFunctionYaml(_izContext, flowSchema, appPath),
51
+ createPreSignUrlHandler(_izContext, flowSchema, appPath),
52
+ createPreSignUrlMainFunction(_izContext, flowSchema, appPath),
53
+ ...createPreSignUrlQueueName(_izContext, appPath),
66
54
 
67
55
  // * Process After Upload S3
68
- ...createProcessAfterUploadS3FunctionYmlS3(
69
- _izContext,
70
- flowSchema,
71
- saveFilePath
72
- ),
73
- ...createProcessAfterUploadS3HandlerS3(
74
- _izContext,
75
- flowSchema,
76
- saveFilePath
77
- ),
78
- ...createProcessAfterUploadS3MainFunction(
79
- _izContext,
80
- flowSchema,
81
- saveFilePath
82
- ),
56
+ createProcessAfterUploadS3FunctionYmlS3(_izContext, flowSchema, appPath),
57
+ createProcessAfterUploadS3HandlerS3(_izContext, flowSchema, appPath),
58
+ createProcessAfterUploadS3MainFunction(_izContext, flowSchema, appPath),
83
59
 
84
60
  // * confirm After Upload S3
85
- ...createConfirmAfterUploadS3FunctionYaml(
86
- _izContext,
87
- flowSchema,
88
- saveFilePath
89
- ),
90
- ...createConfirmAfterUploadS3Handler(_izContext, flowSchema, saveFilePath),
91
- ...createConfirmAfterUploadS3MainFunction(
92
- _izContext,
93
- flowSchema,
94
- saveFilePath
95
- ),
96
- ...createConfirmAfterUploadS3Queue(_izContext, saveFilePath),
61
+ createConfirmAfterUploadS3FunctionYaml(_izContext, flowSchema, appPath),
62
+ createConfirmAfterUploadS3Handler(_izContext, flowSchema, appPath),
63
+ createConfirmAfterUploadS3MainFunction(_izContext, flowSchema, appPath),
64
+ ...createConfirmAfterUploadS3Queue(_izContext, appPath),
97
65
 
98
66
  // * Relate Resources
99
- ...createBucketS3(_izContext, flowSchema, saveFilePath),
67
+ createBucketS3(_izContext, flowSchema, appPath),
100
68
 
101
69
  // * Other Resources
102
- ...createReservedDataMainTable(_izContext, saveFilePath),
103
- ...createSnsTopicForUploadS3(_izContext, flowSchema, saveFilePath),
70
+ ...createReservedDataMainTable(_izContext, appPath),
71
+ ...createSnsTopicForUploadS3(_izContext, flowSchema, appPath),
104
72
 
105
73
  //
106
- createFlowSchemaEndpointMainFunction(_izContext, flowSchema, saveFilePath)
74
+ await createFlowSchemaEndpointMainFunction(_izContext, flowSchema, appPath)
107
75
  ];
108
76
 
109
77
  return component.flat();
@@ -55,11 +55,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
55
55
  * @return {{ templatePath, templateData, setting } }
56
56
  */
57
57
 
58
- function data(_izContext, flowSchema, srcPath) {
59
- return [createSourceParams(_izContext, flowSchema, srcPath)];
60
- }
61
-
62
- function createSourceParams(_izContext, flowSchema, srcPath) {
58
+ function createSourceParams(_izContext, flowSchema, appPath) {
63
59
  let functionName = 'ConfirmNewReserved';
64
60
  let handlerType = upperCase(HANDLER.hdrSqs);
65
61
  let additionalResourcePermission = defaultIamRolePerAction();
@@ -123,11 +119,11 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
123
119
  },
124
120
  setting: {
125
121
  saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
126
- savePath: path.join(srcPath, SOURCE_PATH.appYaml),
122
+ savePath: path.join(appPath, SOURCE_PATH.appYaml),
127
123
  fileExtension: '.yml',
128
124
  isAppend: true
129
125
  }
130
126
  };
131
127
  }
132
128
 
133
- export default data;
129
+ export default createSourceParams;
@@ -36,11 +36,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
36
36
  * @return {{ templatePath, templateData, setting } }
37
37
  */
38
38
 
39
- function data(_izContext, flowSchema, srcPath) {
40
- return [createSourceParams(_izContext, flowSchema, srcPath)];
41
- }
42
-
43
- function createSourceParams(_izContext, flowSchema, srcPath) {
39
+ function createSourceParams(_izContext, flowSchema, appPath) {
44
40
  let functionName = 'ConfirmNewReserved';
45
41
  let handlerType = upperCase(HANDLER.hdrSqs);
46
42
 
@@ -53,7 +49,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
53
49
  setting: {
54
50
  saveFileName: `${functionName}_${handlerType}`,
55
51
  savePath: path.join(
56
- srcPath,
52
+ appPath,
57
53
  SOURCE_PATH.webSocket,
58
54
  flowSchema.flowTag,
59
55
  'source/'
@@ -64,4 +60,4 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
64
60
  };
65
61
  }
66
62
 
67
- export default data;
63
+ export default createSourceParams;
@@ -32,11 +32,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
32
32
  * @return {{ templatePath, templateData, setting } }
33
33
  */
34
34
 
35
- function data(_izContext, flowSchema, srcPath) {
36
- return [createSourceParams(_izContext, flowSchema, srcPath)];
37
- }
38
-
39
- function createSourceParams(_izContext, flowSchema, srcPath) {
35
+ function createSourceParams(_izContext, flowSchema, appPath) {
40
36
  let functionName = 'ConfirmNewReserved';
41
37
  return {
42
38
  templatePath: templatePath,
@@ -44,7 +40,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
44
40
  setting: {
45
41
  saveFileName: `${functionName}_Main`,
46
42
  savePath: path.join(
47
- srcPath,
43
+ appPath,
48
44
  SOURCE_PATH.webSocket,
49
45
  flowSchema.flowTag,
50
46
  'source/'
@@ -55,4 +51,4 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
55
51
  };
56
52
  }
57
53
 
58
- export default data;
54
+ export default createSourceParams;
@@ -36,12 +36,12 @@ const templatePath = path.join(__dirname, 'template.ejs');
36
36
  * @returns {Object[]} - data of multiple dynamoDb template
37
37
  */
38
38
 
39
- function data(_izContext, srcPath) {
39
+ function data(_izContext, appPath) {
40
40
  let resultForCreateSqs = [];
41
41
  const WebSocketSqsQueueNames = [];
42
42
  const setting = {
43
43
  initialData: 'Resources:\n',
44
- savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
44
+ savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
45
45
  saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
46
46
  fileExtension: '.yml',
47
47
  isAppend: true
@@ -53,11 +53,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
53
53
  * @return {{templatePath, templateData,setting}}
54
54
  */
55
55
 
56
- function data(_izContext, flowSchema, srcPath) {
57
- return [createSourceParams(_izContext, flowSchema, srcPath)];
58
- }
59
-
60
- function createSourceParams(_izContext, flowSchema, srcPath) {
56
+ function createSourceParams(_izContext, flowSchema, appPath) {
61
57
  let functionName = upperCase(FUNCTION_NAME.createObjectS3);
62
58
  let handlerType = upperCase('hdrWbs');
63
59
  let additionalResourcePermission = defaultIamRolePerAction();
@@ -110,7 +106,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
110
106
  roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaUploadS3Role
111
107
  },
112
108
  setting: {
113
- savePath: path.join(srcPath, SOURCE_PATH.appYaml),
109
+ savePath: path.join(appPath, SOURCE_PATH.appYaml),
114
110
  saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
115
111
  fileExtension: '.yml',
116
112
  isAppend: true
@@ -118,4 +114,4 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
118
114
  };
119
115
  }
120
116
 
121
- export default data;
117
+ export default createSourceParams;
@@ -37,11 +37,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
37
37
  * @return {{templatePath, templateData,setting}}
38
38
  */
39
39
 
40
- function data(_izContext, flowSchema, srcPath) {
41
- return [createParamsForCreateSource(_izContext, flowSchema, srcPath)];
42
- }
43
-
44
- function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
40
+ function createParamsForCreateSource(_izContext, flowSchema, appPath) {
45
41
  let functionName = upperCase(FUNCTION_NAME.createObjectS3);
46
42
  let handlerType = 'HdrWbs';
47
43
  let route = flowSchema.flowTag;
@@ -54,7 +50,7 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
54
50
  },
55
51
  setting: {
56
52
  savePath: path.join(
57
- srcPath,
53
+ appPath,
58
54
  SOURCE_PATH.webSocket,
59
55
  flowSchema.flowTag,
60
56
  'source/'
@@ -65,4 +61,4 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
65
61
  }
66
62
  };
67
63
  }
68
- export default data;
64
+ export default createParamsForCreateSource;