@izara_project/izara-market-library-service-schemas 1.0.84 → 1.0.85
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/index.js +0 -1
- package/package.json +1 -2
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +17 -1938
- package/src/MainLibs/src/Consts.js +383 -4
- package/src/reStructure/TemplateData/EndpointPerService/handler/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/handler/sqs/data.js +9 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +16 -3
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +18 -5
- package/src/reStructure/TemplateData/IntTest/generateTests/events/data.js +2 -0
- package/src/reStructure/TemplateData/IntTest/generateTests/pathIntTest/data.js +10 -1
- package/src/reStructure/TemplateData/IntTest/generateTests/pathIntTest/template.ejs +4 -4
- package/src/reStructure/TemplateData/IntTest/libs/libs.js +1 -1
- package/src/reStructure/TemplateData/externalService/functionNameConfig/templateIntTesting.ejs +1 -1
- package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +1 -1
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/handler/template.ejs +1 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/templateByHandler/dsqTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/templateByHandler/sqsTemplate.ejs +2 -3
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +1 -1
- package/src/CheckPermission/CheckPermission.js +0 -122
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/api/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/dsq/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/inv/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/sqs/request.json +0 -0
|
@@ -17,9 +17,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
17
17
|
|
|
18
18
|
import { consts } from '@izara_project/izara-core-library-service-schemas';
|
|
19
19
|
const { HANDLER, ACTIONS, STORAGE_TYPES, OBJECT_SCHEMA_BUCKET_NAME } = consts;
|
|
20
|
+
const { HANDLER, ACTIONS, STORAGE_TYPES, OBJECT_SCHEMA_BUCKET_NAME } = consts;
|
|
20
21
|
import { serviceConfig } from '@izara_project/izara-core-library-service-schemas';
|
|
21
22
|
import utils from './Utils.js';
|
|
22
23
|
const { firstLetterUpperCase: upperCase } = utils;
|
|
24
|
+
import utils from './Utils.js';
|
|
25
|
+
const { firstLetterUpperCase: upperCase } = utils;
|
|
23
26
|
|
|
24
27
|
const DEFAULT_HANDLER_PER_ACTION = {
|
|
25
28
|
[ACTIONS.create]: [HANDLER.hdrApi, HANDLER.hdrSqs, HANDLER.hdrInv],
|
|
@@ -27,6 +30,7 @@ const DEFAULT_HANDLER_PER_ACTION = {
|
|
|
27
30
|
[ACTIONS.get]: [HANDLER.hdrApi, HANDLER.hdrInv],
|
|
28
31
|
[ACTIONS.delete]: [HANDLER.hdrApi, HANDLER.hdrSqs]
|
|
29
32
|
};
|
|
33
|
+
};
|
|
30
34
|
|
|
31
35
|
const RESOURCE_CLASSES = {
|
|
32
36
|
sqs: 'sqs',
|
|
@@ -36,6 +40,9 @@ const RESOURCE_CLASSES = {
|
|
|
36
40
|
sns: 'sns',
|
|
37
41
|
lambda: 'lambda',
|
|
38
42
|
webSocket: 'webSocket'
|
|
43
|
+
sns: 'sns',
|
|
44
|
+
lambda: 'lambda',
|
|
45
|
+
webSocket: 'webSocket'
|
|
39
46
|
};
|
|
40
47
|
|
|
41
48
|
/**
|
|
@@ -61,6 +68,21 @@ function resourceNames(resourceClass, resourceName) {
|
|
|
61
68
|
resourceName,
|
|
62
69
|
[RESOURCE_CLASSES.webSocket]:
|
|
63
70
|
'arn:aws:execute-api:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_webSocketHostId}/${self:custom.iz_stage}/POST/@connections/{connectionId}'
|
|
71
|
+
[RESOURCE_CLASSES.sqs]:
|
|
72
|
+
'arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}' +
|
|
73
|
+
resourceName,
|
|
74
|
+
[RESOURCE_CLASSES.s3]: 'arn:aws:s3:::' + resourceName,
|
|
75
|
+
[RESOURCE_CLASSES.dynamoDbTable]:
|
|
76
|
+
'arn:aws:dynamodb:${self:custom.iz_region}:${self:custom.iz_accountId}:table/${self:custom.iz_resourcePrefix}' +
|
|
77
|
+
resourceName,
|
|
78
|
+
[RESOURCE_CLASSES.sns]:
|
|
79
|
+
'arn:aws:sns:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_serviceTag}_${self:custom.iz_stage}_' +
|
|
80
|
+
resourceName,
|
|
81
|
+
[RESOURCE_CLASSES.lambda]:
|
|
82
|
+
'arn:aws:lambda:${self:custom.iz_region}:${self:custom.iz_accountId}:function:${self:custom.iz_resourcePrefix}' +
|
|
83
|
+
resourceName,
|
|
84
|
+
[RESOURCE_CLASSES.webSocket]:
|
|
85
|
+
'arn:aws:execute-api:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_webSocketHostId}/${self:custom.iz_stage}/POST/@connections/{connectionId}'
|
|
64
86
|
}[resourceClass];
|
|
65
87
|
}
|
|
66
88
|
|
|
@@ -71,18 +93,25 @@ function resourceNames(resourceClass, resourceName) {
|
|
|
71
93
|
* @param {string} effect - optional default Allow
|
|
72
94
|
* @returns {{ effect, action, resource}}
|
|
73
95
|
*/
|
|
96
|
+
function createIamRole(action, resource = [], effect = 'Allow') {
|
|
74
97
|
function createIamRole(action, resource = [], effect = 'Allow') {
|
|
75
98
|
if (Array.isArray(action)) {
|
|
76
99
|
const actionObj = {};
|
|
77
100
|
action.forEach(act => {
|
|
101
|
+
if (act.includes(':')) {
|
|
102
|
+
const [serviceAction, resourceAction] = act.split(':');
|
|
103
|
+
actionObj[serviceAction] = [upperCase(resourceAction)];
|
|
78
104
|
if (act.includes(':')) {
|
|
79
105
|
const [serviceAction, resourceAction] = act.split(':');
|
|
80
106
|
actionObj[serviceAction] = [upperCase(resourceAction)];
|
|
81
107
|
}
|
|
82
108
|
});
|
|
83
109
|
action = actionObj;
|
|
110
|
+
action = actionObj;
|
|
84
111
|
} else {
|
|
85
112
|
for (const resourceAction in action) {
|
|
113
|
+
if (typeof action[resourceAction] === 'string') {
|
|
114
|
+
action[resourceAction] = [action[resourceAction]];
|
|
86
115
|
if (typeof action[resourceAction] === 'string') {
|
|
87
116
|
action[resourceAction] = [action[resourceAction]];
|
|
88
117
|
}
|
|
@@ -91,6 +120,9 @@ function createIamRole(action, resource = [], effect = 'Allow') {
|
|
|
91
120
|
throw new Error(
|
|
92
121
|
`resourceAction:${resourceAction} should be string or array`
|
|
93
122
|
);
|
|
123
|
+
throw new Error(
|
|
124
|
+
`resourceAction:${resourceAction} should be string or array`
|
|
125
|
+
);
|
|
94
126
|
}
|
|
95
127
|
}
|
|
96
128
|
}
|
|
@@ -109,42 +141,66 @@ const SOURCE_PATH = {
|
|
|
109
141
|
externalService: '../initial_setup/generatedCode/source/',
|
|
110
142
|
lambdaPerAction: '../src/generatedCode/ObjectTypePerActionEndpoint/source/',
|
|
111
143
|
outPerActionComplete: '../src/generatedCode/OutPerActionComplete/source/',
|
|
144
|
+
resourceLocationOutPerActionComplete:
|
|
145
|
+
'src/generatedCode/OutPerActionComplete/source/',
|
|
146
|
+
outPerActionComplete: '../src/generatedCode/OutPerActionComplete/source/',
|
|
112
147
|
resourceLocationOutPerActionComplete:
|
|
113
148
|
'src/generatedCode/OutPerActionComplete/source/',
|
|
114
149
|
relationshipPerAction: '../src/generatedCode/RelationshipPerAction/source/',
|
|
115
150
|
findData: '../src/generatedCode/FindData/source/',
|
|
116
151
|
translateIdsRequestFile: '../src/generatedCode/TranslateId/source/',
|
|
117
152
|
processLogical: '../src/generatedCode/ProcessLogical/source/',
|
|
153
|
+
resourceLocationPerAction:
|
|
154
|
+
'src/generatedCode/ObjectTypePerActionEndpoint/source/',
|
|
155
|
+
processLogical: '../src/generatedCode/ProcessLogical/source/',
|
|
118
156
|
resourceLocationPerAction:
|
|
119
157
|
'src/generatedCode/ObjectTypePerActionEndpoint/source/',
|
|
120
158
|
resourceLocationFindData: 'src/generatedCode/FindData/source/',
|
|
121
159
|
resourceLocationFindData: 'src/generatedCode/FindData/source/',
|
|
160
|
+
resourceLocationRelationshipPerAction:
|
|
161
|
+
'src/generatedCode/RelationshipPerAction/source/',
|
|
122
162
|
resourceLocationRelationshipPerAction:
|
|
123
163
|
'src/generatedCode/RelationshipPerAction/source/',
|
|
124
164
|
resourceLocationTranslateId: 'src/generatedCode/TranslateId/source/',
|
|
125
165
|
resourceLocationProcessLogical: 'src/generatedCode/ProcessLogical/source/',
|
|
166
|
+
resourceLocationProcessLogical: 'src/generatedCode/ProcessLogical/source/',
|
|
126
167
|
// ** FlowSchema
|
|
127
168
|
webSocket: '../src/generatedCode/FlowSchema/UploadS3/',
|
|
128
169
|
resourceLocationWebSocket: 'src/generatedCode/FlowSchema/UploadS3/',
|
|
170
|
+
webSocket: '../src/generatedCode/FlowSchema/UploadS3/',
|
|
171
|
+
resourceLocationWebSocket: 'src/generatedCode/FlowSchema/UploadS3/',
|
|
129
172
|
// * FlowSchema event
|
|
130
173
|
flowSchema: '../src/generatedCode/FlowSchema/',
|
|
131
174
|
resourceLocationFlowSchema: 'src/generatedCode/FlowSchema/',
|
|
175
|
+
flowSchema: '../src/generatedCode/FlowSchema/',
|
|
176
|
+
resourceLocationFlowSchema: 'src/generatedCode/FlowSchema/',
|
|
132
177
|
|
|
133
178
|
// * FlowSchema eventBridge
|
|
134
179
|
flowSchemaEventBridge: '../src/generatedCode/FlowSchema/EventBridge/',
|
|
180
|
+
resourceLocationFlowSchemaEventBridge:
|
|
181
|
+
'src/generatedCode/FlowSchema/EventBridge/',
|
|
182
|
+
flowSchemaEventBridge: '../src/generatedCode/FlowSchema/EventBridge/',
|
|
135
183
|
resourceLocationFlowSchemaEventBridge:
|
|
136
184
|
'src/generatedCode/FlowSchema/EventBridge/',
|
|
137
185
|
// * FlowSchema lambdaSync
|
|
138
186
|
flowSchemaLambdaSync: '../src/generatedCode/FlowSchema/lambdaSync/',
|
|
187
|
+
resourceLocationFlowSchemaLambdaSync:
|
|
188
|
+
'src/generatedCode/FlowSchema/lambdaSync/',
|
|
189
|
+
flowSchemaLambdaSync: '../src/generatedCode/FlowSchema/lambdaSync/',
|
|
139
190
|
resourceLocationFlowSchemaLambdaSync:
|
|
140
191
|
'src/generatedCode/FlowSchema/lambdaSync/',
|
|
141
192
|
|
|
142
193
|
// * FlowSchema Register
|
|
143
194
|
flowSchemaRegister: '../src/generatedCode/FlowSchema/Register/',
|
|
144
195
|
resourceLocationFlowSchemaRegister: 'src/generatedCode/FlowSchema/Register/',
|
|
196
|
+
flowSchemaRegister: '../src/generatedCode/FlowSchema/Register/',
|
|
197
|
+
resourceLocationFlowSchemaRegister: 'src/generatedCode/FlowSchema/Register/',
|
|
145
198
|
|
|
146
199
|
//* WebSocket Main
|
|
147
200
|
WebSocketMain: '../src/generatedCode/FlowSchema/WebSocketMain/source/',
|
|
201
|
+
resourceLocationWebSocketMain:
|
|
202
|
+
'src/generatedCode/FlowSchema/WebSocketMain/source/',
|
|
203
|
+
WebSocketMain: '../src/generatedCode/FlowSchema/WebSocketMain/source/',
|
|
148
204
|
resourceLocationWebSocketMain:
|
|
149
205
|
'src/generatedCode/FlowSchema/WebSocketMain/source/',
|
|
150
206
|
|
|
@@ -163,24 +219,43 @@ const SOURCE_PATH = {
|
|
|
163
219
|
createRecordComplete: '../src/generatedCode/CreateRecordComplete/',
|
|
164
220
|
resourceLocationCreateRecordComplete:
|
|
165
221
|
'src/generatedCode/CreateRerordComplete/'
|
|
222
|
+
generateCodeLib: '../src/generatedCode/libs/source/',
|
|
223
|
+
generatedCodeHookFunction:
|
|
224
|
+
'../src/generatedCode/WebSocket/source/FlowSchemaHook/HookFunctionGeneratedCode/source/',
|
|
225
|
+
resourceLocationGeneratedCodeHookFunction:
|
|
226
|
+
'src/generatedCode/WebSocket/source/FlowSchemaHook/HookFunctionGeneratedCode/source/',
|
|
227
|
+
generatedAttributeTree: '../src/schemas/generatedCode/attributeTree/',
|
|
228
|
+
generatedPropertyValue: '../src/schemas/generatedCode/propertyValue/',
|
|
229
|
+
generatedRefRelationshipAttribute:
|
|
230
|
+
'../src/schemas/generatedCode/refRelationshipAttribute/',
|
|
231
|
+
endpointPerService: '../src/generatedCode/ActionEndpoint/source/',
|
|
232
|
+
resourceLocationHandlerEndpointPerService:
|
|
233
|
+
'src/generatedCode/ActionEndpoint/source/',
|
|
234
|
+
createRecordComplete: '../src/generatedCode/CreateRecordComplete/',
|
|
235
|
+
resourceLocationCreateRecordComplete:
|
|
236
|
+
'src/generatedCode/CreateRerordComplete/'
|
|
166
237
|
};
|
|
167
238
|
|
|
168
239
|
const DEFAULT_LAMBDA_ROLE_PER_ACTION = {
|
|
169
240
|
[ACTIONS.create]: {
|
|
170
241
|
dynamoDbPermission: 'PutItem',
|
|
171
242
|
httpMethod: 'put'
|
|
243
|
+
httpMethod: 'put'
|
|
172
244
|
},
|
|
173
245
|
[ACTIONS.update]: {
|
|
174
246
|
dynamoDbPermission: 'UpdateItem',
|
|
175
247
|
httpMethod: 'post'
|
|
248
|
+
httpMethod: 'post'
|
|
176
249
|
},
|
|
177
250
|
[ACTIONS.get]: {
|
|
178
251
|
dynamoDbPermission: 'GetItem',
|
|
179
252
|
httpMethod: 'post'
|
|
253
|
+
httpMethod: 'post'
|
|
180
254
|
},
|
|
181
255
|
[ACTIONS.delete]: {
|
|
182
256
|
dynamoDbPermission: 'DeleteItem',
|
|
183
257
|
httpMethod: 'delete'
|
|
258
|
+
httpMethod: 'delete'
|
|
184
259
|
}
|
|
185
260
|
};
|
|
186
261
|
|
|
@@ -191,11 +266,19 @@ const SQS_RESOURCE = {
|
|
|
191
266
|
getQueueAttributes: 'GetQueueAttributes',
|
|
192
267
|
deleteMessageBatch: 'DeleteMessageBatch',
|
|
193
268
|
getQueueUrl: 'GetQueueUrl'
|
|
269
|
+
sendMessage: 'SendMessage',
|
|
270
|
+
receiveMessage: 'ReceiveMessage',
|
|
271
|
+
deleteMessage: 'DeleteMessage',
|
|
272
|
+
getQueueAttributes: 'GetQueueAttributes',
|
|
273
|
+
deleteMessageBatch: 'DeleteMessageBatch',
|
|
274
|
+
getQueueUrl: 'GetQueueUrl'
|
|
194
275
|
};
|
|
195
276
|
|
|
196
277
|
const SNS_RESOURCE = {
|
|
197
278
|
publish: 'Publish',
|
|
198
279
|
subscribe: 'Subscribe'
|
|
280
|
+
publish: 'Publish',
|
|
281
|
+
subscribe: 'Subscribe'
|
|
199
282
|
};
|
|
200
283
|
|
|
201
284
|
const DYNAMO_RESOURCE = {
|
|
@@ -204,10 +287,16 @@ const DYNAMO_RESOURCE = {
|
|
|
204
287
|
query: 'Query',
|
|
205
288
|
updateItem: 'UpdateItem',
|
|
206
289
|
deleteItem: 'DeleteItem'
|
|
290
|
+
putItem: 'PutItem',
|
|
291
|
+
getItem: 'GetItem',
|
|
292
|
+
query: 'Query',
|
|
293
|
+
updateItem: 'UpdateItem',
|
|
294
|
+
deleteItem: 'DeleteItem'
|
|
207
295
|
};
|
|
208
296
|
|
|
209
297
|
const LAMBDA_RESOURCE = {
|
|
210
298
|
invokeFunction: 'InvokeFunction'
|
|
299
|
+
invokeFunction: 'InvokeFunction'
|
|
211
300
|
};
|
|
212
301
|
|
|
213
302
|
const S3_RESOURCE = {
|
|
@@ -217,10 +306,19 @@ const S3_RESOURCE = {
|
|
|
217
306
|
deleteObjectTagging: 'DeleteObjectTagging',
|
|
218
307
|
putObject: 'PutObject',
|
|
219
308
|
putObjectTagging: 'PutObjectTagging'
|
|
309
|
+
getObject: 'GetObject',
|
|
310
|
+
getObjectTagging: 'GetObjectTagging',
|
|
311
|
+
deleteObject: 'DeleteObject',
|
|
312
|
+
deleteObjectTagging: 'DeleteObjectTagging',
|
|
313
|
+
putObject: 'PutObject',
|
|
314
|
+
putObjectTagging: 'PutObjectTagging'
|
|
220
315
|
};
|
|
221
316
|
|
|
222
317
|
function externalResourceName(resourceClass, resourceName, serviceTag) {
|
|
223
318
|
return {
|
|
319
|
+
[RESOURCE_CLASSES.dynamoDbTable]:
|
|
320
|
+
'arn:aws:dynamodb:${process.env.iz_region}:${process.env.iz_accountId}:table/${dynamoSharedLib.tableName(_izContext, ' +
|
|
321
|
+
`"${resourceName}" ,"${serviceTag}")}`,
|
|
224
322
|
[RESOURCE_CLASSES.dynamoDbTable]:
|
|
225
323
|
'arn:aws:dynamodb:${process.env.iz_region}:${process.env.iz_accountId}:table/${dynamoSharedLib.tableName(_izContext, ' +
|
|
226
324
|
`"${resourceName}" ,"${serviceTag}")}`,
|
|
@@ -237,12 +335,26 @@ function externalResourceName(resourceClass, resourceName, serviceTag) {
|
|
|
237
335
|
`"${resourceName}", "${serviceTag}")}`
|
|
238
336
|
}[resourceClass];
|
|
239
337
|
}
|
|
338
|
+
[RESOURCE_CLASSES.dynamoDbAcrossService]:
|
|
339
|
+
'arn:aws:dynamodb:${process.env.iz_region}:${process.env.iz_accountId}:table/' +
|
|
340
|
+
`"${serviceTag}"` +
|
|
341
|
+
`"${resourceName}"`,
|
|
342
|
+
[RESOURCE_CLASSES.lambda]:
|
|
343
|
+
'arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, ' +
|
|
344
|
+
`"${resourceName}" ,"${serviceTag}")}`,
|
|
345
|
+
[RESOURCE_CLASSES.sns]:
|
|
346
|
+
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, ' +
|
|
347
|
+
`"${resourceName}", "${serviceTag}")}`
|
|
348
|
+
}[resourceClass];
|
|
349
|
+
}
|
|
240
350
|
|
|
241
351
|
function externalResourceYaml(resourceClass, resourceName, serviceTag) {
|
|
242
352
|
if (!serviceTag) {
|
|
243
353
|
serviceTag = '${self:custom.iz_resourcePrefix}';
|
|
354
|
+
serviceTag = '${self:custom.iz_resourcePrefix}';
|
|
244
355
|
} else {
|
|
245
356
|
serviceTag = serviceTag + 'Test';
|
|
357
|
+
serviceTag = serviceTag + 'Test';
|
|
246
358
|
}
|
|
247
359
|
return {
|
|
248
360
|
[RESOURCE_CLASSES.dynamoDbTable]:
|
|
@@ -263,6 +375,24 @@ function externalResourceYaml(resourceClass, resourceName, serviceTag) {
|
|
|
263
375
|
`${resourceName}`
|
|
264
376
|
}[resourceClass];
|
|
265
377
|
}
|
|
378
|
+
[RESOURCE_CLASSES.dynamoDbTable]:
|
|
379
|
+
'arn:aws:dynamodb:${self:custom.iz_region}:${self:custom.iz_accountId}:table/' +
|
|
380
|
+
`${serviceTag}` +
|
|
381
|
+
`${resourceName}`,
|
|
382
|
+
[RESOURCE_CLASSES.lambda]:
|
|
383
|
+
'arn:aws:lambda:${self:custom.iz_region}:${self:custom.iz_accountId}:function:' +
|
|
384
|
+
`${serviceTag}` +
|
|
385
|
+
`${resourceName}`,
|
|
386
|
+
[RESOURCE_CLASSES.sns]:
|
|
387
|
+
'arn:aws:sns:${self:custom.iz_region}:${self:custom.iz_accountId}:' +
|
|
388
|
+
`${serviceTag}` +
|
|
389
|
+
`${resourceName}`,
|
|
390
|
+
[RESOURCE_CLASSES.sqs]:
|
|
391
|
+
'arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:' +
|
|
392
|
+
`${serviceTag}` +
|
|
393
|
+
`${resourceName}`
|
|
394
|
+
}[resourceClass];
|
|
395
|
+
}
|
|
266
396
|
|
|
267
397
|
const SAVE_FILE_NAME = {
|
|
268
398
|
dynamoDbYaml: 'generated-dynamoDB-table',
|
|
@@ -281,6 +411,22 @@ const SAVE_FILE_NAME = {
|
|
|
281
411
|
objectRelationship: 'ObjectRelationships',
|
|
282
412
|
refObjectRelationship: 'RefObjectRelationships',
|
|
283
413
|
objectSchema: 'ObjectFieldSchema'
|
|
414
|
+
dynamoDbYaml: 'generated-dynamoDB-table',
|
|
415
|
+
snsInSqsYaml: 'generated-sns-in-sqs',
|
|
416
|
+
snsOutYaml: 'generated-sns-out',
|
|
417
|
+
functionRelationshipYaml: 'RelationshipPerAction',
|
|
418
|
+
functionPerActionYaml: 'per-action-function',
|
|
419
|
+
externalLambdaRole: 'generatedLambdaRoleServiceConfig',
|
|
420
|
+
snsSubscription: 'generatedSnsServiceConfig',
|
|
421
|
+
translateId: 'TranslateIdsRequest',
|
|
422
|
+
findData: 'findData',
|
|
423
|
+
processLogicalYaml: 'processLogical',
|
|
424
|
+
flowSchema: 'flowSchema',
|
|
425
|
+
S3Bucket: 'generated-s3-bucket',
|
|
426
|
+
sharedResourceYaml: 'generate-SharedResource',
|
|
427
|
+
objectRelationship: 'ObjectRelationships',
|
|
428
|
+
refObjectRelationship: 'RefObjectRelationships',
|
|
429
|
+
objectSchema: 'ObjectFieldSchema'
|
|
284
430
|
};
|
|
285
431
|
|
|
286
432
|
const FUNCTION_NAME = {
|
|
@@ -320,10 +466,53 @@ const FUNCTION_NAME = {
|
|
|
320
466
|
changeRelComplete: 'changeRelationshipComplete',
|
|
321
467
|
moveRel: 'moveRelationship',
|
|
322
468
|
moveRelComplete: 'moveRelationshipComplete'
|
|
469
|
+
updateRel: 'updateRelationship',
|
|
470
|
+
createRel: 'createRelationship',
|
|
471
|
+
updateRelComplete: 'updateRelationshipComplete',
|
|
472
|
+
createRelComplete: 'createRelationshipComplete',
|
|
473
|
+
deleteRel: 'deleteRelationship',
|
|
474
|
+
deleteRelComplete: 'deleteRelationshipComplete',
|
|
475
|
+
translateId: 'translateIdsRequest',
|
|
476
|
+
translateIdsProcess: 'processTranslateIds',
|
|
477
|
+
outTranslateIds: 'processTranslateIdsComplete',
|
|
478
|
+
findData: 'findData',
|
|
479
|
+
processLogical: 'processLogical',
|
|
480
|
+
updateNodeComplete: 'updateNodeComplete',
|
|
481
|
+
createObjectComplete: 'createObjectComplete',
|
|
482
|
+
getNodeComplete: 'getNodeComplete',
|
|
483
|
+
paginateProcessLogical: 'paginateProcessLogical',
|
|
484
|
+
deleteNode: 'deleteNode',
|
|
485
|
+
deleteNodeComplete: 'deleteNodeComplete',
|
|
486
|
+
createObjectS3: 'createObjectS3',
|
|
487
|
+
createObjectS3Complete: 'webSocketTaskComplete',
|
|
488
|
+
processAfterUploadS3: 'processAfterUploadS3',
|
|
489
|
+
getRel: 'getRelationship',
|
|
490
|
+
getRelComplete: 'getRelationshipComplete',
|
|
491
|
+
reservedLimit: 'reservedLimit',
|
|
492
|
+
createPresignUrl: 'createPresignUrl',
|
|
493
|
+
flowSchemaOwnTopic: 'flowSchemaOwnTopic',
|
|
494
|
+
flowSchemaOwnTopicComplete: 'flowSchemaOwnTopicComplete',
|
|
495
|
+
flowSchemaOwnTopicEndpoint: 'flowSchemaOwnTopicEndpoint',
|
|
496
|
+
flowSchemaOwnTopicEndpointComplete: 'flowSchemaOwnTopicEndpointComplete',
|
|
497
|
+
flowSchemaExternalTopic: 'externalTopic',
|
|
498
|
+
flowSchemaEventBridge: 'EventBridge',
|
|
499
|
+
createRecordComplete: 'createRecordComplete',
|
|
500
|
+
flowSchemaRegister: 'register',
|
|
501
|
+
changeRel: 'changeRelationship',
|
|
502
|
+
changeRelComplete: 'changeRelationshipComplete',
|
|
503
|
+
moveRel: 'moveRelationship',
|
|
504
|
+
moveRelComplete: 'moveRelationshipComplete'
|
|
323
505
|
};
|
|
324
506
|
|
|
507
|
+
const SHORT_FUNCTION_NAME = functionName => {
|
|
325
508
|
const SHORT_FUNCTION_NAME = functionName => {
|
|
326
509
|
return {
|
|
510
|
+
[FUNCTION_NAME.updateRel]: 'updateRel',
|
|
511
|
+
[FUNCTION_NAME.createRel]: 'createRel',
|
|
512
|
+
[FUNCTION_NAME.updateRelComplete]: 'updateRelComp',
|
|
513
|
+
[FUNCTION_NAME.createRelComplete]: 'createRelComp',
|
|
514
|
+
[FUNCTION_NAME.deleteRel]: 'deleteRel',
|
|
515
|
+
[FUNCTION_NAME.deleteRelComplete]: 'deleteRelComp',
|
|
327
516
|
[FUNCTION_NAME.updateRel]: 'updateRel',
|
|
328
517
|
[FUNCTION_NAME.createRel]: 'createRel',
|
|
329
518
|
[FUNCTION_NAME.updateRelComplete]: 'updateRelComp',
|
|
@@ -350,13 +539,39 @@ const SHORT_FUNCTION_NAME = functionName => {
|
|
|
350
539
|
[FUNCTION_NAME.moveRelComplete]: 'moveRelComp'
|
|
351
540
|
}[functionName];
|
|
352
541
|
};
|
|
542
|
+
[FUNCTION_NAME.findData]: 'findData',
|
|
543
|
+
[FUNCTION_NAME.processLogical]: 'processLogical',
|
|
544
|
+
[FUNCTION_NAME.updateNodeComplete]: 'updateNodeComp',
|
|
545
|
+
[FUNCTION_NAME.createObjectComplete]: 'createObjectComp',
|
|
546
|
+
[FUNCTION_NAME.getNodeComplete]: 'getNodeComp',
|
|
547
|
+
[FUNCTION_NAME.paginateProcessLogical]: 'paginateProLogical',
|
|
548
|
+
[FUNCTION_NAME.deleteNode]: 'deleteNode',
|
|
549
|
+
[FUNCTION_NAME.deleteNodeComplete]: 'deleteNodeComp',
|
|
550
|
+
[FUNCTION_NAME.createObjectS3Complete]: 'webSocketTaskComp',
|
|
551
|
+
[FUNCTION_NAME.getRel]: 'getRel',
|
|
552
|
+
[FUNCTION_NAME.getRelComplete]: 'getRelComp',
|
|
553
|
+
[FUNCTION_NAME.changeRel]: 'changeRel',
|
|
554
|
+
[FUNCTION_NAME.changeRelComplete]: 'changeRelComp',
|
|
555
|
+
[FUNCTION_NAME.moveRel]: 'moveRel',
|
|
556
|
+
[FUNCTION_NAME.moveRelComplete]: 'moveRelComp'
|
|
557
|
+
}[functionName];
|
|
558
|
+
};
|
|
353
559
|
|
|
560
|
+
const getGraphServiceNameFromAllRelSchema = async (
|
|
561
|
+
_izContext,
|
|
562
|
+
allRelSchemas,
|
|
563
|
+
settings = { bucketName: OBJECT_SCHEMA_BUCKET_NAME }
|
|
564
|
+
) => {
|
|
354
565
|
const getGraphServiceNameFromAllRelSchema = async (
|
|
355
566
|
_izContext,
|
|
356
567
|
allRelSchemas,
|
|
357
568
|
settings = { bucketName: OBJECT_SCHEMA_BUCKET_NAME }
|
|
358
569
|
) => {
|
|
359
570
|
const graphServiceNameSet = new Set();
|
|
571
|
+
await Promise.all(
|
|
572
|
+
allRelSchemas.map(async relSchema => {
|
|
573
|
+
let relTag = Object.keys(relSchema)[0];
|
|
574
|
+
let relSchemaData = relSchema[relTag];
|
|
360
575
|
await Promise.all(
|
|
361
576
|
allRelSchemas.map(async relSchema => {
|
|
362
577
|
let relTag = Object.keys(relSchema)[0];
|
|
@@ -380,6 +595,25 @@ const getGraphServiceNameFromAllRelSchema = async (
|
|
|
380
595
|
})
|
|
381
596
|
);
|
|
382
597
|
const graphServiceName = [...graphServiceNameSet];
|
|
598
|
+
return graphServiceName;
|
|
599
|
+
await Promise.all(
|
|
600
|
+
Object.values(relSchemaData.storageResources).map(
|
|
601
|
+
async storageResource => {
|
|
602
|
+
if (storageResource.storageType === STORAGE_TYPES.graph) {
|
|
603
|
+
const getGraphServiceName =
|
|
604
|
+
await serviceConfig.getGraphServiceTagWithCache(
|
|
605
|
+
_izContext,
|
|
606
|
+
storageResource.graphServerTag,
|
|
607
|
+
settings.bucketName
|
|
608
|
+
);
|
|
609
|
+
graphServiceNameSet.add(getGraphServiceName);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
)
|
|
613
|
+
);
|
|
614
|
+
})
|
|
615
|
+
);
|
|
616
|
+
const graphServiceName = [...graphServiceNameSet];
|
|
383
617
|
return graphServiceName;
|
|
384
618
|
};
|
|
385
619
|
|
|
@@ -390,6 +624,7 @@ function defaultIamRolePerAction() {
|
|
|
390
624
|
createIamRole(
|
|
391
625
|
{
|
|
392
626
|
[RESOURCE_CLASSES.s3]: ['GetObject', 'GetObjectVersion']
|
|
627
|
+
[RESOURCE_CLASSES.s3]: ['GetObject', 'GetObjectVersion']
|
|
393
628
|
},
|
|
394
629
|
[
|
|
395
630
|
resourceNames(
|
|
@@ -400,6 +635,14 @@ function defaultIamRolePerAction() {
|
|
|
400
635
|
RESOURCE_CLASSES.s3,
|
|
401
636
|
'${self:custom.iz_serviceSchemaBucketName}/serviceConfig/GraphServerTags.json'
|
|
402
637
|
)
|
|
638
|
+
resourceNames(
|
|
639
|
+
RESOURCE_CLASSES.s3,
|
|
640
|
+
'${self:custom.iz_serviceSchemaBucketName}/perServiceSchemas/*'
|
|
641
|
+
),
|
|
642
|
+
resourceNames(
|
|
643
|
+
RESOURCE_CLASSES.s3,
|
|
644
|
+
'${self:custom.iz_serviceSchemaBucketName}/serviceConfig/GraphServerTags.json'
|
|
645
|
+
)
|
|
403
646
|
]
|
|
404
647
|
)
|
|
405
648
|
);
|
|
@@ -411,11 +654,24 @@ function defaultIamRolePerAction() {
|
|
|
411
654
|
'${self:custom.iz_serviceSchemaBucketName}'
|
|
412
655
|
)
|
|
413
656
|
])
|
|
657
|
+
createIamRole({ [RESOURCE_CLASSES.s3]: ['ListBucket'] }, [
|
|
658
|
+
resourceNames(
|
|
659
|
+
RESOURCE_CLASSES.s3,
|
|
660
|
+
'${self:custom.iz_serviceSchemaBucketName}'
|
|
661
|
+
)
|
|
662
|
+
])
|
|
414
663
|
);
|
|
415
664
|
|
|
416
665
|
return defaultIamRole;
|
|
417
666
|
}
|
|
667
|
+
return defaultIamRole;
|
|
668
|
+
}
|
|
418
669
|
|
|
670
|
+
async function getGraphServiceNameFromObjectSchema(
|
|
671
|
+
_izContext,
|
|
672
|
+
allObjSchemas,
|
|
673
|
+
settings = { bucketName: OBJECT_SCHEMA_BUCKET_NAME }
|
|
674
|
+
) {
|
|
419
675
|
async function getGraphServiceNameFromObjectSchema(
|
|
420
676
|
_izContext,
|
|
421
677
|
allObjSchemas,
|
|
@@ -432,12 +688,22 @@ async function getGraphServiceNameFromObjectSchema(
|
|
|
432
688
|
settings.bucketName
|
|
433
689
|
);
|
|
434
690
|
graphServiceName.add(getGraphServiceName);
|
|
691
|
+
let getGraphServiceName =
|
|
692
|
+
await serviceConfig.getGraphServiceTagWithCache(
|
|
693
|
+
_izContext,
|
|
694
|
+
storageResource.graphServerTag,
|
|
695
|
+
settings.bucketName
|
|
696
|
+
);
|
|
697
|
+
graphServiceName.add(getGraphServiceName);
|
|
435
698
|
}
|
|
436
699
|
}
|
|
437
700
|
}
|
|
438
701
|
let graphServiceNames = [...graphServiceName];
|
|
439
702
|
return graphServiceNames;
|
|
440
703
|
}
|
|
704
|
+
let graphServiceNames = [...graphServiceName];
|
|
705
|
+
return graphServiceNames;
|
|
706
|
+
}
|
|
441
707
|
|
|
442
708
|
function awaitingMultipleStepsRole() {
|
|
443
709
|
let awaitingMultipleStepsRole = createIamRole(
|
|
@@ -448,6 +714,12 @@ function awaitingMultipleStepsRole() {
|
|
|
448
714
|
DYNAMO_RESOURCE.deleteItem,
|
|
449
715
|
DYNAMO_RESOURCE.query
|
|
450
716
|
]
|
|
717
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [
|
|
718
|
+
DYNAMO_RESOURCE.updateItem,
|
|
719
|
+
DYNAMO_RESOURCE.putItem,
|
|
720
|
+
DYNAMO_RESOURCE.deleteItem,
|
|
721
|
+
DYNAMO_RESOURCE.query
|
|
722
|
+
]
|
|
451
723
|
},
|
|
452
724
|
[
|
|
453
725
|
resourceNames(RESOURCE_CLASSES.dynamoDbTable, 'AwaitingMultipleSteps'),
|
|
@@ -456,14 +728,25 @@ function awaitingMultipleStepsRole() {
|
|
|
456
728
|
'AwaitingMultipleStepByPending'
|
|
457
729
|
),
|
|
458
730
|
resourceNames(RESOURCE_CLASSES.dynamoDbTable, 'AwaitingStep')
|
|
731
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, 'AwaitingMultipleSteps'),
|
|
732
|
+
resourceNames(
|
|
733
|
+
RESOURCE_CLASSES.dynamoDbTable,
|
|
734
|
+
'AwaitingMultipleStepByPending'
|
|
735
|
+
),
|
|
736
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, 'AwaitingStep')
|
|
459
737
|
]
|
|
460
738
|
);
|
|
461
739
|
return awaitingMultipleStepsRole;
|
|
462
740
|
}
|
|
741
|
+
);
|
|
742
|
+
return awaitingMultipleStepsRole;
|
|
743
|
+
}
|
|
463
744
|
|
|
464
745
|
function shortNameHandler(fullNameHandler) {
|
|
465
746
|
return fullNameHandler.slice(3);
|
|
466
747
|
}
|
|
748
|
+
return fullNameHandler.slice(3);
|
|
749
|
+
}
|
|
467
750
|
|
|
468
751
|
const SOURCE_GENERATE_IAM_ROLE = {
|
|
469
752
|
ProcessFindDataRole: 'ProcFindData',
|
|
@@ -478,6 +761,18 @@ const SOURCE_GENERATE_IAM_ROLE = {
|
|
|
478
761
|
EventBridge: 'EventBridge',
|
|
479
762
|
CreateRecordComplete: 'CreateRecordComplete',
|
|
480
763
|
RegisterRole: 'Register'
|
|
764
|
+
ProcessFindDataRole: 'ProcFindData',
|
|
765
|
+
ObjectCompleteRole: 'ObjectCom',
|
|
766
|
+
NodeCompleteRole: 'NodeCom',
|
|
767
|
+
RelationshipRole: 'Relationship',
|
|
768
|
+
RelationshipCompleteRole: 'RelationshipCom',
|
|
769
|
+
FlowSchemaUploadS3Role: 'FlowSchemaUploadS3',
|
|
770
|
+
FlowSchemaOwnTopic: 'FlowSchemaOwnTopic',
|
|
771
|
+
PerActionEndpoint: 'PerActionEndpoint',
|
|
772
|
+
ExternalTopicRole: 'ExternalTopic',
|
|
773
|
+
EventBridge: 'EventBridge',
|
|
774
|
+
CreateRecordComplete: 'CreateRecordComplete',
|
|
775
|
+
RegisterRole: 'Register'
|
|
481
776
|
};
|
|
482
777
|
|
|
483
778
|
const ADD_ON_DATA_STRUCTURE_TYPE = {
|
|
@@ -485,6 +780,10 @@ const ADD_ON_DATA_STRUCTURE_TYPE = {
|
|
|
485
780
|
attributeTree: 'attributeTree',
|
|
486
781
|
propertyNode: 'propertyNode',
|
|
487
782
|
translation: 'translation'
|
|
783
|
+
versionedData: 'versionedData',
|
|
784
|
+
attributeTree: 'attributeTree',
|
|
785
|
+
propertyNode: 'propertyNode',
|
|
786
|
+
translation: 'translation'
|
|
488
787
|
};
|
|
489
788
|
|
|
490
789
|
const ATTRIBUTE_TAG = {
|
|
@@ -492,11 +791,17 @@ const ATTRIBUTE_TAG = {
|
|
|
492
791
|
attributeTagLink: 'Link',
|
|
493
792
|
attributeTagProperty: 'Property',
|
|
494
793
|
attributeTagPropertyLabel: 'PropertyLabel'
|
|
794
|
+
attributeTagLabel: 'Label',
|
|
795
|
+
attributeTagLink: 'Link',
|
|
796
|
+
attributeTagProperty: 'Property',
|
|
797
|
+
attributeTagPropertyLabel: 'PropertyLabel'
|
|
495
798
|
};
|
|
496
799
|
|
|
497
800
|
const PROPERTY_VALUE_TAG = {
|
|
498
801
|
property: 'PropertyValue',
|
|
499
802
|
propertyLabel: 'PropertyLabel'
|
|
803
|
+
property: 'PropertyValue',
|
|
804
|
+
propertyLabel: 'PropertyLabel'
|
|
500
805
|
};
|
|
501
806
|
|
|
502
807
|
const FIELD_NAME_TYPE = {
|
|
@@ -505,12 +810,19 @@ const FIELD_NAME_TYPE = {
|
|
|
505
810
|
requiredOnCreateFieldName: 'requiredOnCreateFieldName',
|
|
506
811
|
randomOnCreateFieldName: 'randomOnCreateFieldName',
|
|
507
812
|
optionalOnCreate: 'optionalOnCreate'
|
|
813
|
+
identifiers: 'identifiers',
|
|
814
|
+
nonIdentifiers: 'nonIdentifiers',
|
|
815
|
+
requiredOnCreateFieldName: 'requiredOnCreateFieldName',
|
|
816
|
+
randomOnCreateFieldName: 'randomOnCreateFieldName',
|
|
817
|
+
optionalOnCreate: 'optionalOnCreate'
|
|
508
818
|
};
|
|
509
819
|
|
|
510
820
|
function fieldNameSetting(fieldNameType) {
|
|
821
|
+
const stringValidation = '^[a-zA-Z0-9-_]+$';
|
|
511
822
|
const stringValidation = '^[a-zA-Z0-9-_]+$';
|
|
512
823
|
return {
|
|
513
824
|
[FIELD_NAME_TYPE.identifiers]: {
|
|
825
|
+
type: 'string',
|
|
514
826
|
type: 'string',
|
|
515
827
|
requiredOnCreate: true,
|
|
516
828
|
optionalOnCreate: false,
|
|
@@ -521,6 +833,7 @@ function fieldNameSetting(fieldNameType) {
|
|
|
521
833
|
}
|
|
522
834
|
},
|
|
523
835
|
[FIELD_NAME_TYPE.nonIdentifiers]: {
|
|
836
|
+
type: 'string',
|
|
524
837
|
type: 'string',
|
|
525
838
|
requiredOnCreate: false,
|
|
526
839
|
optionalOnCreate: false,
|
|
@@ -531,6 +844,7 @@ function fieldNameSetting(fieldNameType) {
|
|
|
531
844
|
}
|
|
532
845
|
},
|
|
533
846
|
[FIELD_NAME_TYPE.requiredOnCreateFieldName]: {
|
|
847
|
+
type: 'string',
|
|
534
848
|
type: 'string',
|
|
535
849
|
requiredOnCreate: true,
|
|
536
850
|
optionalOnCreate: false,
|
|
@@ -541,6 +855,7 @@ function fieldNameSetting(fieldNameType) {
|
|
|
541
855
|
}
|
|
542
856
|
},
|
|
543
857
|
[FIELD_NAME_TYPE.randomOnCreateFieldName]: {
|
|
858
|
+
type: 'string',
|
|
544
859
|
type: 'string',
|
|
545
860
|
requiredOnCreate: false,
|
|
546
861
|
optionalOnCreate: false,
|
|
@@ -551,6 +866,7 @@ function fieldNameSetting(fieldNameType) {
|
|
|
551
866
|
}
|
|
552
867
|
},
|
|
553
868
|
[FIELD_NAME_TYPE.optionalOnCreate]: {
|
|
869
|
+
type: 'string',
|
|
554
870
|
type: 'string',
|
|
555
871
|
requiredOnCreate: false,
|
|
556
872
|
optionalOnCreate: true,
|
|
@@ -562,18 +878,28 @@ function fieldNameSetting(fieldNameType) {
|
|
|
562
878
|
}
|
|
563
879
|
}[fieldNameType];
|
|
564
880
|
}
|
|
881
|
+
}[fieldNameType];
|
|
882
|
+
}
|
|
565
883
|
|
|
566
884
|
const PREFIX_RELATIONSHIP = {
|
|
567
885
|
has: 'has',
|
|
568
886
|
is: 'is',
|
|
569
887
|
disabled: 'disabled'
|
|
570
888
|
};
|
|
889
|
+
has: 'has',
|
|
890
|
+
is: 'is',
|
|
891
|
+
disabled: 'disabled'
|
|
892
|
+
};
|
|
571
893
|
|
|
572
894
|
function checkDynamoTypeRelationship(relationship) {
|
|
573
895
|
let storageType;
|
|
574
896
|
let relationshipTag;
|
|
575
897
|
let links;
|
|
576
898
|
for (const [relTag, relProperties] of Object.entries(relationship)) {
|
|
899
|
+
relationshipTag = relTag;
|
|
900
|
+
for (const [storageResourceTag, storageResource] of Object.entries(
|
|
901
|
+
relProperties.storageResources
|
|
902
|
+
)) {
|
|
577
903
|
relationshipTag = relTag;
|
|
578
904
|
for (const [storageResourceTag, storageResource] of Object.entries(
|
|
579
905
|
relProperties.storageResources
|
|
@@ -583,6 +909,7 @@ function checkDynamoTypeRelationship(relationship) {
|
|
|
583
909
|
for (const link of relProperties.links) {
|
|
584
910
|
if (link.storageResourceTags.includes(storageResourceTag)) {
|
|
585
911
|
links = relProperties.links;
|
|
912
|
+
links = relProperties.links;
|
|
586
913
|
}
|
|
587
914
|
}
|
|
588
915
|
}
|
|
@@ -594,22 +921,31 @@ function checkDynamoTypeRelationship(relationship) {
|
|
|
594
921
|
function createDynamoDbComponentByLinks(link, relationshipTag) {
|
|
595
922
|
let tableNameFrom = `${link.from.objType.serviceTag}_${link.from.objType.objectType}__${relationshipTag}__${link.to.objType.serviceTag}_${link.to.objType.objectType}`;
|
|
596
923
|
let tableNameTo = `${link.to.objType.serviceTag}_${link.to.objType.objectType}__${relationshipTag}__${link.from.objType.serviceTag}_${link.from.objType.objectType}`;
|
|
924
|
+
let tableNameFrom = `${link.from.objType.serviceTag}_${link.from.objType.objectType}__${relationshipTag}__${link.to.objType.serviceTag}_${link.to.objType.objectType}`;
|
|
925
|
+
let tableNameTo = `${link.to.objType.serviceTag}_${link.to.objType.objectType}__${relationshipTag}__${link.from.objType.serviceTag}_${link.from.objType.objectType}`;
|
|
597
926
|
|
|
927
|
+
let identifiersConcatFrom = `${link.from.objType.serviceTag}_${link.from.objType.objectType}__identifiersConcat`;
|
|
928
|
+
let identifiersConcatTo = `${link.to.objType.serviceTag}_${link.to.objType.objectType}__identifiersConcat`;
|
|
598
929
|
let identifiersConcatFrom = `${link.from.objType.serviceTag}_${link.from.objType.objectType}__identifiersConcat`;
|
|
599
930
|
let identifiersConcatTo = `${link.to.objType.serviceTag}_${link.to.objType.objectType}__identifiersConcat`;
|
|
600
931
|
|
|
601
|
-
let resourceNameFrom = `${upperCase(link.from.objType.objectType) + upperCase(link.to.objType.objectType)}${upperCase(relationshipTag)}`;
|
|
602
|
-
let resourceNameTo = `${upperCase(link.to.objType.objectType) + upperCase(link.from.objType.objectType)}${upperCase(relationshipTag)}`;
|
|
932
|
+
// let resourceNameFrom = `${upperCase(link.from.objType.objectType) + upperCase(link.to.objType.objectType)}${upperCase(relationshipTag)}`;
|
|
933
|
+
// let resourceNameTo = `${upperCase(link.to.objType.objectType) + upperCase(link.from.objType.objectType)}${upperCase(relationshipTag)}`;
|
|
603
934
|
return {
|
|
604
935
|
tableNameFrom,
|
|
605
936
|
tableNameTo,
|
|
606
937
|
identifiersConcatFrom,
|
|
607
938
|
identifiersConcatTo,
|
|
608
|
-
resourceNameFrom,
|
|
609
|
-
resourceNameTo
|
|
939
|
+
// resourceNameFrom,
|
|
940
|
+
// resourceNameTo
|
|
610
941
|
};
|
|
611
942
|
}
|
|
612
943
|
|
|
944
|
+
async function getStorageResourceFromObjectSchemas(
|
|
945
|
+
_izContext,
|
|
946
|
+
allObjSchemas,
|
|
947
|
+
settings = { bucketName: OBJECT_SCHEMA_BUCKET_NAME }
|
|
948
|
+
) {
|
|
613
949
|
async function getStorageResourceFromObjectSchemas(
|
|
614
950
|
_izContext,
|
|
615
951
|
allObjSchemas,
|
|
@@ -617,16 +953,25 @@ async function getStorageResourceFromObjectSchemas(
|
|
|
617
953
|
) {
|
|
618
954
|
if (Array.isArray(allObjSchemas)) {
|
|
619
955
|
allObjSchemas = [allObjSchemas];
|
|
956
|
+
allObjSchemas = [allObjSchemas];
|
|
620
957
|
}
|
|
621
958
|
let resourceGraphServiceTag = new Set();
|
|
622
959
|
let resourceDynamoTableName = new Set();
|
|
623
960
|
for (const objectSchema of allObjSchemas.records) {
|
|
961
|
+
for (const storageResource of Object.values(
|
|
962
|
+
objectSchema.storageResources
|
|
963
|
+
)) {
|
|
624
964
|
for (const storageResource of Object.values(
|
|
625
965
|
objectSchema.storageResources
|
|
626
966
|
)) {
|
|
627
967
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
628
968
|
resourceDynamoTableName.add(storageResource.tableName);
|
|
629
969
|
} else if (storageResource.storageType === STORAGE_TYPES.graph) {
|
|
970
|
+
let graphServiceTag = await serviceConfig.getGraphServiceTagWithCache(
|
|
971
|
+
_izContext,
|
|
972
|
+
storageResource.graphServerTag,
|
|
973
|
+
settings.bucketName
|
|
974
|
+
);
|
|
630
975
|
let graphServiceTag = await serviceConfig.getGraphServiceTagWithCache(
|
|
631
976
|
_izContext,
|
|
632
977
|
storageResource.graphServerTag,
|
|
@@ -641,6 +986,10 @@ async function getStorageResourceFromObjectSchemas(
|
|
|
641
986
|
resourceGraphServiceTag: [...resourceGraphServiceTag],
|
|
642
987
|
resourceDynamoTableName: [...resourceDynamoTableName]
|
|
643
988
|
};
|
|
989
|
+
return {
|
|
990
|
+
resourceGraphServiceTag: [...resourceGraphServiceTag],
|
|
991
|
+
resourceDynamoTableName: [...resourceDynamoTableName]
|
|
992
|
+
};
|
|
644
993
|
}
|
|
645
994
|
|
|
646
995
|
const FLOW_SCHEMA_EVENT_TYPE = {
|
|
@@ -649,7 +998,16 @@ const FLOW_SCHEMA_EVENT_TYPE = {
|
|
|
649
998
|
extTopic: 'extTopic',
|
|
650
999
|
eventBridge: 'eventBridge'
|
|
651
1000
|
};
|
|
1001
|
+
s3: 's3',
|
|
1002
|
+
ownTopic: 'ownTopic',
|
|
1003
|
+
extTopic: 'extTopic',
|
|
1004
|
+
eventBridge: 'eventBridge'
|
|
1005
|
+
};
|
|
652
1006
|
|
|
1007
|
+
async function getExternalTopicComponentFromAllObjectSchemas(
|
|
1008
|
+
_izContext,
|
|
1009
|
+
allObjSchemas
|
|
1010
|
+
) {
|
|
653
1011
|
async function getExternalTopicComponentFromAllObjectSchemas(
|
|
654
1012
|
_izContext,
|
|
655
1013
|
allObjSchemas
|
|
@@ -664,6 +1022,7 @@ async function getExternalTopicComponentFromAllObjectSchemas(
|
|
|
664
1022
|
serviceTag: storageResource.serviceTag,
|
|
665
1023
|
stage: storageResource.stage
|
|
666
1024
|
});
|
|
1025
|
+
});
|
|
667
1026
|
|
|
668
1027
|
if (!externalTopicComponentSet.has(uniqueTag)) {
|
|
669
1028
|
externalTopicComponentSet.add({
|
|
@@ -674,6 +1033,14 @@ async function getExternalTopicComponentFromAllObjectSchemas(
|
|
|
674
1033
|
stage: storageResource.stage
|
|
675
1034
|
}
|
|
676
1035
|
});
|
|
1036
|
+
externalTopicComponentSet.add({
|
|
1037
|
+
[uniqueTag]: {
|
|
1038
|
+
accountId: storageResource.accountId,
|
|
1039
|
+
region: storageResource.region,
|
|
1040
|
+
serviceTag: storageResource.serviceTag,
|
|
1041
|
+
stage: storageResource.stage
|
|
1042
|
+
}
|
|
1043
|
+
});
|
|
677
1044
|
}
|
|
678
1045
|
}
|
|
679
1046
|
}
|
|
@@ -681,17 +1048,27 @@ async function getExternalTopicComponentFromAllObjectSchemas(
|
|
|
681
1048
|
let externalTopicComponents = [...externalTopicComponentSet];
|
|
682
1049
|
return externalTopicComponents;
|
|
683
1050
|
}
|
|
1051
|
+
let externalTopicComponents = [...externalTopicComponentSet];
|
|
1052
|
+
return externalTopicComponents;
|
|
1053
|
+
}
|
|
684
1054
|
|
|
685
1055
|
const GENERATE_SEED_DATA_TYPE = {
|
|
686
1056
|
RANDOM_ON_CREATE_IDENTIFIERS: 'randomOnCreateIdentifier',
|
|
687
1057
|
NON_RANDOM_ON_CREATE_IDENTIFIERS: 'notRandomOnIdentifier',
|
|
688
1058
|
RELATIONSHIPS: 'relationships'
|
|
689
1059
|
};
|
|
1060
|
+
RANDOM_ON_CREATE_IDENTIFIERS: 'randomOnCreateIdentifier',
|
|
1061
|
+
NON_RANDOM_ON_CREATE_IDENTIFIERS: 'notRandomOnIdentifier',
|
|
1062
|
+
RELATIONSHIPS: 'relationships'
|
|
1063
|
+
};
|
|
690
1064
|
|
|
691
1065
|
const SEED_DATA_TAG = {
|
|
692
1066
|
dynamoDBSeedDataTags: 'dynamoDBSeedDataTags',
|
|
693
1067
|
graphSeedDataTags: 'graphSeedDataTags'
|
|
694
1068
|
};
|
|
1069
|
+
dynamoDBSeedDataTags: 'dynamoDBSeedDataTags',
|
|
1070
|
+
graphSeedDataTags: 'graphSeedDataTags'
|
|
1071
|
+
};
|
|
695
1072
|
|
|
696
1073
|
export default {
|
|
697
1074
|
STORAGE_TYPES,
|
|
@@ -733,3 +1110,5 @@ export default {
|
|
|
733
1110
|
GENERATE_SEED_DATA_TYPE,
|
|
734
1111
|
SEED_DATA_TAG
|
|
735
1112
|
};
|
|
1113
|
+
|
|
1114
|
+
};
|