@telorun/http-server 0.16.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @telorun/http-server
2
2
 
3
+ ## 0.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 942c176: Rename `ctx.resolveChildren` to `ctx.ensureKindRef`. The old name stays as a
8
+ deprecated delegate.
9
+
10
+ The method never resolved anything: it takes a nested slot value — an inline
11
+ `{ kind, …config }` definition, a `{ kind, name }` ref, or a `!ref` sentinel —
12
+ and produces a `KindRef`, registering the inline case as a manifest (under a
13
+ supplied or generated name) on the way. `ensure` carries that create-if-needed
14
+ side effect; `KindRef` is what comes back.
15
+
16
+ It also reads correctly next to `ctx.resolveRef`, which runs the other direction
17
+ — ref to live instance. Two `resolve*` methods on one interface returning
18
+ opposite categories was the ambiguity; this fixes it at the source rather than
19
+ lengthening the name of the method that was right.
20
+
21
+ ### Patch Changes
22
+
23
+ - @telorun/http-dispatch@0.4.1
24
+
3
25
  ## 0.16.1
4
26
 
5
27
  ### Patch Changes
@@ -204,7 +204,7 @@ export async function create(resource, ctx) {
204
204
  if (!h)
205
205
  continue;
206
206
  if (typeof h === "object") {
207
- handlerRefs.set(route, ctx.resolveChildren(h));
207
+ handlerRefs.set(route, ctx.ensureKindRef(h));
208
208
  }
209
209
  else if (typeof h === "string") {
210
210
  // String form (schema oneOf: string | object) — only the resource name
@@ -285,7 +285,7 @@ export async function create(resource, ctx) {
285
285
  let kind = "";
286
286
  let name = "";
287
287
  if (typeof invoke === "object" && invoke !== null) {
288
- const resolved = ctx.resolveChildren(invoke);
288
+ const resolved = ctx.ensureKindRef(invoke);
289
289
  kind = resolved.kind;
290
290
  name = resolved.name;
291
291
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/http-server",
3
- "version": "0.16.1",
3
+ "version": "0.17.0",
4
4
  "description": "Telo HTTP Server module - HTTP server and API resource kinds for Telo manifests.",
5
5
  "keywords": [
6
6
  "telo",
@@ -55,7 +55,7 @@
55
55
  "@types/node": "^20.0.0",
56
56
  "typescript": "^5.0.0",
57
57
  "vitest": "^2.1.8",
58
- "@telorun/sdk": "0.50.0"
58
+ "@telorun/sdk": "0.54.0"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@telorun/sdk": "*"
@@ -266,7 +266,7 @@ export async function create(resource: any, ctx: ResourceContext): Promise<HttpS
266
266
  const h = route.handler;
267
267
  if (!h) continue;
268
268
  if (typeof h === "object") {
269
- handlerRefs.set(route, ctx.resolveChildren(h));
269
+ handlerRefs.set(route, ctx.ensureKindRef(h));
270
270
  } else if (typeof h === "string") {
271
271
  // String form (schema oneOf: string | object) — only the resource name
272
272
  // is given, not the kind. Phase 5 injects the live instance either way;
@@ -399,7 +399,7 @@ export async function create(
399
399
  let kind = "";
400
400
  let name = "";
401
401
  if (typeof invoke === "object" && invoke !== null) {
402
- const resolved = ctx.resolveChildren(invoke);
402
+ const resolved = ctx.ensureKindRef(invoke);
403
403
  kind = resolved.kind;
404
404
  name = resolved.name;
405
405
  } else if (typeof invoke === "string") {
@@ -81,7 +81,7 @@ describe("Http.Server boots with request logging enabled", () => {
81
81
  return {
82
82
  log,
83
83
  args: { _: [] },
84
- resolveChildren: () => ({ kind: "Http.Api", name: "x" }),
84
+ ensureKindRef: () => ({ kind: "Http.Api", name: "x" }),
85
85
  moduleContext: { expandWith: (value: unknown) => value },
86
86
  validateSchema: () => {},
87
87
  } as never;
@@ -42,7 +42,7 @@ describe("http-server request cancellation", () => {
42
42
  // Minimal ResourceContext: just the surface the controller touches.
43
43
  const ctx = {
44
44
  validateSchema: () => {},
45
- resolveChildren: () => ({ kind: "Test.Handler", name: "SlowWork" }),
45
+ ensureKindRef: () => ({ kind: "Test.Handler", name: "SlowWork" }),
46
46
  moduleContext: { expandWith: (value: unknown) => value },
47
47
  createCancellationSource: () => createCancellationSource(),
48
48
  invokeResolved: (_kind: string, _name: string, h: typeof handler, input: unknown, c: unknown) =>
@@ -28,7 +28,7 @@ describe("http-server request span", () => {
28
28
 
29
29
  const ctx = {
30
30
  validateSchema: () => {},
31
- resolveChildren: () => ({ kind: "JS.Script", name: "Echo" }),
31
+ ensureKindRef: () => ({ kind: "JS.Script", name: "Echo" }),
32
32
  moduleContext: { expandWith: (value: unknown) => value },
33
33
  createCancellationSource: () => createCancellationSource(),
34
34
  invokeResolved: (_kind: string, _name: string, h: typeof handler, input: unknown) =>