@intentius/chant-lexicon-aws 0.7.0 → 0.8.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 (224) hide show
  1. package/dist/actions/dynamodb.d.ts +11 -0
  2. package/dist/actions/dynamodb.d.ts.map +1 -0
  3. package/dist/actions/ecr.d.ts +5 -0
  4. package/dist/actions/ecr.d.ts.map +1 -0
  5. package/dist/actions/ecs.d.ts +6 -0
  6. package/dist/actions/ecs.d.ts.map +1 -0
  7. package/dist/actions/iam.d.ts +4 -0
  8. package/dist/actions/iam.d.ts.map +1 -0
  9. package/dist/actions/index.d.ts +10 -0
  10. package/dist/actions/index.d.ts.map +1 -0
  11. package/dist/actions/lambda.d.ts +6 -0
  12. package/dist/actions/lambda.d.ts.map +1 -0
  13. package/dist/actions/logs.d.ts +5 -0
  14. package/dist/actions/logs.d.ts.map +1 -0
  15. package/dist/actions/s3.d.ts +11 -0
  16. package/dist/actions/s3.d.ts.map +1 -0
  17. package/dist/actions/sns.d.ts +6 -0
  18. package/dist/actions/sns.d.ts.map +1 -0
  19. package/dist/actions/sqs.d.ts +6 -0
  20. package/dist/actions/sqs.d.ts.map +1 -0
  21. package/dist/codegen/docs-cli.d.ts +2 -0
  22. package/dist/codegen/docs-cli.d.ts.map +1 -0
  23. package/dist/codegen/docs.d.ts +15 -0
  24. package/dist/codegen/docs.d.ts.map +1 -0
  25. package/dist/codegen/extensions.d.ts +25 -0
  26. package/dist/codegen/extensions.d.ts.map +1 -0
  27. package/dist/codegen/fallback.d.ts +8 -0
  28. package/dist/codegen/fallback.d.ts.map +1 -0
  29. package/dist/codegen/generate-cli.d.ts +3 -0
  30. package/dist/codegen/generate-cli.d.ts.map +1 -0
  31. package/dist/codegen/generate-lexicon.d.ts +38 -0
  32. package/dist/codegen/generate-lexicon.d.ts.map +1 -0
  33. package/dist/codegen/generate-typescript.d.ts +16 -0
  34. package/dist/codegen/generate-typescript.d.ts.map +1 -0
  35. package/dist/codegen/generate.d.ts +15 -0
  36. package/dist/codegen/generate.d.ts.map +1 -0
  37. package/dist/codegen/naming.d.ts +16 -0
  38. package/dist/codegen/naming.d.ts.map +1 -0
  39. package/dist/codegen/package.d.ts +11 -0
  40. package/dist/codegen/package.d.ts.map +1 -0
  41. package/dist/codegen/patches.d.ts +37 -0
  42. package/dist/codegen/patches.d.ts.map +1 -0
  43. package/dist/codegen/sam.d.ts +9 -0
  44. package/dist/codegen/sam.d.ts.map +1 -0
  45. package/dist/codegen/typecheck.d.ts +5 -0
  46. package/dist/codegen/typecheck.d.ts.map +1 -0
  47. package/dist/codegen/versions.d.ts +20 -0
  48. package/dist/codegen/versions.d.ts.map +1 -0
  49. package/dist/composites/alb-shared.d.ts +16 -0
  50. package/dist/composites/alb-shared.d.ts.map +1 -0
  51. package/dist/composites/ec2-instance-role.d.ts +11 -0
  52. package/dist/composites/ec2-instance-role.d.ts.map +1 -0
  53. package/dist/composites/ecs-trust-policy.d.ts +11 -0
  54. package/dist/composites/ecs-trust-policy.d.ts.map +1 -0
  55. package/dist/composites/efs-with-access-point.d.ts +18 -0
  56. package/dist/composites/efs-with-access-point.d.ts.map +1 -0
  57. package/dist/composites/fargate-alb.d.ts +43 -0
  58. package/dist/composites/fargate-alb.d.ts.map +1 -0
  59. package/dist/composites/fargate-service.d.ts +51 -0
  60. package/dist/composites/fargate-service.d.ts.map +1 -0
  61. package/dist/composites/index.d.ts +35 -0
  62. package/dist/composites/index.d.ts.map +1 -0
  63. package/dist/composites/lambda-api.d.ts +13 -0
  64. package/dist/composites/lambda-api.d.ts.map +1 -0
  65. package/dist/composites/lambda-dynamodb.d.ts +20 -0
  66. package/dist/composites/lambda-dynamodb.d.ts.map +1 -0
  67. package/dist/composites/lambda-eventbridge.d.ts +14 -0
  68. package/dist/composites/lambda-eventbridge.d.ts.map +1 -0
  69. package/dist/composites/lambda-function.d.ts +90 -0
  70. package/dist/composites/lambda-function.d.ts.map +1 -0
  71. package/dist/composites/lambda-s3.d.ts +23 -0
  72. package/dist/composites/lambda-s3.d.ts.map +1 -0
  73. package/dist/composites/lambda-sns.d.ts +12 -0
  74. package/dist/composites/lambda-sns.d.ts.map +1 -0
  75. package/dist/composites/lambda-sqs.d.ts +13 -0
  76. package/dist/composites/lambda-sqs.d.ts.map +1 -0
  77. package/dist/composites/minimal-vpc.d.ts +12 -0
  78. package/dist/composites/minimal-vpc.d.ts.map +1 -0
  79. package/dist/composites/rds-instance.d.ts +40 -0
  80. package/dist/composites/rds-instance.d.ts.map +1 -0
  81. package/dist/composites/scheduled-lambda.d.ts +15 -0
  82. package/dist/composites/scheduled-lambda.d.ts.map +1 -0
  83. package/dist/composites/solr-fargate-service.d.ts +15 -0
  84. package/dist/composites/solr-fargate-service.d.ts.map +1 -0
  85. package/dist/composites/vpc-default.d.ts +49 -0
  86. package/dist/composites/vpc-default.d.ts.map +1 -0
  87. package/dist/coverage.d.ts +5 -0
  88. package/dist/coverage.d.ts.map +1 -0
  89. package/dist/default-tags.d.ts +57 -0
  90. package/dist/default-tags.d.ts.map +1 -0
  91. package/dist/detect.d.ts +3 -0
  92. package/dist/detect.d.ts.map +1 -0
  93. package/dist/generated/index.d.ts +10456 -0
  94. package/dist/generated/index.d.ts.map +1 -0
  95. package/dist/generated/runtime.d.ts +5 -0
  96. package/dist/generated/runtime.d.ts.map +1 -0
  97. package/dist/import/generator.d.ts +72 -0
  98. package/dist/import/generator.d.ts.map +1 -0
  99. package/dist/import/live-export.d.ts +12 -0
  100. package/dist/import/live-export.d.ts.map +1 -0
  101. package/dist/import/parser.d.ts +30 -0
  102. package/dist/import/parser.d.ts.map +1 -0
  103. package/dist/index.d.ts +27 -0
  104. package/dist/index.d.ts.map +1 -0
  105. package/dist/integrity.json +4 -4
  106. package/dist/intrinsics.d.ts +158 -0
  107. package/dist/intrinsics.d.ts.map +1 -0
  108. package/dist/lint/post-synth/cf-refs.d.ts +54 -0
  109. package/dist/lint/post-synth/cf-refs.d.ts.map +1 -0
  110. package/dist/lint/post-synth/cor020.d.ts +10 -0
  111. package/dist/lint/post-synth/cor020.d.ts.map +1 -0
  112. package/dist/lint/post-synth/ext001.d.ts +25 -0
  113. package/dist/lint/post-synth/ext001.d.ts.map +1 -0
  114. package/dist/lint/post-synth/index.d.ts +3 -0
  115. package/dist/lint/post-synth/index.d.ts.map +1 -0
  116. package/dist/lint/post-synth/waw010.d.ts +10 -0
  117. package/dist/lint/post-synth/waw010.d.ts.map +1 -0
  118. package/dist/lint/post-synth/waw011.d.ts +9 -0
  119. package/dist/lint/post-synth/waw011.d.ts.map +1 -0
  120. package/dist/lint/post-synth/waw013.d.ts +10 -0
  121. package/dist/lint/post-synth/waw013.d.ts.map +1 -0
  122. package/dist/lint/post-synth/waw014.d.ts +9 -0
  123. package/dist/lint/post-synth/waw014.d.ts.map +1 -0
  124. package/dist/lint/post-synth/waw015.d.ts +13 -0
  125. package/dist/lint/post-synth/waw015.d.ts.map +1 -0
  126. package/dist/lint/post-synth/waw016.d.ts +13 -0
  127. package/dist/lint/post-synth/waw016.d.ts.map +1 -0
  128. package/dist/lint/post-synth/waw017.d.ts +13 -0
  129. package/dist/lint/post-synth/waw017.d.ts.map +1 -0
  130. package/dist/lint/post-synth/waw018.d.ts +9 -0
  131. package/dist/lint/post-synth/waw018.d.ts.map +1 -0
  132. package/dist/lint/post-synth/waw019.d.ts +10 -0
  133. package/dist/lint/post-synth/waw019.d.ts.map +1 -0
  134. package/dist/lint/post-synth/waw020.d.ts +10 -0
  135. package/dist/lint/post-synth/waw020.d.ts.map +1 -0
  136. package/dist/lint/post-synth/waw021.d.ts +9 -0
  137. package/dist/lint/post-synth/waw021.d.ts.map +1 -0
  138. package/dist/lint/post-synth/waw022.d.ts +9 -0
  139. package/dist/lint/post-synth/waw022.d.ts.map +1 -0
  140. package/dist/lint/post-synth/waw023.d.ts +9 -0
  141. package/dist/lint/post-synth/waw023.d.ts.map +1 -0
  142. package/dist/lint/post-synth/waw024.d.ts +9 -0
  143. package/dist/lint/post-synth/waw024.d.ts.map +1 -0
  144. package/dist/lint/post-synth/waw025.d.ts +9 -0
  145. package/dist/lint/post-synth/waw025.d.ts.map +1 -0
  146. package/dist/lint/post-synth/waw026.d.ts +9 -0
  147. package/dist/lint/post-synth/waw026.d.ts.map +1 -0
  148. package/dist/lint/post-synth/waw027.d.ts +9 -0
  149. package/dist/lint/post-synth/waw027.d.ts.map +1 -0
  150. package/dist/lint/post-synth/waw028.d.ts +9 -0
  151. package/dist/lint/post-synth/waw028.d.ts.map +1 -0
  152. package/dist/lint/post-synth/waw029.d.ts +11 -0
  153. package/dist/lint/post-synth/waw029.d.ts.map +1 -0
  154. package/dist/lint/post-synth/waw030.d.ts +19 -0
  155. package/dist/lint/post-synth/waw030.d.ts.map +1 -0
  156. package/dist/lint/post-synth/waw031.d.ts +17 -0
  157. package/dist/lint/post-synth/waw031.d.ts.map +1 -0
  158. package/dist/lint/post-synth/waw032.d.ts +11 -0
  159. package/dist/lint/post-synth/waw032.d.ts.map +1 -0
  160. package/dist/lint/post-synth/waw033.d.ts +12 -0
  161. package/dist/lint/post-synth/waw033.d.ts.map +1 -0
  162. package/dist/lint/post-synth/waw034.d.ts +11 -0
  163. package/dist/lint/post-synth/waw034.d.ts.map +1 -0
  164. package/dist/lint/post-synth/waw035.d.ts +12 -0
  165. package/dist/lint/post-synth/waw035.d.ts.map +1 -0
  166. package/dist/lint/post-synth/waw036.d.ts +21 -0
  167. package/dist/lint/post-synth/waw036.d.ts.map +1 -0
  168. package/dist/lint/post-synth/waw037.d.ts +21 -0
  169. package/dist/lint/post-synth/waw037.d.ts.map +1 -0
  170. package/dist/lint/rules/hardcoded-region.d.ts +9 -0
  171. package/dist/lint/rules/hardcoded-region.d.ts.map +1 -0
  172. package/dist/lint/rules/iam-wildcard.d.ts +9 -0
  173. package/dist/lint/rules/iam-wildcard.d.ts.map +1 -0
  174. package/dist/lint/rules/index.d.ts +7 -0
  175. package/dist/lint/rules/index.d.ts.map +1 -0
  176. package/dist/lint/rules/s3-encryption.d.ts +9 -0
  177. package/dist/lint/rules/s3-encryption.d.ts.map +1 -0
  178. package/dist/lsp/completions.d.ts +6 -0
  179. package/dist/lsp/completions.d.ts.map +1 -0
  180. package/dist/lsp/hover.d.ts +6 -0
  181. package/dist/lsp/hover.d.ts.map +1 -0
  182. package/dist/manifest.json +1 -1
  183. package/dist/meta.json +47226 -71473
  184. package/dist/nested-stack.d.ts +75 -0
  185. package/dist/nested-stack.d.ts.map +1 -0
  186. package/dist/package-cli.d.ts +3 -0
  187. package/dist/package-cli.d.ts.map +1 -0
  188. package/dist/parameter.d.ts +14 -0
  189. package/dist/parameter.d.ts.map +1 -0
  190. package/dist/plugin.d.ts +9 -0
  191. package/dist/plugin.d.ts.map +1 -0
  192. package/dist/pseudo.d.ts +17 -0
  193. package/dist/pseudo.d.ts.map +1 -0
  194. package/dist/serializer.d.ts +6 -0
  195. package/dist/serializer.d.ts.map +1 -0
  196. package/dist/spec/fetch.d.ts +74 -0
  197. package/dist/spec/fetch.d.ts.map +1 -0
  198. package/dist/spec/parse.d.ts +65 -0
  199. package/dist/spec/parse.d.ts.map +1 -0
  200. package/dist/taggable.d.ts +11 -0
  201. package/dist/taggable.d.ts.map +1 -0
  202. package/dist/types/index.d.ts +36468 -78177
  203. package/dist/validate-cli.d.ts +3 -0
  204. package/dist/validate-cli.d.ts.map +1 -0
  205. package/dist/validate.d.ts +17 -0
  206. package/dist/validate.d.ts.map +1 -0
  207. package/package.json +24 -5
  208. package/src/codegen/__snapshots__/snapshot.test.ts.snap +0 -1
  209. package/src/codegen/fallback.ts +2 -0
  210. package/src/codegen/package.ts +1 -1
  211. package/src/codegen/sam.ts +18 -0
  212. package/src/composites/efs-with-access-point.ts +1 -1
  213. package/src/composites/fargate-service.ts +1 -1
  214. package/src/composites/lambda-api.ts +6 -2
  215. package/src/composites/lambda-function.ts +6 -1
  216. package/src/composites/lambda-s3.ts +7 -2
  217. package/src/composites/vpc-default.ts +25 -1
  218. package/src/detect.ts +19 -0
  219. package/src/generated/index.d.ts +36468 -78177
  220. package/src/generated/index.ts +110 -4962
  221. package/src/generated/lexicon-aws.json +47226 -71473
  222. package/src/lint/post-synth/index.ts +63 -0
  223. package/src/plugin.ts +7 -26
  224. package/src/spec/parse.ts +21 -1
