@izara_project/izara-market-library-service-schemas 1.0.55 → 1.0.56
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 +1 -0
- 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 +15 -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 +14 -10
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/data.js +20 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +8 -14
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/handler/template.ejs +2 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +45 -55
- 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 +31 -40
- 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 +5 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +28 -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/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/relationshipPerAction/create/action/handler/api/template.ejs
CHANGED
|
@@ -89,8 +89,8 @@ let validatorSchema = {
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
//(<
|
|
93
|
-
//</
|
|
92
|
+
//(<globalVariable>
|
|
93
|
+
//</globalVariable>)
|
|
94
94
|
|
|
95
95
|
// validate event params in middleware before into main function
|
|
96
96
|
validatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(validatorSchema);
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/dsq/template.ejs
CHANGED
|
@@ -110,8 +110,8 @@ let validatorSchema = {
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
//(<
|
|
114
|
-
//</
|
|
113
|
+
//(<globalVariable>
|
|
114
|
+
//</globalVariable>)
|
|
115
115
|
|
|
116
116
|
// validate event params in middleware before into main function
|
|
117
117
|
validatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(validatorSchema);
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/sqs/template.ejs
CHANGED
|
@@ -94,8 +94,8 @@ let validatorSchema = {
|
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
//(<
|
|
98
|
-
//</
|
|
97
|
+
//(<globalVariable>
|
|
98
|
+
//</globalVariable>)
|
|
99
99
|
|
|
100
100
|
// validate event params in middleware before into main function
|
|
101
101
|
validatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(validatorSchema);
|
package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs
CHANGED
|
@@ -34,8 +34,10 @@ const {
|
|
|
34
34
|
TOPIC_NAME_GRAPH_HANDLER,
|
|
35
35
|
PREFIX
|
|
36
36
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
37
|
+
|
|
37
38
|
//(<optionalRequire>)
|
|
38
39
|
//(</optionalRequire>)
|
|
40
|
+
|
|
39
41
|
module.exports.createRelationshipComplete = async (
|
|
40
42
|
_izContext,
|
|
41
43
|
returnValue,
|
|
@@ -122,6 +124,8 @@ module.exports.createRelationshipComplete = async (
|
|
|
122
124
|
_izContext.logger.debug("Send message to OutCreateRelationshipComplete :::>", sendMessageToOutCreateRelationshipComplete);
|
|
123
125
|
await sns.publishAsync(_izContext, sendMessageToOutCreateRelationshipComplete);
|
|
124
126
|
|
|
127
|
+
//(<afterCheckAwaitingStep>)
|
|
128
|
+
//(</afterCheckAwaitingStep>)
|
|
125
129
|
} // check pendingStepId finished
|
|
126
130
|
|
|
127
131
|
// remove awaitingMultipleStep after finished
|
|
@@ -134,6 +138,8 @@ module.exports.createRelationshipComplete = async (
|
|
|
134
138
|
}) // end per pendingStep
|
|
135
139
|
);
|
|
136
140
|
|
|
141
|
+
//(<afterCheckAllAwaitingStep>)
|
|
142
|
+
//(</afterCheckAllAwaitingStep>)
|
|
137
143
|
|
|
138
144
|
return {
|
|
139
145
|
returnValue,
|
package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/api/template.ejs
CHANGED
|
@@ -89,8 +89,8 @@ let validatorSchema = {
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
//(<
|
|
93
|
-
//</
|
|
92
|
+
//(<globalVariable>
|
|
93
|
+
//</globalVariable>)
|
|
94
94
|
|
|
95
95
|
// validate event params in middleware before into main function
|
|
96
96
|
validatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(validatorSchema);
|
package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/dsq/template.ejs
CHANGED
|
@@ -110,8 +110,8 @@ let validatorSchema = {
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
//(<
|
|
114
|
-
//</
|
|
113
|
+
//(<globalVariable>
|
|
114
|
+
//</globalVariable>)
|
|
115
115
|
|
|
116
116
|
// validate event params in middleware before into main function
|
|
117
117
|
validatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(validatorSchema);
|
package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/sqs/template.ejs
CHANGED
|
@@ -90,8 +90,8 @@ let validatorSchema = {
|
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
//(<
|
|
94
|
-
//</
|
|
93
|
+
//(<globalVariable>
|
|
94
|
+
//</globalVariable>)
|
|
95
95
|
|
|
96
96
|
// validate event params in middleware before into main function
|
|
97
97
|
validatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(validatorSchema);
|
package/src/reStructure/TemplateData/relationshipPerAction/get/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
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
|
|
23
|
+
//(<optionalRequire>)
|
|
24
|
+
//(</optionalRequire>)
|
|
25
25
|
|
|
26
26
|
const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>_Main');
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
// validate event params in middlewareHandler before into function
|
|
30
|
+
let basicValidatorSchema = {
|
|
29
31
|
type: "object",
|
|
30
32
|
required: ["firstObject", "secondObject", "relType", '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_-]+$",
|
|
@@ -87,21 +89,19 @@ let validatorSchema = {
|
|
|
87
89
|
}
|
|
88
90
|
};
|
|
89
91
|
|
|
92
|
+
//(<globalVariable>
|
|
93
|
+
//</globalVariable>)
|
|
90
94
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
// validate event params in middleware before into main function
|
|
96
|
-
validatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(validatorSchema);
|
|
97
|
-
middleware.setValidatorSchema(validatorSchema)
|
|
95
|
+
// validate event params in middlewareHandler before into main function
|
|
96
|
+
basicValidatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(basicValidatorSchema);
|
|
97
|
+
middlewareHandler.setValidatorSchema(basicValidatorSchema)
|
|
98
98
|
// if need to validate authorizer or additional params , add code to hook tag below
|
|
99
99
|
|
|
100
100
|
//(<afterValidateWith>)
|
|
101
101
|
//(</afterValidateWith>)
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
module.exports.main =
|
|
104
|
+
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
105
105
|
event._izContext.logger.debug('Event:', event);
|
|
106
106
|
try {
|
|
107
107
|
// invoke LambdaFunction
|
|
@@ -119,15 +119,15 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
119
119
|
|
|
120
120
|
// return error to client
|
|
121
121
|
if (lambdaFunctionResponse instanceof Error) {
|
|
122
|
-
return (
|
|
122
|
+
return (response.failure(lambdaFunctionResponse));
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
// return success to client
|
|
126
|
-
return (
|
|
126
|
+
return (response.success(lambdaFunctionResponse));
|
|
127
127
|
|
|
128
128
|
} catch (err) {
|
|
129
129
|
event._izContext.logger.error('Error, <%- functionName %>HdrApi: ', err);
|
|
130
|
-
return (
|
|
130
|
+
return (response.failure(err));
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
133
|
<%_ function firstLetterUpperCase(text) {
|
package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/dsq/template.ejs
CHANGED
|
@@ -17,8 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
|
-
const
|
|
21
|
-
const middleware = izara.middlewareHandler;
|
|
20
|
+
const { middlewareHandler, validatorSchema, response } = require("@izara_project/izara-middleware");
|
|
22
21
|
|
|
23
22
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
24
23
|
|
|
@@ -27,10 +26,13 @@ const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-
|
|
|
27
26
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
28
27
|
const recordHandlerSharedLib = require('@izara_project/izara-core-library-record-handler');
|
|
29
28
|
|
|
29
|
+
//(<optionalRequire>)
|
|
30
|
+
//(</optionalRequire>)
|
|
30
31
|
|
|
31
32
|
const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>_Main');
|
|
33
|
+
|
|
32
34
|
// validate event properties in body.Message of sqs event
|
|
33
|
-
|
|
35
|
+
middlewareHandler.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema(
|
|
34
36
|
{
|
|
35
37
|
type: "object",
|
|
36
38
|
required: ['body', 'messageAttributes'],
|
|
@@ -45,8 +47,8 @@ middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema(
|
|
|
45
47
|
}
|
|
46
48
|
));
|
|
47
49
|
|
|
48
|
-
// validate event params in
|
|
49
|
-
let
|
|
50
|
+
// validate event params in middleware before into function.
|
|
51
|
+
let basicValidatorSchema = {
|
|
50
52
|
type: "object",
|
|
51
53
|
required: ["firstObject", "secondObject", "relType", 'relId'],
|
|
52
54
|
properties: {
|
|
@@ -58,8 +60,8 @@ let validatorSchema = {
|
|
|
58
60
|
type: "object",
|
|
59
61
|
required: ["serviceTag", "objectType"],
|
|
60
62
|
properties: {
|
|
61
|
-
serviceTag:
|
|
62
|
-
objectType:
|
|
63
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
64
|
+
objectType: validatorSchema.stringNotEmpty()
|
|
63
65
|
}
|
|
64
66
|
},
|
|
65
67
|
identifiers: {
|
|
@@ -76,8 +78,8 @@ let validatorSchema = {
|
|
|
76
78
|
type: "object",
|
|
77
79
|
required: ["serviceTag", "objectType"],
|
|
78
80
|
properties: {
|
|
79
|
-
serviceTag:
|
|
80
|
-
objectType:
|
|
81
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
82
|
+
objectType: validatorSchema.stringNotEmpty()
|
|
81
83
|
}
|
|
82
84
|
},
|
|
83
85
|
identifiers: {
|
|
@@ -90,7 +92,7 @@ let validatorSchema = {
|
|
|
90
92
|
type: "object",
|
|
91
93
|
required: ["relationshipTag", "serviceTag"],
|
|
92
94
|
properties: {
|
|
93
|
-
relationshipTag:
|
|
95
|
+
relationshipTag: validatorSchema.stringNotEmpty(),
|
|
94
96
|
serviceTag: {
|
|
95
97
|
type: 'string',
|
|
96
98
|
pattern: "^[a-zA-Z0-9_-]+$",
|
|
@@ -109,18 +111,18 @@ let validatorSchema = {
|
|
|
109
111
|
};
|
|
110
112
|
|
|
111
113
|
|
|
112
|
-
//(<
|
|
113
|
-
|
|
114
|
+
//(<globalVariable>
|
|
115
|
+
//</globalVariable>)
|
|
114
116
|
|
|
115
|
-
// validate event params in
|
|
116
|
-
|
|
117
|
+
// validate event params in middlewareHandler before into main function
|
|
118
|
+
basicValidatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(basicValidatorSchema);
|
|
117
119
|
// if need to validate authorizer or additional params , add code to hook tag below
|
|
118
120
|
|
|
119
121
|
//(<afterValidateWith>)
|
|
120
122
|
//(</afterValidateWith>)
|
|
121
123
|
|
|
122
124
|
|
|
123
|
-
module.exports.main =
|
|
125
|
+
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
124
126
|
Logger.debug('event:', event);
|
|
125
127
|
Logger.debug('context:', context);
|
|
126
128
|
try {
|
|
@@ -140,7 +142,7 @@ let validatorSchema = {
|
|
|
140
142
|
await recordHandlerSharedLib.validateRecord(
|
|
141
143
|
record, // one record will send to mainFunction
|
|
142
144
|
"<%- queueName %>", // queue name that need to retry or send to dlq
|
|
143
|
-
|
|
145
|
+
basicValidatorSchema, // schema for record.Message
|
|
144
146
|
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
145
147
|
);
|
|
146
148
|
|
package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/inv/template.ejs
CHANGED
|
@@ -17,8 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
|
-
const
|
|
21
|
-
const middleware = izara.middlewareHandler;
|
|
20
|
+
const { middlewareHandler, validatorSchema, response } = require("@izara_project/izara-middleware");
|
|
22
21
|
|
|
23
22
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
24
23
|
|
|
@@ -26,10 +25,13 @@ const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-
|
|
|
26
25
|
// const Logger = require('@izara_project/izara-core-library-logger');
|
|
27
26
|
// const IntegrationTestDetail = require('@izara_project/izara-core-library-integration-tests')
|
|
28
27
|
|
|
28
|
+
//(<optionalRequire>)
|
|
29
|
+
//(</optionalRequire>)
|
|
30
|
+
|
|
29
31
|
const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>_Main');
|
|
30
32
|
|
|
31
|
-
// validate event params in
|
|
32
|
-
let
|
|
33
|
+
// validate event params in middleware before into function.
|
|
34
|
+
let basicValidatorSchema = {
|
|
33
35
|
type: "object",
|
|
34
36
|
required: ["firstObject", "secondObject", "relType", 'relId'],
|
|
35
37
|
properties: {
|
|
@@ -41,8 +43,8 @@ let validatorSchema = {
|
|
|
41
43
|
type: "object",
|
|
42
44
|
required: ["serviceTag", "objectType"],
|
|
43
45
|
properties: {
|
|
44
|
-
serviceTag:
|
|
45
|
-
objectType:
|
|
46
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
47
|
+
objectType: validatorSchema.stringNotEmpty()
|
|
46
48
|
}
|
|
47
49
|
},
|
|
48
50
|
identifiers: {
|
|
@@ -59,8 +61,8 @@ let validatorSchema = {
|
|
|
59
61
|
type: "object",
|
|
60
62
|
required: ["serviceTag", "objectType"],
|
|
61
63
|
properties: {
|
|
62
|
-
serviceTag:
|
|
63
|
-
objectType:
|
|
64
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
65
|
+
objectType: validatorSchema.stringNotEmpty()
|
|
64
66
|
}
|
|
65
67
|
},
|
|
66
68
|
identifiers: {
|
|
@@ -73,7 +75,7 @@ let validatorSchema = {
|
|
|
73
75
|
type: "object",
|
|
74
76
|
required: ["relationshipTag", "serviceTag"],
|
|
75
77
|
properties: {
|
|
76
|
-
relationshipTag:
|
|
78
|
+
relationshipTag: validatorSchema.stringNotEmpty(),
|
|
77
79
|
serviceTag: {
|
|
78
80
|
type: 'string',
|
|
79
81
|
pattern: "^[a-zA-Z0-9_-]+$",
|
|
@@ -91,10 +93,10 @@ let validatorSchema = {
|
|
|
91
93
|
}
|
|
92
94
|
};
|
|
93
95
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
basicValidatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(basicValidatorSchema); // is Ok callingFlow
|
|
97
|
+
middlewareHandler.setValidatorSchema(basicValidatorSchema)
|
|
96
98
|
|
|
97
|
-
module.exports.main =
|
|
99
|
+
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
98
100
|
event._izContext.logger.debug('Event:', event);
|
|
99
101
|
event._izContext.logger.debug('context:', context);
|
|
100
102
|
|
package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/sqs/template.ejs
CHANGED
|
@@ -16,21 +16,23 @@ 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
|
-
validateSchemaMiddleware
|
|
24
|
-
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
|
|
23
|
+
|
|
25
24
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
26
25
|
const recordHandlerSharedLib = require('@izara_project/izara-core-library-record-handler');
|
|
27
26
|
|
|
27
|
+
//(<optionalRequire>)
|
|
28
|
+
//(</optionalRequire>)
|
|
29
|
+
|
|
28
30
|
const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>_Main');
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
middlewareHandler.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
31
33
|
|
|
32
|
-
// validate event params in
|
|
33
|
-
let
|
|
34
|
+
// validate event params in middlewareHandler before into function
|
|
35
|
+
let basicValidatorSchema = {
|
|
34
36
|
type: "object",
|
|
35
37
|
required: ["firstObject", "secondObject", "relType", 'relId'],
|
|
36
38
|
properties: {
|
|
@@ -42,8 +44,8 @@ let validatorSchema = {
|
|
|
42
44
|
type: "object",
|
|
43
45
|
required: ["serviceTag", "objectType"],
|
|
44
46
|
properties: {
|
|
45
|
-
serviceTag:
|
|
46
|
-
objectType:
|
|
47
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
48
|
+
objectType: validatorSchema.stringNotEmpty()
|
|
47
49
|
}
|
|
48
50
|
},
|
|
49
51
|
identifiers: {
|
|
@@ -60,8 +62,8 @@ let validatorSchema = {
|
|
|
60
62
|
type: "object",
|
|
61
63
|
required: ["serviceTag", "objectType"],
|
|
62
64
|
properties: {
|
|
63
|
-
serviceTag:
|
|
64
|
-
objectType:
|
|
65
|
+
serviceTag: validatorSchema.stringNotEmpty(),
|
|
66
|
+
objectType: validatorSchema.stringNotEmpty()
|
|
65
67
|
}
|
|
66
68
|
},
|
|
67
69
|
identifiers: {
|
|
@@ -74,7 +76,7 @@ let validatorSchema = {
|
|
|
74
76
|
type: "object",
|
|
75
77
|
required: ["relationshipTag", "serviceTag"],
|
|
76
78
|
properties: {
|
|
77
|
-
relationshipTag:
|
|
79
|
+
relationshipTag: validatorSchema.stringNotEmpty(),
|
|
78
80
|
serviceTag: {
|
|
79
81
|
type: 'string',
|
|
80
82
|
pattern: "^[a-zA-Z0-9_-]+$",
|
|
@@ -94,17 +96,17 @@ let validatorSchema = {
|
|
|
94
96
|
|
|
95
97
|
|
|
96
98
|
|
|
97
|
-
//(<
|
|
98
|
-
//</
|
|
99
|
+
//(<globalVariable>
|
|
100
|
+
//</globalVariable>)
|
|
99
101
|
|
|
100
|
-
// validate event params in
|
|
101
|
-
|
|
102
|
+
// validate event params in middlewareHandler before into main function
|
|
103
|
+
basicValidatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(basicValidatorSchema);
|
|
102
104
|
// if need to validate authorizer or additional params , add code to hook tag below
|
|
103
105
|
|
|
104
106
|
//(<afterValidateWith>)
|
|
105
107
|
//(</afterValidateWith>)
|
|
106
108
|
|
|
107
|
-
module.exports.main =
|
|
109
|
+
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
108
110
|
|
|
109
111
|
try {
|
|
110
112
|
|
|
@@ -119,7 +121,7 @@ let validatorSchema = {
|
|
|
119
121
|
await recordHandlerSharedLib.validateRecord(
|
|
120
122
|
record, // one record will send to mainFunction
|
|
121
123
|
"<%-firstLetterUpperCase(queueName) %>", // queue name that need to retry or send to dlq
|
|
122
|
-
|
|
124
|
+
basicValidatorSchema, // schema for record.Message
|
|
123
125
|
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
124
126
|
);
|
|
125
127
|
|
package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs
CHANGED
|
@@ -53,8 +53,10 @@ const {
|
|
|
53
53
|
TOPIC_NAME_GRAPH_HANDLER
|
|
54
54
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
55
55
|
const graphSharedLib = require('@izara_project/izara-core-library-graph-service')
|
|
56
|
+
|
|
56
57
|
//(<optionalRequire>)
|
|
57
58
|
//(</optionalRequire>)
|
|
59
|
+
|
|
58
60
|
/**
|
|
59
61
|
* update relationship endpoint
|
|
60
62
|
*
|
package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/template.ejs
CHANGED
|
@@ -27,8 +27,10 @@ const recordHandlerSharedLib = require('@izara_project/izara-core-library-record
|
|
|
27
27
|
|
|
28
28
|
const getRelationshipComplete = require('./GetRelationshipComplete_Main');
|
|
29
29
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
30
|
+
|
|
30
31
|
// validate event properties in body.Message of sqs event
|
|
31
32
|
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
33
|
+
|
|
32
34
|
// set schema for record.body.Message
|
|
33
35
|
let perRecordsValidatorSchema = {
|
|
34
36
|
type: "object",
|
|
@@ -96,7 +98,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
96
98
|
passOnProperties.push(record.body.Message.errorsFound)
|
|
97
99
|
passOnProperties.push(record.body.Message.graphServiceTag)
|
|
98
100
|
passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message)) // is Ok PassBackProperties
|
|
99
|
-
// passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message)) // is Ok
|
|
101
|
+
// passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message)) // is Ok callingFlow
|
|
100
102
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
101
103
|
|
|
102
104
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
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) {
|