@izara_project/izara-market-library-service-schemas 1.0.13 → 1.0.15
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 +5 -5
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +32 -29
- package/src/TemplateManager/src/FindData/GetByStorage/getByGraph.ejs +2 -1
- package/src/TemplateManager/src/GenerateCode.js +3 -3
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/template.ejs +17 -14
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/template.ejs +14 -13
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Delete/template.ejs +0 -1
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/data.js +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/template.ejs +18 -11
- package/src/TemplateManager/src/ProcessLogical/mainFunction/template.ejs +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrInv/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/mainFunction/template.ejs +25 -17
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrApi/template.ejs +39 -21
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrDsq/template.ejs +38 -21
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrInv/template.ejs +40 -22
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrSqs/template.ejs +38 -22
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/data.js +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/mainFunction/template.ejs +21 -11
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrApi/template.ejs +37 -20
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/template.ejs +40 -23
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrInv/template.ejs +40 -23
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/template.ejs +40 -23
- package/src/TemplateManager/src/externalService/FunctionNameConfig/data.js +45 -12
- package/src/TemplateManager/src/externalService/FunctionNameConfig/templateIntTesting.ejs +31 -0
- package/src/TemplateManager/src/externalService/FunctionNameConfig/templateYaml.ejs +10 -0
- package/src/TemplateManager/src/externalService/LambdaRole/data.js +10 -46
- package/src/TemplateManager/src/libs/Consts.js +3 -3
|
@@ -27,31 +27,44 @@ 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: ["
|
|
30
|
+
required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection"],
|
|
31
31
|
properties: {
|
|
32
|
-
|
|
33
|
-
type: "
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
required: ["serviceTag", "objectType"],
|
|
43
|
-
properties: {
|
|
44
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
45
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
identifiers: {
|
|
49
|
-
type: "object",
|
|
50
|
-
minproperties: 1
|
|
32
|
+
firstObject: {
|
|
33
|
+
type: "object",
|
|
34
|
+
required: ["objType","identifiers"],
|
|
35
|
+
properties: {
|
|
36
|
+
objType: {
|
|
37
|
+
type: "object",
|
|
38
|
+
required: ["serviceTag","objectType"],
|
|
39
|
+
properties: {
|
|
40
|
+
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
41
|
+
objectType: izara.validatorSchema.stringNotEmpty(),
|
|
51
42
|
}
|
|
43
|
+
},
|
|
44
|
+
identifiers: {
|
|
45
|
+
type: "object",
|
|
46
|
+
minProperties: 1
|
|
52
47
|
}
|
|
53
48
|
}
|
|
54
49
|
},
|
|
50
|
+
secondObject: {
|
|
51
|
+
type: "object",
|
|
52
|
+
required: ["objType","identifiers"],
|
|
53
|
+
properties: {
|
|
54
|
+
objType: {
|
|
55
|
+
type: "object",
|
|
56
|
+
required: ["serviceTag","objectType"],
|
|
57
|
+
properties: {
|
|
58
|
+
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
59
|
+
objectType: izara.validatorSchema.stringNotEmpty(),
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
identifiers: {
|
|
63
|
+
type: "object",
|
|
64
|
+
minProperties: 1
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
55
68
|
relType: {
|
|
56
69
|
type: "object",
|
|
57
70
|
required: ["relationshipTag", "serviceTag"],
|
|
@@ -67,6 +80,10 @@ let validatorSchema = {
|
|
|
67
80
|
relationshipProperties: {
|
|
68
81
|
type: "object",
|
|
69
82
|
minProperties: 1
|
|
83
|
+
},
|
|
84
|
+
relationshipDirection: {
|
|
85
|
+
type: "string",
|
|
86
|
+
enum: ['from','to']
|
|
70
87
|
}
|
|
71
88
|
}
|
|
72
89
|
};
|
|
@@ -94,7 +111,8 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
94
111
|
objects: event.objects,
|
|
95
112
|
relType: event.relType,
|
|
96
113
|
relId: event.relId,
|
|
97
|
-
relationshipProperties: event.relationshipProperties
|
|
114
|
+
relationshipProperties: event.relationshipProperties,
|
|
115
|
+
relationshipDirection: event.relationshipDirection
|
|
98
116
|
}
|
|
99
117
|
);
|
|
100
118
|
|
|
@@ -46,33 +46,46 @@ middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema(
|
|
|
46
46
|
));
|
|
47
47
|
|
|
48
48
|
// validate event params in middlewware before into function.
|
|
49
|
-
let validatorSchema =
|
|
49
|
+
let validatorSchema = {
|
|
50
50
|
type: "object",
|
|
51
|
-
required: ["
|
|
51
|
+
required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection"],
|
|
52
52
|
properties: {
|
|
53
|
-
|
|
54
|
-
type: "
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
required: ["serviceTag", "objectType"],
|
|
64
|
-
properties: {
|
|
65
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
66
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
identifiers: {
|
|
70
|
-
type: "object",
|
|
71
|
-
minproperties: 1
|
|
53
|
+
firstObject: {
|
|
54
|
+
type: "object",
|
|
55
|
+
required: ["objType","identifiers"],
|
|
56
|
+
properties: {
|
|
57
|
+
objType: {
|
|
58
|
+
type: "object",
|
|
59
|
+
required: ["serviceTag","objectType"],
|
|
60
|
+
properties: {
|
|
61
|
+
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
62
|
+
objectType: izara.validatorSchema.stringNotEmpty(),
|
|
72
63
|
}
|
|
64
|
+
},
|
|
65
|
+
identifiers: {
|
|
66
|
+
type: "object",
|
|
67
|
+
minProperties: 1
|
|
73
68
|
}
|
|
74
69
|
}
|
|
75
70
|
},
|
|
71
|
+
secondObject: {
|
|
72
|
+
type: "object",
|
|
73
|
+
required: ["objType","identifiers"],
|
|
74
|
+
properties: {
|
|
75
|
+
objType: {
|
|
76
|
+
type: "object",
|
|
77
|
+
required: ["serviceTag","objectType"],
|
|
78
|
+
properties: {
|
|
79
|
+
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
80
|
+
objectType: izara.validatorSchema.stringNotEmpty(),
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
identifiers: {
|
|
84
|
+
type: "object",
|
|
85
|
+
minProperties: 1
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
76
89
|
relType: {
|
|
77
90
|
type: "object",
|
|
78
91
|
required: ["relationshipTag", "serviceTag"],
|
|
@@ -88,6 +101,10 @@ let validatorSchema = {
|
|
|
88
101
|
relationshipProperties: {
|
|
89
102
|
type: "object",
|
|
90
103
|
minProperties: 1
|
|
104
|
+
},
|
|
105
|
+
relationshipDirection: {
|
|
106
|
+
type: "string",
|
|
107
|
+
enum: ['from','to']
|
|
91
108
|
}
|
|
92
109
|
}
|
|
93
110
|
};
|
|
@@ -29,33 +29,46 @@ const callingFlowSharedLib = require('@izara_project/izara-shared/src/CallingFlo
|
|
|
29
29
|
const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>_Main');
|
|
30
30
|
|
|
31
31
|
// validate event params in middlewware before into function.
|
|
32
|
-
let validatorSchema =
|
|
32
|
+
let validatorSchema = {
|
|
33
33
|
type: "object",
|
|
34
|
-
required: ["
|
|
34
|
+
required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection"],
|
|
35
35
|
properties: {
|
|
36
|
-
|
|
37
|
-
type: "
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
required: ["serviceTag", "objectType"],
|
|
47
|
-
properties: {
|
|
48
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
49
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
identifiers: {
|
|
53
|
-
type: "object",
|
|
54
|
-
minproperties: 1
|
|
36
|
+
firstObject: {
|
|
37
|
+
type: "object",
|
|
38
|
+
required: ["objType","identifiers"],
|
|
39
|
+
properties: {
|
|
40
|
+
objType: {
|
|
41
|
+
type: "object",
|
|
42
|
+
required: ["serviceTag","objectType"],
|
|
43
|
+
properties: {
|
|
44
|
+
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
45
|
+
objectType: izara.validatorSchema.stringNotEmpty(),
|
|
55
46
|
}
|
|
47
|
+
},
|
|
48
|
+
identifiers: {
|
|
49
|
+
type: "object",
|
|
50
|
+
minProperties: 1
|
|
56
51
|
}
|
|
57
52
|
}
|
|
58
53
|
},
|
|
54
|
+
secondObject: {
|
|
55
|
+
type: "object",
|
|
56
|
+
required: ["objType","identifiers"],
|
|
57
|
+
properties: {
|
|
58
|
+
objType: {
|
|
59
|
+
type: "object",
|
|
60
|
+
required: ["serviceTag","objectType"],
|
|
61
|
+
properties: {
|
|
62
|
+
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
63
|
+
objectType: izara.validatorSchema.stringNotEmpty(),
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
identifiers: {
|
|
67
|
+
type: "object",
|
|
68
|
+
minProperties: 1
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
59
72
|
relType: {
|
|
60
73
|
type: "object",
|
|
61
74
|
required: ["relationshipTag", "serviceTag"],
|
|
@@ -71,6 +84,10 @@ let validatorSchema = {
|
|
|
71
84
|
relationshipProperties: {
|
|
72
85
|
type: "object",
|
|
73
86
|
minProperties: 1
|
|
87
|
+
},
|
|
88
|
+
relationshipDirection: {
|
|
89
|
+
type: "string",
|
|
90
|
+
enum: ['from','to']
|
|
74
91
|
}
|
|
75
92
|
}
|
|
76
93
|
};
|
|
@@ -84,12 +101,13 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
84
101
|
|
|
85
102
|
try {
|
|
86
103
|
// invoke LambdaFunction
|
|
87
|
-
return await
|
|
104
|
+
return await <%- functionName %>.<%- functionName %>(
|
|
88
105
|
event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId
|
|
89
106
|
{
|
|
90
107
|
objects: event.objects,
|
|
91
108
|
relType: event.relType,
|
|
92
109
|
relationshipProperties: event.relationshipProperties,
|
|
110
|
+
relationshipDirection: event.relationshipDirection
|
|
93
111
|
},
|
|
94
112
|
callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
|
|
95
113
|
);
|
|
@@ -30,33 +30,46 @@ const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>
|
|
|
30
30
|
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
31
31
|
|
|
32
32
|
// validate event params in middleware before into function
|
|
33
|
-
let validatorSchema =
|
|
33
|
+
let validatorSchema = {
|
|
34
34
|
type: "object",
|
|
35
|
-
required: ["
|
|
35
|
+
required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection"],
|
|
36
36
|
properties: {
|
|
37
|
-
|
|
38
|
-
type: "
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
required: ["serviceTag", "objectType"],
|
|
48
|
-
properties: {
|
|
49
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
50
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
identifiers: {
|
|
54
|
-
type: "object",
|
|
55
|
-
minproperties: 1
|
|
37
|
+
firstObject: {
|
|
38
|
+
type: "object",
|
|
39
|
+
required: ["objType","identifiers"],
|
|
40
|
+
properties: {
|
|
41
|
+
objType: {
|
|
42
|
+
type: "object",
|
|
43
|
+
required: ["serviceTag","objectType"],
|
|
44
|
+
properties: {
|
|
45
|
+
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
46
|
+
objectType: izara.validatorSchema.stringNotEmpty(),
|
|
56
47
|
}
|
|
48
|
+
},
|
|
49
|
+
identifiers: {
|
|
50
|
+
type: "object",
|
|
51
|
+
minProperties: 1
|
|
57
52
|
}
|
|
58
53
|
}
|
|
59
54
|
},
|
|
55
|
+
secondObject: {
|
|
56
|
+
type: "object",
|
|
57
|
+
required: ["objType","identifiers"],
|
|
58
|
+
properties: {
|
|
59
|
+
objType: {
|
|
60
|
+
type: "object",
|
|
61
|
+
required: ["serviceTag","objectType"],
|
|
62
|
+
properties: {
|
|
63
|
+
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
64
|
+
objectType: izara.validatorSchema.stringNotEmpty(),
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
identifiers: {
|
|
68
|
+
type: "object",
|
|
69
|
+
minProperties: 1
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
60
73
|
relType: {
|
|
61
74
|
type: "object",
|
|
62
75
|
required: ["relationshipTag", "serviceTag"],
|
|
@@ -72,11 +85,14 @@ let validatorSchema = {
|
|
|
72
85
|
relationshipProperties: {
|
|
73
86
|
type: "object",
|
|
74
87
|
minProperties: 1
|
|
88
|
+
},
|
|
89
|
+
relationshipDirection: {
|
|
90
|
+
type: "string",
|
|
91
|
+
enum: ['from','to']
|
|
75
92
|
}
|
|
76
93
|
}
|
|
77
94
|
};
|
|
78
95
|
|
|
79
|
-
|
|
80
96
|
//(<globalVarible>
|
|
81
97
|
//</globalVarible>)
|
|
82
98
|
|
|
@@ -65,7 +65,7 @@ function createParamForCreateSource(srcPath) {
|
|
|
65
65
|
functionName,
|
|
66
66
|
handlerType,
|
|
67
67
|
additionalResourcePermission,
|
|
68
|
-
resourceLocation: SOURCE_PATH.
|
|
68
|
+
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
|
|
69
69
|
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.updateRel) + upperCase(shortNameHandler(handlerType))
|
|
70
70
|
},
|
|
71
71
|
setting: {
|
|
@@ -67,7 +67,7 @@ const {
|
|
|
67
67
|
*
|
|
68
68
|
* @returns {object} description of return value
|
|
69
69
|
*/
|
|
70
|
-
module.exports
|
|
70
|
+
module.exports.updateRelationship = async (
|
|
71
71
|
_izContext,
|
|
72
72
|
requestParams,
|
|
73
73
|
callingFlowConfig = {},
|
|
@@ -83,10 +83,12 @@ module.exports.<%- functionName %> = async (
|
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
const {
|
|
86
|
-
|
|
86
|
+
firstObject,
|
|
87
|
+
secondObject,
|
|
87
88
|
relType,
|
|
88
89
|
relId,
|
|
89
|
-
relationshipProperties
|
|
90
|
+
relationshipProperties,
|
|
91
|
+
relationshipDirection
|
|
90
92
|
//(<requestparamUpdateRel>)
|
|
91
93
|
//(</requestparamUpdateRel>)
|
|
92
94
|
} = requestParams;
|
|
@@ -121,8 +123,8 @@ module.exports.<%- functionName %> = async (
|
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
|
|
124
|
-
await validateIdentifiersExists(_izContext,
|
|
125
|
-
await validateIdentifiersExists(_izContext,
|
|
126
|
+
await validateIdentifiersExists(_izContext, firstObject.objType, firstObject.identifiers);
|
|
127
|
+
await validateIdentifiersExists(_izContext, secondObject.objType, secondObject.identifiers);
|
|
126
128
|
// finished validate object and identifiers
|
|
127
129
|
|
|
128
130
|
//(<afterValidateUpdateRel>)
|
|
@@ -142,8 +144,8 @@ module.exports.<%- functionName %> = async (
|
|
|
142
144
|
const { serviceTag: fromServiceTag, objectType: fromObjectType } = from.objType
|
|
143
145
|
const { serviceTag: toServiceTag, objectType: toObjectType } = to.objType
|
|
144
146
|
|
|
145
|
-
const { serviceTag: firstServiceTag, objectType: firstObjectType } =
|
|
146
|
-
const { serviceTag: secondServiceTag, objectType: secondObjectType } =
|
|
147
|
+
const { serviceTag: firstServiceTag, objectType: firstObjectType } = firstObject.objType;
|
|
148
|
+
const { serviceTag: secondServiceTag, objectType: secondObjectType } = secondObject.objType;
|
|
147
149
|
|
|
148
150
|
// find exists link
|
|
149
151
|
if (
|
|
@@ -210,8 +212,11 @@ module.exports.<%- functionName %> = async (
|
|
|
210
212
|
if (errorsFound.length) {
|
|
211
213
|
|
|
212
214
|
let updateCompleteMsg = {
|
|
215
|
+
firstObject: firstObject,
|
|
216
|
+
secondObject: secondObject,
|
|
213
217
|
relId: relId,
|
|
214
218
|
relType: relType,
|
|
219
|
+
relationshipDirection,
|
|
215
220
|
status: 'error',
|
|
216
221
|
errorFounds: errorsFound
|
|
217
222
|
//(<inUpdateCompleteMsgUpdateRel>)
|
|
@@ -240,7 +245,7 @@ module.exports.<%- functionName %> = async (
|
|
|
240
245
|
|
|
241
246
|
|
|
242
247
|
// before create awaitingStepId per graph storageResource
|
|
243
|
-
const linkTypeId = createLinkTypeId(_izContext,
|
|
248
|
+
const linkTypeId = createLinkTypeId(_izContext, firstObject.objType, secondObject.objType, relType, relationshipDirection);
|
|
244
249
|
|
|
245
250
|
let usedGraphServiceTag = []; // collect used graph serviceName, use to check duplicate graph serviceName across graph serverTag
|
|
246
251
|
let targetGraphStorageResources = []; // collect used graph storageResources, filtered duplicate graphServiceTag from graphServerTag out
|
|
@@ -276,10 +281,12 @@ module.exports.<%- functionName %> = async (
|
|
|
276
281
|
|
|
277
282
|
// prepare message body
|
|
278
283
|
let updateRelMessageBody = {
|
|
279
|
-
|
|
284
|
+
firstObject,
|
|
285
|
+
secondObject,
|
|
280
286
|
relId,
|
|
281
287
|
relType: relType,
|
|
282
|
-
relationshipProperties
|
|
288
|
+
relationshipProperties,
|
|
289
|
+
relationshipDirection
|
|
283
290
|
//(<inUpdateRelMessageBodyUpdateRel>)
|
|
284
291
|
//(</inUpdateRelMessageBodyUpdateRel>)
|
|
285
292
|
}
|
|
@@ -318,9 +325,12 @@ module.exports.<%- functionName %> = async (
|
|
|
318
325
|
}
|
|
319
326
|
|
|
320
327
|
return {
|
|
328
|
+
firstObject,
|
|
329
|
+
secondObject,
|
|
321
330
|
relId: relId,
|
|
322
331
|
relType: relType,
|
|
323
|
-
|
|
332
|
+
relationshipDirection,
|
|
333
|
+
errorsFound
|
|
324
334
|
};
|
|
325
335
|
|
|
326
336
|
} catch (err) {
|
|
@@ -27,31 +27,44 @@ 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: ["
|
|
30
|
+
required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection"],
|
|
31
31
|
properties: {
|
|
32
|
-
|
|
33
|
-
type: "
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
required: ["serviceTag", "objectType"],
|
|
43
|
-
properties: {
|
|
44
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
45
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
identifiers: {
|
|
49
|
-
type: "object",
|
|
50
|
-
minproperties: 1
|
|
32
|
+
firstObject: {
|
|
33
|
+
type: "object",
|
|
34
|
+
required: ["objType","identifiers"],
|
|
35
|
+
properties: {
|
|
36
|
+
objType: {
|
|
37
|
+
type: "object",
|
|
38
|
+
required: ["serviceTag","objectType"],
|
|
39
|
+
properties: {
|
|
40
|
+
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
41
|
+
objectType: izara.validatorSchema.stringNotEmpty(),
|
|
51
42
|
}
|
|
43
|
+
},
|
|
44
|
+
identifiers: {
|
|
45
|
+
type: "object",
|
|
46
|
+
minProperties: 1
|
|
52
47
|
}
|
|
53
48
|
}
|
|
54
49
|
},
|
|
50
|
+
secondObject: {
|
|
51
|
+
type: "object",
|
|
52
|
+
required: ["objType","identifiers"],
|
|
53
|
+
properties: {
|
|
54
|
+
objType: {
|
|
55
|
+
type: "object",
|
|
56
|
+
required: ["serviceTag","objectType"],
|
|
57
|
+
properties: {
|
|
58
|
+
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
59
|
+
objectType: izara.validatorSchema.stringNotEmpty(),
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
identifiers: {
|
|
63
|
+
type: "object",
|
|
64
|
+
minProperties: 1
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
55
68
|
relType: {
|
|
56
69
|
type: "object",
|
|
57
70
|
required: ["relationshipTag", "serviceTag"],
|
|
@@ -68,6 +81,10 @@ let validatorSchema = {
|
|
|
68
81
|
relationshipProperties: {
|
|
69
82
|
type: "object",
|
|
70
83
|
minProperties: 1
|
|
84
|
+
},
|
|
85
|
+
relationshipDirection: {
|
|
86
|
+
type: "string",
|
|
87
|
+
enum: ['from','to']
|
|
71
88
|
}
|
|
72
89
|
}
|
|
73
90
|
};
|
|
@@ -47,31 +47,44 @@ middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema(
|
|
|
47
47
|
// validate event params in middleware before into function
|
|
48
48
|
let validatorSchema = {
|
|
49
49
|
type: "object",
|
|
50
|
-
required: ["
|
|
50
|
+
required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection"],
|
|
51
51
|
properties: {
|
|
52
|
-
|
|
53
|
-
type: "
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
required: ["serviceTag", "objectType"],
|
|
63
|
-
properties: {
|
|
64
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
65
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
identifiers: {
|
|
69
|
-
type: "object",
|
|
70
|
-
minProperties: 1
|
|
52
|
+
firstObject: {
|
|
53
|
+
type: "object",
|
|
54
|
+
required: ["objType","identifiers"],
|
|
55
|
+
properties: {
|
|
56
|
+
objType: {
|
|
57
|
+
type: "object",
|
|
58
|
+
required: ["serviceTag","objectType"],
|
|
59
|
+
properties: {
|
|
60
|
+
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
61
|
+
objectType: izara.validatorSchema.stringNotEmpty(),
|
|
71
62
|
}
|
|
63
|
+
},
|
|
64
|
+
identifiers: {
|
|
65
|
+
type: "object",
|
|
66
|
+
minProperties: 1
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
69
|
},
|
|
70
|
+
secondObject: {
|
|
71
|
+
type: "object",
|
|
72
|
+
required: ["objType","identifiers"],
|
|
73
|
+
properties: {
|
|
74
|
+
objType: {
|
|
75
|
+
type: "object",
|
|
76
|
+
required: ["serviceTag","objectType"],
|
|
77
|
+
properties: {
|
|
78
|
+
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
79
|
+
objectType: izara.validatorSchema.stringNotEmpty(),
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
identifiers: {
|
|
83
|
+
type: "object",
|
|
84
|
+
minProperties: 1
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
75
88
|
relType: {
|
|
76
89
|
type: "object",
|
|
77
90
|
required: ["relationshipTag", "serviceTag"],
|
|
@@ -81,14 +94,18 @@ let validatorSchema = {
|
|
|
81
94
|
type: 'string',
|
|
82
95
|
pattern: "^[a-zA-Z0-9_-]+$",
|
|
83
96
|
enum: [process.env.iz_serviceTag]
|
|
84
|
-
}
|
|
97
|
+
}
|
|
85
98
|
}
|
|
86
99
|
},
|
|
87
100
|
relId: izara.validatorSchema.stringNotEmpty(),
|
|
88
101
|
relationshipProperties: {
|
|
89
|
-
type:
|
|
90
|
-
minProperties: 1
|
|
102
|
+
type: "object",
|
|
103
|
+
minProperties: 1
|
|
91
104
|
},
|
|
105
|
+
relationshipDirection: {
|
|
106
|
+
type: "string",
|
|
107
|
+
enum: ['from','to']
|
|
108
|
+
}
|
|
92
109
|
}
|
|
93
110
|
};
|
|
94
111
|
|