@distilled.cloud/core 1.0.0-rc.17 → 1.0.0-rc.18

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 (259) hide show
  1. package/lib/_bundle/base.js +2 -2
  2. package/lib/_bundle/base.js.map +1 -1
  3. package/lib/_bundle/graphql.js +2 -2
  4. package/lib/_bundle/graphql.js.map +1 -1
  5. package/lib/_bundle/rest.js +1 -1
  6. package/lib/_bundle/rest.js.map +1 -1
  7. package/lib/annotations.d.ts +15 -0
  8. package/lib/annotations.d.ts.map +1 -0
  9. package/lib/annotations.js +2 -0
  10. package/lib/annotations.js.map +1 -0
  11. package/lib/api.d.ts +15 -0
  12. package/lib/api.d.ts.map +1 -1
  13. package/lib/api.js +1 -1
  14. package/lib/category.d.ts.map +1 -1
  15. package/lib/config.d.ts +54 -13
  16. package/lib/config.d.ts.map +1 -1
  17. package/lib/config.js +1 -1
  18. package/lib/debug.d.ts.map +1 -1
  19. package/lib/error-category.d.ts.map +1 -1
  20. package/lib/errors.d.ts +2 -13
  21. package/lib/errors.d.ts.map +1 -1
  22. package/lib/errors.js +1 -1
  23. package/lib/graphql.d.ts +14 -0
  24. package/lib/graphql.d.ts.map +1 -1
  25. package/lib/index.d.ts +3 -2
  26. package/lib/index.d.ts.map +1 -1
  27. package/lib/index.js +1 -0
  28. package/lib/pagination.d.ts +34 -2
  29. package/lib/pagination.d.ts.map +1 -1
  30. package/lib/pagination.js +1 -1
  31. package/lib/protocol-http.d.ts +30 -6
  32. package/lib/protocol-http.d.ts.map +1 -1
  33. package/lib/protocol-http.js +1 -1
  34. package/lib/protocol-rest.d.ts +53 -39
  35. package/lib/protocol-rest.d.ts.map +1 -1
  36. package/lib/protocol-rest.js +1 -1
  37. package/lib/response-validation.d.ts +4 -3
  38. package/lib/response-validation.d.ts.map +1 -1
  39. package/lib/schema-lite-typed.js +1 -2
  40. package/lib/telemetry-debug.d.ts +14 -0
  41. package/lib/telemetry-debug.d.ts.map +1 -0
  42. package/lib/telemetry-debug.js +2 -0
  43. package/lib/telemetry-debug.js.map +1 -0
  44. package/lib/telemetry-hooks.d.ts +32 -0
  45. package/lib/telemetry-hooks.d.ts.map +1 -0
  46. package/lib/telemetry-hooks.js +2 -0
  47. package/lib/telemetry-hooks.js.map +1 -0
  48. package/lib/telemetry-host-rules.d.ts +23 -0
  49. package/lib/telemetry-host-rules.d.ts.map +1 -0
  50. package/lib/telemetry-host-rules.js +2 -0
  51. package/lib/telemetry-host-rules.js.map +1 -0
  52. package/lib/telemetry-lambda-context.d.ts +17 -0
  53. package/lib/telemetry-lambda-context.d.ts.map +1 -0
  54. package/lib/telemetry-lambda-context.js +2 -0
  55. package/lib/telemetry-lambda-context.js.map +1 -0
  56. package/lib/telemetry-message-context.d.ts +52 -0
  57. package/lib/telemetry-message-context.d.ts.map +1 -0
  58. package/lib/telemetry-message-context.js +2 -0
  59. package/lib/telemetry-message-context.js.map +1 -0
  60. package/lib/telemetry-metrics.d.ts +6 -0
  61. package/lib/telemetry-metrics.d.ts.map +1 -0
  62. package/lib/telemetry-metrics.js +2 -0
  63. package/lib/telemetry-metrics.js.map +1 -0
  64. package/lib/telemetry-name-template.d.ts +13 -0
  65. package/lib/telemetry-name-template.d.ts.map +1 -0
  66. package/lib/telemetry-name-template.js +2 -0
  67. package/lib/telemetry-name-template.js.map +1 -0
  68. package/lib/telemetry-stream.d.ts +9 -0
  69. package/lib/telemetry-stream.d.ts.map +1 -0
  70. package/lib/telemetry-stream.js +2 -0
  71. package/lib/telemetry-stream.js.map +1 -0
  72. package/lib/telemetry-xray.d.ts +28 -0
  73. package/lib/telemetry-xray.d.ts.map +1 -0
  74. package/lib/telemetry-xray.js +2 -0
  75. package/lib/telemetry-xray.js.map +1 -0
  76. package/lib/telemetry.d.ts +269 -0
  77. package/lib/telemetry.d.ts.map +1 -0
  78. package/lib/telemetry.js +3 -0
  79. package/lib/telemetry.js.map +1 -0
  80. package/package.json +1 -3
  81. package/src/annotations.ts +37 -0
  82. package/src/api.ts +123 -24
  83. package/src/category.ts +21 -22
  84. package/src/config.ts +58 -29
  85. package/src/debug.ts +9 -6
  86. package/src/error-category.ts +12 -14
  87. package/src/errors.ts +7 -7
  88. package/src/graphql.ts +123 -18
  89. package/src/index.ts +3 -2
  90. package/src/pagination.ts +119 -6
  91. package/src/protocol-http.ts +63 -43
  92. package/src/protocol-rest.ts +201 -140
  93. package/src/response-validation.ts +4 -3
  94. package/src/telemetry-debug.ts +135 -0
  95. package/src/telemetry-hooks.ts +33 -0
  96. package/src/telemetry-host-rules.ts +39 -0
  97. package/src/telemetry-lambda-context.ts +46 -0
  98. package/src/telemetry-message-context.ts +170 -0
  99. package/src/telemetry-metrics.ts +69 -0
  100. package/src/telemetry-name-template.ts +26 -0
  101. package/src/telemetry-stream.ts +91 -0
  102. package/src/telemetry-xray.ts +66 -0
  103. package/src/telemetry.ts +768 -0
  104. package/lib/codegen/boolean-string-enums.d.ts +0 -36
  105. package/lib/codegen/boolean-string-enums.d.ts.map +0 -1
  106. package/lib/codegen/boolean-string-enums.js +0 -147
  107. package/lib/codegen/boolean-string-enums.js.map +0 -1
  108. package/lib/codegen/chunk.d.ts +0 -7
  109. package/lib/codegen/chunk.d.ts.map +0 -1
  110. package/lib/codegen/chunk.js +0 -139
  111. package/lib/codegen/chunk.js.map +0 -1
  112. package/lib/codegen/cli.d.ts +0 -80
  113. package/lib/codegen/cli.d.ts.map +0 -1
  114. package/lib/codegen/cli.js +0 -166
  115. package/lib/codegen/cli.js.map +0 -1
  116. package/lib/codegen/datafy.d.ts +0 -14
  117. package/lib/codegen/datafy.d.ts.map +0 -1
  118. package/lib/codegen/datafy.js +0 -853
  119. package/lib/codegen/datafy.js.map +0 -1
  120. package/lib/codegen/dedupe.d.ts +0 -5
  121. package/lib/codegen/dedupe.d.ts.map +0 -1
  122. package/lib/codegen/dedupe.js +0 -153
  123. package/lib/codegen/dedupe.js.map +0 -1
  124. package/lib/codegen/emit.d.ts +0 -125
  125. package/lib/codegen/emit.d.ts.map +0 -1
  126. package/lib/codegen/emit.js +0 -99
  127. package/lib/codegen/emit.js.map +0 -1
  128. package/lib/codegen/format.d.ts +0 -11
  129. package/lib/codegen/format.d.ts.map +0 -1
  130. package/lib/codegen/format.js +0 -32
  131. package/lib/codegen/format.js.map +0 -1
  132. package/lib/codegen/generated-at.d.ts +0 -29
  133. package/lib/codegen/generated-at.d.ts.map +0 -1
  134. package/lib/codegen/generated-at.js +0 -78
  135. package/lib/codegen/generated-at.js.map +0 -1
  136. package/lib/codegen/generator.d.ts +0 -353
  137. package/lib/codegen/generator.d.ts.map +0 -1
  138. package/lib/codegen/generator.js +0 -810
  139. package/lib/codegen/generator.js.map +0 -1
  140. package/lib/codegen/graph.d.ts +0 -36
  141. package/lib/codegen/graph.d.ts.map +0 -1
  142. package/lib/codegen/graph.js +0 -136
  143. package/lib/codegen/graph.js.map +0 -1
  144. package/lib/codegen/graphql-client.d.ts +0 -70
  145. package/lib/codegen/graphql-client.d.ts.map +0 -1
  146. package/lib/codegen/graphql-client.js +0 -439
  147. package/lib/codegen/graphql-client.js.map +0 -1
  148. package/lib/codegen/graphql.d.ts +0 -207
  149. package/lib/codegen/graphql.d.ts.map +0 -1
  150. package/lib/codegen/graphql.js +0 -786
  151. package/lib/codegen/graphql.js.map +0 -1
  152. package/lib/codegen/latin1.d.ts +0 -3
  153. package/lib/codegen/latin1.d.ts.map +0 -1
  154. package/lib/codegen/latin1.js +0 -126
  155. package/lib/codegen/latin1.js.map +0 -1
  156. package/lib/codegen/members.d.ts +0 -32
  157. package/lib/codegen/members.d.ts.map +0 -1
  158. package/lib/codegen/members.js +0 -62
  159. package/lib/codegen/members.js.map +0 -1
  160. package/lib/codegen/model-diff.d.ts +0 -10
  161. package/lib/codegen/model-diff.d.ts.map +0 -1
  162. package/lib/codegen/model-diff.js +0 -67
  163. package/lib/codegen/model-diff.js.map +0 -1
  164. package/lib/codegen/naming.d.ts +0 -29
  165. package/lib/codegen/naming.d.ts.map +0 -1
  166. package/lib/codegen/naming.js +0 -74
  167. package/lib/codegen/naming.js.map +0 -1
  168. package/lib/codegen/openapi-cli.d.ts +0 -52
  169. package/lib/codegen/openapi-cli.d.ts.map +0 -1
  170. package/lib/codegen/openapi-cli.js +0 -84
  171. package/lib/codegen/openapi-cli.js.map +0 -1
  172. package/lib/codegen/openapi.d.ts +0 -209
  173. package/lib/codegen/openapi.d.ts.map +0 -1
  174. package/lib/codegen/openapi.js +0 -1548
  175. package/lib/codegen/openapi.js.map +0 -1
  176. package/lib/codegen/operations.d.ts +0 -24
  177. package/lib/codegen/operations.d.ts.map +0 -1
  178. package/lib/codegen/operations.js +0 -56
  179. package/lib/codegen/operations.js.map +0 -1
  180. package/lib/codegen/pagination.d.ts +0 -39
  181. package/lib/codegen/pagination.d.ts.map +0 -1
  182. package/lib/codegen/pagination.js +0 -31
  183. package/lib/codegen/pagination.js.map +0 -1
  184. package/lib/codegen/patch-audit.d.ts +0 -84
  185. package/lib/codegen/patch-audit.d.ts.map +0 -1
  186. package/lib/codegen/patch-audit.js +0 -366
  187. package/lib/codegen/patch-audit.js.map +0 -1
  188. package/lib/codegen/patches.d.ts +0 -129
  189. package/lib/codegen/patches.d.ts.map +0 -1
  190. package/lib/codegen/patches.js +0 -472
  191. package/lib/codegen/patches.js.map +0 -1
  192. package/lib/codegen/prelude.d.ts +0 -15
  193. package/lib/codegen/prelude.d.ts.map +0 -1
  194. package/lib/codegen/prelude.js +0 -60
  195. package/lib/codegen/prelude.js.map +0 -1
  196. package/lib/codegen/privatize.d.ts +0 -21
  197. package/lib/codegen/privatize.d.ts.map +0 -1
  198. package/lib/codegen/privatize.js +0 -176
  199. package/lib/codegen/privatize.js.map +0 -1
  200. package/lib/codegen/proto.d.ts +0 -121
  201. package/lib/codegen/proto.d.ts.map +0 -1
  202. package/lib/codegen/proto.js +0 -960
  203. package/lib/codegen/proto.js.map +0 -1
  204. package/lib/codegen/pure.d.ts +0 -6
  205. package/lib/codegen/pure.d.ts.map +0 -1
  206. package/lib/codegen/pure.js +0 -91
  207. package/lib/codegen/pure.js.map +0 -1
  208. package/lib/codegen/rewrite-operation-ids.d.ts +0 -154
  209. package/lib/codegen/rewrite-operation-ids.d.ts.map +0 -1
  210. package/lib/codegen/rewrite-operation-ids.js +0 -1117
  211. package/lib/codegen/rewrite-operation-ids.js.map +0 -1
  212. package/lib/codegen/spec-path.d.ts +0 -16
  213. package/lib/codegen/spec-path.d.ts.map +0 -1
  214. package/lib/codegen/spec-path.js +0 -101
  215. package/lib/codegen/spec-path.js.map +0 -1
  216. package/lib/codegen/table.d.ts +0 -5
  217. package/lib/codegen/table.d.ts.map +0 -1
  218. package/lib/codegen/table.js +0 -249
  219. package/lib/codegen/table.js.map +0 -1
  220. package/lib/json-patch.d.ts +0 -58
  221. package/lib/json-patch.d.ts.map +0 -1
  222. package/lib/json-patch.js +0 -2
  223. package/lib/json-patch.js.map +0 -1
  224. package/lib/schema-lite-typed.js.map +0 -1
  225. package/lib/testing.d.ts +0 -40
  226. package/lib/testing.d.ts.map +0 -1
  227. package/lib/testing.js +0 -2
  228. package/lib/testing.js.map +0 -1
  229. package/src/codegen/boolean-string-enums.ts +0 -155
  230. package/src/codegen/chunk.ts +0 -147
  231. package/src/codegen/cli.ts +0 -293
  232. package/src/codegen/datafy.ts +0 -874
  233. package/src/codegen/dedupe.ts +0 -173
  234. package/src/codegen/emit.ts +0 -200
  235. package/src/codegen/format.ts +0 -49
  236. package/src/codegen/generated-at.ts +0 -88
  237. package/src/codegen/generator.ts +0 -1229
  238. package/src/codegen/graph.ts +0 -151
  239. package/src/codegen/graphql-client.ts +0 -545
  240. package/src/codegen/graphql.ts +0 -1145
  241. package/src/codegen/latin1.ts +0 -131
  242. package/src/codegen/members.ts +0 -79
  243. package/src/codegen/model-diff.ts +0 -67
  244. package/src/codegen/naming.ts +0 -85
  245. package/src/codegen/openapi-cli.ts +0 -141
  246. package/src/codegen/openapi.ts +0 -1845
  247. package/src/codegen/operations.ts +0 -73
  248. package/src/codegen/pagination.ts +0 -64
  249. package/src/codegen/patch-audit.ts +0 -480
  250. package/src/codegen/patches.ts +0 -581
  251. package/src/codegen/prelude.ts +0 -70
  252. package/src/codegen/privatize.ts +0 -200
  253. package/src/codegen/proto.ts +0 -1092
  254. package/src/codegen/pure.ts +0 -94
  255. package/src/codegen/rewrite-operation-ids.ts +0 -1219
  256. package/src/codegen/spec-path.ts +0 -112
  257. package/src/codegen/table.ts +0 -254
  258. package/src/json-patch.ts +0 -273
  259. package/src/testing.ts +0 -74
