@izara_project/izara-market-library-service-schemas 1.0.58 → 1.0.60
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 +3 -3
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +5 -5
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +46 -32
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +17 -72
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +8 -33
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +2 -2
- package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +2 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/handler/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +18 -8
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/data.js +31 -7
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +5 -4
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/handler/template.ejs +20 -2
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/mainFunction/template.ejs +29 -18
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +9 -6
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +10 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-market-library-service-schemas",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.60",
|
|
4
4
|
"description": "Schemas for Izara Market project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"@izara_project/izara-core-library-core": "^1.0.20",
|
|
25
25
|
"@izara_project/izara-core-library-external-request": "^1.0.20",
|
|
26
26
|
"@izara_project/izara-core-library-logger": "^1.0.7",
|
|
27
|
-
"@izara_project/izara-core-library-service-schemas": "^1.0.
|
|
27
|
+
"@izara_project/izara-core-library-service-schemas": "^1.0.90",
|
|
28
28
|
"@izara_project/izara-core-library-sns": "^1.0.6",
|
|
29
29
|
"@izara_project/izara-core-library-sqs": "^1.0.4",
|
|
30
30
|
"@izara_project/izara-shared": "^1.0.126",
|
|
31
|
-
"@izara_project/izara-shared-service-schemas": "^1.0.
|
|
31
|
+
"@izara_project/izara-shared-service-schemas": "^1.0.29",
|
|
32
32
|
"@izara_project/izara-shared-core": "^1.0.2",
|
|
33
33
|
"ejs": "^3.1.10",
|
|
34
34
|
"js-beautify": "^1.15.4",
|
|
@@ -72,7 +72,7 @@ function validateSchemaMiddleware(
|
|
|
72
72
|
middleware,
|
|
73
73
|
// objectType,
|
|
74
74
|
action,
|
|
75
|
-
bucketName =
|
|
75
|
+
bucketName = process.env.iz_serviceSchemaBucketName
|
|
76
76
|
// setting = {}
|
|
77
77
|
) {
|
|
78
78
|
|
|
@@ -108,7 +108,7 @@ async function validateSchemaPerRecord(
|
|
|
108
108
|
lambdaFunctionName,
|
|
109
109
|
objType,
|
|
110
110
|
action,
|
|
111
|
-
setting = { bucketName:
|
|
111
|
+
setting = { bucketName: process.env.iz_serviceSchemaBucketName, specificFieldNames: [] }
|
|
112
112
|
) {
|
|
113
113
|
try {
|
|
114
114
|
record._izContext.logger.debug("validateSchemaPerRecord: ",
|
|
@@ -350,7 +350,7 @@ async function messageToDlq(record, messageFailError, queueUrl) {
|
|
|
350
350
|
* @param {Object} _izContext
|
|
351
351
|
* @param {Object} objectSchema
|
|
352
352
|
*/
|
|
353
|
-
async function createGetDataDetails(_izContext, objectSchema, settings = { bucketName:
|
|
353
|
+
async function createGetDataDetails(_izContext, objectSchema, settings = { bucketName: process.env.iz_serviceSchemaBucketName }) {
|
|
354
354
|
|
|
355
355
|
// group versionedData per storageTag
|
|
356
356
|
// or should group versionedData per graph serviceTag
|
|
@@ -546,7 +546,7 @@ async function createGetDataDetails(_izContext, objectSchema, settings = { bucke
|
|
|
546
546
|
* @param {Object} objectSchema
|
|
547
547
|
* @param {Object} reqIdentifiers - input identifier from calling function
|
|
548
548
|
*/
|
|
549
|
-
async function generateDynamoDbIdentifiers(_izContext, objectSchema, reqIdentifiers, bucketName =
|
|
549
|
+
async function generateDynamoDbIdentifiers(_izContext, objectSchema, reqIdentifiers, bucketName = process.env.iz_serviceSchemaBucketName) {
|
|
550
550
|
|
|
551
551
|
// start create identifiers for dynamo
|
|
552
552
|
let dynamoIdentifiers = {};
|
|
@@ -617,7 +617,7 @@ const generateDynamoDbIdentifiersWithCache = inMemoryCacheLib(
|
|
|
617
617
|
* @param {Object} dynamoStorageResource
|
|
618
618
|
* @param {Object} reqIdentifiers
|
|
619
619
|
*/
|
|
620
|
-
async function dynamoDbIdentifiersByStorageResource(_izContext, objectSchema, dynamoStorageResource, reqIdentifiers, bucketName =
|
|
620
|
+
async function dynamoDbIdentifiersByStorageResource(_izContext, objectSchema, dynamoStorageResource, reqIdentifiers, bucketName = process.env.iz_serviceSchemaBucketName) {
|
|
621
621
|
|
|
622
622
|
let dynamoIdentifiers = await generateDynamoDbIdentifiersWithCache(_izContext, objectSchema, reqIdentifiers, bucketName)
|
|
623
623
|
|
|
@@ -169,49 +169,62 @@ module.exports.createMain = async (
|
|
|
169
169
|
const identifier = objectSchemas.identifiers[0];
|
|
170
170
|
_izContext.logger.debug(":::::case single identifier:::::", identifier);
|
|
171
171
|
|
|
172
|
-
if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("randomOnCreate")) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
_izContext.logger.debug("Assign requestParams", requestParams)
|
|
172
|
+
if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("randomOnCreate") && (objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == true)) {
|
|
173
|
+
Object.assign(requestParams.fieldNames, {
|
|
174
|
+
[identifier.fieldName]: hash({
|
|
175
|
+
fieldNames: identifier, //
|
|
176
|
+
uniqueRequestId: _izContext.uniqueRequestId,
|
|
177
|
+
callingFlowConfig: callingFlowConfig
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
_izContext.logger.debug("Assign requestParams", requestParams)
|
|
182
181
|
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
} else if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("randomOnCreate") && objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == false ||
|
|
183
|
+
objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == null) {
|
|
185
184
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
if ((objectSchemas.fieldNames[identifier.fieldName].requiredOnCreate == true) &&
|
|
186
|
+
(objectSchemas.fieldNames[identifier.fieldName].canUpdate == false)) {
|
|
187
|
+
// check Fns have receive
|
|
189
188
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
if (requestParams.fieldNames.hasOwnProperty([identifier.fieldName])) {
|
|
190
|
+
_izContext.logger.debug("identifier is exist:", {
|
|
191
|
+
[identifier.fieldName]: requestParams.fieldNames[identifier.fieldName]
|
|
192
|
+
});
|
|
194
193
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
194
|
+
} else {
|
|
195
|
+
errorsFound.push("[invalid]requestParams not have data fieldNames of requiredOnCreate");
|
|
198
196
|
}
|
|
199
|
-
}
|
|
197
|
+
}
|
|
200
198
|
} else if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("hashOnCreate")) {
|
|
199
|
+
let hashFieldName = {}
|
|
201
200
|
if (objectSchemas.fieldNames[identifier.fieldName].hashOnCreate.length &&
|
|
202
201
|
objectSchemas.fieldNames[identifier.fieldName].hashOnCreate.length > 0) {
|
|
203
202
|
for (const fieldName of objectSchemas.fieldNames[identifier.fieldName].hashOnCreate) {
|
|
204
|
-
Object.assign(
|
|
205
|
-
requestParams.fieldNames
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
203
|
+
Object.assign(hashFieldName, {
|
|
204
|
+
[fieldName]: requestParams.fieldNames[fieldName]
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
Object.assign(
|
|
209
|
+
requestParams.fieldNames, {
|
|
210
|
+
[identifier.fieldName]: hash(hashFieldName)
|
|
211
211
|
}
|
|
212
|
+
)
|
|
213
|
+
|
|
212
214
|
} else {
|
|
213
215
|
errorsFound.push("[invalid] no data to hash for create")
|
|
214
216
|
}
|
|
217
|
+
} else if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("optionalOnCreate")) {
|
|
218
|
+
if ((objectSchemas.fieldNames[identifier.fieldName].optionalOnCreate == true)) {
|
|
219
|
+
Object.assign(
|
|
220
|
+
requestParams.fieldNames, {
|
|
221
|
+
[identifier.fieldName]: hash({
|
|
222
|
+
//(<createIdentifiersOptionalOnCreate>)
|
|
223
|
+
//(</createIdentifiersOptionalOnCreate>)
|
|
224
|
+
})
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
}
|
|
215
228
|
} else {
|
|
216
229
|
if ((objectSchemas.fieldNames[identifier.fieldName].requiredOnCreate === false) &&
|
|
217
230
|
(objectSchemas.fieldNames[identifier.fieldName].optionalOnCreate === false) &&
|
|
@@ -287,7 +300,7 @@ module.exports.createMain = async (
|
|
|
287
300
|
for (let [storageTag, createDataDetail] of Object.entries(createDataDetails)) {
|
|
288
301
|
//(<beforeCreate>)
|
|
289
302
|
//(</beforeCreate>)
|
|
290
|
-
if (createDataDetail.storageType == consts.STORAGE_TYPES.dynamoDB
|
|
303
|
+
if (createDataDetail.storageType == consts.STORAGE_TYPES.dynamoDB) {
|
|
291
304
|
//(<beforeCreateRecordDynamo>)
|
|
292
305
|
//(</beforeCreateRecordDynamo>)
|
|
293
306
|
_izContext.logger.debug("::::::DynamoDB::::::", { storageTag, objInstanceFull });
|
|
@@ -308,7 +321,8 @@ module.exports.createMain = async (
|
|
|
308
321
|
_izContext,
|
|
309
322
|
await dynamodbSharedLib.tableName(
|
|
310
323
|
_izContext,
|
|
311
|
-
createDataDetail.tableName
|
|
324
|
+
createDataDetail.tableName,
|
|
325
|
+
createDataDetail.serviceTag
|
|
312
326
|
),
|
|
313
327
|
{
|
|
314
328
|
...identifiersForCreateData,
|
|
@@ -154,88 +154,33 @@ module.exports.deleteMain = async (
|
|
|
154
154
|
await sns.publishAsync(_izContext, messageParams);
|
|
155
155
|
|
|
156
156
|
return deleteNodeCompleteMessage
|
|
157
|
-
}
|
|
157
|
+
} else {
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
_izContext.logger.debug("dynamoDb process")
|
|
163
|
-
|
|
164
|
-
let identifiersForDeleteData = await dynamoDbIdentifiersByStorageResource(
|
|
165
|
-
_izContext,
|
|
166
|
-
objectSchema,
|
|
167
|
-
deleteDataDetail,
|
|
168
|
-
requestParams.identifiers
|
|
169
|
-
)
|
|
170
|
-
|
|
171
|
-
_izContext.logger.debug("identifiersForDeleteData", identifiersForDeleteData)
|
|
172
|
-
|
|
173
|
-
// deleteItem in dynamo
|
|
174
|
-
await dynamodbSharedLib.deleteItem(_izContext,
|
|
175
|
-
await dynamodbSharedLib.tableName(_izContext, deleteDataDetail.tableName),
|
|
176
|
-
identifiersForDeleteData
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
} else if (deleteDataDetail.storageType === consts.STORAGE_TYPES.graph) {
|
|
180
|
-
_izContext.logger.debug("graph process")
|
|
181
|
-
|
|
182
|
-
let deleteNodeParams = {
|
|
183
|
-
objType: objType,
|
|
184
|
-
identifiers: requestParams.identifiers
|
|
185
|
-
}
|
|
186
|
-
deleteNodeParams = callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(
|
|
187
|
-
deleteNodeParams,
|
|
188
|
-
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
189
|
-
callingFlowConfig,
|
|
190
|
-
callingFlowSharedLib.createCallingFlowConfig(
|
|
191
|
-
//(<callingFlowProperties>)
|
|
192
|
-
await lambdaSharedLib.lambdaFunctionName(_izContext, TOPIC_NAME_GENERATE_CODE.deleteNodeComplete), {}
|
|
193
|
-
//(</callingFlowProperties>)
|
|
194
|
-
)
|
|
195
|
-
)
|
|
196
|
-
)
|
|
197
|
-
_izContext.logger.debug("messageObject before send message: ", deleteNodeParams);
|
|
198
|
-
|
|
199
|
-
let messageAttributes;
|
|
200
|
-
|
|
201
|
-
let deleteNodeMessageBody = {
|
|
202
|
-
Message: JSON.stringify(deleteNodeParams),
|
|
203
|
-
MessageAttributes: sns.createStringMessageAttributes(_izContext, messageAttributes),
|
|
204
|
-
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, TOPIC_NAME_GRAPH_HANDLER.inDeleteNode, storageTag)
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
_izContext.logger.debug("request message params before send to IndeleteNode::", deleteNodeMessageBody);
|
|
208
|
-
|
|
209
|
-
let resSns = await sns.publishAsync(_izContext, deleteNodeMessageBody)
|
|
210
|
-
_izContext.logger.debug('reSNS send to topic InDeleteNode finish', resSns)
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if (objectSchema.hasOwnProperty("extendObjType")) {
|
|
214
|
-
if (deleteDataDetail.storageType === consts.STORAGE_TYPES.dynamoDB && deleteDataDetail.serviceTag !== process.env.iz_serviceTag) {
|
|
159
|
+
for await (const [storageTag, deleteDataDetail] of Object.entries(deleteDataDetails)) {
|
|
160
|
+
if (deleteDataDetail.storageType === consts.STORAGE_TYPES.dynamoDB) {
|
|
161
|
+
_izContext.logger.debug("dynamoDb process")
|
|
215
162
|
|
|
216
163
|
let identifiersForDeleteData = await dynamoDbIdentifiersByStorageResource(
|
|
217
164
|
_izContext,
|
|
218
165
|
objectSchema,
|
|
219
166
|
deleteDataDetail,
|
|
220
167
|
requestParams.identifiers
|
|
221
|
-
|
|
222
|
-
_izContext.logger.debug("identifiersForDeleteData", identifiersForDeleteData);
|
|
168
|
+
)
|
|
223
169
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
deleteDataDetail.serviceTag
|
|
230
|
-
),
|
|
170
|
+
_izContext.logger.debug("identifiersForDeleteData", identifiersForDeleteData)
|
|
171
|
+
|
|
172
|
+
// deleteItem in dynamo
|
|
173
|
+
await dynamodbSharedLib.deleteItem(_izContext,
|
|
174
|
+
await dynamodbSharedLib.tableName(_izContext, deleteDataDetail.tableName, deleteDataDetail.serviceTag),
|
|
231
175
|
identifiersForDeleteData
|
|
232
|
-
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
}
|
|
233
179
|
}
|
|
234
|
-
}
|
|
235
|
-
};
|
|
180
|
+
};
|
|
236
181
|
|
|
237
182
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
183
|
+
} catch (err) {
|
|
184
|
+
throw (err)
|
|
185
|
+
}
|
|
241
186
|
}
|
|
@@ -101,9 +101,11 @@ module.exports.getMain = async (
|
|
|
101
101
|
callingFlowConfig
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
const
|
|
104
|
+
const errorsFound = [];
|
|
105
|
+
|
|
106
|
+
const returnSystemFieldsName = requestParams.additionalRequest?.setting?.returnSystemFieldsName ?? false;
|
|
107
|
+
const throwWhenNotFoundSomeRecord = requestParams.additionalRequest?.setting?.throwWhenNotFoundSomeRecord ?? true;
|
|
108
|
+
const returnVersionedData = requestParams.additionalRequest?.setting?.returnVersionedData ?? true
|
|
107
109
|
|
|
108
110
|
//(<beforeQuery>)
|
|
109
111
|
//(</beforeQuery>)
|
|
@@ -151,8 +153,8 @@ module.exports.getMain = async (
|
|
|
151
153
|
// get data from graph
|
|
152
154
|
let graphServiceName = await getGraphServiceTagWithCache(_izContext, getDataDetail.graphServiceTag);
|
|
153
155
|
|
|
154
|
-
|
|
155
|
-
if (
|
|
156
|
+
let versionedDataLabels = [];
|
|
157
|
+
if (returnVersionedData) {
|
|
156
158
|
if (getDataDetail.versionedDatas && Object.keys(getDataDetail.versionedDatas).length) {
|
|
157
159
|
// have versionedData
|
|
158
160
|
versionedDataLabels = Object.keys(getDataDetail.versionedDatas);
|
|
@@ -228,7 +230,7 @@ module.exports.getMain = async (
|
|
|
228
230
|
|
|
229
231
|
let dataFromDynamoDb = await dynamodbSharedLib.getItem(
|
|
230
232
|
_izContext,
|
|
231
|
-
await dynamodbSharedLib.tableName(_izContext, getDataDetail.tableName),
|
|
233
|
+
await dynamodbSharedLib.tableName(_izContext, getDataDetail.tableName, getDataDetail.serviceTag),
|
|
232
234
|
identifiersForGetData
|
|
233
235
|
);
|
|
234
236
|
|
|
@@ -254,33 +256,6 @@ module.exports.getMain = async (
|
|
|
254
256
|
getResults.push([dataFromDynamoDb, getDataDetail]);
|
|
255
257
|
|
|
256
258
|
}
|
|
257
|
-
|
|
258
|
-
if (objectSchema.hasOwnProperty("extendObjType")) {
|
|
259
|
-
if (getDataDetail.storageType === consts.STORAGE_TYPES.dynamoDB && getDataDetail.serviceTag !== process.env.iz_serviceTag) {
|
|
260
|
-
|
|
261
|
-
let identifiersForGetData = await dynamoDbIdentifiersByStorageResource(
|
|
262
|
-
_izContext,
|
|
263
|
-
objectSchema,
|
|
264
|
-
getDataDetail,
|
|
265
|
-
requestParams.identifiers
|
|
266
|
-
)
|
|
267
|
-
_izContext.logger.debug("identifiersForGetData", identifiersForGetData);
|
|
268
|
-
|
|
269
|
-
let getParent = await dynamodbSharedLib.getItem(
|
|
270
|
-
_izContext,
|
|
271
|
-
await dynamodbSharedLib.tableName(
|
|
272
|
-
_izContext,
|
|
273
|
-
getDataDetail.tableName,
|
|
274
|
-
getDataDetail.serviceTag
|
|
275
|
-
),
|
|
276
|
-
identifiersForGetData
|
|
277
|
-
);
|
|
278
|
-
|
|
279
|
-
getResults.push([getParent, getDataDetail]);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
259
|
})
|
|
285
260
|
);
|
|
286
261
|
|
|
@@ -308,7 +308,7 @@ module.exports.updateMain = async (
|
|
|
308
308
|
|
|
309
309
|
let updateItem = await dynamodbSharedLib.updateItem(
|
|
310
310
|
_izContext,
|
|
311
|
-
await dynamodbSharedLib.tableName(_izContext, updateDataDetail.tableName),
|
|
311
|
+
await dynamodbSharedLib.tableName(_izContext, updateDataDetail.tableName, updateDataDetail.serviceTag),
|
|
312
312
|
identifiersForUpdateData,
|
|
313
313
|
fieldForUpdateTableDynamo,
|
|
314
314
|
{
|
|
@@ -324,7 +324,7 @@ module.exports.updateMain = async (
|
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
if (callingFlowConfig[callingFlowSharedLib.consts.CALLINGFLOWPROPERTIES_PROPERTYNAME]) {
|
|
327
|
-
_izContext.logger.debug("HAVE
|
|
327
|
+
_izContext.logger.debug("HAVE CALLING FLOW");
|
|
328
328
|
|
|
329
329
|
messageObject = callingFlowSharedLib.addPassBackPropertiesToSnsResponseMessageObject(callingFlowConfig, messageObject);
|
|
330
330
|
let messageAttributes = callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(callingFlowConfig, {});
|
|
@@ -81,7 +81,7 @@ module.exports.confirmNewReserved = async (
|
|
|
81
81
|
|
|
82
82
|
let sendMessageToConfirmUsage = {
|
|
83
83
|
Message: JSON.stringify(confirmUsageMessage),
|
|
84
|
-
TopicArn: await snsSharedLib.
|
|
84
|
+
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, 'ConfirmUsage_In', consts.EXTERNAL_SERVICE_NAME.accountLimits)
|
|
85
85
|
};
|
|
86
86
|
_izContext.logger.debug("sendMessageToConfirmUsage", sendMessageToConfirmUsage);
|
|
87
87
|
await sns.publishAsync(_izContext, sendMessageToConfirmUsage);
|
|
@@ -114,7 +114,7 @@ module.exports.confirmNewReserved = async (
|
|
|
114
114
|
|
|
115
115
|
let sendMessageToUpdateEndpoint = {
|
|
116
116
|
Message: JSON.stringify(sendMessageToUpdateStatus),
|
|
117
|
-
TopicArn: await snsSharedLib.
|
|
117
|
+
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, "Update_In")
|
|
118
118
|
};
|
|
119
119
|
_izContext.logger.debug("sendMessageToUpdateEndpoint", sendMessageToUpdateEndpoint);
|
|
120
120
|
await sns.publishAsync(_izContext, sendMessageToUpdateEndpoint);
|
|
@@ -120,7 +120,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
120
120
|
functionNameConfig: functionName + upperCase(handlerType),
|
|
121
121
|
resourceLocation: path.join(SOURCE_PATH.resourceLocationWebSocket, flowSchema.flowTag, "source/"),
|
|
122
122
|
additionalResourcePermission,
|
|
123
|
-
functionNameConfig:
|
|
123
|
+
functionNameConfig: functionName + upperCase(shortNameHandler(handlerType)),
|
|
124
124
|
roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaUploadS3Role
|
|
125
125
|
},
|
|
126
126
|
setting: {
|
|
@@ -83,7 +83,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
83
83
|
// validate message (and MessageAttributes)
|
|
84
84
|
await recordHandlerSharedLib.validateRecord(
|
|
85
85
|
record, // one record will send to mainFunction
|
|
86
|
-
"
|
|
86
|
+
"CreatePresignUrlHdrSqs", // queue name that need to retry or send to dlq
|
|
87
87
|
perRecordsValidatorSchema, // schema for record.Message
|
|
88
88
|
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
89
89
|
);
|
|
@@ -101,7 +101,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
101
101
|
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
102
102
|
record, // one record will send to mainFunction
|
|
103
103
|
createPresignUrl.createPresignUrl, // mainFunction that need to invoke.
|
|
104
|
-
"
|
|
104
|
+
"CreatePresignUrlHdrSqs", // queue name that need to retry or send to dlq
|
|
105
105
|
passOnProperties, // all parameters that mainFunction needed.
|
|
106
106
|
);
|
|
107
107
|
record._izContext.logger.debug('after recordPromise in handler');
|
|
@@ -152,14 +152,22 @@ module.exports.createPresignUrl = async (
|
|
|
152
152
|
await sns.publishAsync(_izContext, sendMessageToCancelReserved);
|
|
153
153
|
|
|
154
154
|
await postToConnection({ message: "reserved has reach limit" }, connectionId)
|
|
155
|
+
|
|
156
|
+
//(<createIdentifiersForDeleteTask>)
|
|
157
|
+
let identifiers
|
|
158
|
+
//(</createIdentifiersForDeleteTask>)
|
|
155
159
|
// after post message delete websocket task
|
|
156
160
|
await dynamodbSharedLib.deleteItem(_izContext,
|
|
157
161
|
await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
|
|
158
162
|
{
|
|
159
|
-
taskKey:
|
|
163
|
+
taskKey: `${createFlowTypeConcat(_izContext, { flowTag: "<%- flowTag %>", serviceTag: process.env.iz_serviceTag })}${identifiers}`,
|
|
160
164
|
connectionId: connectionId
|
|
161
165
|
}
|
|
162
166
|
)
|
|
167
|
+
|
|
168
|
+
//(<afterCancelReservedLimit>)
|
|
169
|
+
//(</afterCancelReservedLimit>)
|
|
170
|
+
|
|
163
171
|
return "reserved not pass"
|
|
164
172
|
}
|
|
165
173
|
|
|
@@ -167,7 +175,7 @@ module.exports.createPresignUrl = async (
|
|
|
167
175
|
const Key = `${fileName}.${importType}`
|
|
168
176
|
//(</createKeyForUploadFile>)
|
|
169
177
|
|
|
170
|
-
const maximumSize = fileSize * 1048576 // convert to byte unit for restrict
|
|
178
|
+
const maximumSize = getResult.fields.fileSize * 1048576 // convert to byte unit for restrict
|
|
171
179
|
_izContext.logger.debug("maximumSize", maximumSize);
|
|
172
180
|
|
|
173
181
|
// create PresignUrl
|
|
@@ -207,7 +215,7 @@ module.exports.createPresignUrl = async (
|
|
|
207
215
|
},
|
|
208
216
|
fields: {
|
|
209
217
|
importBatchStatus: "waitingToUpload",
|
|
210
|
-
expiryTimestamp: (getResult.startTime + (createPresignUrlParam.expires * 1000))
|
|
218
|
+
expiryTimestamp: (getResult.fields.startTime + (createPresignUrlParam.expires * 1000))
|
|
211
219
|
}
|
|
212
220
|
},
|
|
213
221
|
objectType: objType.objectType
|
|
@@ -218,7 +226,7 @@ module.exports.createPresignUrl = async (
|
|
|
218
226
|
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
219
227
|
returnMessage, // resive parent callingFlowConfig.
|
|
220
228
|
callingFlowSharedLib.createCallingFlowConfig( // calling flow own service
|
|
221
|
-
await lambdaSharedLib.lambdaFunctionName(_izContext, `
|
|
229
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, `WebSocketComplete`), {}
|
|
222
230
|
)
|
|
223
231
|
)
|
|
224
232
|
);
|
|
@@ -232,11 +240,9 @@ module.exports.createPresignUrl = async (
|
|
|
232
240
|
_izContext.logger.debug("sendMessageToUpdateEndpoint", sendMessageToUpdateEndpoint);
|
|
233
241
|
await sns.publishAsync(_izContext, sendMessageToUpdateEndpoint);
|
|
234
242
|
|
|
235
|
-
|
|
236
|
-
//(<createIdentifiersFlow>)
|
|
243
|
+
//(<createIdentifierFlow>)
|
|
237
244
|
let identifiers
|
|
238
|
-
//(</
|
|
239
|
-
|
|
245
|
+
//(</createIdentifierFlow>)
|
|
240
246
|
await dynamodbSharedLib.updateItem(_izContext,
|
|
241
247
|
await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
|
|
242
248
|
{
|
|
@@ -248,6 +254,10 @@ module.exports.createPresignUrl = async (
|
|
|
248
254
|
}
|
|
249
255
|
)
|
|
250
256
|
}
|
|
257
|
+
|
|
258
|
+
//(<mainFunctionHookCode>)
|
|
259
|
+
//(</mainFunctionHookCode>)
|
|
260
|
+
|
|
251
261
|
} catch (err) {
|
|
252
262
|
_izContext.logger.error('error createPresignUrl: ', err)
|
|
253
263
|
throw (err)
|
|
@@ -37,12 +37,15 @@ const {
|
|
|
37
37
|
externalResourceSns,
|
|
38
38
|
externalResourceName,
|
|
39
39
|
SOURCE_GENERATE_IAM_ROLE,
|
|
40
|
-
FUNCTION_NAME
|
|
40
|
+
FUNCTION_NAME,
|
|
41
|
+
DYNAMO_RESOURCE
|
|
41
42
|
} = require('../../../../../../../../MainLibs/src/Consts');
|
|
42
43
|
|
|
43
44
|
const {
|
|
44
45
|
TOPIC_NAME_GENERATE_CODE
|
|
45
46
|
} = require('../../../../../../../../GenerateCodeLibs/src/Consts');
|
|
47
|
+
const { STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
48
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas').getObjectSchema
|
|
46
49
|
|
|
47
50
|
/**
|
|
48
51
|
* receive objectSchema
|
|
@@ -51,15 +54,15 @@ const {
|
|
|
51
54
|
* @return {{ templatePath, templateData, setting } }
|
|
52
55
|
*/
|
|
53
56
|
|
|
54
|
-
function data(_izContext, flowSchema, srcPath) {
|
|
55
|
-
return [createSourceParams(_izContext, flowSchema, srcPath)]
|
|
57
|
+
async function data(_izContext, flowSchema, srcPath) {
|
|
58
|
+
return [await createSourceParams(_izContext, flowSchema, srcPath)]
|
|
56
59
|
}
|
|
57
60
|
|
|
58
|
-
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
61
|
+
async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
59
62
|
let functionName = upperCase(FUNCTION_NAME.reservedLimit);
|
|
60
63
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
61
64
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
62
|
-
|
|
65
|
+
let tableNames = [];
|
|
63
66
|
additionalResourcePermission.push(
|
|
64
67
|
createIamRole(
|
|
65
68
|
{
|
|
@@ -72,16 +75,37 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
72
75
|
[RESOURCE_CLASSES.sns]: [
|
|
73
76
|
SNS_RESOURCE.publish,
|
|
74
77
|
SNS_RESOURCE.subscribe
|
|
75
|
-
]
|
|
78
|
+
],
|
|
76
79
|
},
|
|
77
80
|
[
|
|
78
81
|
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType),
|
|
79
82
|
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType + "DLQ"),
|
|
80
|
-
resourceNames(RESOURCE_CLASSES.sns, TOPIC_NAME_GENERATE_CODE.outCreateNodeComplete)
|
|
83
|
+
resourceNames(RESOURCE_CLASSES.sns, TOPIC_NAME_GENERATE_CODE.outCreateNodeComplete),
|
|
81
84
|
]
|
|
82
85
|
)
|
|
83
86
|
)
|
|
84
87
|
|
|
88
|
+
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
89
|
+
|
|
90
|
+
let objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(_izContext, flowSchema.objType)
|
|
91
|
+
|
|
92
|
+
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
93
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
94
|
+
tableNames.push(storageResource.tableName)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
additionalResourcePermission.push(
|
|
99
|
+
createIamRole(
|
|
100
|
+
{
|
|
101
|
+
[RESOURCE_CLASSES.dynamoDbTable]: Object.values(DYNAMO_RESOURCE)
|
|
102
|
+
},
|
|
103
|
+
tableNames.map(tableName =>
|
|
104
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName)
|
|
105
|
+
)
|
|
106
|
+
)
|
|
107
|
+
)
|
|
108
|
+
|
|
85
109
|
return {
|
|
86
110
|
templatePath: templatePath,
|
|
87
111
|
templateData: {
|
|
@@ -28,6 +28,8 @@ const consts = require('@izara_project/izara-market-library-service-schemas/src/
|
|
|
28
28
|
const coreConsts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
29
29
|
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
30
30
|
const importDataLibs = require('../../../../libs/source/GenerateCodeLibs');
|
|
31
|
+
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
32
|
+
|
|
31
33
|
/**
|
|
32
34
|
* description of function.
|
|
33
35
|
* @param {Object} _izContext
|
|
@@ -66,8 +68,6 @@ module.exports.reservedLimit = async (
|
|
|
66
68
|
|
|
67
69
|
// get static
|
|
68
70
|
let payloadBeforeInvokeStaticLimit = {
|
|
69
|
-
userId: _izContext.correlationIds.get(coreConsts.BASE_USER_ID),
|
|
70
|
-
targetId: _izContext.correlationIds.get(coreConsts.TARGET_ID),
|
|
71
71
|
//(<additionalPropertiesStaticLimit>)
|
|
72
72
|
//(</additionalPropertiesStaticLimit>)
|
|
73
73
|
}
|
|
@@ -81,13 +81,14 @@ module.exports.reservedLimit = async (
|
|
|
81
81
|
|
|
82
82
|
if (res.passStatus === false) {
|
|
83
83
|
importDataLibs.postToConnection({ message: "static limit over" }, connectionId)
|
|
84
|
+
//(<afterFailReservedStaticLimit>)
|
|
85
|
+
return
|
|
86
|
+
//(</afterFailReservedStaticLimit>)
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
// reservedDynamic
|
|
87
90
|
|
|
88
91
|
let sendMsgReservedDynamic = {
|
|
89
|
-
userId: _izContext.correlationIds.get(coreConsts.BASE_USER_ID),
|
|
90
|
-
targetId: _izContext.correlationIds.get(coreConsts.TARGET_ID),
|
|
91
92
|
//(<additionalPropertiesReservedDynamic>)
|
|
92
93
|
//(</additionalPropertiesReservedDynamic>)
|
|
93
94
|
}
|
|
@@ -24,15 +24,29 @@ const izara = require("@izara_project/izara-middleware");
|
|
|
24
24
|
const middleware = izara.middlewareHandler;
|
|
25
25
|
const recordHandlerSharedLib = require("@izara_project/izara-core-library-record-handler")
|
|
26
26
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
27
|
-
|
|
27
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
28
28
|
const <%- functionName %> = require('./<%- functionName %>_Main')
|
|
29
29
|
|
|
30
|
+
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema(
|
|
31
|
+
{
|
|
32
|
+
type: "object",
|
|
33
|
+
required: ['body', 'messageAttributes'],
|
|
34
|
+
properties: {
|
|
35
|
+
body: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
},
|
|
38
|
+
messageAttributes: {
|
|
39
|
+
type: 'object'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
));
|
|
44
|
+
|
|
30
45
|
// validate event properties in body.Message of sqs event
|
|
31
46
|
let perRecordsValidatorSchema = {
|
|
32
47
|
//(<validatorSchema>)
|
|
33
48
|
//(</validatorSchema>)
|
|
34
49
|
}
|
|
35
|
-
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
36
50
|
|
|
37
51
|
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
38
52
|
|
|
@@ -43,6 +57,9 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
43
57
|
// loop each record and send to mainFunction
|
|
44
58
|
await Promise.all(event.Records.map(async record => { // promise.all for map() function
|
|
45
59
|
|
|
60
|
+
record = recordHandlerSharedLib.reformatDsqMessage(record._izContext, record);
|
|
61
|
+
record._izContext.logger.debug('record LambdaFunctionHdrDsq after reform', record);
|
|
62
|
+
|
|
46
63
|
let passOnProperties = []
|
|
47
64
|
record._izContext.logger.debug('record ReceiveMsgOutHdrSqs', record);
|
|
48
65
|
|
|
@@ -58,6 +75,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
58
75
|
passOnProperties.push(record.body.Message)
|
|
59
76
|
//(<additionalParams>)
|
|
60
77
|
//(</additionalParams>)
|
|
78
|
+
passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
|
|
61
79
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
62
80
|
|
|
63
81
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
@@ -203,7 +203,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
203
203
|
|
|
204
204
|
// const webSocketCreateObjectStordCache = createWebSocketCreateObjectStoredCache(_izContext, saveFilePath);
|
|
205
205
|
|
|
206
|
-
const reservedLimitFunctionYaml = createReservedLimitFunctionYaml(_izContext, flowSchema, saveFilePath);
|
|
206
|
+
const reservedLimitFunctionYaml = await createReservedLimitFunctionYaml(_izContext, flowSchema, saveFilePath);
|
|
207
207
|
const reservedLimitHandlerFunction = createReservedLimitHandler(_izContext, flowSchema, saveFilePath);
|
|
208
208
|
const reservedLimitMainFunction = await createReservedLimitMainFunction(_izContext, flowSchema, saveFilePath);
|
|
209
209
|
const reservedLimitQueueName = createReservedLimitQueueName(_izContext, saveFilePath);
|
|
@@ -24,7 +24,7 @@ const izara = require("@izara_project/izara-middleware");
|
|
|
24
24
|
const middleware = izara.middlewareHandler;
|
|
25
25
|
const recordHandlerSharedLib = require("@izara_project/izara-core-library-record-handler")
|
|
26
26
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
27
|
-
|
|
27
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
28
28
|
const <%- functionName %> = require('./<%- functionName %>_Main')
|
|
29
29
|
|
|
30
30
|
// validate event properties in body.Message of sqs event
|
|
@@ -37,6 +37,8 @@ const { v4: uuidv4 } = require('uuid')
|
|
|
37
37
|
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
38
38
|
const consts = require("@izara_project/izara-middleware").consts
|
|
39
39
|
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
40
|
+
const { createFlowTypeConcat } = require("@izara_project/izara-core-library-service-schemas").utils
|
|
41
|
+
|
|
40
42
|
//(<optionalRequire>)
|
|
41
43
|
//(</optionalRequire>)
|
|
42
44
|
/**
|
|
@@ -73,25 +75,34 @@ module.exports.<%- functionName %> = async (
|
|
|
73
75
|
throw new NoRetryError('not have TopicArn for get FlowSchemas')
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
let topicName = topicArn.
|
|
78
|
+
let topicName = topicArn.split(":")[5].split("_")
|
|
79
|
+
let flowTag = topicName[2]
|
|
77
80
|
|
|
78
81
|
let flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
79
|
-
flowTag:
|
|
82
|
+
flowTag: flowTag,
|
|
80
83
|
serviceTag: topicName[0]
|
|
81
84
|
})
|
|
82
85
|
|
|
86
|
+
if (!flowSchema) {
|
|
87
|
+
if (requestParams.hasOwnProperty("flowTag")) {
|
|
88
|
+
flowTag = requestParams.flowTag;
|
|
89
|
+
flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
90
|
+
flowTag: flowTag,
|
|
91
|
+
serviceTag: process.env.iz_serviceTag
|
|
92
|
+
})
|
|
93
|
+
} else {
|
|
94
|
+
throw new NoRetryError("Could not find flowSchema from topicArn or requestParams.flowTag")
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
83
98
|
//(<createIdentifiersFlow>)
|
|
84
99
|
let identifiers
|
|
85
100
|
//(</createIdentifiersFlow>)
|
|
86
101
|
|
|
87
|
-
if (!flowSchema) {
|
|
88
|
-
throw new NoRetryError("not have flowSchema in S3")
|
|
89
|
-
}
|
|
90
|
-
|
|
91
102
|
let wbsTasks;
|
|
92
103
|
let taskKey;
|
|
93
104
|
if (flowSchema.statusType === "statusField" || flowSchema.statusType === "storedCache" || flowSchema.statusType === "triggerCache") {
|
|
94
|
-
taskKey = `${createFlowTypeConcat(_izContext,{flowTag:
|
|
105
|
+
taskKey = `${createFlowTypeConcat(_izContext,{flowTag: flowTag, serviceTag: topicName[0]})}${identifiers}`
|
|
95
106
|
wbsTasks = await dynamodbSharedLib.query(
|
|
96
107
|
_izContext,
|
|
97
108
|
await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
|
|
@@ -100,7 +111,7 @@ module.exports.<%- functionName %> = async (
|
|
|
100
111
|
}
|
|
101
112
|
)
|
|
102
113
|
} else if (flowSchema.statusType === "none") {
|
|
103
|
-
taskKey = `${createFlowTypeConcat(_izContext,{flowTag:
|
|
114
|
+
taskKey = `${createFlowTypeConcat(_izContext,{flowTag: flowTag, serviceTag: topicName[0]})}${correlationId}`
|
|
104
115
|
wbsTasks = await dynamodbSharedLib.query(
|
|
105
116
|
_izContext,
|
|
106
117
|
await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
|
|
@@ -108,22 +119,22 @@ module.exports.<%- functionName %> = async (
|
|
|
108
119
|
taskKey: taskKey
|
|
109
120
|
}
|
|
110
121
|
)
|
|
111
|
-
|
|
122
|
+
}
|
|
112
123
|
|
|
113
124
|
if (wbsTasks.Items.length) {
|
|
114
|
-
await Promise.all(wbsTasks.Items.map(async (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
)
|
|
125
|
+
await Promise.all(wbsTasks.Items.map(async (wbsTask) => {
|
|
126
|
+
let postMessage = { message: requestParams }
|
|
127
|
+
|
|
128
|
+
//(<beforePostMessage>)
|
|
129
|
+
//(</beforePostMessage>)
|
|
130
|
+
|
|
131
|
+
await postToConnection(postMessage, wbsTask.connectionId)
|
|
121
132
|
|
|
122
133
|
await dynamodbSharedLib.deleteItem(_izContext,
|
|
123
134
|
await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
|
|
124
135
|
{
|
|
125
|
-
taskKey: taskKey,
|
|
126
|
-
connectionId: connectionId
|
|
136
|
+
taskKey: wbsTask.taskKey,
|
|
137
|
+
connectionId: wbsTask.connectionId
|
|
127
138
|
}
|
|
128
139
|
)
|
|
129
140
|
}))
|
|
@@ -55,7 +55,7 @@ module.exports.updateNodeComplete = async (
|
|
|
55
55
|
let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
|
|
56
56
|
hash({
|
|
57
57
|
objectType: returnValue.requestParams.objType.objectType,
|
|
58
|
-
serviceTag: returnValue.requestParams.objType.
|
|
58
|
+
serviceTag: returnValue.requestParams.objType.serviceTag,
|
|
59
59
|
identifiers: returnValue.requestParams.objInstanceFull.identifiers,
|
|
60
60
|
fields: returnValue.requestParams.objInstanceFull.fields
|
|
61
61
|
}),
|
|
@@ -83,17 +83,20 @@ module.exports.updateNodeComplete = async (
|
|
|
83
83
|
|
|
84
84
|
let updateCompleteMsg = {
|
|
85
85
|
objType: {
|
|
86
|
-
objectType: returnValue.
|
|
87
|
-
serviceTag: returnValue.
|
|
86
|
+
objectType: returnValue.requestParams.objType.objectType,
|
|
87
|
+
serviceTag: returnValue.requestParams.objType.serviceTag
|
|
88
88
|
},
|
|
89
89
|
objInstanceFull: {
|
|
90
|
-
identifiers: returnValue.
|
|
91
|
-
fields: returnValue.
|
|
90
|
+
identifiers: returnValue.requestParams.objInstanceFull.identifiers,
|
|
91
|
+
fields: returnValue.requestParams.objInstanceFull.fields
|
|
92
92
|
},
|
|
93
93
|
status: status,
|
|
94
|
-
errorsFound: errorsFound
|
|
94
|
+
errorsFound: errorsFound,
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
+
//(<additionalProperties>)
|
|
98
|
+
//(</additionalProperties>)
|
|
99
|
+
|
|
97
100
|
updateCompleteMsg = callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(passBackProperties, updateCompleteMsg);
|
|
98
101
|
_izContext.logger.debug("after addCallingFlow to SnsResponseMessageObject", updateCompleteMsg);
|
|
99
102
|
|
|
@@ -36,6 +36,8 @@ const { NoRetryError } = require("@izara_project/izara-core-library-core");
|
|
|
36
36
|
|
|
37
37
|
async function filterCreateResourceYaml(_izContext, createSourceParams, objSchemaPath) {
|
|
38
38
|
let tableNamesToFilter = new Set();
|
|
39
|
+
let ownServiceTag = getLocalConfig(path.join(objSchemaPath, "../../"), "iz_serviceTag")
|
|
40
|
+
|
|
39
41
|
const allLocalFlowSchema = await getObjectSchema.getAllLocalFlowSchemas(_izContext, objSchemaPath);
|
|
40
42
|
await Promise.all(allLocalFlowSchema.records.map(async (flowSchema) => {
|
|
41
43
|
if (flowSchema.statusType === "storedCache") {
|
|
@@ -48,9 +50,16 @@ async function filterCreateResourceYaml(_izContext, createSourceParams, objSchem
|
|
|
48
50
|
const allLocalObjSchema = await getObjectSchema.getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
|
|
49
51
|
await Promise.all(allLocalObjSchema.records.map(async (objSchema) => {
|
|
50
52
|
if (objSchema.hasOwnProperty("extendObjType")) {
|
|
51
|
-
|
|
53
|
+
for (const storageResource of Object.values(objSchema.storageResources)) {
|
|
54
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
55
|
+
if (storageResource?.serviceTag !== ownServiceTag) {
|
|
56
|
+
tableNamesToFilter.add(storageResource.tableName)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
52
60
|
}
|
|
53
61
|
}))
|
|
62
|
+
|
|
54
63
|
let filteredCreateSourceParams = createSourceParams.filter(
|
|
55
64
|
(result) => !tableNamesToFilter.has(result.templateData.tableName)
|
|
56
65
|
)
|
|
@@ -75,17 +84,3 @@ async function getStoredCacheTableFromFlowSchema(_izContext, flowSchema, objSche
|
|
|
75
84
|
}
|
|
76
85
|
return tableNameStoredCache;
|
|
77
86
|
}
|
|
78
|
-
|
|
79
|
-
async function getParentTableFromObjSchema(_izContext, objSchema, objSchemaPath) {
|
|
80
|
-
let parentTableNames = new Set();
|
|
81
|
-
let ownServiceTag = getLocalConfig(path.join(objSchemaPath, "../../"), "iz_serviceTag")
|
|
82
|
-
for (const storageResource of Object.values(objSchema.storageResources)) {
|
|
83
|
-
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
84
|
-
if (storageResource.serviceTag && storageResource.serviceTag !== ownServiceTag) {
|
|
85
|
-
parentTableNames.add(storageResource.tableName)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return parentTableNames
|
|
91
|
-
}
|