@workerstack/clients 1.0.0-rc.29 → 1.0.0-rc.30

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 (291) hide show
  1. package/README.md +373 -14
  2. package/assets/installers/examples/github.config.ts +17 -19
  3. package/assets/installers/examples/goreleaser.config.ts +16 -18
  4. package/assets/installers/examples/raw.config.ts +13 -15
  5. package/bin/clients.js +87 -66
  6. package/bin/installgen.js +19 -10
  7. package/dist/cli.d.ts +4 -4
  8. package/dist/cli.js +18 -12
  9. package/dist/emit/cli/channels.d.ts +2 -2
  10. package/dist/emit/cli/channels.js +18 -13
  11. package/dist/emit/cli/commands.d.ts +1 -1
  12. package/dist/emit/cli/commands.js +14 -8
  13. package/dist/emit/cli/discovery.d.ts +0 -6
  14. package/dist/emit/cli/discovery.js +9 -7
  15. package/dist/emit/cli/flags.d.ts +1 -3
  16. package/dist/emit/cli/flags.js +11 -5
  17. package/dist/emit/cli/install.d.ts +0 -8
  18. package/dist/emit/cli/install.js +3 -3
  19. package/dist/emit/cli/layout.d.ts +1 -1
  20. package/dist/emit/cli/layout.js +13 -10
  21. package/dist/emit/cli/module.d.ts +6 -6
  22. package/dist/emit/cli/module.js +10 -10
  23. package/dist/emit/cli/release.d.ts +0 -11
  24. package/dist/emit/cli/release.js +4 -4
  25. package/dist/emit/cli/skills.js +3 -3
  26. package/dist/emit/csharp/errors.js +4 -4
  27. package/dist/emit/csharp/json.js +8 -8
  28. package/dist/emit/csharp/realtime.js +3 -3
  29. package/dist/emit/csharp/sdk-answer.js +4 -4
  30. package/dist/emit/csharp/sdk-body.js +8 -6
  31. package/dist/emit/csharp/sdk-client.d.ts +3 -3
  32. package/dist/emit/csharp/sdk-client.js +2 -2
  33. package/dist/emit/csharp/sdk-csproj.d.ts +7 -9
  34. package/dist/emit/csharp/sdk-csproj.js +10 -10
  35. package/dist/emit/csharp/sdk-doc.js +1 -1
  36. package/dist/emit/csharp/sdk-method.d.ts +0 -1
  37. package/dist/emit/csharp/sdk-method.js +10 -6
  38. package/dist/emit/csharp/sdk-plan.js +0 -1
  39. package/dist/emit/csharp/sdk.js +3 -3
  40. package/dist/emit/csharp/sse.d.ts +0 -2
  41. package/dist/emit/csharp/sse.js +7 -7
  42. package/dist/emit/csharp/transport.js +7 -7
  43. package/dist/emit/csharp/types-enum.js +3 -1
  44. package/dist/emit/csharp/types-messages.js +3 -3
  45. package/dist/emit/csharp/types-names.js +10 -12
  46. package/dist/emit/csharp/types-record.js +3 -3
  47. package/dist/emit/csharp/types-union.d.ts +1 -1
  48. package/dist/emit/csharp/types.d.ts +0 -1
  49. package/dist/emit/csharp/types.js +3 -3
  50. package/dist/emit/csharp/ws.js +2 -2
  51. package/dist/emit/go/errors.js +1 -1
  52. package/dist/emit/go/http.js +2 -2
  53. package/dist/emit/go/module-path.js +2 -2
  54. package/dist/emit/go/sdk-answer.js +1 -1
  55. package/dist/emit/go/sdk-body.js +11 -7
  56. package/dist/emit/go/sdk-client.js +1 -1
  57. package/dist/emit/go/sdk-method.js +2 -2
  58. package/dist/emit/go/sdk-mirror.js +2 -2
  59. package/dist/emit/go/sdk-opts.d.ts +0 -2
  60. package/dist/emit/go/sdk-opts.js +3 -3
  61. package/dist/emit/go/sdk.d.ts +1 -1
  62. package/dist/emit/go/sdk.js +9 -9
  63. package/dist/emit/go/sse.js +1 -1
  64. package/dist/emit/go/types-names.js +5 -0
  65. package/dist/emit/go/types-struct.d.ts +2 -1
  66. package/dist/emit/go/types-struct.js +1 -1
  67. package/dist/emit/go/types.js +9 -9
  68. package/dist/emit/go/ws.js +6 -6
  69. package/dist/emit/java/gradle.d.ts +7 -9
  70. package/dist/emit/java/gradle.js +8 -8
  71. package/dist/emit/java/json.js +1 -1
  72. package/dist/emit/java/layout-ast.js +1 -1
  73. package/dist/emit/java/layout-decl.js +5 -4
  74. package/dist/emit/java/layout-doc.js +13 -7
  75. package/dist/emit/java/layout-dot.js +1 -1
  76. package/dist/emit/java/layout-strings.js +4 -5
  77. package/dist/emit/java/layout-types.js +7 -5
  78. package/dist/emit/java/layout-visitor.js +4 -3
  79. package/dist/emit/java/layout.js +5 -4
  80. package/dist/emit/java/models-names.js +5 -4
  81. package/dist/emit/java/models-record.d.ts +0 -1
  82. package/dist/emit/java/models-record.js +3 -3
  83. package/dist/emit/java/models-union.d.ts +1 -1
  84. package/dist/emit/java/models-union.js +1 -1
  85. package/dist/emit/java/models.d.ts +1 -2
  86. package/dist/emit/java/models.js +25 -16
  87. package/dist/emit/java/realtime.d.ts +5 -17
  88. package/dist/emit/java/realtime.js +1 -1
  89. package/dist/emit/java/sdk-client.d.ts +6 -6
  90. package/dist/emit/java/sdk-client.js +1 -1
  91. package/dist/emit/java/sdk-decl.js +2 -2
  92. package/dist/emit/java/sdk-errors.js +1 -1
  93. package/dist/emit/java/sdk-headers.js +2 -2
  94. package/dist/emit/java/sdk-mirror.js +2 -2
  95. package/dist/emit/java/sdk-models.d.ts +1 -1
  96. package/dist/emit/java/sdk-models.js +7 -7
  97. package/dist/emit/java/sdk-op.d.ts +1 -10
  98. package/dist/emit/java/sdk-op.js +8 -8
  99. package/dist/emit/java/sdk-params.d.ts +5 -5
  100. package/dist/emit/java/sdk-params.js +3 -2
  101. package/dist/emit/java/sdk-plan.js +0 -1
  102. package/dist/emit/java/sdk.d.ts +1 -1
  103. package/dist/emit/java/sdk.js +14 -13
  104. package/dist/emit/java/sse.d.ts +2 -4
  105. package/dist/emit/java/sse.js +6 -6
  106. package/dist/emit/java/ws.d.ts +2 -2
  107. package/dist/emit/java/ws.js +3 -4
  108. package/dist/emit/mcp/annotations.js +8 -4
  109. package/dist/emit/mcp/files.js +9 -9
  110. package/dist/emit/mcp/mounted.js +2 -2
  111. package/dist/emit/mcp/output-schema.js +3 -3
  112. package/dist/emit/mcp/registry.d.ts +0 -2
  113. package/dist/emit/mcp/registry.js +5 -4
  114. package/dist/emit/mcp/runtime.js +2 -2
  115. package/dist/emit/mcp/schema.js +22 -11
  116. package/dist/emit/mcp/server.d.ts +7 -7
  117. package/dist/emit/mcp/server.js +7 -6
  118. package/dist/emit/mcp/tools.js +7 -6
  119. package/dist/emit/python/errors.js +3 -3
  120. package/dist/emit/python/realtime.js +2 -2
  121. package/dist/emit/python/sdk-answer.d.ts +3 -7
  122. package/dist/emit/python/sdk-answer.js +2 -2
  123. package/dist/emit/python/sdk-body.js +4 -5
  124. package/dist/emit/python/sdk-client.js +5 -5
  125. package/dist/emit/python/sdk-doc.js +2 -2
  126. package/dist/emit/python/sdk-method.js +5 -5
  127. package/dist/emit/python/sdk-plan.js +0 -1
  128. package/dist/emit/python/sdk-pyproject.d.ts +0 -2
  129. package/dist/emit/python/sdk-pyproject.js +8 -8
  130. package/dist/emit/python/sdk.d.ts +1 -1
  131. package/dist/emit/python/sdk.js +7 -7
  132. package/dist/emit/python/sse.d.ts +0 -2
  133. package/dist/emit/python/sse.js +2 -2
  134. package/dist/emit/python/transport.js +4 -4
  135. package/dist/emit/python/types-dict.d.ts +2 -2
  136. package/dist/emit/python/types-dict.js +1 -1
  137. package/dist/emit/python/types-names.js +2 -2
  138. package/dist/emit/python/types-union.js +1 -1
  139. package/dist/emit/python/types.js +3 -3
  140. package/dist/emit/python/ws.d.ts +2 -5
  141. package/dist/emit/python/ws.js +4 -4
  142. package/dist/emit/rust/errors.js +3 -3
  143. package/dist/emit/rust/http.js +4 -4
  144. package/dist/emit/rust/realtime.js +2 -2
  145. package/dist/emit/rust/sdk-body.js +8 -5
  146. package/dist/emit/rust/sdk-cargo.d.ts +16 -18
  147. package/dist/emit/rust/sdk-cargo.js +12 -12
  148. package/dist/emit/rust/sdk-client.d.ts +1 -1
  149. package/dist/emit/rust/sdk-client.js +3 -3
  150. package/dist/emit/rust/sdk-method.js +2 -2
  151. package/dist/emit/rust/sdk-opts.d.ts +2 -1
  152. package/dist/emit/rust/sdk-opts.js +2 -2
  153. package/dist/emit/rust/sdk-plan.js +0 -1
  154. package/dist/emit/rust/sdk.d.ts +1 -1
  155. package/dist/emit/rust/sdk.js +5 -5
  156. package/dist/emit/rust/sse.d.ts +0 -5
  157. package/dist/emit/rust/sse.js +2 -2
  158. package/dist/emit/rust/types-names.js +3 -3
  159. package/dist/emit/rust/types-struct.js +1 -1
  160. package/dist/emit/rust/types-union.d.ts +1 -1
  161. package/dist/emit/rust/types.js +7 -5
  162. package/dist/emit/rust/ws.d.ts +0 -11
  163. package/dist/emit/rust/ws.js +5 -5
  164. package/dist/emit/shared/escape.js +17 -17
  165. package/dist/emit/shared/format.js +1 -1
  166. package/dist/emit/shared/gofmt.js +1 -1
  167. package/dist/emit/shared/lang.js +10 -10
  168. package/dist/emit/shared/literals.d.ts +5 -0
  169. package/dist/emit/shared/literals.js +8 -0
  170. package/dist/emit/shared/metadata.d.ts +0 -6
  171. package/dist/emit/shared/metadata.js +8 -7
  172. package/dist/emit/shared/ruff.js +1 -1
  173. package/dist/emit/shared/rustfmt.js +1 -1
  174. package/dist/emit/shared/type-emitter.js +37 -20
  175. package/dist/emit/shared/unknown-type.constants.d.ts +2 -0
  176. package/dist/emit/shared/unknown-type.constants.js +2 -0
  177. package/dist/emit/ts/http.d.ts +0 -2
  178. package/dist/emit/ts/http.js +4 -4
  179. package/dist/emit/ts/package.d.ts +14 -12
  180. package/dist/emit/ts/package.js +9 -8
  181. package/dist/emit/ts/route-tree.js +2 -2
  182. package/dist/emit/ts/sdk-types-preamble.d.ts +1 -1
  183. package/dist/emit/ts/sdk-types-preamble.js +2 -2
  184. package/dist/emit/ts/sdk-types.js +11 -11
  185. package/dist/emit/ts/sdk.js +4 -4
  186. package/dist/emit/ts/service-map.d.ts +2 -1
  187. package/dist/emit/ts/tanstack-query.js +6 -6
  188. package/dist/emit/ts/type-gen.js +31 -18
  189. package/dist/emit/ts/webhooks.d.ts +0 -2
  190. package/dist/emit/ts/webhooks.js +3 -3
  191. package/dist/extract/chain.js +5 -4
  192. package/dist/extract/extract.js +5 -5
  193. package/dist/extract/serialize.d.ts +0 -2
  194. package/dist/extract/serialize.js +14 -15
  195. package/dist/extract/walk.js +15 -12
  196. package/dist/gen/args.js +9 -5
  197. package/dist/gen/formatters.js +5 -3
  198. package/dist/gen/shipped.js +2 -2
  199. package/dist/gen/targets.d.ts +2 -4
  200. package/dist/gen/targets.js +8 -4
  201. package/dist/gen/write.js +4 -2
  202. package/dist/index.js +2 -2
  203. package/dist/installers/cli.d.ts +4 -4
  204. package/dist/installers/cli.js +24 -24
  205. package/dist/installers/commands/build.d.ts +4 -4
  206. package/dist/installers/commands/build.js +2 -3
  207. package/dist/installers/commands/check.d.ts +2 -2
  208. package/dist/installers/commands/check.js +11 -10
  209. package/dist/installers/commands/init.d.ts +2 -2
  210. package/dist/installers/commands/init.js +1 -2
  211. package/dist/installers/config/define-config.d.ts +16 -16
  212. package/dist/installers/config/define-config.js +1 -1
  213. package/dist/installers/config/hooks/bun.d.ts +6 -6
  214. package/dist/installers/config/hooks/node.js +1 -1
  215. package/dist/installers/config/load.d.ts +6 -8
  216. package/dist/installers/config/load.js +7 -8
  217. package/dist/installers/config/resolve.d.ts +1 -2
  218. package/dist/installers/config/resolve.js +28 -33
  219. package/dist/installers/config/types.d.ts +6 -6
  220. package/dist/installers/config/types.js +0 -1
  221. package/dist/installers/render/quote.js +3 -5
  222. package/dist/installers/render/render.d.ts +6 -6
  223. package/dist/installers/render/render.js +26 -26
  224. package/dist/installers/ui.d.ts +4 -4
  225. package/dist/installers/ui.js +3 -3
  226. package/dist/ir/build.d.ts +3 -3
  227. package/dist/ir/build.js +8 -5
  228. package/dist/ir/load.js +9 -10
  229. package/dist/ir/model.d.ts +2 -1
  230. package/dist/ir/model.js +0 -1
  231. package/dist/ir/resolve-refs.js +2 -2
  232. package/dist/ir/resource-tree.js +2 -1
  233. package/dist/ir/route-tree-intern.js +1 -1
  234. package/dist/ir/schema.js +3 -3
  235. package/dist/ir/sdk-model.js +3 -3
  236. package/dist/ir/slots.js +13 -8
  237. package/dist/ir/streams.js +1 -1
  238. package/dist/release/bootstrap.d.ts +3 -3
  239. package/dist/release/bootstrap.js +7 -7
  240. package/dist/release/bump-args.js +4 -4
  241. package/dist/release/bump-command.d.ts +1 -1
  242. package/dist/release/bump-command.js +9 -10
  243. package/dist/release/bump.d.ts +5 -4
  244. package/dist/release/bump.js +2 -2
  245. package/dist/release/cli.d.ts +4 -4
  246. package/dist/release/cli.js +4 -4
  247. package/dist/release/codegen.js +1 -1
  248. package/dist/release/digest.js +5 -7
  249. package/dist/release/git.js +5 -8
  250. package/dist/release/load.js +3 -3
  251. package/dist/release/manifest.js +9 -10
  252. package/dist/release/oasdiff.d.ts +10 -15
  253. package/dist/release/oasdiff.js +5 -6
  254. package/dist/release/registries.d.ts +0 -11
  255. package/dist/release/registries.js +17 -17
  256. package/dist/release/release-state.d.ts +16 -13
  257. package/dist/release/release-workflow.js +5 -7
  258. package/dist/release/repo-settings.d.ts +2 -1
  259. package/dist/release/spec-gate.d.ts +0 -2
  260. package/dist/release/spec-gate.js +6 -10
  261. package/dist/release/sync-command.d.ts +2 -2
  262. package/dist/release/sync-command.js +1 -1
  263. package/dist/release/sync-tree.js +9 -13
  264. package/dist/release/sync.d.ts +6 -6
  265. package/dist/release/sync.js +12 -13
  266. package/dist/release/types.d.ts +22 -22
  267. package/dist/release/types.js +0 -1
  268. package/dist/release/version-files.d.ts +3 -4
  269. package/dist/release/version-files.js +4 -5
  270. package/dist/runtime/.oxfmtrc.jsonc +8 -0
  271. package/dist/runtime/mcp/files.ts +1 -1
  272. package/dist/runtime/mcp/http.ts +6 -2
  273. package/dist/runtime/mcp/listen.ts +1 -1
  274. package/dist/runtime/mcp/mount.ts +2 -2
  275. package/dist/runtime/mcp/protocol.ts +1 -1
  276. package/dist/runtime/ts-tanstack-query/query.ts +0 -2
  277. package/package.json +10 -7
  278. package/dist/emit/cli/index.d.ts +0 -1
  279. package/dist/emit/cli/index.js +0 -1
  280. package/dist/emit/csharp/index.d.ts +0 -1
  281. package/dist/emit/csharp/index.js +0 -1
  282. package/dist/emit/go/index.d.ts +0 -1
  283. package/dist/emit/go/index.js +0 -1
  284. package/dist/emit/java/index.d.ts +0 -2
  285. package/dist/emit/java/index.js +0 -2
  286. package/dist/emit/mcp/index.d.ts +0 -3
  287. package/dist/emit/mcp/index.js +0 -3
  288. package/dist/emit/python/index.d.ts +0 -1
  289. package/dist/emit/python/index.js +0 -1
  290. package/dist/emit/rust/index.d.ts +0 -1
  291. package/dist/emit/rust/index.js +0 -1
