@intentius/chant 0.52.2 → 0.53.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.
Files changed (125) hide show
  1. package/dist/cdk/advise.d.ts +29 -0
  2. package/dist/cdk/advise.d.ts.map +1 -0
  3. package/dist/cdk/assembly.d.ts +38 -0
  4. package/dist/cdk/assembly.d.ts.map +1 -0
  5. package/dist/cdk/graph.d.ts +68 -0
  6. package/dist/cdk/graph.d.ts.map +1 -0
  7. package/dist/cdk/tier-map.d.ts +44 -0
  8. package/dist/cdk/tier-map.d.ts.map +1 -0
  9. package/dist/cdk/types.d.ts +114 -0
  10. package/dist/cdk/types.d.ts.map +1 -0
  11. package/dist/cli/commands/carve-apply.d.ts.map +1 -1
  12. package/dist/cli/commands/carve-bridge.d.ts.map +1 -1
  13. package/dist/cli/commands/carve-emit.d.ts.map +1 -1
  14. package/dist/cli/commands/carve.d.ts +48 -6
  15. package/dist/cli/commands/carve.d.ts.map +1 -1
  16. package/dist/cli/handlers/carve-emit.d.ts.map +1 -1
  17. package/dist/cli/handlers/carve.d.ts +5 -4
  18. package/dist/cli/handlers/carve.d.ts.map +1 -1
  19. package/dist/cli/handlers/lifecycle.d.ts +10 -0
  20. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  21. package/dist/cli/handlers/op-progress.d.ts +37 -4
  22. package/dist/cli/handlers/op-progress.d.ts.map +1 -1
  23. package/dist/cli/handlers/operator.d.ts +61 -1
  24. package/dist/cli/handlers/operator.d.ts.map +1 -1
  25. package/dist/cli/handlers/run.d.ts.map +1 -1
  26. package/dist/cli/main.d.ts.map +1 -1
  27. package/dist/cli/registry.d.ts +9 -1
  28. package/dist/cli/registry.d.ts.map +1 -1
  29. package/dist/identity.d.ts +196 -0
  30. package/dist/identity.d.ts.map +1 -0
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/lexicon.d.ts +41 -0
  34. package/dist/lexicon.d.ts.map +1 -1
  35. package/dist/lifecycle/converge-ledger.d.ts +81 -1
  36. package/dist/lifecycle/converge-ledger.d.ts.map +1 -1
  37. package/dist/lifecycle/gate-ledger.d.ts +43 -1
  38. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  39. package/dist/terraform/adopt-state.d.ts +17 -66
  40. package/dist/terraform/adopt-state.d.ts.map +1 -1
  41. package/dist/terraform/aws-resources.d.ts +1 -1
  42. package/dist/terraform/carve-provider.d.ts +142 -0
  43. package/dist/terraform/carve-provider.d.ts.map +1 -0
  44. package/dist/terraform/carve.d.ts +36 -3
  45. package/dist/terraform/carve.d.ts.map +1 -1
  46. package/dist/terraform/emit-source.d.ts +25 -0
  47. package/dist/terraform/emit-source.d.ts.map +1 -0
  48. package/dist/terraform/graduate.d.ts +11 -1
  49. package/dist/terraform/graduate.d.ts.map +1 -1
  50. package/dist/terraform/providers/aws.d.ts +19 -0
  51. package/dist/terraform/providers/aws.d.ts.map +1 -0
  52. package/dist/terraform/providers/gcp.d.ts +41 -0
  53. package/dist/terraform/providers/gcp.d.ts.map +1 -0
  54. package/dist/terraform/providers/index.d.ts +15 -0
  55. package/dist/terraform/providers/index.d.ts.map +1 -0
  56. package/dist/terraform/providers/kubernetes.d.ts +29 -0
  57. package/dist/terraform/providers/kubernetes.d.ts.map +1 -0
  58. package/dist/terraform/score.d.ts +70 -4
  59. package/dist/terraform/score.d.ts.map +1 -1
  60. package/dist/terraform/tier-map.d.ts +30 -35
  61. package/dist/terraform/tier-map.d.ts.map +1 -1
  62. package/dist/terraform/types.d.ts +6 -0
  63. package/dist/terraform/types.d.ts.map +1 -1
  64. package/package.json +1 -1
  65. package/src/cdk/__fixtures__/cdk.out/AppStack.template.json +171 -0
  66. package/src/cdk/__fixtures__/cdk.out/DataStack.template.json +90 -0
  67. package/src/cdk/__fixtures__/cdk.out/cdk.out +1 -0
  68. package/src/cdk/__fixtures__/cdk.out/manifest.json +30 -0
  69. package/src/cdk/__fixtures__/cdk.out/tree.json +201 -0
  70. package/src/cdk/__fixtures__/cdk.out-dummy/LookupStack.template.json +29 -0
  71. package/src/cdk/__fixtures__/cdk.out-dummy/manifest.json +26 -0
  72. package/src/cdk/advise.test.ts +208 -0
  73. package/src/cdk/advise.ts +44 -0
  74. package/src/cdk/assembly.ts +133 -0
  75. package/src/cdk/graph.test.ts +206 -0
  76. package/src/cdk/graph.ts +525 -0
  77. package/src/cdk/tier-map.ts +71 -0
  78. package/src/cdk/types.ts +115 -0
  79. package/src/cli/commands/carve-apply.ts +20 -4
  80. package/src/cli/commands/carve-bridge.ts +9 -5
  81. package/src/cli/commands/carve-emit-k8s.test.ts +262 -0
  82. package/src/cli/commands/carve-emit-provider.test.ts +207 -0
  83. package/src/cli/commands/carve-emit.ts +28 -24
  84. package/src/cli/commands/carve.ts +139 -36
  85. package/src/cli/handlers/carve-emit.ts +8 -3
  86. package/src/cli/handlers/carve.ts +8 -7
  87. package/src/cli/handlers/lifecycle.test.ts +187 -1
  88. package/src/cli/handlers/lifecycle.ts +125 -1
  89. package/src/cli/handlers/op-progress.test.ts +67 -1
  90. package/src/cli/handlers/op-progress.ts +70 -14
  91. package/src/cli/handlers/operator.test.ts +302 -1
  92. package/src/cli/handlers/operator.ts +193 -5
  93. package/src/cli/handlers/run.ts +11 -13
  94. package/src/cli/main.test.ts +19 -0
  95. package/src/cli/main.ts +38 -10
  96. package/src/cli/registry.ts +9 -1
  97. package/src/identity.test.ts +199 -0
  98. package/src/identity.ts +346 -0
  99. package/src/index.ts +1 -0
  100. package/src/lexicon.ts +53 -0
  101. package/src/lifecycle/converge-ledger.test.ts +110 -0
  102. package/src/lifecycle/converge-ledger.ts +110 -2
  103. package/src/lifecycle/gate-ledger.test.ts +81 -1
  104. package/src/lifecycle/gate-ledger.ts +64 -1
  105. package/src/terraform/__fixtures__/gcp-estate/main.tf +60 -0
  106. package/src/terraform/adopt-state.test.ts +131 -0
  107. package/src/terraform/adopt-state.ts +19 -167
  108. package/src/terraform/aws-resources.test.ts +38 -22
  109. package/src/terraform/aws-resources.ts +1 -1
  110. package/src/terraform/carve-provider.test.ts +155 -0
  111. package/src/terraform/carve-provider.ts +237 -0
  112. package/src/terraform/carve.test.ts +55 -1
  113. package/src/terraform/carve.ts +0 -0
  114. package/src/terraform/emit-source.ts +39 -0
  115. package/src/terraform/graduate.test.ts +37 -0
  116. package/src/terraform/graduate.ts +55 -7
  117. package/src/terraform/graph.ts +3 -3
  118. package/src/terraform/providers/aws.ts +169 -0
  119. package/src/terraform/providers/gcp.test.ts +228 -0
  120. package/src/terraform/providers/gcp.ts +329 -0
  121. package/src/terraform/providers/index.ts +21 -0
  122. package/src/terraform/providers/kubernetes.ts +224 -0
  123. package/src/terraform/score.ts +111 -25
  124. package/src/terraform/tier-map.ts +45 -107
  125. package/src/terraform/types.ts +6 -0
