@workerstack/clients 1.0.0-rc.26 → 1.0.0-rc.28

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 (277) hide show
  1. package/README.md +43 -43
  2. package/bin/{honey-clients.js → clients.js} +12 -12
  3. package/dist/cli.d.ts +3 -3
  4. package/dist/cli.js +14 -14
  5. package/dist/emit/cli/discovery.js +1 -1
  6. package/dist/emit/cli/install.js +2 -2
  7. package/dist/emit/cli/layout.js +1 -1
  8. package/dist/emit/cli/module.js +1 -1
  9. package/dist/emit/cli/release.js +1 -1
  10. package/dist/emit/csharp/errors.js +1 -1
  11. package/dist/emit/csharp/sdk-client.js +1 -1
  12. package/dist/emit/csharp/sdk-csproj.d.ts +1 -1
  13. package/dist/emit/csharp/sdk-csproj.js +2 -2
  14. package/dist/emit/csharp/sdk.d.ts +1 -1
  15. package/dist/emit/csharp/sdk.js +2 -2
  16. package/dist/emit/csharp/transport.js +2 -2
  17. package/dist/emit/csharp/types-record.d.ts +1 -1
  18. package/dist/emit/go/sdk-client.js +1 -1
  19. package/dist/emit/go/sdk.js +1 -1
  20. package/dist/emit/java/sdk-errors.js +5 -5
  21. package/dist/emit/java/sdk-op.d.ts +1 -1
  22. package/dist/emit/java/sdk.js +3 -3
  23. package/dist/emit/mcp/files.d.ts +1 -1
  24. package/dist/emit/mcp/mounted.js +2 -2
  25. package/dist/emit/mcp/runtime.js +1 -1
  26. package/dist/emit/mcp/server.js +1 -1
  27. package/dist/emit/python/errors.js +1 -1
  28. package/dist/emit/python/sdk-client.js +2 -2
  29. package/dist/emit/python/sdk-pyproject.js +4 -4
  30. package/dist/emit/python/sdk.d.ts +1 -1
  31. package/dist/emit/python/sdk.js +11 -11
  32. package/dist/emit/python/transport.js +1 -1
  33. package/dist/emit/rust/errors.js +2 -2
  34. package/dist/emit/rust/sdk-cargo.js +3 -3
  35. package/dist/emit/rust/sdk.d.ts +1 -1
  36. package/dist/emit/rust/sdk.js +2 -2
  37. package/dist/emit/shared/format.d.ts +1 -1
  38. package/dist/emit/shared/metadata.d.ts +1 -1
  39. package/dist/emit/shared/status-keys.d.ts +1 -1
  40. package/dist/emit/shared/status-keys.js +1 -1
  41. package/dist/emit/ts/app-client.js +2 -2
  42. package/dist/emit/ts/route-tree.d.ts +1 -1
  43. package/dist/emit/ts/route-tree.js +1 -12
  44. package/dist/emit/ts/sdk-types-preamble.js +16 -16
  45. package/dist/emit/ts/sdk-types.js +6 -6
  46. package/dist/emit/ts/tanstack-query.js +5 -5
  47. package/dist/emit/ts/type-gen.d.ts +4 -3
  48. package/dist/emit/ts/type-gen.js +86 -45
  49. package/dist/extract/chain.d.ts +10 -6
  50. package/dist/extract/chain.js +5 -19
  51. package/dist/extract/extract.d.ts +2 -2
  52. package/dist/extract/extract.js +40 -26
  53. package/dist/extract/serialize.js +1 -1
  54. package/dist/extract/walk.d.ts +15 -4
  55. package/dist/extract/walk.js +159 -15
  56. package/dist/gen/args.js +3 -3
  57. package/dist/gen/formatters.d.ts +6 -6
  58. package/dist/gen/formatters.js +7 -7
  59. package/dist/gen/process.d.ts +3 -3
  60. package/dist/gen/process.js +7 -7
  61. package/dist/gen/targets.d.ts +3 -3
  62. package/dist/gen/targets.js +3 -3
  63. package/dist/gen/write.d.ts +1 -1
  64. package/dist/gen/write.js +1 -1
  65. package/dist/index.d.ts +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/ir/load.js +10 -10
  68. package/dist/ir/model.d.ts +6 -4
  69. package/dist/ir/sdk-model.d.ts +1 -1
  70. package/dist/ir/sdk-model.js +1 -1
  71. package/dist/ir/slots.d.ts +3 -3
  72. package/dist/ir/slots.js +12 -10
  73. package/dist/release/bootstrap.js +1 -1
  74. package/dist/release/bump-command.js +1 -1
  75. package/dist/release/cli.d.ts +4 -4
  76. package/dist/release/cli.js +6 -6
  77. package/dist/release/context.d.ts +1 -1
  78. package/dist/release/context.js +1 -1
  79. package/dist/release/digest.d.ts +1 -1
  80. package/dist/release/digest.js +2 -2
  81. package/dist/release/index.d.ts +1 -1
  82. package/dist/release/load.js +1 -1
  83. package/dist/release/manifest.js +1 -1
  84. package/dist/release/registries.js +3 -3
  85. package/dist/release/release-workflow.js +1 -1
  86. package/dist/release/spec-gate.d.ts +2 -2
  87. package/dist/release/spec-gate.js +2 -2
  88. package/dist/release/sync-command.d.ts +1 -1
  89. package/dist/release/sync-command.js +1 -1
  90. package/dist/release/sync-tree.js +1 -1
  91. package/dist/release/types.d.ts +6 -6
  92. package/dist/runtime/cli/body.go +1 -1
  93. package/dist/runtime/cli/config.go +3 -3
  94. package/dist/runtime/cli/discovery.go +1 -1
  95. package/dist/runtime/cli/format.go +1 -1
  96. package/dist/runtime/cli/log.go +1 -1
  97. package/dist/runtime/cli/output.go +1 -1
  98. package/dist/runtime/cli/params.go +1 -1
  99. package/dist/runtime/cli/run.go +1 -1
  100. package/dist/runtime/cli/socket.go +1 -1
  101. package/dist/runtime/cli/stream.go +1 -1
  102. package/dist/runtime/cli/target.go +1 -1
  103. package/dist/runtime/csharp/Adapters.cs +2 -2
  104. package/dist/runtime/csharp/Auth.cs +2 -2
  105. package/dist/runtime/csharp/Body.cs +3 -3
  106. package/dist/runtime/csharp/Config.cs +2 -2
  107. package/dist/runtime/csharp/Envelope.cs +3 -3
  108. package/dist/runtime/csharp/Errors.cs +10 -10
  109. package/dist/runtime/csharp/Events.cs +2 -2
  110. package/dist/runtime/csharp/Exchange.cs +4 -4
  111. package/dist/runtime/csharp/Handler.cs +3 -3
  112. package/dist/runtime/csharp/Hooks.cs +3 -3
  113. package/dist/runtime/csharp/Invalidation.cs +2 -2
  114. package/dist/runtime/csharp/Json.cs +2 -2
  115. package/dist/runtime/csharp/Log.cs +2 -2
  116. package/dist/runtime/csharp/Operation.cs +2 -2
  117. package/dist/runtime/csharp/Path.cs +2 -2
  118. package/dist/runtime/csharp/Query.cs +2 -2
  119. package/dist/runtime/csharp/Realtime.cs +2 -2
  120. package/dist/runtime/csharp/RealtimeLoop.cs +3 -3
  121. package/dist/runtime/csharp/Redirect.cs +2 -2
  122. package/dist/runtime/csharp/Result.cs +2 -2
  123. package/dist/runtime/csharp/Sse.cs +2 -2
  124. package/dist/runtime/csharp/Stale.cs +2 -2
  125. package/dist/runtime/csharp/Transport.cs +2 -2
  126. package/dist/runtime/csharp/TransportLongPoll.cs +2 -2
  127. package/dist/runtime/csharp/TransportSse.cs +2 -2
  128. package/dist/runtime/csharp/TransportWs.cs +2 -2
  129. package/dist/runtime/csharp/Wire.cs +2 -2
  130. package/dist/runtime/csharp/Ws.cs +2 -2
  131. package/dist/runtime/csharp/WsDial.cs +2 -2
  132. package/dist/runtime/go/auth.go +1 -1
  133. package/dist/runtime/go/body.go +2 -2
  134. package/dist/runtime/go/config.go +1 -1
  135. package/dist/runtime/go/errors.go +5 -5
  136. package/dist/runtime/go/export.go +10 -10
  137. package/dist/runtime/go/hooks.go +2 -2
  138. package/dist/runtime/go/invalidation.go +2 -2
  139. package/dist/runtime/go/log.go +1 -1
  140. package/dist/runtime/go/nullable.go +1 -1
  141. package/dist/runtime/go/options.go +1 -1
  142. package/dist/runtime/go/path.go +1 -1
  143. package/dist/runtime/go/query.go +2 -2
  144. package/dist/runtime/go/realtime.go +4 -4
  145. package/dist/runtime/go/realtime_loop.go +1 -1
  146. package/dist/runtime/go/redirect.go +2 -2
  147. package/dist/runtime/go/request.go +9 -9
  148. package/dist/runtime/go/result.go +2 -2
  149. package/dist/runtime/go/sse.go +3 -3
  150. package/dist/runtime/go/stale.go +1 -1
  151. package/dist/runtime/go/stream.go +2 -2
  152. package/dist/runtime/go/transport.go +2 -2
  153. package/dist/runtime/go/transport_longpoll.go +1 -1
  154. package/dist/runtime/go/transport_sse.go +2 -2
  155. package/dist/runtime/go/ws.go +1 -1
  156. package/dist/runtime/java/Answer.java +2 -2
  157. package/dist/runtime/java/ApiException.java +2 -2
  158. package/dist/runtime/java/BinaryBody.java +2 -2
  159. package/dist/runtime/java/Body.java +4 -4
  160. package/dist/runtime/java/Call.java +2 -2
  161. package/dist/runtime/java/CallLog.java +2 -2
  162. package/dist/runtime/java/ClientConfig.java +2 -2
  163. package/dist/runtime/java/ConnectionState.java +2 -2
  164. package/dist/runtime/java/Credential.java +2 -2
  165. package/dist/runtime/java/Deadline.java +2 -2
  166. package/dist/runtime/java/Decode.java +2 -2
  167. package/dist/runtime/java/Envelope.java +2 -2
  168. package/dist/runtime/java/ErrorEnvelope.java +3 -3
  169. package/dist/runtime/java/EventStream.java +2 -2
  170. package/dist/runtime/java/Exchange.java +2 -2
  171. package/dist/runtime/java/FilePart.java +2 -2
  172. package/dist/runtime/java/Flight.java +3 -3
  173. package/dist/runtime/java/Hooks.java +3 -3
  174. package/dist/runtime/java/Hops.java +2 -2
  175. package/dist/runtime/java/{HoneyException.java → HttpException.java} +4 -4
  176. package/dist/runtime/java/InvalidationConfig.java +2 -2
  177. package/dist/runtime/java/Json.java +3 -3
  178. package/dist/runtime/java/Keepalive.java +2 -2
  179. package/dist/runtime/java/LogEntry.java +2 -2
  180. package/dist/runtime/java/LongPollAdapter.java +2 -2
  181. package/dist/runtime/java/Operation.java +2 -2
  182. package/dist/runtime/java/Opt.java +2 -2
  183. package/dist/runtime/java/Pump.java +2 -2
  184. package/dist/runtime/java/RawResponse.java +2 -2
  185. package/dist/runtime/java/Realtime.java +2 -2
  186. package/dist/runtime/java/RealtimeLoop.java +4 -4
  187. package/dist/runtime/java/RedirectPolicy.java +2 -2
  188. package/dist/runtime/java/Redirects.java +2 -2
  189. package/dist/runtime/java/RequestContext.java +2 -2
  190. package/dist/runtime/java/RequestHook.java +2 -2
  191. package/dist/runtime/java/RequestOptions.java +2 -2
  192. package/dist/runtime/java/ResponseContext.java +2 -2
  193. package/dist/runtime/java/ResponseHook.java +2 -2
  194. package/dist/runtime/java/Result.java +2 -2
  195. package/dist/runtime/java/ResumableConnection.java +2 -2
  196. package/dist/runtime/java/SdkException.java +3 -3
  197. package/dist/runtime/java/Socket.java +2 -2
  198. package/dist/runtime/java/Sse.java +2 -2
  199. package/dist/runtime/java/SseAdapter.java +2 -2
  200. package/dist/runtime/java/SseEvent.java +2 -2
  201. package/dist/runtime/java/StaleMeta.java +2 -2
  202. package/dist/runtime/java/StaleTracker.java +2 -2
  203. package/dist/runtime/java/Transport.java +2 -2
  204. package/dist/runtime/java/TransportAdapter.java +2 -2
  205. package/dist/runtime/java/TransportConnection.java +2 -2
  206. package/dist/runtime/java/TransportKind.java +2 -2
  207. package/dist/runtime/java/TransportMessage.java +2 -2
  208. package/dist/runtime/java/TransportOptions.java +2 -2
  209. package/dist/runtime/java/TypedWebSocket.java +2 -2
  210. package/dist/runtime/java/UrlPath.java +2 -2
  211. package/dist/runtime/java/UrlQuery.java +2 -2
  212. package/dist/runtime/java/WsAdapter.java +2 -2
  213. package/dist/runtime/java/WsClose.java +2 -2
  214. package/dist/runtime/java/WsDial.java +2 -2
  215. package/dist/runtime/java/WsMessage.java +2 -2
  216. package/dist/runtime/mcp/call.ts +3 -3
  217. package/dist/runtime/mcp/result.ts +2 -2
  218. package/dist/runtime/python/__init__.py +1 -1
  219. package/dist/runtime/python/auth.py +1 -1
  220. package/dist/runtime/python/body.py +1 -1
  221. package/dist/runtime/python/config.py +1 -1
  222. package/dist/runtime/python/errors.py +11 -11
  223. package/dist/runtime/python/events.py +4 -4
  224. package/dist/runtime/python/exchange.py +1 -1
  225. package/dist/runtime/python/hooks.py +4 -4
  226. package/dist/runtime/python/invalidation.py +1 -1
  227. package/dist/runtime/python/log.py +1 -1
  228. package/dist/runtime/python/operation.py +1 -1
  229. package/dist/runtime/python/path.py +1 -1
  230. package/dist/runtime/python/query.py +1 -1
  231. package/dist/runtime/python/realtime.py +5 -5
  232. package/dist/runtime/python/redirect.py +1 -1
  233. package/dist/runtime/python/result.py +1 -1
  234. package/dist/runtime/python/send_async.py +4 -4
  235. package/dist/runtime/python/send_sync.py +3 -3
  236. package/dist/runtime/python/sse.py +1 -1
  237. package/dist/runtime/python/stale.py +1 -1
  238. package/dist/runtime/python/transport.py +1 -1
  239. package/dist/runtime/python/transport_longpoll.py +1 -1
  240. package/dist/runtime/python/transport_sse.py +1 -1
  241. package/dist/runtime/python/transport_ws.py +1 -1
  242. package/dist/runtime/python/ws.py +3 -3
  243. package/dist/runtime/rust/Cargo.lock +1 -1
  244. package/dist/runtime/rust/answer.rs +1 -1
  245. package/dist/runtime/rust/auth.rs +1 -1
  246. package/dist/runtime/rust/body.rs +2 -2
  247. package/dist/runtime/rust/call.rs +1 -1
  248. package/dist/runtime/rust/config.rs +1 -1
  249. package/dist/runtime/rust/envelope.rs +3 -3
  250. package/dist/runtime/rust/errors.rs +3 -3
  251. package/dist/runtime/rust/events.rs +1 -1
  252. package/dist/runtime/rust/exchange.rs +1 -1
  253. package/dist/runtime/rust/hooks.rs +1 -1
  254. package/dist/runtime/rust/invalidation.rs +1 -1
  255. package/dist/runtime/rust/log.rs +1 -1
  256. package/dist/runtime/rust/nullable.rs +1 -1
  257. package/dist/runtime/rust/path.rs +1 -1
  258. package/dist/runtime/rust/query.rs +1 -1
  259. package/dist/runtime/rust/realtime.rs +1 -1
  260. package/dist/runtime/rust/realtime_loop.rs +1 -1
  261. package/dist/runtime/rust/redirect.rs +1 -1
  262. package/dist/runtime/rust/request.rs +1 -1
  263. package/dist/runtime/rust/result.rs +1 -1
  264. package/dist/runtime/rust/sse.rs +1 -1
  265. package/dist/runtime/rust/stale.rs +1 -1
  266. package/dist/runtime/rust/transport.rs +1 -1
  267. package/dist/runtime/rust/transport_longpoll.rs +1 -1
  268. package/dist/runtime/rust/transport_sse.rs +1 -1
  269. package/dist/runtime/rust/transport_ws.rs +1 -1
  270. package/dist/runtime/rust/ws.rs +1 -1
  271. package/dist/runtime/ts/app-types.ts +5 -5
  272. package/dist/runtime/ts/app.ts +5 -5
  273. package/dist/runtime/ts/http.ts +3 -3
  274. package/dist/runtime/ts/path.ts +1 -1
  275. package/dist/runtime/ts/request.ts +1 -1
  276. package/dist/runtime/ts/sdk.ts +1 -1
  277. package/package.json +2 -29
