@intentius/chant-lexicon-aws 0.109.0 → 0.111.0

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.
Files changed (46) hide show
  1. package/dist/condition.d.ts +12 -1
  2. package/dist/condition.d.ts.map +1 -1
  3. package/dist/import/generator.d.ts +69 -0
  4. package/dist/import/generator.d.ts.map +1 -1
  5. package/dist/import/parser.d.ts.map +1 -1
  6. package/dist/index.d.ts +4 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/integrity.json +4 -4
  9. package/dist/intrinsics.d.ts +58 -6
  10. package/dist/intrinsics.d.ts.map +1 -1
  11. package/dist/lint/post-synth/cf-refs.d.ts.map +1 -1
  12. package/dist/lint/post-synth/waw042.d.ts.map +1 -1
  13. package/dist/manifest.json +22 -1
  14. package/dist/mapping.d.ts +27 -0
  15. package/dist/mapping.d.ts.map +1 -0
  16. package/dist/parameter.d.ts +16 -1
  17. package/dist/parameter.d.ts.map +1 -1
  18. package/dist/plugin.d.ts.map +1 -1
  19. package/dist/rules/cf-refs.ts +12 -2
  20. package/dist/rules/waw042.ts +25 -4
  21. package/dist/serializer.d.ts.map +1 -1
  22. package/dist/template-sections.d.ts +44 -0
  23. package/dist/template-sections.d.ts.map +1 -0
  24. package/package.json +2 -2
  25. package/src/condition.test.ts +31 -0
  26. package/src/condition.ts +15 -1
  27. package/src/import/generator.test.ts +24 -3
  28. package/src/import/generator.ts +322 -49
  29. package/src/import/parser.test.ts +0 -1
  30. package/src/import/parser.ts +74 -21
  31. package/src/import/roundtrip-build.test.ts +322 -0
  32. package/src/import/roundtrip-fixtures.test.ts +3 -3
  33. package/src/index.ts +10 -0
  34. package/src/intrinsics.test.ts +7 -2
  35. package/src/intrinsics.ts +102 -13
  36. package/src/lint/post-synth/cf-refs.ts +12 -2
  37. package/src/lint/post-synth/waw019.test.ts +32 -0
  38. package/src/lint/post-synth/waw042.test.ts +28 -0
  39. package/src/lint/post-synth/waw042.ts +25 -4
  40. package/src/mapping.test.ts +64 -0
  41. package/src/mapping.ts +41 -0
  42. package/src/parameter.ts +22 -1
  43. package/src/plugin.test.ts +2 -1
  44. package/src/plugin.ts +3 -0
  45. package/src/serializer.ts +79 -12
  46. package/src/template-sections.ts +71 -0
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Template Description and Metadata — the template-level `Description` and
3
+ * `Metadata` sections of the synthesized CloudFormation template.
4
+ *
5
+ * Like `Transform` (./template-transform.ts), these belong to the template,
6
+ * not to a resource, so a project exports a declaration and the serializer
7
+ * lifts it to the top of the template. `chant import` writes them for the
8
+ * sections a template it imports has.
9
+ */
10
+
11
+ import { DECLARABLE_MARKER, type Declarable } from "@intentius/chant/declarable";
12
+
13
+ /** Marker symbol for a template description or metadata declaration. */
14
+ export const TEMPLATE_SECTION_MARKER = Symbol.for("chant.aws.templateSection");
15
+
16
+ /** A template-level section the serializer lifts: `Description` or `Metadata`. */
17
+ export interface TemplateSection extends Declarable {
18
+ readonly [TEMPLATE_SECTION_MARKER]: true;
19
+ readonly [DECLARABLE_MARKER]: true;
20
+ readonly lexicon: "aws";
21
+ readonly entityType: "chant:aws:templateSection";
22
+ readonly section: "Description" | "Metadata";
23
+ readonly value: unknown;
24
+ }
25
+
26
+ /** Type guard for TemplateSection. */
27
+ export function isTemplateSection(value: unknown): value is TemplateSection {
28
+ return (
29
+ typeof value === "object" &&
30
+ value !== null &&
31
+ TEMPLATE_SECTION_MARKER in value &&
32
+ (value as Record<symbol, unknown>)[TEMPLATE_SECTION_MARKER] === true
33
+ );
34
+ }
35
+
36
+ function templateSection(section: TemplateSection["section"], value: unknown): TemplateSection {
37
+ return {
38
+ [TEMPLATE_SECTION_MARKER]: true,
39
+ [DECLARABLE_MARKER]: true,
40
+ lexicon: "aws",
41
+ entityType: "chant:aws:templateSection",
42
+ section,
43
+ value,
44
+ };
45
+ }
46
+
47
+ /**
48
+ * Declare the template's top-level `Description`. One per template.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * export const description = templateDescription("Queue and its dead-letter queue");
53
+ * ```
54
+ */
55
+ export function templateDescription(description: string): TemplateSection {
56
+ return templateSection("Description", description);
57
+ }
58
+
59
+ /**
60
+ * Declare entries in the template's top-level `Metadata`
61
+ * (`AWS::CloudFormation::Interface`, `cfn-lint` settings). Several
62
+ * declarations merge; keys chant writes itself are added after them.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * export const metadata = templateMetadata({ "cfn-lint": { config: { ignore_checks: ["W3005"] } } });
67
+ * ```
68
+ */
69
+ export function templateMetadata(metadata: Record<string, unknown>): TemplateSection {
70
+ return templateSection("Metadata", metadata);
71
+ }