@izara_project/izara-core-generate-service-code 1.0.23 → 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 (69) 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 +5 -14
  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/sns-out/data.js +2 -1
  10. package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/data.js +1 -5
  11. package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/template.ejs +12 -21
  12. package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/data.js +9 -7
  13. package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/template.ejs +3 -10
  14. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/functionYaml/data.js +1 -0
  15. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/functionYaml/data.js +5 -8
  16. package/src/generateCode/generateFlowSchema/event/ownTopicComponent/sns-out/data.js +2 -1
  17. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/data.js +12 -10
  18. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/template.ejs +5 -8
  19. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/statusFieldTemplate.ejs +30 -0
  20. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/storedCacheTemplate.ejs +26 -0
  21. package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/triggerCacheTemplate.ejs +44 -0
  22. package/src/generateCode/generateFlowSchema/event/s3Component/index.js +17 -17
  23. package/src/generateCode/generateFlowSchema/event/s3Component/upload/confirmReserved/handler/data.js +1 -1
  24. package/src/generateCode/generateFlowSchema/event/s3Component/upload/relate/sns-out/data.js +3 -1
  25. package/src/generateCode/generateFlowSchema/event/s3Component/websocket/dynamoDb/ReservedTableData.js +1 -1
  26. package/src/generateCode/generateFlowSchema/flowSchemaMainFunction/template.ejs +3 -5
  27. package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/functionYaml/data.js +9 -9
  28. package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/handler/data.js +1 -5
  29. package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/index.js +6 -18
  30. package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/mainFunction/data.js +15 -14
  31. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/functionYaml/data.js +4 -8
  32. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/handler/data.js +15 -15
  33. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/mainFunction/data.js +15 -15
  34. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/index.js +13 -33
  35. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/functionYaml/data.js +4 -8
  36. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/handler/data.js +12 -14
  37. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/mainFunction/data.js +11 -14
  38. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/functionYaml/dsq/data.js +4 -9
  39. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/functionYaml/sqs/data.js +4 -9
  40. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/handler/dsq/data.js +11 -14
  41. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/handler/sqs/data.js +11 -14
  42. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/mainFunction/data.js +15 -15
  43. package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheQueue/data.js +2 -3
  44. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/create/mainFunction/template.ejs +185 -103
  45. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/create/sns-out/data.js +2 -1
  46. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/delete/sns-out/data.js +2 -1
  47. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/get/sns-out/data.js +2 -1
  48. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/mainFunction/template.ejs +137 -71
  49. package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/sns-out/data.js +2 -1
  50. package/src/generateCode/generateSchema/actionEndpointComponent/yaml/data.js +6 -4
  51. package/src/generateCode/generateSchema/findDataComponent/mainFunction/data.js +1 -1
  52. package/src/generateCode/generateSchema/relationshipPerActionComponent/changeRelationship/complete/sns-out/data.js +2 -1
  53. package/src/generateCode/generateSchema/relationshipPerActionComponent/create/action/functionYaml/data.js +1 -0
  54. package/src/generateCode/generateSchema/relationshipPerActionComponent/create/complete/sns-out/data.js +2 -1
  55. package/src/generateCode/generateSchema/relationshipPerActionComponent/delete/action/functionYaml/data.js +1 -0
  56. package/src/generateCode/generateSchema/relationshipPerActionComponent/delete/complete/sns-out/data.js +2 -1
  57. package/src/generateCode/generateSchema/relationshipPerActionComponent/get/action/functionYaml/data.js +1 -0
  58. package/src/generateCode/generateSchema/relationshipPerActionComponent/get/complete/sns-out/data.js +2 -1
  59. package/src/generateCode/generateSchema/relationshipPerActionComponent/moveRelationship/complete/sns-out/data.js +2 -1
  60. package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/functionYaml/data.js +1 -0
  61. package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/sns-out/data.js +2 -1
  62. package/src/generateCode/generateSchema/relationshipPerActionComponent/update/complete/sns-out/data.js +2 -1
  63. package/src/generateCode/resourceYamlComponent/sns-out/data.js +2 -1
  64. package/src/generateCode/resourceYamlComponent/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +2 -1
  65. package/src/generateCode/resourceYamlComponent/sns-out/template.ejs +2 -6
  66. package/src/generateCode.js +9 -7
  67. package/src/libs/Utils.js +26 -1
  68. package/src/__TemplateData/flowSchema/event/externalTopic/Process/handler/data.js +0 -64
  69. package/src/__TemplateData/flowSchema/event/externalTopic/sns-out/data.js +0 -75
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-core-generate-service-code",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "Code for locally generating per service files",
5
5
  "author": "Sven Mason <thebarbariansven@gmail.com>",
6
6
  "license": "AGPL-3.0-or-later",