@@ -11,16 +11,16 @@ import { toIR } from "../../ir/build.js";
11
11
  import { sdkModel } from "../../ir/sdk-model.js";
12
12
  import { pyDocLines } from "../shared/escape.js";
13
13
  import { compareCodeUnits, NameScope } from "../shared/lang.js";
14
+ import { packageOn } from "../shared/metadata.js";
14
15
  import { pythonErrorKeys } from "./errors.js";
15
16
  import { clientDecls, clientTitle } from "./sdk-client.js";
16
17
  import { allOrder, importBlock, importLine } from "./sdk-imports.js";
17
- import { packageOn } from "../shared/metadata.js";
18
18
  import { pyproject, validatePackageName, validateVersion } from "./sdk-pyproject.js";
19
19
  import { needsWebSocket, runtimeExports, runtimeFiles } from "./transport.js";
20
20
  import { pyTopLevel, pyTypeContext } from "./types.js";
21
- /* the marker ruff, mypy and linguist read */
21
+ // the marker ruff, mypy and linguist read
22
22
  const MARKER = "# @generated by clients. DO NOT EDIT.";
23
- /* where client.py imports each runtime name from, under `._http.` */
23
+ // where client.py imports each runtime name from, under `._http.`
24
24
  const RUNTIME = {
25
25
  AsyncRealtimeTransport: "realtime",
26
26
  AsyncTransport: "send_async",
@@ -37,7 +37,7 @@ const RUNTIME = {
37
37
  TransportOpts: "transport",
38
38
  TypedWebSocket: "ws",
39
39
  };
40
- /* where types.py imports each runtime name from, under `._http.`; any other it spells is `collections.abc`'s */
40
+ // where types.py imports each runtime name from, under `._http.`; any other it spells is `collections.abc`'s
41
41
  const TYPES_RUNTIME = {
42
42
  FilePart: "body",
43
43
  HttpError: "errors",
@@ -71,7 +71,7 @@ function componentDecls(ir, at) {
71
71
  });
72
72
  }
