@izara_project/izara-market-library-service-schemas 1.0.66 → 1.0.68
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 +13 -1
- package/src/MainLibs/src/Consts.js +34 -1
- package/src/MainLibs/src/GenerateCodeUtils.js +6 -6
- package/src/reStructure/GenerateCode.js +2 -1
- package/src/reStructure/TemplateData/EndpointPerService/generateTemplateData.js +1 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +35 -8
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +49 -5
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +8 -0
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +14 -0
- package/src/reStructure/TemplateData/findData/findDataYaml/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/dynamoDb/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowStep/functionYaml/data.js +3 -3
- package/src/reStructure/TemplateData/flowSchema/flowStep/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/data.js +4 -2
- package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/template.ejs +9 -9
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +24 -24
- package/src/reStructure/TemplateData/generateRole/data.js +38 -24
- package/src/reStructure/TemplateData/generateRole/template.ejs +5 -7
- package/src/reStructure/TemplateData/processLogical/yaml/data.js +3 -3
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/dsq/data.js +1 -1
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/sqs/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/data.js +29 -25
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/mainFunction/template.ejs +4 -4
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/data.js +37 -29
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +1 -4
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/data.js +37 -29
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +1 -4
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/data.js +37 -29
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +1 -4
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/data.js +36 -50
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/apiTemplate.ejs +15 -30
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/dsqTemplate.ejs +15 -30
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/invTemplate.ejs +15 -30
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/sqsTemplate.ejs +15 -30
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/functionYaml/data.js +1 -4
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/data.js +30 -27
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +1 -4
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +8 -7
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +36 -30
- package/src/reStructure/TemplateData/resourceYaml/generateTemplateData.js +2 -2
|
@@ -49,12 +49,12 @@ middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema(
|
|
|
49
49
|
let validatorSchema = {
|
|
50
50
|
type: "object",
|
|
51
51
|
required: [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
'firstObject',
|
|
53
|
+
'secondObject',
|
|
54
|
+
'relType',
|
|
55
|
+
'relationshipProperties',
|
|
56
|
+
'relationshipDirection',
|
|
57
|
+
'moveObject'
|
|
58
58
|
],
|
|
59
59
|
properties: {
|
|
60
60
|
firstObject: {
|
|
@@ -95,7 +95,7 @@ let validatorSchema = {
|
|
|
95
95
|
},
|
|
96
96
|
relType: {
|
|
97
97
|
type: "object",
|
|
98
|
-
required: ['serviceTag','relationshipTag'],
|
|
98
|
+
required: ['serviceTag', 'relationshipTag'],
|
|
99
99
|
properties: {
|
|
100
100
|
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
101
101
|
relationshipTag: izara.validatorSchema.stringNotEmpty()
|
|
@@ -103,37 +103,22 @@ let validatorSchema = {
|
|
|
103
103
|
},
|
|
104
104
|
relationshipDirection: {
|
|
105
105
|
type: "string",
|
|
106
|
-
enum: ['from','to']
|
|
106
|
+
enum: ['from', 'to']
|
|
107
107
|
},
|
|
108
|
-
|
|
108
|
+
relationshipProperties: {
|
|
109
109
|
type: "object",
|
|
110
110
|
minProperties: 1
|
|
111
111
|
},
|
|
112
112
|
moveObject: {
|
|
113
|
-
|
|
114
|
-
required: ['fromObjectRef','toObject'],
|
|
113
|
+
required: ["fromObjectRef", "moveToIdentifiers"],
|
|
115
114
|
properties: {
|
|
116
115
|
fromObjectRef: {
|
|
117
|
-
type:
|
|
118
|
-
enum: [
|
|
116
|
+
type: "string",
|
|
117
|
+
enum: ["firstObject", "secondObject"]
|
|
119
118
|
},
|
|
120
|
-
|
|
121
|
-
type:
|
|
122
|
-
|
|
123
|
-
properties: {
|
|
124
|
-
objType: {
|
|
125
|
-
type: 'object',
|
|
126
|
-
required: ['objectType', 'serviceTag'],
|
|
127
|
-
properties: {
|
|
128
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
129
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
identifiers: {
|
|
133
|
-
type: 'object',
|
|
134
|
-
minProperties: 1
|
|
135
|
-
}
|
|
136
|
-
}
|
|
119
|
+
moveToIdentifiers: {
|
|
120
|
+
type: "object",
|
|
121
|
+
minProperties: 1,
|
|
137
122
|
}
|
|
138
123
|
}
|
|
139
124
|
},
|
|
@@ -32,12 +32,12 @@ const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>
|
|
|
32
32
|
let validatorSchema = {
|
|
33
33
|
type: "object",
|
|
34
34
|
required: [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
'firstObject',
|
|
36
|
+
'secondObject',
|
|
37
|
+
'relType',
|
|
38
|
+
'relationshipProperties',
|
|
39
|
+
'relationshipDirection',
|
|
40
|
+
'moveObject'
|
|
41
41
|
],
|
|
42
42
|
properties: {
|
|
43
43
|
firstObject: {
|
|
@@ -78,7 +78,7 @@ let validatorSchema = {
|
|
|
78
78
|
},
|
|
79
79
|
relType: {
|
|
80
80
|
type: "object",
|
|
81
|
-
required: ['serviceTag','relationshipTag'],
|
|
81
|
+
required: ['serviceTag', 'relationshipTag'],
|
|
82
82
|
properties: {
|
|
83
83
|
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
84
84
|
relationshipTag: izara.validatorSchema.stringNotEmpty()
|
|
@@ -86,37 +86,22 @@ let validatorSchema = {
|
|
|
86
86
|
},
|
|
87
87
|
relationshipDirection: {
|
|
88
88
|
type: "string",
|
|
89
|
-
enum: ['from','to']
|
|
89
|
+
enum: ['from', 'to']
|
|
90
90
|
},
|
|
91
|
-
|
|
91
|
+
relationshipProperties: {
|
|
92
92
|
type: "object",
|
|
93
93
|
minProperties: 1
|
|
94
94
|
},
|
|
95
95
|
moveObject: {
|
|
96
|
-
|
|
97
|
-
required: ['fromObjectRef','toObject'],
|
|
96
|
+
required: ["fromObjectRef", "moveToIdentifiers"],
|
|
98
97
|
properties: {
|
|
99
98
|
fromObjectRef: {
|
|
100
|
-
type:
|
|
101
|
-
enum: [
|
|
99
|
+
type: "string",
|
|
100
|
+
enum: ["firstObject", "secondObject"]
|
|
102
101
|
},
|
|
103
|
-
|
|
104
|
-
type:
|
|
105
|
-
|
|
106
|
-
properties: {
|
|
107
|
-
objType: {
|
|
108
|
-
type: 'object',
|
|
109
|
-
required: ['objectType', 'serviceTag'],
|
|
110
|
-
properties: {
|
|
111
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
112
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
identifiers: {
|
|
116
|
-
type: 'object',
|
|
117
|
-
minProperties: 1
|
|
118
|
-
}
|
|
119
|
-
}
|
|
102
|
+
moveToIdentifiers: {
|
|
103
|
+
type: "object",
|
|
104
|
+
minProperties: 1,
|
|
120
105
|
}
|
|
121
106
|
}
|
|
122
107
|
},
|
|
@@ -33,12 +33,12 @@ middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
|
33
33
|
let validatorSchema = {
|
|
34
34
|
type: "object",
|
|
35
35
|
required: [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
'firstObject',
|
|
37
|
+
'secondObject',
|
|
38
|
+
'relType',
|
|
39
|
+
'relationshipProperties',
|
|
40
|
+
'relationshipDirection',
|
|
41
|
+
'moveObject'
|
|
42
42
|
],
|
|
43
43
|
properties: {
|
|
44
44
|
firstObject: {
|
|
@@ -79,7 +79,7 @@ let validatorSchema = {
|
|
|
79
79
|
},
|
|
80
80
|
relType: {
|
|
81
81
|
type: "object",
|
|
82
|
-
required: ['serviceTag','relationshipTag'],
|
|
82
|
+
required: ['serviceTag', 'relationshipTag'],
|
|
83
83
|
properties: {
|
|
84
84
|
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
85
85
|
relationshipTag: izara.validatorSchema.stringNotEmpty()
|
|
@@ -87,37 +87,22 @@ let validatorSchema = {
|
|
|
87
87
|
},
|
|
88
88
|
relationshipDirection: {
|
|
89
89
|
type: "string",
|
|
90
|
-
enum: ['from','to']
|
|
90
|
+
enum: ['from', 'to']
|
|
91
91
|
},
|
|
92
|
-
|
|
92
|
+
relationshipProperties: {
|
|
93
93
|
type: "object",
|
|
94
94
|
minProperties: 1
|
|
95
95
|
},
|
|
96
96
|
moveObject: {
|
|
97
|
-
|
|
98
|
-
required: ['fromObjectRef','toObject'],
|
|
97
|
+
required: ["fromObjectRef", "moveToIdentifiers"],
|
|
99
98
|
properties: {
|
|
100
99
|
fromObjectRef: {
|
|
101
|
-
type:
|
|
102
|
-
enum: [
|
|
100
|
+
type: "string",
|
|
101
|
+
enum: ["firstObject", "secondObject"]
|
|
103
102
|
},
|
|
104
|
-
|
|
105
|
-
type:
|
|
106
|
-
|
|
107
|
-
properties: {
|
|
108
|
-
objType: {
|
|
109
|
-
type: 'object',
|
|
110
|
-
required: ['objectType', 'serviceTag'],
|
|
111
|
-
properties: {
|
|
112
|
-
serviceTag: izara.validatorSchema.stringNotEmpty(),
|
|
113
|
-
objectType: izara.validatorSchema.stringNotEmpty()
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
identifiers: {
|
|
117
|
-
type: 'object',
|
|
118
|
-
minProperties: 1
|
|
119
|
-
}
|
|
120
|
-
}
|
|
103
|
+
moveToIdentifiers: {
|
|
104
|
+
type: "object",
|
|
105
|
+
minProperties: 1,
|
|
121
106
|
}
|
|
122
107
|
}
|
|
123
108
|
},
|
|
@@ -234,8 +234,8 @@ module.exports.<%- functionName %> = async (
|
|
|
234
234
|
if (errorsFound.length) {
|
|
235
235
|
|
|
236
236
|
let moveRelCompleteMsg = {
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
firstObject,
|
|
238
|
+
secondObject,
|
|
239
239
|
relType,
|
|
240
240
|
relationshipProperties,
|
|
241
241
|
relationshipDirection,
|
|
@@ -81,10 +81,7 @@ function createParamForCreateSource(srcPath) {
|
|
|
81
81
|
),
|
|
82
82
|
createIamRole(
|
|
83
83
|
{
|
|
84
|
-
[RESOURCE_CLASSES.sns]:
|
|
85
|
-
[
|
|
86
|
-
SNS_RESOURCE.publish, SNS_RESOURCE.subscribe
|
|
87
|
-
]
|
|
84
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe],
|
|
88
85
|
},
|
|
89
86
|
[
|
|
90
87
|
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/data.js
CHANGED
|
@@ -75,35 +75,38 @@ function createParamForCreateSource(allObjectRelationships, handlerType, srcPath
|
|
|
75
75
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
76
76
|
|
|
77
77
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
78
|
+
if (handlerType === HANDLER.hdrDsq) {
|
|
79
|
+
additionalResourcePermission.push(
|
|
80
|
+
createIamRole(
|
|
81
|
+
{
|
|
82
|
+
[RESOURCE_CLASSES.sqs]: Object.values(SQS_RESOURCE)
|
|
83
|
+
},
|
|
84
|
+
[
|
|
85
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
86
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
87
|
+
]
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
}
|
|
78
91
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
SQS_RESOURCE
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
]
|
|
95
|
-
),
|
|
96
|
-
createIamRole(
|
|
97
|
-
{
|
|
98
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
99
|
-
},
|
|
100
|
-
[
|
|
101
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.updateRelComplete) + "_Out"),
|
|
102
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
103
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
104
|
-
]
|
|
92
|
+
if (handlerType === HANDLER.hdrSqs) {
|
|
93
|
+
additionalResourcePermission.push(
|
|
94
|
+
createIamRole(
|
|
95
|
+
{
|
|
96
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe],
|
|
97
|
+
[RESOURCE_CLASSES.sqs]: Object.values(SQS_RESOURCE)
|
|
98
|
+
},
|
|
99
|
+
[
|
|
100
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.updateRelComplete) + "_Out"),
|
|
101
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
102
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
103
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
104
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
105
|
+
]
|
|
106
|
+
)
|
|
105
107
|
)
|
|
106
|
-
|
|
108
|
+
}
|
|
109
|
+
|
|
107
110
|
for (const relationship of allObjectRelationships) {
|
|
108
111
|
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
109
112
|
if (storageType === STORAGE_TYPES.dynamoDB) {
|
package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js
CHANGED
|
@@ -80,10 +80,7 @@ function createParamForCreateSource(srcPath) {
|
|
|
80
80
|
),
|
|
81
81
|
createIamRole(
|
|
82
82
|
{
|
|
83
|
-
[RESOURCE_CLASSES.sns]:
|
|
84
|
-
[
|
|
85
|
-
SNS_RESOURCE.publish, SNS_RESOURCE.subscribe
|
|
86
|
-
]
|
|
83
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe],
|
|
87
84
|
},
|
|
88
85
|
[
|
|
89
86
|
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js
CHANGED
|
@@ -49,7 +49,7 @@ const { getLocalConfig } = require('../../../../MainLibs/src/Utils.js')
|
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
51
|
function dataForMainDynamoDbYamlFromObjectSchema(_izContext, objectSchema, srcPath) {
|
|
52
|
-
let
|
|
52
|
+
let dynamoDbYamlTemplateData = [];
|
|
53
53
|
|
|
54
54
|
let identifierDetail = {};
|
|
55
55
|
for (let identifier of objectSchema.identifiers) { //check identifiers from objectSchema
|
|
@@ -119,10 +119,11 @@ function dataForMainDynamoDbYamlFromObjectSchema(_izContext, objectSchema, srcPa
|
|
|
119
119
|
// if (storageResource.hasOwnProperty("serviceTag") && storageResource.serviceTag !== getLocalConfig(srcPath)) {
|
|
120
120
|
// continue; // if serviceTag of storageResource not own service will skip
|
|
121
121
|
// }
|
|
122
|
+
|
|
122
123
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
123
124
|
let templateData = {
|
|
124
|
-
tableName: storageResource.tableName,
|
|
125
|
-
resourceName: storageResource.tableName,
|
|
125
|
+
tableName: upperCase(storageResource.tableName),
|
|
126
|
+
resourceName: upperCase(storageResource.tableName),
|
|
126
127
|
attributes: []
|
|
127
128
|
};
|
|
128
129
|
if (storageResource.hasOwnProperty("groupByPartitionKeyField")) {
|
|
@@ -145,11 +146,11 @@ function dataForMainDynamoDbYamlFromObjectSchema(_izContext, objectSchema, srcPa
|
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
// templateData.resourceName = upperCase(objectSchema.objectType)
|
|
148
|
-
|
|
149
|
+
dynamoDbYamlTemplateData.push(templateData)
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
|
-
|
|
152
|
-
return
|
|
152
|
+
// console.log("dynamoDbYamlTemplateData", dynamoDbYamlTemplateData)
|
|
153
|
+
return dynamoDbYamlTemplateData
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
const createSourceDataDynamoDB = (_izContext, objectSchema, srcPath) => {
|
|
@@ -158,7 +159,7 @@ const createSourceDataDynamoDB = (_izContext, objectSchema, srcPath) => {
|
|
|
158
159
|
|
|
159
160
|
|
|
160
161
|
const dynamoDbMainYamlDataList = dataForMainDynamoDbYamlFromObjectSchema(_izContext, objectSchema, srcPath)
|
|
161
|
-
|
|
162
|
+
// console.log("generateDynamoPerObjectSchema", objectSchema)
|
|
162
163
|
for (let dynamoDbMainYamlData of dynamoDbMainYamlDataList) {
|
|
163
164
|
resultsForCreateSource.push({
|
|
164
165
|
templatePath: templatePath,
|
|
@@ -30,53 +30,59 @@ const STORAGE_TYPES = {
|
|
|
30
30
|
graph: "graph"
|
|
31
31
|
}
|
|
32
32
|
const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../../../MainLibs/src/Consts')
|
|
33
|
-
const {
|
|
33
|
+
const { firstLetterUpperCase: upperCase, getLocalConfig } = require('../../../../MainLibs/src/Utils')
|
|
34
34
|
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
35
35
|
const { NoRetryError } = require("@izara_project/izara-core-library-core");
|
|
36
36
|
|
|
37
37
|
async function filterCreateResourceYaml(_izContext, createSourceParams, objSchemaPath) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (storageResource
|
|
56
|
-
|
|
38
|
+
try {
|
|
39
|
+
let tableNamesToFilter = new Set();
|
|
40
|
+
let ownServiceTag = getLocalConfig(path.join(objSchemaPath, "../../"), "iz_serviceTag")
|
|
41
|
+
|
|
42
|
+
const allLocalFlowSchema = await getObjectSchema.getAllLocalFlowSchemas(_izContext, objSchemaPath);
|
|
43
|
+
await Promise.all(allLocalFlowSchema.records.map(async (flowSchema) => {
|
|
44
|
+
if (flowSchema.statusType === "storedCache") {
|
|
45
|
+
tableNamesToFilter.add(...await getTableNameFromFlowSchema(_izContext, flowSchema, objSchemaPath))
|
|
46
|
+
} else if (flowSchema.statusType === "triggerCache") {
|
|
47
|
+
tableNamesToFilter.add(...await getTableNameFromFlowSchema(_izContext, flowSchema, objSchemaPath))
|
|
48
|
+
}
|
|
49
|
+
}))
|
|
50
|
+
|
|
51
|
+
const allLocalObjSchema = await getObjectSchema.getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
|
|
52
|
+
await Promise.all(allLocalObjSchema.records.map(async (objSchema) => {
|
|
53
|
+
if (objSchema.hasOwnProperty("extendObjType")) {
|
|
54
|
+
for (const storageResource of Object.values(objSchema.storageResources)) {
|
|
55
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
56
|
+
if (storageResource?.serviceTag !== ownServiceTag) {
|
|
57
|
+
tableNamesToFilter.has(storageResource.tableName)
|
|
58
|
+
}
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
+
}))
|
|
63
|
+
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
// console.log("tableNamesToFilter", tableNamesToFilter)
|
|
66
|
+
let filteredCreateSourceParams = createSourceParams.filter(
|
|
67
|
+
(result) => !tableNamesToFilter.has(result.templateData.tableName)
|
|
68
|
+
)
|
|
66
69
|
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
// console.log("filteredCreateSourceParams", filteredCreateSourceParams)
|
|
71
|
+
return filteredCreateSourceParams
|
|
72
|
+
} catch (err) {
|
|
73
|
+
console.log(err)
|
|
74
|
+
}
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
module.exports = filterCreateResourceYaml;
|
|
72
78
|
|
|
73
|
-
async function
|
|
74
|
-
let tableNameStoredCache =
|
|
79
|
+
async function getTableNameFromFlowSchema(_izContext, flowSchema, objSchemaPath) {
|
|
80
|
+
let tableNameStoredCache = [];
|
|
75
81
|
const objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], objSchemaPath).then(res => res.records[0])
|
|
76
82
|
if (objectSchema) {
|
|
77
83
|
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
78
84
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
79
|
-
tableNameStoredCache.
|
|
85
|
+
tableNameStoredCache.push(upperCase(storageResource.tableName));
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
88
|
} else {
|
|
@@ -61,7 +61,6 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
61
61
|
try {
|
|
62
62
|
|
|
63
63
|
let createSourceDynamoDb = createSourceDataDynamoDB(_izContext, objectSchema, saveFilePath)
|
|
64
|
-
|
|
65
64
|
const [dynamoResources, updatedTableYaml] = checkValidTableYaml(
|
|
66
65
|
_izContext,
|
|
67
66
|
createSourceDynamoDb,
|
|
@@ -78,7 +77,6 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
|
-
|
|
82
80
|
// Add default resources
|
|
83
81
|
const defaultDynamoDbResources = createDefaultDynamoDb(_izContext, saveFilePath);
|
|
84
82
|
const defaultSnsInSqsResources = createFindDataAndProcessLogicalDefaultSnsInSqs(_izContext, saveFilePath);
|
|
@@ -97,6 +95,8 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
97
95
|
...dynamoDbResourcePerRelationshipLink
|
|
98
96
|
)
|
|
99
97
|
}
|
|
98
|
+
|
|
99
|
+
// console.log("createSourceParams before filter", createSourceParams)
|
|
100
100
|
const filteredCreateSourceParams = await filterCreateResourceYaml(_izContext, createSourceParams, objSchemaPath);
|
|
101
101
|
|
|
102
102
|
// console.log("filteredCreateSourceParams", filteredCreateSourceParams);
|