@terra-graph/conventions-aws 1.0.0-rc.1
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/CHANGELOG.md +35 -0
- package/README.md +25 -0
- package/dist/cjs/conventions/dataflow/profiles/base.js +89 -0
- package/dist/cjs/conventions/dataflow/profiles/dot.js +44 -0
- package/dist/cjs/conventions/dataflow/profiles/dot.test.js +147 -0
- package/dist/cjs/conventions/dataflow/rules.js +4 -0
- package/dist/cjs/conventions/dataflow/rules.test.js +11 -0
- package/dist/cjs/conventions/dataflow/rulesets.js +751 -0
- package/dist/cjs/conventions/dataflow/rulesets.test.js +27 -0
- package/dist/cjs/conventions/index.js +7 -0
- package/dist/cjs/conventions/index.test.js +8 -0
- package/dist/cjs/index.js +70 -0
- package/dist/cjs/index.test.js +58 -0
- package/dist/cjs/namespaces.js +14 -0
- package/dist/cjs/namespaces.test.js +17 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/plugins/AwsApiGateway.js +218 -0
- package/dist/cjs/plugins/AwsApiGateway.test.js +427 -0
- package/dist/cjs/plugins/AwsIam.js +432 -0
- package/dist/cjs/plugins/AwsIam.test.js +468 -0
- package/dist/cjs/plugins/AwsS3.js +107 -0
- package/dist/cjs/plugins/AwsS3.test.js +102 -0
- package/dist/cjs/plugins/AwsSns.js +52 -0
- package/dist/cjs/plugins/AwsSns.test.js +55 -0
- package/dist/cjs/plugins/AwsTransferFamily.js +105 -0
- package/dist/cjs/plugins/AwsTransferFamily.test.js +279 -0
- package/dist/cjs/rules/dot.js +36 -0
- package/dist/cjs/rules/dot.test.js +42 -0
- package/dist/cjs/rules/general.js +69 -0
- package/dist/cjs/rules/general.test.js +47 -0
- package/dist/cjs/rulesets/dot.js +25 -0
- package/dist/cjs/rulesets/dot.test.js +48 -0
- package/dist/esm/conventions/dataflow/profiles/base.d.ts +4 -0
- package/dist/esm/conventions/dataflow/profiles/base.js +86 -0
- package/dist/esm/conventions/dataflow/profiles/dot.d.ts +4 -0
- package/dist/esm/conventions/dataflow/profiles/dot.js +38 -0
- package/dist/esm/conventions/dataflow/profiles/dot.test.d.ts +1 -0
- package/dist/esm/conventions/dataflow/profiles/dot.test.js +109 -0
- package/dist/esm/conventions/dataflow/rules.d.ts +3 -0
- package/dist/esm/conventions/dataflow/rules.js +2 -0
- package/dist/esm/conventions/dataflow/rules.test.d.ts +1 -0
- package/dist/esm/conventions/dataflow/rules.test.js +6 -0
- package/dist/esm/conventions/dataflow/rulesets.d.ts +3 -0
- package/dist/esm/conventions/dataflow/rulesets.js +749 -0
- package/dist/esm/conventions/dataflow/rulesets.test.d.ts +1 -0
- package/dist/esm/conventions/dataflow/rulesets.test.js +22 -0
- package/dist/esm/conventions/index.d.ts +3 -0
- package/dist/esm/conventions/index.js +4 -0
- package/dist/esm/conventions/index.test.d.ts +1 -0
- package/dist/esm/conventions/index.test.js +6 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +32 -0
- package/dist/esm/index.test.d.ts +1 -0
- package/dist/esm/index.test.js +53 -0
- package/dist/esm/namespaces.d.ts +7 -0
- package/dist/esm/namespaces.js +6 -0
- package/dist/esm/namespaces.test.d.ts +1 -0
- package/dist/esm/namespaces.test.js +15 -0
- package/dist/esm/plugins/AwsApiGateway.d.ts +6 -0
- package/dist/esm/plugins/AwsApiGateway.js +214 -0
- package/dist/esm/plugins/AwsApiGateway.test.d.ts +1 -0
- package/dist/esm/plugins/AwsApiGateway.test.js +425 -0
- package/dist/esm/plugins/AwsIam.d.ts +32 -0
- package/dist/esm/plugins/AwsIam.js +428 -0
- package/dist/esm/plugins/AwsIam.test.d.ts +1 -0
- package/dist/esm/plugins/AwsIam.test.js +466 -0
- package/dist/esm/plugins/AwsS3.d.ts +12 -0
- package/dist/esm/plugins/AwsS3.js +103 -0
- package/dist/esm/plugins/AwsS3.test.d.ts +1 -0
- package/dist/esm/plugins/AwsS3.test.js +100 -0
- package/dist/esm/plugins/AwsSns.d.ts +6 -0
- package/dist/esm/plugins/AwsSns.js +48 -0
- package/dist/esm/plugins/AwsSns.test.d.ts +1 -0
- package/dist/esm/plugins/AwsSns.test.js +53 -0
- package/dist/esm/plugins/AwsTransferFamily.d.ts +6 -0
- package/dist/esm/plugins/AwsTransferFamily.js +101 -0
- package/dist/esm/plugins/AwsTransferFamily.test.d.ts +1 -0
- package/dist/esm/plugins/AwsTransferFamily.test.js +277 -0
- package/dist/esm/rules/dot.d.ts +3 -0
- package/dist/esm/rules/dot.js +34 -0
- package/dist/esm/rules/dot.test.d.ts +1 -0
- package/dist/esm/rules/dot.test.js +37 -0
- package/dist/esm/rules/general.d.ts +3 -0
- package/dist/esm/rules/general.js +67 -0
- package/dist/esm/rules/general.test.d.ts +1 -0
- package/dist/esm/rules/general.test.js +42 -0
- package/dist/esm/rulesets/dot.d.ts +3 -0
- package/dist/esm/rulesets/dot.js +23 -0
- package/dist/esm/rulesets/dot.test.d.ts +1 -0
- package/dist/esm/rulesets/dot.test.js +43 -0
- package/package.json +45 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
## 1.0.0-rc.1 (2026-03-28)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* add aws package ([2eaadc9](https://github.com/terra-graph/conventions/commit/2eaadc93f45ac1a9a1cd75f11b3652c9b838b37d))
|
|
6
|
+
* add initial aws package ([8700de3](https://github.com/terra-graph/conventions/commit/8700de3984fcc75368864bbe615a38645c404d1b))
|
|
7
|
+
* added core package ([1bdc6e7](https://github.com/terra-graph/conventions/commit/1bdc6e7aefc2813e5fb6650bd008a0bf31295719))
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* force release ([38320d9](https://github.com/terra-graph/conventions/commit/38320d95672062fba3dd62500f8653c67b09bb45))
|
|
12
|
+
* force release ([f625ac0](https://github.com/terra-graph/conventions/commit/f625ac0a95083f25df1db7155c08d2d1544c4f2b))
|
|
13
|
+
* force release ([955c8b6](https://github.com/terra-graph/conventions/commit/955c8b66eebbadc6663b771f12cad85830e29b59))
|
|
14
|
+
* force release ([f53250c](https://github.com/terra-graph/conventions/commit/f53250ca7b027d453a63731782d627d24cfc2de9))
|
|
15
|
+
* force release ([fd1b399](https://github.com/terra-graph/conventions/commit/fd1b3998f3015b791981ef4a99b253855938ef92))
|
|
16
|
+
* force release ([b3c459b](https://github.com/terra-graph/conventions/commit/b3c459b97b1f6c9028a7a173a6a8a0ad0e6b9f20))
|
|
17
|
+
* force release ([1b05e2b](https://github.com/terra-graph/conventions/commit/1b05e2b9e03f76d7fe22a80a2e80f519ac320bc6))
|
|
18
|
+
* release ([ca16ba5](https://github.com/terra-graph/conventions/commit/ca16ba5293f7bbc38c80f93052f90942ddedc56d))
|
|
19
|
+
* release ([a85626d](https://github.com/terra-graph/conventions/commit/a85626d70979d59aed9e1d77f4372bd7751b3984))
|
|
20
|
+
* release ([4d150c0](https://github.com/terra-graph/conventions/commit/4d150c0c8eecac008b3ebba875663bfe7ab1e164))
|
|
21
|
+
* release ([ac7c8e0](https://github.com/terra-graph/conventions/commit/ac7c8e0b22f852fcff331f79b11d3c044b51fcdd))
|
|
22
|
+
* release ([af4d120](https://github.com/terra-graph/conventions/commit/af4d1204bbba1f950421d971bdddeb13f470f20c))
|
|
23
|
+
* release ([80c26e0](https://github.com/terra-graph/conventions/commit/80c26e0c2bd43cd965c9a6537b6bf6fbb8be72cf))
|
|
24
|
+
* release ([0e72f68](https://github.com/terra-graph/conventions/commit/0e72f687704df3a0edf1b4fb54b04e123030cd40))
|
|
25
|
+
* release ([f996d7b](https://github.com/terra-graph/conventions/commit/f996d7b29190acfd575c2f01df6ac86f11f97871))
|
|
26
|
+
* release ([ca0daff](https://github.com/terra-graph/conventions/commit/ca0daffdb70c7a5fe471114d5b7e03c4863fbc21))
|
|
27
|
+
* release ([9c60c78](https://github.com/terra-graph/conventions/commit/9c60c780ae91fbde08f4d121871c73e4142dc910))
|
|
28
|
+
* release ([7912dd5](https://github.com/terra-graph/conventions/commit/7912dd53c34009ad0008c4c4c4210730c78c32ae))
|
|
29
|
+
* release ([24e33b6](https://github.com/terra-graph/conventions/commit/24e33b63d6c589fb7e36de9c127f3ece5889155f))
|
|
30
|
+
* release ([54e836e](https://github.com/terra-graph/conventions/commit/54e836e6a8f5d8fd29fb3ed57bb5d0e83deb96f7))
|
|
31
|
+
* update tests ([53d386c](https://github.com/terra-graph/conventions/commit/53d386ce82d78d1ce75c7cf88f63e09ee5840c75))
|
|
32
|
+
|
|
33
|
+
# Changelog
|
|
34
|
+
|
|
35
|
+
All notable changes to this package will be documented in this file.
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @terra-graph/conventions-aws
|
|
2
|
+
|
|
3
|
+
AWS convention/provider package for `terra-graph`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
yarn add @terra-graph/conventions-aws
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## API
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import {
|
|
15
|
+
AWS_CONVENTION_PACKAGE,
|
|
16
|
+
AWS_CONVENTION_VERSION,
|
|
17
|
+
awsNamedRules,
|
|
18
|
+
awsNamedRuleSets,
|
|
19
|
+
awsProfiles,
|
|
20
|
+
awsPlugins,
|
|
21
|
+
awsConventionManifest,
|
|
22
|
+
} from '@terra-graph/conventions-aws';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This package currently ships placeholder, serialization-safe convention assets and a manifest contract for future expansion.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.conventionDataFlowBaseProfileName = void 0;
|
|
4
|
+
const conventions_core_1 = require("@terra-graph/conventions-core");
|
|
5
|
+
const core_1 = require("@terra-graph/core");
|
|
6
|
+
const namespaces_js_1 = require("../../../namespaces.js");
|
|
7
|
+
const AwsIam_js_1 = require("../../../plugins/AwsIam.js");
|
|
8
|
+
const AwsS3_js_1 = require("../../../plugins/AwsS3.js");
|
|
9
|
+
const index_js_1 = require("../../index.js");
|
|
10
|
+
exports.conventionDataFlowBaseProfileName = (0, namespaces_js_1.conventionName)(index_js_1.Convention.DataFlow, (0, namespaces_js_1.profileName)('base'));
|
|
11
|
+
exports.default = new core_1.Profile(exports.conventionDataFlowBaseProfileName, {
|
|
12
|
+
usesProfiles: [conventions_core_1.coreBase],
|
|
13
|
+
phases: [
|
|
14
|
+
{
|
|
15
|
+
phase: 'pre',
|
|
16
|
+
rules: [
|
|
17
|
+
new core_1.RemoveNode({
|
|
18
|
+
node: {
|
|
19
|
+
or: [
|
|
20
|
+
{
|
|
21
|
+
attr: {
|
|
22
|
+
key: 'terraform.resource',
|
|
23
|
+
startsWith: ['aws_kms_', 'aws_ssm_'],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
attr: {
|
|
28
|
+
key: 'terraform.resource',
|
|
29
|
+
in: ['external', 'aws_caller_identity'],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
// { namedRule: ruleName('log_groups.only_event_bridge') },
|
|
36
|
+
{ namedRule: (0, namespaces_js_1.ruleName)('lambda.only_event_source_mapping') },
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
phase: 'semantics',
|
|
41
|
+
rules: [{ namedRuleSet: (0, namespaces_js_1.conventionName)(index_js_1.Convention.DataFlow, (0, namespaces_js_1.ruleSetName)('semantics')) }],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
phase: 'cleanup',
|
|
45
|
+
rules: [
|
|
46
|
+
// not sure this semantics re-run is needed?
|
|
47
|
+
{ namedRuleSet: (0, namespaces_js_1.conventionName)(index_js_1.Convention.DataFlow, (0, namespaces_js_1.ruleSetName)('semantics')) },
|
|
48
|
+
{ namedRuleSet: (0, namespaces_js_1.conventionName)(index_js_1.Convention.DataFlow, (0, namespaces_js_1.ruleSetName)('cleanup')) },
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
phase: 'main',
|
|
53
|
+
rules: [
|
|
54
|
+
// TODO: ConvertNodeToEdge probably should apply some hints to the edge (converted node etc)
|
|
55
|
+
// new ConvertNodeToEdge({
|
|
56
|
+
// node: {
|
|
57
|
+
// attr: {
|
|
58
|
+
// key: 'terraform.resource',
|
|
59
|
+
// in: [
|
|
60
|
+
// 'aws_lambda_event_source_mapping',
|
|
61
|
+
// 'aws_cloudwatch_event_target',
|
|
62
|
+
// 'aws_cloudwatch_log_destination',
|
|
63
|
+
// ],
|
|
64
|
+
// },
|
|
65
|
+
// },
|
|
66
|
+
// }),
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
plugins: [
|
|
71
|
+
{ plugin: AwsS3_js_1.AwsS3.id },
|
|
72
|
+
{
|
|
73
|
+
plugin: AwsIam_js_1.AwsIamGraphPlugin.id,
|
|
74
|
+
options: { mode: 'full', removeOrphans: true },
|
|
75
|
+
},
|
|
76
|
+
// { plugin: 'aws.iam', options: { mode: 'full' } },
|
|
77
|
+
// {
|
|
78
|
+
// plugin: 'aws.iam',
|
|
79
|
+
// options: { mode: 'roles_policies', attachments: 'convert_to_edge' },
|
|
80
|
+
// }, // can't see any difference
|
|
81
|
+
// { plugin: 'aws.iam', options: { mode: 'full' } }, // shows everything as expected
|
|
82
|
+
// {
|
|
83
|
+
// plugin: 'aws.iam',
|
|
84
|
+
// options: {
|
|
85
|
+
// mode: 'full',
|
|
86
|
+
// },
|
|
87
|
+
// },
|
|
88
|
+
],
|
|
89
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.conventionDataFlowDotProfileName = void 0;
|
|
7
|
+
const core_1 = require("@terra-graph/core");
|
|
8
|
+
const namespaces_js_1 = require("../../../namespaces.js");
|
|
9
|
+
const index_js_1 = require("../../index.js");
|
|
10
|
+
const base_js_1 = __importDefault(require("./base.js"));
|
|
11
|
+
exports.conventionDataFlowDotProfileName = (0, namespaces_js_1.conventionName)(index_js_1.Convention.DataFlow, (0, namespaces_js_1.profileName)('dot'));
|
|
12
|
+
const baseDotProfile = new core_1.Profile('overview.dot', {
|
|
13
|
+
supports: core_1.DotAdapter,
|
|
14
|
+
render: {
|
|
15
|
+
options: {
|
|
16
|
+
graph: {
|
|
17
|
+
rankdir: 'LR',
|
|
18
|
+
ranksep: 2.5,
|
|
19
|
+
nodesep: 0.6,
|
|
20
|
+
pad: 1,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
phases: [
|
|
25
|
+
{
|
|
26
|
+
phase: 'normalize',
|
|
27
|
+
rules: [{ namedRule: 'dot.normalise_modules' }],
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
exports.default = new core_1.Profile(exports.conventionDataFlowDotProfileName, {
|
|
32
|
+
supports: core_1.DotAdapter,
|
|
33
|
+
usesProfiles: [base_js_1.default, baseDotProfile],
|
|
34
|
+
phases: [
|
|
35
|
+
{
|
|
36
|
+
phase: 'main',
|
|
37
|
+
rules: [
|
|
38
|
+
{ namedRuleSet: (0, namespaces_js_1.ruleSetName)('dot.sqs.dlq') },
|
|
39
|
+
{ namedRule: (0, namespaces_js_1.ruleName)('dot.schedule.align') },
|
|
40
|
+
{ namedRule: (0, namespaces_js_1.ruleName)('dot.iam_role.align') },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const core_1 = require("@terra-graph/core");
|
|
40
|
+
const index_js_1 = __importDefault(require("../../../index.js"));
|
|
41
|
+
const namespaces_js_1 = require("../../../namespaces.js");
|
|
42
|
+
const AwsIam_js_1 = require("../../../plugins/AwsIam.js");
|
|
43
|
+
const AwsS3_js_1 = require("../../../plugins/AwsS3.js");
|
|
44
|
+
const index_js_2 = require("../../index.js");
|
|
45
|
+
const rules_js_1 = __importDefault(require("../rules.js"));
|
|
46
|
+
const rulesets_js_1 = __importDefault(require("../rulesets.js"));
|
|
47
|
+
const dot_js_1 = __importStar(require("./dot.js"));
|
|
48
|
+
const baseNamedRules = new core_1.NamedRuleRegistry({
|
|
49
|
+
'remove.tfconfig': new core_1.RemoveNode({
|
|
50
|
+
node: {
|
|
51
|
+
or: [
|
|
52
|
+
{
|
|
53
|
+
attr: {
|
|
54
|
+
key: 'terraform.kind',
|
|
55
|
+
in: ['local', 'var', 'terraform_data'],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
attr: {
|
|
60
|
+
key: 'terraform.resource',
|
|
61
|
+
in: ['null_resource', 'local_file'],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
67
|
+
'reconnect.time_sleep': new core_1.RemoveNodeAndReconnectEdges({
|
|
68
|
+
node: {
|
|
69
|
+
attr: {
|
|
70
|
+
key: 'terraform.resource',
|
|
71
|
+
eq: 'time_sleep',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
'remove.childless_modules': new core_1.RemoveNode({
|
|
76
|
+
node: {
|
|
77
|
+
and: [{ attr: { key: 'terraform.kind', eq: 'module' } }, { children: { exists: false } }],
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
80
|
+
'dot.normalise_modules': new core_1.NodeDotProperties({
|
|
81
|
+
options: {
|
|
82
|
+
peripheries: 0,
|
|
83
|
+
label: '',
|
|
84
|
+
height: 0,
|
|
85
|
+
width: 0,
|
|
86
|
+
},
|
|
87
|
+
node: {
|
|
88
|
+
attr: {
|
|
89
|
+
key: 'terraform.kind',
|
|
90
|
+
eq: 'module',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
}),
|
|
94
|
+
});
|
|
95
|
+
const baseNamedRuleSets = new core_1.NamedRuleSetRegistry({});
|
|
96
|
+
describe('data flow dot profile', () => {
|
|
97
|
+
it('shoud expose namespaced profile metadata and plugin refs', () => {
|
|
98
|
+
const serialized = dot_js_1.default.serialize();
|
|
99
|
+
expect(serialized.name).toBe(dot_js_1.conventionDataFlowDotProfileName);
|
|
100
|
+
expect(serialized.supports).toBe(core_1.DotAdapter.name);
|
|
101
|
+
expect(serialized.phases?.map((phase) => phase.phase)).toStrictEqual(['main']);
|
|
102
|
+
const baseProfile = serialized.usesProfiles?.[0];
|
|
103
|
+
expect(baseProfile?.phases?.map((phase) => phase.phase)).toStrictEqual([
|
|
104
|
+
'pre',
|
|
105
|
+
'semantics',
|
|
106
|
+
'cleanup',
|
|
107
|
+
'main',
|
|
108
|
+
]);
|
|
109
|
+
expect(baseProfile?.plugins).toEqual([
|
|
110
|
+
{ plugin: AwsS3_js_1.AwsS3.id },
|
|
111
|
+
{
|
|
112
|
+
plugin: AwsIam_js_1.AwsIamGraphPlugin.id,
|
|
113
|
+
options: { mode: 'full', removeOrphans: true },
|
|
114
|
+
},
|
|
115
|
+
]);
|
|
116
|
+
expect(dot_js_1.conventionDataFlowDotProfileName).toBe((0, namespaces_js_1.conventionName)(index_js_2.Convention.DataFlow, (0, namespaces_js_1.profileName)('dot')));
|
|
117
|
+
});
|
|
118
|
+
it('shoud resolve phase plan with runtime provider registries', () => {
|
|
119
|
+
const runtime = (0, index_js_1.default)();
|
|
120
|
+
const runtimeNamedRules = runtime.namedRules;
|
|
121
|
+
const runtimeNamedRuleSets = runtime.namedRuleSets;
|
|
122
|
+
const runtimePlugins = runtime.plugins;
|
|
123
|
+
if (!runtimeNamedRules || !runtimeNamedRuleSets || !runtimePlugins) {
|
|
124
|
+
throw new Error('Runtime provider missing expected registries');
|
|
125
|
+
}
|
|
126
|
+
const namedRules = core_1.NamedRuleRegistry.from([baseNamedRules, runtimeNamedRules]);
|
|
127
|
+
const namedRuleSets = core_1.NamedRuleSetRegistry.from([baseNamedRuleSets, runtimeNamedRuleSets]);
|
|
128
|
+
const phases = dot_js_1.default.resolvePhases(namedRules, namedRuleSets, runtimePlugins);
|
|
129
|
+
expect(phases.length).toBeGreaterThan(4);
|
|
130
|
+
expect(phases.map((rules) => rules.some((rule) => rule.serialize().id === 'EdgeLegend'))).toContain(true);
|
|
131
|
+
});
|
|
132
|
+
it('shoud reference conventions rules and rule sets from the dataflow profile', () => {
|
|
133
|
+
const baseProfile = dot_js_1.default.serialize().usesProfiles?.[0];
|
|
134
|
+
const preRules = baseProfile?.phases?.[0]?.rules;
|
|
135
|
+
const mainRules = dot_js_1.default.serialize().phases?.[0]?.rules;
|
|
136
|
+
expect(preRules).toEqual(expect.arrayContaining([
|
|
137
|
+
expect.objectContaining({ id: 'RemoveNode' }),
|
|
138
|
+
{ namedRule: (0, namespaces_js_1.ruleName)('lambda.only_event_source_mapping') },
|
|
139
|
+
]));
|
|
140
|
+
expect(mainRules).toEqual(expect.arrayContaining([
|
|
141
|
+
{ namedRuleSet: (0, namespaces_js_1.ruleSetName)('dot.sqs.dlq') },
|
|
142
|
+
{ namedRule: (0, namespaces_js_1.ruleName)('dot.schedule.align') },
|
|
143
|
+
]));
|
|
144
|
+
expect(rulesets_js_1.default.names()).toContain((0, namespaces_js_1.conventionName)(index_js_2.Convention.DataFlow, (0, namespaces_js_1.ruleSetName)('semantics')));
|
|
145
|
+
expect(rules_js_1.default.names()).toEqual([]);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const rules_js_1 = __importDefault(require("./rules.js"));
|
|
7
|
+
describe('dataflow convention rules', () => {
|
|
8
|
+
it('shoud export an empty registry', () => {
|
|
9
|
+
expect(rules_js_1.default.names()).toEqual([]);
|
|
10
|
+
});
|
|
11
|
+
});
|