@@ -1,13 +1,17 @@
1
1
  /**
2
2
  * The program an app is read from: its tsconfig, the exported app, and every route registration in
3
3
  * the program's own files. A registration is a `.handler()` call on a route builder, recognized by
4
- * the type-only `$ctx`, `$method` and `$path` it carries, whatever method or helper started it.
4
+ * the type-only `$ctx`, `$method` and `$path` it carries, whatever method or helper started it. Its
5
+ * path is the one its own app gives it; a `.route()` mount serves it under the mount's prefix, so its
6
+ * paths follow every chain of mounts that carries that app.
5
7
  */
6
8
  import { existsSync } from "node:fs";
7
9
  import { dirname, resolve } from "node:path";
8
10
  import { compareCodeUnits } from "../emit/shared/lang.js";
9
11
  /* the type-only members every route builder carries */
10
12
  const BUILDER_MEMBERS = ["$ctx", "$method", "$path"];
13
+ /* the type-only members every app carries */
14
+ const APP_MEMBERS = ["$ctx", "$env"];
11
15
  /**
12
16
  * The tsconfig that governs `fromPath`: the nearest one walking up, but never past the project root
13
17
  * (the nearest directory with a package.json); a stray tsconfig above it is not this project's.
@@ -45,12 +49,136 @@ export function loadEntry(tsMorph, options) {
45
49
  throw new Error(`Export "${options.exportName}" not found in ${options.entryPath}`);
46
50
  const checker = project.getTypeChecker().compilerObject;
47
51
  /* for `export default <expr>` the declaration is the expression itself */
