@izara_project/izara-market-library-service-schemas 1.0.41 → 1.0.44

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 (113) hide show
  1. package/package.json +1 -1
  2. package/src/MainLibs/src/Consts.js +1 -1
  3. package/src/reStructure/GenerateCode.js +2 -2
  4. package/src/reStructure/GenerateSchema.js +8 -8
  5. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +23 -13
  6. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +25 -8
  7. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +30 -21
  8. package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +0 -32
  9. package/src/reStructure/TemplateData/findData/mainFunction/template.ejs +4 -4
  10. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/functionYaml/data.js +1 -1
  11. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/functionYaml/template.ejs +1 -0
  12. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/template.ejs +1 -0
  13. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +2 -3
  14. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/template.ejs +1 -0
  15. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/functionYaml/template.ejs +1 -0
  16. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +1 -1
  17. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/template.ejs +1 -1
  18. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +5 -5
  19. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +1 -1
  20. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +5 -2
  21. package/src/reStructure/TemplateData/flowSchema/dynamoDb/data.js +0 -20
  22. package/src/reStructure/TemplateData/flowSchema/eventBridge/functionYaml/data.js +7 -16
  23. package/src/reStructure/TemplateData/flowSchema/eventBridge/handler/inv/data.js +2 -2
  24. package/src/reStructure/TemplateData/flowSchema/eventBridge/handler/inv/template.ejs +0 -1
  25. package/src/reStructure/TemplateData/flowSchema/externalTopic/Complete/functionYaml/data.js +112 -0
  26. package/src/reStructure/TemplateData/flowSchema/externalTopic/{functionYaml → Complete/functionYaml}/template.ejs +1 -0
  27. package/src/reStructure/TemplateData/flowSchema/externalTopic/Complete/handler/data.js +93 -0
  28. package/src/reStructure/TemplateData/flowSchema/externalTopic/Complete/mainFunction/data.js +61 -0
  29. package/src/reStructure/TemplateData/flowSchema/externalTopic/Complete/mainFunction/template.ejs +96 -0
  30. package/src/reStructure/TemplateData/flowSchema/externalTopic/{functionYaml → Process/functionYaml}/data.js +20 -4
  31. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/flowStep → externalTopic/Process}/functionYaml/template.ejs +1 -0
  32. package/src/reStructure/TemplateData/flowSchema/externalTopic/{handler → Process/handler}/data.js +3 -3
  33. package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/handler/template.ejs +87 -0
  34. package/src/reStructure/TemplateData/flowSchema/externalTopic/{mainFunction → Process/mainFunction}/data.js +2 -2
  35. package/src/reStructure/TemplateData/flowSchema/externalTopic/{mainFunction → Process/mainFunction}/template.ejs +2 -2
  36. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +14 -4
  37. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/sqsTemplate.ejs +52 -0
  38. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +1 -1
  39. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/data.js +4 -4
  40. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/template.ejs +1 -0
  41. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/handler/data.js +1 -2
  42. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/handler/template.ejs +1 -1
  43. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/data.js +5 -5
  44. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/template.ejs +5 -2
  45. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +1 -1
  46. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/template.ejs +1 -0
  47. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +1 -1
  48. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/template.ejs +2 -0
  49. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +3 -2
  50. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +2 -2
  51. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +1 -1
  52. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +1 -1
  53. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +2 -2
  54. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +9 -21
  55. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/sqsTemplate.ejs +0 -10
  56. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +1 -1
  57. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/flowStep → flowStep}/functionYaml/data.js +36 -23
  58. package/src/reStructure/TemplateData/flowSchema/flowStep/functionYaml/template.ejs +20 -0
  59. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/flowStep → flowStep}/handler/data.js +22 -18
  60. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/flowStep → flowStep}/mainFunction/data.js +22 -18
  61. package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/data.js +90 -0
  62. package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/template.ejs +45 -0
  63. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +41 -25
  64. package/src/reStructure/TemplateData/flowSchema/register/complete/functionYaml/data.js +1 -0
  65. package/src/reStructure/TemplateData/flowSchema/register/complete/functionYaml/template.ejs +1 -0
  66. package/src/reStructure/TemplateData/flowSchema/register/complete/handler/data.js +0 -1
  67. package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +17 -18
  68. package/src/reStructure/TemplateData/flowSchema/register/dynamoDB/register.js +0 -17
  69. package/src/reStructure/TemplateData/flowSchema/register/sns-in/data.js +0 -1
  70. package/src/reStructure/TemplateData/flowSchema/register/subscriptionOutAll/data.js +1 -3
  71. package/src/reStructure/TemplateData/flowSchema/register/subscriptionOutAll/template.ejs +2 -2
  72. package/src/reStructure/TemplateData/flowSchema/register/wbs/functionYaml/data.js +0 -29
  73. package/src/reStructure/TemplateData/flowSchema/register/wbs/handler/data.js +0 -1
  74. package/src/reStructure/TemplateData/flowSchema/register/wbs/handler/template.ejs +0 -5
  75. package/src/reStructure/TemplateData/flowSchema/register/wbs/mainFunction/template.ejs +16 -15
  76. package/src/reStructure/TemplateData/flowSchema/templateBystatusType/triggerCacheTemplate.ejs +7 -1
  77. package/src/reStructure/TemplateData/flowSchema/webSocketComplete/functionYaml/data.js +1 -1
  78. package/src/reStructure/TemplateData/flowSchema/webSocketComplete/functionYaml/template.ejs +2 -1
  79. package/src/reStructure/TemplateData/flowSchema/webSocketComplete/sqs/data.js +97 -0
  80. package/src/reStructure/TemplateData/flowSchema/webSocketComplete/sqs/template.ejs +52 -0
  81. package/src/reStructure/TemplateData/perActionComplete/create/handler/template.ejs +3 -3
  82. package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +6 -0
  83. package/src/reStructure/TemplateData/perActionComplete/create/yaml/template.ejs +1 -0
  84. package/src/reStructure/TemplateData/perActionComplete/delete/handler/template.ejs +3 -3
  85. package/src/reStructure/TemplateData/perActionComplete/delete/yaml/template.ejs +1 -0
  86. package/src/reStructure/TemplateData/perActionComplete/get/handler/template.ejs +3 -3
  87. package/src/reStructure/TemplateData/perActionComplete/get/yaml/template.ejs +1 -0
  88. package/src/reStructure/TemplateData/perActionComplete/update/handler/template.ejs +3 -3
  89. package/src/reStructure/TemplateData/perActionComplete/update/yaml/template.ejs +1 -0
  90. package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/template.ejs +12 -12
  91. package/src/reStructure/TemplateData/propertyValueSchema/generateTemplateData.js +19 -19
  92. package/src/reStructure/TemplateData/propertyValueSchema/objectPropertyValueSchema/data.js +82 -79
  93. package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +33 -37
  94. package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +7 -5
  95. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +4 -2
  96. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/template.ejs +1 -0
  97. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +4 -4
  98. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +7 -5
  99. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +6 -3
  100. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/template.ejs +1 -0
  101. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +4 -4
  102. package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +3 -3
  103. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +6 -3
  104. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/template.ejs +1 -0
  105. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +1 -1
  106. package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +5 -3
  107. package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +6 -3
  108. package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/template.ejs +1 -0
  109. package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +4 -4
  110. package/src/reStructure/libs/ValidateAddOnDataStructure.js +5 -5
  111. /package/src/reStructure/TemplateData/flowSchema/externalTopic/{handler → Complete/handler}/template.ejs +0 -0
  112. /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/flowStep → flowStep}/handler/template.ejs +0 -0
  113. /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/flowStep → flowStep}/mainFunction/template.ejs +0 -0
