@izara_project/izara-market-library-service-schemas 1.0.20 → 1.0.22
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 +4 -3
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +54 -1
- package/src/TemplateManager/src/FindData/mainFunction/data.js +25 -25
- package/src/TemplateManager/src/GenerateCode.js +5 -5
- package/src/TemplateManager/src/GenerateSchema.js +88 -0
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/data.js +9 -6
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/template.ejs +2 -2
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/data.js +5 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/data.js +5 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/data.js +3 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/data.js +4 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/data.js +3 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/data.js +3 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/data.js +3 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/data.js +3 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Delete/data.js +3 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/data.js +3 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/data.js +3 -1
- package/src/TemplateManager/src/Role/createSharedResource.js +19 -17
- package/src/TemplateManager/src/attributeTree/objectSchema/data.js +125 -0
- package/src/TemplateManager/src/attributeTree/objectSchema/template.ejs +20 -0
- package/src/TemplateManager/src/attributeTree/refRelationshipSchema/data.js +36 -0
- package/src/TemplateManager/src/attributeTree/refRelationshipSchema/template.ejs +0 -0
- package/src/TemplateManager/src/attributeTree/relationshipSchema/data.js +92 -0
- package/src/TemplateManager/src/attributeTree/relationshipSchema/template.ejs +40 -0
- package/src/TemplateManager/src/externalService/FunctionNameConfig/data.js +104 -23
- package/src/TemplateManager/src/externalService/FunctionNameConfig/templateIntTesting.ejs +5 -5
- package/src/TemplateManager/src/externalService/FunctionNameConfig/templateYaml.ejs +2 -2
- package/src/TemplateManager/src/externalService/LambdaRole/data.js +22 -12
- package/src/TemplateManager/src/externalService/LambdaRole/template.ejs +1 -1
- package/src/TemplateManager/src/libs/Consts.js +97 -7
|
@@ -25,13 +25,14 @@ const { getGraphServiceNameFromGraphServerTagWithCache,
|
|
|
25
25
|
} = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig')
|
|
26
26
|
|
|
27
27
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils")
|
|
28
|
-
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, RESOURCE_CLASSES, SOURCE_PATH, externalResourceName, getGraphServiceNameFromAllRelSchema, SAVE_FILE_NAME, LAMBDA_RESOURCE, SNS_RESOURCE, getGraphServiceNameFromObjectSchema, shortNameHandler, SHORT_FUNCTION_NAME, defaultIamRolePerAction, resourceNames } = require("../../libs/Consts");
|
|
28
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, RESOURCE_CLASSES, SOURCE_PATH, externalResourceName, getGraphServiceNameFromAllRelSchema, SAVE_FILE_NAME, LAMBDA_RESOURCE, SNS_RESOURCE, getGraphServiceNameFromObjectSchema, shortNameHandler, SHORT_FUNCTION_NAME, defaultIamRolePerAction, resourceNames, SOURCE_GENERATE_IAM_ROLE } = require("../../libs/Consts");
|
|
29
29
|
// const templatePath = path.join(__dirname, "./template.ejs");
|
|
30
30
|
const templatePath = path.join(__dirname, "./template.ejs");
|
|
31
|
-
const {
|
|
31
|
+
const { getAllLocalRelationshipSchema } = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
|
|
32
32
|
const { EXTERNAL_SERVICE_NAME } = require("../../../../GenerateCodeLibs/src/Consts")
|
|
33
|
+
|
|
33
34
|
const createExternalLambdaRole = async (_izContext, allObjSchemas, allRelSchemas, allLocalFlowSchemas, srcPath) => {
|
|
34
|
-
const allRelationshipSchemas =
|
|
35
|
+
const allRelationshipSchemas = getAllLocalRelationshipSchema(_izContext, srcPath)
|
|
35
36
|
// console.log("allRelationshipSchemas", allRelationshipSchemas);
|
|
36
37
|
const externalLambdaIamRoleArray = [];
|
|
37
38
|
for (const objectSchema of allObjSchemas) {
|
|
@@ -78,7 +79,6 @@ const createExternalLambdaRole = async (_izContext, allObjSchemas, allRelSchemas
|
|
|
78
79
|
const externalLambdaIamRoleFindData = externalLambdaIamRoleDataFindData(_izContext);
|
|
79
80
|
externalLambdaIamRoleFindData && externalLambdaIamRoleArray.push(externalLambdaIamRoleFindData)
|
|
80
81
|
|
|
81
|
-
|
|
82
82
|
// updateRelationshipComplete external lambda role
|
|
83
83
|
|
|
84
84
|
// ... another external lambda role data
|
|
@@ -195,6 +195,7 @@ async function externalLambdaIamRoleDataPerAction(_izContext, objectSchema, acti
|
|
|
195
195
|
|
|
196
196
|
|
|
197
197
|
return {
|
|
198
|
+
objectType: upperCase(objectType),
|
|
198
199
|
functionName: functionName,
|
|
199
200
|
action: action,
|
|
200
201
|
additionalResourcePermission
|
|
@@ -207,7 +208,7 @@ async function externalLambdaIamRoleDataUpdateRelationshipSchema(_izContext, all
|
|
|
207
208
|
const functionName = upperCase(SHORT_FUNCTION_NAME.updateRel) + upperCase(shortNameHandler(handler));
|
|
208
209
|
const additionalResourcePermission = [];
|
|
209
210
|
const graphServiceNamesFromAllRelSchemas = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas);
|
|
210
|
-
|
|
211
|
+
const objectType = SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
211
212
|
|
|
212
213
|
additionalResourcePermission.push(
|
|
213
214
|
createIamRole(
|
|
@@ -222,7 +223,8 @@ async function externalLambdaIamRoleDataUpdateRelationshipSchema(_izContext, all
|
|
|
222
223
|
|
|
223
224
|
return {
|
|
224
225
|
functionName,
|
|
225
|
-
additionalResourcePermission
|
|
226
|
+
additionalResourcePermission,
|
|
227
|
+
objectType
|
|
226
228
|
}
|
|
227
229
|
}
|
|
228
230
|
|
|
@@ -233,6 +235,7 @@ async function externalLambdaIamRoleDataCreateRelationshipSchema(_izContext, all
|
|
|
233
235
|
const functionName = upperCase(SHORT_FUNCTION_NAME.createRel) + upperCase(shortNameHandler(handler));
|
|
234
236
|
const additionalResourcePermission = [];
|
|
235
237
|
const graphServiceNamesFromAllRelSchemas = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas);
|
|
238
|
+
const objectType = SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
236
239
|
|
|
237
240
|
additionalResourcePermission.push(
|
|
238
241
|
createIamRole(
|
|
@@ -246,7 +249,8 @@ async function externalLambdaIamRoleDataCreateRelationshipSchema(_izContext, all
|
|
|
246
249
|
)
|
|
247
250
|
return {
|
|
248
251
|
functionName,
|
|
249
|
-
additionalResourcePermission
|
|
252
|
+
additionalResourcePermission,
|
|
253
|
+
objectType
|
|
250
254
|
}
|
|
251
255
|
}
|
|
252
256
|
|
|
@@ -255,6 +259,7 @@ async function externalLambdaIamRoleDataDeleteRelationshipSchema(_izContext, all
|
|
|
255
259
|
const functionName = upperCase(SHORT_FUNCTION_NAME.deleteRel) + upperCase(shortNameHandler(handler))
|
|
256
260
|
const additionalResourcePermission = [];
|
|
257
261
|
const graphServiceNamesFromAllRelSchemas = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas);
|
|
262
|
+
const objectType = SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
258
263
|
|
|
259
264
|
additionalResourcePermission.push(
|
|
260
265
|
createIamRole(
|
|
@@ -268,14 +273,15 @@ async function externalLambdaIamRoleDataDeleteRelationshipSchema(_izContext, all
|
|
|
268
273
|
)
|
|
269
274
|
return {
|
|
270
275
|
functionName,
|
|
271
|
-
additionalResourcePermission
|
|
276
|
+
additionalResourcePermission,
|
|
277
|
+
objectType
|
|
272
278
|
}
|
|
273
279
|
}
|
|
274
280
|
|
|
275
281
|
function externalLambdaIamRoleDataFindData(_izContext) {
|
|
276
282
|
let functionName = upperCase(SHORT_FUNCTION_NAME.findData) + upperCase(shortNameHandler(HANDLER.hdrSqs));
|
|
277
283
|
let additionalResourcePermission = [];
|
|
278
|
-
|
|
284
|
+
let objectType = SOURCE_GENERATE_IAM_ROLE.ProcessFindDataRole
|
|
279
285
|
additionalResourcePermission.push(
|
|
280
286
|
createIamRole(
|
|
281
287
|
{
|
|
@@ -286,10 +292,11 @@ function externalLambdaIamRoleDataFindData(_izContext) {
|
|
|
286
292
|
]
|
|
287
293
|
)
|
|
288
294
|
)
|
|
289
|
-
console.log("findData template data:", { functionName, additionalResourcePermission })
|
|
295
|
+
// console.log("findData template data:", { functionName, additionalResourcePermission })
|
|
290
296
|
return {
|
|
291
297
|
functionName,
|
|
292
|
-
additionalResourcePermission
|
|
298
|
+
additionalResourcePermission,
|
|
299
|
+
objectType
|
|
293
300
|
}
|
|
294
301
|
}
|
|
295
302
|
|
|
@@ -298,6 +305,8 @@ async function externalLambdaIamRoleDataProcessLogical(_izContext, allObjectSche
|
|
|
298
305
|
let functionName = upperCase(SHORT_FUNCTION_NAME.processLogical) + upperCase(shortNameHandler(HANDLER.hdrSqs));
|
|
299
306
|
let additionalResourcePermission = [];
|
|
300
307
|
let graphServiceNames = await getGraphServiceNameFromObjectSchema(_izContext, allObjectSchemas)
|
|
308
|
+
let objectType = SOURCE_GENERATE_IAM_ROLE.ProcessFindDataRole
|
|
309
|
+
|
|
301
310
|
// console.log("graphServiceNameFromProcessLogical::", graphServiceNames)
|
|
302
311
|
additionalResourcePermission.push(
|
|
303
312
|
createIamRole(
|
|
@@ -311,7 +320,8 @@ async function externalLambdaIamRoleDataProcessLogical(_izContext, allObjectSche
|
|
|
311
320
|
)
|
|
312
321
|
return {
|
|
313
322
|
functionName,
|
|
314
|
-
additionalResourcePermission
|
|
323
|
+
additionalResourcePermission,
|
|
324
|
+
objectType
|
|
315
325
|
}
|
|
316
326
|
}
|
|
317
327
|
|
|
@@ -29,7 +29,7 @@ const _izContext = {logger : Logger}
|
|
|
29
29
|
module.exports.generatedLambdaRole = async () => {
|
|
30
30
|
let externalLambdaRole = [ <%_ datas.forEach((data,dataIndex) => { %>
|
|
31
31
|
{
|
|
32
|
-
|
|
32
|
+
roleName: "<%- data.objectType %>",
|
|
33
33
|
statement: [
|
|
34
34
|
<%_ data.additionalResourcePermission.forEach((resourcePermission, resourceIdx) => { _%>
|
|
35
35
|
{
|
|
@@ -115,16 +115,16 @@ const SOURCE_PATH = {
|
|
|
115
115
|
resourceLocationRelationshipPerAction: 'src/generatedCode/RelationshipPerAction/source/',
|
|
116
116
|
resourceLocationTranslateId: 'src/generatedCode/TranslateId/source/',
|
|
117
117
|
resourceLocationProcessLogical: "src/generatedCode/ProcessLogical/source/",
|
|
118
|
-
webSocket: "../src/generatedCode/
|
|
119
|
-
resourceLocationWebSocket: "src/generatedCode/
|
|
118
|
+
webSocket: "../src/generatedCode/FlowSchema/source/",
|
|
119
|
+
resourceLocationWebSocket: "src/generatedCode/FlowSchema/source/",
|
|
120
120
|
generateCodeLib: "../src/generatedCode/libs/source/",
|
|
121
121
|
logicalFunctionHook: "../src/generatedCode/WebSocket/source/FlowSchemaHook/HookLogicFunction/source/",
|
|
122
122
|
resourceLocationLogicalFunctionHook: "src/generatedCode/WebSocket/source/FlowSchemaHook/HookLogicFunction/source",
|
|
123
123
|
generatedCodeHookFunction: "../src/generatedCode/WebSocket/source/FlowSchemaHook/HookFunctionGeneratedCode/source/",
|
|
124
124
|
resourceLocationGeneratedCodeHookFunction: "src/generatedCode/WebSocket/source/FlowSchemaHook/HookFunctionGeneratedCode/source/",
|
|
125
|
+
generatedAttributeTree: "../src/schemas/generatedCode/source/"
|
|
125
126
|
};
|
|
126
127
|
|
|
127
|
-
|
|
128
128
|
const DEFAULT_LAMBDA_ROLE_PER_ACTION = {
|
|
129
129
|
[ACTIONS.create]: {
|
|
130
130
|
dynamoDbPermission: 'PutItem',
|
|
@@ -219,6 +219,9 @@ const SAVE_FILE_NAME = {
|
|
|
219
219
|
flowSchema: "flowSchema",
|
|
220
220
|
S3Bucket: "generated-s3-bucket",
|
|
221
221
|
sharedResourceYaml: "generate-SharedResource",
|
|
222
|
+
attributeTreeObjectRelationship: "ObjectRelationships",
|
|
223
|
+
attributeTreeRefObjectRelationship: "RefObjectRelationships",
|
|
224
|
+
attributeTreeObjectSchema: "ObjectFieldSchema"
|
|
222
225
|
};
|
|
223
226
|
|
|
224
227
|
const FUNCTION_NAME = {
|
|
@@ -359,12 +362,94 @@ function shortNameHandler(fullNameHandler) {
|
|
|
359
362
|
};
|
|
360
363
|
|
|
361
364
|
const SOURCE_GENERATE_IAM_ROLE = {
|
|
362
|
-
ProcessFindDataRole: "
|
|
363
|
-
ObjectCompleteRole: "
|
|
365
|
+
ProcessFindDataRole: "ProcFindData",
|
|
366
|
+
ObjectCompleteRole: "ObjectCom",
|
|
367
|
+
NodeCompleteRole: "NodeCom",
|
|
364
368
|
RelationshipRole: "Relationship",
|
|
365
|
-
RelationshipCompleteRole: "
|
|
369
|
+
RelationshipCompleteRole: "RelationshipCom",
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
const ADD_ON_DATA_STRUCTURE_TYPE = {
|
|
373
|
+
versionedData: "versionedData",
|
|
374
|
+
attributeTree: "attributeTree"
|
|
366
375
|
};
|
|
367
376
|
|
|
377
|
+
const ATTRIBUTE_TAG = {
|
|
378
|
+
attributeTagLabel: "Label",
|
|
379
|
+
attributeTagLink: "Link",
|
|
380
|
+
attributeTagProperty: "Property",
|
|
381
|
+
attributeTagPropertyLabel: "PropertyLabel",
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
const FIELD_NAME_TPYE = {
|
|
385
|
+
identifiers: "identifiers",
|
|
386
|
+
nonIdentifiers: "nonIdentifiers",
|
|
387
|
+
requiredOnCreateFieldName: "requiredOnCreateFieldName",
|
|
388
|
+
randomOnCreateFieldName: "randomOnCreateFieldName",
|
|
389
|
+
optionalOnCreate: "optionalOnCreate"
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
function fieldNameSetting(fieldNameType) {
|
|
393
|
+
const stringValidation = "^[a-zA-Z0-9-_]+$"
|
|
394
|
+
return {
|
|
395
|
+
[FIELD_NAME_TPYE.identifiers]: {
|
|
396
|
+
type: "string",
|
|
397
|
+
requiredOnCreate: true,
|
|
398
|
+
optionalOnCreate: false,
|
|
399
|
+
canUpdate: false,
|
|
400
|
+
randomOnCreate: false,
|
|
401
|
+
validation: {
|
|
402
|
+
pattern: stringValidation
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
[FIELD_NAME_TPYE.nonIdentifiers]: {
|
|
406
|
+
type: "string",
|
|
407
|
+
requiredOnCreate: false,
|
|
408
|
+
optionalOnCreate: false,
|
|
409
|
+
canUpdate: true,
|
|
410
|
+
randomOnCreate: false,
|
|
411
|
+
validation: {
|
|
412
|
+
pattern: stringValidation
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
[FIELD_NAME_TPYE.requiredOnCreateFieldName]: {
|
|
416
|
+
type: "string",
|
|
417
|
+
requiredOnCreate: true,
|
|
418
|
+
optionalOnCreate: false,
|
|
419
|
+
canUpdate: false,
|
|
420
|
+
randomOnCreate: false,
|
|
421
|
+
validation: {
|
|
422
|
+
pattern: stringValidation
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
[FIELD_NAME_TPYE.randomOnCreateFieldName]: {
|
|
426
|
+
type: "string",
|
|
427
|
+
requiredOnCreate: true,
|
|
428
|
+
optionalOnCreate: false,
|
|
429
|
+
canUpdate: false,
|
|
430
|
+
randomOnCreate: false,
|
|
431
|
+
validation: {
|
|
432
|
+
pattern: stringValidation
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
[FIELD_NAME_TPYE.optionalOnCreate]: {
|
|
436
|
+
type: "string",
|
|
437
|
+
requiredOnCreate: false,
|
|
438
|
+
optionalOnCreate: true,
|
|
439
|
+
canUpdate: false,
|
|
440
|
+
randomOnCreate: false,
|
|
441
|
+
validation: {
|
|
442
|
+
pattern: stringValidation
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}[fieldNameType]
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
const PREFIX_RELATIONSHIP = {
|
|
449
|
+
has: "has",
|
|
450
|
+
is: "is",
|
|
451
|
+
disabled: "disabled"
|
|
452
|
+
}
|
|
368
453
|
|
|
369
454
|
module.exports = {
|
|
370
455
|
ACTIONS,
|
|
@@ -391,5 +476,10 @@ module.exports = {
|
|
|
391
476
|
shortNameHandler,
|
|
392
477
|
SHORT_FUNCTION_NAME,
|
|
393
478
|
S3_RESOURCE,
|
|
394
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
479
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
480
|
+
fieldNameSetting,
|
|
481
|
+
FIELD_NAME_TPYE,
|
|
482
|
+
ADD_ON_DATA_STRUCTURE_TYPE,
|
|
483
|
+
ATTRIBUTE_TAG,
|
|
484
|
+
PREFIX_RELATIONSHIP
|
|
395
485
|
}
|