@@ -0,0 +1,63 @@
1
+ // Code generated by chant generate. DO NOT EDIT.
2
+ import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
3
+ import { cor020 } from "./cor020";
4
+ import { ext001 } from "./ext001";
5
+ import { waw010 } from "./waw010";
6
+ import { waw011 } from "./waw011";
7
+ import { waw013 } from "./waw013";
8
+ import { waw014 } from "./waw014";
9
+ import { waw015 } from "./waw015";
10
+ import { waw016 } from "./waw016";
11
+ import { waw017 } from "./waw017";
12
+ import { waw018 } from "./waw018";
13
+ import { waw019 } from "./waw019";
14
+ import { waw020 } from "./waw020";
15
+ import { waw021 } from "./waw021";
16
+ import { waw022 } from "./waw022";
17
+ import { waw023 } from "./waw023";
18
+ import { waw024 } from "./waw024";
19
+ import { waw025 } from "./waw025";
20
+ import { waw026 } from "./waw026";
21
+ import { waw027 } from "./waw027";
22
+ import { waw028 } from "./waw028";
23
+ import { waw029 } from "./waw029";
24
+ import { waw030 } from "./waw030";
25
+ import { waw031 } from "./waw031";
26
+ import { waw032 } from "./waw032";
27
+ import { waw033 } from "./waw033";
28
+ import { waw034 } from "./waw034";
29
+ import { waw035 } from "./waw035";
30
+ import { waw036 } from "./waw036";
31
+ import { waw037 } from "./waw037";
32
+
33
+ export const postSynthChecks: PostSynthCheck[] = [
34
+ cor020,
35
+ ext001,
36
+ waw010,
37
+ waw011,
38
+ waw013,
39
+ waw014,
40
+ waw015,
41
+ waw016,
42
+ waw017,
43
+ waw018,
44
+ waw019,
45
+ waw020,
46
+ waw021,
47
+ waw022,
48
+ waw023,
49
+ waw024,
50
+ waw025,
51
+ waw026,
52
+ waw027,
53
+ waw028,
54
+ waw029,
55
+ waw030,
56
+ waw031,
57
+ waw032,
58
+ waw033,
59
+ waw034,
60
+ waw035,
61
+ waw036,
62
+ waw037,
63
+ ];
package/src/plugin.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { createRequire } from "module";
2
- import type { LexiconPlugin, IntrinsicDef, ResourceMetadata, ExportedTemplate, ResourceSelector } from "@intentius/chant/lexicon";
2
+ import { detectTemplate } from "./detect";
3
+ import type { LexiconPlugin, IntrinsicDef, ResourceMetadata, ExportedTemplate, ResourceSelector, InitTemplateSet } from "@intentius/chant/lexicon";
3
4
  const require = createRequire(import.meta.url);