@@ -86,16 +86,19 @@ async function generateTemplateDataFromFlowSchema(
86
86
  // ── per-flowSchema resources ─────────────────────────────────────────
87
87
  const perFlowParams = [
88
88
  createWebSocketGenerateCodeLibs(_izContext, flowSchema, appPath),
89
- !flowSchema.event.includes('s3')
90
- ? await createFlowSchemaEndpointMainFunction(
91
- _izContext,
92
- flowSchema,
93
- appPath
94
- )
95
- : {},
96
89
  ...buildFlowStepResources(_izContext, flowSchema, appPath)
97
90
  ];
98
91
 
92
+ if (!flowSchema.event.includes('s3')) {
93
+ perFlowParams.push(
94
+ await createFlowSchemaEndpointMainFunction(
95
+ _izContext,
96
+ flowSchema,
97
+ appPath
98
+ )
99
+ );
100
+ }
101
+
99
102
  // ── event handlers ───────────────────────────────────────────────────
100
103
  const eventPromises = events
101
104
  .filter(event => {
@@ -1,7 +1,6 @@
1
- <%_ const join = require('path').join; _%>
2
- <%- firstLetterUpperCase(functionNameConfig) %>:
3
- handler: <%- join(resourceLocation, `${functionName}_${firstLetterUpperCase(handlerType)}.main`)%>
4
- name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionNameConfig) %>
1
+ <%- functionNameConfig %>:
2
+ handler: <%- `${resourceLocation}${functionName}_${handlerType}.main` %>
3
+ name: ${self:custom.iz_resourcePrefix}<%- functionNameConfig %>
5
4
  role: <%- roleName %>Role
6
5
  #<#<%- functionName %>FunctionSetting#>
7
6
  #<#/<%- functionName %>FunctionSetting#>
@@ -13,9 +12,3 @@
13
12
  rate: <%- schedule.rate %>
14
13
  input: <%- JSON.stringify(schedule.input) %>
15
14
  <%_ }) _%>
16
- <%_ function firstLetterUpperCase(text){
17
- return text.charAt(0).toUpperCase() + text.slice(1)
18
- } _%>
19
- <%_ function firstLetterLowerCase(str) {
20
- return str.charAt(0).toLowerCase() + str.slice(1)
21
- } _%>
@@ -46,7 +46,8 @@ function data(_izContext, flowSchema, appPath) {
46
46
  templatePath: templatePath,
47
47
  templateData: {
48
48
  functionName: functionName,
49
- flowTag: flowTag,
49
+ flowTag: upperCase(flowTag),
50
+ // flowTag: ,
50
51
  // action: action,
51
52
  handler
52
53
  // roleName: SOURCE_GENERATE_IAM_ROLE.EventBridge,
@@ -15,12 +15,10 @@ You should have received a copy of the GNU Affero General Public License
15
15
  along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
-
19
-
20
- import { middlewareHandleras middlewar } from "@izara_project/izara-middleware";
18
+ import { middlewareHandler as middleware } from "@izara_project/izara-middleware";
21
19
  import callingFlowSharedLib from '@izara_project/zara-core-library-calling-flow';
22
20
 
23
- import <%- functionName %>Main from './<%- firstLetterUpperCase(functionName)%>_Main.js'
21
+ import <%- functionName %>Main from './<%- functionName %>_Main.js'
24
22
 
25
23
  //(<globalVariable>
26
24
  //</globalVariable>)
@@ -40,21 +38,14 @@ export const main = middlewareHandler.wrap(async (event, context) => {
40
38
  //(</beforeInvoke>)
41
39
 
42
40
  // invoke LambdaFunction
43
- return await <% - functionName %> Main(
41
+ return await <%- functionName %> Main(
44
42
  event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId
45
43
  event,
46
44
  callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
47
45
  );
48
46
 
49
47
  } catch (err) {
50
- event._izContext.logger.error('Error, <%- firstLetterUpperCase(flowTag) %>: ', err);
48
+ event._izContext.logger.error('Error, <%- flowTag %>: ', err);
51
49
  throw (err);
52
50
  }
53
- });
54
-
55
- <% _ function firstLetterUpperCase(text) {
56
- return text.charAt(0).toUpperCase() + text.slice(1)
57
- } _ %>
58
- <% _ function firstLetterLowerCase(str) {
59
- return str.charAt(0).toLowerCase() + str.slice(1)
60
- } _ %>
51
+ });
@@ -5,7 +5,7 @@ import createExternalTopicSnsOut from './sns-out/data.js';
5
5
 
