@izara_project/izara-market-library-service-schemas 1.0.9 → 1.0.11
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/Consts.js +12 -12
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +63 -17
- package/src/TemplateManager/src/FindData/mainFunction/template.ejs +0 -7
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/data.js +4 -3
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/data.js +0 -2
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/template.ejs +17 -14
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/functionYaml/data.js +4 -3
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/handler/data.js +0 -2
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/mainFunction/template.ejs +5 -2
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/data.js +4 -2
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/handler/data.js +0 -2
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/template.ejs +5 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/data.js +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/data.js +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/data.js +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/data.js +3 -3
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/template.ejs +6 -2
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/template.ejs +2 -2
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/template.ejs +52 -11
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/data.js +2 -2
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/data.js +2 -2
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrDsq/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrInv/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrSqs/data.js +2 -3
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/mainFunction/data.js +2 -0
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/mainFunction/template.ejs +63 -23
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrApi/template.ejs +45 -28
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrDsq/template.ejs +42 -21
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrInv/template.ejs +41 -22
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrSqs/template.ejs +42 -21
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/functionYaml/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrApi/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrDsq/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrInv/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrSqs/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/mainFunction/data.js +2 -0
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/functionYaml/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/mainFunction/data.js +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/template.ejs +1 -1
- package/src/TemplateManager/src/ResourceYaml/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +2 -2
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/data.js +2 -2
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction/template.ejs +2 -36
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq/data.js +2 -2
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs/data.js +2 -2
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/mainFunction/template.ejs +7 -17
- package/src/TemplateManager/src/externalService/LambdaRole/data.js +7 -6
- package/src/TemplateManager/src/libs/Consts.js +21 -1
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +0 -119
package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction/template.ejs
CHANGED
|
@@ -24,11 +24,9 @@ const lambdaSharedLib = izaraShared.lambdaSharedLib;
|
|
|
24
24
|
const graphSharedLib = izaraShared.graphSharedLib;
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
const translateIdsSharedLib = require('@izara_project/izara-translateids/src/TranslateIdsLib');
|
|
29
28
|
const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
|
|
30
29
|
const lambda = require('@izara_project/izara-core-library-external-request/src/resources/Lambda');
|
|
31
|
-
const TranslateIdsLibs = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/TranslateIdsLibs')
|
|
32
30
|
const serviceSchemas = require("@izara_project/izara-core-library-service-schemas");
|
|
33
31
|
const identifiersObject = require('@izara_project/izara-core-library-service-schemas/src/IdentifiersObject');
|
|
34
32
|
const getObjectSchema = require("@izara_project/izara-core-library-service-schemas/src/GetObjectSchema")
|
|
@@ -45,7 +43,6 @@ const { firstLetterUpperCase: upperCase } = require('@izara_project/izara-market
|
|
|
45
43
|
* @param {string} fromPartitionKeyFieldName - partition key field/attribute name
|
|
46
44
|
* @param {string} fromDataFieldName - data field/attribute name
|
|
47
45
|
* @param {object} toObjType - the type of object we are translating ids to
|
|
48
|
-
* @param {string} toTypeId - the type of object we are translating ids to
|
|
49
46
|
* @param {Object} [additionalData={}] - additional data to send back in completed message
|
|
50
47
|
* @param {Object} [startKey={}] - first invoke will be empty
|
|
51
48
|
* @param {Nummic} invocationCount
|
|
@@ -58,13 +55,12 @@ module.exports.processTranslateIds = async (
|
|
|
58
55
|
_izContext,
|
|
59
56
|
fromObjType,
|
|
60
57
|
fromTypeId,
|
|
61
|
-
identifiers,
|
|
58
|
+
identifiers,
|
|
62
59
|
fromTable,
|
|
63
60
|
fromPartitionKeyId,
|
|
64
61
|
fromPartitionKeyFieldName,
|
|
65
62
|
fromDataFieldName,
|
|
66
63
|
toObjType,
|
|
67
|
-
toTypeId,
|
|
68
64
|
relType,
|
|
69
65
|
translateIdsCacheId,
|
|
70
66
|
uniqueRequestId,
|
|
@@ -74,10 +70,6 @@ module.exports.processTranslateIds = async (
|
|
|
74
70
|
passOnErrorsFound,
|
|
75
71
|
callingFlow = "",
|
|
76
72
|
) => {
|
|
77
|
-
// translateIds request to change from propertyIds to mediaLinkIds.
|
|
78
|
-
// MediaLinkProperty: filter dataId is propertyIds
|
|
79
|
-
// MediaLinkPropertyTranslation: filter dataId is propertyIds
|
|
80
|
-
// translate 2 time , propertyIds from MediaLinkProperty and propertyIds from MediaLinkPropertyTranslation
|
|
81
73
|
try {
|
|
82
74
|
_izContext.logger.debug("=== Function:ProcessTranslateIds ===", {
|
|
83
75
|
fromObjType: fromObjType,
|
|
@@ -88,7 +80,6 @@ module.exports.processTranslateIds = async (
|
|
|
88
80
|
fromPartitionKeyFieldName: fromPartitionKeyFieldName,
|
|
89
81
|
fromDataFieldName: fromDataFieldName,
|
|
90
82
|
toObjType: toObjType,
|
|
91
|
-
toTypeId: toTypeId,
|
|
92
83
|
relType: relType,
|
|
93
84
|
translateIdsCacheId: translateIdsCacheId,
|
|
94
85
|
uniqueRequestId: uniqueRequestId,
|
|
@@ -100,31 +91,16 @@ module.exports.processTranslateIds = async (
|
|
|
100
91
|
});
|
|
101
92
|
|
|
102
93
|
let errorsFound = [];
|
|
103
|
-
// Query resultDatas from table
|
|
104
|
-
/*
|
|
105
|
-
receive fromType , toType , relType check relationshipSchema return boolean
|
|
106
|
-
just validate to check for error or use for do something further
|
|
107
|
-
if false throw error if true continue translateIds+
|
|
108
|
-
*/
|
|
109
|
-
// let validateObjTypeStatus = await validateFromTypeToToTypeWithRelType(_izContext, fromObjType, toObjType, relType
|
|
110
|
-
let validateObjTypes = await TranslateIdsLibs.validateObjtypesAndRelType(_izContext, [fromObjType, toObjType], relType)
|
|
111
|
-
if (validateObjTypes == null) {
|
|
112
|
-
errorsFound = errorsFound.concat(`can't find ${fromObjType} and ${toObjType} in relationshipTag:${JSON.stringify(relType)}`)
|
|
113
|
-
}
|
|
114
94
|
|
|
115
|
-
/*
|
|
116
|
-
check fromIdentifiers if have use it
|
|
117
|
-
if not query data from table by using TranslateIdsGetResultIds
|
|
118
|
-
*/
|
|
119
95
|
let resultDatas;
|
|
120
96
|
let lastEvaluatedKeyResultDatas;
|
|
121
97
|
|
|
122
|
-
|
|
123
98
|
// incase didn't send identifiers
|
|
124
99
|
if (!identifiers) {
|
|
125
100
|
|
|
126
101
|
let getFromObjectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(_izContext, fromObjType);
|
|
127
102
|
_izContext.logger.debug("getFromObjectSchema", getFromObjectSchema);
|
|
103
|
+
|
|
128
104
|
// create Full tableName
|
|
129
105
|
let tableName = await dynamodbSharedLib.tableName(_izContext, fromTable, upperCase(getFromObjectSchema.complexFilterServiceTag));
|
|
130
106
|
_izContext.logger.debug("tableName", tableName);
|
|
@@ -136,22 +112,12 @@ module.exports.processTranslateIds = async (
|
|
|
136
112
|
startKey
|
|
137
113
|
)
|
|
138
114
|
|
|
139
|
-
// lastEvaluatedKeyResultDatas.LastEvaluatedKey
|
|
140
|
-
/*
|
|
141
|
-
if not have resultDatas it mean you cant query identifier from table and you didn't send identifier it will return error
|
|
142
|
-
*/
|
|
143
115
|
_izContext.logger.debug("resultDatas query fromtable =>", resultDatas);
|
|
144
116
|
if (!resultDatas && identifiers === undefined) {
|
|
145
117
|
errorsFound.push(`Can not get resultDatas form Table${fromTable} and not have concatinateIdentifier to TranslateIds`)
|
|
146
118
|
}
|
|
147
119
|
}
|
|
148
120
|
|
|
149
|
-
/*
|
|
150
|
-
use from concatinateIdentifier to send in processOneRecord
|
|
151
|
-
concatinateIdentifier type string
|
|
152
|
-
check if in cache and if no save to TranslateIdsCacheFromIdDataTable, then move on to next resultData{fromDataId}
|
|
153
|
-
*/
|
|
154
|
-
|
|
155
121
|
async function processOneRecord(
|
|
156
122
|
_izContext,
|
|
157
123
|
translateIdsCacheId,
|
|
@@ -22,7 +22,7 @@ const fs = require('fs');
|
|
|
22
22
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
24
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
25
|
-
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, externalResourceName, defaultIamRolePerAction, DYNAMO_RESOURCE, SNS_RESOURCE, shortNameHandler } = require("../../../../libs/Consts");
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, externalResourceName, defaultIamRolePerAction, DYNAMO_RESOURCE, SNS_RESOURCE, shortNameHandler, SHORT_FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, './template.ejs');
|
|
28
28
|
|
|
@@ -77,7 +77,7 @@ function createTranslateIdFunctionYamlHdrDsq(srcPath) {
|
|
|
77
77
|
handlerType,
|
|
78
78
|
additionalResourcePermission,
|
|
79
79
|
resourceLocation: SOURCE_PATH.resourceLocationTranslateId,
|
|
80
|
-
functionNameConfig: upperCase(
|
|
80
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.translateId) + upperCase(shortNameHandler(handlerType))
|
|
81
81
|
},
|
|
82
82
|
setting: {
|
|
83
83
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -22,7 +22,7 @@ const fs = require('fs');
|
|
|
22
22
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
24
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
25
|
-
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, externalResourceName, defaultIamRolePerAction, SNS_RESOURCE, DYNAMO_RESOURCE, shortNameHandler } = require("../../../../libs/Consts");
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, externalResourceName, defaultIamRolePerAction, SNS_RESOURCE, DYNAMO_RESOURCE, shortNameHandler, SHORT_FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, './template.ejs');
|
|
28
28
|
|
|
@@ -77,7 +77,7 @@ function createTranslateIdFunctionYmlHdrSqs(srcPath) {
|
|
|
77
77
|
handlerType,
|
|
78
78
|
resourceLocation: SOURCE_PATH.resourceLocationTranslateId,
|
|
79
79
|
additionalResourcePermission,
|
|
80
|
-
functionNameConfig: upperCase(
|
|
80
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.translateId) + upperCase(shortNameHandler(handlerType))
|
|
81
81
|
},
|
|
82
82
|
setting: {
|
|
83
83
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -32,6 +32,7 @@ const lambda = require('@izara_project/izara-core-library-external-request/src/r
|
|
|
32
32
|
const serviceSchemas = require("@izara_project/izara-core-library-service-schemas");
|
|
33
33
|
const identifiersObject = require('@izara_project/izara-core-library-service-schemas/src/IdentifiersObject');
|
|
34
34
|
const getObjectSchema = require("@izara_project/izara-core-library-service-schemas/src/GetObjectSchema");
|
|
35
|
+
const TranslateIdsLibs = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/TranslateIdsLibs')
|
|
35
36
|
const sqs = externalRequest.sqs
|
|
36
37
|
|
|
37
38
|
|
|
@@ -46,7 +47,6 @@ const sqs = externalRequest.sqs
|
|
|
46
47
|
* @param {string} fromPartitionKeyFieldName - partition key field/attribute name
|
|
47
48
|
* @param {string} fromDataFieldName - data field/attribute name
|
|
48
49
|
* @param {object} toObjType - the type of object we are translating ids to
|
|
49
|
-
* @param {string} toTypeId - the type of object we are translating ids to
|
|
50
50
|
* @param {Object} [additionalData={}] - additional data to send back in completed message
|
|
51
51
|
* @param {Object} [startKey={}] - first invoke will be empty
|
|
52
52
|
* @param {Nummic} invocationCount
|
|
@@ -65,18 +65,10 @@ module.exports.translateIdsRequest = async (
|
|
|
65
65
|
fromPartitionKeyFieldName,
|
|
66
66
|
fromDataFieldName,
|
|
67
67
|
toObjType,
|
|
68
|
-
toTypeId,
|
|
69
68
|
relType,
|
|
70
|
-
// startKey ,
|
|
71
|
-
// invocationCount,
|
|
72
|
-
// passOnStatus,
|
|
73
|
-
// passOnErrorsFound,
|
|
74
69
|
callingFlow = "",
|
|
75
70
|
) => {
|
|
76
|
-
|
|
77
|
-
// MediaLinkProperty: filter dataId is propertyIds
|
|
78
|
-
// MediaLinkPropertyTranslation: filter dataId is propertyIds
|
|
79
|
-
// translate 2 time , propertyIds from MediaLinkProperty and propertyIds from MediaLinkPropertyTranslation
|
|
71
|
+
|
|
80
72
|
try {
|
|
81
73
|
_izContext.logger.debug("=== Function:TranslateIdsRequest ===", {
|
|
82
74
|
fromObjType: fromObjType,
|
|
@@ -93,12 +85,6 @@ module.exports.translateIdsRequest = async (
|
|
|
93
85
|
callingFlow: callingFlow
|
|
94
86
|
});
|
|
95
87
|
|
|
96
|
-
/*
|
|
97
|
-
receive params
|
|
98
|
-
check main cache for all param that send in
|
|
99
|
-
use concatinateIdentifier to check cache
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
88
|
//check cache per filterMain
|
|
103
89
|
let [translateIdsCacheMainStatus, translateIdsCacheId, translateIdsCacheMain] = await translateIdsSharedLib.translateIdsCheckCacheMain(
|
|
104
90
|
_izContext,
|
|
@@ -118,6 +104,11 @@ module.exports.translateIdsRequest = async (
|
|
|
118
104
|
translateIdsCacheMain: translateIdsCacheMain
|
|
119
105
|
});
|
|
120
106
|
|
|
107
|
+
let validateObjTypes = await TranslateIdsLibs.validateObjtypesAndRelType(_izContext, [fromObjType, toObjType], relType)
|
|
108
|
+
if (validateObjTypes == null) {
|
|
109
|
+
errorsFound = errorsFound.concat(`can't find ${fromObjType} and ${toObjType} in relationshipTag:${JSON.stringify(relType)}`)
|
|
110
|
+
}
|
|
111
|
+
|
|
121
112
|
if (translateIdsCacheMainStatus !== "process") {
|
|
122
113
|
return;
|
|
123
114
|
};
|
|
@@ -132,7 +123,6 @@ module.exports.translateIdsRequest = async (
|
|
|
132
123
|
fromPartitionKeyFieldName: fromPartitionKeyFieldName,
|
|
133
124
|
fromDataFieldName: fromDataFieldName,
|
|
134
125
|
toObjType: toObjType,
|
|
135
|
-
toTypeId: toTypeId,
|
|
136
126
|
relType: relType,
|
|
137
127
|
invocationCount: 1,
|
|
138
128
|
translateIdsCacheId: translateIdsCacheId,
|
|
@@ -26,7 +26,8 @@ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, rename
|
|
|
26
26
|
const {
|
|
27
27
|
DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SOURCE_PATH, externalResourceName, externalResourceSns, FUNCTION_NAME, getGraphServiceNameFromAllRelSchema, SAVE_FILE_NAME, getComplexFilterServiceTag,
|
|
28
28
|
LAMBDA_RESOURCE, SNS_RESOURCE, DYNAMO_RESOURCE, getGraphServiceNameFromObjectSchema,
|
|
29
|
-
shortNameHandler
|
|
29
|
+
shortNameHandler,
|
|
30
|
+
SHORT_FUNCTION_NAME } = require("../../libs/Consts");
|
|
30
31
|
// const templatePath = path.join(__dirname, "./template.ejs");
|
|
31
32
|
const templatePath = path.join(__dirname, "./template.ejs");
|
|
32
33
|
const { getAllLocalRelationshipSchemas } = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
|
|
@@ -192,7 +193,7 @@ async function externalLambdaIamRoleDataPerAction(_izContext, objectSchema, acti
|
|
|
192
193
|
|
|
193
194
|
// update Relationship
|
|
194
195
|
async function externalLambdaIamRoleDataUpdateRelationshipSchema(_izContext, allRelSchemas, handler) {
|
|
195
|
-
const functionName = upperCase(
|
|
196
|
+
const functionName = upperCase(SHORT_FUNCTION_NAME.updateRel) + upperCase(shortNameHandler(handler));
|
|
196
197
|
const additionalResourcePermission = [];
|
|
197
198
|
const graphServiceNamesFromAllRelSchemas = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas);
|
|
198
199
|
|
|
@@ -218,7 +219,7 @@ async function externalLambdaIamRoleDataUpdateRelationshipSchema(_izContext, all
|
|
|
218
219
|
// create relationship
|
|
219
220
|
|
|
220
221
|
async function externalLambdaIamRoleDataCreateRelationshipSchema(_izContext, allRelSchemas, handler) {
|
|
221
|
-
const functionName = upperCase(
|
|
222
|
+
const functionName = upperCase(SHORT_FUNCTION_NAME.createRel) + upperCase(shortNameHandler(handler));
|
|
222
223
|
const additionalResourcePermission = [];
|
|
223
224
|
const graphServiceNamesFromAllRelSchemas = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas);
|
|
224
225
|
|
|
@@ -262,7 +263,7 @@ async function externalLambdaIamRoleDataDeleteRelationshipSchema(_izContext, all
|
|
|
262
263
|
|
|
263
264
|
// Process TranslateIds Request
|
|
264
265
|
async function externalLambdaIamRoleDataTranslateId(_izContext, allRelSchemas, allObjSchemas) {
|
|
265
|
-
let functionName = upperCase(
|
|
266
|
+
let functionName = upperCase(SHORT_FUNCTION_NAME.translateIdsProcess) + upperCase(shortNameHandler(HANDLER.hdrDsq));
|
|
266
267
|
const additionalResourcePermission = [];
|
|
267
268
|
const graphServiceNamesFromAllRelSchemas = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas);
|
|
268
269
|
let complexFilterServiceTags = getComplexFilterServiceTag(allObjSchemas);
|
|
@@ -296,7 +297,7 @@ async function externalLambdaIamRoleDataTranslateId(_izContext, allRelSchemas, a
|
|
|
296
297
|
}
|
|
297
298
|
|
|
298
299
|
async function externalLambdaIamRoleDataFindData(_izContext, allObjSchemas) {
|
|
299
|
-
let functionName = upperCase(
|
|
300
|
+
let functionName = upperCase(SHORT_FUNCTION_NAME.findData) + upperCase(shortNameHandler(HANDLER.hdrSqs));
|
|
300
301
|
let additionalResourcePermission = [];
|
|
301
302
|
let graphServiceNames = []
|
|
302
303
|
for (const objectSchema of allObjSchemas) {
|
|
@@ -330,7 +331,7 @@ async function externalLambdaIamRoleDataFindData(_izContext, allObjSchemas) {
|
|
|
330
331
|
|
|
331
332
|
|
|
332
333
|
async function externalLambdaIamRoleDataProcessLogical(_izContext, allObjectSchemas) {
|
|
333
|
-
let functionName = upperCase(
|
|
334
|
+
let functionName = upperCase(SHORT_FUNCTION_NAME.processLogical) + upperCase(shortNameHandler(HANDLER.hdrSqs));
|
|
334
335
|
let additionalResourcePermission = [];
|
|
335
336
|
let graphServiceNames = await getGraphServiceNameFromObjectSchema(_izContext, allObjectSchemas)
|
|
336
337
|
// console.log("graphServiceNameFromProcessLogical::", graphServiceNames)
|
|
@@ -174,6 +174,25 @@ const SAVE_FILE_NAME = {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
const FUNCTION_NAME = {
|
|
177
|
+
updateRel: "updateRelationship",
|
|
178
|
+
createRel: "createRelationship",
|
|
179
|
+
updateRelComplete: "updateRelationshipComplete",
|
|
180
|
+
createRelComplete: "createRelationshipComplete",
|
|
181
|
+
deleteRel: "deleteRelationship",
|
|
182
|
+
deleteRelComplete: "deleteRelationshipComplete",
|
|
183
|
+
translateId: "translateIdsRequest",
|
|
184
|
+
translateIdsProcess: "processTranslateIds",
|
|
185
|
+
outTranslateIds: "processTranslateIdsComplete",
|
|
186
|
+
findData: "findData",
|
|
187
|
+
processLogical: "processLogical",
|
|
188
|
+
updateNodeComplete: "updateNodeComplete",
|
|
189
|
+
createObjectComplete: "createObjectComplete",
|
|
190
|
+
paginateProcessLogical: "paginateProcessLogical",
|
|
191
|
+
deleteNode: "deleteNode",
|
|
192
|
+
deleteNodeComplete: "deleteNodeComplete"
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const SHORT_FUNCTION_NAME = {
|
|
177
196
|
updateRel: "updateRel",
|
|
178
197
|
createRel: "createRel",
|
|
179
198
|
updateRelComplete: "updateRelComp",
|
|
@@ -308,5 +327,6 @@ module.exports = {
|
|
|
308
327
|
getComplexFilterServiceTag,
|
|
309
328
|
getGraphServiceNameFromObjectSchema,
|
|
310
329
|
awaitingMultipleStepsRole,
|
|
311
|
-
shortNameHandler
|
|
330
|
+
shortNameHandler,
|
|
331
|
+
SHORT_FUNCTION_NAME
|
|
312
332
|
}
|
package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU Affero General Public License as
|
|
6
|
-
published by the Free Software Foundation, either version 3 of the
|
|
7
|
-
License, or (at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU Affero General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
const path = require('path');
|
|
20
|
-
const fs = require('fs');
|
|
21
|
-
|
|
22
|
-
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
|
-
|
|
24
|
-
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
25
|
-
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE, DYNAMO_RESOURCE } = require("../../../../libs/Consts");
|
|
26
|
-
|
|
27
|
-
const templatePath = path.join(__dirname, "./template.ejs")
|
|
28
|
-
|
|
29
|
-
function defaultIamRolePerAction() {
|
|
30
|
-
|
|
31
|
-
let defaultIamRole = [];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
defaultIamRole.push(
|
|
35
|
-
createIamRole(
|
|
36
|
-
{
|
|
37
|
-
[RESOURCE_CLASSES.s3]: ["GetObject", "GetObjectVersion"],
|
|
38
|
-
},
|
|
39
|
-
[
|
|
40
|
-
resourceNames(RESOURCE_CLASSES.s3, "object-schema/perServiceSchemas/*"),
|
|
41
|
-
resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/ServiceNameConfig.json"),
|
|
42
|
-
resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/GraphServerTags.json"),
|
|
43
|
-
]
|
|
44
|
-
)
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
defaultIamRole.push(
|
|
48
|
-
createIamRole(
|
|
49
|
-
{ [RESOURCE_CLASSES.s3]: ["ListBucket"] },
|
|
50
|
-
[
|
|
51
|
-
resourceNames(RESOURCE_CLASSES.s3, "object-schema"),
|
|
52
|
-
]
|
|
53
|
-
)
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
return defaultIamRole
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* receive objectSchema
|
|
61
|
-
* create data for updateRelationshipSchema
|
|
62
|
-
*
|
|
63
|
-
* @param {Object} objectSchema
|
|
64
|
-
* @return {{ templatePath, templateData, setting } }
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
|
-
function data(_izContext, srcPath) {
|
|
68
|
-
let createSourceArray = [];
|
|
69
|
-
|
|
70
|
-
const createSourceParam = createParamForCreateSource(srcPath);
|
|
71
|
-
createSourceArray.push(createSourceParam);
|
|
72
|
-
// console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", createSourceArray)
|
|
73
|
-
return createSourceArray
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
function createParamForCreateSource(srcPath) {
|
|
78
|
-
|
|
79
|
-
let handlerType = HANDLER.hdrApi
|
|
80
|
-
let functionName = FUNCTION_NAME.createRel
|
|
81
|
-
let additionalResourcePermission = defaultIamRolePerAction();
|
|
82
|
-
|
|
83
|
-
additionalResourcePermission.push(
|
|
84
|
-
createIamRole(
|
|
85
|
-
{ [RESOURCE_CLASSES.dynamoDbTable]: [DYNAMO_RESOURCE.putItem] },
|
|
86
|
-
[
|
|
87
|
-
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleSteps"),
|
|
88
|
-
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleStepByPending")
|
|
89
|
-
]
|
|
90
|
-
))
|
|
91
|
-
|
|
92
|
-
additionalResourcePermission.push(
|
|
93
|
-
createIamRole(
|
|
94
|
-
{
|
|
95
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
96
|
-
},
|
|
97
|
-
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(FUNCTION_NAME.createRelComplete))
|
|
98
|
-
)
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
templatePath: templatePath,
|
|
103
|
-
templateData: {
|
|
104
|
-
functionName,
|
|
105
|
-
handlerType,
|
|
106
|
-
additionalResourcePermission,
|
|
107
|
-
resourceLocation: SOURCE_PATH.resourceLocationUpdateRelationshipSchema
|
|
108
|
-
},
|
|
109
|
-
setting: {
|
|
110
|
-
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
111
|
-
saveFileName: SAVE_FILE_NAME.functionRelationshipYaml,
|
|
112
|
-
fileExtension: '.yml',
|
|
113
|
-
isAppend: true
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
module.exports = data;
|