@izara_project/izara-market-library-service-schemas 1.0.55 → 1.0.57
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.
- package/package.json +1 -1
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +4 -27
- package/src/reStructure/TemplateData/EndpointPerService/handler/api/template.ejs +13 -14
- package/src/reStructure/TemplateData/EndpointPerService/handler/dsq/template.ejs +14 -11
- package/src/reStructure/TemplateData/EndpointPerService/handler/inv/template.ejs +9 -11
- package/src/reStructure/TemplateData/EndpointPerService/handler/sqs/template.ejs +16 -13
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +20 -10
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +6 -4
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +18 -15
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/handler/template.ejs +2 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +15 -11
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +12 -8
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/data.js +20 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +16 -21
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/handler/template.ejs +2 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/data.js +3 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +60 -62
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/template.ejs +5 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/data.js +4 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +32 -44
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerS3/template.ejs +3 -17
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/ProcessCsvtemplate.ejs +391 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +9 -317
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +7 -7
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +18 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +29 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +11 -11
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +16 -16
- package/src/reStructure/TemplateData/flowSchema/register/complete/handler/template.ejs +3 -0
- package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/handler/template.ejs +4 -0
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/mainFunction/template.ejs +36 -7
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +4 -4
- package/src/reStructure/TemplateData/perActionEndpoint/handler/api/template.ejs +2 -2
- package/src/reStructure/TemplateData/perActionEndpoint/handler/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/perActionEndpoint/handler/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +1 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/api/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +6 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/api/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/api/template.ejs +23 -23
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/dsq/template.ejs +18 -16
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/inv/template.ejs +14 -12
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/sqs/template.ejs +21 -19
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +2 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/template.ejs +3 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/api/template.ejs +24 -22
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/dsq/template.ejs +21 -17
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/inv/template.ejs +21 -19
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/sqs/template.ejs +20 -20
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/handler/sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +22 -2
package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/api/template.ejs
CHANGED
|
@@ -16,16 +16,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
|
-
|
|
20
|
-
const
|
|
19
|
+
|
|
20
|
+
const { middlewareHandler, validatorSchema, response } = require("@izara_project/izara-middleware");
|
|
21
|
+
|
|
21
22
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
|
|
24
|
+
//(<optionalRequire>)
|
|
25
|
+
//(</optionalRequire>)
|
|
25
26
|
|
|
26
27
|
const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>_Main');
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
|
|
29
|
+
// validate event params in middlewareHandler before into function
|
|
30
|
+
let basicValidatorSchema = {
|
|
29
31
|
type: "object",
|
|
30
32
|
required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection","relId"],
|
|
31
33
|
properties: {
|
|
@@ -37,8 +39,8 @@ let validatorSchema = {
|
|
|
37
39
|
type: "object",
|
|
38
40
|
required: ["serviceTag","objectType"],
|
|
39
41
|
properties: {
|
|
40
|
-
serviceTag:
|
|
41
|
-
objectType:
|
|
42
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
43
|
+
objectType: validatorSchema.stringNotEmpty(),
|
|
42
44
|
}
|
|
43
45
|
},
|
|
44
46
|
identifiers: {
|
|
@@ -55,8 +57,8 @@ let validatorSchema = {
|
|
|
55
57
|
type: "object",
|
|
56
58
|
required: ["serviceTag","objectType"],
|
|
57
59
|
properties: {
|
|
58
|
-
serviceTag:
|
|
59
|
-
objectType:
|
|
60
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
61
|
+
objectType: validatorSchema.stringNotEmpty(),
|
|
60
62
|
}
|
|
61
63
|
},
|
|
62
64
|
identifiers: {
|
|
@@ -69,7 +71,7 @@ let validatorSchema = {
|
|
|
69
71
|
type: "object",
|
|
70
72
|
required: ["relationshipTag", "serviceTag"],
|
|
71
73
|
properties: {
|
|
72
|
-
relationshipTag:
|
|
74
|
+
relationshipTag: validatorSchema.stringNotEmpty(),
|
|
73
75
|
serviceTag: {
|
|
74
76
|
type: 'string',
|
|
75
77
|
pattern: "^[a-zA-Z0-9_-]+$",
|
|
@@ -77,7 +79,7 @@ let validatorSchema = {
|
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
},
|
|
80
|
-
relId:
|
|
82
|
+
relId: validatorSchema.stringNotEmpty(),
|
|
81
83
|
relationshipProperties: {
|
|
82
84
|
type: "object",
|
|
83
85
|
minProperties: 1
|
|
@@ -90,19 +92,19 @@ let validatorSchema = {
|
|
|
90
92
|
};
|
|
91
93
|
|
|
92
94
|
|
|
93
|
-
//(<
|
|
94
|
-
//</
|
|
95
|
+
//(<globalVariable>
|
|
96
|
+
//</globalVariable>)
|
|
95
97
|
|
|
96
|
-
// validate event params in
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
// validate event params in middlewareHandler before into main function
|
|
99
|
+
basicValidatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(basicValidatorSchema);
|
|
100
|
+
middlewareHandler.setValidatorSchema(basicValidatorSchema)
|
|
99
101
|
// if need to validate authorizer or additional params , add code to hook tag below
|
|
100
102
|
|
|
101
103
|
//(<afterValidateWith>)
|
|
102
104
|
//(</afterValidateWith>)
|
|
103
105
|
|
|
104
106
|
|
|
105
|
-
module.exports.main =
|
|
107
|
+
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
106
108
|
event._izContext.logger.debug('Event:', event);
|
|
107
109
|
try {
|
|
108
110
|
// invoke LambdaFunction
|
|
@@ -121,15 +123,15 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
121
123
|
|
|
122
124
|
// return error to client
|
|
123
125
|
if (lambdaFunctionResponse instanceof Error) {
|
|
124
|
-
return (
|
|
126
|
+
return (response.failure(lambdaFunctionResponse));
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
// return success to client
|
|
128
|
-
return (
|
|
130
|
+
return (response.success(lambdaFunctionResponse));
|
|
129
131
|
|
|
130
132
|
} catch (err) {
|
|
131
133
|
event._izContext.logger.error('Error, <%- functionName %>HdrApi: ', err);
|
|
132
|
-
return (
|
|
134
|
+
return (response.failure(err));
|
|
133
135
|
}
|
|
134
136
|
});
|
|
135
137
|
<%_ function firstLetterUpperCase(text) {
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/dsq/template.ejs
CHANGED
|
@@ -16,8 +16,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
|
-
|
|
20
|
-
const
|
|
19
|
+
|
|
20
|
+
const { middlewareHandler, validatorSchema, response } = require("@izara_project/izara-middleware");
|
|
21
21
|
|
|
22
22
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
23
23
|
|
|
@@ -26,10 +26,14 @@ const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-
|
|
|
26
26
|
// const IntegrationTestDetail = require('@izara_project/izara-core-library-integration-tests')
|
|
27
27
|
const recordHandlerSharedLib = require('@izara_project/izara-core-library-record-handler');
|
|
28
28
|
const Logger = require("@izara_project/izara-core-library-logger/src/Logger");
|
|
29
|
+
|
|
30
|
+
//(<optionalRequire>)
|
|
31
|
+
//(</optionalRequire>)
|
|
32
|
+
|
|
29
33
|
const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>_Main');
|
|
30
34
|
|
|
31
35
|
// validate event properties in body.Message of sqs event
|
|
32
|
-
|
|
36
|
+
middlewareHandler.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema(
|
|
33
37
|
{
|
|
34
38
|
type: "object",
|
|
35
39
|
required: ['body', 'messageAttributes'],
|
|
@@ -44,8 +48,8 @@ middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema(
|
|
|
44
48
|
}
|
|
45
49
|
));
|
|
46
50
|
|
|
47
|
-
// validate event params in
|
|
48
|
-
let
|
|
51
|
+
// validate event params in middlewareHandler before into function
|
|
52
|
+
let basicValidatorSchema = {
|
|
49
53
|
type: "object",
|
|
50
54
|
required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection","relId"],
|
|
51
55
|
properties: {
|
|
@@ -57,8 +61,8 @@ let validatorSchema = {
|
|
|
57
61
|
type: "object",
|
|
58
62
|
required: ["serviceTag","objectType"],
|
|
59
63
|
properties: {
|
|
60
|
-
serviceTag:
|
|
61
|
-
objectType:
|
|
64
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
65
|
+
objectType: validatorSchema.stringNotEmpty(),
|
|
62
66
|
}
|
|
63
67
|
},
|
|
64
68
|
identifiers: {
|
|
@@ -75,8 +79,8 @@ let validatorSchema = {
|
|
|
75
79
|
type: "object",
|
|
76
80
|
required: ["serviceTag","objectType"],
|
|
77
81
|
properties: {
|
|
78
|
-
serviceTag:
|
|
79
|
-
objectType:
|
|
82
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
83
|
+
objectType: validatorSchema.stringNotEmpty(),
|
|
80
84
|
}
|
|
81
85
|
},
|
|
82
86
|
identifiers: {
|
|
@@ -89,7 +93,7 @@ let validatorSchema = {
|
|
|
89
93
|
type: "object",
|
|
90
94
|
required: ["relationshipTag", "serviceTag"],
|
|
91
95
|
properties: {
|
|
92
|
-
relationshipTag:
|
|
96
|
+
relationshipTag: validatorSchema.stringNotEmpty(),
|
|
93
97
|
serviceTag: {
|
|
94
98
|
type: 'string',
|
|
95
99
|
pattern: "^[a-zA-Z0-9_-]+$",
|
|
@@ -97,7 +101,7 @@ let validatorSchema = {
|
|
|
97
101
|
}
|
|
98
102
|
}
|
|
99
103
|
},
|
|
100
|
-
relId:
|
|
104
|
+
relId: validatorSchema.stringNotEmpty(),
|
|
101
105
|
relationshipProperties: {
|
|
102
106
|
type: "object",
|
|
103
107
|
minProperties: 1
|
|
@@ -110,18 +114,18 @@ let validatorSchema = {
|
|
|
110
114
|
};
|
|
111
115
|
|
|
112
116
|
|
|
113
|
-
//(<
|
|
114
|
-
//</
|
|
117
|
+
//(<globalVariable>
|
|
118
|
+
//</globalVariable>)
|
|
115
119
|
|
|
116
|
-
// validate event params in
|
|
117
|
-
|
|
120
|
+
// validate event params in middlewareHandler before into main function
|
|
121
|
+
basicValidatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(basicValidatorSchema);
|
|
118
122
|
// if need to validate authorizer or additional params , add code to hook tag below
|
|
119
123
|
|
|
120
124
|
//(<afterValidateWith>)
|
|
121
125
|
//(</afterValidateWith>)
|
|
122
126
|
|
|
123
127
|
|
|
124
|
-
module.exports.main =
|
|
128
|
+
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
125
129
|
Logger.debug('event:', event);
|
|
126
130
|
Logger.debug('context:', context);
|
|
127
131
|
try {
|
|
@@ -141,7 +145,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
141
145
|
await recordHandlerSharedLib.validateRecord(
|
|
142
146
|
record, // one record will send to mainFunction
|
|
143
147
|
"<%- queueName %>", // queue name that need to retry or send to dlq
|
|
144
|
-
|
|
148
|
+
basicValidatorSchema, // schema for record.Message
|
|
145
149
|
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
146
150
|
);
|
|
147
151
|
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/inv/template.ejs
CHANGED
|
@@ -15,8 +15,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
const middleware = izara.middlewareHandler;
|
|
18
|
+
const { middlewareHandler, validatorSchema, response } = require("@izara_project/izara-middleware");
|
|
20
19
|
|
|
21
20
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
22
21
|
|
|
@@ -24,10 +23,13 @@ const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-
|
|
|
24
23
|
// const Logger = require('@izara_project/izara-core-library-logger');
|
|
25
24
|
// const IntegrationTestDetail = require('@izara_project/izara-core-library-integration-tests')
|
|
26
25
|
|
|
26
|
+
//(<optionalRequire>)
|
|
27
|
+
//(</optionalRequire>)
|
|
28
|
+
|
|
27
29
|
const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>_Main');
|
|
28
30
|
|
|
29
|
-
// validate event params in
|
|
30
|
-
let
|
|
31
|
+
// validate event params in middlewareHandler before into function.
|
|
32
|
+
let basicValidatorSchema = {
|
|
31
33
|
type: "object",
|
|
32
34
|
required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection","relId"],
|
|
33
35
|
properties: {
|
|
@@ -39,8 +41,8 @@ let validatorSchema = {
|
|
|
39
41
|
type: "object",
|
|
40
42
|
required: ["serviceTag","objectType"],
|
|
41
43
|
properties: {
|
|
42
|
-
serviceTag:
|
|
43
|
-
objectType:
|
|
44
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
45
|
+
objectType: validatorSchema.stringNotEmpty(),
|
|
44
46
|
}
|
|
45
47
|
},
|
|
46
48
|
identifiers: {
|
|
@@ -57,8 +59,8 @@ let validatorSchema = {
|
|
|
57
59
|
type: "object",
|
|
58
60
|
required: ["serviceTag","objectType"],
|
|
59
61
|
properties: {
|
|
60
|
-
serviceTag:
|
|
61
|
-
objectType:
|
|
62
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
63
|
+
objectType: validatorSchema.stringNotEmpty(),
|
|
62
64
|
}
|
|
63
65
|
},
|
|
64
66
|
identifiers: {
|
|
@@ -71,7 +73,7 @@ let validatorSchema = {
|
|
|
71
73
|
type: "object",
|
|
72
74
|
required: ["relationshipTag", "serviceTag"],
|
|
73
75
|
properties: {
|
|
74
|
-
relationshipTag:
|
|
76
|
+
relationshipTag: validatorSchema.stringNotEmpty(),
|
|
75
77
|
serviceTag: {
|
|
76
78
|
type: 'string',
|
|
77
79
|
pattern: "^[a-zA-Z0-9_-]+$",
|
|
@@ -79,7 +81,7 @@ let validatorSchema = {
|
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
},
|
|
82
|
-
relId:
|
|
84
|
+
relId: validatorSchema.stringNotEmpty(),
|
|
83
85
|
relationshipProperties: {
|
|
84
86
|
type: "object",
|
|
85
87
|
minProperties: 1
|
|
@@ -91,19 +93,19 @@ let validatorSchema = {
|
|
|
91
93
|
}
|
|
92
94
|
};
|
|
93
95
|
|
|
94
|
-
//(<
|
|
95
|
-
//</
|
|
96
|
+
//(<globalVariable>
|
|
97
|
+
//</globalVariable>)
|
|
96
98
|
|
|
97
|
-
// validate event params in
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
// validate event params in middlewareHandler before into main function
|
|
100
|
+
basicValidatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(basicValidatorSchema);
|
|
101
|
+
middlewareHandler.setValidatorSchema(basicValidatorSchema)
|
|
100
102
|
// if need to validate authorizer or additional params , add code to hook tag below
|
|
101
103
|
|
|
102
104
|
//(<afterValidateWith>)
|
|
103
105
|
//(</afterValidateWith>)
|
|
104
106
|
|
|
105
107
|
|
|
106
|
-
module.exports.main =
|
|
108
|
+
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
107
109
|
event._izContext.logger.debug('Event:', event);
|
|
108
110
|
event._izContext.logger.debug('context:',context);
|
|
109
111
|
|
|
@@ -126,15 +128,15 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
126
128
|
|
|
127
129
|
// return error to client
|
|
128
130
|
if (lambdaFunctionResponse instanceof Error) {
|
|
129
|
-
return (
|
|
131
|
+
return (response.failure(lambdaFunctionResponse));
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
// return success to client
|
|
133
|
-
return (
|
|
135
|
+
return (response.success(lambdaFunctionResponse));
|
|
134
136
|
|
|
135
137
|
} catch (err) {
|
|
136
138
|
event._izContext.logger.error('Error, <%- firstLetterUpperCase(functionName) %>HdrInv: ', err);
|
|
137
|
-
return (
|
|
139
|
+
return (response.failure(err));
|
|
138
140
|
}
|
|
139
141
|
});
|
|
140
142
|
<%_ function firstLetterUpperCase(text){
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/sqs/template.ejs
CHANGED
|
@@ -16,21 +16,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
|
-
|
|
20
|
-
const
|
|
19
|
+
|
|
20
|
+
const { middlewareHandler, validatorSchema, response } = require("@izara_project/izara-middleware");
|
|
21
21
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
22
|
-
const {
|
|
23
|
-
validateSchemaMiddleware
|
|
24
|
-
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
|
|
25
22
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
26
23
|
const recordHandlerSharedLib = require('@izara_project/izara-core-library-record-handler');
|
|
27
24
|
|
|
25
|
+
//(<optionalRequire>)
|
|
26
|
+
//(</optionalRequire>)
|
|
27
|
+
|
|
28
28
|
const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>_Main');
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
middlewareHandler.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
31
31
|
|
|
32
|
-
// validate event params in
|
|
33
|
-
let
|
|
32
|
+
// validate event params in middlewareHandler before into function
|
|
33
|
+
let basicValidatorSchema = {
|
|
34
34
|
type: "object",
|
|
35
35
|
required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection","relId"],
|
|
36
36
|
properties: {
|
|
@@ -42,8 +42,8 @@ let validatorSchema = {
|
|
|
42
42
|
type: "object",
|
|
43
43
|
required: ["serviceTag","objectType"],
|
|
44
44
|
properties: {
|
|
45
|
-
serviceTag:
|
|
46
|
-
objectType:
|
|
45
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
46
|
+
objectType: validatorSchema.stringNotEmpty(),
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
identifiers: {
|
|
@@ -60,8 +60,8 @@ let validatorSchema = {
|
|
|
60
60
|
type: "object",
|
|
61
61
|
required: ["serviceTag","objectType"],
|
|
62
62
|
properties: {
|
|
63
|
-
serviceTag:
|
|
64
|
-
objectType:
|
|
63
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
64
|
+
objectType: validatorSchema.stringNotEmpty(),
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
identifiers: {
|
|
@@ -74,7 +74,7 @@ let validatorSchema = {
|
|
|
74
74
|
type: "object",
|
|
75
75
|
required: ["relationshipTag", "serviceTag"],
|
|
76
76
|
properties: {
|
|
77
|
-
relationshipTag:
|
|
77
|
+
relationshipTag: validatorSchema.stringNotEmpty(),
|
|
78
78
|
serviceTag: {
|
|
79
79
|
type: 'string',
|
|
80
80
|
pattern: "^[a-zA-Z0-9_-]+$",
|
|
@@ -82,7 +82,7 @@ let validatorSchema = {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
-
relId:
|
|
85
|
+
relId: validatorSchema.stringNotEmpty(),
|
|
86
86
|
relationshipProperties: {
|
|
87
87
|
type: "object",
|
|
88
88
|
minProperties: 1
|
|
@@ -94,17 +94,17 @@ let validatorSchema = {
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
//(<
|
|
98
|
-
//</
|
|
97
|
+
//(<globalVariable>
|
|
98
|
+
//</globalVariable>)
|
|
99
99
|
|
|
100
|
-
// validate event params in
|
|
101
|
-
|
|
100
|
+
// validate event params in middlewareHandler before into main function
|
|
101
|
+
basicValidatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(basicValidatorSchema);
|
|
102
102
|
// if need to validate authorizer or additional params , add code to hook tag below
|
|
103
103
|
|
|
104
104
|
//(<afterValidateWith>)
|
|
105
105
|
//(</afterValidateWith>)
|
|
106
106
|
|
|
107
|
-
module.exports.main =
|
|
107
|
+
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
108
108
|
|
|
109
109
|
try {
|
|
110
110
|
|
|
@@ -119,7 +119,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
119
119
|
await recordHandlerSharedLib.validateRecord(
|
|
120
120
|
record, // one record will send to mainFunction
|
|
121
121
|
"<%- queueName %>", // queue name that need to retry or send to dlq
|
|
122
|
-
|
|
122
|
+
basicValidatorSchema, // schema for record.Message
|
|
123
123
|
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
124
124
|
);
|
|
125
125
|
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs
CHANGED
|
@@ -327,7 +327,7 @@ module.exports.updateRelationship = async (
|
|
|
327
327
|
updateRelMessageBody,
|
|
328
328
|
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
329
329
|
callingFlowConfig, // receive parent callingFlowConfig.
|
|
330
|
-
callingFlowSharedLib.createCallingFlowConfig( //
|
|
330
|
+
callingFlowSharedLib.createCallingFlowConfig( // callingFlow own service
|
|
331
331
|
//(<callingFlowProperties>)
|
|
332
332
|
await lambdaSharedLib.lambdaFunctionName(_izContext, TOPIC_NAME_GENERATE_CODE.updateRelComplete),
|
|
333
333
|
//(</callingFlowProperties>)
|
package/src/reStructure/TemplateData/relationshipPerAction/update/complete/handler/sqs/template.ejs
CHANGED
|
@@ -96,7 +96,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
96
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
|
-
// passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message)) // is Ok
|
|
99
|
+
// passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message)) // is Ok callingFlow
|
|
100
100
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
101
101
|
//(<afterSendParamToMainFunction>)
|
|
102
102
|
//(</afterSendParamToMainFunction>)
|
|
@@ -30,7 +30,7 @@ const STORAGE_TYPES = {
|
|
|
30
30
|
graph: "graph"
|
|
31
31
|
}
|
|
32
32
|
const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../../../MainLibs/src/Consts')
|
|
33
|
-
const { firstUpperCase: upperCase } = require('../../../../MainLibs/src/Utils')
|
|
33
|
+
const { firstUpperCase: upperCase, getLocalConfig } = require('../../../../MainLibs/src/Utils')
|
|
34
34
|
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
35
35
|
const { NoRetryError } = require("@izara_project/izara-core-library-core");
|
|
36
36
|
|
|
@@ -45,7 +45,13 @@ async function filterCreateResourceYaml(_izContext, createSourceParams, objSchem
|
|
|
45
45
|
}
|
|
46
46
|
}))
|
|
47
47
|
|
|
48
|
-
const
|
|
48
|
+
const allLocalObjSchema = await getObjectSchema.getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
|
|
49
|
+
await Promise.all(allLocalObjSchema.records.map(async (objSchema) => {
|
|
50
|
+
if (objSchema.hasOwnProperty("extendObjType")) {
|
|
51
|
+
tableNamesToFilter.add(...await getParentTableFromObjSchema(_izContext, objSchema, objSchemaPath))
|
|
52
|
+
}
|
|
53
|
+
}))
|
|
54
|
+
let filteredCreateSourceParams = createSourceParams.filter(
|
|
49
55
|
(result) => !tableNamesToFilter.has(result.templateData.tableName)
|
|
50
56
|
)
|
|
51
57
|
|
|
@@ -69,3 +75,17 @@ async function getStoredCacheTableFromFlowSchema(_izContext, flowSchema, objSche
|
|
|
69
75
|
}
|
|
70
76
|
return tableNameStoredCache;
|
|
71
77
|
}
|
|
78
|
+
|
|
79
|
+
async function getParentTableFromObjSchema(_izContext, objSchema, objSchemaPath) {
|
|
80
|
+
let parentTableNames = new Set();
|
|
81
|
+
let ownServiceTag = getLocalConfig(path.join(objSchemaPath, "../../"), "iz_serviceTag")
|
|
82
|
+
for (const storageResource of Object.values(objSchema.storageResources)) {
|
|
83
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
84
|
+
if (storageResource.serviceTag && storageResource.serviceTag !== ownServiceTag) {
|
|
85
|
+
parentTableNames.add(storageResource.tableName)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return parentTableNames
|
|
91
|
+
}
|