@izara_project/izara-core-generate-service-code 1.0.97 → 1.0.99
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/compile/flowValidator.js +45 -8
- package/src/compile/loadSchemas.js +26 -6
- package/src/emit/application/coreFunction/emitCoreFunctionArtifacts.js +15 -1
- package/src/emit/application/coreFunction/templates/InitialSetupConfig.ejs +8 -4
- package/src/emit/application/crud/templates/CreateEndpoint_Main.ejs +4 -4
- package/src/emit/application/crud/templates/CreateLogicalLib.ejs +60 -8
- package/src/emit/application/crud/templates/DeleteEndpoint_Main.ejs +4 -4
- package/src/emit/application/crud/templates/FlowEndpoint_HdrWbs.ejs +2 -2
- package/src/emit/application/crud/templates/FlowMain_Wbs.ejs +2 -2
- package/src/emit/application/crud/templates/UpdateEndpoint_Main.ejs +4 -4
- package/src/emit/application/custom/customFlowS3.js +4 -4
- package/src/emit/application/custom/templates/FlowEndpoint_Main.ejs +2 -2
- package/src/emit/application/custom/templates/s3/CreateObject_Main.ejs +5 -2
- package/src/emit/application/custom/templates/triggerCache/CheckTriggerCache_Main.ejs +2 -2
- package/src/emit/application/rbac/emitDynamicRbacFlowSchemas.js +4 -1
- package/src/emit/application/rbac/emitRbacApplicationArtifacts.js +76 -1
- package/src/emit/application/rbac/templates/ReservedDynamicUsage_Main.ejs +2 -0
- package/src/emit/application/rbac/templates/ReservedUsageTtlExpired_HdrDss.ejs +176 -0
- package/src/emit/application/relationship/templates/ChangeRelationship_Main.ejs +3 -2
- package/src/emit/application/relationship/templates/CreateRelationship_Main.ejs +3 -2
- package/src/emit/application/relationship/templates/DeleteRelationship_Main.ejs +3 -2
- package/src/emit/application/relationship/templates/GetRelationship_Main.ejs +3 -2
- package/src/emit/application/relationship/templates/MoveRelationship_Main.ejs +3 -2
- package/src/emit/application/relationship/templates/UpdateRelationship_Main.ejs +3 -2
- package/src/emit/application/system/templates/RegisterComplete_Main.ejs +6 -2
- package/src/emit/application/system/templates/Register_Main.ejs +6 -2
- package/src/emit/application/system/templates/WebSocketComplete_Main.ejs +3 -3
- package/src/emit/infrastructure/functions/functionYamlArtifact.js +28 -0
- package/src/emit/infrastructure/functions/templates/DssFunction_Yaml.ejs +21 -0
- package/src/emit/infrastructure/resources/iamResourceArtifacts.js +46 -6
- package/src/emit/infrastructure/resources/templates/GeneratedLambdaRoleServiceConfig.ejs +5 -3
- package/src/emit/schemas/attributeTree/emitAttributeTreeSchemas.js +75 -22
- package/src/emit/schemas/ledger/emitLedgerSchemas.js +33 -11
- package/src/emit/schemas/ledger/templates/LedgerObjectSchema.ejs +3 -0
- package/src/emit/schemas/ledger/templates/LedgerRelationshipSchema.ejs +1 -0
- package/src/emit/schemas/propertyValue/emitPropertyValueSchemas.js +329 -0
- package/src/generate.js +10 -73
- package/src/output/mergeHooks.js +169 -15
- package/src/plan/domainRegistry.js +31 -5
- package/task.md +76 -0
- package/test/integration/graphDrivenFlowSchema.test.js +58 -0
- package/test/integration/publicApi.test.js +54 -1
- package/test/unit/application/createTargetRoleHandler.test.js +70 -1
- package/test/unit/application/crudApplicationArtifacts.test.js +4 -0
- package/test/unit/application/customFlowApplicationArtifacts.test.js +9 -0
- package/test/unit/application/relationshipApplicationArtifacts.test.js +30 -0
- package/test/unit/infrastructure/resourceArtifacts.test.js +53 -0
- package/test/unit/output/mergeHooks.test.js +405 -0
- package/test/unit/schemas/attributeTreeSchemas.test.js +41 -63
- package/test/unit/schemas/attributeTreeSingleService.test.js +175 -0
- package/test/unit/schemas/ledgerSchemas.test.js +33 -7
- package/test/unit/schemas/propertyValueSchemas.test.js +265 -0
- package/test/unit/templates/hookTagsValidation.test.js +83 -0
- package/src/emit/schemas/attributeTree/emitAttributeTreeTargetSchemas.js +0 -153
- package/src/emit/schemas/attributeTree/resolveTargetServicePath.js +0 -111
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.99",
|
|
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": {
|
|
@@ -9,6 +9,15 @@ export const VALID_EVENT_ENUM = [
|
|
|
9
9
|
'generateCode'
|
|
10
10
|
];
|
|
11
11
|
|
|
12
|
+
export const VALID_S3_STEP_NAMES = [
|
|
13
|
+
'CreateObject',
|
|
14
|
+
'ReservedLimit',
|
|
15
|
+
'CreatePreSignUrl',
|
|
16
|
+
'ProcessAfterUpload',
|
|
17
|
+
'ConfirmAfterUpload'
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
|
|
12
21
|
export function validateFlowSchema(flowSchema) {
|
|
13
22
|
if (!flowSchema || typeof flowSchema !== 'object') {
|
|
14
23
|
throw new TypeError('flowSchema must be an object');
|
|
@@ -188,14 +197,19 @@ export function validateFlowSchema(flowSchema) {
|
|
|
188
197
|
}
|
|
189
198
|
}
|
|
190
199
|
|
|
200
|
+
const flowEvents = flowSchema.event;
|
|
201
|
+
const isS3Flow = Array.isArray(flowEvents) && flowEvents.includes('s3');
|
|
202
|
+
|
|
191
203
|
const steps = flowSchema.flowSteps;
|
|
192
204
|
if (!Array.isArray(steps) || steps.length === 0) {
|
|
205
|
+
if (isS3Flow) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
193
208
|
throw new Error(
|
|
194
209
|
'FlowSchema validation error: flowSteps must be a non-empty array'
|
|
195
210
|
);
|
|
196
211
|
}
|
|
197
212
|
|
|
198
|
-
const flowEvents = flowSchema.event;
|
|
199
213
|
const syncEvents = ['lambdaSyncInv', 'lambdaSyncApi'];
|
|
200
214
|
let hasSyncEvent = false;
|
|
201
215
|
for (const eventName of flowEvents) {
|
|
@@ -220,16 +234,28 @@ export function validateFlowSchema(flowSchema) {
|
|
|
220
234
|
}
|
|
221
235
|
|
|
222
236
|
const entryStep = steps[0];
|
|
223
|
-
if (
|
|
224
|
-
!entryStep ||
|
|
225
|
-
typeof entryStep !== 'object' ||
|
|
226
|
-
entryStep.stepName !== 'Start'
|
|
227
|
-
) {
|
|
237
|
+
if (!entryStep || typeof entryStep !== 'object') {
|
|
228
238
|
throw new Error(
|
|
229
|
-
|
|
239
|
+
'FlowSchema validation error: flowSteps[0] must be an object'
|
|
230
240
|
);
|
|
231
241
|
}
|
|
232
242
|
|
|
243
|
+
if (isS3Flow) {
|
|
244
|
+
const validS3EntrySteps = ['Start', 'CreateObject'];
|
|
245
|
+
if (!validS3EntrySteps.includes(entryStep.stepName)) {
|
|
246
|
+
throw new Error(
|
|
247
|
+
`FlowSchema validation error: Entry step flowSteps[0] for s3 flow ` +
|
|
248
|
+
`must have stepName 'CreateObject' or 'Start', got '${entryStep.stepName}'`
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
if (entryStep.stepName !== 'Start') {
|
|
253
|
+
throw new Error(
|
|
254
|
+
"FlowSchema validation error: Entry step flowSteps[0] must have stepName fixed to 'Start'"
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
233
259
|
if (
|
|
234
260
|
entryStep.previousSteps &&
|
|
235
261
|
Array.isArray(entryStep.previousSteps) &&
|
|
@@ -240,7 +266,7 @@ export function validateFlowSchema(flowSchema) {
|
|
|
240
266
|
);
|
|
241
267
|
}
|
|
242
268
|
|
|
243
|
-
if (entryStep.event) {
|
|
269
|
+
if (!isS3Flow && entryStep.event) {
|
|
244
270
|
throw new Error(
|
|
245
271
|
"FlowSchema validation error: Entry step flowSteps[0] must not define step-level 'event'"
|
|
246
272
|
);
|
|
@@ -266,6 +292,17 @@ export function validateFlowSchema(flowSchema) {
|
|
|
266
292
|
);
|
|
267
293
|
}
|
|
268
294
|
|
|
295
|
+
if (
|
|
296
|
+
isS3Flow &&
|
|
297
|
+
step.stepName !== 'Start' &&
|
|
298
|
+
!VALID_S3_STEP_NAMES.includes(step.stepName)
|
|
299
|
+
) {
|
|
300
|
+
throw new Error(
|
|
301
|
+
`FlowSchema validation error: flowSteps[${idx}].stepName '${step.stepName}' ` +
|
|
302
|
+
`is invalid for s3 flow. Must be one of ${JSON.stringify(VALID_S3_STEP_NAMES)}`
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
269
306
|
if (step.stepName.toLowerCase().includes('checktrigger')) {
|
|
270
307
|
if (
|
|
271
308
|
!Array.isArray(flowSchema.triggerFlowTypes) ||
|
|
@@ -28,6 +28,7 @@ const consoleLogger = {
|
|
|
28
28
|
|
|
29
29
|
export { resolveExtendedObjectSchemas, resolveGraphServiceTags };
|
|
30
30
|
|
|
31
|
+
|
|
31
32
|
export async function loadLocalSchemaDirectory(
|
|
32
33
|
project,
|
|
33
34
|
directoryName,
|
|
@@ -37,7 +38,10 @@ export async function loadLocalSchemaDirectory(
|
|
|
37
38
|
const logger = options.logger || consoleLogger;
|
|
38
39
|
let entries;
|
|
39
40
|
try {
|
|
40
|
-
entries = await readdir(directoryPath, {
|
|
41
|
+
entries = await readdir(directoryPath, {
|
|
42
|
+
recursive: true,
|
|
43
|
+
withFileTypes: true
|
|
44
|
+
});
|
|
41
45
|
} catch (error) {
|
|
42
46
|
if (error.code === 'ENOENT') {
|
|
43
47
|
return [];
|
|
@@ -45,14 +49,30 @@ export async function loadLocalSchemaDirectory(
|
|
|
45
49
|
throw error;
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
const validEntries = entries.filter(
|
|
49
|
-
(entry
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
const validEntries = entries.filter((entry) => {
|
|
53
|
+
if (!entry.isFile() || !entry.name.endsWith('.js')) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
if (directoryName === 'FlowSchemas') {
|
|
57
|
+
const parentDir = entry.parentPath || entry.path || '';
|
|
58
|
+
if (parentDir.includes('generateCode')) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
});
|
|
64
|
+
validEntries.sort((a, b) => {
|
|
65
|
+
const aParent = a.parentPath || a.path || directoryPath;
|
|
66
|
+
const bParent = b.parentPath || b.path || directoryPath;
|
|
67
|
+
const aPath = join(aParent, a.name);
|
|
68
|
+
const bPath = join(bParent, b.name);
|
|
69
|
+
return aPath.localeCompare(bPath);
|
|
70
|
+
});
|
|
52
71
|
|
|
53
72
|
const schemas = [];
|
|
54
73
|
for (const entry of validEntries) {
|
|
55
|
-
const
|
|
74
|
+
const parentDir = entry.parentPath || entry.path || directoryPath;
|
|
75
|
+
const filePath = join(parentDir, entry.name);
|
|
56
76
|
const details = await stat(filePath);
|
|
57
77
|
const module = await import(
|
|
58
78
|
`${pathToFileURL(filePath).href}?schemaVersion=${details.mtimeMs}-${details.size}`
|
|
@@ -206,7 +206,21 @@ export async function emitCoreFunctionArtifacts({ project, objects = [], relatio
|
|
|
206
206
|
if (typeof flow.flowTag === 'string' && flow.flowTag) {
|
|
207
207
|
roleName = flow.flowTag[0].toUpperCase() + flow.flowTag.slice(1);
|
|
208
208
|
}
|
|
209
|
-
|
|
209
|
+
let quotaServiceTag = flow.quotaServiceTag;
|
|
210
|
+
if (!quotaServiceTag && flow.belongTo) {
|
|
211
|
+
if (Array.isArray(flow.belongTo)) {
|
|
212
|
+
quotaServiceTag = flow.belongTo[0]?.serviceTag;
|
|
213
|
+
} else if (flow.belongTo.serviceTag) {
|
|
214
|
+
quotaServiceTag = flow.belongTo.serviceTag;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (!quotaServiceTag && flow.objType?.serviceTag) {
|
|
218
|
+
quotaServiceTag = flow.objType.serviceTag;
|
|
219
|
+
}
|
|
220
|
+
if (!quotaServiceTag) {
|
|
221
|
+
quotaServiceTag = project?.serviceTag || 'Rbac';
|
|
222
|
+
}
|
|
223
|
+
return { roleName, quotaServiceTag };
|
|
210
224
|
});
|
|
211
225
|
|
|
212
226
|
const rbac =
|
|
@@ -277,7 +277,9 @@ function roleConfigs() {
|
|
|
277
277
|
`arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'ConfirmUsageHdrInv', 'Rbac')}`,
|
|
278
278
|
`arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'CancelUsageHdrInv', 'Rbac')}`<% if (rbac) { %>,
|
|
279
279
|
`arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'ValidatorRbacHdrInv')}`<% } %><% (rbacValidatorServiceTags || []).forEach(function(tag) { %>,
|
|
280
|
-
`arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'ValidatorRbacHdrInv', '<%= tag %>')}
|
|
280
|
+
`arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'ValidatorRbacHdrInv', '<%= tag %>')}`,
|
|
281
|
+
`arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'ConfirmUsageHdrInv', '<%= tag %>')}`,
|
|
282
|
+
`arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'CancelUsageHdrInv', '<%= tag %>')}`<% }); %>
|
|
281
283
|
]
|
|
282
284
|
},
|
|
283
285
|
|
|
@@ -290,7 +292,9 @@ function roleConfigs() {
|
|
|
290
292
|
`arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, 'ConfirmUsage_In', 'Rbac')}`,
|
|
291
293
|
`arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, 'CancelUsage_In', 'Rbac')}`<% if (rbac) { %>,
|
|
292
294
|
`arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, 'ValidatorRbac_In')}`<% } %><% (rbacValidatorServiceTags || []).forEach(function(tag) { %>,
|
|
293
|
-
`arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, 'ValidatorRbac_In', '<%= tag %>')}
|
|
295
|
+
`arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, 'ValidatorRbac_In', '<%= tag %>')}`,
|
|
296
|
+
`arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, 'ConfirmUsage_In', '<%= tag %>')}`,
|
|
297
|
+
`arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, 'CancelUsage_In', '<%= tag %>')}`<% }); %>
|
|
294
298
|
]
|
|
295
299
|
},
|
|
296
300
|
<% } -%>
|
|
@@ -390,7 +394,7 @@ function roleConfigs() {
|
|
|
390
394
|
Effect: 'Allow',
|
|
391
395
|
Action: ['sns:Publish'],
|
|
392
396
|
Resource: [
|
|
393
|
-
`arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, 'ReservedDynamicUsage_In', '
|
|
397
|
+
`arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, 'ReservedDynamicUsage_In', '<%= flow.quotaServiceTag || 'Rbac' %>')}`
|
|
394
398
|
]
|
|
395
399
|
},
|
|
396
400
|
|
|
@@ -399,7 +403,7 @@ function roleConfigs() {
|
|
|
399
403
|
Effect: 'Allow',
|
|
400
404
|
Action: ['sns:Publish'],
|
|
401
405
|
Resource: [
|
|
402
|
-
`arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, 'ConfirmDynamicAfterUpload_In', '
|
|
406
|
+
`arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, 'ConfirmDynamicAfterUpload_In', '<%= flow.quotaServiceTag || 'Rbac' %>')}`
|
|
403
407
|
]
|
|
404
408
|
}
|
|
405
409
|
//(<create<%= flow.roleName %>Role>)
|
|
@@ -142,9 +142,9 @@ export default async function <%- flowTag %>(
|
|
|
142
142
|
const { checkRbacPermission } =
|
|
143
143
|
await import('@izara_project/izara-authorization');
|
|
144
144
|
|
|
145
|
-
//(<rbacParameterGroups_<%- flowTag
|
|
145
|
+
//(<rbacParameterGroups_<%- flowTag %>>)
|
|
146
146
|
const parameterGroups = {};
|
|
147
|
-
//(</rbacParameterGroups_<%- flowTag
|
|
147
|
+
//(</rbacParameterGroups_<%- flowTag %>>)
|
|
148
148
|
|
|
149
149
|
const isBillable = objectSchema.addOnDataStructure?.some(
|
|
150
150
|
(item) => item.type === 'rbac' && item.billable === true
|
|
@@ -187,8 +187,8 @@ export default async function <%- flowTag %>(
|
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
//(<rbacPublish_<%- flowTag
|
|
191
|
-
//(</rbacPublish_<%- flowTag
|
|
190
|
+
//(<rbacPublish_<%- flowTag %>>)
|
|
191
|
+
//(</rbacPublish_<%- flowTag %>>)
|
|
192
192
|
}
|
|
193
193
|
<%_ } _%>
|
|
194
194
|
|
|
@@ -499,6 +499,24 @@ const ROOT_RBAC_OBJECT_TYPES = new Set([
|
|
|
499
499
|
<%_ } _%>
|
|
500
500
|
]);
|
|
501
501
|
|
|
502
|
+
<%_
|
|
503
|
+
const objectQuotaServiceTags = {};
|
|
504
|
+
for (const obj of objects || []) {
|
|
505
|
+
if (obj?.objectType) {
|
|
506
|
+
let serviceTag = null;
|
|
507
|
+
if (obj.belongTo) {
|
|
508
|
+
if (Array.isArray(obj.belongTo)) {
|
|
509
|
+
serviceTag = obj.belongTo[0]?.serviceTag || null;
|
|
510
|
+
} else if (obj.belongTo.serviceTag) {
|
|
511
|
+
serviceTag = obj.belongTo.serviceTag;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
objectQuotaServiceTags[obj.objectType] = serviceTag;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
_%>
|
|
518
|
+
const OBJECT_QUOTA_SERVICE_TAGS = <%- JSON.stringify(objectQuotaServiceTags) %>;
|
|
519
|
+
|
|
502
520
|
/**
|
|
503
521
|
* Auto-provisions owner TargetRole for Root RBAC object after Graph and DynamoDB write
|
|
504
522
|
* @param {Object} _izContext - Izara context object
|
|
@@ -772,6 +790,30 @@ export function resolveQuotaDeductionKeys(
|
|
|
772
790
|
passBackProperties?.rbacType ||
|
|
773
791
|
callingFlowConfig?.rbacType;
|
|
774
792
|
|
|
793
|
+
const objType =
|
|
794
|
+
returnValue?.requestParams?.objType ||
|
|
795
|
+
requestParams?.objType ||
|
|
796
|
+
passBackProperties?.objType;
|
|
797
|
+
let objectType = null;
|
|
798
|
+
if (typeof objType === 'string') {
|
|
799
|
+
objectType = objType;
|
|
800
|
+
} else if (objType && objType.objectType) {
|
|
801
|
+
objectType = objType.objectType;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
let quotaServiceTag =
|
|
805
|
+
requestParams?.passBackProperties?.quotaServiceTag ||
|
|
806
|
+
passBackProperties?.passBackProperties?.quotaServiceTag ||
|
|
807
|
+
passBackProperties?.quotaServiceTag ||
|
|
808
|
+
callingFlowConfig?.quotaServiceTag;
|
|
809
|
+
|
|
810
|
+
if (!quotaServiceTag && objectType && OBJECT_QUOTA_SERVICE_TAGS[objectType]) {
|
|
811
|
+
quotaServiceTag = OBJECT_QUOTA_SERVICE_TAGS[objectType];
|
|
812
|
+
}
|
|
813
|
+
if (!quotaServiceTag) {
|
|
814
|
+
quotaServiceTag = process.env.iz_serviceTag;
|
|
815
|
+
}
|
|
816
|
+
|
|
775
817
|
return {
|
|
776
818
|
limitTag,
|
|
777
819
|
flowTypeConcat,
|
|
@@ -780,7 +822,8 @@ export function resolveQuotaDeductionKeys(
|
|
|
780
822
|
runningTotalReservedId,
|
|
781
823
|
identifiersConcat,
|
|
782
824
|
targetIdentifiers,
|
|
783
|
-
rbacType
|
|
825
|
+
rbacType,
|
|
826
|
+
quotaServiceTag
|
|
784
827
|
};
|
|
785
828
|
}
|
|
786
829
|
|
|
@@ -808,10 +851,15 @@ export async function forwardToQuotaConfirmation(
|
|
|
808
851
|
targetFunction = 'ConfirmUsageHdrInv';
|
|
809
852
|
}
|
|
810
853
|
|
|
854
|
+
let quotaServiceTag = quotaKeys.quotaServiceTag;
|
|
855
|
+
if (!quotaServiceTag) {
|
|
856
|
+
quotaServiceTag = process.env.iz_serviceTag;
|
|
857
|
+
}
|
|
858
|
+
|
|
811
859
|
const functionName = await lambdaSharedLib.lambdaFunctionName(
|
|
812
860
|
_izContext,
|
|
813
861
|
targetFunction,
|
|
814
|
-
|
|
862
|
+
quotaServiceTag
|
|
815
863
|
);
|
|
816
864
|
|
|
817
865
|
const forwardMessage = {
|
|
@@ -820,11 +868,15 @@ export async function forwardToQuotaConfirmation(
|
|
|
820
868
|
callingFlowConfig
|
|
821
869
|
};
|
|
822
870
|
|
|
823
|
-
_izContext.logger.debug(
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
871
|
+
_izContext.logger.debug(
|
|
872
|
+
`[CreateLogicalLib] invoking ${quotaServiceTag} quota sync`,
|
|
873
|
+
{
|
|
874
|
+
targetFunction,
|
|
875
|
+
functionName,
|
|
876
|
+
quotaServiceTag,
|
|
877
|
+
forwardMessage
|
|
878
|
+
}
|
|
879
|
+
);
|
|
828
880
|
|
|
829
881
|
try {
|
|
830
882
|
quotaResult = await lambda.invokeSync(
|
|
@@ -842,7 +894,7 @@ export async function forwardToQuotaConfirmation(
|
|
|
842
894
|
const cancelFunctionName = await lambdaSharedLib.lambdaFunctionName(
|
|
843
895
|
_izContext,
|
|
844
896
|
'CancelUsageHdrInv',
|
|
845
|
-
|
|
897
|
+
quotaServiceTag
|
|
846
898
|
);
|
|
847
899
|
await lambda.invokeSync(
|
|
848
900
|
_izContext,
|
|
@@ -144,9 +144,9 @@ export default async function <%- flowTag %>(
|
|
|
144
144
|
const { checkRbacPermission } =
|
|
145
145
|
await import('@izara_project/izara-authorization');
|
|
146
146
|
|
|
147
|
-
//(<rbacParameterGroups_<%- flowTag
|
|
147
|
+
//(<rbacParameterGroups_<%- flowTag %>>)
|
|
148
148
|
const parameterGroups = {};
|
|
149
|
-
//(</rbacParameterGroups_<%- flowTag
|
|
149
|
+
//(</rbacParameterGroups_<%- flowTag %>>)
|
|
150
150
|
|
|
151
151
|
const resultPermissionCheck = await checkRbacPermission(
|
|
152
152
|
_izContext,
|
|
@@ -181,8 +181,8 @@ export default async function <%- flowTag %>(
|
|
|
181
181
|
);
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
//(<rbacPublish_<%- flowTag
|
|
185
|
-
//(</rbacPublish_<%- flowTag
|
|
184
|
+
//(<rbacPublish_<%- flowTag %>>)
|
|
185
|
+
//(</rbacPublish_<%- flowTag %>>)
|
|
186
186
|
}
|
|
187
187
|
<%_ } _%>
|
|
188
188
|
|
|
@@ -26,7 +26,7 @@ import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow
|
|
|
26
26
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
27
27
|
import {
|
|
28
28
|
utils,
|
|
29
|
-
|
|
29
|
+
getFlowSchema
|
|
30
30
|
} from '@izara_project/izara-core-library-service-schemas';
|
|
31
31
|
const { createFlowTypeConcat } = utils;
|
|
32
32
|
|
|
@@ -70,7 +70,7 @@ export const main = middleware.wrap(async (event, context) => {
|
|
|
70
70
|
let identifiers = '';
|
|
71
71
|
//(</createIdentifiersFlow>)
|
|
72
72
|
|
|
73
|
-
let flowSchema = await
|
|
73
|
+
let flowSchema = await getFlowSchema.getFlowSchemaS3WithCache(
|
|
74
74
|
event._izContext,
|
|
75
75
|
{
|
|
76
76
|
flowTag: '<%- flowTag %>',
|
|
@@ -16,7 +16,7 @@ along with this program. If not, see
|
|
|
16
16
|
<http: //www.gnu.org/licenses />.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import { getFlowSchema } from '@izara_project/izara-core-library-service-schemas';
|
|
20
20
|
import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
21
21
|
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
22
22
|
import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
|
|
@@ -53,7 +53,7 @@ export default async function <%- typeof functionName !== 'undefined' ? function
|
|
|
53
53
|
callingFlowConfig
|
|
54
54
|
);
|
|
55
55
|
|
|
56
|
-
const flowSchema = await
|
|
56
|
+
const flowSchema = await getFlowSchema.getFlowSchemaS3WithCache(
|
|
57
57
|
_izContext,
|
|
58
58
|
{
|
|
59
59
|
flowTag: '<%- flowTag %>',
|
|
@@ -156,9 +156,9 @@ export default async function <%- flowTag %>(
|
|
|
156
156
|
const { checkRbacPermission } =
|
|
157
157
|
await import('@izara_project/izara-authorization');
|
|
158
158
|
|
|
159
|
-
//(<rbacParameterGroups_<%- flowTag
|
|
159
|
+
//(<rbacParameterGroups_<%- flowTag %>>)
|
|
160
160
|
const parameterGroups = {};
|
|
161
|
-
//(</rbacParameterGroups_<%- flowTag
|
|
161
|
+
//(</rbacParameterGroups_<%- flowTag %>>)
|
|
162
162
|
|
|
163
163
|
const resultPermissionCheck = await checkRbacPermission(
|
|
164
164
|
_izContext,
|
|
@@ -193,8 +193,8 @@ export default async function <%- flowTag %>(
|
|
|
193
193
|
);
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
//(<rbacPublish_<%- flowTag
|
|
197
|
-
//(</rbacPublish_<%- flowTag
|
|
196
|
+
//(<rbacPublish_<%- flowTag %>>)
|
|
197
|
+
//(</rbacPublish_<%- flowTag %>>)
|
|
198
198
|
}
|
|
199
199
|
<%_ } _%>
|
|
200
200
|
|
|
@@ -73,7 +73,7 @@ export async function emitS3Flow(flow, source, handlerRoot) {
|
|
|
73
73
|
...descriptor,
|
|
74
74
|
routeName: tag,
|
|
75
75
|
flowTag: flow.flowTag,
|
|
76
|
-
flowStepName:
|
|
76
|
+
flowStepName: action
|
|
77
77
|
});
|
|
78
78
|
} else if (type === 'sqs') {
|
|
79
79
|
let filterPatternFunctionName = descriptor.functionName;
|
|
@@ -84,7 +84,7 @@ export async function emitS3Flow(flow, source, handlerRoot) {
|
|
|
84
84
|
...descriptor,
|
|
85
85
|
queueName: descriptor.functionName,
|
|
86
86
|
flowTag: flow.flowTag,
|
|
87
|
-
flowStepName:
|
|
87
|
+
flowStepName: action,
|
|
88
88
|
filterPatternFunctionName
|
|
89
89
|
});
|
|
90
90
|
} else if (type === 's3') {
|
|
@@ -101,13 +101,13 @@ export async function emitS3Flow(flow, source, handlerRoot) {
|
|
|
101
101
|
...descriptor,
|
|
102
102
|
bucketName: flow.bucketName,
|
|
103
103
|
flowTag: flow.flowTag,
|
|
104
|
-
flowStepName:
|
|
104
|
+
flowStepName: action
|
|
105
105
|
});
|
|
106
106
|
} else {
|
|
107
107
|
functionYaml = renderInvFunctionYaml({
|
|
108
108
|
...descriptor,
|
|
109
109
|
flowTag: flow.flowTag,
|
|
110
|
-
flowStepName:
|
|
110
|
+
flowStepName: action
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
return {
|
|
@@ -247,8 +247,8 @@ export default async function <%- typeof functionName !== 'undefined' ? function
|
|
|
247
247
|
resultPermissionCheck
|
|
248
248
|
);
|
|
249
249
|
|
|
250
|
-
//(<rbacPublish_<%- flowTag
|
|
251
|
-
//(</rbacPublish_<%- flowTag
|
|
250
|
+
//(<rbacPublish_<%- flowTag %>>)
|
|
251
|
+
//(</rbacPublish_<%- flowTag %>>)
|
|
252
252
|
|
|
253
253
|
return resultPermissionCheck;
|
|
254
254
|
<% } else { -%>
|
|
@@ -16,7 +16,10 @@ along with this program. If not, see
|
|
|
16
16
|
<http: //www.gnu.org/licenses />.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
getObjectSchema,
|
|
21
|
+
getFlowSchema
|
|
22
|
+
} from '@izara_project/izara-core-library-service-schemas';
|
|
20
23
|
import { consts } from '@izara_project/izara-middleware';
|
|
21
24
|
|
|
22
25
|
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
@@ -65,7 +68,7 @@ export default async function createObject(
|
|
|
65
68
|
|
|
66
69
|
let connectionId = _izContext.correlationIds.get(consts.CONNECTION_ID);
|
|
67
70
|
|
|
68
|
-
let flowSchema = await
|
|
71
|
+
let flowSchema = await getFlowSchema.getFlowSchemaS3WithCache(
|
|
69
72
|
_izContext,
|
|
70
73
|
{
|
|
71
74
|
flowTag: '<%- flowTag %>',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFlowSchema } from '@izara_project/izara-core-library-service-schemas';
|
|
2
2
|
import { triggeredCacheSharedLibV2 } from '@izara_project/izara-core-library-trigger-cache';
|
|
3
3
|
|
|
4
4
|
//(<optionalRequire>)
|
|
@@ -19,7 +19,7 @@ export default async function <%- functionName %>(
|
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
const topicName = topicArn.split(':')[5].split('_');
|
|
22
|
-
const flowSchema = await
|
|
22
|
+
const flowSchema = await getFlowSchema.getFlowSchemaS3WithCache(
|
|
23
23
|
_izContext,
|
|
24
24
|
{
|
|
25
25
|
flowTag: topicName[2],
|
|
@@ -18,7 +18,10 @@ const RBAC_CORE_FLOW_DEFINITIONS = [
|
|
|
18
18
|
];
|
|
19
19
|
|
|
20
20
|
const LIMIT_FLOW_DEFINITIONS = [
|
|
21
|
-
{
|
|
21
|
+
{
|
|
22
|
+
flowTag: 'ReservedDynamicUsage',
|
|
23
|
+
event: ['ownTopic', 'lambdaSyncInv', 'lambdaSyncApi']
|
|
24
|
+
},
|
|
22
25
|
{
|
|
23
26
|
flowTag: 'ConfirmUsage',
|
|
24
27
|
event: ['ownTopic', 'lambdaSyncInv', 'lambdaSyncApi']
|