@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
@@ -5,7 +5,7 @@ import { sendArgs } from "./sdk-answer.js";
5
5
  import { goTypeOf } from "./types.js";
6
6
  /** Whether a declared param is the Last-Event-ID header (any casing), the resume channel an SSE dial sends. */
7
7
  export const isLastEventIdHeader = (param, where) => where === "header" && param.toLowerCase() === "last-event-id";
8
- /* LastEventID, sent only when set: an empty header would still name a position */
8
+ // LastEventID, sent only when set: an empty header would still name a position
9
9
  const SSE_OPTS = {
10
10
  before: [],
11
11
  carries: isLastEventIdHeader,
@@ -1,3 +1,8 @@
1
+ /**
2
+ * The package-level names Go types are declared under (v0 buildGoNames): one scope that components,
3
+ * hoisted types and constants all claim from, clear of every identifier the Go runtime declares.
4
+ */
5
+ import {} from "../../ir/model.js";
1
6
  import { irResolver } from "../../ir/schema.js";
2
7
  import { valueCycleSchemas } from "../../ir/sdk-model.js";
3
8
  import { compareCodeUnits, goExported, NameScope } from "../shared/lang.js";
@@ -10,7 +10,7 @@ export type StructField = {
10
10
  triState: boolean;
11
11
  };
12
12
  /** The field holding the keys `additionalProperties` admits beyond the declared ones. */
13
- export type ExtraField = {
13
+ type ExtraField = {
14
14
  goName: string;
15
15
  valueType: string;
16
16
  };
@@ -27,3 +27,4 @@ export type StructShape = {
27
27
  export declare function isTagName(key: string): boolean;
28
28
  /** `type <name> struct { … }` with its embeds, fields and extra map, then whatever methods its keys need. */
29
29
  export declare function structDecl(name: string, shape: StructShape): string;
30
+ export {};
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { goString } from "../shared/escape.js";
8
8
  import { fillingMarshal, marshal, unmarshal } from "./types-codec.js";
9
- /* the punctuation encoding/json's isValidTag accepts in a tag name */
9
+ // the punctuation encoding/json's isValidTag accepts in a tag name
10
10
  const TAG_PUNCTUATION = "!#$%&()*+-./:;<=>?@[]^_{|}~ ";
11
11
  /** Whether encoding/json reads `key` as a tag name (its isValidTag: a letter, a decimal digit or that punctuation). */
12
12
  export function isTagName(key) {
@@ -1,11 +1,11 @@
1
1
  import { goString } from "../shared/escape.js";
2
2
  import { compareCodeUnits, goExported, NameScope } from "../shared/lang.js";
3
- import { irNames, plainNames } from "./types-names.js";
4
3
  import { isNilable } from "./types-codec.js";
4
+ import { irNames, plainNames } from "./types-names.js";
5
5
  import { isTagName, structDecl } from "./types-struct.js";
6
6
  import { unionDecl, variantTypes } from "./types-union.js";
7
7
  const RAW = "json.RawMessage";
8
- /* deeper than this, a schema is raw JSON */
8
+ // deeper than this, a schema is raw JSON
9
9
  const MAX_DEPTH = 12;
10
10
  const SCALARS = {
11
11
  boolean: "bool",
@@ -22,7 +22,7 @@ export function goTypeContext(ir) {
22
22
  function declare(ir, at, key, base) {
23
23
  const name = at.names.hoist(key, base);
24
24
  if (!at.decls.has(name)) {
25
- /* claimed before its body: what the body hoists in turn comes after it */
25
+ // claimed before its body: what the body hoists in turn comes after it
26
26
  at.decls.set(name, "");
27
27
  at.decls.set(name, goTopLevel(name, ir, at));
28
28
  }
@@ -71,7 +71,7 @@ const USES = {
71
71
  ref: refUse,
72
72
  scalar: (ir, at) => (isEnum(ir) ? hoist(ir, at) : SCALARS[ir.type]),
73
73
  tuple: (ir) => `[${ir.items.length}]interface{}`,
74
- /* Go has no union type */
74
+ // Go has no union type
75
75
  union: () => RAW,
76
76
  unknown: () => RAW,
77
77
  };
@@ -85,13 +85,13 @@ export function goTypeOf(ir, at) {
85
85
  /** A label for an enum value inside a constant name: `""` is `Empty`, a negative number `Neg<n>`. */
86
86
  function enumLabel(value) {
87
87
  if (typeof value === "number")
88
- return `${value < 0 ? "Neg" : ""}${String(Math.abs(value)).replace(/\W/g, "_")}`;
88
+ return `${value < 0 ? "Neg" : ""}${String(Math.abs(value)).replaceAll(/\W/g, "_")}`;
89
89
  return value === "" ? "Empty" : goExported(String(value));
90
90
  }
91
91
  /** `type <name> string|int` and one `<name><Label>` constant per value of its kind. */
92
92
  function enumDecl(name, ir, names) {
93
93
  const integer = ir.type === "integer";
94
- /* a value of the other kind (or a null) has no constant */
94
+ // a value of the other kind (or a null) has no constant
95
95
  const values = ir.enum.filter((value) => integer ? Number.isInteger(value) : value !== null);
96
96
  const labels = new NameScope();
97
97
  const consts = values.map((value) => {
@@ -132,7 +132,7 @@ function objectDecl(name, ir, at) {
132
132
  : undefined;
133
133
  return structDecl(name, { embeds: [], extra, fields });
134
134
  }
135
- /* the kinds a required field may render as a slice or a map, whose nil a MarshalJSON fills */
135
+ // the kinds a required field may render as a slice or a map, whose nil a MarshalJSON fills
136
136
  const SLICE_OR_MAP = ["allOf", "array", "nullable", "object"];
137
137
  /** A field encoding/json handles alone: a key a tag can name, never a required slice or map. */
138
138
  const plainField = (field) => isTagName(field.name) && !(field.required && SLICE_OR_MAP.includes(field.schema.kind));
@@ -172,7 +172,7 @@ export function goTopLevel(name, ir, at) {
172
172
  const variant = (schema, key, base) => declare(schema, at, key, base);
173
173
  return unionDecl(name, { ...ir, discriminator: ir.discriminator }, at.names, variant);
174
174
  }
175
- /* a map or an empty struct is a named type; anything else an alias */
175
+ // a map or an empty struct is a named type; anything else an alias
176
176
  return `type ${name} ${ir.kind === "object" ? "" : "= "}${use(ir, member(name, at, "Value"))}`;
177
177
  }
178
178
  /**
@@ -181,7 +181,7 @@ export function goTopLevel(name, ir, at) {
181
181
  */
182
182
  export function goKeyedMembers(schema, dispatch, at) {
183
183
  const name = schema.kind === "ref" ? at.names.ref(schema.name) : `${goExported(at.parentName)}${goExported(at.fieldName)}`;
184
- /* a mapping names refs only, whose type is their component's: the key alone names each inline member */
184
+ // a mapping names refs only, whose type is their component's: the key alone names each inline member
185
185
  const union = { ...dispatch.union, discriminator: { propertyName: dispatch.key } };
186
186
  const types = variantTypes(name, union, at.names, (variant, key, base) => declare(variant, at, key, base));
187
187
  return dispatch.members.map(({ value }, i) => [value, types[i]]);
@@ -6,7 +6,7 @@ import { isLastEventIdHeader } from "./sse.js";
6
6
  import { goKeyedMembers, goTypeOf } from "./types.js";
7
7
  /** Whether a declared param is the `reconnect_token` query param a WebSocket dial sends. */
8
8
  const isReconnectToken = (param, where) => where === "query" && param === "reconnect_token";
9
- /* both open a socket: a dial fails before any stream exists */
9
+ // both open a socket: a dial fails before any stream exists
10
10
  const FAIL = "nil, err";
11
11
  const WS_OPTS = {
12
12
  before: [],
@@ -25,16 +25,16 @@ const WS_OPTS = {
25
25
  const WS = {
26
26
  base: "TypedWebSocket",
27
27
  handlers: ["OnMessage", "OnClose", "OnError"],
28
+ open: (client, read, write) => `dialWebSocket(${sendArgs(client, read, write)})`,
28
29
  suffix: "Socket",
29
30
  what: "socket",
30
- open: (client, read, write) => `dialWebSocket(${sendArgs(client, read, write)})`,
31
31
  };
32
32
  const REALTIME = {
33
33
  base: "ResumableConnection",
34
34
  handlers: ["OnMessage"],
35
+ open: (client, read, write) => `newRealtime(${sendArgs(client, "topts", read, write)})`,
35
36
  suffix: "Connection",
36
37
  what: "connection",
37
- open: (client, read, write) => `newRealtime(${sendArgs(client, "topts", read, write)})`,
38
38
  };
39
39
  /** `<Op><direction>`, the sealed interface of the keyed union `schema`'s members, each marked as one; its lines. */
40
40
  function sealed(op, members, iface, says) {
@@ -99,7 +99,7 @@ function keyedInbound(op, send, dispatch, at) {
99
99
  ].join("\n"));
100
100
  return { codec: decode, decode, key: dispatch.key, members, type: iface };
101
101
  }
102
- /* a send of an op that declares none: as given */
102
+ // a send of an op that declares none: as given
103
103
  const UNTYPED_OUT = { codec: "messageAsIs", type: "any" };
104
104
  /** The fields `schema` requires at its top level: an object's, none for any other schema. */
105
105
  function requiredOf(schema, at) {
@@ -188,7 +188,7 @@ function wsStream(op, at) {
188
188
  const read = inbound(op, send, () => ({ codec: "frameBytes", type: "[]byte" }), at);
189
189
  return { ...answerOf(op, WS, { read, write: outbound(op, receive, at) }, at), doc: "", opts: WS_OPTS };
190
190
  }
191
- /* the realtime Opts' one own field, which `sets` copies: the method sets its Headers and HTTPClient */
191
+ // the realtime Opts' one own field, which `sets` copies: the method sets its Headers and HTTPClient
192
192
  const REALTIME_FIELDS = [
193
193
  {
194
194
  doc: "Transport is the resume cursor, the offered subprotocols and the reconnect policy; the connection advances its own copy, and the client sets Headers and HTTPClient.",
@@ -198,7 +198,7 @@ const REALTIME_FIELDS = [
198
198
  ];
199
199
  const REALTIME_OPTS = {
200
200
  before: ["var topts TransportOpts"],
201
- /* the WebSocket and long-poll dials send the cursor as query params, the SSE dial its id as Last-Event-ID */
201
+ // the WebSocket and long-poll dials send the cursor as query params, the SSE dial its id as Last-Event-ID
202
202
  carries: (param, where) => isReconnectToken(param, where) ||
203
203
  (where === "query" && param === "last_event_id") ||
204
204
  isLastEventIdHeader(param, where),
@@ -6,8 +6,6 @@ export type JavaPackage = {
6
6
  readonly packageName: string;
7
7
  readonly version: string;
8
8
  };
9
- /** The one runtime dependency, its coordinates pinned with the test classpath's (java-pins.json). */
10
- export declare const JACKSON = "tools.jackson.core:jackson-databind:3.2.4";
11
9
  /** A Maven group id: lowercase dotted words. */
12
10
  export declare const validateGroupId: (value: string) => string;
13
11
  /** A Maven artifact id: lowercase words joined by `-`. */
@@ -21,23 +19,23 @@ export declare const validateVersion: (value: string) => string;
21
19
  /** What Maven Central requires of a POM beyond its name and description, each part the caller gave, validated. */
22
20
  export type JavaPomMetadata = {
23
21
  /** the POM's description, over the document's */
24
- readonly description?: string;
22
+ readonly description?: string | undefined;
25
23
  /** the project's https home page, the POM's `url` */
26
- readonly homepage?: string;
24
+ readonly homepage?: string | undefined;
27
25
  /** one SPDX license id */
28
- readonly license?: string;
26
+ readonly license?: string | undefined;
29
27
  /** the https URL of its git repository, without a trailing `/` or `.git` */
30
- readonly repository?: string;
28
+ readonly repository?: string | undefined;
31
29
  /** the POM's developers, comma separated: each a name, or `Name <email>` */
32
- readonly developers?: string;
30
+ readonly developers?: string | undefined;
33
31
  };
34
32
  /** The POM metadata validated: the developers one entry each. */
35
33
  type PomFields = Omit<JavaPomMetadata, "developers"> & {
36
- readonly developers?: readonly string[];
34
+ readonly developers?: readonly string[] | undefined;
37
35
  };
38
36
  /** The POM's words: the document's name and description (spec text, written only through `groovyString`), the rest. */
39
37
  export type JavaPom = PomFields & {
40
- readonly name?: string;
38
+ readonly name?: string | undefined;
41
39
  };
42
40
  /** The POM for `options` over the document's `info`: the metadata validated, its description over the document's. */
43
41
  export declare function pomOf(options: JavaPomMetadata, info: {
@@ -10,8 +10,8 @@
10
10
  import { escapeText } from "../shared/escape.js";
11
11
  import { AUTHOR, authorOf, checked, HTTPS_URL, SPDX_ID, TEXT } from "../shared/metadata.js";
12
12
  /** The one runtime dependency, its coordinates pinned with the test classpath's (java-pins.json). */
13
- export const JACKSON = "tools.jackson.core:jackson-databind:3.2.4";
14
- /* Java's keywords and literals (JLS 3.9, 3.10.3, 3.10.7): no package segment may be one, and `_` is one since 9 */
13
+ const JACKSON = "tools.jackson.core:jackson-databind:3.2.4";
14
+ // Java's keywords and literals (JLS 3.9, 3.10.3, 3.10.7): no package segment may be one, and `_` is one since 9
15
15
  const RESERVED = [
16
16
  "abstract",
17
17
  "assert",
@@ -68,15 +68,15 @@ const RESERVED = [
68
68
  "null",
69
69
  "_",
70
70
  ];
71
- /* the type names the client file spells or imports, and its nested Builder: a client of one of these clashes */
71
+ // the type names the client file spells or imports, and its nested Builder: a client of one of these clashes
72
72
  const SPELLED = ["Builder", "IllegalStateException", "String", "Transport", "URI"];
73
- /* a Maven group: lowercase dotted words; an artifact: lowercase words joined by `-`; a package segment: a lowercase
74
- * identifier; a client: a PascalCase type */
73
+ // a Maven group: lowercase dotted words; an artifact: lowercase words joined by `-`; a package segment: a lowercase
74
+ // identifier; a client: a PascalCase type
75
75
  const GROUP_ID = /^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)*$/;
76
76
  const ARTIFACT_ID = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
77
77
  const SEGMENT = /^[a-z_][a-z0-9_]*$/;
78
78
  const CLIENT_NAME = /^[A-Z][A-Za-z0-9_]*$/;
79
- /* SemVer 2 (semver.org's recommended pattern), as the C# and Rust packages take it */
79
+ // SemVer 2 (semver.org's recommended pattern), as the C# and Rust packages take it
80
80
  const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
81
81
  const refuse = (option, value) => {
82
82
  throw new Error(`Invalid ${option}: ${JSON.stringify(value)}`);
@@ -95,7 +95,7 @@ export function validatePackageName(value) {
95
95
  export const validateClientName = (value) => CLIENT_NAME.test(value) && !SPELLED.includes(value) ? value : refuse("clientName", value);
96
96
  /** A SemVer 2 version. */
97
97
  export const validateVersion = (value) => (SEMVER.test(value) ? value : refuse("version", value));
98
- /* a repository is a path on its host: `https://host/owner/name` */
98
+ // a repository is a path on its host: `https://host/owner/name`
99
99
  const REPOSITORY_PATH = /^https:\/\/[^/]+\/[^/]/;
100
100
  /** The developers option as one author each, or a refusal of the whole value when any is not a name or `Name <email>`. */
101
101
  function developersOf(value) {
@@ -128,7 +128,7 @@ export function pomOf(options, info) {
128
128
  * text neither interpolates (no `$` in `'…'`) nor ends the string.
129
129
  */
130
130
  const groovyString = (text) => `'${escapeText(text, "java").replaceAll("'", "\\'")}'`;
131
- /* the indent of the `pom { … }` block's members, and of one level in */
131
+ // the indent of the `pom { … }` block's members, and of one level in
132
132
  const POM = " ";
133
133
  const IN = " ";
134
134
  /** `key = '…'` lines at `indent`, each value a Groovy string. */
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { javaString } from "../shared/escape.js";
7
7
  import { bin, call, classOf, forOpen, ifOpen, lit, local, methodHeader, newOf, param, returnStmt, rule, statement, throwStmt, typeHeader, } from "./layout.js";
8
- /* a payload's erasure: `Class` takes no type arguments */
8
+ // a payload's erasure: `Class` takes no type arguments
9
9
  const erased = (type) => type.replace(/<.*$/, "");
10
10
  /** One switch arm, `case label -> value;` (`default` for no label), in the switch's body. */
11
11
  const arm = (label, value) => statement(8, rule(label === null ? null : lit(label), value));
@@ -52,7 +52,7 @@ export const id = (path) => path
52
52
  /** A literal or any token kept whole: `"GET"`, `null`, `true`, `16L`. */
53
53
  export const lit = (text) => ({ k: "lit", text });
54
54
  /** A string as an expression: an identifier path, else a token kept whole. */
55
- export const expr = (e) => typeof e !== "string" ? e : /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*$/.test(e) ? id(e) : lit(e);
55
+ export const expr = (e) => typeof e === "string" ? (/^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*$/.test(e) ? id(e) : lit(e)) : e;
56
56
  /** `of.name(args)`, or `name(args)` with no receiver; a string receiver is an identifier path. */
57
57
  export const call = (of, name, args = []) => ({
58
58
  args: args.map(expr),
@@ -125,15 +125,16 @@ export function method(v, m) {
125
125
  /** The return type and the name with its `(`, the break before the name tagged. */
126
126
  function nameScope(v, m, beforeName) {
127
127
  v.b.open(0);
128
- if (m.returns !== undefined) {
128
+ if (m.returns === undefined) {
129
+ v.b.open(0);
130
+ }
131
+ else {
129
132
  v.b.open(0);
130
133
  v.b.open(0);
131
134
  v.type(type(m.returns));
132
135
  v.b.close();
133
136
  v.b.brk("independent", " ", 0, beforeName);
134
- }
135
- else
136
- v.b.open(0); /* a constructor's name scope opens with its name */
137
+ } /* a constructor's name scope opens with its name */
137
138
  v.b.token(m.name);
138
139
  v.b.token("(");
139
140
  v.b.close();
@@ -8,7 +8,7 @@
8
8
  */
9
9
  /** google-java-format's line width. */
10
10
  export const WIDTH = 100;
11
- /* a forced break is "wider" than any line (Doc.MAX_LINE_WIDTH) */
11
+ // a forced break is "wider" than any line (Doc.MAX_LINE_WIDTH)
12
12
  const MAX = 1000;
13
13
  const evalIndent = (indent) => typeof indent === "number" ? indent : indent.tag.taken ? indent.onBreak : indent.onFlat;
14
14
  /** Indent.If: `onBreak` when `tag`'s break was taken, else `onFlat`. */
@@ -50,8 +50,9 @@ function computeBroken(doc, start) {
50
50
  doc.breaks.push(child);
51
51
  doc.splits.push([]);
52
52
  }
53
- else
53
+ else {
54
54
  doc.splits.at(-1).push(child);
55
+ }
55
56
  }
56
57
  return doc.splits.reduce((state, split, i) => breakAndSplit(state, i === 0 ? undefined : doc.breaks[i - 1], split), start);
57
58
  }
@@ -68,8 +69,9 @@ function breakAndSplit(state, brk, split) {
68
69
  brk.newIndent = Math.max(state.lastIndent + evalIndent(brk.indent), 0);
69
70
  next = { ...state, column: brk.newIndent };
70
71
  }
71
- else
72
+ else {
72
73
  next = { ...state, column: state.column + brk.flat.length };
74
+ }
73
75
  }
74
76
  const room = next.column + splitWidth <= WIDTH;
75
77
  next = { ...next, mustBreak: false };
@@ -78,20 +80,24 @@ function breakAndSplit(state, brk, split) {
78
80
  return room ? next : { ...next, mustBreak: true };
79
81
  }
80
82
  function write(doc, out) {
81
- if (doc.k === "text")
83
+ if (doc.k === "text") {
82
84
  put(doc, out);
83
- else if (doc.k === "break")
85
+ }
86
+ else if (doc.k === "break") {
84
87
  out.text += doc.broken ? `\n${" ".repeat(doc.newIndent)}` : doc.flat;
85
- else if (doc.oneLine)
88
+ }
89
+ else if (doc.oneLine) {
86
90
  for (const child of doc.docs)
87
91
  writeFlat(child, out);
88
- else
92
+ }
93
+ else {
89
94
  doc.splits.forEach((split, i) => {
90
95
  if (i > 0)
91
96
  write(doc.breaks[i - 1], out);
92
97
  for (const child of split)
93
98
  write(child, out);
94
99
  });
100
+ }
95
101
  }
96
102
  function writeFlat(doc, out) {
97
103
  if (doc.k === "level")
@@ -59,7 +59,7 @@ function regularDot(v, items) {
59
59
  }
60
60
  v.b.token(e.name);
61
61
  argsAndParen(v, e, 0);
62
- /* the last item is the chain itself, and no dot follows it */
62
+ // the last item is the chain itself, and no dot follows it
63
63
  if (i < items.length - 1)
64
64
  length += v.flat(e).length;
65
65
  });
@@ -4,10 +4,8 @@
4
4
  * `+` chain (or stands alone), else under its own quote.
5
5
  */
6
6
  import { WIDTH } from "./layout-doc.js";
7
- /*
8
- * StringWrapper.stringComponents: a literal's body cut before each whitespace character (and a `\t`), a run of
9
- * `\n`/`\r` escapes ending the piece it closes
10
- */
7
+ // StringWrapper.stringComponents: a literal's body cut before each whitespace character (and a `\t`), a run of
8
+ // `\n`/`\r` escapes ending the piece it closes
11
9
  function piecesOf(body) {
12
10
  const out = [];
13
11
  let start = 0;
@@ -19,8 +17,9 @@ function piecesOf(body) {
19
17
  while (body.startsWith("\\r", i) || body.startsWith("\\n", i))
20
18
  i += 2;
21
19
  }
22
- else
20
+ else {
23
21
  continue;
22
+ }
24
23
  out.push(body.slice(start, i));
25
24
  start = i;
26
25
  }
@@ -31,8 +31,9 @@ function typeList(v, word, types) {
31
31
  v.b.open(4);
32
32
  v.b.token(word);
33
33
  types.forEach((t, i) => {
34
- if (i === 0)
34
+ if (i === 0) {
35
35
  v.b.space();
36
+ }
36
37
  else {
37
38
  v.b.token(",");
38
39
  v.b.breakOp(" ");
@@ -44,7 +45,7 @@ function typeList(v, word, types) {
44
45
  /** A type declaration's header, through its `{` (or `{}`). */
45
46
  export function typeDeclaration(v, h) {
46
47
  if (h.kind === "enum") {
47
- /* visitEnumDeclaration's header: a level of its own, `enum` and a unified break before the name at +4 */
48
+ // visitEnumDeclaration's header: a level of its own, `enum` and a unified break before the name at +4
48
49
  v.b.open(0);
49
50
  typeModifiers(v, h);
50
51
  v.b.open(4);
@@ -61,7 +62,7 @@ export function typeDeclaration(v, h) {
61
62
  v.b.token(h.name);
62
63
  v.b.open(4);
63
64
  if (h.kind === "record") {
64
- /* visitRecordDeclaration's components as formals, then its interface */
65
+ // visitRecordDeclaration's components as formals, then its interface
65
66
  v.b.token("(");
66
67
  if (h.components.length > 0) {
67
68
  v.b.breakToFill("");
@@ -79,15 +80,16 @@ export function typeDeclaration(v, h) {
79
80
  }
80
81
  else if (h.kind === "class") {
81
82
  if (h.extends !== undefined) {
82
- /* classDeclarationTypeList of one superclass, in no level of its own */
83
+ // classDeclarationTypeList of one superclass, in no level of its own
83
84
  v.b.breakToFill(" ");
84
85
  v.b.token("extends");
85
86
  v.b.space();
86
87
  v.type(type(h.extends));
87
88
  }
88
89
  }
89
- else if (h.permits.length > 0)
90
+ else if (h.permits.length > 0) {
90
91
  typeList(v, "permits", h.permits);
92
+ }
91
93
  v.b.close();
92
94
  }
93
95
  v.b.space();
@@ -59,7 +59,7 @@ export class Visitor {
59
59
  new Visitor(b).expr(e);
60
60
  return b.flat();
61
61
  }
62
- /* hasOnlyShortItems: every item under MAX_ITEM_LENGTH_FOR_FILLING (10) characters */
62
+ // hasOnlyShortItems: every item under MAX_ITEM_LENGTH_FOR_FILLING (10) characters
63
63
  shortItems(items) {
64
64
  return items.every((item) => this.flat(item).length < 10);
65
65
  }
@@ -78,8 +78,9 @@ export class Visitor {
78
78
  const dims = t.dims > 0;
79
79
  if (dims)
80
80
  this.b.open(4);
81
- if (t.args.length === 0)
81
+ if (t.args.length === 0) {
82
82
  this.typeName(t.name);
83
+ }
83
84
  else {
84
85
  this.b.open(4);
85
86
  this.typeName(t.name);
@@ -220,7 +221,7 @@ export class Visitor {
220
221
  this.b.brk(fill, " ");
221
222
  this.b.token(e.op);
222
223
  this.b.space();
223
- /* a literal in a `+` after a non-literal operand reflows under its own quote */
224
+ // a literal in a `+` after a non-literal operand reflows under its own quote
224
225
  const later = e.op === "+" && isString(operand) && !e.operands.slice(0, i + 1).every(isString);
225
226
  if (later)
226
227
  this.b.literal(this.flat(operand), true);
@@ -5,7 +5,7 @@
5
5
  * (GJF's Doc and DocBuilder), the visitor layout-visitor.ts, layout-dot.ts and layout-decl.ts (JavaInputAstVisitor),
6
6
  * and a long string literal is reflowed as StringWrapper reflows it (layout-strings.ts).
7
7
  */
8
- import { expr } from "./layout-ast.js";
8
+ import { expr, } from "./layout-ast.js";
9
9
  import { annotation, declareOne, method } from "./layout-decl.js";
10
10
  import { Builder } from "./layout-doc.js";
11
11
  import { wrapStrings } from "./layout-strings.js";
@@ -26,7 +26,7 @@ const STATEMENTS = {
26
26
  v.b.token(";");
27
27
  },
28
28
  for: (v, s) => {
29
- /* visitEnhancedForLoop: the variable declared with `:` before its iterable */
29
+ // visitEnhancedForLoop: the variable declared with `:` before its iterable
30
30
  v.b.open(0);
31
31
  v.b.token("for");
32
32
  v.b.space();
@@ -53,10 +53,11 @@ const STATEMENTS = {
53
53
  local: (v, s) => declareOne(v, s.decl, { kind: "variable", trailing: ";" }),
54
54
  return: (v, s) => keyword(v, "return", s.expr),
55
55
  rule: (v, s) => {
56
- /* visitCase, a rule: `case label ->` or `default ->`, a unified break, the value at +4 */
56
+ // visitCase, a rule: `case label ->` or `default ->`, a unified break, the value at +4
57
57
  v.b.open(4);
58
- if (s.label === null)
58
+ if (s.label === null) {
59
59
  v.b.token("default");
60
+ }
60
61
  else {
61
62
  v.b.token("case");
62
63
  v.b.open(0);
@@ -9,7 +9,7 @@ import { irResolver } from "../../ir/schema.js";
9
9
  import { compareCodeUnits, javaTypeName, NameScope } from "../shared/lang.js";
10
10
  /** The type a value without a schema is, and the one a nullable open value is. */
11
11
  export const JSON_NODE = "JsonNode";
12
- /* the type names the emitted models and the client spell, which no runtime file holds: each is reserved */
12
+ // the type names the emitted models and the client spell, which no runtime file holds: each is reserved
13
13
  const SPELLED = [
14
14
  "Boolean",
15
15
  "Builder",
@@ -39,7 +39,7 @@ const SPELLED = [
39
39
  * The code text a scan reads: comments dropped and string and char literals emptied, in one left-to-right pass, so a
40
40
  * `//` inside a string opens no comment and a quote inside a comment opens no string.
41
41
  */
42
- export const codeOf = (code) => code.replace(/\/\*[\s\S]*?\*\/|\/\/.*$|"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)'/gm, (token) => token.startsWith("/") ? "" : token[0] === '"' ? '""' : "''");
42
+ export const codeOf = (code) => code.replaceAll(/\/\*[\s\S]*?\*\/|\/\/.*$|"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)'/gm, (token) => token.startsWith("/") ? "" : token[0] === '"' ? '""' : "''");
43
43
  /** The type names `code` spells: each imported type by its simple name, and each capitalized identifier that is not a member access. */
44
44
  export function spelledIn(code) {
45
45
  const text = codeOf(code);
@@ -70,13 +70,14 @@ export function javaNames(schemas, taken, declares) {
70
70
  const base = javaTypeName(name);
71
71
  const taken = scope.has(base);
72
72
  components.set(name, scope.claim(taken ? `${base}Model` : base));
73
- if (taken)
73
+ if (taken) {
74
74
  renamed.push({
75
75
  because: `"${base}" is a name the SDK's runtime, the JDK or another declaration holds`,
76
76
  name,
77
77
  renamed: components.get(name),
78
78
  what: "component",
79
79
  });
80
+ }
80
81
  }
81
82
  const hoisted = new Map();
82
83
  return {
@@ -90,7 +91,7 @@ export function javaNames(schemas, taken, declares) {
90
91
  hoisted.set(key, name);
91
92
  return name;
92
93
  },
93
- /* a ref reaches here only for a declared component: `alias` answers for every other one */
94
+ // a ref reaches here only for a declared component: `alias` answers for every other one
94
95
  ref: (name) => components.get(name),
95
96
  renamed,
96
97
  resolve: irResolver(schemas),
@@ -10,7 +10,6 @@
10
10
  */
11
11
  import type { IRField, IRSchema } from "../../ir/model.ts";
12
12
  import type { JavaTypeContext, Member } from "./models.ts";
13
- export declare const RECORD_MEMBERS: readonly string[];
14
13
  /** A record's members: its fields, and whether it keeps every other member (it declares `additionalProperties`). */
15
14
  export type RecordShape = {
16
15
  readonly fields: readonly IRField[];
@@ -2,8 +2,8 @@ import { javaString } from "../shared/escape.js";
2
2
  import { camelWords, compareCodeUnits, isJavaReserved, NameScope } from "../shared/lang.js";
3
3
  import { typeHeader } from "./layout.js";
4
4
  import { JSON_NODE } from "./models-names.js";
5
- /* every member name a record component collides with: java.lang.Record's and Object's synthesized and final methods */
6
- export const RECORD_MEMBERS = [
5
+ // every member name a record component collides with: java.lang.Record's and Object's synthesized and final methods
6
+ const RECORD_MEMBERS = [
7
7
  "clone",
8
8
  "equals",
9
9
  "finalize",
@@ -16,7 +16,7 @@ export const RECORD_MEMBERS = [
16
16
  ];
17
17
  const NON_NULL = { args: ["JsonInclude.Include.NON_NULL"], name: "JsonInclude" };
18
18
  const NON_EMPTY = { args: ["JsonInclude.Include.NON_EMPTY"], name: "JsonInclude" };
19
- /* a required, non-nullable use of these is written primitive */
19
+ // a required, non-nullable use of these is written primitive
20
20
  const PRIMITIVE = { Boolean: "boolean", Double: "double", Long: "long" };
21
21
  /** Whether an object, or any object part of an allOf (refs followed), declares `additionalProperties`. */
22
22
  export function isOpen(schema, resolve) {
@@ -15,7 +15,7 @@ type Discriminated = Of<"union"> & {
15
15
  discriminator: IRDiscriminator;
16
16
  };
17
17
  /** Declares `schema` once under `key` and `base`; its name. */
18
- export type Declare = (schema: IRSchema, key: string, base: string) => string;
18
+ type Declare = (schema: IRSchema, key: string, base: string) => string;
19
19
  /** What a union's declaration reaches: the context, its members' types, and the hoist. */
20
20
  export type UnionScope = {
21
21
  at: JavaTypeContext;
@@ -2,8 +2,8 @@ import { compareCodeUnits, javaTypeName } from "../shared/lang.js";
2
2
  import { deserializerLines } from "./json.js";
3
3
  import { classOf, typeHeader } from "./layout.js";
4
4
  import { enumValues, stringEnumDecl } from "./models-enum.js";
5
- import { fieldsOf } from "./models-record.js";
6
5
  import { JSON_NODE } from "./models-names.js";
6
+ import { fieldsOf } from "./models-record.js";
7
7
  /** Whether a variant is a const string: a union of these alone is a string enum. */
8
8
  export const isLiteral = (variant) => variant.kind === "const" && typeof variant.value === "string";
9
9
  /** The values that select `variant`: its mapping keys, else its property's const or enum, else its ref's name. */
@@ -5,9 +5,8 @@
5
5
  * type name is reserved where it collides (models-names.ts).
6
6
  */
7
7
  import type { IR, IRSchema } from "../../ir/model.ts";
8
- import { type JavaTypeNames } from "./models-names.ts";
9
8
  import type { Dispatch } from "./json.ts";
10
- export type { JavaTypeNames } from "./models-names.ts";
9
+ import { type JavaTypeNames } from "./models-names.ts";
11
10
  /** Where a type is being written, the declarations it hoists, and the names. */
12
11
  export type JavaTypeContext = {
13
12
  parentName: string;