48
- return { appType: checker.getTypeAtLocation(decl.compilerNode), checker, compiler: tsMorph.ts, project };
52
+ return {
53
+ appNode: decl.compilerNode,
54
+ appType: checker.getTypeAtLocation(decl.compilerNode),
55
+ checker,
56
+ compiler: tsMorph.ts,
57
+ project,
58
+ };
49
59
  }
50
60
  /** The string literal values among `type` (itself, or a union's members). */
51
61
  function literals(type) {
52
62
  return (type.isUnion() ? type.types : [type]).filter((t) => t.isStringLiteral()).map((t) => t.value);
53
63
  }
64
+ /** Core's `MergePath`: `"/"` gives the other side, anything else is joined as is (the router normalizes the result). */
65
+ const mergePath = (a, b) => (a === "/" ? b : b === "/" ? a : `${a}${b}`);
66
+ /** `file:line` of a node, as reports name a place. */
67
+ function placeOf(node) {
68
+ const file = node.getSourceFile();
69
+ return `${file.fileName}:${file.getLineAndCharacterOfPosition(node.getStart(file)).line + 1}`;
70
+ }
71
+ /** The single string literal `type` is, or null. */
72
+ function literalOf(type) {
73
+ const values = literals(type);
74
+ return values.length === 1 && !type.isUnion() ? values[0] : null;
75
+ }
76
+ /**
77
+ * The origin of each app expression. A handle (`use`, `basePath`, a route builder, `.handler()`, `.route()`) is its
78
+ * receiver's app; a variable, an import or an object's property is what it was bound to; anything else, `httpApp()` or
79
+ * a factory's call, makes its own app.
80
+ */
81
+ function appOrigins(entry) {
82
+ const { checker, compiler } = entry;
83
+ const memo = new Map();
84
+ const carries = (node) => checker.getTypeAtLocation(node).getProperty("$ctx") !== undefined;
85
+ const bound = (symbol, at) => {
86
+ if (symbol === undefined)
87
+ return at;
88
+ const target = symbol.flags & compiler.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
89
+ const decl = target.valueDeclaration;
90
+ if (decl !== undefined && compiler.isShorthandPropertyAssignment(decl))
91
+ return bound(checker.getShorthandAssignmentValueSymbol(decl), decl);
92
+ const init = decl !== undefined && (compiler.isVariableDeclaration(decl) || compiler.isPropertyAssignment(decl))
93
+ ? decl.initializer
94
+ : undefined;
95
+ return init === undefined ? target : origin(init);
96
+ };
97
+ const step = (expr) => {
98
+ if (compiler.isParenthesizedExpression(expr) ||
99
+ compiler.isAsExpression(expr) ||
100
+ compiler.isSatisfiesExpression(expr) ||
101
+ compiler.isNonNullExpression(expr))
102
+ return origin(expr.expression);
103
+ if (compiler.isIdentifier(expr))
104
+ return bound(checker.getSymbolAtLocation(expr), expr);
105
+ if (compiler.isPropertyAccessExpression(expr))
106
+ return bound(checker.getSymbolAtLocation(expr.name), expr);
107
+ const callee = compiler.isCallExpression(expr) ? expr.expression : undefined;
108
+ if (callee !== undefined &&
109
+ compiler.isPropertyAccessExpression(callee) &&
110
+ carries(callee.expression) &&
111
+ carries(expr))
112
+ return origin(callee.expression);
113
+ return expr;
114
+ };
115
+ const origin = (expr) => {
116
+ const known = memo.get(expr);
117
+ if (known !== undefined)
118
+ return known;
119
+ /* a binding that reads itself ends at the expression */
120
+ memo.set(expr, expr);
121
+ const found = step(expr);
122
+ memo.set(expr, found);
123
+ return found;
124
+ };
125
+ return origin;
126
+ }
127
+ /** The receiver's base path: its `HttpApp` type argument `TBasePath`, when that is one literal. */
128
+ function basePathOf(entry, app) {
129
+ const { checker, compiler } = entry;
130
+ /* a class's instance type is a reference to it: its type arguments are the app's */
131
+ const decl = app.getSymbol()?.declarations?.find((d) => compiler.isClassDeclaration(d));
132
+ const index = decl?.typeParameters?.findIndex((p) => p.name.text === "TBasePath") ?? -1;
133
+ const arg = index < 0 ? undefined : checker.getTypeArguments(app)[index];
134
+ return arg === undefined ? null : literalOf(arg);
135
+ }
136
+ /** The mount a call is, if it is `<app>.route(sub)` or `<app>.route(prefix, sub)`; a path no literal is said, never guessed. */
137
+ function mountOf(entry, call, origin, report) {
138
+ const { checker, compiler } = entry;
139
+ if (!compiler.isPropertyAccessExpression(call.expression) || call.expression.name.text !== "route")
140
+ return null;
141
+ const receiver = call.expression.expression;
142
+ const app = checker.getTypeAtLocation(receiver);
143
+ const sub = call.arguments.at(-1);
144
+ if (sub === undefined || call.arguments.length > 2 || APP_MEMBERS.some((m) => app.getProperty(m) === undefined))
145
+ return null;
146
+ /* core mounts nothing when the sub is the receiver's own app (`register.ts` `mount`): the groups that share one
147
+ app keep their own ids */
148
+ const [into, from] = [origin(receiver), origin(sub)];
149
+ if (into === from)
150
+ return null;
151
+ const base = basePathOf(entry, app);
152
+ const first = call.arguments[0];
153
+ const prefix = call.arguments.length === 1 ? "/" : literalOf(checker.getTypeAtLocation(first));
154
+ if (base === null || prefix === null) {
155
+ report(`${placeOf(call)}: the mount's path is not a literal type; the routes it mounts keep their own paths`);
156
+ return null;
157
+ }
158
+ return { prefix: mergePath(base, prefix), receiver: into, sub: from };
159
+ }
160
+ /**
161
+ * The prefixes an app is served under: `"/"` when no mount takes it as a sub, or when it is the export; else the
162
+ * mount's prefix under each of its receiver's. An app mounted only inside a cycle is served nowhere.
163
+ */
164
+ function servedPrefixes(mounts, exported) {
165
+ const bySub = new Map();
166
+ for (const mount of mounts)
167
+ bySub.set(mount.sub, [...(bySub.get(mount.sub) ?? []), mount]);
168
+ const visiting = new Set();
169
+ const prefixes = (node) => {
170
+ const edges = bySub.get(node) ?? [];
171
+ if (edges.length === 0)
172
+ return ["/"];
173
+ if (visiting.has(node))
174
+ return [];
175
+ visiting.add(node);
176
+ const out = edges.flatMap((m) => prefixes(m.receiver).map((outer) => mergePath(outer, m.prefix)));
177
+ visiting.delete(node);
178
+ return node === exported ? [...out, "/"] : out;
179
+ };
180
+ return prefixes;
181
+ }
54
182
  /** The registration a call is, if it is `<route builder>.handler(…)`. */
