@izara_project/izara-market-library-service-schemas 1.0.67 → 1.0.69
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 +2 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +23 -11
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +8 -0
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +12 -1
- package/src/reStructure/TemplateData/findData/findDataYaml/data.js +2 -2
- package/src/reStructure/TemplateData/processLogical/yaml/data.js +2 -2
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/dsq/data.js +2 -2
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/sqs/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/data.js +4 -4
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/mainFunction/template.ejs +4 -4
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/apiTemplate.ejs +26 -44
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/dsqTemplate.ejs +26 -44
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/invTemplate.ejs +26 -44
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/sqsTemplate.ejs +26 -44
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +1 -4
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/data.js +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/apiTemplate.ejs +36 -55
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/dsqTemplate.ejs +36 -54
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/invTemplate.ejs +36 -54
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/sqsTemplate.ejs +36 -54
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +1 -4
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/data.js +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/apiTemplate.ejs +28 -47
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/dsqTemplate.ejs +28 -47
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/invTemplate.ejs +28 -47
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/sqsTemplate.ejs +28 -47
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +1 -4
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/data.js +2 -23
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/apiTemplate.ejs +15 -30
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/dsqTemplate.ejs +15 -30
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/invTemplate.ejs +15 -30
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/sqsTemplate.ejs +15 -30
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/functionYaml/data.js +1 -4
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/data.js +2 -9
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/apiTemplate.ejs +39 -56
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/dsqTemplate.ejs +39 -56
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/invTemplate.ejs +39 -56
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/sqsTemplate.ejs +39 -56
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +1 -4
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +1 -1
- package/src/reStructure/TemplateData/resourceYaml/generateTemplateData.js +1 -1
package/package.json
CHANGED
|
@@ -897,6 +897,8 @@ async function createDataDetailsLib(_izContext, objectSchemas, settings = { buck
|
|
|
897
897
|
fieldNames: [keyFieldName],
|
|
898
898
|
accountId: storageResources[eachStorageResourceTag].accountId,
|
|
899
899
|
region: storageResources[eachStorageResourceTag].region,
|
|
900
|
+
serviceTag: storageResources[eachStorageResourceTag].serviceTag,
|
|
901
|
+
stage: storageResources[eachStorageResourceTag].stage
|
|
900
902
|
}
|
|
901
903
|
});
|
|
902
904
|
}
|
|
@@ -31,7 +31,8 @@ const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-
|
|
|
31
31
|
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
32
32
|
const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
|
|
33
33
|
const coreConsts = require('@izara_project/izara-core-library-core/src/Consts');
|
|
34
|
-
const { createRandomIdentifier } = require('@izara_project/izara-core-library-
|
|
34
|
+
const { createRandomIdentifier } = require('@izara_project/izara-core-library-identifiers');
|
|
35
|
+
|
|
35
36
|
// ──────────────────────── Middleware / External ────────────────────────
|
|
36
37
|
const middlewareConsts = require('@izara_project/izara-middleware').consts;
|
|
37
38
|
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
@@ -67,7 +68,8 @@ const PREFIX = {
|
|
|
67
68
|
ONE: "one",
|
|
68
69
|
MANY: "many",
|
|
69
70
|
CREATE_OBJECT_ASYNC: "createObjectAsync",
|
|
70
|
-
CREATE_OBJECT_ASYNC_COMPLETE: "createObjectAsyncComplete"
|
|
71
|
+
CREATE_OBJECT_ASYNC_COMPLETE: "createObjectAsyncComplete",
|
|
72
|
+
CREATE_OBJECT_EXTERNAL_TOPIC: "createObjectExternalTopic"
|
|
71
73
|
}
|
|
72
74
|
//-----------------------------------------------------------------------------------------------------------
|
|
73
75
|
|
|
@@ -295,8 +297,9 @@ module.exports.createMain = async (
|
|
|
295
297
|
|
|
296
298
|
let listOfObjectForCreates = [];
|
|
297
299
|
|
|
298
|
-
let objInstanceFullForDynamoDb = lodash.cloneDeep(objInstanceFull)
|
|
299
|
-
let objInstanceFullForGraph = lodash.cloneDeep(objInstanceFull)
|
|
300
|
+
let objInstanceFullForDynamoDb = lodash.cloneDeep(objInstanceFull);
|
|
301
|
+
let objInstanceFullForGraph = lodash.cloneDeep(objInstanceFull);
|
|
302
|
+
let objInstanceFullForExternalTopic = lodash.cloneDeep(objInstanceFull);
|
|
300
303
|
|
|
301
304
|
if (errorsFound.length == 0) {
|
|
302
305
|
//(<validateBeforeCreate>)
|
|
@@ -312,8 +315,9 @@ module.exports.createMain = async (
|
|
|
312
315
|
if (parentObject) {
|
|
313
316
|
if (createDataDetail.tableName.includes(firstLetterUpperCase(`${parentObject.objectType}Records`))) {
|
|
314
317
|
Object.assign(
|
|
315
|
-
objInstanceFullForDynamoDb.fields,
|
|
316
|
-
|
|
318
|
+
objInstanceFullForDynamoDb.fields, {
|
|
319
|
+
[`${parentObject.objectType}HandlerServiceTag`]: process.env.iz_serviceTag
|
|
320
|
+
})
|
|
317
321
|
}
|
|
318
322
|
}
|
|
319
323
|
|
|
@@ -379,13 +383,21 @@ module.exports.createMain = async (
|
|
|
379
383
|
_izContext.logger.debug("::::::externalTopic::::::", { storageTag, createDataDetail });
|
|
380
384
|
//(<beforeSendMessageToExternalTopic>)
|
|
381
385
|
//(</beforeSendMessageToExternalTopic>)
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
+
Object.assign(objInstanceFullForExternalTopic.fields, createObjInstanceFullFieldsByStorageTag(_izContext, storageTag, createDataDetail))
|
|
387
|
+
_izContext.logger.debug("objInstanceFull before send to external topic", objInstanceFullForExternalTopic)
|
|
388
|
+
|
|
389
|
+
allAwaitingStepsId.push(await asyncFlowSharedLib.createAwaitingStepId(
|
|
390
|
+
(hash({
|
|
391
|
+
objType: objType,
|
|
392
|
+
graphServerTag: storageTag,
|
|
393
|
+
identifiers: objInstanceFullForGraph.identifiers,
|
|
394
|
+
callingFlowProperties: callingFlowConfig.callingFlowProperties || {}
|
|
395
|
+
})),
|
|
396
|
+
PREFIX.CREATE_OBJECT_EXTERNAL_TOPIC
|
|
397
|
+
));
|
|
386
398
|
|
|
387
399
|
let sendToCreateExternalTopic = {
|
|
388
|
-
Message: JSON.stringify(
|
|
400
|
+
Message: JSON.stringify(objInstanceFullForExternalTopic),
|
|
389
401
|
TopicArn: `arn:aws:sns:${createDataDetail.region}:${createDataDetail.accountId}:${createDataDetail.serviceTag}_${createDataDetail.stage}_Create_In`
|
|
390
402
|
};
|
|
391
403
|
_izContext.logger.debug("Request params before send to create endpoint:", sendToCreateExternalTopic);
|
|
@@ -204,6 +204,14 @@ async function externalLambdaIamRoleRelationships(_izContext, allRelSchemas) {
|
|
|
204
204
|
graphServiceNamesFromAllRelSchemas.map(graphServiceName =>
|
|
205
205
|
externalResourceName(RESOURCE_CLASSES.sns, "ChangeRelationshipType_In", graphServiceName)
|
|
206
206
|
)
|
|
207
|
+
),
|
|
208
|
+
createIamRole(
|
|
209
|
+
{
|
|
210
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
211
|
+
},
|
|
212
|
+
graphServiceNamesFromAllRelSchemas.map(graphServiceName =>
|
|
213
|
+
externalResourceName(RESOURCE_CLASSES.sns, "MoveRelationship_In", graphServiceName)
|
|
214
|
+
)
|
|
207
215
|
)
|
|
208
216
|
)
|
|
209
217
|
}
|
|
@@ -167,6 +167,17 @@ async function snsSubscriptionDeleteRelationshipComplete(_izContext, allRelSchem
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
async function snsSubscriptionDeleteRelationshipComplete(_izContext, allRelSchemas) {
|
|
171
|
+
let serviceTag = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas)
|
|
172
|
+
|
|
173
|
+
return {
|
|
174
|
+
serviceTag: serviceTag,
|
|
175
|
+
topicName: TOPIC_NAME_GRAPH_HANDLER.outMoveRelationship,
|
|
176
|
+
sqsEndpoint: TOPIC_NAME_GENERATE_CODE.moveRelationshipComplete
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
170
181
|
function snsSubscriptionReservedLimitCompleteForReservedDynamicUsage(_izContext) {
|
|
171
182
|
let serviceTag = [EXTERNAL_SERVICE_NAME.accountLimits]
|
|
172
183
|
return {
|
|
@@ -187,6 +198,6 @@ function snsSubscriptionConfirmReserved(_izContext) {
|
|
|
187
198
|
}
|
|
188
199
|
|
|
189
200
|
async function snsSubScriptionFromExternalTopic(_izContext, allObjectSchemas) {
|
|
190
|
-
|
|
201
|
+
|
|
191
202
|
}
|
|
192
203
|
module.exports = createExternalSnsSubscriptions;
|
|
@@ -65,7 +65,7 @@ async function data(_izContext, objectSchemas, srcPath, settings) {
|
|
|
65
65
|
for (let storageResource of Object.values(objectSchema.storageResources)) {
|
|
66
66
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
67
67
|
// add IamRole for dynamodb depend on tableName in storageResources of objectSchema
|
|
68
|
-
tableForGetItem.push(resourceNames(RESOURCE_CLASSES.dynamoDbTable, storageResource.tableName));
|
|
68
|
+
tableForGetItem.push(resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(storageResource.tableName)));
|
|
69
69
|
|
|
70
70
|
} else if (storageResource.storageType === STORAGE_TYPES.graph) {
|
|
71
71
|
// find graph serviceName from graphServerTag or *GetNodeHdrInv ?
|
|
@@ -90,7 +90,7 @@ async function data(_izContext, objectSchemas, srcPath, settings) {
|
|
|
90
90
|
additionalResourcePermission.push(
|
|
91
91
|
createIamRole(
|
|
92
92
|
{ [RESOURCE_CLASSES.dynamoDbTable]: [DEFAULT_LAMBDA_ROLE_PER_ACTION[ACTIONS.get].dynamoDbPermission] },
|
|
93
|
-
|
|
93
|
+
tableForGetItem
|
|
94
94
|
)
|
|
95
95
|
);
|
|
96
96
|
}
|
|
@@ -62,7 +62,7 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
62
62
|
for (let storageResource of Object.values(objectSchema.storageResources)) {
|
|
63
63
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
64
64
|
// add IamRole for dynamodb depend on tableName in storageResources of objectSchema
|
|
65
|
-
tableForQuery.push(resourceNames(RESOURCE_CLASSES.dynamoDbTable, storageResource.tableName));
|
|
65
|
+
tableForQuery.push(resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(storageResource.tableName)));
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -71,7 +71,7 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
71
71
|
additionalResourcePermission.push(
|
|
72
72
|
createIamRole(
|
|
73
73
|
{ [RESOURCE_CLASSES.dynamoDbTable]: DYNAMO_RESOURCE.query },
|
|
74
|
-
|
|
74
|
+
[tableForQuery]
|
|
75
75
|
)
|
|
76
76
|
);
|
|
77
77
|
}
|
|
@@ -60,7 +60,7 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
60
60
|
for (let storageResource of Object.values(objectSchema.storageResources)) {
|
|
61
61
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
62
62
|
// add IamRole for dynamodb depend on tableName in storageResources of objectSchema
|
|
63
|
-
tableForQuery.push(resourceNames(RESOURCE_CLASSES.dynamoDbTable, storageResource.tableName));
|
|
63
|
+
tableForQuery.push(resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(storageResource.tableName)));
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -69,7 +69,7 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
69
69
|
additionalResourcePermission.push(
|
|
70
70
|
createIamRole(
|
|
71
71
|
{ [RESOURCE_CLASSES.dynamoDbTable]: "Query" },
|
|
72
|
-
|
|
72
|
+
tableForQuery
|
|
73
73
|
)
|
|
74
74
|
);
|
|
75
75
|
}
|
|
@@ -61,7 +61,7 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
61
61
|
for (let storageResource of Object.values(objectSchema.storageResources)) {
|
|
62
62
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
63
63
|
// add IamRole for dynamodb depend on tableName in storageResources of objectSchema
|
|
64
|
-
tableForQuery.push(resourceNames(RESOURCE_CLASSES.dynamoDbTable, storageResource.tableName));
|
|
64
|
+
tableForQuery.push(resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(storageResource.tableName)));
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -70,7 +70,7 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
70
70
|
additionalResourcePermission.push(
|
|
71
71
|
createIamRole(
|
|
72
72
|
{ [RESOURCE_CLASSES.dynamoDbTable]: DYNAMO_RESOURCE.query },
|
|
73
|
-
|
|
73
|
+
tableForQuery
|
|
74
74
|
)
|
|
75
75
|
);
|
|
76
76
|
}
|
|
@@ -60,7 +60,7 @@ function data(_izContext, srcPath) {
|
|
|
60
60
|
const createSourceParam = createParamForCreateSource(handlerType, srcPath);
|
|
61
61
|
createSourceArray.push(createSourceParam);
|
|
62
62
|
}
|
|
63
|
-
// console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", createSourceArray)
|
|
63
|
+
// console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", JSON.stringify(createSourceArray, null, 2))
|
|
64
64
|
return createSourceArray
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -93,10 +93,10 @@ function createParamForCreateSource(handlerType, srcPath) {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
if (handlerType === HANDLER.hdrSqs) {
|
|
96
|
-
createIamRole(
|
|
96
|
+
additionalResourcePermission.push(createIamRole(
|
|
97
97
|
{
|
|
98
98
|
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe],
|
|
99
|
-
[RESOURCE_CLASSES.sqs]:
|
|
99
|
+
[RESOURCE_CLASSES.sqs]: Object.values(SQS_RESOURCE)
|
|
100
100
|
},
|
|
101
101
|
[
|
|
102
102
|
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.changeRelComplete) + "_Out"),
|
|
@@ -105,7 +105,7 @@ function createParamForCreateSource(handlerType, srcPath) {
|
|
|
105
105
|
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
106
106
|
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
107
107
|
]
|
|
108
|
-
)
|
|
108
|
+
))
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
return {
|
|
@@ -234,8 +234,8 @@ module.exports.<%- functionName %> = async (
|
|
|
234
234
|
if (errorsFound.length) {
|
|
235
235
|
|
|
236
236
|
let changeRelCompleteMsg = {
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
firstObject,
|
|
238
|
+
secondObject,
|
|
239
239
|
oldRelTypeAndDirection,
|
|
240
240
|
newRelType,
|
|
241
241
|
originTimestamp,
|
|
@@ -320,8 +320,8 @@ module.exports.<%- functionName %> = async (
|
|
|
320
320
|
|
|
321
321
|
// prepare message body
|
|
322
322
|
let changeRelMessageBody = {
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
firstObject,
|
|
324
|
+
secondObject,
|
|
325
325
|
oldRelTypeAndDirection,
|
|
326
326
|
newRelType,
|
|
327
327
|
originTimestamp,
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/data.js
CHANGED
|
@@ -98,7 +98,7 @@ function createParamForCreateSource(allObjectRelationships, handlerType, srcPath
|
|
|
98
98
|
createIamRole(
|
|
99
99
|
{
|
|
100
100
|
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe],
|
|
101
|
-
[RESOURCE_CLASSES.sqs]:
|
|
101
|
+
[RESOURCE_CLASSES.sqs]: Object.values(SQS_RESOURCE)
|
|
102
102
|
},
|
|
103
103
|
[
|
|
104
104
|
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out"),
|
|
@@ -27,82 +27,64 @@ const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>
|
|
|
27
27
|
// validate event params in middleware before into function
|
|
28
28
|
let validatorSchema = {
|
|
29
29
|
type: "object",
|
|
30
|
-
required: [
|
|
31
|
-
'firstObject',
|
|
32
|
-
'secondObject',
|
|
33
|
-
'oldReltypeAndDirection',
|
|
34
|
-
'newRelType',
|
|
35
|
-
],
|
|
30
|
+
required: ["firstObject", "secondObject", "relType", "relationshipDirection"],
|
|
36
31
|
properties: {
|
|
37
32
|
firstObject: {
|
|
38
|
-
type:
|
|
39
|
-
required: [
|
|
33
|
+
type: "object",
|
|
34
|
+
required: ["objType", "identifiers"],
|
|
40
35
|
properties: {
|
|
41
36
|
objType: {
|
|
42
|
-
type:
|
|
43
|
-
required: [
|
|
37
|
+
type: "object",
|
|
38
|
+
required: ["serviceTag", "objectType"],
|
|
44
39
|
properties: {
|
|
45
40
|
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
46
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
41
|
+
objectType: izara.validatorSchema.stringNotEmpty()
|
|
47
42
|
}
|
|
48
43
|
},
|
|
49
44
|
identifiers: {
|
|
50
45
|
type: "object",
|
|
51
46
|
minProperties: 1
|
|
52
|
-
}
|
|
47
|
+
}
|
|
53
48
|
}
|
|
54
49
|
},
|
|
55
50
|
secondObject: {
|
|
56
|
-
type:
|
|
57
|
-
required: [
|
|
51
|
+
type: "object",
|
|
52
|
+
required: ["objType", "identifiers"],
|
|
58
53
|
properties: {
|
|
59
54
|
objType: {
|
|
60
|
-
type:
|
|
61
|
-
required: [
|
|
55
|
+
type: "object",
|
|
56
|
+
required: ["serviceTag", "objectType"],
|
|
62
57
|
properties: {
|
|
63
58
|
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
64
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
59
|
+
objectType: izara.validatorSchema.stringNotEmpty()
|
|
65
60
|
}
|
|
66
61
|
},
|
|
67
62
|
identifiers: {
|
|
68
63
|
type: "object",
|
|
69
64
|
minProperties: 1
|
|
70
|
-
}
|
|
65
|
+
}
|
|
71
66
|
}
|
|
72
67
|
},
|
|
73
|
-
|
|
74
|
-
type:
|
|
75
|
-
required: [
|
|
68
|
+
relType: {
|
|
69
|
+
type: "object",
|
|
70
|
+
required: ["relationshipTag", "serviceTag"],
|
|
76
71
|
properties: {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
required: ['serviceTag', 'relationshipTag'],
|
|
80
|
-
properties: {
|
|
81
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
82
|
-
relationshipTag: izara.validatorSchema.stringNotEmpty(),
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
relationshipProperties: {
|
|
86
|
-
type: 'object',
|
|
87
|
-
},
|
|
88
|
-
relationshipDirection: {
|
|
72
|
+
relationshipTag: izara.validatorSchema.stringNotEmpty(),
|
|
73
|
+
serviceTag: {
|
|
89
74
|
type: 'string',
|
|
90
|
-
|
|
91
|
-
|
|
75
|
+
pattern: "^[a-zA-Z0-9_-]+$",
|
|
76
|
+
enum: [process.env.iz_serviceTag]
|
|
92
77
|
},
|
|
93
78
|
}
|
|
94
79
|
},
|
|
95
|
-
|
|
80
|
+
relationshipDirection: {
|
|
81
|
+
type: "string",
|
|
82
|
+
enum: ['from', "to"]
|
|
83
|
+
},
|
|
84
|
+
relationshipProperties: {
|
|
96
85
|
type: 'object',
|
|
97
|
-
|
|
98
|
-
properties: {
|
|
99
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
100
|
-
relationshipTag: izara.validatorSchema.stringNotEmpty(),
|
|
101
|
-
}
|
|
86
|
+
default: {}
|
|
102
87
|
},
|
|
103
|
-
settings: {
|
|
104
|
-
type: 'object'
|
|
105
|
-
}
|
|
106
88
|
}
|
|
107
89
|
};
|
|
108
90
|
|
|
@@ -48,82 +48,64 @@ middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema(
|
|
|
48
48
|
// validate event params in middlewware before into function.
|
|
49
49
|
let validatorSchema = {
|
|
50
50
|
type: "object",
|
|
51
|
-
required: [
|
|
52
|
-
'firstObject',
|
|
53
|
-
'secondObject',
|
|
54
|
-
'oldReltypeAndDirection',
|
|
55
|
-
'newRelType',
|
|
56
|
-
],
|
|
51
|
+
required: ["firstObject", "secondObject", "relType", "relationshipDirection"],
|
|
57
52
|
properties: {
|
|
58
53
|
firstObject: {
|
|
59
|
-
type:
|
|
60
|
-
required: [
|
|
54
|
+
type: "object",
|
|
55
|
+
required: ["objType", "identifiers"],
|
|
61
56
|
properties: {
|
|
62
57
|
objType: {
|
|
63
|
-
type:
|
|
64
|
-
required: [
|
|
58
|
+
type: "object",
|
|
59
|
+
required: ["serviceTag", "objectType"],
|
|
65
60
|
properties: {
|
|
66
61
|
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
67
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
62
|
+
objectType: izara.validatorSchema.stringNotEmpty()
|
|
68
63
|
}
|
|
69
64
|
},
|
|
70
65
|
identifiers: {
|
|
71
66
|
type: "object",
|
|
72
67
|
minProperties: 1
|
|
73
|
-
}
|
|
68
|
+
}
|
|
74
69
|
}
|
|
75
70
|
},
|
|
76
71
|
secondObject: {
|
|
77
|
-
type:
|
|
78
|
-
required: [
|
|
72
|
+
type: "object",
|
|
73
|
+
required: ["objType", "identifiers"],
|
|
79
74
|
properties: {
|
|
80
75
|
objType: {
|
|
81
|
-
type:
|
|
82
|
-
required: [
|
|
76
|
+
type: "object",
|
|
77
|
+
required: ["serviceTag", "objectType"],
|
|
83
78
|
properties: {
|
|
84
79
|
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
85
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
80
|
+
objectType: izara.validatorSchema.stringNotEmpty()
|
|
86
81
|
}
|
|
87
82
|
},
|
|
88
83
|
identifiers: {
|
|
89
84
|
type: "object",
|
|
90
85
|
minProperties: 1
|
|
91
|
-
}
|
|
86
|
+
}
|
|
92
87
|
}
|
|
93
88
|
},
|
|
94
|
-
|
|
95
|
-
type:
|
|
96
|
-
required: [
|
|
89
|
+
relType: {
|
|
90
|
+
type: "object",
|
|
91
|
+
required: ["relationshipTag", "serviceTag"],
|
|
97
92
|
properties: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
required: ['serviceTag', 'relationshipTag'],
|
|
101
|
-
properties: {
|
|
102
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
103
|
-
relationshipTag: izara.validatorSchema.stringNotEmpty(),
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
relationshipProperties: {
|
|
107
|
-
type: 'object',
|
|
108
|
-
},
|
|
109
|
-
relationshipDirection: {
|
|
93
|
+
relationshipTag: izara.validatorSchema.stringNotEmpty(),
|
|
94
|
+
serviceTag: {
|
|
110
95
|
type: 'string',
|
|
111
|
-
|
|
112
|
-
|
|
96
|
+
pattern: "^[a-zA-Z0-9_-]+$",
|
|
97
|
+
enum: [process.env.iz_serviceTag]
|
|
113
98
|
},
|
|
114
99
|
}
|
|
115
100
|
},
|
|
116
|
-
|
|
101
|
+
relationshipDirection: {
|
|
102
|
+
type: "string",
|
|
103
|
+
enum: ['from', "to"]
|
|
104
|
+
},
|
|
105
|
+
relationshipProperties: {
|
|
117
106
|
type: 'object',
|
|
118
|
-
|
|
119
|
-
properties: {
|
|
120
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
121
|
-
relationshipTag: izara.validatorSchema.stringNotEmpty(),
|
|
122
|
-
}
|
|
107
|
+
default: {}
|
|
123
108
|
},
|
|
124
|
-
settings: {
|
|
125
|
-
type: 'object'
|
|
126
|
-
}
|
|
127
109
|
}
|
|
128
110
|
};
|
|
129
111
|
|
|
@@ -31,82 +31,64 @@ const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>
|
|
|
31
31
|
// validate event params in middlewware before into function.
|
|
32
32
|
let validatorSchema = {
|
|
33
33
|
type: "object",
|
|
34
|
-
required: [
|
|
35
|
-
'firstObject',
|
|
36
|
-
'secondObject',
|
|
37
|
-
'oldReltypeAndDirection',
|
|
38
|
-
'newRelType',
|
|
39
|
-
],
|
|
34
|
+
required: ["firstObject", "secondObject", "relType", "relationshipDirection"],
|
|
40
35
|
properties: {
|
|
41
36
|
firstObject: {
|
|
42
|
-
type:
|
|
43
|
-
required: [
|
|
37
|
+
type: "object",
|
|
38
|
+
required: ["objType", "identifiers"],
|
|
44
39
|
properties: {
|
|
45
40
|
objType: {
|
|
46
|
-
type:
|
|
47
|
-
required: [
|
|
41
|
+
type: "object",
|
|
42
|
+
required: ["serviceTag", "objectType"],
|
|
48
43
|
properties: {
|
|
49
44
|
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
50
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
45
|
+
objectType: izara.validatorSchema.stringNotEmpty()
|
|
51
46
|
}
|
|
52
47
|
},
|
|
53
48
|
identifiers: {
|
|
54
49
|
type: "object",
|
|
55
50
|
minProperties: 1
|
|
56
|
-
}
|
|
51
|
+
}
|
|
57
52
|
}
|
|
58
53
|
},
|
|
59
54
|
secondObject: {
|
|
60
|
-
type:
|
|
61
|
-
required: [
|
|
55
|
+
type: "object",
|
|
56
|
+
required: ["objType", "identifiers"],
|
|
62
57
|
properties: {
|
|
63
58
|
objType: {
|
|
64
|
-
type:
|
|
65
|
-
required: [
|
|
59
|
+
type: "object",
|
|
60
|
+
required: ["serviceTag", "objectType"],
|
|
66
61
|
properties: {
|
|
67
62
|
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
68
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
63
|
+
objectType: izara.validatorSchema.stringNotEmpty()
|
|
69
64
|
}
|
|
70
65
|
},
|
|
71
66
|
identifiers: {
|
|
72
67
|
type: "object",
|
|
73
68
|
minProperties: 1
|
|
74
|
-
}
|
|
69
|
+
}
|
|
75
70
|
}
|
|
76
71
|
},
|
|
77
|
-
|
|
78
|
-
type:
|
|
79
|
-
required: [
|
|
72
|
+
relType: {
|
|
73
|
+
type: "object",
|
|
74
|
+
required: ["relationshipTag", "serviceTag"],
|
|
80
75
|
properties: {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
required: ['serviceTag', 'relationshipTag'],
|
|
84
|
-
properties: {
|
|
85
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
86
|
-
relationshipTag: izara.validatorSchema.stringNotEmpty(),
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
relationshipProperties: {
|
|
90
|
-
type: 'object',
|
|
91
|
-
},
|
|
92
|
-
relationshipDirection: {
|
|
76
|
+
relationshipTag: izara.validatorSchema.stringNotEmpty(),
|
|
77
|
+
serviceTag: {
|
|
93
78
|
type: 'string',
|
|
94
|
-
|
|
95
|
-
|
|
79
|
+
pattern: "^[a-zA-Z0-9_-]+$",
|
|
80
|
+
enum: [process.env.iz_serviceTag]
|
|
96
81
|
},
|
|
97
82
|
}
|
|
98
83
|
},
|
|
99
|
-
|
|
84
|
+
relationshipDirection: {
|
|
85
|
+
type: "string",
|
|
86
|
+
enum: ['from', "to"]
|
|
87
|
+
},
|
|
88
|
+
relationshipProperties: {
|
|
100
89
|
type: 'object',
|
|
101
|
-
|
|
102
|
-
properties: {
|
|
103
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
104
|
-
relationshipTag: izara.validatorSchema.stringNotEmpty(),
|
|
105
|
-
}
|
|
90
|
+
default: {}
|
|
106
91
|
},
|
|
107
|
-
settings: {
|
|
108
|
-
type: 'object'
|
|
109
|
-
}
|
|
110
92
|
}
|
|
111
93
|
};
|
|
112
94
|
|