@izara_project/izara-market-library-service-schemas 1.0.57 → 1.0.59
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/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +23 -9
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +17 -72
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +8 -32
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +3 -21
- package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +2 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +2 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/functionYaml/data.js +2 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/data.js +0 -14
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +13 -8
- 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 +12 -10
- 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 +10 -9
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrS3/template.ejs +0 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/S3/data.js +4 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/S3/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +2 -45
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/sns-out/data.js +75 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +16 -16
- package/src/reStructure/TemplateData/flowSchema/components/websocket/dynamoDb/ttlDynamoTemplate.ejs +32 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/dynamoDb/userUploadRecords.js +58 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/handler/template.ejs +20 -2
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +24 -16
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/mainFunction/template.ejs +33 -21
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +4 -1
- package/src/reStructure/TemplateData/processLogical/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +1 -1
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +10 -15
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrDsq/data.js +0 -87
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrDsq/template.ejs +0 -30
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerDsq/data.js +0 -45
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerDsq/template.ejs +0 -151
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/request.json +0 -7
|
@@ -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
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2021 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
|
-
|
|
20
|
-
const path = require("path")
|
|
21
|
-
|
|
22
|
-
const { firstLetterUpperCase: upperCase } = require('../../../../../../../MainLibs/src/Utils');
|
|
23
|
-
const { SOURCE_PATH, SAVE_FILE_NAME, defaultIamRolePerAction, createIamRole, RESOURCE_CLASSES, S3_RESOURCE, resourceNames, DYNAMO_RESOURCE, SQS_RESOURCE, SNS_RESOURCE, shortNameHandler, HANDLER, FUNCTION_NAME } = require("../../../../../libs/Consts");
|
|
24
|
-
const templatePath = path.join(__dirname, "./template.ejs")
|
|
25
|
-
|
|
26
|
-
function data(_izContext, srcPath) {
|
|
27
|
-
return [createSourceParam(_izContext, srcPath)]
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function createSourceParam(_izContext, srcPath) {
|
|
31
|
-
let functionName = upperCase(FUNCTION_NAME.processAfterUploadS3);
|
|
32
|
-
let handlerType = HANDLER.hdrDsq;
|
|
33
|
-
let additionalResourcePermission = defaultIamRolePerAction();
|
|
34
|
-
additionalResourcePermission.push(
|
|
35
|
-
|
|
36
|
-
createIamRole(
|
|
37
|
-
{
|
|
38
|
-
[RESOURCE_CLASSES.dynamoDbTable]: [
|
|
39
|
-
DYNAMO_RESOURCE.updateItem,
|
|
40
|
-
DYNAMO_RESOURCE.getItem
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
[
|
|
44
|
-
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "ImportBatchMain")
|
|
45
|
-
]
|
|
46
|
-
),
|
|
47
|
-
createIamRole(
|
|
48
|
-
{
|
|
49
|
-
[RESOURCE_CLASSES.sqs]: [
|
|
50
|
-
SQS_RESOURCE.sendMessage,
|
|
51
|
-
SQS_RESOURCE.receiveMessage,
|
|
52
|
-
SQS_RESOURCE.deleteMessage,
|
|
53
|
-
SQS_RESOURCE.getQueueAttributes
|
|
54
|
-
]
|
|
55
|
-
},
|
|
56
|
-
[
|
|
57
|
-
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType),
|
|
58
|
-
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType + "DLQ")
|
|
59
|
-
]
|
|
60
|
-
),
|
|
61
|
-
createIamRole(
|
|
62
|
-
{
|
|
63
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
64
|
-
},
|
|
65
|
-
[
|
|
66
|
-
resourceNames(RESOURCE_CLASSES.sns, "In" + functionName)
|
|
67
|
-
]
|
|
68
|
-
)
|
|
69
|
-
)
|
|
70
|
-
return {
|
|
71
|
-
templatePath: templatePath,
|
|
72
|
-
templateData: {
|
|
73
|
-
functionName,
|
|
74
|
-
handlerType,
|
|
75
|
-
additionalResourcePermission,
|
|
76
|
-
resourceLocation: SOURCE_PATH.resourceLocationWebSocket,
|
|
77
|
-
},
|
|
78
|
-
setting: {
|
|
79
|
-
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
80
|
-
saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
|
|
81
|
-
isAppend: true,
|
|
82
|
-
fileExtension: ".yml"
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
module.exports = data
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<%_ const join = require('path').join; _%>
|
|
2
|
-
<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>:
|
|
3
|
-
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
-
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
-
events:
|
|
6
|
-
- sqs:
|
|
7
|
-
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- functionName %>
|
|
8
|
-
batchSize: 10
|
|
9
|
-
iamRoleStatements:
|
|
10
|
-
<%_ additionalResourcePermission.forEach(resourcePermission => { _%>
|
|
11
|
-
- Effect: <%- resourcePermission.effect %>
|
|
12
|
-
Action:
|
|
13
|
-
<%_ Object.keys(resourcePermission.action).forEach(resourcePerAction => { _%>
|
|
14
|
-
<%_ resourcePermission.action[resourcePerAction].forEach(permission => { _%>
|
|
15
|
-
- <%- resourcePerAction %>:<%- permission %>
|
|
16
|
-
<%_}) _%>
|
|
17
|
-
<%_ }) _%>
|
|
18
|
-
Resource:
|
|
19
|
-
<%_ resourcePermission.resource.forEach(resource => { _%>
|
|
20
|
-
- <%- resource %>
|
|
21
|
-
<%_ }) _%>
|
|
22
|
-
<%_}) _%>
|
|
23
|
-
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
24
|
-
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
25
|
-
<%_ function firstLetterUpperCase(text){
|
|
26
|
-
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
27
|
-
} _%>
|
|
28
|
-
<%_ function firstLetterLowerCase(str) {
|
|
29
|
-
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
30
|
-
} _%>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2021 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
|
-
|
|
20
|
-
const path = require("path")
|
|
21
|
-
|
|
22
|
-
const { firstLetterUpperCase: upperCase } = require('../../../../../../../MainLibs/src/Utils');
|
|
23
|
-
const { SOURCE_PATH, SAVE_FILE_NAME, defaultIamRolePerAction, createIamRole, RESOURCE_CLASSES, S3_RESOURCE, resourceNames, DYNAMO_RESOURCE, SQS_RESOURCE, SNS_RESOURCE, shortNameHandler, HANDLER, FUNCTION_NAME } = require("../../../../../libs/Consts");
|
|
24
|
-
const templatePath = path.join(__dirname, "./template.ejs")
|
|
25
|
-
|
|
26
|
-
function data(_izContext, srcPath) {
|
|
27
|
-
return [createSourceData(_izContext, srcPath)]
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function createSourceData(_izContext, srcPath) {
|
|
31
|
-
let functionName = FUNCTION_NAME.processAfterUploadS3;
|
|
32
|
-
let handlerType = HANDLER.hdrDsq;
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
templatePath: templatePath,
|
|
36
|
-
templateData: {},
|
|
37
|
-
setting: {
|
|
38
|
-
saveFileName: `${upperCase(functionName)}_${upperCase(handlerType)}`,
|
|
39
|
-
savePath: path.join(srcPath, SOURCE_PATH.webSocket),
|
|
40
|
-
fileExtension: ".js",
|
|
41
|
-
isAppend: false
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
module.exports = data;
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2021 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
|
-
|
|
20
|
-
// const AWS = require('aws-sdk');
|
|
21
|
-
// const sqs = new AWS.SQS({ apiVersion: '2012-11-05' });
|
|
22
|
-
|
|
23
|
-
const izara = require("@izara_project/izara-middleware");
|
|
24
|
-
const middleware = izara.middlewareHandler;
|
|
25
|
-
const recordHandlerSharedLib = require("@izara_project/izara-shared").recordHandlerSharedLib;
|
|
26
|
-
const Logger = require('@izara_project/izara-core-library-logger');
|
|
27
|
-
const izaraShared = require('@izara_project/izara-shared');
|
|
28
|
-
const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
|
|
29
|
-
|
|
30
|
-
const processAfterUpload = require('./ProcessAfterUploadS3_Main')
|
|
31
|
-
|
|
32
|
-
// validate event properties in body.Message of sqs event
|
|
33
|
-
middleware.setValidatorSchema(
|
|
34
|
-
recordHandlerSharedLib.baseValidatorSchema({
|
|
35
|
-
type: 'object',
|
|
36
|
-
required: ['body', 'messageAttributes'],
|
|
37
|
-
properties: {
|
|
38
|
-
body: {
|
|
39
|
-
type: 'object',
|
|
40
|
-
},
|
|
41
|
-
messageAttributes: {
|
|
42
|
-
type: 'object',
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
})
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
// set schema for record.body.Message
|
|
49
|
-
let perRecordsValidatorSchema = {
|
|
50
|
-
type: "object",
|
|
51
|
-
required: [
|
|
52
|
-
'bucket',
|
|
53
|
-
'field',
|
|
54
|
-
'importBy'
|
|
55
|
-
],
|
|
56
|
-
properties: {
|
|
57
|
-
bucket: {
|
|
58
|
-
type: "string"
|
|
59
|
-
},
|
|
60
|
-
field: {
|
|
61
|
-
type: "object"
|
|
62
|
-
},
|
|
63
|
-
importBy: {
|
|
64
|
-
type: "string"
|
|
65
|
-
},
|
|
66
|
-
imageImportId: {
|
|
67
|
-
type: "string"
|
|
68
|
-
},
|
|
69
|
-
realImageSize: {
|
|
70
|
-
type: "number",
|
|
71
|
-
default: 0
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// set schema for record.body.MessageAttributes
|
|
77
|
-
// const messageAttributeValidatorSchema = {
|
|
78
|
-
// type: "object",
|
|
79
|
-
// required: ['msgAtrrParam1', 'msgAtrrParam2'],
|
|
80
|
-
// properties: {
|
|
81
|
-
// msgAtrrParam1: {
|
|
82
|
-
// type: "string"
|
|
83
|
-
// },
|
|
84
|
-
// msgAtrrParam2: {
|
|
85
|
-
// type: "object"
|
|
86
|
-
// }
|
|
87
|
-
// }
|
|
88
|
-
// };
|
|
89
|
-
|
|
90
|
-
perRecordsValidatorSchema = callingFlowSharedLib.addOptionalPassBackPropertiesToValidatorSchema(perRecordsValidatorSchema)
|
|
91
|
-
|
|
92
|
-
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
93
|
-
|
|
94
|
-
try {
|
|
95
|
-
|
|
96
|
-
let recordPromises = []; // final return
|
|
97
|
-
|
|
98
|
-
// loop each record and send to mainFunction
|
|
99
|
-
await Promise.all(event.Records.map(async record => { // promise.all for map() function
|
|
100
|
-
|
|
101
|
-
// --- reforming record.body for Dsq request
|
|
102
|
-
record = recordHandlerSharedLib.reformatDsqMessage(record._izContext, record);
|
|
103
|
-
record._izContext.logger.debug('record GetSignedUrlS3HdrDsq after reform', record);
|
|
104
|
-
|
|
105
|
-
let passOnProperties = []
|
|
106
|
-
|
|
107
|
-
// validate message (and MessageAttributes)
|
|
108
|
-
await recordHandlerSharedLib.validateRecord(
|
|
109
|
-
record, // one record will send to mainFunction
|
|
110
|
-
"ProcessAfterUploadHdrDsq", // queue name that need to retry or send to dlq
|
|
111
|
-
perRecordsValidatorSchema, // schema for record.Message
|
|
112
|
-
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
// add argument (to invoke lambda) to passOnProperties[]
|
|
116
|
-
passOnProperties.push(record.body.Message.bucket),
|
|
117
|
-
passOnProperties.push(record.body.Message.field),
|
|
118
|
-
passOnProperties.push(record.body.Message.importBy),
|
|
119
|
-
passOnProperties.push(record.body.Message.imageImportId),
|
|
120
|
-
passOnProperties.push(record.body.Message.realImageSize),
|
|
121
|
-
passOnProperties.push(record.body.Message.passBackProperties),
|
|
122
|
-
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
123
|
-
|
|
124
|
-
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
125
|
-
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
126
|
-
record, // one record will send to mainFunction
|
|
127
|
-
processAfterUpload.processAfterUpload, // mainFunction that need to invoke.
|
|
128
|
-
"ProcessAfterUploadHdrDsq", // queue name that need to retry or send to dlq
|
|
129
|
-
passOnProperties, // all parameters that mainFunction needed.
|
|
130
|
-
);
|
|
131
|
-
record._izContext.logger.debug('after recordPromise in handler');
|
|
132
|
-
recordPromises.push(recordPromise); // push promise to recordPromises
|
|
133
|
-
}))
|
|
134
|
-
|
|
135
|
-
Logger.debug('before Promise.all(recordPromises) in handler');
|
|
136
|
-
try {
|
|
137
|
-
// --- main await all promises
|
|
138
|
-
await Promise.all(recordPromises); // await all promises
|
|
139
|
-
|
|
140
|
-
return event.Records // return all for local test
|
|
141
|
-
|
|
142
|
-
} catch {
|
|
143
|
-
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
|
|
144
|
-
}
|
|
145
|
-
Logger.debug('after Promise.all(recordPromises) in handler');
|
|
146
|
-
|
|
147
|
-
} catch (err) {
|
|
148
|
-
Logger.error('Unhandled Error, processImageAfterUpload: ', err);
|
|
149
|
-
throw (err);
|
|
150
|
-
}
|
|
151
|
-
});
|