@izara_project/izara-core-generate-service-code 1.0.55 → 1.0.57
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/codeGenerators/app/initial_setup/InitialSetupGenerator.js +223 -123
- package/src/codeGenerators/app/initial_setup/templates/InitialSetup_LambdaRole.ejs +6 -6
- package/src/codeGenerators/app/sls_yaml/FindDataYamlGenerator.js +1 -1
- package/src/codeGenerators/app/sls_yaml/FunctionYamlGenerator.js +299 -197
- package/src/codeGenerators/app/sls_yaml/RoleNameConfigGenerator.js +84 -60
- package/src/codeGenerators/app/sls_yaml/SharedResourceYamlGenerator.js +304 -271
- package/src/codeGenerators/app/sls_yaml/__tests__/SharedResourceYamlGenerator.test.js +91 -32
- package/src/codeGenerators/app/sls_yaml/templates/SharedResource_Yaml.ejs +2 -2
- package/src/codeGenerators/app/src/generatedCode/Flow/{FlowEndpoints → FlowObjects}/EndpointsGenerator.js +1 -1
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/FlowRbac_Main.ejs +252 -0
- package/src/codeGenerators/app/src/generatedCode/Flow/{FlowRelationshipEndpoints → FlowRelationships}/RelationshipFlowGenerator.js +19 -3
- package/src/codeGenerators/app/src/generatedCode/Flow/{FlowRelationshipEndpoints → FlowRelationships}/templates/relationship/ProcessCreateRelationship_Main.ejs +1 -1
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/WebSocketGenerator.js +4 -4
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowClassifier.js +3 -2
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowMainFunctionBase.js +12 -5
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowValidator.js +1 -1
- package/src/codeGenerators/app/src/generatedCode/libs/templates/Consts.ejs +23 -23
- package/src/codeGenerators/resource/sls_yaml/DynamoDBGenerator.js +1 -1
- package/src/codeGenerators/resource/sls_yaml/FlowOutGenerator.js +3 -6
- package/src/codeGenerators/resource/sls_yaml/FlowResourceYamlGenerator.js +29 -10
- package/src/codeGenerators/resource/sls_yaml/templates/SystemDynamoDB_Yaml.ejs +64 -0
- package/src/generate.js +1 -1
- package/src/generateCode.js +14 -11
- package/src/generateSchema.js +1 -1
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/FlowSchemaGenerator.js +0 -1
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/RbacFlowSchemaGenerator.js +16 -2
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/RelationshipFlowSchemaGenerator.js +2 -2
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/DynamicFlowSchemaTemplate.ejs +12 -12
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/DynamicRbacFlowSchemaTemplate.ejs +1 -0
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/UserRbacFlowSchemaTemplate.ejs +22 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowEndpoints → FlowObjects}/.gitkeep +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowEndpoints → FlowObjects}/templates/FlowEndpointBeforeLogical_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowEndpoints → FlowObjects}/templates/crud/CreateEndpoint_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowEndpoints → FlowObjects}/templates/crud/DeleteEndpoint_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowEndpoints → FlowObjects}/templates/crud/GetEndpoint_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowEndpoints → FlowObjects}/templates/crud/UpdateEndpoint_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowRelationshipEndpoints → FlowRelationships}/templates/relationship/ProcessChangeRelationshipComplete_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowRelationshipEndpoints → FlowRelationships}/templates/relationship/ProcessChangeRelationship_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowRelationshipEndpoints → FlowRelationships}/templates/relationship/ProcessCreateRelationshipComplete_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowRelationshipEndpoints → FlowRelationships}/templates/relationship/ProcessDeleteRelationshipComplete_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowRelationshipEndpoints → FlowRelationships}/templates/relationship/ProcessDeleteRelationship_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowRelationshipEndpoints → FlowRelationships}/templates/relationship/ProcessGetRelationshipComplete_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowRelationshipEndpoints → FlowRelationships}/templates/relationship/ProcessGetRelationship_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowRelationshipEndpoints → FlowRelationships}/templates/relationship/ProcessMoveRelationshipComplete_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowRelationshipEndpoints → FlowRelationships}/templates/relationship/ProcessMoveRelationship_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowRelationshipEndpoints → FlowRelationships}/templates/relationship/ProcessUpdateRelationshipComplete_Main.ejs +0 -0
- /package/src/codeGenerators/app/src/generatedCode/Flow/{FlowRelationshipEndpoints → FlowRelationships}/templates/relationship/ProcessUpdateRelationship_Main.ejs +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-core-generate-service-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"description": "Code for locally generating per service files",
|
|
5
5
|
"homepage": "https://bitbucket.org/izara-core-support-services/izara-core-support-services-generate-service-code#readme",
|
|
6
6
|
"repository": {
|
|
@@ -7,143 +7,243 @@ import { getFlowsForGeneration } from '../src/generatedCode/Flow/_shared/shared/
|
|
|
7
7
|
const __filename = fileURLToPath(import.meta.url);
|
|
8
8
|
const __dirname = path.dirname(__filename);
|
|
9
9
|
|
|
10
|
+
const FLOW_OBJECTS_ROLE = 'FlowObjectsRole';
|
|
11
|
+
const CRUD_FLOW_TAGS = new Set(['Create', 'Update', 'Delete', 'Get']);
|
|
12
|
+
const RBAC_FLOW_TAGS = new Set([
|
|
13
|
+
'CreateTargetRole',
|
|
14
|
+
'ListTargetRole',
|
|
15
|
+
'DeleteTargetRole',
|
|
16
|
+
'CreateRolePermissions',
|
|
17
|
+
'ListRolePermissions',
|
|
18
|
+
'DeleteRolePermissions',
|
|
19
|
+
'CreateUserRole',
|
|
20
|
+
'ListUserInRoles',
|
|
21
|
+
'DeleteUserFromRole'
|
|
22
|
+
]);
|
|
23
|
+
const REL_FLOW_TAGS = new Set([
|
|
24
|
+
'CreateRelationship',
|
|
25
|
+
'UpdateRelationship',
|
|
26
|
+
'DeleteRelationship',
|
|
27
|
+
'GetRelationship',
|
|
28
|
+
'ChangeRelationship',
|
|
29
|
+
'MoveRelationship'
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
function upperCase(str) {
|
|
33
|
+
if (!str) return str;
|
|
34
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function detectRoleNames(allSchemas) {
|
|
38
|
+
const flows = getFlowsForGeneration(allSchemas);
|
|
39
|
+
const roleNames = new Set(['ProcFindDataRole']);
|
|
40
|
+
|
|
41
|
+
for (const flow of flows) {
|
|
42
|
+
if (!flow.flowTag) continue;
|
|
43
|
+
|
|
44
|
+
const upperFlowTag = upperCase(flow.flowTag);
|
|
45
|
+
|
|
46
|
+
if (CRUD_FLOW_TAGS.has(upperFlowTag)) {
|
|
47
|
+
roleNames.add(FLOW_OBJECTS_ROLE);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (RBAC_FLOW_TAGS.has(upperFlowTag) || upperFlowTag.endsWith('RbacFlow')) {
|
|
52
|
+
roleNames.add('FlowRbacRole');
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (REL_FLOW_TAGS.has(upperFlowTag)) {
|
|
57
|
+
roleNames.add('FlowRelationshipRole');
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if ((flow.event || []).includes('ownTopic')) {
|
|
62
|
+
roleNames.add('WebSocketMainRole');
|
|
63
|
+
// ponytail: removed continue; so custom flows with ownTopic get their own specific role
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
roleNames.add(`${upperFlowTag}Role`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return { flows, roleNames };
|
|
70
|
+
}
|
|
71
|
+
|
|
10
72
|
export async function generateInitialSetup(allSchemas, options) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
73
|
+
console.log(' [InitialSetupGenerator] Generating Initial Setup Scripts...');
|
|
74
|
+
|
|
75
|
+
const { flows, roleNames } = detectRoleNames(allSchemas);
|
|
76
|
+
const setupDir = path.join(options.outputPath, 'app', 'initial_setup');
|
|
77
|
+
const sourceDir = path.join(setupDir, 'generatedCode', 'source');
|
|
78
|
+
const hookDir = path.join(setupDir, 'generatedCode', 'hook');
|
|
79
|
+
|
|
80
|
+
await fs.mkdir(sourceDir, { recursive: true });
|
|
81
|
+
await fs.mkdir(hookDir, { recursive: true });
|
|
82
|
+
|
|
83
|
+
const tableNames = new Set();
|
|
84
|
+
const tableNameTpl = await fs.readFile(
|
|
85
|
+
path.join(__dirname, 'templates', 'InitialSetup_TableName.ejs'),
|
|
86
|
+
'utf-8'
|
|
87
|
+
);
|
|
88
|
+
const tableNameContent = ejs.render(tableNameTpl, {
|
|
89
|
+
tableNames: Array.from(tableNames)
|
|
90
|
+
});
|
|
91
|
+
await fs.writeFile(
|
|
92
|
+
path.join(sourceDir, 'generatedTableNameConfig.js'),
|
|
93
|
+
tableNameContent,
|
|
94
|
+
'utf-8'
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
const hardcodedSubscriptions = [
|
|
98
|
+
{
|
|
99
|
+
serviceTag: 'GraphHandler',
|
|
100
|
+
topicName: 'UpdateRelationship_Out',
|
|
101
|
+
sqsEndpoint: 'UpdateRelationshipComplete'
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
serviceTag: 'GraphHandler',
|
|
105
|
+
topicName: 'CreateRelationship_Out',
|
|
106
|
+
sqsEndpoint: 'CreateRelationshipComplete'
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
serviceTag: 'GraphHandler',
|
|
110
|
+
topicName: 'DeleteRelationship_Out',
|
|
111
|
+
sqsEndpoint: 'DeleteRelationshipComplete'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
serviceTag: 'GraphHandler',
|
|
115
|
+
topicName: 'UpdateNode_Out',
|
|
116
|
+
sqsEndpoint: 'UpdateComplete'
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
serviceTag: 'GraphHandler',
|
|
120
|
+
topicName: 'CreateNode_Out',
|
|
121
|
+
sqsEndpoint: 'CreateComplete'
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
serviceTag: 'GraphHandler',
|
|
125
|
+
topicName: 'ChangeRelationshipType_Out',
|
|
126
|
+
sqsEndpoint: 'ChangeRelationshipComplete'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
serviceTag: 'GraphHandler',
|
|
130
|
+
topicName: 'MoveRelationship_Out',
|
|
131
|
+
sqsEndpoint: 'MoveRelationshipComplete'
|
|
132
|
+
}
|
|
133
|
+
];
|
|
134
|
+
const snsTpl = await fs.readFile(
|
|
135
|
+
path.join(__dirname, 'templates', 'InitialSetup_SnsService.ejs'),
|
|
136
|
+
'utf-8'
|
|
137
|
+
);
|
|
138
|
+
const snsContent = ejs.render(snsTpl, { subscriptions: hardcodedSubscriptions });
|
|
139
|
+
await fs.writeFile(
|
|
140
|
+
path.join(sourceDir, 'generatedSnsServiceConfig.js'),
|
|
141
|
+
snsContent,
|
|
142
|
+
'utf-8'
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
const lambdaRoles = [
|
|
146
|
+
{
|
|
147
|
+
objectType: FLOW_OBJECTS_ROLE,
|
|
148
|
+
additionalResourcePermission: [
|
|
149
|
+
{
|
|
150
|
+
effect: 'Allow',
|
|
151
|
+
action: { lambda: ['InvokeFunction'] },
|
|
152
|
+
resource: [
|
|
153
|
+
'arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, "GetNodeHdrInv" ,"GraphHandler")}'
|
|
154
|
+
]
|
|
155
|
+
},
|
|
44
156
|
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
resource: ["arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, \"GetNodeHdrInv\" ,\"GraphHandler\")}"]
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
effect: "Allow",
|
|
54
|
-
action: { "sns": ["Publish"] },
|
|
55
|
-
resource: ["arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, \"UpdateNode_In\", \"GraphHandler\")}"]
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
effect: "Allow",
|
|
59
|
-
action: { "sns": ["Publish"] },
|
|
60
|
-
resource: ["arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, \"CreateNode_In\", \"GraphHandler\")}"]
|
|
61
|
-
}
|
|
62
|
-
]
|
|
157
|
+
effect: 'Allow',
|
|
158
|
+
action: { sns: ['Publish'] },
|
|
159
|
+
resource: [
|
|
160
|
+
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "UpdateNode_In", "GraphHandler")}'
|
|
161
|
+
]
|
|
63
162
|
},
|
|
64
163
|
{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
resource: ["arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, \"GetNodeHdrInv\" ,\"GraphHandler\")}"]
|
|
71
|
-
}
|
|
72
|
-
]
|
|
164
|
+
effect: 'Allow',
|
|
165
|
+
action: { sns: ['Publish'] },
|
|
166
|
+
resource: [
|
|
167
|
+
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "CreateNode_In", "GraphHandler")}'
|
|
168
|
+
]
|
|
73
169
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
resource: ["arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, \"ReservedDynamicUsage_In\", \"AccountLimits\")}"]
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
effect: "Allow",
|
|
89
|
-
action: { "lambda": ["InvokeFunction"] },
|
|
90
|
-
resource: ["arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, \"StaticLimitProcessHdrInv\" ,\"AccountLimits\")}"]
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
effect: "Allow",
|
|
94
|
-
action: { "sns": ["Publish"] },
|
|
95
|
-
resource: ["arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, \"CancelUsage_In\", \"AccountLimits\")}"]
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
effect: "Allow",
|
|
99
|
-
action: { "sns": ["Publish"] },
|
|
100
|
-
resource: [
|
|
101
|
-
"arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, \"ReservedDynamicUsageComplet_Out\", \"AccountLimits\")}",
|
|
102
|
-
"arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, \"ConfirmUsage_In\", \"AccountLimits\")}"
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
]
|
|
106
|
-
});
|
|
107
|
-
}
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
objectType: 'ProcFindDataRole',
|
|
174
|
+
additionalResourcePermission: [
|
|
175
|
+
{
|
|
176
|
+
effect: 'Allow',
|
|
177
|
+
action: { lambda: ['InvokeFunction'] },
|
|
178
|
+
resource: [
|
|
179
|
+
'arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, "GetNodeHdrInv" ,"GraphHandler")}'
|
|
180
|
+
]
|
|
108
181
|
}
|
|
182
|
+
]
|
|
109
183
|
}
|
|
184
|
+
];
|
|
110
185
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
186
|
+
for (const flow of flows) {
|
|
187
|
+
if (!flow.event || !flow.event.includes('s3')) continue;
|
|
188
|
+
|
|
189
|
+
lambdaRoles.push({
|
|
190
|
+
objectType: 'FlowSchemaUploadS3Role',
|
|
191
|
+
additionalResourcePermission: [
|
|
192
|
+
{
|
|
193
|
+
effect: 'Allow',
|
|
194
|
+
action: { sns: ['Publish'] },
|
|
195
|
+
resource: [
|
|
196
|
+
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "ReservedDynamicUsage_In", "AccountLimits")}'
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
effect: 'Allow',
|
|
201
|
+
action: { lambda: ['InvokeFunction'] },
|
|
202
|
+
resource: [
|
|
203
|
+
'arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, "StaticLimitProcessHdrInv" ,"AccountLimits")}'
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
effect: 'Allow',
|
|
208
|
+
action: { sns: ['Publish'] },
|
|
209
|
+
resource: [
|
|
210
|
+
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "CancelUsage_In", "AccountLimits")}'
|
|
211
|
+
]
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
effect: 'Allow',
|
|
215
|
+
action: { sns: ['Publish'] },
|
|
216
|
+
resource: [
|
|
217
|
+
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "ReservedDynamicUsageComplet_Out", "AccountLimits")}',
|
|
218
|
+
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "ConfirmUsage_In", "AccountLimits")}'
|
|
219
|
+
]
|
|
127
220
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
221
|
+
]
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const lambdaTpl = await fs.readFile(
|
|
226
|
+
path.join(__dirname, 'templates', 'InitialSetup_LambdaRole.ejs'),
|
|
227
|
+
'utf-8'
|
|
228
|
+
);
|
|
229
|
+
const lambdaContent = ejs.render(lambdaTpl, { datas: lambdaRoles });
|
|
230
|
+
await fs.writeFile(
|
|
231
|
+
path.join(sourceDir, 'generatedLambdaRoleServiceConfig.js'),
|
|
232
|
+
lambdaContent,
|
|
233
|
+
'utf-8'
|
|
234
|
+
);
|
|
138
235
|
|
|
139
|
-
|
|
236
|
+
const roleNameConfigContent = `export function generatedIntTestRoleNameConfig() {
|
|
140
237
|
let roleNameConfigIntTest = [
|
|
141
|
-
${Array.from(
|
|
238
|
+
${Array.from(roleNames)
|
|
239
|
+
.sort()
|
|
240
|
+
.map(roleName => ` "${roleName}",`)
|
|
241
|
+
.join('\n')}
|
|
142
242
|
];
|
|
143
243
|
return roleNameConfigIntTest;
|
|
144
244
|
}
|
|
145
245
|
`;
|
|
146
|
-
|
|
246
|
+
await fs.writeFile(path.join(sourceDir, 'RoleNameConfig.js'), roleNameConfigContent, 'utf-8');
|
|
147
247
|
|
|
148
|
-
|
|
248
|
+
console.log(` [InitialSetupGenerator] Wrote initial_setup scripts to ${sourceDir}`);
|
|
149
249
|
}
|
|
@@ -8,7 +8,7 @@ const _izContext = { logger: Logger };
|
|
|
8
8
|
|
|
9
9
|
export function generatedLambdaRole() {
|
|
10
10
|
const externalLambdaRole = [
|
|
11
|
-
<% datas.forEach((data
|
|
11
|
+
<% datas.forEach((data) => { %>
|
|
12
12
|
{
|
|
13
13
|
roleName: "<%- data.objectType %>",
|
|
14
14
|
statement: [
|
|
@@ -17,21 +17,21 @@ export function generatedLambdaRole() {
|
|
|
17
17
|
"Sid": "<%- data.objectType %>Test<%- resourceIdx %>",
|
|
18
18
|
"Effect": "<%- resourcePermission.effect %>",
|
|
19
19
|
"Action": [
|
|
20
|
-
<% Object.keys(resourcePermission.action).forEach(resourcePerAction => { %>
|
|
21
|
-
<% resourcePermission.action[resourcePerAction].forEach(permission => { %>
|
|
20
|
+
<% Object.keys(resourcePermission.action).forEach((resourcePerAction) => { %>
|
|
21
|
+
<% resourcePermission.action[resourcePerAction].forEach((permission) => { %>
|
|
22
22
|
"<%- resourcePerAction %>:<%- permission %>",
|
|
23
23
|
<% }) %>
|
|
24
24
|
<% }) %>
|
|
25
25
|
],
|
|
26
26
|
"Resource": [
|
|
27
|
-
<% resourcePermission.resource.forEach(resource => { %>
|
|
27
|
+
<% resourcePermission.resource.forEach((resource) => { %>
|
|
28
28
|
`<%- resource %>`,
|
|
29
29
|
<% }) %>
|
|
30
30
|
]
|
|
31
31
|
},
|
|
32
32
|
<% }) %>
|
|
33
|
-
//(<create<%- data.objectType %>Role>)
|
|
34
|
-
//(</create<%- data.objectType %>Role>)
|
|
33
|
+
//(<create<%- data.objectType.replace(/Role$/, '') %>Role>)
|
|
34
|
+
//(</create<%- data.objectType.replace(/Role$/, '') %>Role>)
|
|
35
35
|
]
|
|
36
36
|
},
|
|
37
37
|
<% }) %>
|
|
@@ -12,7 +12,7 @@ export async function generateFindDataYaml(options) {
|
|
|
12
12
|
path.join(__dirname, 'templates', 'FindData_Yaml.ejs'),
|
|
13
13
|
path.join(options.outputPath, 'app', 'sls_yaml', 'generatedCode', 'source', 'find-data.yml'),
|
|
14
14
|
{
|
|
15
|
-
functionName: '
|
|
15
|
+
functionName: 'FindDataHdrSqs',
|
|
16
16
|
handlerPath: 'src/generatedCode/FindData/source/FindData_HdrSqs.main',
|
|
17
17
|
roleName: 'ProcFindData',
|
|
18
18
|
upperFunctionName: 'FINDDATA',
|