@izara_project/izara-market-library-service-schemas 1.0.55 → 1.0.56
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/GenerateCodeLibs.js +1 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/api/template.ejs +13 -14
- package/src/reStructure/TemplateData/EndpointPerService/handler/dsq/template.ejs +14 -11
- package/src/reStructure/TemplateData/EndpointPerService/handler/inv/template.ejs +9 -11
- package/src/reStructure/TemplateData/EndpointPerService/handler/sqs/template.ejs +16 -13
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +15 -4
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +18 -15
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/handler/template.ejs +2 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +14 -10
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/data.js +20 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +8 -14
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/handler/template.ejs +2 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +45 -55
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/template.ejs +5 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/data.js +4 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +31 -40
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerS3/template.ejs +3 -17
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/ProcessCsvtemplate.ejs +391 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +9 -317
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +5 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +28 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +11 -11
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +16 -16
- package/src/reStructure/TemplateData/flowSchema/register/complete/handler/template.ejs +3 -0
- package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/handler/template.ejs +4 -0
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/mainFunction/template.ejs +36 -7
- package/src/reStructure/TemplateData/perActionEndpoint/handler/api/template.ejs +2 -2
- package/src/reStructure/TemplateData/perActionEndpoint/handler/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/perActionEndpoint/handler/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +1 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/api/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +6 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/api/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/api/template.ejs +23 -23
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/dsq/template.ejs +18 -16
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/inv/template.ejs +14 -12
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/sqs/template.ejs +21 -19
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +2 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/template.ejs +3 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/api/template.ejs +24 -22
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/dsq/template.ejs +21 -17
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/inv/template.ejs +21 -19
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/sqs/template.ejs +20 -20
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/handler/sqs/template.ejs +1 -1
package/package.json
CHANGED
|
@@ -857,6 +857,7 @@ async function createDataDetailsLib(_izContext, objectSchemas, settings = { buck
|
|
|
857
857
|
[eachStorageResourceTag]: {
|
|
858
858
|
storageType: consts.STORAGE_TYPES.dynamoDB,
|
|
859
859
|
tableName: storageResources[eachStorageResourceTag].tableName,
|
|
860
|
+
serviceTag: process.env.iz_serviceTag,
|
|
860
861
|
fieldNames: [keyFieldName]
|
|
861
862
|
}
|
|
862
863
|
});
|
|
@@ -16,21 +16,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
|
-
|
|
20
|
-
const
|
|
19
|
+
|
|
20
|
+
const { middlewareHandler, validatorSchema, response } = require("@izara_project/izara-middleware");
|
|
21
21
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
|
|
23
|
+
//(<optionalRequire>)
|
|
24
|
+
//(</optionalRequire>)
|
|
25
25
|
|
|
26
26
|
const { <%- action %>Main } =require('./<%- firstLetterUpperCase(action) %>_Main.js')
|
|
27
27
|
|
|
28
|
-
//(<
|
|
29
|
-
//</
|
|
28
|
+
//(<globalVariable>
|
|
29
|
+
//</globalVariable>)
|
|
30
30
|
|
|
31
|
-
//validate event params in
|
|
32
|
-
validateSchemaMiddleware(
|
|
33
|
-
middleware,
|
|
31
|
+
//validate event params in middlewareHandler before into main function
|
|
32
|
+
validatorSchema.validateSchemaMiddleware(
|
|
34
33
|
"<%- action %>",
|
|
35
34
|
//(<validateSchemaSetting>
|
|
36
35
|
//</validateSchemaSetting>)
|
|
@@ -41,7 +40,7 @@ validateSchemaMiddleware(
|
|
|
41
40
|
//(</afterValidateWith>)
|
|
42
41
|
|
|
43
42
|
|
|
44
|
-
module.exports.main =
|
|
43
|
+
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
45
44
|
event._izContext.logger.debug('Event:', event);
|
|
46
45
|
try {
|
|
47
46
|
// invoke LambdaFunction
|
|
@@ -55,15 +54,15 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
55
54
|
|
|
56
55
|
// return error to client
|
|
57
56
|
if (lambdaFunctionResponse instanceof Error) {
|
|
58
|
-
return (
|
|
57
|
+
return (response.failure(lambdaFunctionResponse));
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
// return success to client
|
|
62
|
-
return (
|
|
61
|
+
return (response.success(lambdaFunctionResponse));
|
|
63
62
|
|
|
64
63
|
} catch (err) {
|
|
65
64
|
event._izContext.logger.error('Error, <%- firstLetterUpperCase(action) %>_<%- firstLetterUpperCase(handler) %>: ', err);
|
|
66
|
-
return (
|
|
65
|
+
return (response.failure(err));
|
|
67
66
|
}
|
|
68
67
|
});
|
|
69
68
|
<%_ function firstLetterUpperCase(text){
|
|
@@ -16,24 +16,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
|
-
|
|
20
|
-
const
|
|
19
|
+
|
|
20
|
+
const { middlewareHandler } = require("@izara_project/izara-middleware");
|
|
21
21
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
22
22
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
23
|
-
const {validateSchemaPerRecord} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs')
|
|
23
|
+
const { validateSchemaPerRecord } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs')
|
|
24
24
|
const recordHandlerSharedLib = require('@izara_project/izara-core-library-record-handler');
|
|
25
25
|
|
|
26
|
+
//(<optionalRequire>)
|
|
27
|
+
//(</optionalRequire>)
|
|
28
|
+
|
|
26
29
|
const { <%- action %>Main } =require('./<%- firstLetterUpperCase(action) %>_Main.js')
|
|
27
30
|
|
|
28
|
-
//(<
|
|
29
|
-
//</
|
|
31
|
+
//(<globalVariable>
|
|
32
|
+
//</globalVariable>)
|
|
30
33
|
|
|
31
34
|
//validate event params in middleware before into main function
|
|
32
|
-
middleware.setValidatorSchema(
|
|
33
|
-
recordHandlerSharedLib.
|
|
35
|
+
// middleware.setValidatorSchema(
|
|
36
|
+
// recordHandlerSharedLib.baseValidatorSchemaS3(),
|
|
34
37
|
//(<middlewareSettings>)
|
|
35
38
|
//(</middlewareSettings>)
|
|
36
|
-
)
|
|
39
|
+
// )
|
|
37
40
|
|
|
38
41
|
/*
|
|
39
42
|
const perRecordsValidatorSchema = {
|
|
@@ -55,11 +58,11 @@ module.exports.main = middleware.wrap(async (event,context, callback) => {
|
|
|
55
58
|
let recordPromises = [];
|
|
56
59
|
|
|
57
60
|
await Promise.all(event.Records.map(async record => {
|
|
58
|
-
record._izContext.logger.debug('record
|
|
61
|
+
record._izContext.logger.debug('record ReceiveMsgOutHdrSqs', record);
|
|
59
62
|
|
|
60
63
|
let passOnProperties = [];
|
|
61
64
|
|
|
62
|
-
const
|
|
65
|
+
const object = {
|
|
63
66
|
objectType: record.body.Message.objectType,
|
|
64
67
|
serviceTag: process.env.iz_serviceTag
|
|
65
68
|
}
|
|
@@ -68,7 +71,7 @@ module.exports.main = middleware.wrap(async (event,context, callback) => {
|
|
|
68
71
|
await validateSchemaPerRecord(
|
|
69
72
|
record,
|
|
70
73
|
"<%- firstLetterUpperCase(action) %><%- firstLetterUpperCase(handler) %>",
|
|
71
|
-
|
|
74
|
+
object,
|
|
72
75
|
"<%- action %>",
|
|
73
76
|
//(<validateSchemaSetting>)
|
|
74
77
|
//(</validateSchemaSetting>)
|
|
@@ -17,12 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
const { middlewareHandler, validatorSchema } = require("@izara_project/izara-middleware");
|
|
22
21
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
|
|
23
|
+
//(<optionalRequire>)
|
|
24
|
+
//(</optionalRequire>)
|
|
26
25
|
|
|
27
26
|
const { <%- action %>Main } =require('./<%- firstLetterUpperCase(action) %>_Main.js')
|
|
28
27
|
|
|
@@ -30,20 +29,19 @@ const { <%- action %>Main } =require('./<%- firstLetterUpperCase(action) %>_Main
|
|
|
30
29
|
//</globalVariable>)
|
|
31
30
|
|
|
32
31
|
|
|
33
|
-
//validate event params in
|
|
34
|
-
validateSchemaMiddleware(
|
|
35
|
-
middleware,
|
|
32
|
+
//validate event params in middlewareHandler before into main function
|
|
33
|
+
validatorSchema.validateSchemaMiddleware(
|
|
36
34
|
"<%- action %>",
|
|
37
35
|
//(<validateSchemaSetting>
|
|
38
36
|
//</validateSchemaSetting>)
|
|
39
37
|
)
|
|
40
38
|
// if need to validate authorizer or additional params, add code to hook tag below
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
//(<afterValidateWithGeneratedSchema>)
|
|
41
|
+
//(</afterValidateWithGeneratedSchema>)
|
|
44
42
|
|
|
45
43
|
|
|
46
|
-
module.exports.main =
|
|
44
|
+
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
47
45
|
event._izContext.logger.debug('Event:', event);
|
|
48
46
|
event._izContext.logger.debug('context:', context);
|
|
49
47
|
|
|
@@ -16,24 +16,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
|
-
|
|
20
|
-
const
|
|
19
|
+
|
|
20
|
+
const { middlewareHandler } = require("@izara_project/izara-middleware");
|
|
21
21
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
22
22
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
23
|
-
const {validateSchemaPerRecord} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs')
|
|
23
|
+
const { validateSchemaPerRecord } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs')
|
|
24
24
|
const recordHandlerSharedLib = require('@izara_project/izara-core-library-record-handler');
|
|
25
25
|
|
|
26
|
+
//(<optionalRequire>)
|
|
27
|
+
//(</optionalRequire>)
|
|
28
|
+
|
|
26
29
|
const { <%- action %>Main } =require('./<%- firstLetterUpperCase(action) %>_Main.js')
|
|
27
30
|
|
|
28
|
-
//(<
|
|
29
|
-
//(</
|
|
31
|
+
//(<globalVariable>)
|
|
32
|
+
//(</globalVariable>)
|
|
30
33
|
|
|
31
|
-
//validate event params in
|
|
32
|
-
|
|
33
|
-
recordHandlerSharedLib.
|
|
34
|
+
//validate event params in middlewareHandler before into main function
|
|
35
|
+
// middlewareHandler.setValidatorSchema(
|
|
36
|
+
// recordHandlerSharedLib.baseValidatorSchemaS3(),
|
|
34
37
|
//(<middlewareSettings>)
|
|
35
38
|
//(</middlewareSettings>)
|
|
36
|
-
)
|
|
39
|
+
// )
|
|
37
40
|
/*
|
|
38
41
|
const perRecordsValidatorSchema = {
|
|
39
42
|
type: "object",
|
|
@@ -46,18 +49,18 @@ const perRecordsValidatorSchema = {
|
|
|
46
49
|
|
|
47
50
|
// if need to validate authorizer or additional params , add code to hook tag below
|
|
48
51
|
|
|
49
|
-
module.exports.main =
|
|
52
|
+
module.exports.main = middlewareHandler.wrap(async (event,context, callback) => {
|
|
50
53
|
|
|
51
54
|
try {
|
|
52
55
|
|
|
53
56
|
let recordPromises = [];
|
|
54
57
|
|
|
55
58
|
await Promise.all(event.Records.map(async record => {
|
|
56
|
-
record._izContext.logger.debug('record
|
|
59
|
+
record._izContext.logger.debug('record ReceiveMsgOutHdrSqs', record);
|
|
57
60
|
|
|
58
61
|
let passOnProperties = [];
|
|
59
62
|
|
|
60
|
-
const
|
|
63
|
+
const object = {
|
|
61
64
|
objectType: record.body.Message.objectType,
|
|
62
65
|
serviceTag: process.env.iz_serviceTag
|
|
63
66
|
}
|
|
@@ -65,7 +68,7 @@ module.exports.main = middleware.wrap(async (event,context, callback) => {
|
|
|
65
68
|
await validateSchemaPerRecord(
|
|
66
69
|
record,
|
|
67
70
|
"<%- firstLetterUpperCase(action) %><%- firstLetterUpperCase(handler) %>",
|
|
68
|
-
|
|
71
|
+
object,
|
|
69
72
|
"<%- action %>",
|
|
70
73
|
//(<validateSchemaSetting>)
|
|
71
74
|
//(</validateSchemaSetting>)
|
|
@@ -53,9 +53,11 @@ const {
|
|
|
53
53
|
TOPIC_NAME_GRAPH_HANDLER,
|
|
54
54
|
GRAPH_HANDLER_SERVICE_NAME,
|
|
55
55
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
56
|
+
|
|
56
57
|
const {
|
|
57
|
-
createDataDetailsLib,
|
|
58
|
-
}
|
|
58
|
+
generateCodeLibs: { generateCodeLibs: { createDataDetailsLib } },
|
|
59
|
+
utils: { utils: { firstLetterUpperCase } }
|
|
60
|
+
} = require('@izara_project/izara-market-library-service-schemas');
|
|
59
61
|
|
|
60
62
|
//(<optionalRequire>)
|
|
61
63
|
//(</optionalRequire>)
|
|
@@ -314,6 +316,9 @@ module.exports.createMain = async (
|
|
|
314
316
|
...objInstanceFullForDynamoDb.fields
|
|
315
317
|
}
|
|
316
318
|
);
|
|
319
|
+
|
|
320
|
+
objInstanceFullForDynamoDb.fields = {} // prevent using fieldNames from other tableName
|
|
321
|
+
|
|
317
322
|
//(<afterCreateRecordDynamo>)
|
|
318
323
|
//(</afterCreateRecordDynamo>)
|
|
319
324
|
} else if (createDataDetail.storageType == consts.STORAGE_TYPES.graph) {
|
|
@@ -349,11 +354,16 @@ module.exports.createMain = async (
|
|
|
349
354
|
}
|
|
350
355
|
|
|
351
356
|
if (objectSchema.hasOwnProperty("extendObjType")) {
|
|
352
|
-
if (createDataDetail.storageType === consts.STORAGE_TYPES.dynamoDB &&
|
|
357
|
+
if (createDataDetail.storageType === consts.STORAGE_TYPES.dynamoDB &&
|
|
358
|
+
createDataDetail.tableName.includes(`${firstLetterUpperCase(objectSchema.extendObjType.objectType)}Records`) &&
|
|
359
|
+
createDataDetail.serviceTag !== process.env.iz_serviceTag
|
|
360
|
+
) {
|
|
353
361
|
let objInstanceFullForParentDynamoDb = lodash.cloneDeep(objInstanceFull)
|
|
354
362
|
Object.assign(objInstanceFullForParentDynamoDb.fields, createObjInstanceFullFieldsByStorageTag(_izContext, storageTag, createDataDetail))
|
|
355
363
|
_izContext.logger.debug("objInstanceFull before create item in dynamoDB in parent", objInstanceFullForParentDynamoDb)
|
|
356
364
|
|
|
365
|
+
Object.assign(objInstanceFullForParentDynamoDb.fields, { [`${objectSchema.extendObjType.objectType}HandlerServiceTag`]: process.env.iz_serviceTag })
|
|
366
|
+
|
|
357
367
|
let identifiersForCreateData = await dynamoDbIdentifiersByStorageResource(
|
|
358
368
|
_izContext,
|
|
359
369
|
objectSchema,
|
|
@@ -448,7 +458,8 @@ module.exports.createMain = async (
|
|
|
448
458
|
Date.now(),
|
|
449
459
|
{ updatePropertiesOnMatch: false },
|
|
450
460
|
)
|
|
451
|
-
|
|
461
|
+
return createNodeResult
|
|
462
|
+
|
|
452
463
|
} else {
|
|
453
464
|
_izContext.logger.debug("not have userAgent will send Message to GraphHandler")
|
|
454
465
|
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
@@ -159,31 +159,34 @@ async function createParamForCreateSource(_izContext, allObjSchemas, action, han
|
|
|
159
159
|
const configPath = path.join(srcPath, '../../config/serverless.config.yml');
|
|
160
160
|
const serverlessConfig = fs.readFileSync(configPath, 'utf8');
|
|
161
161
|
const config = yaml.parse(serverlessConfig);
|
|
162
|
-
const
|
|
162
|
+
const ownServiceTag = config.main_config.iz_serviceTag;
|
|
163
|
+
let parentTables = [];
|
|
163
164
|
// create lambdaRole for parent dynamo table if able
|
|
164
165
|
for (const objectSchema of allObjSchemas.records) {
|
|
165
166
|
if (objectSchema.hasOwnProperty("extendObjType")) {
|
|
166
167
|
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
167
168
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
168
|
-
if (storageResource.serviceTag) {
|
|
169
|
-
|
|
170
|
-
additionalResourcePermission.push(
|
|
171
|
-
createIamRole(
|
|
172
|
-
{
|
|
173
|
-
[RESOURCE_CLASSES.dynamoDbTable]: Object.values(DYNAMO_RESOURCE)
|
|
174
|
-
},
|
|
175
|
-
[
|
|
176
|
-
externalResourceYaml(RESOURCE_CLASSES.dynamoDbAcrossService, upperCase(storageResource.tableName), storageResource.serviceTag)
|
|
177
|
-
]
|
|
178
|
-
)
|
|
179
|
-
)
|
|
180
|
-
}
|
|
169
|
+
if (storageResource.serviceTag && storageResource.serviceTag !== ownServiceTag) {
|
|
170
|
+
parentTables.push({ tableName: storageResource.tableName, serviceTag: storageResource.serviceTag })
|
|
181
171
|
}
|
|
182
172
|
}
|
|
183
173
|
}
|
|
184
174
|
}
|
|
185
175
|
}
|
|
186
176
|
|
|
177
|
+
if (parentTables) {
|
|
178
|
+
additionalResourcePermission.push(
|
|
179
|
+
createIamRole(
|
|
180
|
+
{
|
|
181
|
+
[RESOURCE_CLASSES.dynamoDbTable]: Object.values(DYNAMO_RESOURCE)
|
|
182
|
+
},
|
|
183
|
+
parentTables.map(parentTable =>
|
|
184
|
+
externalResourceYaml(RESOURCE_CLASSES.dynamoDbAcrossService, upperCase(parentTable.tableName), parentTable.serviceTag)
|
|
185
|
+
)
|
|
186
|
+
)
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
|
|
187
190
|
let resourceApis = [];
|
|
188
191
|
if (handler === HANDLER.hdrApi) {
|
|
189
192
|
for (const objectSchema of allObjSchemas.records) {
|
|
@@ -205,7 +208,7 @@ async function createParamForCreateSource(_izContext, allObjSchemas, action, han
|
|
|
205
208
|
action: action,
|
|
206
209
|
functionNameConfig,
|
|
207
210
|
resourceApis,
|
|
208
|
-
serviceTag:
|
|
211
|
+
serviceTag: ownServiceTag
|
|
209
212
|
},
|
|
210
213
|
setting: {
|
|
211
214
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -92,6 +92,8 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
92
92
|
passOnProperties.push(record.body.Message.returnMessage)
|
|
93
93
|
passOnProperties.push(record.body.Message.errorsFound)
|
|
94
94
|
passOnProperties.push(record.body.Message.passStatus)
|
|
95
|
+
//(<additionalProperties>)
|
|
96
|
+
//(</additionalProperties>)
|
|
95
97
|
passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message))
|
|
96
98
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
97
99
|
|
|
@@ -22,6 +22,7 @@ const snsSharedLib = require('@izara_project/izara-core-library-sns')
|
|
|
22
22
|
const sns = require('@izara_project/izara-core-library-external-request').sns
|
|
23
23
|
const consts = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
24
24
|
const { getNestObject } = require('../../../../libs/source/GenerateCodeLibs');
|
|
25
|
+
|
|
25
26
|
//(<optionalRequired>)
|
|
26
27
|
//(</optionalRequired>)
|
|
27
28
|
/**
|
|
@@ -44,7 +45,9 @@ module.exports.confirmNewReserved = async (
|
|
|
44
45
|
returnMessage,
|
|
45
46
|
errorsFound,
|
|
46
47
|
passStatus,
|
|
47
|
-
|
|
48
|
+
//(<additionalProperties>)
|
|
49
|
+
//(</additionalProperties>)
|
|
50
|
+
passBackProperties = {}
|
|
48
51
|
|
|
49
52
|
) => {
|
|
50
53
|
try {
|
|
@@ -76,7 +79,7 @@ module.exports.confirmNewReserved = async (
|
|
|
76
79
|
|
|
77
80
|
let sendMessageToConfirmUsage = {
|
|
78
81
|
Message: JSON.stringify(confirmUsageMessage),
|
|
79
|
-
TopicArn: await snsSharedLib.snsTopicArn(_izContext, '
|
|
82
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, 'ConfirmUsage_In', consts.EXTERNAL_SERVICE_NAME.accountLimits)
|
|
80
83
|
};
|
|
81
84
|
_izContext.logger.debug("sendMessageToConfirmUsage", sendMessageToConfirmUsage);
|
|
82
85
|
await sns.publishAsync(_izContext, sendMessageToConfirmUsage);
|
|
@@ -94,24 +97,25 @@ module.exports.confirmNewReserved = async (
|
|
|
94
97
|
}
|
|
95
98
|
)
|
|
96
99
|
|
|
97
|
-
|
|
98
|
-
let sendMessageToUpdateImportBatchStatus = {
|
|
100
|
+
let sendMessageToUpdateStatus = {
|
|
99
101
|
objInstanceFull: {
|
|
100
102
|
identifiers: {
|
|
101
|
-
|
|
103
|
+
//(<identifiers>)
|
|
104
|
+
//(</identifiers>)
|
|
102
105
|
},
|
|
103
106
|
fields: {
|
|
104
|
-
|
|
107
|
+
//(<fields>)
|
|
108
|
+
//(</fields>)
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
let
|
|
113
|
+
let sendMessageToUpdateEndpoint = {
|
|
110
114
|
Message: JSON.stringify(sendMessageToUpdateImportBatchStatus),
|
|
111
|
-
TopicArn: await snsSharedLib.snsTopicArn(_izContext,
|
|
115
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, "Update_In")
|
|
112
116
|
};
|
|
113
|
-
_izContext.logger.debug("
|
|
114
|
-
await sns.publishAsync(_izContext,
|
|
117
|
+
_izContext.logger.debug("sendMessageToUpdateEndpoint", sendMessageToUpdateEndpoint);
|
|
118
|
+
await sns.publishAsync(_izContext, sendMessageToUpdateEndpoint);
|
|
115
119
|
|
|
116
120
|
return { returnResponse: 'success' }
|
|
117
121
|
|
package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/data.js
CHANGED
|
@@ -38,11 +38,28 @@ async function data(_izContext, flowSchema, srcPath) {
|
|
|
38
38
|
|
|
39
39
|
async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
40
40
|
let functionName = upperCase(FUNCTION_NAME.createObjectS3)
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
let objectSchema = await getObjectSchema.getObjectSchemaCombineFieldNamesWithCache(_izContext, flowSchema.objType)
|
|
42
|
+
let objectType = flowSchema.objType.objectType
|
|
43
|
+
let createdFieldNames = [];
|
|
44
|
+
let statusFieldNames = [];
|
|
45
|
+
for (const [fieldNames, fieldSettings] of Object.entries(objectSchema.fieldNames)) {
|
|
46
|
+
if (fieldSettings.hasOwnProperty("requiredOnCreate") && fieldSettings.requiredOnCreate === true) {
|
|
47
|
+
createdFieldNames.push(fieldNames);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (fieldSettings.hasOwnProperty("statusField") && fieldSettings.statusField === true) {
|
|
51
|
+
statusFieldNames.push(fieldNames)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
43
55
|
return {
|
|
44
56
|
templatePath: templatePath,
|
|
45
|
-
templateData: {
|
|
57
|
+
templateData: {
|
|
58
|
+
flowTag: flowSchema.flowTag,
|
|
59
|
+
createdFieldNames: createdFieldNames,
|
|
60
|
+
statusFieldNames: statusFieldNames,
|
|
61
|
+
objectType
|
|
62
|
+
},
|
|
46
63
|
setting: {
|
|
47
64
|
savePath: path.join(srcPath, SOURCE_PATH.webSocket, flowSchema.flowTag, "source/"),
|
|
48
65
|
saveFileName: `${functionName}_Main`,
|
|
@@ -35,8 +35,10 @@ const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryEr
|
|
|
35
35
|
const { v4: uuidv4 } = require('uuid')
|
|
36
36
|
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
37
37
|
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
38
|
+
|
|
38
39
|
//(<optionalRequired>)
|
|
39
40
|
//(</optionalRequired>)
|
|
41
|
+
|
|
40
42
|
/**
|
|
41
43
|
*
|
|
42
44
|
*
|
|
@@ -65,9 +67,6 @@ module.exports.createObject = async (
|
|
|
65
67
|
_izContext.logger.debug("WebSocketInvoke requestParams", requestParams)
|
|
66
68
|
_izContext.logger.debug("WebSocketInvoke callingFlowConfig", callingFlowConfig)
|
|
67
69
|
|
|
68
|
-
_izContext.correlationIds.set(coreConsts.BASE_USER_ID, "BasDev");
|
|
69
|
-
_izContext.correlationIds.set(coreConsts.TARGET_ID, "BasDevTarget");
|
|
70
|
-
|
|
71
70
|
let flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
72
71
|
flowTag: "<%- flowTag %>",
|
|
73
72
|
serviceTag: process.env.iz_serviceTag
|
|
@@ -75,6 +74,8 @@ module.exports.createObject = async (
|
|
|
75
74
|
|
|
76
75
|
_izContext.logger.debug("getFlowSchema", flowSchema)
|
|
77
76
|
|
|
77
|
+
let userId = _izContext.correlationIds.get(coreConsts.BASE_USER_ID)
|
|
78
|
+
let submittedByUserId = _izContext.correlationIds.get(coreConsts.TARGET_ID);
|
|
78
79
|
|
|
79
80
|
if (!flowSchema) {
|
|
80
81
|
throw new NoRetryError(`flowTag not found ${requestParams.flowTag}`)
|
|
@@ -96,17 +97,10 @@ module.exports.createObject = async (
|
|
|
96
97
|
//(</beforeCreateHook>)
|
|
97
98
|
// create message Object to create Endpoint
|
|
98
99
|
let messageObject = {
|
|
100
|
+
objectType: <%- objectType %>
|
|
99
101
|
fieldNames: {
|
|
100
|
-
|
|
101
|
-
//
|
|
102
|
-
submittedByUserId: _izContext.correlationIds.get(coreConsts.TARGET_ID),
|
|
103
|
-
// submittedByUserId: "mockSubmittedByUserId",
|
|
104
|
-
startTime: Date.now(),
|
|
105
|
-
importConfigId: requestParams.importConfigId,
|
|
106
|
-
importBatchStatus: "processing",
|
|
107
|
-
importType: requestParams.importType,
|
|
108
|
-
fileName: requestParams.fileName,
|
|
109
|
-
fileSize: requestParams.fileSize
|
|
102
|
+
//(<fieldNamesHook>)
|
|
103
|
+
//(</fieldNamesHook>)
|
|
110
104
|
}
|
|
111
105
|
}
|
|
112
106
|
// create callingFlow
|
|
@@ -120,7 +114,7 @@ module.exports.createObject = async (
|
|
|
120
114
|
)
|
|
121
115
|
)
|
|
122
116
|
|
|
123
|
-
// send message to
|
|
117
|
+
// send message to Create endpoint
|
|
124
118
|
let sendMessageToCreateEndpoint = {
|
|
125
119
|
Message: JSON.stringify(messageObject),
|
|
126
120
|
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, "Create_In")
|
|
@@ -92,6 +92,8 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
92
92
|
passOnProperties.push(record.body.Message.returnMessage)
|
|
93
93
|
passOnProperties.push(record.body.Message.errorsFound)
|
|
94
94
|
passOnProperties.push(record.body.Message.passStatus)
|
|
95
|
+
//(<additionalProperties>)
|
|
96
|
+
//(</additionalProperties>)
|
|
95
97
|
passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message))
|
|
96
98
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
97
99
|
|