@izara_project/izara-core-generate-service-code 1.0.73 → 1.0.74
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/emit/coreFunction/emitCoreFunctionArtifacts.js +3 -0
- package/src/emit/coreFunction/templates/InitialSetupConfig.ejs +100 -28
- package/src/emit/coreFunction/templates/InitialSetupRunner_uploadSchema.ejs +2 -0
- package/src/emit/coreFunction/templates/UploadSchema_Main.ejs +2 -0
- package/src/emit/custom/customFlows.js +42 -0
- package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +22 -9
- package/src/emit/custom/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +2 -1
- package/src/emit/function/functionYamlArtifact.js +8 -3
- package/src/emit/relationship/templates/ChangeRelationshipComplete_Main.ejs +8 -13
- package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +5 -14
- package/src/emit/relationship/templates/CreateRelationshipComplete_Main.ejs +8 -13
- package/src/emit/relationship/templates/CreateRelationship_Main.ejs +7 -16
- package/src/emit/relationship/templates/DeleteRelationshipComplete_Main.ejs +8 -4
- package/src/emit/relationship/templates/DeleteRelationship_Main.ejs +6 -24
- package/src/emit/relationship/templates/GetRelationshipComplete_Main.ejs +8 -4
- package/src/emit/relationship/templates/MoveRelationshipComplete_Main.ejs +8 -15
- package/src/emit/relationship/templates/MoveRelationship_Main.ejs +6 -15
- package/src/emit/relationship/templates/UpdateRelationshipComplete_Main.ejs +9 -31
- package/src/emit/relationship/templates/UpdateRelationship_Main.ejs +6 -15
- package/src/emit/resource/emitResourceArtifacts.js +2 -1
- package/src/emit/resource/templates/DynamoDBTable_Yaml.ejs +3 -0
- package/src/emit/shared/templates/FlowHandler_HdrApi.ejs +1 -1
- package/src/emit/shared/templates/FlowHandler_HdrDsq.ejs +2 -1
- package/src/emit/shared/templates/FlowHandler_HdrInv.ejs +1 -1
- package/src/emit/shared/templates/FlowHandler_HdrSqs.ejs +2 -1
- package/src/emit/system/templates/WebSocketComplete_Yaml.ejs +2 -0
- package/test/crudApplicationArtifacts.test.js +22 -0
- package/test/customFlowApplicationArtifacts.test.js +135 -0
- package/test/functionYamlArtifact.test.js +5 -2
- package/test/publicApi.test.js +29 -0
- package/test/relationshipApplicationArtifacts.test.js +42 -8
- package/test/resourceArtifacts.test.js +34 -16
|
@@ -27,10 +27,7 @@ test('emits queues, topics, tables, and IAM roles from schema data', async () =>
|
|
|
27
27
|
),
|
|
28
28
|
'utf8'
|
|
29
29
|
);
|
|
30
|
-
assert.match(
|
|
31
|
-
resources,
|
|
32
|
-
/SubscriptionOutCreateToUploadReservedLimitHdrSqs:/
|
|
33
|
-
);
|
|
30
|
+
assert.match(resources, /SubscriptionOutCreateToUploadReservedLimitHdrSqs:/);
|
|
34
31
|
assert.match(resources, /TopicArn: !Ref OutCreate/);
|
|
35
32
|
assert.match(
|
|
36
33
|
resources,
|
|
@@ -45,16 +42,16 @@ test('emits queues, topics, tables, and IAM roles from schema data', async () =>
|
|
|
45
42
|
]) {
|
|
46
43
|
assert.match(resources, new RegExp(`^ ${queueName}:`, 'm'));
|
|
47
44
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
'resource/sls_yaml/generatedCode/source/generated-dynamoDB-table.yml'
|
|
53
|
-
),
|
|
54
|
-
'utf8'
|
|
45
|
+
const dynamoYaml = await readFile(
|
|
46
|
+
join(
|
|
47
|
+
rootPath,
|
|
48
|
+
'resource/sls_yaml/generatedCode/source/generated-dynamoDB-table.yml'
|
|
55
49
|
),
|
|
56
|
-
|
|
50
|
+
'utf8'
|
|
57
51
|
);
|
|
52
|
+
assert.match(dynamoYaml, /OrdersTable:/);
|
|
53
|
+
assert.match(dynamoYaml, /#<#OrdersTableSetting#>/);
|
|
54
|
+
assert.match(dynamoYaml, /#<#\/OrdersTableSetting#>/);
|
|
58
55
|
const iam = await readFile(
|
|
59
56
|
join(
|
|
60
57
|
rootPath,
|
|
@@ -84,10 +81,7 @@ test('emits queues, topics, tables, and IAM roles from schema data', async () =>
|
|
|
84
81
|
/RolePermissions|ProcessCreateTargetRoleHdrSqs/
|
|
85
82
|
);
|
|
86
83
|
// Per-object RBAC flow queue (e.g. OrderRbacFlowHdrSqs from Order with rbac add-on)
|
|
87
|
-
assert.match(
|
|
88
|
-
roleBlock(iam, 'FlowRbacRole'),
|
|
89
|
-
/OrderRbacFlowHdrSqs/
|
|
90
|
-
);
|
|
84
|
+
assert.match(roleBlock(iam, 'FlowRbacRole'), /OrderRbacFlowHdrSqs/);
|
|
91
85
|
assert.match(resources, /^ CreateRelationshipHdrSqs:/m);
|
|
92
86
|
assert.equal(
|
|
93
87
|
(resources.match(/^ CreateRelationshipHdrSqs:/gm) ?? []).length,
|
|
@@ -219,6 +213,30 @@ test('scopes stored-cache permissions to the flow object table', async () => {
|
|
|
219
213
|
assert.doesNotMatch(role, /Orders|WebSocketTask/);
|
|
220
214
|
});
|
|
221
215
|
|
|
216
|
+
test('emits DynamoDB tables and hooks defined in flowSchemas storageResources', async () => {
|
|
217
|
+
const rootPath = await createProject();
|
|
218
|
+
await writeFile(
|
|
219
|
+
join(rootPath, 'app/src/schemas/FlowSchemas/FlowWithTable.js'),
|
|
220
|
+
"export default { flowTag: 'tableFlow', event: ['ownTopic'], " +
|
|
221
|
+
"storageResources: { main: { storageType: 'dynamoDB', " +
|
|
222
|
+
"tableName: 'FlowCustomTable' } }, identifiers: " +
|
|
223
|
+
"[{ type: 'partitionKey', fieldName: 'flowKey' }] };\n"
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
await generateResourceArtifacts(rootPath);
|
|
227
|
+
|
|
228
|
+
const dynamoYaml = await readFile(
|
|
229
|
+
join(
|
|
230
|
+
rootPath,
|
|
231
|
+
'resource/sls_yaml/generatedCode/source/generated-dynamoDB-table.yml'
|
|
232
|
+
),
|
|
233
|
+
'utf8'
|
|
234
|
+
);
|
|
235
|
+
assert.match(dynamoYaml, /FlowCustomTableTable:/);
|
|
236
|
+
assert.match(dynamoYaml, /#<#FlowCustomTableTableSetting#>/);
|
|
237
|
+
assert.match(dynamoYaml, /#<#\/FlowCustomTableTableSetting#>/);
|
|
238
|
+
});
|
|
239
|
+
|
|
222
240
|
function roleBlock(iam, roleName) {
|
|
223
241
|
const match = iam.match(
|
|
224
242
|
new RegExp(
|