@@ -0,0 +1,97 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ const path = require("path")
21
+
22
+
23
+ // const {
24
+ // HANDLER,
25
+ // STORAGE_TYPES
26
+ // } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
27
+
28
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../MainLibs/src/Utils.js");
29
+ const STORAGE_TYPES = {
30
+ dynamoDB: "dynamoDB",
31
+ graph: "graph"
32
+ }
33
+
34
+ const templatePath = path.join(__dirname, './template.ejs');
35
+
36
+
37
+ const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = require('../../../../../MainLibs/src/Consts.js');
38
+
39
+ /**
40
+ * create data for dynamoDbYaml tempalte from objectSchema
41
+ * return array of dynamoDb data
42
+ * because one objectSchema can create multiple dynamoDb table
43
+ *
44
+ * @param {Object} _izContext
45
+ * @param {String} saveFilePath
46
+ * @returns {Object[]} - data of multiple dynamoDb template
47
+ */
48
+
49
+ function createDataForDefaultSnsInSqs(_izContext, allFlowSchema, srcPath) {
50
+ let resultsForCreateDefaultSnsInSqs = [];
51
+ let defaultDsqQueueDataList = [];
52
+ for (const flowSchema of allFlowSchema.records) {
53
+ if (flowSchema.hasOwnProperty("flowSteps")) {
54
+
55
+ let flowSteps = Object.keys(flowSchema.flowSteps);
56
+ if (flowSteps.length && flowSteps.length > 0) {
57
+ // console.log("create topic by flowSteps", flowSteps)
58
+
59
+
60
+
61
+ if (flowSchema.outputTopic) {
62
+ if (flowSteps.includes("Out")) {
63
+ if (flowSchema.outputTopic) {
64
+ let topicOut = `${upperCase(flowSchema.flowTag)}`;
65
+ defaultDsqQueueDataList.push({
66
+ queueName: `WebSocketComplete` + upperCase(HANDLER.hdrSqs),
67
+ subscribeTo: topicOut
68
+ }
69
+ )
70
+
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+
78
+ if (defaultDsqQueueDataList.length) {
79
+ for (let defaultDsqQueueData of defaultDsqQueueDataList) {
80
+ resultsForCreateDefaultSnsInSqs.push({
81
+ templatePath: templatePath,
82
+ templateData: defaultDsqQueueData,
83
+ setting: {
84
+ initialData: "Resources:\n",
85
+ savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
86
+ saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
87
+ fileExtension: ".yml",
88
+ isAppend: true
89
+ }
90
+ })
91
+ }
92
+ }
93
+
94
+ return resultsForCreateDefaultSnsInSqs;
95
+ }
96
+
97
+ module.exports = createDataForDefaultSnsInSqs;
@@ -0,0 +1,52 @@
1
+ <% if (subscribeTo) { %>
2
+ ##===== SNS Subscription
3
+ SubscriptionToOut<%- subscribeTo %>:
4
+ Type: AWS::SNS::Subscription
5
+ Properties:
6
+ TopicArn: !Ref Out<%- subscribeTo %>
7
+ Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>"
8
+ Protocol: "sqs"
9
+ <% } %>
10
+ #------- queue ---------
11
+ <%- queueName %>:
12
+ Type: "AWS::SQS::Queue"
13
+ Properties:
14
+ QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
15
+ RedrivePolicy:
16
+ deadLetterTargetArn: #!GetAtt
17
+ Fn::GetAtt:
18
+ - <%- queueName %>DLQ
19
+ - Arn
20
+ maxReceiveCount: 3
21
+ VisibilityTimeout: 120
22
+
23
+ <%- queueName %>DLQ:
24
+ Type: AWS::SQS::Queue
25
+ Properties:
26
+ QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
27
+
28
+ <%- queueName %>Policy:
29
+ Type: AWS::SQS::QueuePolicy
30
+ Properties:
31
+ PolicyDocument:
32
+ Version: "2012-10-17"
33
+ Statement:
34
+ - Sid: "allow-sns-messages"
35
+ Effect: Allow
36
+ Principal: "*"
37
+ Resource: #!GetAtt
38
+ Fn::GetAtt:
39
+ - <%- queueName %>
40
+ - Arn
41
+ Action: "SQS:SendMessage"
42
+ Queues:
43
+ - Ref: <%- queueName %>
44
+ #<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
45
+ #<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
46
+
47
+ <%_ function firstLetterUpperCase(text){
48
+ return text.charAt(0).toUpperCase() + text.slice(1)
49
+ } _%>
50
+ <%_ function firstLetterLowerCase(str) {
51
+ return str.charAt(0).toLowerCase() + str.slice(1)
52
+ } _%>
@@ -35,7 +35,7 @@ let perRecordsValidatorSchema = {
35
35
  required: [
36
36
  'returnValue',
37
37
  'status',
38
- 'errorFounds',
38
+ 'errorsFound',
39
39
  'graphServiceTag'
40
40
  ],
41
41
  properties: {
@@ -45,7 +45,7 @@ let perRecordsValidatorSchema = {
45
45
  status: {
46
46
  type: 'string',
47
47
  },
48
- errorFounds: {
48
+ errorsFound: {
49
49
  type: 'array',
50
50
  default: []
51
51
  },
@@ -93,7 +93,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
93
93
  // add argument (to invoke lambda) to passOnProperties[]
94
94
  passOnProperties.push(record.body.Message.returnValue)
95
95
  passOnProperties.push(record.body.Message.status)
96
- passOnProperties.push(record.body.Message.errorFounds)
96
+ passOnProperties.push(record.body.Message.errorsFound)
97
97
  passOnProperties.push(record.body.Message.graphServiceTag)
98
98
  passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message)) // is Ok PassBackProperties
99
99
  // passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message)) // is Ok callinfFlow
@@ -143,6 +143,12 @@ module.exports.createObjectComplete = async (
143
143
  _izContext.logger.debug("Send message to OutCreateObjectComplete :::>", sendMessageOutCreateObjectComplete)
144
144
  await sns.publishAsync(_izContext, sendMessageOutCreateObjectComplete);
145
145
 
146
+ await asyncFlowSharedLib.removeAwaitingMultipleStep(
147
+ _izContext,
148
+ awaitingStepId,
149
+ pendingStepId
150
+ );
151
+
146
152
  //(<afterSendMessage>)
147
153
  //(</afterSendMessage>)
148
154
  }
@@ -8,6 +8,7 @@
8
8
  batchSize: 10
9
9
  filterPatterns: #**** need to update serverless framwork upper v.2.69.1
10
10
  - body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
11
+ - body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
11
12
  role: <%- roleName %>Role
12
13
  #<#<%- functionName %><%- handlerType %>IamRole#>
13
14
  #<#/<%- functionName %><%- handlerType %>IamRole#>
@@ -36,7 +36,7 @@ let perRecordsValidatorSchema = {
36
36
  required: [
37
37
  'returnValue',
38
38
  'status',
39
- 'errorFounds'
39
+ 'errorsFound'
40
40
  ],
41
41
  properties: {
42
42
  returnValue: {
@@ -45,7 +45,7 @@ let perRecordsValidatorSchema = {
45
45
  status: {
46
46
  type: 'string',
47
47
  },
48
- errorFounds: {
48
+ errorsFound: {
49
49
  type: 'array',
50
50
  default: []
51
51
  }
@@ -90,7 +90,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
90
90
  // add argument (to invoke lambda) to passOnProperties[]
91
91
  passOnProperties.push(record.body.Message.returnValue)
92
92
  passOnProperties.push(record.body.Message.status)
93
- passOnProperties.push(record.body.Message.errorFounds)
93
+ passOnProperties.push(record.body.Message.errorsFound)
94
94
  passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message)) // is Ok PassBackProperties
95
95
  // passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message)) // is Ok callinfFlow
96
96
  record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
@@ -8,6 +8,7 @@
8
8
  batchSize: 10
9
9
  filterPatterns: #**** need to update serverless framwork upper v.2.69.1
10
10
  - body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
11
+ - body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
11
12
  role: <%- roleName %>Role
12
13
  #<#<%- functionName %><%- handlerType %>IamRole#>
13
14
  #<#/<%- functionName %><%- handlerType %>IamRole#>
@@ -35,7 +35,7 @@ let perRecordsValidatorSchema = {
35
35
  required: [
36
36
  'returnValue',
37
37
  'status',
38
- 'errorFounds'
38
+ 'errorsFound'
39
39
  ],
40
40
  properties: {
41
41
  returnValue: {
@@ -44,7 +44,7 @@ let perRecordsValidatorSchema = {
44
44
  status: {
45
45
  type: 'string',
46
46
  },
47
- errorFounds: {
47
+ errorsFound: {
48
48
  type: 'array',
49
49
  default: []
50
50
  }
@@ -89,7 +89,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
89
89
  // add argument (to invoke lambda) to passOnProperties[]
90
90
  passOnProperties.push(record.body.Message.returnValue)
91
91
  passOnProperties.push(record.body.Message.status)
92
- passOnProperties.push(record.body.Message.errorFounds)
92
+ passOnProperties.push(record.body.Message.errorsFound)
93
93
  passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message)) // is Ok PassBackProperties
94
94
  // passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message)) // is Ok callinfFlow
95
95
  record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
@@ -8,6 +8,7 @@
8
8
  batchSize: 10
9
9
  filterPatterns: #**** need to update serverless framwork upper v.2.69.1
10
10
  - body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
11
+ - body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
11
12
  role: <%- roleName %>Role
12
13
  #<#<%- functionName %><%- handlerType %>IamRole#>
13
14
  #<#/<%- functionName %><%- handlerType %>IamRole#>
@@ -35,7 +35,7 @@ let perRecordsValidatorSchema = {
35
35
  required: [
36
36
  'returnValue',
37
37
  'status',
38
- 'errorFounds'
38
+ 'errorsFound'
39
39
  ],
40
40
  properties: {
41
41
  returnValue: {
@@ -44,7 +44,7 @@ let perRecordsValidatorSchema = {
44
44
  status: {
45
45
  type: 'string',
46
46
  },
47
- errorFounds: {
47
+ errorsFound: {
48
48
  type: 'array',
49
49
  default: []
50
50
  }
@@ -89,7 +89,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
89
89
  // add argument (to invoke lambda) to passOnProperties[]
90
90
  passOnProperties.push(record.body.Message.returnValue)
91
91
  passOnProperties.push(record.body.Message.status)
92
- passOnProperties.push(record.body.Message.errorFounds)
92
+ passOnProperties.push(record.body.Message.errorsFound)
93
93
  passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message)) // is Ok PassBackProperties
94
94
  // passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message)) // is Ok callinfFlow
95
95
  record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
@@ -8,6 +8,7 @@
8
8
  batchSize: 10
9
9
  filterPatterns: #**** need to update serverless framwork upper v.2.69.1
10
10
  - body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
11
+ - body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
11
12
  role: <%- roleName %>Role
12
13
  #<#<%- functionName %><%- handlerType %>IamRole#>
13
14
  #<#/<%- functionName %><%- handlerType %>IamRole#>
@@ -73,12 +73,12 @@ module.exports.<%- functionName %>Main = async (
73
73
  _izContext.logger.debug("<%- functionName %> requestParams", requestParams)
74
74
  _izContext.logger.debug("<%- functionName %> callingFlowConfig", callingFlowConfig)
75
75
 
76
- let errorFounds = [];
76
+ let errorsFound = [];
77
77
  const userId = _izContext.correlationIds.get(coreConsts.BASE_USER_ID);
78
78
  const targetId = _izContext.correlationIds.get(coreConsts.TARGET_ID);
79
79
 
80
80
  if (!userId) {
81
- errorFounds.push("Not have userId")
81
+ errorsFound.push("Not have userId")
82
82
  }
83
83
 
84
84
  const OBJECT_TYPE = "<%- objectType %>"
@@ -105,7 +105,7 @@ module.exports.<%- functionName %>Main = async (
105
105
  _izContext.logger.debug("objectSchema", objectSchema);
106
106
 
107
107
  if (objectSchema.hasOwnProperty("belongTo") && !targetId) {
108
- errorFounds.push('not have targetId')
108
+ errorsFound.push('not have targetId')
109
109
  }
110
110
 
111
111
  let updateDataDetails = await createUpdateDataDetail(_izContext, objectSchema);
@@ -149,26 +149,26 @@ module.exports.<%- functionName %>Main = async (
149
149
  _izContext.logger.debug("missingVersionedDataIdLabels:: ", missingVersionedDataIdLabels);
150
150
 
151
151
  if (missingVersionedDataIdLabels.length) {
152
- errorFounds.push(`missing versionedDataIds of versionedDataLabel '${missingVersionedDataIdLabels.join(", ")}'`)
152
+ errorsFound.push(`missing versionedDataIds of versionedDataLabel '${missingVersionedDataIdLabels.join(", ")}'`)
153
153
  }
154
154
 
155
155
  // check missing update data of versionedDataLabels
156
156
  const missingDataVersionedDataLabels = versionedDataIdLabelKeys.filter(label => !versionedDataIdLabelKeys.includes(label))
157
157
  if (missingDataVersionedDataLabels.length) {
158
- errorFounds.push(`missing data of versionedDataLabels '${missingDataVersionedDataLabels.join(", ")}'`);
158
+ errorsFound.push(`missing data of versionedDataLabels '${missingDataVersionedDataLabels.join(", ")}'`);
159
159
  }
160
160
  // check mainNode Data should not exists
161
161
  if (Object.keys(updateMainNodeData).length) {
162
- errorFounds.push("cannot update mainNode if have versionedDataIds");
162
+ errorsFound.push("cannot update mainNode if have versionedDataIds");
163
163
  }
164
164
  }
165
165
 
166
166
  let messageAttributes
167
167
 
168
- if (errorFounds.length) {
168
+ if (errorsFound.length) {
169
169
  let updateNodeCompleteMessage = {
170
170
  objType: {
171
- objecType: OBJECT_TYPE,
171
+ objectType: OBJECT_TYPE,
172
172
  serviceTag: SERVICE_TAG
173
173
  },
174
174
  objInstanceFull: {
@@ -177,7 +177,7 @@ module.exports.<%- functionName %>Main = async (
177
177
  },
178
178
  versionedDataIds: versionedDataIds,
179
179
  status: 'error',
180
- errorFounds: errorFounds
180
+ errorsFound: errorsFound
181
181
  };
182
182
 
183
183
 
@@ -205,7 +205,7 @@ module.exports.<%- functionName %>Main = async (
205
205
  if (updateDataDetail.storageType === consts.STORAGE_TYPES.graph) {
206
206
  // let graphServiceName = await getGraphServiceTagWithCache(_izContext, getDataDetail.graphServiceTag)
207
207
 
208
- awaitingStepIds.push( // createAwaitingstepId if updateGraph
208
+ awaitingStepIds.push( // create Awaiting stepId if updateGraph
209
209
  asyncFlowSharedLib.createAwaitingStepId(
210
210
  hash({
211
211
  objectType: OBJECT_TYPE,
@@ -266,7 +266,7 @@ module.exports.<%- functionName %>Main = async (
266
266
  TopicArn: await snsSharedLib.snsTopicArn(_izContext, TOPIC_NAME_GRAPH_HANDLER.inUpdateNode, storageTag, )
267
267
  }
268
268
 
269
- _izContext.logger.debug('requset param before send to topic InUpdateNode:::', updateNodeMessageBody);
269
+ _izContext.logger.debug('request param before send to topic InUpdateNode:::', updateNodeMessageBody);
270
270
 
271
271
  let resSNS = await sns.publishAsync(_izContext, updateNodeMessageBody)
272
272
  _izContext.logger.debug('resSNS send to topic InUpdateNode finish!', resSNS);
@@ -341,7 +341,7 @@ module.exports.<%- functionName %>Main = async (
341
341
  versionedDataIds: versionedDataIds
342
342
  },
343
343
  status: "complete",
344
- errorFounds
344
+ errorsFound
345
345
  }
346
346
  } catch (err) {
347
347
  _izContext.logger.error('error AddressUpdate: ', err)
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
  'use strict';
19
19
 
20
20
  // Import required modules
21
- console.log("generate main PropertyValue Schema");
21
+ // console.log("generate main PropertyValue Schema");
22
22
  const { join } = require('path');
23
23
 
24
24
 
@@ -34,29 +34,29 @@ const modules = {
34
34
  */
35
35
  async function generateCodeWithTemplate(_izContext, objSchemaPath, settings) {
36
36
  try {
37
- console.log("settings generateCodeWithTemplate", settings)
37
+ // console.log("settings generateCodeWithTemplate", settings)
38
38
  let allCreateSource = [];
39
39
  const srcPath = join(objSchemaPath, '../');
40
40
 
41
- if (settings.generateName === "propertyValue") {
42
- let objSchemaPropertyNode = await modules.objectPropertyNodeSchema(
43
- _izContext,
44
- settings,
45
- srcPath
46
- );
47
- allCreateSource.push(...objSchemaPropertyNode);
41
+ // if (settings.generateName === "propertyValue") {
42
+ let objSchemaPropertyNode = await modules.objectPropertyNodeSchema(
43
+ _izContext,
44
+ settings,
45
+ srcPath
46
+ );
47
+ allCreateSource.push(...objSchemaPropertyNode);
48
48
 
49
- let relationshipSchemaPropertyNode = await modules.relationshipPropertyNodeSchema(
50
- _izContext,
51
- settings,
52
- srcPath
53
- );
54
- allCreateSource.push(relationshipSchemaPropertyNode);
55
-
56
- } else {
57
- throw Error(`Generate propertyNode schema Invalid generateName:${settings.generateName} `);
58
- }
49
+ let relationshipSchemaPropertyNode = await modules.relationshipPropertyNodeSchema(
50
+ _izContext,
51
+ settings,
52
+ srcPath
53
+ );
54
+ allCreateSource.push(relationshipSchemaPropertyNode);
59
55
 
56
+ // } else {
57
+ // throw Error(`Generate propertyNode schema Invalid generateName:${settings.generateName} `);
58
+ // }
59
+ // console.log("allCreateSource propertyValues", JSON.stringify(allCreateSource, null, 2))
60
60
  return allCreateSource;
61
61
  } catch (error) {
62
62
  _izContext.logger.error('Error generating code with template propertyNode schema:', error);
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
18
  'use strict';
19
19
 
20
- console.log("=== property value schema ===");
20
+ // console.log("=== property value schema ===");
21
21
 
22
22
  const path = require('path');
23
23
  const fs = require('fs');
@@ -39,89 +39,92 @@ const objectschemaLocalByPath = require('@izara_project/izara-core-library-servi
39
39
 
40
40
 
41
41
  async function data(_izContext, settings, srcPath) {
42
-
43
- let objectSchema = await objectschemaLocalByPath.getLocalObjectSchemasWithHierarchy(
44
- _izContext,
45
- settings.objType.objectType,
46
- path.join(srcPath, "./schemas")
47
- ).then(res => res.records[0]);
48
- _izContext.logger.debug("objectSchema objectSchema::", objectSchema)
49
-
50
- if (!objectSchema) {
51
- throw Error(`Invalid objType:${objTypeString(objType)}, cannot generate attribute tree schema cause objectSchema is not exists`)
52
- };
53
-
54
42
  let propertyValueObjectSchemas = [];
55
43
  let createSources = [];
56
-
57
- // let objectType = settings.objType.objectType;
58
- let propertyValueTag = settings.propertyValueTag
59
- // validate only addOnndataStructure is type propertyNode.
60
-
61
- if (!objectSchema.hasOwnProperty("addOnDataStructure") || !Array.isArray(objectSchema.addOnDataStructure) || !objectSchema.addOnDataStructure.length) {
62
- console.log(`Not have data in addOnDataStructure in objectType:${objectSchema.objectType}`);
63
- throw Error(`Not have data in addOnDataStructure in objectType:${objectSchema.objectType}`)
64
-
65
- };
66
-
67
- const storageResources = objectSchema.storageResources; // storageResource from main objectType
68
- const storageResourceTag = Object.keys(storageResources); // storage ResourceTag from main objectType
69
- const compositeKeyDeliminator = objectSchema.compositeKeyDeliminator;
70
-
71
- propertyValueObjectSchemas.push(
72
- { // {subject}property
73
- objectType: propertyValueTag + PROPERTYVALUE_TAG.property,
74
- fieldNames: {
75
- [propertyValueTag + PROPERTYVALUE_TAG.property + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
76
- },
77
- identifiers: [
78
- {
79
- type: "identifier",
80
- fieldName: propertyValueTag + PROPERTYVALUE_TAG.property + "Id"
44
+ for (const settingPropertyNode of settings) {
45
+ if (settingPropertyNode.generateName === "propertyValue") {
46
+ let objectSchema = await objectschemaLocalByPath.getLocalObjectSchemasWithHierarchy(
47
+ _izContext,
48
+ [settingPropertyNode.objType.objectType],
49
+ path.join(srcPath, "./schemas")
50
+ ).then(res => res.records[0]);
51
+ _izContext.logger.debug("objectSchema objectSchema::", objectSchema)
52
+
53
+ if (!objectSchema) {
54
+ throw Error(`Invalid objType:${objTypeString(objType)}, cannot generate attribute tree schema cause objectSchema is not exists`)
55
+ };
56
+
57
+
58
+ // let objectType = settings.objType.objectType;
59
+ let propertyValueTag = settingPropertyNode.propertyValueTag
60
+ // validate only addOnndataStructure is type propertyNode.
61
+
62
+ if (!objectSchema.hasOwnProperty("addOnDataStructure") || !Array.isArray(objectSchema.addOnDataStructure) || !objectSchema.addOnDataStructure.length) {
63
+ // console.log(`Not have data in addOnDataStructure in objectType:${objectSchema.objectType}`);
64
+ throw Error(`Not have data in addOnDataStructure in objectType:${objectSchema.objectType}`)
65
+
66
+ };
67
+
68
+ const storageResources = objectSchema.storageResources; // storageResource from main objectType
69
+ const storageResourceTag = Object.keys(storageResources); // storage ResourceTag from main objectType
70
+ const compositeKeyDeliminator = objectSchema.compositeKeyDeliminator;
71
+
72
+ propertyValueObjectSchemas.push(
73
+ { // {subject}property
74
+ objectType: propertyValueTag + PROPERTYVALUE_TAG.property,
75
+ fieldNames: {
76
+ [propertyValueTag + PROPERTYVALUE_TAG.property + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
77
+ },
78
+ identifiers: [
79
+ {
80
+ type: "identifier",
81
+ fieldName: propertyValueTag + PROPERTYVALUE_TAG.property + "Id"
82
+ }
83
+ ]
84
+ },
85
+ { // {subject}propertyLabel
86
+ objectType: propertyValueTag + PROPERTYVALUE_TAG.propertyLabel,
87
+ fieldNames: {
88
+ [propertyValueTag + PROPERTYVALUE_TAG.propertyLabel + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
89
+ },
90
+ identifiers: [
91
+ {
92
+ type: "identifier",
93
+ fieldName: propertyValueTag + PROPERTYVALUE_TAG.propertyLabel + "Id"
94
+ }
95
+ ]
81
96
  }
82
- ]
83
- },
84
- { // {subject}propertyLabel
85
- objectType: propertyValueTag + PROPERTYVALUE_TAG.propertyLabel,
86
- fieldNames: {
87
- [propertyValueTag + PROPERTYVALUE_TAG.propertyLabel + "Id"]: fieldNameSetting(FIELD_NAME_TPYE.randomOnCreateFieldName),
88
- },
89
- identifiers: [
90
- {
91
- type: "identifier",
92
- fieldName: propertyValueTag + PROPERTYVALUE_TAG.propertyLabel + "Id"
97
+ );
98
+
99
+ for (let propertyValueObjectSchema of propertyValueObjectSchemas) {
100
+ Object.assign(propertyValueObjectSchema, {
101
+ storageResources: storageResources, // add storageResources
102
+ compositeKeyDeliminator: compositeKeyDeliminator
103
+ })
104
+ for (let attributeTreeFieldName of Object.values(propertyValueObjectSchema.fieldNames)) {
105
+ Object.assign(attributeTreeFieldName, { storageResourceTags: storageResourceTag }) // add storageResourceTags for each fieldName
93
106
  }
94
- ]
95
- }
96
- );
97
-
98
- for (let propertyValueObjectSchema of propertyValueObjectSchemas) {
99
- Object.assign(propertyValueObjectSchema, {
100
- storageResources: storageResources, // add storageResources
101
- compositeKeyDeliminator: compositeKeyDeliminator
102
- })
103
- for (let attributeTreeFieldName of Object.values(propertyValueObjectSchema.fieldNames)) {
104
- Object.assign(attributeTreeFieldName, { storageResourceTags: storageResourceTag }) // add storageResourceTags for each fieldName
105
- }
106
- };
107
- for (const propertyValueObjectSchema of propertyValueObjectSchemas) {
108
- createSources.push({
109
- templatePath: templatePath,
110
- templateData: {
111
- fieldNames: JSON.stringify(propertyValueObjectSchema.fieldNames, null, 2),
112
- identifiers: JSON.stringify(propertyValueObjectSchema.identifiers, null, 2),
113
- objectType: propertyValueObjectSchema.objectType,
114
- storageResources: JSON.stringify(propertyValueObjectSchema.storageResources, null, 2),
115
- compositeKeyDeliminator: propertyValueObjectSchema.compositeKeyDeliminator
116
- },
117
- setting: {
118
- savePath: path.join(srcPath, SOURCE_PATH.generatedPropertyValue, propertyValueObjectSchema.objectType + "/"),
119
- hookPath: path.join(srcPath, "schemaHook", "propertyValue", propertyValueObjectSchema.objectType, "/"),
120
- saveFileName: SAVE_FILE_NAME.objectSchema,
121
- fileExtension: ".js",
122
- isAppend: false
107
+ };
108
+ for (const propertyValueObjectSchema of propertyValueObjectSchemas) {
109
+ createSources.push({
110
+ templatePath: templatePath,
111
+ templateData: {
112
+ fieldNames: JSON.stringify(propertyValueObjectSchema.fieldNames, null, 2),
113
+ identifiers: JSON.stringify(propertyValueObjectSchema.identifiers, null, 2),
114
+ objectType: propertyValueObjectSchema.objectType,
115
+ storageResources: JSON.stringify(propertyValueObjectSchema.storageResources, null, 2),
116
+ compositeKeyDeliminator: propertyValueObjectSchema.compositeKeyDeliminator
117
+ },
118
+ setting: {
119
+ savePath: path.join(srcPath, SOURCE_PATH.generatedPropertyValue, propertyValueObjectSchema.objectType + "/"),
120
+ hookPath: path.join(srcPath, "schemaHook", "propertyValue", propertyValueObjectSchema.objectType, "/"),
121
+ saveFileName: SAVE_FILE_NAME.objectSchema,
122
+ fileExtension: ".js",
123
+ isAppend: false
124
+ }
125
+ })
123
126
  }
124
- })
127
+ }
125
128
  };
126
129
  return createSources;
127
130