@izara_project/izara-core-generate-service-code 1.0.23 → 1.0.25

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 (79) hide show
  1. package/package.json +1 -1
  2. package/src/generateCode/generateFlowSchema/GenerateCodeFlowSchema.js +10 -7
  3. package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/functionYaml/template.ejs +3 -10
  4. package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/handler/inv/data.js +2 -1
  5. package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/handler/inv/template.ejs +8 -15
  6. package/src/generateCode/generateFlowSchema/event/extTopicComponent/index.js +1 -1
  7. package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/functionYaml/data.js +2 -6
  8. package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/functionYaml/template.ejs +4 -11
  9. package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/handler/template.ejs +2 -2
  10. package/src/generateCode/generateFlowSchema/event/extTopicComponent/sns-out/data.js +2 -1
  11. package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/data.js +1 -5
  12. package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/template.ejs +12 -21
  13. package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/handler/template.ejs +1 -3
  14. package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/data.js +9 -7
  15. package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/template.ejs +3 -10
  16. package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/handler/template.ejs +1 -1
  17. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/functionYaml/data.js +1 -0
  18. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/handler/DsqHandlerTemplate.ejs +2 -2
  19. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/handler/SqsHandlerTemplate.ejs +2 -2
  20. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/functionYaml/data.js +5 -8
  21. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/sns-out/data.js +2 -1
  22. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/data.js +12 -10
  23. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/template.ejs +6 -9
  24. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/statusFieldTemplate.ejs +30 -0
  25. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/storedCacheTemplate.ejs +26 -0
  26. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/triggerCacheTemplate.ejs +44 -0
  27. package/src/generateCode/generateFlowSchema/event/s3Component/index.js +17 -17
  28. package/src/generateCode/generateFlowSchema/event/s3Component/upload/confirmReserved/handler/data.js +1 -1
  29. package/src/generateCode/generateFlowSchema/event/s3Component/upload/relate/sns-out/data.js +3 -1
  30. package/src/generateCode/generateFlowSchema/event/s3Component/websocket/dynamoDb/ReservedTableData.js +1 -1
  31. package/src/generateCode/generateFlowSchema/flowSchemaMainFunction/template.ejs +4 -6
  32. package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/functionYaml/data.js +9 -9
  33. package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/handler/data.js +1 -5
  34. package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/index.js +6 -18
  35. package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/mainFunction/data.js +15 -14
  36. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/functionYaml/data.js +4 -8
  37. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/handler/data.js +15 -15
  38. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/mainFunction/data.js +15 -15
  39. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/index.js +13 -33
  40. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/functionYaml/data.js +4 -8
  41. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/handler/data.js +12 -14
  42. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/mainFunction/data.js +11 -14
  43. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/functionYaml/dsq/data.js +4 -9
  44. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/functionYaml/sqs/data.js +4 -9
  45. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/handler/dsq/data.js +11 -14
  46. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/handler/sqs/data.js +11 -14
  47. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/mainFunction/data.js +15 -15
  48. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheQueue/data.js +2 -3
  49. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/create/mainFunction/template.ejs +185 -103
  50. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/create/sns-out/data.js +2 -1
  51. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/delete/sns-out/data.js +2 -1
  52. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/get/sns-out/data.js +2 -1
  53. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/mainFunction/template.ejs +137 -71
  54. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/sns-out/data.js +2 -1
  55. package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/beforeLogical/template.ejs +14 -6
  56. package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/create/main/template.ejs +21 -3
  57. package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/delete/main/template.ejs +24 -4
  58. package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/update/main/template.ejs +25 -4
  59. package/src/generateCode/generateSchema/actionEndpointComponent/yaml/data.js +6 -4
  60. package/src/generateCode/generateSchema/findDataComponent/mainFunction/data.js +1 -1
  61. package/src/generateCode/generateSchema/relationshipPerActionComponent/changeRelationship/complete/sns-out/data.js +2 -1
  62. package/src/generateCode/generateSchema/relationshipPerActionComponent/create/action/functionYaml/data.js +1 -0
  63. package/src/generateCode/generateSchema/relationshipPerActionComponent/create/complete/sns-out/data.js +2 -1
  64. package/src/generateCode/generateSchema/relationshipPerActionComponent/delete/action/functionYaml/data.js +1 -0
  65. package/src/generateCode/generateSchema/relationshipPerActionComponent/delete/complete/sns-out/data.js +2 -1
  66. package/src/generateCode/generateSchema/relationshipPerActionComponent/get/action/functionYaml/data.js +1 -0
  67. package/src/generateCode/generateSchema/relationshipPerActionComponent/get/complete/sns-out/data.js +2 -1
  68. package/src/generateCode/generateSchema/relationshipPerActionComponent/moveRelationship/complete/sns-out/data.js +2 -1
  69. package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/functionYaml/data.js +1 -0
  70. package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/sns-out/data.js +2 -1
  71. package/src/generateCode/generateSchema/relationshipPerActionComponent/update/complete/mainFunction/template.ejs +1 -1
  72. package/src/generateCode/generateSchema/relationshipPerActionComponent/update/complete/sns-out/data.js +2 -1
  73. package/src/generateCode/resourceYamlComponent/sns-out/data.js +2 -1
  74. package/src/generateCode/resourceYamlComponent/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +2 -1
  75. package/src/generateCode/resourceYamlComponent/sns-out/template.ejs +2 -6
  76. package/src/generateCode.js +9 -7
  77. package/src/libs/Utils.js +26 -1
  78. package/src/__TemplateData/flowSchema/event/externalTopic/Process/handler/data.js +0 -64
  79. package/src/__TemplateData/flowSchema/event/externalTopic/sns-out/data.js +0 -75