55
183
  function registrationOf(entry, call) {
56
184
  const { checker, compiler } = entry;
@@ -75,27 +203,35 @@ function registrationOf(entry, call) {
75
203
  const typed = paramsType
76
204
  ?.getProperties()
77
205
  .some((key) => !(checker.getTypeOfSymbol(key).flags & compiler.TypeFlags.String));
78
- const file = call.getSourceFile();
79
- const line = file.getLineAndCharacterOfPosition(call.getStart(file)).line + 1;
80
- const paths = literals(path);
81
206
  return {
82
- at: `${file.fileName}:${line}`,
207
+ at: placeOf(call),
208
+ builder: receiver,
83
209
  ctx: ctx,
84
210
  input: input ? checker.getTypeOfSymbol(input) : null,
85
211
  params: typed === true ? paramsType : null,
86
212
  /* `.on()`'s methods are literals by its signature; a path is one only as a single literal */
87
213
  methods: literals(method),
88
- path: paths.length === 1 && !path.isUnion() ? paths[0] : null,
214
+ path: literalOf(path),
89
215
  };
90
216
  }
91
- /** Every route the program's own files register (not declaration files, not packages), in file order then source order. */
92
- export function registrations(entry) {
93
- const { compiler } = entry;
94
- const out = [];
217
+ /**
218
+ * Every route the program's own files register (not declaration files, not packages), in file order then source order,
219
+ * at the paths the program's mounts serve it at. A mount whose path is no literal is said through `report`.
220
+ */
221
+ export function registrations(entry, report) {
222
+ const { appNode, compiler } = entry;
223
+ const origin = appOrigins(entry);
224
+ const found = [];
225
+ const mounts = [];
95
226
  const visit = (node) => {
96
- const found = compiler.isCallExpression(node) ? registrationOf(entry, node) : null;
97
- if (found !== null)
98
- out.push(found);
227
+ if (compiler.isCallExpression(node)) {
228
+ const registration = registrationOf(entry, node);
229
+ if (registration !== null)
230
+ found.push(registration);
231
+ const mount = registration === null ? mountOf(entry, node, origin, report) : null;
232
+ if (mount !== null)
233
+ mounts.push(mount);
234
+ }
99
235
  compiler.forEachChild(node, visit);
100
236
  };
101
237
  const files = entry.project
@@ -105,5 +241,13 @@ export function registrations(entry) {
105
241
  .sort((a, b) => compareCodeUnits(a.fileName, b.fileName));
106
242
  for (const file of files)
107
243
  visit(file);
108
- return out;
244
+ /* the export resolves as any binding of it does: through its name, or as the default export's expression */
245
+ const prefixes = servedPrefixes(mounts, origin(compiler.isVariableDeclaration(appNode) ? appNode.name : appNode));
246
+ return found.map(({ builder, path, ...registration }) => ({
247
+ ...registration,
248
+ own: path,
249
+ paths: path === null
250
+ ? null
251
+ : [...new Set(prefixes(origin(builder)).map((prefix) => mergePath(prefix, path)))].sort(compareCodeUnits),
252
+ }));
109
253
  }
package/dist/gen/args.js CHANGED
@@ -9,11 +9,11 @@ import { isListField, METADATA_FIELDS } from "../emit/shared/metadata.js";
9
9
  import { isBooleanOption, TARGET_OPTIONS, TARGETS } from "./targets.js";
10
10
  /** The usage text, the options listed by target. */
11
11
  export function usage() {
12
- return `usage: honey-clients generate (--spec <openapi.json> | --app <module>[#export]) --target <name>... --out <dir>
12
+ return `usage: clients generate (--spec <openapi.json> | --app <module>[#export]) --target <name>... --out <dir>
13
13
  [--watch] [options]
14
14
 
15
15
  --spec <file> the OpenAPI document (JSON) to generate from
16
- --app <module> a honey app module instead: its export (#name, else app, else default) is the app, and its
16
+ --app <module> a backend app module instead: its export (#name, else app, else default) is the app, and its
17
17
  openApi export, if any, the document's options (core's generateOpenApi); the module
18
18
  exports the app and serves nothing: one that calls serve() as it loads is outside --app
19
19
  --target <name> ${TARGETS.join(", ")}; repeat for more than one
@@ -34,7 +34,7 @@ ${Object.entries(TARGET_OPTIONS)
34
34
  .map(([target, options]) => ` ${target}: ${options.map((key) => `--${target}-${kebab(key)}`).join(" ")}`)
35
35
  .join("\n")}
36
36
 
37
- Each <out>/<target> keeps .honey-generated.json: the package it makes on each registry (registry, name, version),
37
+ Each <out>/<target> keeps .clients-generated.json: the package it makes on each registry (registry, name, version),
38
38
  and every file it wrote with its sha256. A regeneration deletes a file the last run wrote and this one does not,
39
39
  unless it was edited since: that one is kept and named on stderr.
40
40
  Nothing outside <out>/<target> is written or deleted, and no symlink is followed.
@@ -9,7 +9,7 @@ export declare function findGofmt(env?: NodeJS.ProcessEnv): string | undefined;
9
9
  /**
10
10
  * The pinned ruff, or none: `RUFF` names it, else PATH. A named path that is not there counts as none, so a
11
11
  * stale override is a skip with its own line rather than a spawn failure deep in the post-pass, which
12
- * `formatFiles` would raise as though honey had emitted unparseable Python.
12
+ * `formatFiles` would raise as though clients had emitted unparseable Python.
13
13
  */
14
14
  export declare function findRuff(env?: NodeJS.ProcessEnv): string | undefined;
15
15
  /**
@@ -24,10 +24,10 @@ export type FormatPass = {
24
24
  readonly extension: string;
25
25
  readonly install: string;
26
26
  /**
27
- * Say nothing when this one is absent. Only `ts`: oxfmt is honey's own choice of TS formatter and a
27
+ * Say nothing when this one is absent. Only `ts`: oxfmt is clients' own choice of TS formatter and a
28
28
  * declared optional peer, so a consumer is not expected to have it and "TS goes out as emitted" is the
29
29
  * documented rule (Q12, `blueprint/00-rules.md`). ruff, rustfmt and gofmt are the language's own standard
30
- * tools, which a developer of that language has — honey simply never called them, and silence there is
30
+ * tools, which a developer of that language has — clients simply never called them, and silence there is
31
31
  * what let unformatted Python ship.
32
32
  */
33
33
  readonly quiet?: true;
@@ -42,7 +42,7 @@ export type FormatPass = {
42
42
  export declare const FORMATTERS: Partial<Record<Target, FormatPass>>;
43
43
  /**
44
44
  * The formatter for `target`, or none when its binary is not there. Each factory is named here rather than
45
- * held in the table's rows: `honey/spawn-timeout` proves which exports reach a spawn by walking named calls
45
+ * held in the table's rows: `clients/spawn-timeout` proves which exports reach a spawn by walking named calls
46
46
  * (the repo lint plugin's `spawners.js`), and a closure in a table is opaque to that walk — which would leave a
47
47
  * test calling `generated()` free of the bound it needs, since the spawn is real either way.
48
48
  */
@@ -54,8 +54,8 @@ export declare function formatterFor(target: Target, where: {
54
54
  * A formatter that is not there: the files go out as emitted and the skip is named, so unformatted output is
55
55
  * never silent. A consumer generating a Python SDK should not need ruff to get valid Python.
56
56
  *
57
- * `HONEY_REQUIRE_FORMATTERS=1` makes it fail instead, for a pipeline that would rather stop than ship
58
- * unformatted code. Deliberately NOT `HONEY_REQUIRE_TOOLCHAINS`, which this repository's CI sets on six jobs
57
+ * `CLIENTS_REQUIRE_FORMATTERS=1` makes it fail instead, for a pipeline that would rather stop than ship
58
+ * unformatted code. Deliberately NOT `CLIENTS_REQUIRE_TOOLCHAINS`, which this repository's CI sets on six jobs
59
59
  * to mean "these TESTS need their toolchain, do not skip" — reading it here turned every incidental
60
60
  * generation in CI without oxfmt into a hard failure, which is how rc.10's release run died.
61
61
  */
@@ -21,7 +21,7 @@ import { rustfmtFormatter } from "../emit/shared/rustfmt.js";
21
21
  * The binary a caller named through an environment variable, checked here at the edge. An override that
22
22
  * points at nothing is a mistake in how the run was configured, so it is a named error: falling back to some
23
23
  * other binary would ignore an explicit instruction, and spawning it would surface inside the post-pass,
24
- * which raises a failure there as though honey had emitted source the formatter could not parse.
24
+ * which raises a failure there as though clients had emitted source the formatter could not parse.
25
25
  */
26
26
  function named(variable, path) {
27
27
  if (path === undefined || path === "")
@@ -57,7 +57,7 @@ export function findGofmt(env = process.env) {
57
57
  /**
58
58
  * The pinned ruff, or none: `RUFF` names it, else PATH. A named path that is not there counts as none, so a
59
59
  * stale override is a skip with its own line rather than a spawn failure deep in the post-pass, which
60
- * `formatFiles` would raise as though honey had emitted unparseable Python.
60
+ * `formatFiles` would raise as though clients had emitted unparseable Python.
61
61
  */
62
62
  export function findRuff(env = process.env) {
63
63
  return named("RUFF", env.RUFF) ?? onPath("ruff", env);
@@ -101,7 +101,7 @@ export const FORMATTERS = {
101
101
  };
102
102
  /**
103
103
  * The formatter for `target`, or none when its binary is not there. Each factory is named here rather than
104
- * held in the table's rows: `honey/spawn-timeout` proves which exports reach a spawn by walking named calls
104
+ * held in the table's rows: `clients/spawn-timeout` proves which exports reach a spawn by walking named calls
105
105
  * (the repo lint plugin's `spawners.js`), and a closure in a table is opaque to that walk — which would leave a
106
106
  * test calling `generated()` free of the bound it needs, since the spawn is real either way.
107
107
  */
@@ -131,16 +131,16 @@ export async function formatterFor(target, where) {
131
131
  * A formatter that is not there: the files go out as emitted and the skip is named, so unformatted output is
132
132
  * never silent. A consumer generating a Python SDK should not need ruff to get valid Python.
133
133
  *
134
- * `HONEY_REQUIRE_FORMATTERS=1` makes it fail instead, for a pipeline that would rather stop than ship
135
- * unformatted code. Deliberately NOT `HONEY_REQUIRE_TOOLCHAINS`, which this repository's CI sets on six jobs
134
+ * `CLIENTS_REQUIRE_FORMATTERS=1` makes it fail instead, for a pipeline that would rather stop than ship
135
+ * unformatted code. Deliberately NOT `CLIENTS_REQUIRE_TOOLCHAINS`, which this repository's CI sets on six jobs
136
136
  * to mean "these TESTS need their toolchain, do not skip" — reading it here turned every incidental
137
137
  * generation in CI without oxfmt into a hard failure, which is how rc.10's release run died.
138
138
  */
139
139
  export function missingFormatter(target, pass, env, report) {
140
140
  const said = `${pass.tool} was not found, so the ${target} output is not formatted (${pass.install})`;
141
141
  /* an explicit demand is honoured for every target, quiet or not: the caller asked to be stopped */
142
- if (env.HONEY_REQUIRE_FORMATTERS === "1")
142
+ if (env.CLIENTS_REQUIRE_FORMATTERS === "1")
143
143
  throw new Error(said);
144
144
  if (pass.quiet !== true)
145
- report(`honey-clients: ${said}\n`);
145
+ report(`clients: ${said}\n`);
146
146
  }
@@ -1,10 +1,10 @@
1
- /** argv that starts the package's `honey-clients` bin on the current runtime. */
1
+ /** argv that starts the package's `clients` bin on the current runtime. */
2
2
  export declare function cliInvocation(): [string, string];
3
3
  /** How a child ended, as a failure names it: its signal, else its exit code. */
4
4
  export declare const endOf: (code: number | null, signal: NodeJS.Signals | null) => string;
5
5
  /**
6
- * Runs `honey-clients <args>` in `cwd` with its output inherited, and resolves when it exits 0; any other end rejects
7
- * with how it ended. A Bun handoff is never repeated in the child, and the child is marked HONEY_CODEGEN_CHILD, over
6
+ * Runs `clients <args>` in `cwd` with its output inherited, and resolves when it exits 0; any other end rejects
7
+ * with how it ended. A Bun handoff is never repeated in the child, and the child is marked CLIENTS_CODEGEN_CHILD, over
8
8
  * any `env`, so it refuses `--watch`.
9
9
  */
10
10
  export declare function runCli(args: readonly string[], options: {
@@ -1,19 +1,19 @@
1
1
  /**
2
- * The generate CLI's child process (bit 17 phase h): watch mode runs each generation as a fresh `honey-clients`, so
2
+ * The generate CLI's child process (bit 17 phase h): watch mode runs each generation as a fresh `clients`, so
3
3
  * nothing one run loads outlives it. The child is the package's own bin on this runtime, which picks the entry as it
4
4
  * does for a user (Bun the TypeScript source, a checkout the source through jiti, an install the compiled one).
5
5
  */
6
6
  import { spawn } from "node:child_process";
7
7
  import { fileURLToPath } from "node:url";
8
- /** argv that starts the package's `honey-clients` bin on the current runtime. */
8
+ /** argv that starts the package's `clients` bin on the current runtime. */
9
9
  export function cliInvocation() {
10
- return [process.execPath, fileURLToPath(new URL("../../bin/honey-clients.js", import.meta.url))];
10
+ return [process.execPath, fileURLToPath(new URL("../../bin/clients.js", import.meta.url))];
11
11
  }
12
12
  /** How a child ended, as a failure names it: its signal, else its exit code. */
13
13
  export const endOf = (code, signal) => signal ?? `exit ${code}`;
14
14
  /**
15
- * Runs `honey-clients <args>` in `cwd` with its output inherited, and resolves when it exits 0; any other end rejects
16
- * with how it ended. A Bun handoff is never repeated in the child, and the child is marked HONEY_CODEGEN_CHILD, over
15
+ * Runs `clients <args>` in `cwd` with its output inherited, and resolves when it exits 0; any other end rejects
16
+ * with how it ended. A Bun handoff is never repeated in the child, and the child is marked CLIENTS_CODEGEN_CHILD, over
17
17
  * any `env`, so it refuses `--watch`.
18
18
  */
19
19
  export function runCli(args, options) {
@@ -21,7 +21,7 @@ export function runCli(args, options) {
21
21
  return new Promise((resolve, reject) => {
22
22
  const child = spawn(command, [bin, ...args], {
23
23
  cwd: options.cwd,
24
- env: { ...process.env, HONEY_NO_BUN_HANDOFF: "1", ...options.env, HONEY_CODEGEN_CHILD: "1" },
24
+ env: { ...process.env, CLIENTS_NO_BUN_HANDOFF: "1", ...options.env, CLIENTS_CODEGEN_CHILD: "1" },
25
25
  stdio: ["ignore", "inherit", "inherit"],
26
26
  });
27
27
  child.on("error", reject);
@@ -29,7 +29,7 @@ export function runCli(args, options) {
29
29
  if (code === 0)
30
30
  resolve();
31
31
  else
32
- reject(new Error(`honey-clients ${args[0] ?? ""} failed (${endOf(code, signal)})`));
32
+ reject(new Error(`clients ${args[0] ?? ""} failed (${endOf(code, signal)})`));
33
33
  });
34
34
  });
35
35
  }
@@ -1,8 +1,8 @@
1
1
  /**
2
- * The targets honey-clients generates and each target's options (plan 39 8.1): the table the CLI reads
2
+ * The targets clients generates and each target's options (plan 39 8.1): the table the CLI reads
3
3
  * `--<target>-<option>` from, and what a caller holding a run as data (a release manifest) checks it with, so a new
4
4
  * target or option reaches that caller with no change of its own. The schemas are Standard Schemas (v1), the kind
5
- * honey takes everywhere, so any validator that reads one checks a run before it reaches `generated`.
5
+ * clients takes everywhere, so any validator that reads one checks a run before it reaches `generated`.
6
6
  */
7
7
  import { type Metadata } from "../emit/shared/metadata.ts";
8
8
  /**
@@ -68,7 +68,7 @@ export type TargetOptionsSchema<T extends Target> = {
68
68
  /** The Standard Schema version. */
69
69
  readonly version: 1;
70
70
  /** Who made the schema. */
71
- readonly vendor: "honey-clients";
71
+ readonly vendor: "clients";
72
72
  /** Checks `value` as `T`'s options: its option names only, each a non-empty string, a switch true or false. */
73
73
  readonly validate: (value: unknown) => OptionsResult<T>;
74
74
  /** The types the schema reads and answers, for a caller to infer from; never set at runtime. */
@@ -1,8 +1,8 @@
1
1
  /**
2
- * The targets honey-clients generates and each target's options (plan 39 8.1): the table the CLI reads
2
+ * The targets clients generates and each target's options (plan 39 8.1): the table the CLI reads
3
3
  * `--<target>-<option>` from, and what a caller holding a run as data (a release manifest) checks it with, so a new
4
4
  * target or option reaches that caller with no change of its own. The schemas are Standard Schemas (v1), the kind
5
- * honey takes everywhere, so any validator that reads one checks a run before it reaches `generated`.
5
+ * clients takes everywhere, so any validator that reads one checks a run before it reaches `generated`.
6
6
  */
7
7
  import { authorName } from "../emit/shared/metadata.js";
8
8
  /**
@@ -111,7 +111,7 @@ function schemaOf(target) {
111
111
  const issues = given.flatMap(([key, option]) => issueOf(target, key, option) ?? []);
112
112
  return issues.length > 0 ? { issues } : { value: Object.fromEntries(given) };
113
113
  },
114
- vendor: "honey-clients",
114
+ vendor: "clients",
115
115
  version: 1,
116
116
  },
117
117
  };
@@ -3,7 +3,7 @@ import type { PackageIdentity } from "../emit/shared/metadata.ts";
3
3
  * The manifest a target's directory keeps: `files`, each file it wrote by its path with its sha256, and `packages`,
4
4
  * the package as each registry lists it (`registry`, `name`, `version`), when the writer names it.
5
5
  */
6
- export declare const MANIFEST = ".honey-generated.json";
6
+ export declare const MANIFEST = ".clients-generated.json";
7
7
  /** What a write did: the files rewritten, the stale ones deleted, and the edited stale ones kept. */
8
8
  export type Written = {
9
9
  /** each stale file removed, its path relative to the directory */
package/dist/gen/write.js CHANGED
@@ -14,7 +14,7 @@ import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
14
14
  * The manifest a target's directory keeps: `files`, each file it wrote by its path with its sha256, and `packages`,
15
15
  * the package as each registry lists it (`registry`, `name`, `version`), when the writer names it.
16
16
  */
17
- export const MANIFEST = ".honey-generated.json";
17
+ export const MANIFEST = ".clients-generated.json";
18
18
  const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
19
19
  /** Whether `path` is a symlink, a dangling one included. */
20
20
  function isLink(path) {
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `@workerstack/clients`'s module entry (bit 19 h2): what core's build plugin imports, dynamically, to write an
3
3
  * app's artifacts (the route tree, the types, each file only when it changed). The SDK, CLI and MCP server generators
4
- * stay behind the `honey-clients` bin. Bit 21 e: the MCP handler an app mounts is the plugin's `codegen.mcp` output.
4
+ * stay behind the `clients` bin. Bit 21 e: the MCP handler an app mounts is the plugin's `codegen.mcp` output.
5
5
  */
6
6
  export { type Metadata, METADATA_FIELDS, type MetadataField, type PackageIdentity, type Registry, } from "./emit/shared/metadata.ts";
7
7
  export { type ExtractedTypes, type ExtractOptions, extractTypes, loadTsMorph } from "./extract/extract.ts";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `@workerstack/clients`'s module entry (bit 19 h2): what core's build plugin imports, dynamically, to write an
3
3
  * app's artifacts (the route tree, the types, each file only when it changed). The SDK, CLI and MCP server generators
4
- * stay behind the `honey-clients` bin. Bit 21 e: the MCP handler an app mounts is the plugin's `codegen.mcp` output.
4
+ * stay behind the `clients` bin. Bit 21 e: the MCP handler an app mounts is the plugin's `codegen.mcp` output.
5
5
  */
6
6
  export { METADATA_FIELDS, } from "./emit/shared/metadata.js";
7
7
  export { extractTypes, loadTsMorph } from "./extract/extract.js";
package/dist/ir/load.js CHANGED
@@ -7,12 +7,12 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
7
7
  return path;
8
8
  };
9
9
  /**
10
- * `honey-clients generate --app <module>[#export]` (bit 19 h2, carry-in #1): the app module loaded and its OpenAPI
11
- * document generated by the app's own core, `@workerstack/backend/openapi`, resolved from the app as it would be at run
10
+ * `clients generate --app <module>[#export]` (bit 19 h2, carry-in #1): the app module loaded and its OpenAPI
11
+ * document generated by the app's own core, `@workerstack/backend/http/openapi`, resolved from the app as it would be at run
12
12
  * time, so gen imports no core itself (H2). The named export, else `app`, else `default`, is the app; the module's
13
13
  * `openApi` export, if any, is the document's options (core's GenerateOpenApiOptions), else a bare `info`. On Node
14
14
  * the module loads through jiti, a core checkout read from its source by alias; on Bun through Bun's own import, a
15
- * checkout read from its source by the honey-source condition, refused when this Bun resolves it elsewhere (bit 20).
15
+ * checkout read from its source by the backend-source condition, refused when this Bun resolves it elsewhere (bit 20).
16
16
  * With no core installed where the app resolves it, the refusal names it.
17
17
  */
18
18
  import { existsSync, readFileSync, realpathSync } from "node:fs";
@@ -35,11 +35,11 @@ function coreRoot(from) {
35
35
  return undefined;
36
36
  }
37
37
  }
38
- /** A package.json map's entries with a `honey-source` target: each keyed by `key(subpath)`, at that file under `root`. */
38
+ /** A package.json map's entries with a `backend-source` target: each keyed by `key(subpath)`, at that file under `root`. */
39
39
  function sourcesOf(root, map, key) {
40
40
  const out = {};
41
41
  for (const [subpath, target] of Object.entries(map)) {
42
- const source = typeof target === "object" ? target["honey-source"] : undefined;
42
+ const source = typeof target === "object" ? target["backend-source"] : undefined;
43
43
  if (source !== undefined)
44
44
  out[key(subpath)] = join(root, source);
45
45
  }
@@ -61,7 +61,7 @@ function appOf(mod, ref, name) {
61
61
  if (typeof app?.fetch === "function")
62
62
  return app;
63
63
  const which = name === undefined ? "no `app` or `default` export" : `no export ${JSON.stringify(name)}`;
64
- throw new Error(`--app ${ref}: ${which} that is a honey app (name one as <module>#<export>)`);
64
+ throw new Error(`--app ${ref}: ${which} that is a backend app (name one as <module>#<export>)`);
65
65
  }
66
66
  /* Node: jiti, its one module cache shared by the app and its document, so both see one core module (its GRAPH symbol) */
67
67
  async function jitiImporter(path, alias) {
@@ -72,7 +72,7 @@ async function jitiImporter(path, alias) {
72
72
  /*
73
73
  * Bun: its own import, never jiti, which there retries a module that threw through its Babel (evaluating it twice),
74
74
  * whose Error.prepareStackTrace hook then breaks Bun's captureStackTrace on a non-Error (Vite's follow-redirects), and
75
- * whose native mode ignores the aliases (bit 20). A checkout's aliases hold by the honey-source condition instead:
75
+ * whose native mode ignores the aliases (bit 20). A checkout's aliases hold by the backend-source condition instead:
76
76
  * each must resolve to its source, never to an unbuilt or stale dist/.
77
77
  */
78
78
  function bunImporter(bun, path, aliases, ref) {
@@ -86,7 +86,7 @@ function bunImporter(bun, path, aliases, ref) {
86
86
  /* unresolvable without the condition (a checkout has no dist/): refused below, as one resolved elsewhere */
87
87
  }
88
88
  if (resolved !== realpathSync(source))
89
- throw new Error(`--app ${ref}: ${specifier} is a checkout, read from its source only under the honey-source condition: start Bun with --conditions=honey-source`);
89
+ throw new Error(`--app ${ref}: ${specifier} is a checkout, read from its source only under the backend-source condition: start Bun with --conditions=backend-source`);
90
90
  }
91
91
  return (specifier) => import(__rewriteRelativeImportExtension(pathToFileURL(bun.resolveSync(specifier, from)).href));
92
92
  }
@@ -101,12 +101,12 @@ export async function loadAppDocument(ref, cwd) {
101
101
  throw new Error(`--app ${ref}: no ${CORE} is installed where ${relative(cwd, path)} resolves it`);
102
102
  const bun = globalThis.Bun;
103
103
  const aliases = sourceAliases(root);
104
- /* Bun resolves core's own imports under the honey-source condition, through core's package.json */
104
+ /* Bun resolves core's own imports under the backend-source condition, through core's package.json */
105
105
  const load = bun === undefined
106
106
  ? await jitiImporter(path, { ...aliases.exports, ...aliases.imports })
107
107
  : bunImporter(bun, path, aliases.exports, ref);
108
108
  const mod = await load(path);
109
109
  const app = appOf(mod, ref, name);
110
- const { generateOpenApi } = (await load(`${CORE}/openapi`));
110
+ const { generateOpenApi } = (await load(`${CORE}/http/openapi`));
111
111
  return generateOpenApi(app, mod.openApi ?? DEFAULT_OPTIONS);
112
112
  }
@@ -74,7 +74,7 @@ export type IRParam = {
74
74
  description?: string;
75
75
  /** a path param is always required */
76
76
  required?: boolean;
77
- /** a path param spanning segments (`x-honey-wildcard`) */
77
+ /** a path param spanning segments (`x-backend-wildcard`) */
78
78
  wildcard?: true;
79
79
  /** `schema.default`, as declared */
80
80
  default?: unknown;
@@ -119,12 +119,14 @@ export type IRResponse = {
119
119
  contentType: string;
120
120
  schema?: IRSchema;
121
121
  }[];
122
- /** a response a declared error produces (`x-honey-error`), never a declared output */
122
+ /** a response a declared error produces (`x-backend-error`), never a declared output */
123
123
  error?: true;
124
124
  };
125
125
  export type IROperationExtensions = {
126
+ /** the id the route declared, when the document renamed its operationId (`x-backend-declared-id`) */
127
+ declaredId?: string;
126
128
  deprecated?: true;
127
- /** every declared error key (`x-honey-errors`): its status, null when it has none, and its own schema */
129
+ /** every declared error key (`x-backend-errors`): its status, null when it has none, and its own schema */
128
130
  errors?: Record<string, {
129
131
  schema?: IRSchema;
130
132
  status: number | null;
@@ -133,7 +135,7 @@ export type IROperationExtensions = {
133
135
  invalidates?: string[];
134
136
  mcp?: true;
135
137
  realtime?: true;
136
- /** the honey route id the operation came from (`x-honey-route`): what extracted ctx types are keyed by */
138
+ /** the backend route id the operation came from (`x-backend-route`): what extracted ctx types are keyed by */
137
139
  route?: string;
138
140
  sse?: true;
139
141
  websocket?: true;
@@ -79,7 +79,7 @@ export declare function sseEventSchema(op: IROperation, resolve: (schema: IRSche
79
79
  export declare function sdkModel(ir: IR): SdkModel;
80
80
  /** The component schemas on a by-value cycle, direct or mutual: such a reference needs a pointer or a `Box`. */
81
81
  export declare function valueCycleSchemas(schemas: Record<string, IRSchema>): Set<string>;
82
- /** honey's error envelope (`success: false`, an `error_key` enum, one `status`): its keys and status, else `null`. */
82
+ /** backend's error envelope (`success: false`, an `error_key` enum, one `status`): its keys and status, else `null`. */
83
83
  export declare function irErrorEnvelope(schema: IRSchema, resolve: (schema: IRSchema) => IRSchema): {
84
84
  keys: string[];
85
85
  status: number;
@@ -185,7 +185,7 @@ function envelopeShape(envelope, field, resolve) {
185
185
  const item = list?.kind === "array" ? resolve(list.items) : undefined;
186
186
  return ["error_key", "message", "path"].every((name) => isString(field(item, name)));
187
187
  }
188
- /** honey's error envelope (`success: false`, an `error_key` enum, one `status`): its keys and status, else `null`. */
188
+ /** backend's error envelope (`success: false`, an `error_key` enum, one `status`): its keys and status, else `null`. */
189
189
  export function irErrorEnvelope(schema, resolve) {
190
190
  const field = (object, name) => {
191
191
  const found = object?.kind === "object" ? object.fields.find((f) => f.name === name) : undefined;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * One operation's slots in the IR: its parameters by where they travel, its request bodies in
3
- * preference order, its responses by status, and the honey extensions it carries (realtime, SSE,
3
+ * preference order, its responses by status, and the backend extensions it carries (realtime, SSE,
4
4
  * websocket, invalidation…), and for a Standard Webhooks event, its type and data. Component `$ref`s on
5
5
  * parameters, bodies, responses and an event's envelope are followed.
6
6
  */
@@ -31,10 +31,10 @@ export declare function responsesOf(op: Json, components: Components): {
31
31
  responses: Record<string, IRResponse>;
32
32
  sse: boolean;
33
33
  };
34
- /** The honey extensions: each only when it is literally `true`; invalidation targets as strings. */
34
+ /** The backend extensions: each only when it is literally `true`; invalidation targets as strings. */
35
35
  export declare function extensionsOf(op: Json, sse: boolean): IROperationExtensions;
36
36
  /**
37
- * The Standard Webhooks event the webhook `name` declares through `x-honey-webhook`, from its JSON
37
+ * The Standard Webhooks event the webhook `name` declares through `x-backend-webhook`, from its JSON
38
38
  * body's `{ type, timestamp, data }` envelope; none when unmarked. gen reads documents it did not
39
39
  * write: a marked webhook it could not verify into a typed event is refused, never emitted half.
40
40
  */