@intentius/chant-lexicon-aws 0.0.6 → 0.0.9
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/dist/integrity.json +25 -10
- package/dist/manifest.json +1 -1
- package/dist/meta.json +9444 -4597
- package/dist/rules/cf-refs.ts +99 -0
- package/dist/rules/ext001.ts +32 -25
- package/dist/rules/hardcoded-region.ts +1 -0
- package/dist/rules/iam-wildcard.ts +1 -0
- package/dist/rules/s3-encryption.ts +3 -3
- package/dist/rules/waw016.ts +86 -0
- package/dist/rules/waw017.ts +53 -0
- package/dist/rules/waw018.ts +71 -0
- package/dist/rules/waw019.ts +82 -0
- package/dist/rules/waw020.ts +64 -0
- package/dist/rules/waw021.ts +53 -0
- package/dist/rules/waw022.ts +43 -0
- package/dist/rules/waw023.ts +47 -0
- package/dist/rules/waw024.ts +54 -0
- package/dist/rules/waw025.ts +43 -0
- package/dist/rules/waw026.ts +46 -0
- package/dist/rules/waw027.ts +50 -0
- package/dist/rules/waw028.ts +47 -0
- package/dist/rules/waw029.ts +62 -0
- package/dist/rules/waw030.ts +246 -0
- package/dist/skills/chant-aws.md +430 -0
- package/dist/types/index.d.ts +58525 -58501
- package/package.json +2 -2
- package/src/actions/actions.test.ts +75 -0
- package/src/actions/dynamodb.ts +36 -0
- package/src/actions/ecr.ts +9 -0
- package/src/actions/ecs.ts +5 -0
- package/src/actions/iam.ts +3 -0
- package/src/actions/index.ts +9 -0
- package/src/actions/lambda.ts +11 -0
- package/src/actions/logs.ts +4 -0
- package/src/actions/s3.ts +34 -0
- package/src/actions/sns.ts +5 -0
- package/src/actions/sqs.ts +15 -0
- package/src/codegen/__snapshots__/snapshot.test.ts.snap +20 -20
- package/src/codegen/docs-links.test.ts +143 -0
- package/src/codegen/docs.ts +294 -124
- package/src/codegen/generate-lexicon.ts +8 -0
- package/src/codegen/generate-typescript.ts +25 -1
- package/src/codegen/generate.ts +1 -13
- package/src/codegen/package.ts +2 -0
- package/src/codegen/typecheck.test.ts +1 -1
- package/src/composites/composites.test.ts +442 -0
- package/src/composites/fargate-alb.ts +253 -0
- package/src/composites/index.ts +20 -0
- package/src/composites/lambda-api.ts +20 -0
- package/src/composites/lambda-dynamodb.ts +64 -0
- package/src/composites/lambda-eventbridge.ts +36 -0
- package/src/composites/lambda-function.ts +76 -0
- package/src/composites/lambda-s3.ts +72 -0
- package/src/composites/lambda-sns.ts +30 -0
- package/src/composites/lambda-sqs.ts +44 -0
- package/src/composites/scheduled-lambda.ts +37 -0
- package/src/composites/vpc-default.ts +148 -0
- package/src/default-tags.test.ts +38 -0
- package/src/default-tags.ts +77 -0
- package/src/generated/index.d.ts +58525 -58501
- package/src/generated/index.ts +1351 -1351
- package/src/generated/lexicon-aws.json +9444 -4597
- package/src/import/generator.test.ts +5 -5
- package/src/import/generator.ts +4 -4
- package/src/import/roundtrip-fixtures.test.ts +2 -1
- package/src/import/roundtrip.test.ts +5 -5
- package/src/index.ts +21 -0
- package/src/integration.test.ts +92 -21
- package/src/intrinsics.ts +24 -13
- package/src/lint/post-synth/cf-refs.ts +99 -0
- package/src/lint/post-synth/ext001.test.ts +214 -31
- package/src/lint/post-synth/ext001.ts +32 -25
- package/src/lint/post-synth/waw013.test.ts +120 -0
- package/src/lint/post-synth/waw014.test.ts +121 -0
- package/src/lint/post-synth/waw015.test.ts +147 -0
- package/src/lint/post-synth/waw016.test.ts +141 -0
- package/src/lint/post-synth/waw016.ts +86 -0
- package/src/lint/post-synth/waw017.test.ts +130 -0
- package/src/lint/post-synth/waw017.ts +53 -0
- package/src/lint/post-synth/waw018.test.ts +109 -0
- package/src/lint/post-synth/waw018.ts +71 -0
- package/src/lint/post-synth/waw019.test.ts +138 -0
- package/src/lint/post-synth/waw019.ts +82 -0
- package/src/lint/post-synth/waw020.test.ts +125 -0
- package/src/lint/post-synth/waw020.ts +64 -0
- package/src/lint/post-synth/waw021.test.ts +81 -0
- package/src/lint/post-synth/waw021.ts +53 -0
- package/src/lint/post-synth/waw022.test.ts +54 -0
- package/src/lint/post-synth/waw022.ts +43 -0
- package/src/lint/post-synth/waw023.test.ts +53 -0
- package/src/lint/post-synth/waw023.ts +47 -0
- package/src/lint/post-synth/waw024.test.ts +64 -0
- package/src/lint/post-synth/waw024.ts +54 -0
- package/src/lint/post-synth/waw025.test.ts +42 -0
- package/src/lint/post-synth/waw025.ts +43 -0
- package/src/lint/post-synth/waw026.test.ts +54 -0
- package/src/lint/post-synth/waw026.ts +46 -0
- package/src/lint/post-synth/waw027.test.ts +63 -0
- package/src/lint/post-synth/waw027.ts +50 -0
- package/src/lint/post-synth/waw028.test.ts +68 -0
- package/src/lint/post-synth/waw028.ts +47 -0
- package/src/lint/post-synth/waw029.test.ts +179 -0
- package/src/lint/post-synth/waw029.ts +62 -0
- package/src/lint/post-synth/waw030.test.ts +800 -0
- package/src/lint/post-synth/waw030.ts +246 -0
- package/src/lint/rules/hardcoded-region.ts +1 -0
- package/src/lint/rules/iam-wildcard.ts +1 -0
- package/src/lint/rules/rules.test.ts +8 -8
- package/src/lint/rules/s3-encryption.ts +3 -3
- package/src/lsp/completions.ts +2 -0
- package/src/lsp/hover.ts +17 -0
- package/src/nested-stack-integration.test.ts +100 -0
- package/src/nested-stack.ts +2 -2
- package/src/plugin.test.ts +13 -15
- package/src/plugin.ts +552 -114
- package/src/serializer.test.ts +370 -43
- package/src/serializer.ts +69 -17
- package/src/spec/fetch.ts +10 -0
- package/src/spec/parse.test.ts +141 -0
- package/src/spec/parse.ts +40 -0
- package/src/taggable.ts +44 -0
- package/src/testdata/nested-stacks/app.ts +26 -0
- package/src/testdata/nested-stacks/network/outputs.ts +17 -0
- package/src/testdata/nested-stacks/network/security.ts +17 -0
- package/src/testdata/nested-stacks/network/vpc.ts +54 -0
- package/dist/skills/aws-cloudformation.md +0 -41
- package/src/codegen/rollback.test.ts +0 -80
- package/src/codegen/rollback.ts +0 -20
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect } from "bun:test";
|
|
2
|
-
import { mkdirSync, writeFileSync, rmSync, readFileSync } from "fs";
|
|
3
|
-
import { join } from "path";
|
|
4
|
-
import { tmpdir } from "os";
|
|
5
|
-
import { snapshotArtifacts, saveSnapshot, restoreSnapshot, listSnapshots } from "./rollback";
|
|
6
|
-
|
|
7
|
-
function makeTempDir(): string {
|
|
8
|
-
const dir = join(tmpdir(), `chant-rollback-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
9
|
-
mkdirSync(dir, { recursive: true });
|
|
10
|
-
return dir;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
describe("rollback", () => {
|
|
14
|
-
test("snapshot captures generated files", () => {
|
|
15
|
-
const dir = makeTempDir();
|
|
16
|
-
const genDir = join(dir, "generated");
|
|
17
|
-
mkdirSync(genDir, { recursive: true });
|
|
18
|
-
|
|
19
|
-
writeFileSync(join(genDir, "lexicon-aws.json"), '{"Bucket":{"kind":"resource"}}');
|
|
20
|
-
writeFileSync(join(genDir, "index.d.ts"), "declare class Bucket {}");
|
|
21
|
-
writeFileSync(join(genDir, "index.ts"), "export const Bucket = {};");
|
|
22
|
-
|
|
23
|
-
const snapshot = snapshotArtifacts(genDir);
|
|
24
|
-
expect(snapshot.files["lexicon-aws.json"]).toBeDefined();
|
|
25
|
-
expect(snapshot.files["index.d.ts"]).toBeDefined();
|
|
26
|
-
expect(snapshot.files["index.ts"]).toBeDefined();
|
|
27
|
-
expect(snapshot.hashes["lexicon-aws.json"]).toBeDefined();
|
|
28
|
-
expect(snapshot.resourceCount).toBe(1);
|
|
29
|
-
|
|
30
|
-
rmSync(dir, { recursive: true, force: true });
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test("save and list snapshots", () => {
|
|
34
|
-
const dir = makeTempDir();
|
|
35
|
-
const snapshotsDir = join(dir, ".snapshots");
|
|
36
|
-
|
|
37
|
-
const snapshot = {
|
|
38
|
-
timestamp: "2025-01-01T00:00:00.000Z",
|
|
39
|
-
files: { "test.json": "{}" },
|
|
40
|
-
hashes: { "test.json": "abc123" },
|
|
41
|
-
resourceCount: 0,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
saveSnapshot(snapshot, snapshotsDir);
|
|
45
|
-
const list = listSnapshots(snapshotsDir);
|
|
46
|
-
expect(list.length).toBe(1);
|
|
47
|
-
expect(list[0].timestamp).toBe("2025-01-01T00:00:00.000Z");
|
|
48
|
-
|
|
49
|
-
rmSync(dir, { recursive: true, force: true });
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test("restore snapshot overwrites generated files", () => {
|
|
53
|
-
const dir = makeTempDir();
|
|
54
|
-
const genDir = join(dir, "generated");
|
|
55
|
-
const snapshotsDir = join(dir, ".snapshots");
|
|
56
|
-
mkdirSync(genDir, { recursive: true });
|
|
57
|
-
|
|
58
|
-
// Write original files
|
|
59
|
-
writeFileSync(join(genDir, "lexicon-aws.json"), '{"original":true}');
|
|
60
|
-
|
|
61
|
-
// Snapshot them
|
|
62
|
-
const snapshot = snapshotArtifacts(genDir);
|
|
63
|
-
const snapshotPath = saveSnapshot(snapshot, snapshotsDir);
|
|
64
|
-
|
|
65
|
-
// Overwrite with new content
|
|
66
|
-
writeFileSync(join(genDir, "lexicon-aws.json"), '{"modified":true}');
|
|
67
|
-
expect(readFileSync(join(genDir, "lexicon-aws.json"), "utf-8")).toBe('{"modified":true}');
|
|
68
|
-
|
|
69
|
-
// Restore
|
|
70
|
-
restoreSnapshot(snapshotPath, genDir);
|
|
71
|
-
expect(readFileSync(join(genDir, "lexicon-aws.json"), "utf-8")).toBe('{"original":true}');
|
|
72
|
-
|
|
73
|
-
rmSync(dir, { recursive: true, force: true });
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
test("listSnapshots returns empty for nonexistent dir", () => {
|
|
77
|
-
const list = listSnapshots("/nonexistent/path");
|
|
78
|
-
expect(list).toHaveLength(0);
|
|
79
|
-
});
|
|
80
|
-
});
|
package/src/codegen/rollback.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Re-export from core with AWS-specific artifact names.
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
snapshotArtifacts as _snapshotArtifacts,
|
|
6
|
-
saveSnapshot,
|
|
7
|
-
restoreSnapshot,
|
|
8
|
-
listSnapshots,
|
|
9
|
-
} from "@intentius/chant/codegen/rollback";
|
|
10
|
-
export type { ArtifactSnapshot, SnapshotInfo } from "@intentius/chant/codegen/rollback";
|
|
11
|
-
export { saveSnapshot, restoreSnapshot, listSnapshots };
|
|
12
|
-
|
|
13
|
-
const AWS_ARTIFACT_NAMES = ["lexicon-aws.json", "index.d.ts", "index.ts"];
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Snapshot AWS lexicon artifacts.
|
|
17
|
-
*/
|
|
18
|
-
export function snapshotArtifacts(generatedDir: string) {
|
|
19
|
-
return _snapshotArtifacts(generatedDir, AWS_ARTIFACT_NAMES);
|
|
20
|
-
}
|