@@ -18,11 +18,19 @@
18
18
  * expression in a block that manages no infrastructure, the same order of work
19
19
  * as recording an outbound deferred input. Hence 4, not 12.
20
20
  *
21
- * Sub-resources that inline into a parent (see `FOLDS_INTO`) are folded into the
21
+ * Sub-resources that inline into a parent (see `foldParentOf`) are folded into the
22
22
  * parent's carve set: they are removed from the ranking and their edge to the
23
23
  * parent is not counted as inbound — inlining them is free, not boundary work.
24
+ *
25
+ * The model itself is not Terraform-specific — the CDK cloud-assembly advisor
26
+ * (#1056) scores construct units with the same arithmetic. What differs per
27
+ * source is the type→tier lookup and the extra signals that source can see, so
28
+ * both are injectable via `ScoreOptions` rather than forked into a second
29
+ * scorer. Everything else — the six penalty terms, the clamp, the bands — is
30
+ * shared verbatim.
24
31
  */
25
- import type { TfGraph } from "./types.js";
32
+ import { type TierInfo } from "./tier-map.js";
33
+ import type { TfGraph, TfNode } from "./types.js";
26
34
  export type PeelabilityBand = "clean leaf" | "carvable w/ edits" | "leave in Terraform";
27
35
  export interface PeelabilityBreakdown {
28
36
  /** Inbound edges from resource/module blocks — a data-source patch each. */
@@ -33,7 +41,12 @@ export interface PeelabilityBreakdown {
33
41
  tier: 1 | 2 | 3 | null;
34
42
  hasDynamic: boolean;
35
43
  instances: number;
36
- /** Signed penalty contributions, for report transparency. */
44
+ /**
45
+ * Signed penalty contributions, for report transparency. The six shared terms
46
+ * are always present; a source-specific scorer may add its own keys (the CDK
47
+ * advisor's `asset`, say). A reader that sums the values reproduces the score;
48
+ * a reader that only knows the six named terms still reads those correctly.
49
+ */
37
50
  penalties: {
38
51
  inbound: number;
39
52
  outbound: number;
@@ -41,8 +54,26 @@ export interface PeelabilityBreakdown {
41
54
  tier: number;
42
55
  dynamic: number;
43
56
  instances: number;
57
+ [term: string]: number;
44
58
  };
45
59
  }
60
+ /**
61
+ * One unit of source a scored node stands for, when the node is a fold of
62
+ * several (#1056). A CDK construct emits 1..n CloudFormation resources and
63
+ * ranks once; this names the resources that carve with it. Absent on the
64
+ * Terraform path, where a fold is expressed by the child's absence from the
65
+ * ranking instead.
66
+ */
67
+ export interface CarveUnitMember {
68
+ /** Identifier within its template/estate — a CFN logical ID. */
69
+ id: string;
70
+ /** Resource type, e.g. `AWS::IAM::Role`. */
71
+ type: string;
72
+ /** The template/stack the member lives in. */
73
+ stack?: string;
74
+ /** The member's own source path, e.g. a CDK construct path. */
75
+ path?: string;
76
+ }
46
77
  export interface Peelability {
47
78
  address: string;
48
79
  kind: "resource" | "module";
@@ -51,11 +82,46 @@ export interface Peelability {
51
82
  /** Native spec type a carve would target; undefined for modules/unsupported. */
52
83
  mapsTo?: string;
53
84
  breakdown: PeelabilityBreakdown;
85
+ /**
86
+ * Source-specific facts about this node that the six penalty terms do not
87
+ * carry — why it was disqualified, what folded into it, what it is. Plain
88
+ * prose, for the report's benefit; nothing keys on it.
89
+ */
90
+ notes?: string[];
91
+ /** The source units folded into this node (#1056). */
92
+ members?: CarveUnitMember[];
93
+ }
94
+ /**
95
+ * Source-specific scoring input for one node, layered on the shared model.
96
+ * Everything here is optional: with no signals a node scores exactly as the
97
+ * Terraform path scores it.
98
+ */
99
+ export interface ScoreSignals {
100
+ /** Extra penalty terms, merged into `breakdown.penalties` and the total. */
101
+ penalties?: Record<string, number>;
102
+ notes?: string[];
103
+ members?: CarveUnitMember[];
104
+ /**
105
+ * When set, the node scores 0 and this is the stated reason. For claims the
106
+ * arithmetic cannot express — a CDK assembly synthesized from dummy lookup
107
+ * values is not a faithful picture of anything, so no score it produces is
108
+ * worth reading.
109
+ */
110
+ disqualified?: string;
111
+ }
112
+ export interface ScoreOptions {
113
+ /**
114
+ * Resource type → native tier. Defaults to the Terraform tier map; the CDK
115
+ * advisor passes a CloudFormation-keyed one. Modules keep the built-in
116
+ * {@link MODULE_TIER} treatment either way.
117
+ */
118
+ tierOf?: (type: string) => TierInfo | null;
119
+ signalsFor?: (node: TfNode) => ScoreSignals;
54
120
  }
55
121
  export declare function bandFor(score: number): PeelabilityBand;
56
122
  /**
57
123
  * Score every carvable node in the estate, ranked most-peelable first. Folded
58
124
  * sub-resources are omitted (they carve with their parent, not on their own).
59
125
  */
60
- export declare function scoreEstate(graph: TfGraph): Peelability[];
126
+ export declare function scoreEstate(graph: TfGraph, opts?: ScoreOptions): Peelability[];
61
127
  //# sourceMappingURL=score.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"score.d.ts","sourceRoot":"","sources":["../../src/terraform/score.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAU,MAAM,SAAS,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,mBAAmB,GAAG,oBAAoB,CAAC;AAExF,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,6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AC3C,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,CAAC;CAC7C;AAUD,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAItD;AAyGD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,GAAE,YAAiB,GAAG,WAAW,EAAE,CAMlF"}
@@ -1,56 +1,51 @@
1
1
  /**
2
- * Terraform-type → native-spec tier map for the carve-out advisor (#214 T3).
2
+ * Terraform-type → native-spec ranking for the carve-out advisor (#214 T3),
3
+ * resolved through the carve provider registry (`carve-provider.ts`, #2016).
3
4
  *
4
- * The AWS entries are derived from the single AWS carve-out table
5
- * (`aws-resources.ts`), so the advisor ranks exactly the AWS types `carve emit`
6
- * can produce — no advise↔emit cliff. Non-AWS entries (e.g. `kubernetes_manifest`)
7
- * are listed here directly; emit for those is a separate target.
5
+ * Every entry comes from a registered provider: the AWS ones from the single
6
+ * AWS carve-out table (`providers/aws.ts` over `aws-resources.ts`), so the
7
+ * advisor ranks exactly the AWS types `carve emit` can produce — no advise↔emit
8
+ * cliff — and the Kubernetes ones from `providers/kubernetes.ts`, which emits
9
+ * `kubernetes_manifest` and ranks the typed provider resources it does not.
8
10
  *
9
11
  * tier 1 — a clean 1:1 native resource
10
12
  * tier 2 — maps, but with reshaping
11
13
  * tier 3 — a hard/partial map
12
14
  * null — no known native mapping (unsupported provider/type) → score 0
13
- */
14
- export interface TierInfo {
15
- tier: 1 | 2 | 3;
16
- /** The native spec type a carve would target, for the report. */
17
- mapsTo: string;
18
- }
19
- /** TF resource type → native tier. Absent = unsupported (score 0). */
20
- export declare const TIER_MAP: Record<string, TierInfo>;
21
- /**
22
- * TF "sub-resource" types that inline into a parent resource rather than
23
- * standing alone (TF splits config the native spec keeps in one resource).
24
- * A sub-resource that shares its parent's name is folded into the parent's
25
- * carve set: it is not ranked on its own, and its edge to the parent does not
26
- * count as inbound boundary work — inlining it is free.
27
15
  *
28
- * Maps sub-resource TF type → parent TF type.
16
+ * These are functions, not frozen constants: the registry is open, so a
17
+ * provider registered after module load has to be visible here.
29
18
  */
30
- export declare const FOLDS_INTO: Record<string, string>;
19
+ import { type TierInfo } from "./carve-provider.js";
20
+ export { carveEmitTypes, type TierInfo } from "./carve-provider.js";
21
+ /** TF resource type → native tier, over every registered provider. Absent = unsupported (score 0). */
22
+ export declare function tierMap(): Readonly<Record<string, TierInfo>>;
23
+ export declare function resolveTier(tfType: string): TierInfo | null;
31
24
  /**
32
- * The HCL attribute carrying a resource's physical name, per type — AWS entries
33
- * derived from the carve-out table, non-AWS listed directly. A dotted entry is
34
- * a path into nested blocks (`manifest.metadata.name`). Used for the graph's
25
+ * The HCL attribute carrying a resource's physical name. A dotted entry is a
26
+ * path into nested blocks (`manifest.metadata.name`). Used for the graph's
35
27
  * identity and the live-import hint. Absent → fall back to the TF logical name.
36
28
  */
37
- export declare const IDENTITY_ATTR: Record<string, string>;
38
- export declare function resolveTier(tfType: string): TierInfo | null;
29
+ export declare function identityAttrOf(tfType: string): string | undefined;
30
+ /**
31
+ * The parent Terraform type a sub-resource folds into, if any. Terraform splits
32
+ * configuration the native spec keeps in one resource; a sub-resource sharing
33
+ * its parent's name carves with the parent rather than being ranked on its own.
34
+ */
35
+ export declare function foldParentOf(tfType: string): string | undefined;
39
36
  /**
40
37
  * Can `chant carve emit` produce chant source for this type? Narrower than
41
- * `resolveTier`: the tier map also ranks the kubernetes types, which advise
42
- * bands but no emit path can adopt (#999, blocked on the provider seam #2016).
43
- * Both emit paths — `--state` and `--env` — gate on this, so a type either
44
- * command refuses is refused by the other with the same message.
38
+ * `resolveTier`: providers also rank types no emit path can adopt (the typed
39
+ * `kubernetes_*` resources, whose manifest only the provider schema knows how
40
+ * to reassemble). Both emit paths — `--state` and `--env` — gate on this, so a
41
+ * type either command refuses is refused by the other with the same message.
45
42
  */
46
43
  export declare function canCarveEmit(tfType: string): boolean;
47
- /** The types `canCarveEmit` accepts, sorted, for user-facing hints. */
48
- export declare function carveEmitTypes(): string[];
49
44
  /**
50
45
  * Can `chant carve bridge` render a Terraform `data` source for this type? A
51
- * dotted `IDENTITY_ATTR` is a path into nested blocks, and a data source body
52
- * is flat `attr = value` — `manifest.metadata.name = "x"` is not valid HCL.
53
- * An absent entry is fine: the bridge writes a TODO comment for the identity.
46
+ * dotted identity attribute is a path into nested blocks, and a data source
47
+ * body is flat `attr = value` — `manifest.metadata.name = "x"` is not valid
48
+ * HCL. An absent entry is fine: the bridge writes a TODO comment instead.
54
49
  */
55
50
  export declare function canBridge(tfType: string): boolean;
56
51
  //# sourceMappingURL=tier-map.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tier-map.d.ts","sourceRoot":"","sources":["../../src/terraform/tier-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;CAChB;AA0CD,sEAAsE;AACtE,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAK7C,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiB7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGhD,CAAC;AAEF,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAE3D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,uEAAuE;AACvE,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAGjD"}
1
+ {"version":3,"file":"tier-map.d.ts","sourceRoot":"","sources":["../../src/terraform/tier-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAKL,KAAK,QAAQ,EACd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjE,sGAAsG;AACtG,wBAAgB,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAE5D;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE/D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAGjD"}
@@ -62,6 +62,12 @@ export interface TfEdge {
62
62
  * parameter. Empty when the reference came from a non-object block shape.
63
63
  */
64
64
  via: string[];
65
+ /**
66
+ * The two ends live in different templates — a CloudFormation
67
+ * `Fn::ImportValue` resolved through the exporting stack's `Outputs` (#1056).
68
+ * Never set on the Terraform path, where a single estate is one namespace.
69
+ */
70
+ crossStack?: boolean;
65
71
  }
66
72
  export interface TfGraph {
67
73
  nodes: TfNode[];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/terraform/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,+EAA+E;AAC/E,MAAM,WAAW,MAAM;IACrB,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,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
1
1
  {
2
2
  "name": "@intentius/chant",
3
- "version": "0.52.2",
3
+ "version": "0.53.1",
4
4
  "description": "Declarative infrastructure-as-code toolkit — TypeScript on Node.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",
@@ -0,0 +1,171 @@
1
+ {
2
+ "Parameters": {
3
+ "EnvName": {
4
+ "Type": "String",
5
+ "Default": "dev"
6
+ },
7
+ "BootstrapVersion": {
8
+ "Type": "AWS::SSM::Parameter::Value<String>",
9
+ "Default": "/cdk-bootstrap/hnb659fds/version",
10
+ "Description": "Version of the CDK Bootstrap resources in this environment"
11
+ }
12
+ },
13
+ "Conditions": {
14
+ "IsProd": { "Fn::Equals": [{ "Ref": "EnvName" }, "prod"] }
15
+ },
16
+ "Resources": {
17
+ "ApiQueue4A6E9832": {
18
+ "Type": "AWS::SQS::Queue",
19
+ "Properties": {
20
+ "VisibilityTimeout": 300
21
+ },
22
+ "UpdateReplacePolicy": "Delete",
23
+ "DeletionPolicy": "Delete",
24
+ "Metadata": {
25
+ "aws:cdk:path": "AppStack/Api/Queue/Resource"
26
+ }
27
+ },
28
+ "ApiTopic1B2C3D4E": {
29
+ "Type": "AWS::SNS::Topic",
30
+ "Properties": {
31
+ "DisplayName": "api-events"
32
+ },
33
+ "Metadata": {
34
+ "aws:cdk:path": "AppStack/Api/Topic/Resource"
35
+ }
36
+ },
37
+ "ApiTopicQueueSubscriptionAA11BB22": {
38
+ "Type": "AWS::SNS::Subscription",
39
+ "Properties": {
40
+ "Protocol": "sqs",
41
+ "TopicArn": { "Ref": "ApiTopic1B2C3D4E" },
42
+ "Endpoint": { "Fn::GetAtt": ["ApiQueue4A6E9832", "Arn"] }
43
+ },
44
+ "Metadata": {
45
+ "aws:cdk:path": "AppStack/Api/Topic/QueueSubscription/Resource"
46
+ }
47
+ },
48
+ "HandlerServiceRoleFCDC14AE": {
49
+ "Type": "AWS::IAM::Role",
50
+ "Properties": {
51
+ "AssumeRolePolicyDocument": {
52
+ "Statement": [
53
+ {
54
+ "Action": "sts:AssumeRole",
55
+ "Effect": "Allow",
56
+ "Principal": { "Service": "lambda.amazonaws.com" }
57
+ }
58
+ ],
59
+ "Version": "2012-10-17"
60
+ }
61
+ },
62
+ "Metadata": {
63
+ "aws:cdk:path": "AppStack/Handler/ServiceRole/Resource"
64
+ }
65
+ },
66
+ "HandlerServiceRoleDefaultPolicy4C43A1F9": {
67
+ "Type": "AWS::IAM::Policy",
68
+ "Properties": {
69
+ "PolicyDocument": {
70
+ "Statement": [
71
+ {
72
+ "Action": ["s3:GetObject", "s3:PutObject"],
73
+ "Effect": "Allow",
74
+ "Resource": {
75
+ "Fn::Join": [
76
+ "",
77
+ [
78
+ { "Fn::ImportValue": "DataStack:ExportsOutputFnGetAttAssets675B7A57ArnE0B2A4A8" },
79
+ "/*"
80
+ ]
81
+ ]
82
+ }
83
+ }
84
+ ],
85
+ "Version": "2012-10-17"
86
+ },
87
+ "PolicyName": "HandlerServiceRoleDefaultPolicy4C43A1F9",
88
+ "Roles": [{ "Ref": "HandlerServiceRoleFCDC14AE" }]
89
+ },
90
+ "Metadata": {
91
+ "aws:cdk:path": "AppStack/Handler/ServiceRole/DefaultPolicy/Resource"
92
+ }
93
+ },
94
+ "Handler886CB40B": {
95
+ "Type": "AWS::Lambda::Function",
96
+ "Properties": {
97
+ "Code": {
98
+ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" },
99
+ "S3Key": "9f8e7d6c5b4a39281706f5e4d3c2b1a09f8e7d6c5b4a39281706f5e4d3c2b1a0.zip"
100
+ },
101
+ "Environment": {
102
+ "Variables": {
103
+ "QUEUE_URL": { "Ref": "ApiQueue4A6E9832" }
104
+ }
105
+ },
106
+ "Handler": "index.handler",
107
+ "Role": { "Fn::GetAtt": ["HandlerServiceRoleFCDC14AE", "Arn"] },
108
+ "Runtime": "nodejs20.x"
109
+ },
110
+ "DependsOn": ["HandlerServiceRoleDefaultPolicy4C43A1F9", "HandlerServiceRoleFCDC14AE"],
111
+ "Metadata": {
112
+ "aws:cdk:path": "AppStack/Handler/Resource",
113
+ "aws:asset:path": "asset.9f8e7d6c5b4a39281706f5e4d3c2b1a0",
114
+ "aws:asset:is-bundled": false,
115
+ "aws:asset:property": "Code"
116
+ }
117
+ },
118
+ "LegacyBucket": {
119
+ "Type": "AWS::S3::Bucket",
120
+ "Condition": "IsProd",
121
+ "Properties": {
122
+ "BucketName": { "Fn::Sub": "legacy-${EnvName}-archive" }
123
+ },
124
+ "UpdateReplacePolicy": "Retain",
125
+ "DeletionPolicy": "Retain",
126
+ "Metadata": {
127
+ "aws:cdk:path": "AppStack/Legacy"
128
+ }
129
+ },
130
+ "ReportsNestedStackReportsNestedStackResource7B21D4C6": {
131
+ "Type": "AWS::CloudFormation::Stack",
132
+ "Properties": {
133
+ "TemplateURL": {
134
+ "Fn::Join": [
135
+ "",
136
+ [
137
+ "https://s3.",
138
+ { "Ref": "AWS::Region" },
139
+ ".",
140
+ { "Ref": "AWS::URLSuffix" },
141
+ "/cdk-hnb659fds-assets-",
142
+ { "Ref": "AWS::AccountId" },
143
+ "-",
144
+ { "Ref": "AWS::Region" },
145
+ "/1a2b3c4d5e6f70819a2b3c4d5e6f70819a2b3c4d5e6f70819a2b3c4d5e6f7081.json"
146
+ ]
147
+ ]
148
+ }
149
+ },
150
+ "UpdateReplacePolicy": "Delete",
151
+ "DeletionPolicy": "Delete",
152
+ "Metadata": {
153
+ "aws:cdk:path": "AppStack/Reports.NestedStack/Reports.NestedStackResource"
154
+ }
155
+ },
156
+ "CDKMetadata": {
157
+ "Type": "AWS::CDK::Metadata",
158
+ "Properties": {
159
+ "Analytics": "v2:deflate64:H4sIAAAAAAAA/y2K0QqAIAwAv8V3XVEE9V4fEEQfIGtJmDrYVoT4740ed3fY4wr7BgtCvIYuBl+w7gLuoIm2y9lgAWJv6TylOUYVXpLK5x0Ipp98yRz5Uqz+MvzQZlvibDpsMK1SUteYWvwNyxu2AlgAAAA="
160
+ },
161
+ "Metadata": {
162
+ "aws:cdk:path": "AppStack/CDKMetadata/Default"
163
+ }
164
+ }
165
+ },
166
+ "Outputs": {
167
+ "QueueUrl": {
168
+ "Value": { "Ref": "ApiQueue4A6E9832" }
169
+ }
170
+ }
171
+ }
@@ -0,0 +1,90 @@
1
+ {
2
+ "Parameters": {
3
+ "BootstrapVersion": {
4
+ "Type": "AWS::SSM::Parameter::Value<String>",
5
+ "Default": "/cdk-bootstrap/hnb659fds/version",
6
+ "Description": "Version of the CDK Bootstrap resources in this environment"
7
+ }
8
+ },
9
+ "Resources": {
10
+ "Assets675B7A57": {
11
+ "Type": "AWS::S3::Bucket",
12
+ "Properties": {
13
+ "BucketName": "myapp-assets-prod",
14
+ "VersioningConfiguration": { "Status": "Enabled" }
15
+ },
16
+ "UpdateReplacePolicy": "Retain",
17
+ "DeletionPolicy": "Retain",
18
+ "Metadata": {
19
+ "aws:cdk:path": "DataStack/Assets/Resource"
20
+ }
21
+ },
22
+ "AssetsPolicyE8B0F1C2": {
23
+ "Type": "AWS::S3::BucketPolicy",
24
+ "Properties": {
25
+ "Bucket": { "Ref": "Assets675B7A57" },
26
+ "PolicyDocument": {
27
+ "Statement": [
28
+ {
29
+ "Action": "s3:*",
30
+ "Condition": { "Bool": { "aws:SecureTransport": "false" } },
31
+ "Effect": "Deny",
32
+ "Principal": { "AWS": "*" },
33
+ "Resource": [
34
+ { "Fn::GetAtt": ["Assets675B7A57", "Arn"] },
35
+ { "Fn::Join": ["", [{ "Fn::GetAtt": ["Assets675B7A57", "Arn"] }, "/*"]] }
36
+ ]
37
+ }
38
+ ],
39
+ "Version": "2012-10-17"
40
+ }
41
+ },
42
+ "Metadata": {
43
+ "aws:cdk:path": "DataStack/Assets/Policy/Resource"
44
+ }
45
+ },
46
+ "Table778B6D2C": {
47
+ "Type": "AWS::DynamoDB::Table",
48
+ "Properties": {
49
+ "AttributeDefinitions": [{ "AttributeName": "pk", "AttributeType": "S" }],
50
+ "BillingMode": "PAY_PER_REQUEST",
51
+ "KeySchema": [{ "AttributeName": "pk", "KeyType": "HASH" }]
52
+ },
53
+ "UpdateReplacePolicy": "Delete",
54
+ "DeletionPolicy": "Delete",
55
+ "Metadata": {
56
+ "aws:cdk:path": "DataStack/Table/Resource"
57
+ }
58
+ },
59
+ "CDKMetadata": {
60
+ "Type": "AWS::CDK::Metadata",
61
+ "Properties": {
62
+ "Analytics": "v2:deflate64:H4sIAAAAAAAA/y2K0QqAIAwAv8V3XVEE9V4fEEQfIGtJmDrYVoT4740ed3fY4wr7BgtCvIYuBl+w7gLuoIm2y9lgAWJv6TylOUYVXpLK5x0Ipp98yRz5Uqz+MvzQZlvibDpsMK1SUteYWvwNyxu2AlgAAAA="
63
+ },
64
+ "Metadata": {
65
+ "aws:cdk:path": "DataStack/CDKMetadata/Default"
66
+ }
67
+ }
68
+ },
69
+ "Outputs": {
70
+ "ExportsOutputFnGetAttAssets675B7A57ArnE0B2A4A8": {
71
+ "Value": { "Fn::GetAtt": ["Assets675B7A57", "Arn"] },
72
+ "Export": { "Name": "DataStack:ExportsOutputFnGetAttAssets675B7A57ArnE0B2A4A8" }
73
+ },
74
+ "TableName": {
75
+ "Value": { "Ref": "Table778B6D2C" }
76
+ }
77
+ },
78
+ "Rules": {
79
+ "CheckBootstrapVersion": {
80
+ "Assertions": [
81
+ {
82
+ "Assert": {
83
+ "Fn::Not": [{ "Fn::Contains": [["1", "2", "3", "4", "5"], { "Ref": "BootstrapVersion" }] }]
84
+ },
85
+ "AssertDescription": "CDK bootstrap stack version 6 required."
86
+ }
87
+ ]
88
+ }
89
+ }
90
+ }
@@ -0,0 +1 @@
1
+ {"version":"36.0.0"}
@@ -0,0 +1,30 @@
1
+ {
2
+ "version": "36.0.0",
3
+ "artifacts": {
4
+ "DataStack": {
5
+ "type": "aws:cloudformation:stack",
6
+ "environment": "aws://unknown-account/unknown-region",
7
+ "properties": {
8
+ "templateFile": "DataStack.template.json",
9
+ "validateOnSynth": false
10
+ },
11
+ "displayName": "DataStack"
12
+ },
13
+ "AppStack": {
14
+ "type": "aws:cloudformation:stack",
15
+ "environment": "aws://unknown-account/unknown-region",
16
+ "properties": {
17
+ "templateFile": "AppStack.template.json",
18
+ "validateOnSynth": false
19
+ },
20
+ "dependencies": ["DataStack"],
21
+ "displayName": "AppStack"
22
+ },
23
+ "Tree": {
24
+ "type": "cdk:tree",
25
+ "properties": {
26
+ "file": "tree.json"
27
+ }
28
+ }
29
+ }
30
+ }