73
73
  /** The identifiers `text` spells outside its strings. */
74
- const spelled = (text) => new Set(Array.from(text.replace(/"""[\s\S]*?"""|"(?:[^"\\\n]|\\.)*"/g, '""').matchAll(/[A-Za-z_]\w*/g), (match) => match[0]));
74
+ const spelled = (text) => new Set(Array.from(text.replaceAll(/"""[\s\S]*?"""|"(?:[^"\\\n]|\\.)*"/g, '""').matchAll(/[A-Za-z_]\w*/g), (match) => match[0]));
75
75
  /** client.py: the marker, the API's doc, its imports, then its declarations. */
76
76
  function clientFile(ir, env, body) {
77
77
  const doc = pyDocLines([clientTitle(ir), ir.info.description].filter((part) => part !== undefined).join("\n\n"));
@@ -115,9 +115,9 @@ function emitPython(document, options, metadata = {}) {
115
115
  const ir = toIR(document, { deriveOperationIds: true });
116
116
  const model = sdkModel(ir);
117
117
  const at = pyTypeContext(ir);
118
- /* components first: the client's hoisted types then land beside them */
118
+ // components first: the client's hoisted types then land beside them
119
119
  const components = componentDecls(ir, at);
120
- /* before the client: its `_DEFAULTS` names ErrorKey, and each `<Key>Data` lands among the hoisted declarations */
120
+ // before the client: its `_DEFAULTS` names ErrorKey, and each `<Key>Data` lands among the hoisted declarations
121
121
  const errorKey = pythonErrorKeys(model, at);
122
122
  const features = {
123
123
  realtime: model.ops.some((op) => op.stream === "realtime"),
@@ -1,6 +1,4 @@
1
1
  import { type PyStream } from "./sdk-answer.ts";
2
- /** The header the SSE and realtime dials resume an event stream with. */
3
- export declare const LAST_EVENT_ID = "Last-Event-ID";
4
2
  /** Whether a declared param is the Last-Event-ID header (any casing), the resume channel an SSE dial sends. */
5
3
  export declare const isLastEventIdHeader: (name: string, where: string) => boolean;
6
4
  /** The SSE operation's answer, its one field and its docstring's lines. */
@@ -8,10 +8,10 @@
8
8
  import { sseEvents } from "../../ir/sdk-model.js";
9
9
  import { pyClassName } from "../shared/lang.js";
10
10
  import { eventType } from "./sdk-answer.js";
11
- import { pyTypeOf } from "./types.js";
12
11
  import { aliasDecl } from "./types-union.js";
12
+ import { pyTypeOf } from "./types.js";
13
13
  /** The header the SSE and realtime dials resume an event stream with. */
14
- export const LAST_EVENT_ID = "Last-Event-ID";
14
+ const LAST_EVENT_ID = "Last-Event-ID";
15
15
  /** Whether a declared param is the Last-Event-ID header (any casing), the resume channel an SSE dial sends. */
16
16
  export const isLastEventIdHeader = (name, where) => where === "header" && name.toLowerCase() === LAST_EVENT_ID.toLowerCase();
17
17
  /**
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { readFileSync } from "node:fs";
8
8
  import { compareCodeUnits } from "../shared/lang.js";
9
- /* every SDK: the sans-IO core and its two shells, config, errors, hooks, log, redirects, SSE, invalidation */
9
+ // every SDK: the sans-IO core and its two shells, config, errors, hooks, log, redirects, SSE, invalidation
10
10
  const CORE = [
11
11
  "__init__",
12
12
  "auth",
@@ -28,12 +28,12 @@ const CORE = [
28
28
  "sse",
29
29
  "stale",
30
30
  ];
31
- /* a WebSocket operation; realtime adds the transports on top of it */
31
+ // a WebSocket operation; realtime adds the transports on top of it
32
32
  const WS = ["ws"];
33
33
  const REALTIME = ["realtime", "transport", "transport_longpoll", "transport_sse", "transport_ws"];
34
- /* a module's `__all__ = [...]`, one name per line or on one line */
34
+ // a module's `__all__ = [...]`, one name per line or on one line
35
35
  const ALL = /^__all__ = \[([^\]]*)\]/m;
36
- /* a top-level public name: `class X`, `def x`, `async def x`, `X =` or `X: T =` at column 0 */
36
+ // a top-level public name: `class X`, `def x`, `async def x`, `X =` or `X: T =` at column 0
37
37
  const PUBLIC_NAME = /^(?:class (?<cls>[A-Za-z]\w*)|(?:async )?def (?<fn>[A-Za-z]\w*)\(|(?<bound>[A-Za-z]\w*)(?:: [^=\n]+)? = )/gm;
38
38
  /** Whether these features make the package depend on `httpx2[ws]` (Fb3). */
39
39
  export const needsWebSocket = (features) => features.ws || features.realtime;
@@ -17,8 +17,8 @@ export type DictKey = {
17
17
  };
18
18
  /** How a dict is declared beyond its keys: its bases and its docstring. */
19
19
  export type DictShape = {
20
- readonly bases?: readonly string[];
21
- readonly doc?: string;
20
+ readonly bases?: readonly string[] | undefined;
21
+ readonly doc?: string | undefined;
22
22
  };
23
23
  /** The TypedDict `name` over `keys`: the class form when every key is spellable, else the functional form. */
24
24
  export declare function dictDecl(name: string, keys: readonly DictKey[], shape?: DictShape): string;
@@ -1,6 +1,6 @@
1
1
  import { lineComment, pyDocLines, pyString } from "../shared/escape.js";
2
2
  import { compareCodeUnits } from "../shared/lang.js";
3
- /* the hard keywords: no class body can spell one as a key */
3
+ // the hard keywords: no class body can spell one as a key
4
4
  const HARD_KEYWORDS = " False None True and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield ";
5
5
  /** Whether a class body can spell `key` as it is. */
6
6
  const spellable = (key) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(key) && !HARD_KEYWORDS.includes(` ${key} `) && !key.startsWith("__");
@@ -1,7 +1,7 @@
1
1
  import { irResolver } from "../../ir/schema.js";
2
2
  import { compareCodeUnits, NameScope, pyClassName } from "../shared/lang.js";
3
3
  import { publicNames, runtimeFiles } from "./transport.js";
4
- /* the names the emitted modules import or declare beside the runtime's */
4
+ // the names the emitted modules import or declare beside the runtime's
5
5
  const EMITTED = [
6
6
  "SDK",
7
7
  "AsyncSDK",
@@ -45,7 +45,7 @@ export function irNames(ir) {
45
45
  hoisted.set(key, name);
46
46
  return name;
47
47
  },
48
- /* only a declared component is referred to by name (types.ts reads a dangling ref as Any) */
48
+ // only a declared component is referred to by name (types.ts reads a dangling ref as Any)
49
49
  ref: (name) => components.get(name),
50
50
  resolve: irResolver(ir.schemas),
51
51
  };
@@ -12,7 +12,7 @@ export function valuePart(value) {
12
12
  const integral = typeof value === "number" && Number.isInteger(value);
13
13
  return integral ? { literal: BigInt(value).toString() } : { type: "float" };
14
14
  }
15
- /* where the Literal goes among a union's types: a string no type is spelled as */
15
+ // where the Literal goes among a union's types: a string no type is spelled as
16
16
  const LITERAL = "\u0000";
17
17
  /** `parts` as one annotation, and whether it spells `Literal`. */
18
18
  export function joined(parts) {
@@ -2,7 +2,7 @@ import { pascalWords, pyClassName } from "../shared/lang.js";
2
2
  import { dictDecl, dictParts, keysOf, mergedFields } from "./types-dict.js";
3
3
  import { irNames, plainNames } from "./types-names.js";
4
4
  import { aliasDecl, joined, valuePart, variantSuffix } from "./types-union.js";
5
- /* deeper than this, a schema is Any (Go and Rust parity; v0 Python stopped at 8) */
5
+ // deeper than this, a schema is Any (Go and Rust parity; v0 Python stopped at 8)
6
6
  const MAX_DEPTH = 12;
7
7
  const SCALARS = {
8
8
  boolean: "bool",
@@ -20,7 +20,7 @@ export function pyTypeContext(ir) {
20
20
  function declare(ir, at, key, base) {
21
21
  const name = at.names.hoist(key, base);
22
22
  if (!at.decls.has(name)) {
23
- /* claimed before its body: what the body hoists in turn comes after it */
23
+ // claimed before its body: what the body hoists in turn comes after it
24
24
  at.decls.set(name, "");
25
25
  at.decls.set(name, pyTopLevel(name, ir, { ...at, typing: at.declTyping }));
26
26
  }
@@ -90,7 +90,7 @@ function single(ir, at) {
90
90
  return objectUse(ir, at);
91
91
  if (ir.kind === "allOf")
92
92
  return allOfUse(ir, deeper(at));
93
- /* a ref to no component reads as any JSON value: the IR resolves it to unknown */
93
+ // a ref to no component reads as any JSON value: the IR resolves it to unknown
94
94
  if (ir.kind === "ref")
95
95
  return at.names.resolve(ir).kind === "unknown" ? "Any" : at.names.ref(ir.name);
96
96
  if (ir.kind === "scalar")
@@ -1,14 +1,10 @@
1
1
  import { type SdkOp } from "../../ir/sdk-model.ts";
2
2
  import { type Answer, type PyStream } from "./sdk-answer.ts";
3
3
  import type { MethodEnv } from "./sdk-method.ts";
4
- /** The resume cursor's token, which the WebSocket and realtime methods take. */
5
- export declare const RECONNECT_TOKEN = "reconnect_token: str | None = None";
6
- /** The subprotocols a WebSocket or realtime dial offers. */
7
- export declare const PROTOCOLS = "protocols: Sequence[str] | None = None";
8
4
  /** Whether a declared param is the `reconnect_token` query param, the resume channel a socket dial sends. */
9
5
  export declare const isReconnectToken: (name: string, where: string) => boolean;
10
6
  /** A socket class's `on` events beyond its members', given its `Out`: each with the type its handler takes. */
11
- export type Lifecycle = (out: string) => readonly (readonly [event: string, handler: string])[];
7
+ type Lifecycle = (out: string) => readonly (readonly [event: string, handler: string])[];
12
8
  /**
13
9
  * How a socket stream answers: its generic class `base[Out, In]` and the transport call it makes; what it reads and
14
10
  * sends when its op declares no `send` or `receive`; the subclass suffix a keyed `send` union names; the events
@@ -26,3 +22,4 @@ export type SocketShape = {
26
22
  export declare function socketAnswer(op: SdkOp, env: MethodEnv, shape: SocketShape): Answer;
27
23
  /** The WebSocket operation's answer, its two fields and its docstring's lines. */
28
24
  export declare const wsStream: PyStream;
25
+ export {};
@@ -4,9 +4,9 @@ import { pyClassName } from "../shared/lang.js";
4
4
  import { typeAt } from "./sdk-answer.js";
5
5
  import { pyKeyedMembers, pyTypeOf } from "./types.js";
6
6
  /** The resume cursor's token, which the WebSocket and realtime methods take. */
7
- export const RECONNECT_TOKEN = "reconnect_token: str | None = None";
7
+ const RECONNECT_TOKEN = "reconnect_token: str | None = None";
8
8
  /** The subprotocols a WebSocket or realtime dial offers. */
9
- export const PROTOCOLS = "protocols: Sequence[str] | None = None";
9
+ const PROTOCOLS = "protocols: Sequence[str] | None = None";
10
10
  /** Whether a declared param is the `reconnect_token` query param, the resume channel a socket dial sends. */
11
11
  export const isReconnectToken = (name, where) => where === "query" && name === "reconnect_token";
12
12
  /** One `on` overload: `event` hands its handler a `type`. */
@@ -24,7 +24,7 @@ function keyedClass(op, env, shape, dispatch) {
24
24
  const { receive, send } = op.ir.messages;
25
25
  const typing = env.at.declTyping;
26
26
  const at = { ...env.at, fieldName: "Send", parentName: op.id, typing };
27
- /* spelled in types.py, whose typing names they then take: the same hoist keys, so the names client.py spells */
27
+ // spelled in types.py, whose typing names they then take: the same hoist keys, so the names client.py spells
28
28
  const out = pyTypeOf(send, at);
29
29
  const inType = receive === undefined ? shape.in : pyTypeOf(receive, { ...at, fieldName: "Receive" });
30
30
  const lifecycle = shape.lifecycle(out);
@@ -63,7 +63,7 @@ export const wsStream = {
63
63
  answer: (op, env) => socketAnswer(op, env, {
64
64
  base: "TypedWebSocket",
65
65
  in: "object",
66
- /* the events every socket's `on` takes, with what each hands its handler */
66
+ // the events every socket's `on` takes, with what each hands its handler
67
67
  lifecycle: (out) => [
68
68
  ["message", out],
69
69
  ["close", "WsClose"],
@@ -5,7 +5,7 @@ import { rustTopLevel } from "./types.js";
5
5
  /** The keys an error response's envelope names, over every operation's JSON error statuses (the runtime reads JSON only). */
6
6
  function envelopeKeys(model) {
7
7
  return model.ops.flatMap((op) => op.errorStatuses.flatMap((status) => {
8
- /* an error status is a declared response, and a schema comes with the content type it is under */
8
+ // an error status is a declared response, and a schema comes with the content type it is under
9
9
  const { contentType, schema } = op.ir.responses[String(status)];
10
10
  if (schema === undefined || !isJsonMedia(contentType))
11
11
  return [];
@@ -19,7 +19,7 @@ function envelopeKeys(model) {
19
19
  function declaredKeys(model) {
20
20
  const byId = [...model.ops].sort((a, b) => compareCodeUnits(a.id, b.id));
21
21
  const declared = byId.flatMap((op) => Object.entries(op.ir.extensions.errors ?? {}));
22
- /* reversed, so a key ends on its first declaration */
22
+ // reversed, so a key ends on its first declaration
23
23
  const keys = new Map(declared.toReversed().map(([key, { schema }]) => [key, schema]));
24
24
  for (const key of envelopeKeys(model))
25
25
  if (!keys.has(key))
@@ -77,7 +77,7 @@ function fromLines(keys) {
77
77
  ];
78
78
  return ["impl From<&str> for ErrorKey {", " fn from(key: &str) -> Self {", ...parse, " }", "}"];
79
79
  }
80
- /* Display as the wire spells it, and ApiError::key() over the runtime's raw key */
80
+ // Display as the wire spells it, and ApiError::key() over the runtime's raw key
81
81
  const TAIL = [
82
82
  "impl std::fmt::Display for ErrorKey {",
83
83
  " fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {",
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { readFileSync } from "node:fs";
8
8
  import { compareCodeUnits } from "../shared/lang.js";
9
- /* every SDK: config, the call, its request and exchange, redirects, auth, hooks, log, errors and their envelope, answers, SSE, invalidation */
9
+ // every SDK: config, the call, its request and exchange, redirects, auth, hooks, log, errors and their envelope, answers, SSE, invalidation
10
10
  const CORE = [
11
11
  "answer",
12
12
  "auth",
@@ -29,7 +29,7 @@ const CORE = [
29
29
  "sse",
30
30
  "stale",
31
31
  ];
32
- /* a WebSocket operation; realtime adds the transports on top of it */
32
+ // a WebSocket operation; realtime adds the transports on top of it
33
33
  const WS = ["ws"];
34
34
  const REALTIME = [
35
35
  "realtime",
@@ -39,9 +39,9 @@ const REALTIME = [
39
39
  "transport_sse",
40
40
  "transport_ws",
41
41
  ];
42
- /* the lock template every crate's Cargo.lock is cut from */
42
+ // the lock template every crate's Cargo.lock is cut from
43
43
  const LOCK = "Cargo.lock";
44
- /* a top-level public item: `pub struct Name`, `pub fn name`, … at column 0 */
44
+ // a top-level public item: `pub struct Name`, `pub fn name`, … at column 0
45
45
  const PUBLIC_ITEM = /^pub (?:struct|enum|trait|type|fn|const|static) ([A-Za-z_][A-Za-z0-9_]*)/gm;
46
46
  /** The runtime `.rs` file names an SDK with `features` ships, in code-unit order. */
47
47
  export function runtimeFileNames(features) {
@@ -1,6 +1,6 @@
1
1
  import { eventType, isLastEventIdHeader } from "./sse.js";
2
2
  import { isReconnectToken, messageType, typeParams, valueHandlers } from "./ws.js";
3
- /* the WebSocket and long-poll dials send the cursor as query params, the SSE dial its id as Last-Event-ID */
3
+ // the WebSocket and long-poll dials send the cursor as query params, the SSE dial its id as Last-Event-ID
4
4
  const REALTIME = {
5
5
  carries: (param, where) => isReconnectToken(param, where) ||
6
6
  (where === "query" && param === "last_event_id") ||
@@ -18,7 +18,7 @@ export function realtimeAnswer(op, at) {
18
18
  const write = receive && messageType(op, receive, "Receive", at);
19
19
  if (send !== undefined && read !== undefined)
20
20
  valueHandlers("ResumableConnection", ["on_message"], { schema: send, type: read }, at);
21
- /* declared messages are JSON: one that is not is an error; an event type or none reads text too */
21
+ // declared messages are JSON: one that is not is an error; an event type or none reads text too
22
22
  const loop = read === undefined && write === undefined ? "connect" : "typed";
23
23
  const params = typeParams(read ?? (op.events === undefined ? undefined : eventType(op, op.events, at)), write, "serde_json::Value");
24
24
  const run = `crate::realtime_loop::${loop}(opts.transport.clone())`;
@@ -6,14 +6,13 @@ import { rustTypeOf } from "./types.js";
6
6
  export const typeAt = (schema, parent, field, at) => unboxed(schema, rustTypeOf(schema, { ...at, fieldName: field, parentName: parent }));
7
7
  /** The field of `part` named `ident` on the struct `parent`: its type by the part's kind, and its statement. */
8
8
  function partField(part, ident, parent, at) {
9
- /* the IR gives every part its schema (ir/slots.ts partsOf) */
9
+ // the IR gives every part its schema (ir/slots.ts partsOf)
10
10
  const declared = part.schema;
11
11
  const schema = at.names.resolve(declared);
12
12
  const call = part.type === "file" ? "files" : "text";
13
13
  const line = `form.${call}(${rustString(part.name)}, &body.${ident});`;
14
- if (part.type === "file") {
14
+ if (part.type === "file")
15
15
  return { decl: schema.kind === "array" ? "Vec<crate::FilePart>" : "Option<crate::FilePart>", line };
16
- }
17
16
  if (schema.kind === "array")
18
17
  return { decl: `Vec<${typeAt(schema.items, parent, part.name, at)}>`, line };
19
18
  return { decl: `Option<${typeAt(declared, parent, part.name, at)}>`, line };
@@ -28,7 +27,7 @@ function multipartBody(op, parts, at) {
28
27
  return { ident, ...partField(part, ident, type, at) };
29
28
  });
30
29
  const doc = `The multipart/form-data parts of ${op.id}'s body: None and an empty list send no part.`;
31
- /* never empty: a body is multipart only with a file part (ir/slots.ts bodyOf) */
30
+ // never empty: a body is multipart only with a file part (ir/slots.ts bodyOf)
32
31
  const decl = [
33
32
  ...lineComment(doc, "///"),
34
33
  "#[derive(Debug, Clone, Default)]",
@@ -37,7 +36,11 @@ function multipartBody(op, parts, at) {
37
36
  "}",
38
37
  ];
39
38
  at.decls.set(type, decl.join("\n"));
40
- const lines = ["let mut form = crate::body::Multipart::new();", ...fields.map((f) => f.line), "spec.multipart(form);"];
39
+ const lines = [
40
+ "let mut form = crate::body::Multipart::new();",
41
+ ...fields.map((f) => f.line),
42
+ "spec.multipart(form);",
43
+ ];
41
44
  return { lines, type: `&${type}` };
42
45
  }
43
46
  /** The body of `op` as its method takes it, and the statements encoding it into the spec at once. */
@@ -1,32 +1,30 @@
1
1
  import { type Shipped } from "../shared/metadata.ts";
2
2
  /** The emitted `rust-version`: the toolchain floor every SDK builds with (Fb2). */
3
3
  export declare const RUST_VERSION = "1.85";
4
- /** The emitted edition, which the floor forces. */
5
- export declare const EDITION = "2024";
6
4
  /** The crate's name and version as Cargo.toml and the lock root carry them, and the metadata crates.io shows. */
7
5
  export type CrateIdentity = {
8
6
  readonly name: string;
9
7
  readonly version: string;
10
8
  /** what crates.io shows and `cargo publish` requires; left out when the caller names none */
11
- readonly description?: string;
12
- readonly documentation?: string;
13
- readonly homepage?: string;
14
- readonly keywords?: readonly string[];
15
- readonly categories?: readonly string[];
16
- readonly license?: string;
17
- readonly repository?: string;
9
+ readonly description?: string | undefined;
10
+ readonly documentation?: string | undefined;
11
+ readonly homepage?: string | undefined;
12
+ readonly keywords?: readonly string[] | undefined;
13
+ readonly categories?: readonly string[] | undefined;
14
+ readonly license?: string | undefined;
15
+ readonly repository?: string | undefined;
18
16
  };
19
17
  /** The crate options as a run gives them: a list as a list, or the CLI's comma-separated value. */
20
18
  export type CrateOptions = {
21
- readonly crateName?: string;
22
- readonly version?: string;
23
- readonly description?: string;
24
- readonly documentation?: string;
25
- readonly homepage?: string;
26
- readonly keywords?: readonly string[] | string;
27
- readonly categories?: readonly string[] | string;
28
- readonly license?: string;
29
- readonly repository?: string;
19
+ readonly crateName?: string | undefined;
20
+ readonly version?: string | undefined;
21
+ readonly description?: string | undefined;
22
+ readonly documentation?: string | undefined;
23
+ readonly homepage?: string | undefined;
24
+ readonly keywords?: readonly string[] | string | undefined;
25
+ readonly categories?: readonly string[] | string | undefined;
26
+ readonly license?: string | undefined;
27
+ readonly repository?: string | undefined;
30
28
  };
31
29
  /**
32
30
  * The crate `options` give, each value checked against the grammar every target shares and crates.io's own limits
@@ -10,12 +10,12 @@ import { checked, HTTPS_URL, LICENSE, README, SPDX_EXPRESSION, TEXT } from "../s
10
10
  /** The emitted `rust-version`: the toolchain floor every SDK builds with (Fb2). */
11
11
  export const RUST_VERSION = "1.85";
12
12
  /** The emitted edition, which the floor forces. */
13
- export const EDITION = "2024";
14
- /* a crate that ships nothing beside its code */
13
+ const EDITION = "2024";
14
+ // a crate that ships nothing beside its code
15
15
  const NONE_SHIPPED = { icon: undefined, licenseFile: false, readme: false };
16
- /* the dependency the WebSocket and realtime runtime files need, and only they */
16
+ // the dependency the WebSocket and realtime runtime files need, and only they
17
17
  const WEBSOCKET = "tokio-tungstenite";
18
- /* each dependency's requirement line, in name order: the floors are the template lock's versions */
18
+ // each dependency's requirement line, in name order: the floors are the template lock's versions
19
19
  const DEPENDENCIES = [
20
20
  ["bytes", '"1.12.1"'],
21
21
  ["futures-util", '{ version = "0.3.34", default-features = false, features = ["std", "sink"] }'],
@@ -30,17 +30,17 @@ const DEPENDENCIES = [
30
30
  ["url", '"2.5.8"'],
31
31
  ];
32
32
  const MARKER = "# @generated by clients. DO NOT EDIT.";
33
- /* a semver version: it lands inside a TOML string, so nothing else may */
33
+ // a semver version: it lands inside a TOML string, so nothing else may
34
34
  const SEMVER = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
35
- /* crates.io's keyword: ASCII, a letter or digit first, then letters, digits, `_`, `-` or `+`, at most 20 characters;
36
- * a category: a slug as https://crates.io/category_slugs lists them, which crates.io matches exactly; five of each */
35
+ // crates.io's keyword: ASCII, a letter or digit first, then letters, digits, `_`, `-` or `+`, at most 20 characters;
36
+ // a category: a slug as https://crates.io/category_slugs lists them, which crates.io matches exactly; five of each
37
37
  const CRATE_KEYWORD = /^[A-Za-z0-9][A-Za-z0-9_+-]{0,19}$/;
38
38
  const CATEGORY = /^[a-z0-9-]+(?:::[a-z0-9-]+)*$/;
39
39
  const MAX_LISTED = 5;
40
40
  /** A list option as a list, each entry checked against `grammar`, at most five: crates.io's limit for both lists. */
41
41
  function listed(option, value, grammar) {
42
42
  if (value === undefined)
43
- return undefined;
43
+ return;
44
44
  const list = (typeof value === "string" ? value.split(",") : value).map((word) => word.trim()).filter(Boolean);
45
45
  for (const word of list)
46
46
  checked(option, word, grammar);
@@ -102,11 +102,11 @@ export function cargoToml(crate, ws, shipped = NONE_SHIPPED) {
102
102
  `version = "${crate.version}"`,
103
103
  `edition = "${EDITION}"`,
104
104
  `rust-version = "${RUST_VERSION}"`,
105
- /* the metadata crates.io reads: each line only when the caller gave it */
105
+ // the metadata crates.io reads: each line only when the caller gave it
106
106
  ...metadata(crate),
107
107
  ...(shipped.readme ? [`readme = "${README}"`] : []),
108
- /* what the published crate holds beside Cargo.toml and its lock, which cargo always packs: its README and
109
- * license file when it ships them; clients' manifest and anything else written beside the crate stay out */
108
+ // what the published crate holds beside Cargo.toml and its lock, which cargo always packs: its README and
109
+ // license file when it ships them; clients' manifest and anything else written beside the crate stay out
110
110
  `include = ${toml(["/src", ...(shipped.readme ? [`/${README}`] : []), ...(shipped.licenseFile ? [`/${LICENSE}`] : [])])}`,
111
111
  "",
112
112
  "[lib]",
@@ -153,7 +153,7 @@ function referenced(kept, reference) {
153
153
  return kept.filter((p) => p.name === name).length > 1 ? reference : name;
154
154
  }
155
155
  /** `p`'s text with every dependency reference rewritten for `kept`. */
156
- const rewritten = (p, kept) => p.text.replace(/^ "([^"]+)",$/gm, (_, reference) => ` "${referenced(kept, reference)}",`);
156
+ const rewritten = (p, kept) => p.text.replaceAll(/^ "([^"]+)",$/gm, (_, reference) => ` "${referenced(kept, reference)}",`);
157
157
  /** The root entry as `crate`, without `tokio-tungstenite` unless `ws`. */
158
158
  function rootOf(root, crate, ws) {
159
159
  const named = root.text
@@ -8,8 +8,8 @@
8
8
  */
9
9
  import type { IR } from "../../ir/model.ts";
10
10
  import type { SdkOp } from "../../ir/sdk-model.ts";
11
- import type { RustCallPlan } from "./sdk-plan.ts";
12
11
  import { type MethodEnv } from "./sdk-method.ts";
12
+ import type { RustCallPlan } from "./sdk-plan.ts";
13
13
  /** The method env, the operations by id, and the notices the generation reports (a root member renamed for the mirror). */
14
14
  export type ClientEnv = MethodEnv & {
15
15
  readonly ops: ReadonlyMap<string, SdkOp>;
@@ -4,7 +4,7 @@ import { compareCodeUnits, NameScope, rustTypeIdent, rustValueIdent } from "../s
4
4
  import { MIRROR, mirrorNotice } from "../shared/mirror.js";
5
5
  import { rustMethod } from "./sdk-method.js";
6
6
  import { STYLE } from "./types-names.js";
7
- /* the runtime's own associated functions on `Client`, the mirror among them: no operation takes their name */
7
+ // the runtime's own associated functions on `Client`, the mirror among them: no operation takes their name
8
8
  const CLIENT_FNS = ["build", "new", MIRROR];
9
9
  /** A member's name in `scope`; at the root (`path` empty) one spelled like the mirror is `safe_` instead, and noticed. */
10
10
  function memberName(segment, path, scope, env) {
@@ -22,7 +22,7 @@ function resourceOf(ns, path, type, env) {
22
22
  const children = namespacesOf(ns).map(([segment, child]) => {
23
23
  const accessor = memberName(segment, path, scope, env);
24
24
  const childPath = [...path, segment];
25
- /* the type rule over the whole name: a leading digit gets its guard, and `self` stays `SelfResource` */
25
+ // the type rule over the whole name: a leading digit gets its guard, and `self` stays `SelfResource`
26
26
  const childType = env.at.names.claim(rustTypeIdent([...childPath, "Resource"].join(".")));
27
27
  return { accessor, node: resourceOf(child, childPath, childType, env) };
28
28
  });
@@ -42,7 +42,7 @@ function accessorBlocks(node, lifetime, client) {
42
42
  const members = (blocks) => blocks.map((lines) => lines.join("\n")).join("\n\n");
43
43
  /** Each namespace below the client: its type, its accessors and methods, then its children's. */
44
44
  function resourceLines(node) {
45
- /* the lifetime is named only where an accessor hands it on */
45
+ // the lifetime is named only where an accessor hands it on
46
46
  const head = node.children.length > 0
47
47
  ? `impl<'a, ${STYLE}: Style> ${node.type}<'a, ${STYLE}> {`
48
48
  : `impl<${STYLE}: Style> ${node.type}<'_, ${STYLE}> {`;
@@ -1,13 +1,13 @@
1
1
  import { mediaEssence } from "../../ir/sdk-model.js";
2
2
  import { lineComment, rustString } from "../shared/escape.js";
3
3
  import { NameScope, rustTypeIdent, rustValueIdent } from "../shared/lang.js";
4
+ import { realtimeAnswer } from "./realtime.js";
4
5
  import { rustBody, typeAt } from "./sdk-body.js";
5
6
  import { optsDecl, optsFields, optsLines, responseHeaders, takesIdempotencyKey, } from "./sdk-opts.js";
6
- import { realtimeAnswer } from "./realtime.js";
7
7
  import { sseAnswer } from "./sse.js";
8
8
  import { STYLE } from "./types-names.js";
9
9
  import { wsAnswer } from "./ws.js";
10
- /* the method's own locals: a path param never shadows one (it is claimed as `…2`) */
10
+ // the method's own locals: a path param never shadows one (it is claimed as `…2`)
11
11
  const METHOD_LOCALS = ["body", "client", "form", "opts", "spec"];
12
12
  /** How a stream operation answers. */
13
13
  function streamAnswer(op, at) {
@@ -13,7 +13,7 @@ export type OptsField = {
13
13
  readonly bare: boolean;
14
14
  };
15
15
  /** A stream's own `<Op>Opts` field, after the declared ones. */
16
- export type StreamField = {
16
+ type StreamField = {
17
17
  readonly ident: string;
18
18
  readonly type: string;
19
19
  readonly doc?: string;
@@ -56,3 +56,4 @@ export declare function responseHeaders(op: SdkOp, at: RustTypeContext): {
56
56
  readonly plan: RustResponseHeaders;
57
57
  readonly decl: string;
58
58
  } | null;
59
+ export {};
@@ -2,7 +2,7 @@ import { lineComment, rustString } from "../shared/escape.js";
2
2
  import { compareCodeUnits, NameScope, rustTypeIdent, rustValueIdent } from "../shared/lang.js";
3
3
  import { unboxed } from "./types-struct.js";
4
4
  import { rustTypeOf } from "./types.js";
5
- /* the Opts field an idempotent operation's caller sets its Idempotency-Key through */
5
+ // the Opts field an idempotent operation's caller sets its Idempotency-Key through
6
6
  const IDEMPOTENCY_KEY = "idempotency_key";
7
7
  const isStringConst = (s) => s.kind === "const" && typeof s.value === "string";
8
8
  /** Whether the type `schema` declares as a component has a `Default`: a struct, a newtype and a payload enum do not. */
@@ -77,7 +77,7 @@ function declaredHeaders(op) {
77
77
  .filter((status) => /^2(?:\d\d|XX)$/i.test(status))
78
78
  .sort(compareCodeUnits)
79
79
  .flatMap((status) => op.ir.responses[status].headers ?? []);
80
- /* reversed, so the first spelling of a name is the one its key ends on */
80
+ // reversed, so the first spelling of a name is the one its key ends on
81
81
  const first = new Map(all.toReversed().map((header) => [header.name.toLowerCase(), header]));
82
82
  return [...first.values()].sort((a, b) => compareCodeUnits(a.name, b.name));
83
83
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +1,5 @@
1
- import { type CrateOptions } from "./sdk-cargo.ts";
2
1
  import { type PackageIdentity, type Shipped } from "../shared/metadata.ts";
2
+ import { type CrateOptions } from "./sdk-cargo.ts";
3
3
  import type { RustCallPlan } from "./sdk-plan.ts";
4
4
  /**
5
5
  * The crate's options: its name (`http-sdk` by default), version (`0.1.0` by default) and what crates.io shows,
@@ -10,14 +10,14 @@ import { toIR } from "../../ir/build.js";
10
10
  import { sdkModel } from "../../ir/sdk-model.js";
11
11
  import { lineComment } from "../shared/escape.js";
12
12
  import { compareCodeUnits, rustTypeIdent } from "../shared/lang.js";
13
+ import { packageOn } from "../shared/metadata.js";
13
14
  import { renameNotice } from "../shared/mirror.js";
14
15
  import { rustErrorKeys } from "./errors.js";
15
16
  import { needsWebSocket, publicItems, runtimeFiles } from "./http.js";
16
17
  import { cargoLock, cargoToml, crateIdentity } from "./sdk-cargo.js";
17
- import { packageOn } from "../shared/metadata.js";
18
18
  import { clientDecls } from "./sdk-client.js";
19
19
  import { rustTopLevel, rustTypeContext } from "./types.js";
20
- /* the marker rustfmt and linguist read */
20
+ // the marker rustfmt and linguist read
21
21
  const MARKER = "// @generated by clients. DO NOT EDIT.";
22
22
  /** Each component's declaration in code-unit order, its description as its rustdoc. */
23
23
  function componentDecls(ir, at) {
@@ -64,9 +64,9 @@ function emitRust(document, options, shipped) {
64
64
  const ir = toIR(document, { deriveOperationIds: true });
65
65
  const model = sdkModel(ir);
66
66
  const at = rustTypeContext(ir);
67
- /* components first: the client's hoisted types then land beside them */
67
+ // components first: the client's hoisted types then land beside them
68
68
  const components = componentDecls(ir, at);
69
- /* every component emitted under another name is noticed, as the mirror's rename is */
69
+ // every component emitted under another name is noticed, as the mirror's rename is
70
70
  const notices = [...at.names.renamed].map(([name, emitted]) => renameNotice("rust", {
71
71
  because: `"${rustTypeIdent(name)}" is a name the SDK's crate root or the Rust prelude holds`,
72
72
  name,
@@ -74,7 +74,7 @@ function emitRust(document, options, shipped) {
74
74
  what: "component",
75
75
  }));
76
76
  const client = clientDecls(ir, { at, notices, ops: model.opsById });
77
- /* before the hoisted are read: each key's <Key>Data lands among them; an API without operations answers no error */
77
+ // before the hoisted are read: each key's <Key>Data lands among them; an API without operations answers no error
78
78
  const errorKeys = model.ops.length > 0 ? [rustErrorKeys(model, at)] : [];
79
79
  const hoisted = [...at.decls].sort(([a], [b]) => compareCodeUnits(a, b)).map(([, decl]) => decl);
80
80
  const features = {
@@ -10,11 +10,6 @@ import type { IRSchema } from "../../ir/model.ts";
10
10
  import { type SdkOp } from "../../ir/sdk-model.ts";
11
11
  import type { OptsField, StreamAnswer } from "./sdk-opts.ts";
12
12
  import type { RustTypeContext } from "./types.ts";
13
- /** The resume cursor's id, which the SSE and realtime Opts carry. */
14
- export declare const LAST_EVENT_ID: {
15
- ident: string;
16
- type: string;
17
- };
18
13
  /** Whether a declared param is the Last-Event-ID header (any casing), the resume channel an SSE dial sends. */
19
14
  export declare const isLastEventIdHeader: (param: string, where: OptsField["in"]) => boolean;
20
15
  /** The type of the events `op` declares as `events`. */