@@ -35,43 +35,43 @@ import createFlowSchemaEndpointMainFunction from './flowSchemaMainFunction/data.
35
35
  async function createS3Component(_izContext, flowSchema, appPath) {
36
36
  const component = [
37
37
  // * Create Object WebSocket
38
- ...createFunctionYamlCreateObjectWebSocket(_izContext, flowSchema, appPath),
39
- ...createHandlerCreateObjectWebSocket(_izContext, flowSchema, appPath),
40
- ...createMainFunctionCreateObjectWebSocket(_izContext, flowSchema, appPath),
38
+ createFunctionYamlCreateObjectWebSocket(_izContext, flowSchema, appPath),
39
+ createHandlerCreateObjectWebSocket(_izContext, flowSchema, appPath),
40
+ createMainFunctionCreateObjectWebSocket(_izContext, flowSchema, appPath),
41
41
 
42
42
  // * PreSigned URL WebSocket
43
43
  // reservedLimit
44
- ...(await createReservedLimitFunctionYaml(_izContext, flowSchema, appPath)),
45
- ...createReservedLimitHandler(_izContext, flowSchema, appPath),
46
- ...createReservedLimitMainFunction(_izContext, flowSchema, appPath),
44
+ await createReservedLimitFunctionYaml(_izContext, flowSchema, appPath),
45
+ createReservedLimitHandler(_izContext, flowSchema, appPath),
46
+ createReservedLimitMainFunction(_izContext, flowSchema, appPath),
47
47
  ...createReservedLimitQueueName(_izContext, appPath),
48
48
 
49
49
  // createPreSignUrl
50
- ...createPreSignUrlFunctionYaml(_izContext, flowSchema, appPath),
51
- ...createPreSignUrlHandler(_izContext, flowSchema, appPath),
52
- ...createPreSignUrlMainFunction(_izContext, flowSchema, appPath),
50
+ createPreSignUrlFunctionYaml(_izContext, flowSchema, appPath),
51
+ createPreSignUrlHandler(_izContext, flowSchema, appPath),
52
+ createPreSignUrlMainFunction(_izContext, flowSchema, appPath),
53
53
  ...createPreSignUrlQueueName(_izContext, appPath),
54
54
 
55
55
  // * Process After Upload S3
56
- ...createProcessAfterUploadS3FunctionYmlS3(_izContext, flowSchema, appPath),
57
- ...createProcessAfterUploadS3HandlerS3(_izContext, flowSchema, appPath),
58
- ...createProcessAfterUploadS3MainFunction(_izContext, flowSchema, appPath),
56
+ createProcessAfterUploadS3FunctionYmlS3(_izContext, flowSchema, appPath),
57
+ createProcessAfterUploadS3HandlerS3(_izContext, flowSchema, appPath),
58
+ createProcessAfterUploadS3MainFunction(_izContext, flowSchema, appPath),
59
59
 
60
60
  // * confirm After Upload S3
61
- ...createConfirmAfterUploadS3FunctionYaml(_izContext, flowSchema, appPath),
62
- ...createConfirmAfterUploadS3Handler(_izContext, flowSchema, appPath),
63
- ...createConfirmAfterUploadS3MainFunction(_izContext, flowSchema, appPath),
61
+ createConfirmAfterUploadS3FunctionYaml(_izContext, flowSchema, appPath),
62
+ createConfirmAfterUploadS3Handler(_izContext, flowSchema, appPath),
63
+ createConfirmAfterUploadS3MainFunction(_izContext, flowSchema, appPath),
64
64
  ...createConfirmAfterUploadS3Queue(_izContext, appPath),
65
65
 
66
66
  // * Relate Resources
67
- ...createBucketS3(_izContext, flowSchema, appPath),
67
+ createBucketS3(_izContext, flowSchema, appPath),
68
68
 
69
69
  // * Other Resources
70
70
  ...createReservedDataMainTable(_izContext, appPath),
71
71
  ...createSnsTopicForUploadS3(_izContext, flowSchema, appPath),
72
72
 
73
73
  //
74
- createFlowSchemaEndpointMainFunction(_izContext, flowSchema, appPath)
74
+ await createFlowSchemaEndpointMainFunction(_izContext, flowSchema, appPath)
75
75
  ];
76
76
 
77
77
  return component.flat();
@@ -49,7 +49,7 @@ function createSourceParams(_izContext, flowSchema, appPath) {
49
49
  setting: {
50
50
  saveFileName: `${functionName}_${handlerType}`,
51
51
  savePath: path.join(
52
- appPAth,
52
+ appPath,
53
53
  SOURCE_PATH.webSocket,
54
54
  flowSchema.flowTag,
55
55
  'source/'
@@ -58,10 +58,12 @@ function createDataForDefaultSnsOut(_izContext, flowSchema, appPath) {
58
58
  savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
59
59
  saveFileName: SAVE_FILE_NAME.snsOutYaml,
60
60
  fileExtension: '.yml',
61
- isAppend: true
61
+ isAppend: true,
62
+ fromFile: 's3/sns-out/data.js'
62
63
  }
63
64
  });
64
65
  }
66
+
65
67
  return resultsForCreateDefaultSnsOut;
66
68
  }