4
5
  import type { LintRule } from "@intentius/chant/lint/rule";
5
6
  import type { TemplateParser } from "@intentius/chant/import/parser";
6
7
  import type { TypeScriptGenerator } from "@intentius/chant/import/generator";
7
8
  import type { CompletionContext, CompletionItem, HoverContext, HoverInfo } from "@intentius/chant/lsp/types";
8
- import { discoverLintRules, discoverPostSynthChecks } from "@intentius/chant/lint/discover";
9
+ import { discoverLintRules } from "@intentius/chant/lint/discover";
10
+ import { postSynthChecks as postSynthCheckList } from "./lint/post-synth";
9
11
  import { createSkillsLoader, createDiffTool, createCatalogResource } from "@intentius/chant/lexicon-plugin-helpers";
10
12
  import { readFileSync } from "fs";
11
13
  import { join, dirname } from "path";
@@ -59,7 +61,7 @@ export const awsPlugin: LexiconPlugin = {
59
61
  ];
60
62
  },
61
63
 
62
- initTemplates(template?: string) {
64
+ initTemplates(template?: string): InitTemplateSet {
63
65
  if (template === "eks") {
64
66
  return { src: {
65
67
  "infra/cluster.ts": `/**
@@ -234,27 +236,7 @@ export const logsBucket = new Bucket({
234
236
  } };
235
237
  },
236
238
 
237
- detectTemplate(data: unknown): boolean {
238
- if (typeof data !== "object" || data === null) return false;
239
- const obj = data as Record<string, unknown>;
240
-
241
- // CloudFormation has AWSTemplateFormatVersion
242
- if (obj.AWSTemplateFormatVersion !== undefined) return true;
243
-
244
- // Or Resources with AWS::* types
245
- if (typeof obj.Resources === "object" && obj.Resources !== null) {
246
- for (const resource of Object.values(obj.Resources as Record<string, unknown>)) {
247
- if (typeof resource === "object" && resource !== null) {
248
- const type = (resource as Record<string, unknown>).Type;
249
- if (typeof type === "string" && type.startsWith("AWS::")) {
250
- return true;
251
- }
252
- }
253
- }
254
- }
255
-
256
- return false;
257
- },
239
+ detectTemplate,
258
240
 
259
241
  templateParser(): TemplateParser {
260
242
  return new CFParser();
@@ -265,8 +247,7 @@ export const logsBucket = new Bucket({
265
247
  },
266
248
 
267
249
  postSynthChecks() {
268
- const postSynthDir = join(dirname(fileURLToPath(import.meta.url)), "lint", "post-synth");
269
- return discoverPostSynthChecks(postSynthDir, import.meta.url);
250
+ return postSynthCheckList;
270
251
  },
271
252
 
272
253
  async generate(options?: { verbose?: boolean }): Promise<void> {
package/src/spec/parse.ts CHANGED
@@ -17,9 +17,19 @@ import {
17
17
  type JsonSchemaProperty,
18
18
  type JsonSchemaDefinition,
19
19
  } from "@intentius/chant/codegen/json-schema";
20
+ import { boundPropertyTypes } from "@intentius/chant/codegen/bound-property-types";
20
21
 
21
22
  export type { PropertyConstraints } from "@intentius/chant/codegen/json-schema";
22
23
 
24
+ /**
25
+ * Maximum nesting depth of generated property-type interfaces. Bounds the
26
+ * shipped `.d.ts` size: property types reachable from a resource's top-level
27
+ * properties within this depth stay typed; deeper ones are loosened to
28
+ * `Record<string, unknown>`. Set high enough that the shapes composites consume
29
+ * (which reach a few levels into CFN config) remain typed. (#440)
30
+ */
31
+ const MAX_PROPERTY_TYPE_DEPTH = 3;
32
+
23
33
  export interface ParsedProperty {
24
34
  name: string;
25
35
  tsType: string;
@@ -182,6 +192,16 @@ export function parseCFNSchema(data: string | Buffer): SchemaParseResult {
182
192
  replacementStrategy = schema.replacementStrategy;
183
193
  }
184
194
 
195
+ // Bound the emitted property types to keep the shipped declaration small while
196
+ // preserving the shapes composites and shallow authoring rely on (#440).
197
+ const boundedPropertyTypes = boundPropertyTypes(
198
+ shortName,
199
+ props,
200
+ propertyTypes,
201
+ new Set(enums.map((e) => e.name)),
202
+ { maxDepth: MAX_PROPERTY_TYPE_DEPTH },
203
+ );
204
+
185
205
  return {
186
206
  resource: {
187
207
  typeName: schema.typeName,
@@ -195,7 +215,7 @@ export function parseCFNSchema(data: string | Buffer): SchemaParseResult {
195
215
  ...(replacementStrategy && { replacementStrategy }),
196
216
  ...(tagging && { tagging }),
197
217
  },
198
- propertyTypes,
218
+ propertyTypes: boundedPropertyTypes,
199
219
  enums,
200
220
  };
201
221
  }