@izara_project/izara-market-library-service-schemas 1.0.54 → 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/Auth/generateAuthYml/template.ejs +15 -16
- 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 +41 -17
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +39 -21
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +43 -8
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +29 -9
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +21 -15
- package/src/reStructure/TemplateData/EndpointPerService/yaml/template.ejs +2 -2
- 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 +21 -4
- 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 +35 -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/externalTopic/Process/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +8 -8
- package/src/reStructure/TemplateData/flowSchema/flowSchemaMainFunction/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaMainFunction/template.ejs +5 -3
- 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/flowStep/handler/template.ejs +1 -0
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +28 -26
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Api/functionYaml/data.js +10 -1
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Api/functionYaml/template.ejs +2 -2
- 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/templateByStatusType/storedCacheTemplate.ejs +3 -0
- package/src/reStructure/TemplateData/flowSchema/templateByStatusType/triggerCacheTemplate.ejs +3 -0
- 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/perActionEndpoint/yaml/api/data.js +10 -2
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/api/template.ejs +1 -1
- 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/action/mainFunction/template.ejs +9 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/handler/sqs/template.ejs +2 -1
- 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
|
});
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
resultTtlInSeconds: 300
|
|
1
|
+
authorizerServiceSchema:
|
|
2
|
+
type: request
|
|
3
|
+
functionArn: ${self:custom.iz_authorizerServiceSchemaV2}
|
|
4
|
+
identitySource:
|
|
5
|
+
- $request.header.Authorization
|
|
6
|
+
- $context.routeKey
|
|
7
|
+
resultTtlInSeconds: 300
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
authorizerIdentifiers:
|
|
10
|
+
type: request
|
|
11
|
+
functionArn: ${self:custom.iz_authorizerServiceSchemaV2}
|
|
12
|
+
identitySource:
|
|
13
|
+
- $request.header.Authorization
|
|
14
|
+
- $context.routeKey
|
|
15
|
+
- $request.querystring.identifiers
|
|
16
|
+
resultTtlInSeconds: 300
|
|
@@ -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>)
|
|
@@ -16,31 +16,51 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
// ──────────────────────── Core Node Modules ────────────────────────
|
|
21
|
+
const lodash = require("lodash");
|
|
22
|
+
|
|
23
|
+
// ──────────────────────── Shared Core Libraries ────────────────────────
|
|
24
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
25
|
+
|
|
26
|
+
// ──────────────────────── Izara Core Libraries ────────────────────────
|
|
20
27
|
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
21
28
|
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
22
29
|
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
23
30
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
24
31
|
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
32
|
+
const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
|
|
33
|
+
const coreConsts = require('@izara_project/izara-core-library-core/src/Consts');
|
|
25
34
|
|
|
35
|
+
// ──────────────────────── Middleware / External ────────────────────────
|
|
36
|
+
const middlewareConsts = require('@izara_project/izara-middleware').consts;
|
|
26
37
|
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
27
38
|
const sns = externalRequest.sns;
|
|
28
39
|
|
|
29
|
-
|
|
40
|
+
// ──────────────────────── Service Schemas ────────────────────────
|
|
41
|
+
const { createObjType } = require('@izara_project/izara-core-library-service-schemas/src/Utils');
|
|
42
|
+
const { createNodeLib, uploadUseCase, consts, getObjectSchema } = require('@izara_project/izara-core-library-service-schemas');
|
|
30
43
|
|
|
31
|
-
|
|
44
|
+
// ──────────────────────── Graph Service Libraries ────────────────────────
|
|
45
|
+
const graphSharedLibs = require('@izara_project/izara-core-library-graph-service');
|
|
32
46
|
|
|
33
|
-
|
|
34
|
-
const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
|
|
35
|
-
const consts = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
36
|
-
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
37
|
-
const middlewareConsts = require('@izara_project/izara-middleware').consts
|
|
38
|
-
const graphSharedLibs = require('@izara_project/izara-core-library-graph-service')
|
|
47
|
+
// ──────────────────────── Market Library Service Schemas ────────────────────────
|
|
39
48
|
const {
|
|
40
49
|
dynamoDbIdentifiersByStorageResource,
|
|
41
50
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
|
|
51
|
+
const {
|
|
52
|
+
TOPIC_NAME_GENERATE_CODE,
|
|
53
|
+
TOPIC_NAME_GRAPH_HANDLER,
|
|
54
|
+
GRAPH_HANDLER_SERVICE_NAME,
|
|
55
|
+
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
42
56
|
|
|
57
|
+
const {
|
|
58
|
+
generateCodeLibs: { generateCodeLibs: { createDataDetailsLib } },
|
|
59
|
+
utils: { utils: { firstLetterUpperCase } }
|
|
60
|
+
} = require('@izara_project/izara-market-library-service-schemas');
|
|
43
61
|
|
|
62
|
+
//(<optionalRequire>)
|
|
63
|
+
//(</optionalRequire>)
|
|
44
64
|
|
|
45
65
|
//-----------------------------------------------------------------------------------------------------------
|
|
46
66
|
const PREFIX = {
|
|
@@ -50,11 +70,6 @@ const PREFIX = {
|
|
|
50
70
|
CREATE_OBJECT_ASYNC_COMPLETE: "createObjectAsyncComplete"
|
|
51
71
|
}
|
|
52
72
|
//-----------------------------------------------------------------------------------------------------------
|
|
53
|
-
const { TOPIC_NAME_GENERATE_CODE, TOPIC_NAME_GRAPH_HANDLER, GRAPH_HANDLER_SERVICE_NAME } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
54
|
-
const { createDataDetailsLib } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs')
|
|
55
|
-
const createNodeLib = require('@izara_project/izara-core-library-service-schemas').createNodeLib
|
|
56
|
-
//(<optionalRequire>)
|
|
57
|
-
//(</optionalRequire>)
|
|
58
73
|
|
|
59
74
|
/**
|
|
60
75
|
*
|
|
@@ -301,7 +316,10 @@ module.exports.createMain = async (
|
|
|
301
316
|
...objInstanceFullForDynamoDb.fields
|
|
302
317
|
}
|
|
303
318
|
);
|
|
304
|
-
|
|
319
|
+
|
|
320
|
+
objInstanceFullForDynamoDb.fields = {} // prevent using fieldNames from other tableName
|
|
321
|
+
|
|
322
|
+
//(<afterCreateRecordDynamo>)
|
|
305
323
|
//(</afterCreateRecordDynamo>)
|
|
306
324
|
} else if (createDataDetail.storageType == consts.STORAGE_TYPES.graph) {
|
|
307
325
|
//(<beforeCreateNode>)
|
|
@@ -336,11 +354,16 @@ module.exports.createMain = async (
|
|
|
336
354
|
}
|
|
337
355
|
|
|
338
356
|
if (objectSchema.hasOwnProperty("extendObjType")) {
|
|
339
|
-
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
|
+
) {
|
|
340
361
|
let objInstanceFullForParentDynamoDb = lodash.cloneDeep(objInstanceFull)
|
|
341
362
|
Object.assign(objInstanceFullForParentDynamoDb.fields, createObjInstanceFullFieldsByStorageTag(_izContext, storageTag, createDataDetail))
|
|
342
363
|
_izContext.logger.debug("objInstanceFull before create item in dynamoDB in parent", objInstanceFullForParentDynamoDb)
|
|
343
364
|
|
|
365
|
+
Object.assign(objInstanceFullForParentDynamoDb.fields, { [`${objectSchema.extendObjType.objectType}HandlerServiceTag`]: process.env.iz_serviceTag })
|
|
366
|
+
|
|
344
367
|
let identifiersForCreateData = await dynamoDbIdentifiersByStorageResource(
|
|
345
368
|
_izContext,
|
|
346
369
|
objectSchema,
|
|
@@ -435,7 +458,8 @@ module.exports.createMain = async (
|
|
|
435
458
|
Date.now(),
|
|
436
459
|
{ updatePropertiesOnMatch: false },
|
|
437
460
|
)
|
|
438
|
-
|
|
461
|
+
return createNodeResult
|
|
462
|
+
|
|
439
463
|
} else {
|
|
440
464
|
_izContext.logger.debug("not have userAgent will send Message to GraphHandler")
|
|
441
465
|
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
@@ -16,42 +16,60 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
|
-
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
20
|
-
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
21
|
-
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
22
|
-
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
23
|
-
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
const
|
|
20
|
+
// ==================== Built-in Modules ====================
|
|
21
|
+
const path = require('path');
|
|
22
|
+
const schemasPath = path.join(__dirname, '../schemas');
|
|
28
23
|
|
|
29
|
-
const uploadUseCase = require('@izara_project/izara-core-library-service-schemas/src/libs/UploadUseCase')
|
|
30
24
|
|
|
25
|
+
// ==================== Shared Core Utilities ====================
|
|
31
26
|
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
32
27
|
const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
|
|
33
|
-
const
|
|
34
|
-
|
|
28
|
+
const coreConsts = require('@izara_project/izara-core-library-core/src/Consts');
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
// ==================== Core Service Schemas ====================
|
|
32
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
35
33
|
const consts = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
36
|
-
const
|
|
34
|
+
const { createObjType } = require('@izara_project/izara-core-library-service-schemas/src/Utils');
|
|
35
|
+
const serviceConfigLib = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig');
|
|
36
|
+
const {
|
|
37
|
+
getGraphServiceTagWithCache,
|
|
38
|
+
getServiceNameWithCache,
|
|
39
|
+
} = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig');
|
|
40
|
+
const uploadUseCase = require('@izara_project/izara-core-library-service-schemas/src/libs/UploadUseCase');
|
|
37
41
|
|
|
42
|
+
|
|
43
|
+
// ==================== Market Service Schemas ====================
|
|
38
44
|
const {
|
|
39
45
|
generateDynamoDbIdentifiers,
|
|
40
46
|
dynamoDbIdentifiersByStorageResource,
|
|
41
|
-
collectGetData
|
|
47
|
+
collectGetData,
|
|
48
|
+
createDeleteDataDetail,
|
|
42
49
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
|
|
43
50
|
|
|
44
51
|
const {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} = require('@izara_project/izara-
|
|
52
|
+
TOPIC_NAME_GENERATE_CODE,
|
|
53
|
+
TOPIC_NAME_GRAPH_HANDLER,
|
|
54
|
+
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
// ==================== Shared Libraries ====================
|
|
58
|
+
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
59
|
+
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
60
|
+
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
61
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
62
|
+
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
// ==================== External Resources ====================
|
|
66
|
+
const sns = require('@izara_project/izara-core-library-external-request/src/resources/Sns');
|
|
67
|
+
|
|
48
68
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
69
|
+
// ==================== Optional Requires ====================
|
|
70
|
+
// (<optionalRequire>)
|
|
71
|
+
// (</optionalRequire>)
|
|
52
72
|
|
|
53
|
-
//(<optionalRequire>)
|
|
54
|
-
//(</optionalRequire>)
|
|
55
73
|
/**
|
|
56
74
|
*
|
|
57
75
|
* @param {*} _izContext
|
|
@@ -18,6 +18,7 @@ Copyright (C) 2020 Sven Mason <http: //izara.io>
|
|
|
18
18
|
|
|
19
19
|
'use strict';
|
|
20
20
|
|
|
21
|
+
// ==================== Izara Core Service Schemas ====================
|
|
21
22
|
const {
|
|
22
23
|
getObjSchemaS3WithHierarchy,
|
|
23
24
|
} = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
@@ -29,17 +30,33 @@ const {
|
|
|
29
30
|
const consts = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
30
31
|
|
|
31
32
|
const {
|
|
32
|
-
objInstanceFromObjInstanceBase
|
|
33
|
+
objInstanceFromObjInstanceBase,
|
|
33
34
|
} = require('@izara_project/izara-core-library-service-schemas/src/IdentifiersObject');
|
|
34
35
|
|
|
36
|
+
const {
|
|
37
|
+
createObjTypeConcat,
|
|
38
|
+
createObjType,
|
|
39
|
+
} = require('@izara_project/izara-core-library-service-schemas/src/Utils');
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// ==================== Izara Market Service Schemas ====================
|
|
35
43
|
const {
|
|
36
44
|
dynamoDbIdentifiersByStorageResource,
|
|
37
45
|
collectGetData,
|
|
38
46
|
createGetDataDetails,
|
|
39
47
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
|
|
40
48
|
|
|
41
|
-
const {
|
|
49
|
+
const {
|
|
50
|
+
TOPIC_NAME_GENERATE_CODE,
|
|
51
|
+
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
52
|
+
|
|
42
53
|
|
|
54
|
+
// ==================== Shared Core Libraries ====================
|
|
55
|
+
const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
|
|
56
|
+
const coreConsts = require('@izara_project/izara-core-library-core/src/Consts');
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// ==================== Shared Utility Libraries ====================
|
|
43
60
|
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
44
61
|
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
45
62
|
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
@@ -47,14 +64,16 @@ const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-
|
|
|
47
64
|
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
48
65
|
const graphSharedLib = require('@izara_project/izara-core-library-graph-service');
|
|
49
66
|
|
|
67
|
+
|
|
68
|
+
// ==================== External Services ====================
|
|
50
69
|
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
51
|
-
const sns = externalRequest.sns
|
|
70
|
+
const sns = externalRequest.sns;
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
// ==================== Optional Requires ====================
|
|
74
|
+
// (<optionalRequire>)
|
|
75
|
+
// (</optionalRequire>)
|
|
52
76
|
|
|
53
|
-
const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
|
|
54
|
-
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
55
|
-
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
56
|
-
//(<optionalRequire>)
|
|
57
|
-
//(</optionalRequire>)
|
|
58
77
|
/**
|
|
59
78
|
*
|
|
60
79
|
*
|
|
@@ -87,6 +106,7 @@ module.exports.getMain = async (
|
|
|
87
106
|
|
|
88
107
|
//(<beforeQuery>)
|
|
89
108
|
//(</beforeQuery>)
|
|
109
|
+
|
|
90
110
|
const objType = createObjType(requestParams.objectType)
|
|
91
111
|
let objectSchema = await getObjSchemaS3WithHierarchy(
|
|
92
112
|
_izContext,
|
|
@@ -95,6 +115,21 @@ module.exports.getMain = async (
|
|
|
95
115
|
|
|
96
116
|
_izContext.logger.debug("objectSchema: ", objectSchema);
|
|
97
117
|
|
|
118
|
+
let userId;
|
|
119
|
+
let targetId;
|
|
120
|
+
if (objectSchema.generatedBy === "userGenerated") {
|
|
121
|
+
userId = _izContext.correlationIds.get(coreConsts.BASE_USER_ID);
|
|
122
|
+
targetId = _izContext.correlationIds.get(coreConsts.TARGET_ID)
|
|
123
|
+
|
|
124
|
+
if (!userId) {
|
|
125
|
+
errorsFound.push("Not have userId")
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (objectSchema.hasOwnProperty("belongTo") && !targetId) {
|
|
129
|
+
errorsFound.push('not have targetId')
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
98
133
|
let getDataDetails = await createGetDataDetails(
|
|
99
134
|
_izContext,
|
|
100
135
|
objectSchema,
|
|
@@ -18,28 +18,48 @@ along with this program. If not, see
|
|
|
18
18
|
|
|
19
19
|
'use strict';
|
|
20
20
|
|
|
21
|
+
// ==================== Shared Core Utilities ====================
|
|
21
22
|
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
23
|
+
const coreConsts = require('@izara_project/izara-core-library-core/src/Consts');
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// ==================== Core Service Schemas ====================
|
|
22
27
|
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
23
28
|
const consts = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
29
|
+
const { createObjType } = require('@izara_project/izara-core-library-service-schemas/src/Utils');
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// ==================== Market Service Schemas ====================
|
|
24
33
|
const {
|
|
25
34
|
dynamoDbIdentifiersByStorageResource,
|
|
26
|
-
createFieldForUpdateDynamoDb
|
|
35
|
+
createFieldForUpdateDynamoDb,
|
|
36
|
+
createUpdateDataDetail,
|
|
27
37
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
PREFIX,
|
|
41
|
+
TOPIC_NAME_GENERATE_CODE,
|
|
42
|
+
TOPIC_NAME_GRAPH_HANDLER,
|
|
43
|
+
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
// ==================== Shared Libraries ====================
|
|
28
47
|
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
29
48
|
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
30
49
|
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
31
50
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
32
51
|
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
33
52
|
|
|
53
|
+
|
|
54
|
+
// ==================== External Services ====================
|
|
34
55
|
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
35
|
-
const sns = externalRequest.sns
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
//(</optionalRequire>)
|
|
56
|
+
const sns = externalRequest.sns;
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// ==================== Optional Requires ====================
|
|
60
|
+
// (<optionalRequire>)
|
|
61
|
+
// (</optionalRequire>)
|
|
62
|
+
|
|
43
63
|
/**
|
|
44
64
|
*
|
|
45
65
|
*
|