67
69
 
@@ -26,7 +26,7 @@ const { SOURCE_PATH, SAVE_FILE_NAME } = consts;
26
26
 
27
27
  const templatePath = path.join(
28
28
  __dirname,
29
- '../../../../../resourceYaml/dynamodb/template.ejs'
29
+ '../../../../../resourceYamlComponent/dynamodb/template.ejs'
30
30
  );
31
31
 
32
32
  function data(_izContext, appPath) {
@@ -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';
@@ -29,6 +27,7 @@ import { lambda,sns,sqs } from '@izara_project/izara-core-library-external-reque
29
27
  import { NoRetryError } from '@izara_project/izara-core-library-core';
30
28
  import { utils} from '@izara_project/izara-core-library-service-schemas';
31
29
  const { createFlowTypeConcat } = utils;
30
+
32
31
  <% if (statusType === "triggerCache") { -%>
33
32
  import { triggeredCacheSharedLibV2 } from '@izara_project/izara-core-library-trigger-cache';
34
33
  <% } else if (statusType === "statusField") { -%>
@@ -57,9 +56,9 @@ import storedCacheSharedLib from '@izara_project/izara-core-library-stored-cache
57
56
  export default async function <%- functionName %> (
58
57
  _izContext,
59
58
  requestParams,
59
+ callingFlowConfig = {},
60
60
  //(<additionalParams>)
61
61
  //(</additionalParams>)
62
- callingFlowConfig = {},
63
62
  ) {
64
63
 
65
64
  try {
@@ -70,8 +69,7 @@ export default async function <%- functionName %> (
70
69
  <% if (statusType === "statusField") { %>
71
70
  <%- include(statusFieldTemplate, { tableName:tableName, flowTag: flowTag }) %>
72
71
  <% } else if (statusType === "storedCache") { %>
73
- <%- include(storedCacheTemplate, { tableName:tableName, flowSchemaComplete:flowSchemaComplete,flowTag }) %>
74
-
72
+ <%- include(storedCacheTemplate, { tableName:tableName, flowSchemaComplete:flowSchemaComplete, flowTag }) %>
75
73
  <% } else if (statusType === "triggerCache") { %>
76
74
  <%- include(triggerCacheTemplate, {
77
75
  tableName: tableName,
@@ -79,7 +77,7 @@ export default async function <%- functionName %> (
79
77
  triggerType: triggerType,
80
78
  flowTag,
81
79
  queueName
82
- }) %>
80
+ }) %>
83
81
  <% } %>
84
82
 
85
83
  //(<endpointHook>)
@@ -59,17 +59,15 @@ const templatePath = path.join(__dirname, 'template.ejs');
59
59
  * @return {{templatePath, templateData,setting}}
60
60
  */
61
61
 
62
- async function data(_izContext, flowSchema, srcPath) {
63
- return [await createSourceParams(_izContext, flowSchema, srcPath)];
64
- }
65
-
66
- async function createSourceParams(_izContext, flowSchema, srcPath) {
62
+ async function createSourceParams(_izContext, flowSchema, appPath) {
67
63
  let functionName = 'CompleteStatusField' + upperCase(flowSchema.flowTag);
68
64
  let handlerType = upperCase(HANDLER.hdrSqs);
69
65
  let additionalResourcePermission = defaultIamRolePerAction();
70
66
  let queueName =
71
67
  'CompleteStatusField' + upperCase(flowSchema.flowTag) + handlerType;
72
- let serviceTag = getLocalConfig(path.join(srcPath, '../'), 'iz_serviceTag');
68
+ const serviceTag = getLocalConfig('iz_serviceTag');
69
+ console.debug('########################## serviceTag: ', serviceTag);
70
+
73
71
  additionalResourcePermission.push(
74
72
  createIamRole(
75
73
  {
@@ -90,7 +88,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
90
88
  .getLocalObjectSchemasWithHierarchy(
91
89
  _izContext,
92
90
  [flowSchema.objType.objectType],
93
- path.join(srcPath, './schemas')
91
+ path.join(appPath, './schemas')
94
92
  )
95
93
  .then(res => res.records[0]);
96
94
  } else {
@@ -99,6 +97,8 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
99
97
  _izContext,
100
98
  flowSchema.objType
101
99
  );
100
+
101
+ console.debug('### objectSchema: ', objectSchema);
102
102
  }
103
103
  if (!objectSchema) {
104
104
  throw new NoRetryError('ObjectSchema not found');
@@ -140,7 +140,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
140
140
  queueName
141
141
  },
142
142
  setting: {
143
- savePath: path.join(srcPath, SOURCE_PATH.appYaml),
143
+ savePath: path.join(appPath, SOURCE_PATH.appYaml),
144
144
  saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
145
145
  fileExtension: '.yml',
146
146
  isAppend: true
@@ -148,4 +148,4 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
148
148
  };
149
149
  }
150
150
 
151
- export default data;
151
+ export default createSourceParams;
@@ -36,10 +36,6 @@ 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
39
  function createSourceParams(_izContext, flowSchema, srcPath) {
44
40
  let functionName = 'CompleteStatusField' + upperCase(flowSchema.flowTag);
45
41
  let handlerType = upperCase(HANDLER.hdrSqs);
@@ -66,4 +62,4 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
66
62
  };
67
63
  }
68
64
 
69
- export default data;
65
+ export default createSourceParams;
@@ -3,28 +3,16 @@ import createCompleteStatusFieldFunctionYaml from './functionYaml/data.js';
3
3
  import createCompleteStatusFieldHandler from './handler/data.js';
4
4
  import createCompleteStatusFieldTopicAndQueue from './sns/data.js';
5
5
 
6
- async function createStatusFieldComponent(
7
- _izContext,
8
- flowSchema,
9
- saveFilePath
10
- ) {
6
+ async function createStatusFieldComponent(_izContext, flowSchema, appPath) {
11
7
  const component = [
12
- ...createCompleteStatusFieldMainFunction(
8
+ createCompleteStatusFieldMainFunction(_izContext, flowSchema, appPath),
9
+ await createCompleteStatusFieldFunctionYaml(
13
10
  _izContext,
14
11
  flowSchema,
15
- saveFilePath
12
+ appPath
16
13
  ),
17
- ...(await createCompleteStatusFieldFunctionYaml(
18
- _izContext,
19
- flowSchema,
20
- saveFilePath
21
- )),
22
- ...createCompleteStatusFieldHandler(_izContext, flowSchema, saveFilePath),
23
- ...createCompleteStatusFieldTopicAndQueue(
24
- _izContext,
25
- flowSchema,
26
- saveFilePath
27
- )
14
+ createCompleteStatusFieldHandler(_izContext, flowSchema, appPath),
15
+ ...createCompleteStatusFieldTopicAndQueue(_izContext, flowSchema, appPath)
28
16
  ];
29
17
 
30
18
  return component;
@@ -24,8 +24,11 @@ import consts from '#libs/Consts.js';
24
24
  import utils from '#libs/Utils.js';
25
25
 
26
26
  const { SOURCE_PATH } = consts;
27
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } =
28
- utils;
27
+ const {
28
+ firstLetterLowerCase: lowerCase,
29
+ firstLetterUpperCase: upperCase,
30
+ savePath
31
+ } = utils;
29
32
  const templatePath = path.join(__dirname, 'template.ejs');
30
33
 
31
34
  /**
@@ -35,11 +38,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
35
38
  * @return {{templatePath, templateData,setting}}
36
39
  */
37
40
 
38
- function data(_izContext, flowSchema, srcPath) {
39
- return [createSourceParams(_izContext, flowSchema, srcPath)];
40
- }
41
-
42
- function createSourceParams(_izContext, flowSchema, srcPath) {
41
+ function createSourceParams(_izContext, flowSchema, appPath) {
43
42
  let functionName = 'CompleteStatusField' + upperCase(flowSchema.flowTag);
44
43
 
45
44
  return {
@@ -49,12 +48,14 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
49
48
  flowType: flowSchema.flowTag
50
49
  },
51
50
  setting: {
52
- savePath: path.join(
53
- srcPath,
54
- SOURCE_PATH.flowSchema,
55
- upperCase(flowSchema.flowTag),
56
- 'source/'
57
- ),
51
+ savePath:
52
+ // path.join(
53
+ // appPath,
54
+ // SOURCE_PATH.flowSchema,
55
+ // upperCase(flowSchema.flowTag),
56
+ // 'source/'
57
+ // ),
58
+ savePath.resourceYamlFlowSchemaFlowTag(appPath, flowSchema.flowTag),
58
59
  saveFileName: `${functionName}_Main`,
59
60
  fileExtension: '.js',
60
61
  isAppend: true
@@ -62,4 +63,4 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
62
63
  };
63
64
  }
64
65
 
65
- export default data;
66
+ export default createSourceParams;
@@ -54,11 +54,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
54
54
  * @return {{templatePath, templateData,setting}}
55
55
  */
56
56
 
57
- async function data(_izContext, flowSchema, srcPath) {
58
- return [await createSourceParams(_izContext, flowSchema, srcPath)];
59
- }
60
-
61
- async function createSourceParams(_izContext, flowSchema, srcPath) {
57
+ async function createSourceParams(_izContext, flowSchema, appPath) {
62
58
  let functionName =
63
59
  'CheckTriggerCache' + upperCase(flowSchema.flowTag) + 'Complete';
64
60
  let handlerType = upperCase(HANDLER.hdrSqs);
@@ -86,7 +82,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
86
82
  .getLocalObjectSchemas(
87
83
  _izContext,
88
84
  [flowSchema.objType.objectType],
89
- path.join(srcPath, './schemas')
85
+ path.join(appPath, 'src/schemas')
90
86
  )
91
87
  .then(res => res.records[0]);
92
88
  if (!objectSchema) {
@@ -129,7 +125,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
129
125
  queueName
130
126
  },
131
127
  setting: {
132
- savePath: path.join(srcPath, SOURCE_PATH.appYaml),
128
+ savePath: path.join(appPath, SOURCE_PATH.appYaml),
133
129
  saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
134
130
  fileExtension: '.yml',
135
131
  isAppend: true
@@ -137,4 +133,4 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
137
133
  };
138
134
  }
139
135
 
140
- export default data;
136
+ export default createSourceParams;
@@ -23,8 +23,11 @@ import consts from '#libs/Consts.js';
23
23
  import utils from '#libs/Utils.js';
24
24
 
25
25
  const { SOURCE_PATH, HANDLER } = consts;
26
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } =
27
- utils;
26
+ const {
27
+ firstLetterLowerCase: lowerCase,
28
+ firstLetterUpperCase: upperCase,
29
+ savePath
30
+ } = utils;
28
31
  const templatePath = path.join(__dirname, 'template.ejs');
29
32
 
30
33
  /**
@@ -33,12 +36,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
33
36
  * @param {Object} objectSchema
34
37
  * @return {{templatePath, templateData,setting}}
35
38
  */
36
-
37
- function data(_izContext, flowSchema, srcPath) {
38
- return [createSourceParams(_izContext, flowSchema, srcPath)];
39
- }
40
-
41
- function createSourceParams(_izContext, flowSchema, srcPath) {
39
+ function createSourceParams(_izContext, flowSchema, appPath) {
42
40
  let functionName =
43
41
  'CheckTriggerCache' + upperCase(flowSchema.flowTag) + 'Complete';
44
42
  let handlerType = upperCase(HANDLER.hdrSqs);
@@ -55,12 +53,14 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
55
53
  queueName
56
54
  },
57
55
  setting: {
58
- savePath: path.join(
59
- srcPath,
60
- SOURCE_PATH.flowSchema,
61
- upperCase(flowSchema.flowTag),
62
- 'source/'
63
- ),
56
+ savePath:
57
+ // path.join(
58
+ // appPath,
59
+ // SOURCE_PATH.flowSchema,
60
+ // upperCase(flowSchema.flowTag),
61
+ // 'source/'
62
+ // ),
63
+ savePath.resourceYamlFlowSchemaFlowTag(appPath, flowSchema.flowTag),
64
64
  saveFileName: `${upperCase(functionName)}_${upperCase(handlerType)}`,
65
65
  fileExtension: '.js',
66
66
  isAppend: true
@@ -68,4 +68,4 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
68
68
  };
69
69
  }
70
70
 
71
- export default data;
71
+ export default createSourceParams;
@@ -22,8 +22,11 @@ const __dirname = path.dirname(__filename);
22
22
  import consts from '#libs/Consts.js';
23
23
  import utils from '#libs/Utils.js';
24
24
  const { SOURCE_PATH, HANDLER } = consts;
25
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } =
26
- utils;
25
+ const {
26
+ firstLetterLowerCase: lowerCase,
27
+ firstLetterUpperCase: upperCase,
28
+ savePath
29
+ } = utils;
27
30
 
28
31
  const templatePath = path.join(__dirname, 'template.ejs');
29
32
 
@@ -34,12 +37,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
34
37
  * @param {Object} objectSchema
35
38
  * @return {{templatePath, templateData,setting}}
36
39
  */
37
-
38
- function data(_izContext, flowSchema, srcPath) {
39
- return [createSourceParams(_izContext, flowSchema, srcPath)];
40
- }
41
-
42
- function createSourceParams(_izContext, flowSchema, srcPath) {
40
+ function createSourceParams(_izContext, flowSchema, appPath) {
43
41
  let functionName =
44
42
  'CheckTriggerCache' + upperCase(flowSchema.flowTag) + 'Complete';
45
43
  let handlerType = upperCase(HANDLER.hdrSqs);
@@ -57,12 +55,14 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
57
55
  flowTag: flowSchema.flowTag
58
56
  },
59
57
  setting: {
60
- savePath: path.join(
61
- srcPath,
62
- SOURCE_PATH.flowSchema,
63
- upperCase(flowSchema.flowTag),
64
- 'source/'
65
- ),
58
+ savePath:
59
+ // path.join(
60
+ // appPath,
61
+ // SOURCE_PATH.flowSchema,
62
+ // upperCase(flowSchema.flowTag),
63
+ // 'source/'
64
+ // ),
65
+ savePath.resourceYamlFlowSchemaFlowTag(appPath, flowSchema.flowTag),
66
66
  saveFileName: `${upperCase(functionName)}_Main`,
67
67
  fileExtension: '.js',
68
68
  isAppend: true
@@ -70,4 +70,4 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
70
70
  };
71
71
  }
72
72
 
73
- export default data;
73
+ export default createSourceParams;
@@ -11,47 +11,27 @@ import createCheckTriggerCacheMainFunction from './checkTriggerCacheComplete/mai
11
11
  import createTriggerCacheCompleteMainFunction from './triggerCacheComplete/mainFunction/data.js';
12
12
  import createFlowSchemaTriggerCacheQueue from './triggerCacheQueue/data.js';
13
13
 
14
- async function createTriggerCacheComponent(_izContext, flowSchema, saveFilePath) {
14
+ async function createTriggerCacheComponent(_izContext, flowSchema, appPath) {
15
15
  const triggerCacheComponents = [
16
16
  // Yaml
17
- await createProcessTriggerCacheYaml(_izContext, flowSchema, saveFilePath),
18
- await createCheckTriggerCacheYaml(_izContext, flowSchema, saveFilePath),
19
- await createTriggerCacheCompleteYamlSqs(_izContext, flowSchema, saveFilePath),
20
- await createTriggerCacheCompleteYamlDsq(_izContext, flowSchema, saveFilePath),
17
+ await createProcessTriggerCacheYaml(_izContext, flowSchema, appPath),
18
+ await createCheckTriggerCacheYaml(_izContext, flowSchema, appPath),
19
+ await createTriggerCacheCompleteYamlSqs(_izContext, flowSchema, appPath),
20
+ await createTriggerCacheCompleteYamlDsq(_izContext, flowSchema, appPath),
21
21
 
22
22
  // Main Function
23
- ...createProcessTriggerCacheMainFunction(
24
- _izContext,
25
- flowSchema,
26
- saveFilePath
27
- ),
28
- ...createCheckTriggerCacheMainFunction(
29
- _izContext,
30
- flowSchema,
31
- saveFilePath
32
- ),
33
- ...createTriggerCacheCompleteMainFunction(
34
- _izContext,
35
- flowSchema,
36
- saveFilePath
37
- ),
23
+ createProcessTriggerCacheMainFunction(_izContext, flowSchema, appPath),
24
+ createCheckTriggerCacheMainFunction(_izContext, flowSchema, appPath),
25
+ createTriggerCacheCompleteMainFunction(_izContext, flowSchema, appPath),
38
26
 
39
27
  // Handler
40
- ...createProcessTriggerCacheHandler(_izContext, flowSchema, saveFilePath),
41
- ...createCheckTriggerCacheHandler(_izContext, flowSchema, saveFilePath),
42
- ...createTriggerCacheCompleteHandlerSqs(
43
- _izContext,
44
- flowSchema,
45
- saveFilePath
46
- ),
47
- ...createTriggerCacheCompleteHandlerDsq(
48
- _izContext,
49
- flowSchema,
50
- saveFilePath
51
- ),
28
+ createProcessTriggerCacheHandler(_izContext, flowSchema, appPath),
29
+ createCheckTriggerCacheHandler(_izContext, flowSchema, appPath),
30
+ createTriggerCacheCompleteHandlerSqs(_izContext, flowSchema, appPath),
31
+ createTriggerCacheCompleteHandlerDsq(_izContext, flowSchema, appPath),
52
32
 
53
33
  // Queue
54
- ...createFlowSchemaTriggerCacheQueue(_izContext, flowSchema, saveFilePath)
34
+ ...createFlowSchemaTriggerCacheQueue(_izContext, flowSchema, appPath)
55
35
  ];
56
36
 
57
37
  return triggerCacheComponents.flat();
@@ -61,11 +61,7 @@ const templatePath = path.join(__dirname, './template.ejs');
61
61
  * @return {{templatePath, templateData,setting}}
62
62
  */
63
63
 
64
- async function data(_izContext, flowSchema, srcPath) {
65
- return await createSourceParams(_izContext, flowSchema, srcPath);
66
- }
67
-
68
- async function createSourceParams(_izContext, flowSchema, srcPath) {
64
+ async function createSourceParams(_izContext, flowSchema, appPath) {
69
65
  let functionName = 'ProcessTriggerCache' + upperCase(flowSchema.flowTag);
70
66
  // let functionName = createFlowTypeConcat(_izContext, { serviceTag: getLocalConfig("iz_serviceTag"), flowTag: upperCase(flowSchema.flowTag) })
71
67
  let handlerType = upperCase(HANDLER.hdrDsq);
@@ -91,7 +87,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
91
87
  .getLocalObjectSchemas(
92
88
  _izContext,
93
89
  [flowSchema.objType.objectType],
94
- path.join(srcPath, './schemas')
90
+ path.join(appPath, 'src/schemas')
95
91
  )
96
92
  .then(res => res.records[0]);
97
93
  if (!objectSchema) {
@@ -134,7 +130,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
134
130
  queueName
135
131
  },
136
132
  setting: {
137
- savePath: path.join(srcPath, SOURCE_PATH.appYaml),
133
+ savePath: path.join(appPath, SOURCE_PATH.appYaml),
138
134
  saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
139
135
  fileExtension: '.yml',
140
136
  isAppend: true
@@ -142,4 +138,4 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
142
138
  };
143
139
  }
144
140
 
145
- export default data;
141
+ export default createSourceParams;
@@ -30,7 +30,8 @@ const { SOURCE_PATH, HANDLER } = consts;
30
30
  const {
31
31
  firstLetterLowerCase: lowerCase,
32
32
  firstLetterUpperCase: upperCase,
33
- getLocalConfig
33
+ getLocalConfig,
34
+ savePath
34
35
  } = utils;
35
36
  const templatePath = path.join(__dirname, 'template.ejs');
36
37
 
@@ -40,12 +41,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
40
41
  * @param {Object} objectSchema
41
42
  * @return {{templatePath, templateData,setting}}
42
43
  */
43
-
44
- function data(_izContext, flowSchema, srcPath) {
45
- return [createSourceParams(_izContext, flowSchema, srcPath)];
46
- }
47
-
48
- function createSourceParams(_izContext, flowSchema, srcPath) {
44
+ function createSourceParams(_izContext, flowSchema, appPath) {
49
45
  let functionName = 'ProcessTriggerCache' + upperCase(flowSchema.flowTag);
50
46
  // let functionName = createFlowTypeConcat(_izContext, { serviceTag: getLocalConfig("iz_serviceTag"), flowTag: upperCase(flowSchema.flowTag) })
51
47
  let handlerType = upperCase(HANDLER.hdrDsq);
@@ -58,12 +54,14 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
58
54
  queueName
59
55
  },
60
56
  setting: {
61
- savePath: path.join(
62
- srcPath,
63
- SOURCE_PATH.flowSchema,
64
- upperCase(flowSchema.flowTag),
65
- 'source/'
66
- ),
57
+ savePath:
58
+ // path.join(
59
+ // appPath,
60
+ // SOURCE_PATH.flowSchema,
61
+ // upperCase(flowSchema.flowTag),
62
+ // 'source/'
63
+ // ),
64
+ savePath.resourceYamlFlowSchemaFlowTag(appPath, flowSchema.flowTag),
67
65
  saveFileName: `${upperCase(functionName)}_${upperCase(handlerType)}`,
68
66
  fileExtension: '.js',
69
67
  isAppend: true
@@ -71,4 +69,4 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
71
69
  };
72
70
  }
73
71
 
74
- export default data;
72
+ export default createSourceParams;
@@ -28,7 +28,7 @@ const { SOURCE_PATH, HANDLER } = consts;
28
28
  const {
29
29
  firstLetterLowerCase: lowerCase,
30
30
  firstLetterUpperCase: upperCase,
31
- getLocalConfig
31
+ savePath
32
32
  } = utils;
33
33
  const templatePath = path.join(__dirname, './template.ejs');
34
34
 
@@ -39,12 +39,7 @@ const templatePath = path.join(__dirname, './template.ejs');
39
39
  * @param {Object} objectSchema
40
40
  * @return {{templatePath, templateData,setting}}
41
41
  */
42
-
43
- function data(_izContext, flowSchema, srcPath) {
44
- return [createSourceParams(_izContext, flowSchema, srcPath)];
45
- }
46
-
47
- function createSourceParams(_izContext, flowSchema, srcPath) {
42
+ function createSourceParams(_izContext, flowSchema, appPath) {
48
43
  let functionName = 'ProcessTriggerCache' + upperCase(flowSchema.flowTag);
49
44
  // let functionName = createFlowTypeConcat(_izContext, { serviceTag: getLocalConfig("iz_serviceTag"), flowTag: upperCase(flowSchema.flowTag) })
50
45
 
@@ -54,12 +49,14 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
54
49
  functionName
55
50
  },
56
51
  setting: {
57
- savePath: path.join(
58
- srcPath,
59
- SOURCE_PATH.flowSchema,
60
- upperCase(flowSchema.flowTag),
61
- 'source/'
62
- ),
52
+ savePath:
53
+ // path.join(
54
+ // appPath,
55
+ // SOURCE_PATH.flowSchema,
56
+ // upperCase(flowSchema.flowTag),
57
+ // 'source/'
58
+ // ),
59
+ savePath.resourceYamlFlowSchemaFlowTag(appPath, flowSchema.flowTag),
63
60
  saveFileName: `${upperCase(functionName)}_Main`,
64
61
  fileExtension: '.js',
65
62
  isAppend: true
@@ -67,4 +64,4 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
67
64
  };
68
65
  }
69
66
 
70
- export default data;
67
+ export default createSourceParams;