@@ -1,84 +0,0 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
- import * as fs from "node:fs/promises";
16
- import * as path from "node:path";
17
- import { convertOpenApiToSmithy } from "./openapi.js";
18
- import { finalizeConvert } from "./patches.js";
19
- import { resolveSpecPath } from "./spec-path.js";
20
- const exists = async (p) => {
21
- try {
22
- await fs.access(p);
23
- return true;
24
- }
25
- catch {
26
- return false;
27
- }
28
- };
29
-
30
- export const runOpenApiConvert = async (o) => {
31
- const outDir = path.resolve(o.root, o.outDir ?? ".generated-specs");
32
- const patchRoot = o.patchesDir === false ? undefined : path.resolve(o.root, o.patchesDir ?? "patches");
33
- const parse = o.parse ?? ((text) => JSON.parse(text));
34
- const onStalePatch = o.onStalePatch ?? "fail";
35
- await fs.mkdir(outDir, { recursive: true });
36
- console.log("🛠️ openapi → smithy");
37
- console.log(` Output: ${outDir}`);
38
- // Each spec's patch dir, relative to the patch root: `<name>/` when it
39
- // exists, else the root itself for a single-spec provider.
40
- const patchDirs = new Map();
41
- if (patchRoot && (await exists(patchRoot))) {
42
- for (const entry of o.specs) {
43
- if (await exists(path.join(patchRoot, entry.name)))
44
- patchDirs.set(entry.name, entry.name);
45
- else if (o.specs.length === 1)
46
- patchDirs.set(entry.name, "");
47
- }
48
- }
49
- for (const entry of o.specs) {
50
- // Production path by default; `specs/.local` under DISTILLED_SPECS_LOCAL.
51
- const specPath = resolveSpecPath(o.root, entry.specPath);
52
- let spec = parse(await fs.readFile(specPath, "utf8"), specPath);
53
- // ---- Preprocess hook ----
54
- if (entry.preprocess) {
55
- const replaced = await entry.preprocess(spec);
56
- if (replaced !== undefined)
57
- spec = replaced;
58
- }
59
- // ---- Convert, write ----
60
- const model = convertOpenApiToSmithy(spec, {
61
- deferNaming: true,
62
- ...o.options,
63
- ...entry.options,
64
- });
65
- const opCount = Object.values(model.shapes).filter((s) => s.type === "operation").length;
66
- const outPath = path.join(outDir, `${entry.name}.json`);
67
- await fs.writeFile(outPath, JSON.stringify(model, null, 2) + "\n");
68
- console.log(` ✅ ${entry.name}: ${opCount} operations, ${Object.keys(model.shapes).length} shapes`);
69
- }
70
- if (o.finalize !== false) {
71
- const written = new Set(o.specs.map((s) => s.name));
72
- await finalizeConvert({
73
- root: o.root,
74
- outDir,
75
- patchesDir: patchRoot ?? false,
76
- patchesFor: (resource) => patchDirs.get(resource),
77
- onStalePatch,
78
- // The converter computed the names; finalize only applies them.
79
- operationNaming: "as-is",
80
- include: (resource) => written.has(resource),
81
- });
82
- }
83
- };
84
- //# sourceMappingURL=openapi-cli.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openapi-cli.js","sourceRoot":"","sources":["../../src/codegen/openapi-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAA8B,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAoDjD,MAAM,MAAM,GAAG,KAAK,EAAE,CAAS,EAAoB,EAAE;IACnD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IAC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AC,GAAG,IAAI,CAAC,CAAC;QACnE,OAAO,CAAC,GAAG,CACT,QAAQ,KAAK,CAAC,IAAI,KAAK,OAAO,gBAAgB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,SAAS,CACxF,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACpD,MAAM,eAAe,CAAC;YACpB,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,MAAM;YACN,UAAU,EAAE,SAAS,IAAI,KAAK;YAC9B,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC;YACjD,YAAY;YACZ,gEAAgE;YAChE,eAAe,EAAE,OAAO;YACxB,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;SAC7C,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
@@ -1,209 +0,0 @@
1
- /**
2
- * OpenAPI → Smithy 2.0 JSON converter (dev-time only, provider-agnostic).
3
- *
4
- * Turns a Swagger 2.0 / OAS 3.0 / OAS 3.1 document into the same Smithy JSON
5
- * model shape the other spec converters produce (`{ smithy: "2.0", metadata,
6
- * shapes }`), so every OpenAPI-sourced provider flows through the one shared
7
- * `generateService` compiler. Conversion fidelity follows distilled v0's
8
- * `generate-openapi.ts` feature matrix:
9
- *
10
- * • one operation per (path × get/post/put/patch/delete — plus head/options
11
- * when a provider opts in via `extraHttpMethods`), deprecated skipped by
12
- * default; op shape name = PascalCase(operationId), or verbNoun
13
- * (`Apps_list` → `ListApps`) when {@link OpenApiConvertOptions.operationNaming}
14
- * is `"verbNoun"`
15
- * • input `<Op>Request`: path params → `smithy.api#httpLabel` (+required),
16
- * query params → `smithy.api#httpQuery`, header params →
17
- * `smithy.api#httpHeader` when `headerParams` is on (dropped otherwise,
18
- * as cookie params always are),
19
- * body properties flattened alongside
20
- * (labels win, then query, then headers, then body);
21
- * non-object bodies become a sole `body` member with `smithy.api#httpPayload`
22
- * • `$ref`s become NAMED shapes (`components/schemas/X` → `<ns>#X`), reused
23
- * across operations; anonymous nested objects synthesize names from the
24
- * parent + member path
25
- * • responses: 200 → 201 → 204 precedence (`successStatuses` overrides),
26
- * JSON or opt-in binary `application/octet-stream`; object
27
- * results become `<Op>Response` structures (a sole `$ref` reuses the named
28
- * shape); bare array/scalar results wrap in a structure whose single
29
- * member carries `com.distilled.openapi#rawResponse` (the SdkSpec maps it
30
- * to a root pipe); no schema → `smithy.api#Unit`; `head` is always
31
- * `smithy.api#Unit`, whatever content the spec declares
32
- * • nullability (3.0 `nullable`, 3.1 `type: [..., "null"]`, 2.0
33
- * `x-nullable`, `oneOf`/`anyOf` null branches) → member-level
34
- * `com.distilled.openapi#nullable` trait
35
- * • sensitive string members (x-sensitive or name-pattern match) →
36
- * `smithy.api#sensitive` on the member (direction-agnostic; the SdkSpec
37
- * decides the input/output treatment)
38
- * • per-op non-2xx statuses (outside `defaultErrorStatuses`) → typed error
39
- * shapes with `smithy.api#error`/`smithy.api#httpError` and
40
- * `com.distilled.openapi#errorMatchers` status matchers
41
- * • v0 pagination detection (`pagination.cursor` / `.next` / `.next_page`,
42
- * `next_token`/`NextToken`/`nextToken`, `next_page` + input alias lists +
43
- * first top-level array property) → `smithy.api#paginated` on the op
44
- * (with the non-standard `mode` member the core runtime dispatches on)
45
- */
46
- import { RENAME_METADATA_KEY, type OperationIdRewrite } from "./rewrite-operation-ids.ts";
47
- /** Member-level nullability (`S.NullOr` + `| null` via `SdkSpec.nullableTrait`). */
48
- export declare const NULLABLE_TRAIT = "com.distilled.openapi#nullable";
49
- /**
50
- * Marks the sole member of a synthesized response wrapper for bare
51
- * array/scalar response bodies. SdkSpecs bind it with a `rootPipe`
52
- * (`T.RawResponseRoot()` from `core/protocol-rest`), so the emitted response
53
- * type IS the payload type.
54
- */
55
- export declare const RAW_RESPONSE_TRAIT = "com.distilled.openapi#rawResponse";
56
- /**
57
- * Wire-matching rules for a generated error class (see
58
- * `SdkSpec.errorMatchersTrait` + `applyErrorMatchers`). The converter stamps
59
- * `[{ status }]` from the response status the class was mapped from.
60
- */
61
- export declare const ERROR_MATCHERS_TRAIT = "com.distilled.openapi#errorMatchers";
62
- /**
63
- * Non-JSON request body encoding chosen by the v0 content-type precedence
64
- * (json > form-urlencoded > multipart). Value: `"form-urlencoded"` |
65
- * `"multipart"`. `"multipart"` is also merged into the `smithy.api#http`
66
- * trait's `contentType` (which core's `buildRequest` understands);
67
- * form-urlencoded is left to provider SdkSpecs/protocols.
68
- */
69
- export declare const CONTENT_TYPE_TRAIT = "com.distilled.openapi#contentType";
70
- /**
71
- * The `apiVersion` recorded on every operation when
72
- * {@link OpenApiConvertOptions.apiVersion} is set (Azure ARM style). The
73
- * matching `api-version` query parameter is dropped from inputs; the
74
- * provider's protocol injects it at request time.
75
- */
76
- export declare const API_VERSION_TRAIT = "com.distilled.openapi#apiVersion";
77
- export declare const SENSITIVE_FIELD_PATTERNS: readonly RegExp[];
78
- export interface OpenApiConvertOptions {
79
- /** Shape namespace, e.g. `"com.neon.api"`. */
80
- readonly namespace: string;
81
- /** Service shape name (PascalCased), e.g. `"Neon"`. */
82
- readonly serviceName: string;
83
- /** Service shape `version`. Default: the spec's `info.version`, else "1.0". */
84
- readonly serviceVersion?: string;
85
- /**
86
- * Non-2xx response status → error class name. Statuses in
87
- * {@link defaultErrorStatuses} never produce per-op errors. Default:
88
- * `{400: BadRequest, 403: Forbidden, 404: NotFound, 409: Conflict,
89
- * 422: UnprocessableEntity}` (the v0 default).
90
- */
91
- readonly statusToErrorClass?: Readonly<Record<string, string>>;
92
- /**
93
- * Statuses covered by the SDK's common errors, excluded from per-op error
94
- * lists. Default: `{"401","429","500","503"}` (the v0 default).
95
- */
96
- readonly defaultErrorStatuses?: Iterable<string>;
97
- /** Skip operations marked `deprecated: true`. Default true. */
98
- readonly skipDeprecated?: boolean;
99
- /**
100
- * HTTP methods to convert IN ADDITION to get/post/put/patch/delete —
101
- * currently `"head"` and `"options"`. Opt-in, so a provider that models
102
- * them (Vercel probes cache artifacts and sandbox files with HEAD) gets
103
- * them without every other provider silently gaining operations.
104
- *
105
- * `head` operations always output `smithy.api#Unit` — see the output-shape
106
- * comment in {@link convertOpenApiToSmithy} for why a declared response
107
- * body on a HEAD can never arrive.
108
- */
109
- readonly extraHttpMethods?: readonly ("head" | "options")[];
110
- /**
111
- * Emit `in: header` parameters as `smithy.api#httpHeader` members instead
112
- * of dropping them. Opt-in for the same reason as
113
- * {@link extraHttpMethods}: turning it on adds input members to every
114
- * operation whose spec declares a header parameter, and most providers
115
- * declare ones the protocol already sends itself (Accept, Authorization,
116
- * an API-version pin). Providers whose headers are real per-call inputs
117
- * — Vercel's `x-Artifact-*` remote-cache metadata, `x-Vercel-Digest` —
118
- * ask for them.
119
- */
120
- readonly headerParams?: boolean;
121
- /**
122
- * Convert `format: binary` strings to blobs and include binary
123
- * `application/octet-stream` responses. Opt in only when the provider's
124
- * generator and protocol support binary inputs and outputs. Default false.
125
- */
126
- readonly binaryTypes?: boolean;
127
- /**
128
- * Response statuses to read the operation's output shape from, most
129
- * preferred first. Default `["200", "201", "204"]`. Extend it for an API
130
- * that answers asynchronous work with a body under another status — Vercel
131
- * returns `202 Accepted` with a payload from nine endpoints (artifact
132
- * upload, account deletion, VCR blob/manifest writes), which would
133
- * otherwise generate as a `void` output.
134
- */
135
- readonly successStatuses?: readonly string[];
136
- /**
137
- * Response headers (matched case-insensitively) to add to an operation's
138
- * output as optional `smithy.api#httpHeader` members wherever one of its
139
- * 2xx responses declares them -- bodiless ones such as `202 Accepted`
140
- * included. An allowlist for the same reason as {@link headerParams}:
141
- * specs declare noise headers (request ids, ETags) on most responses.
142
- * Azure lists its long-running-operation status monitor
143
- * (`Azure-AsyncOperation`, `Location`, `Retry-After`), which callers need
144
- * to follow the operation themselves.
145
- *
146
- * An operation whose output reuses a named component gets its own output
147
- * structure (the component's members plus the headers), so the headers
148
- * never leak into other operations sharing that component. A header whose
149
- * member name a body member already uses is suffixed `Header`
150
- * (`Location` → `locationHeader` next to ARM's `location` region).
151
- */
152
- readonly responseHeaders?: readonly string[];
153
- /**
154
- * Azure-style fixed `api-version`: drops `api-version` query params and
155
- * stamps {@link API_VERSION_TRAIT} on every operation.
156
- */
157
- readonly apiVersion?: string;
158
- /**
159
- * Name patterns marking string members sensitive. Default
160
- * {@link SENSITIVE_FIELD_PATTERNS}. Pass `[]` to disable name-based
161
- * detection (explicit `x-sensitive: true` still applies).
162
- */
163
- readonly sensitivePatterns?: readonly RegExp[];
164
- /**
165
- * Optional full shape-definition overrides for emitted error classes
166
- * (keyed by class name) — e.g. custom members. The converter's default is
167
- * an empty structure with `smithy.api#error` + `smithy.api#httpError` +
168
- * {@link ERROR_MATCHERS_TRAIT} traits; overrides are merged over it.
169
- */
170
- readonly errorShapes?: Readonly<Record<string, any>>;
171
- /**
172
- * How to turn an OpenAPI `operationId` into the Smithy/SDK operation name.
173
- * This is a convert policy, not a spec patch — the OpenAPI document is
174
- * left alone.
175
- *
176
- * - `"verbNoun"` (default): `Apps_list` / `ConfigsList` / `showContact` →
177
- * `listApps` / `listConfigs` / `getApp`. Already verb-first ids stay.
178
- * An operation with no `operationId`, or a mechanical one that only
179
- * restates the method and path (`get-api-card`, `post_v1_users`), is
180
- * named from the route instead: `GET /users` → `listUsers`,
181
- * `GET /users/{id}` → `getUser`, `POST /users/{id}/reset` →
182
- * `resetUser`.
183
- * - `"as-is"`: `PascalCase(operationId)` (`Apps_list` → `AppsList`).
184
- *
185
- * {@link operationNames} overrides win (lookup by `"METHOD path"`, then
186
- * operationId).
187
- */
188
- readonly operationNaming?: "as-is" | "verbNoun";
189
- /**
190
- * Per-operation name overrides for {@link operationNaming}. Use
191
- * `"METHOD path"` keys when two methods share an `operationId`.
192
- */
193
- readonly operationNames?: OperationIdRewrite;
194
- /**
195
- * Name shapes from the spec (`PascalCase(operationId)`, no overrides) and
196
- * record the {@link operationNaming} names in
197
- * `metadata[RENAME_METADATA_KEY]`; `finalizeConvert` renames after the
198
- * Smithy patches, so patches target upstream names.
199
- */
200
- readonly deferNaming?: boolean;
201
- }
202
- export interface SmithyModel {
203
- smithy: "2.0";
204
- metadata: any;
205
- shapes: Record<string, any>;
206
- }
207
- export { RENAME_METADATA_KEY };
208
- export declare const convertOpenApiToSmithy: (spec: unknown, options: OpenApiConvertOptions) => SmithyModel;
209
- //# sourceMappingURL=openapi.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/codegen/openapi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAGH,OAAO,EAIL,mBAAmB,EAInB,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAMpC,oFAAoF;AACpF,eAAO,MAAM,cAAc,mCAAmC,CAAC;AAC/D;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,sCAAsC,CAAC;AACtE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,wCAAwC,CAAC;AAC1E;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,sCAAsC,CAAC;AACtE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,qCAAqC,CAAC;AAMpE,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAoBrD,CAAC;AAMF,MAAM,WAAW,qBAAqB;IACpC,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,uDAAuD;IACvD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,CAAC,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