6
6
  async function createExternalTopicComponent(_izContext, flowSchema, appPath) {
7
7
  const component = [
8
- createExternalSqsFunctionYaml(_izContext, flowSchema, appPath),
8
+ await createExternalSqsFunctionYaml(_izContext, flowSchema, appPath),
9
9
  createExternalSqsHandler(_izContext, flowSchema, appPath),
10
10
  ...createExternalTopicSnsInSqs(_izContext, flowSchema, appPath),
11
11
  ...createExternalTopicSnsOut(_izContext, flowSchema, appPath)
@@ -38,7 +38,7 @@ const {
38
38
  LAMBDA_RESOURCE
39
39
  } = consts;
40
40
 
41
- const { firstLetterUpperCase: upperCase } = utils;
41
+ const { firstLetterUpperCase: upperCase, savePath } = utils;
42
42
 
43
43
  const {
44
44
  shortNameHandler,
@@ -132,11 +132,7 @@ async function createSourceParams(_izContext, flowSchema, appPath) {
132
132
  return {
133
133
  templatePath: templatePath,
134
134
  templateData: {
135
- resourceLocation: path.join(
136
- SOURCE_PATH.resourceLocationFlowSchema,
137
- upperCase(flowSchema.flowTag),
138
- 'source/'
139
- ),
135
+ resourceLocation: savePath.flowSchemaFlowTag(flowSchema.flowTag),
140
136
  functionName,
141
137
  handlerType,
142
138
  additionalResourcePermission,
@@ -1,7 +1,6 @@
1
- <%_ const join = require('path').join; _%>
2
- <%- firstLetterUpperCase(functionNameConfig) %>:
3
- handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
4
- name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
1
+ <%- functionNameConfig %>:
2
+ handler: <%- `${resourceLocation}${functionName}_${handlerType}.main`%>
3
+ name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- handlerType %>
5
4
  role: <%- roleName %>Role
6
5
  #<#<%- functionName %><%- handlerType %>FunctionSetting#>
7
6
  #<#/<%- functionName %><%- handlerType %>FunctionSetting#>
@@ -11,10 +10,4 @@
11
10
  batchSize: 10
12
11
  filterPatterns: #**** need to update serverless framework upper v.2.69.1
13
12
  - body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- functionName %>"]}}} # functionName of callingFlow
14
- - body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
15
- <%_ function firstLetterUpperCase(text){
16
- return text.charAt(0).toUpperCase() + text.slice(1)
17
- } _%>
18
- <%_ function firstLetterLowerCase(str) {
19
- return str.charAt(0).toLowerCase() + str.slice(1)
20
- } _%>
13
+ - body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
@@ -49,7 +49,8 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, appPath) {
49
49
  savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
50
50
  saveFileName: SAVE_FILE_NAME.snsOutYaml,
51
51
  fileExtension: '.yml',
52
- isAppend: true
52
+ isAppend: true,
53
+ fromFile: 'external/sns-out/data.js'
53
54
  };
54
55
 
55
56
  let topicOut = `${upperCase(flowSchema.flowTag)}`;
@@ -54,11 +54,7 @@ function createSourceParamsApi(_izContext, flowSchema, appPath) {
54
54
  return {
55
55
  templatePath: templatePath,
56
56
  templateData: {
57
- resourceLocation: path.join(
58
- SOURCE_PATH.resourceLocationFlowSchema,
59
- upperCase(flowSchema.flowTag),
60
- 'source/'
61
- ),
57
+ resourceYamlFlowSchemaFlowTag,
62
58
  functionName,
63
59
  handlerType,
64
60
  additionalResourcePermission,
@@ -1,28 +1,19 @@
1
- <%_ const join = require('path').join _%>
2
- <%- firstLetterUpperCase(functionNameConfig) %>:
3
- handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`) %>
4
- name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
5
- role: <%- firstLetterUpperCase(roleName) _%>Role
6
- #<#<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>FunctionSetting#>
7
- #<#/<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>FunctionSetting#>
1
+ <%- functionNameConfig %>:
2
+ handler: <%- `${resourceLocation}${functionName}_${handlerType}.main` %>
3
+ name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- handlerType %>
4
+ role: <%- roleName %>Role
5
+ #<#<%- functionName %><%- handlerType %>FunctionSetting#>
6
+ #<#/<%- functionName %><%- handlerType %>FunctionSetting#>
8
7
  events:
9
8
  - httpApi:
10
- path: /<%- serviceTag %>/<%- firstLetterLowerCase(functionName) %>/<%- functionName %>
9
+ path: /<%- serviceTag %>/<%- functionName %>/<%- functionName %>
11
10
  method: <%- event %>
12
11
  authorizer: authorizerServiceSchema
13
- #<#<%- firstLetterUpperCase(functionName) _%><%- firstLetterUpperCase(handlerType) %>AppLevelAuthorizer#>
14
- #<#/<%- firstLetterUpperCase(functionName) _%><%- firstLetterUpperCase(handlerType) %>AppLevelAuthorizer#>
12
+ #<#<%- functionName %><%- handlerType %>AppLevelAuthorizer#>
13
+ #<#/<%- functionName %><%- handlerType %>AppLevelAuthorizer#>
15
14
  - httpApi:
16
- path: /<%- serviceTag %>/<%- firstLetterLowerCase(functionName) %>/<%- functionName %>/{targetUserId}
15
+ path: /<%- serviceTag %>/<%- functionName %>/<%- functionName %>/{targetUserId}
17
16
  method: <%- event %>
18
17
  authorizer: authorizerServiceSchema
19
- #<#<%- firstLetterUpperCase(functionName) _%><%- firstLetterUpperCase(handlerType) %>UserLevelAuthorizer#>
20
- #<#/<%- firstLetterUpperCase(functionName) _%><%- firstLetterUpperCase(handlerType) %>UserLevelAuthorizer#>
21
-
22
-
23
- <%_ function firstLetterUpperCase(text){
24
- return text.charAt(0).toUpperCase() + text.slice(1)
25
- } _%>
26
- <%_ function firstLetterLowerCase(str) {
27
- return str.charAt(0).toLowerCase() + str.slice(1)
28
- } _%>
18
+ #<#<%- functionName %><%- handlerType %>UserLevelAuthorizer#>
19
+ #<#/<%- functionName %><%- handlerType %>UserLevelAuthorizer#>
@@ -28,7 +28,7 @@ const { HANDLER, SOURCE_PATH, SAVE_FILE_NAME } = consts;
28
28
 
29
29
  const { shortNameHandler, defaultIamRolePerAction } = libs;
30
30
 
31
- const { firstLetterUpperCase: upperCase } = utils;
31
+ const { firstLetterUpperCase: upperCase, savePath } = utils;
32
32
 
33
33
  const templatePath = path.join(__dirname, 'template.ejs');
34
34
  /**
@@ -46,12 +46,14 @@ function createSourceParamsInvoke(_izContext, flowSchema, appPath) {
46
46
  return {
47
47
  templatePath: templatePath,
48
48
  templateData: {
49
- resourceLocation: path.join(
50
- SOURCE_PATH.resourceLocationFlowSchema,
51
- upperCase(flowSchema.flowTag),
52
- 'source/'
53
- ),
54
- functionName,
49
+ resourceLocation:
50
+ // path.join(
51
+ // SOURCE_PATH.resourceLocationFlowSchema,
52
+ // upperCase(flowSchema.flowTag),
53
+ // 'MainHandler/',
54
+ // 'source/'
55
+ // ),
56
+ savePath.flowSchemaFlowTag(flowSchema.flowTag),
55
57
  handlerType,
56
58
  additionalResourcePermission,
57
59
  functionNameConfig:
@@ -1,13 +1,6 @@
1
- <%_ const join = require('path').join; _%>
2
- <%- firstLetterUpperCase(functionNameConfig) %>:
3
- handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
4
- name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
1
+ <%- functionNameConfig %>:
2
+ handler: <%- `${resourceLocation}${functionName}_${handlerType}.main` %>
3
+ name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- handlerType %>
5
4
  role: <%- roleName %>Role
6
5
  #<#<%- functionName %><%- handlerType %>FunctionSetting#>
7
6
  #<#/<%- functionName %><%- handlerType %>FunctionSetting#>
8
- <%_ function firstLetterUpperCase(text){
9
- return text.charAt(0).toUpperCase() + text.slice(1)
10
- } _%>
11
- <%_ function firstLetterLowerCase(str) {
12
- return str.charAt(0).toLowerCase() + str.slice(1)
13
- } _%>
@@ -78,6 +78,7 @@ async function createSourceParams(_izContext, flowSchema, appPath) {
78
78
  handlerFilePath: path.join(
79
79
  SOURCE_PATH.resourceLocationFlowSchema,
80
80
  upperCase(flowSchema.flowTag),
81
+ 'MainHandler/',
81
82
  'source/'
82
83
  ),
83
84
  functionName,
@@ -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
 
@@ -103,13 +103,10 @@ function createSourceParams(_izContext, flowSchema, appPath) {
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,
@@ -64,7 +64,8 @@ function createDataForSnsOut(_izContext, flowSchema, appPath) {
64
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
  /**
@@ -102,12 +102,14 @@ async function createParamsForCreateSource(_izContext, flowSchema, appPath) {
102
102
  queueName: `${createFlowTypeConcat(_izContext, { serviceTag: getLocalConfig('iz_serviceTag'), flowTag: upperCase(flowSchema.flowTag) })}_Main`
103
103
  },
104
104
  setting: {
105
- savePath: path.join(
106
- appPath,
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)
@@ -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) {