@telorun/http-server 0.9.0 → 0.10.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,34 @@
|
|
|
1
1
|
# @telorun/http-server
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ee8926f: Unify resource references on the `!ref` YAML tag. The object form `{ kind, name }`
|
|
8
|
+
and bare-string references are removed: the analyzer rejects them up front
|
|
9
|
+
(`INVALID_REFERENCE_FORM`) and `!ref <name>` / `!ref <Alias>.<name>` is the only
|
|
10
|
+
authored shape. `resolveRefSentinels` now resolves `!ref` sentinels across the
|
|
11
|
+
whole manifest tree (including step `invoke`s and refs nested in inline
|
|
12
|
+
definitions), so every consumer sees the uniform resolved shape. The
|
|
13
|
+
http-server mount slot is renamed `mounts[].type` → `mounts[].mount`, and the
|
|
14
|
+
mcp transports / clients read their Phase-5-injected ref instances directly.
|
|
15
|
+
|
|
16
|
+
Schema validation (analyzer and kernel) now drops the stale scalar `type` a ref
|
|
17
|
+
slot may still pin (older published modules encode references as `type: string`)
|
|
18
|
+
before running AJV, so a resolved reference object validates against a legacy
|
|
19
|
+
`x-telo-ref` slot. This keeps an app that consumes a not-yet-republished
|
|
20
|
+
dependency analyzable and bootable during the migration. Object-typed ref slots
|
|
21
|
+
that also accept an inline value (e.g. `inputType` / `outputType`) are left
|
|
22
|
+
untouched.
|
|
23
|
+
|
|
24
|
+
`Run.Sequence` reference slots are brought onto the same enforcement path: a
|
|
25
|
+
step `invoke` and a scope `targets` entry now require a `!ref` (the `targets`
|
|
26
|
+
slot gains an `x-telo-ref` constraint and the `with` scope's visibility extends
|
|
27
|
+
to `/targets`), so a bare-string ref at either is rejected with
|
|
28
|
+
`INVALID_REFERENCE_FORM` at `telo check` — uniform with `Telo.Application`
|
|
29
|
+
targets — instead of failing as an obscure runtime error. The controller reads
|
|
30
|
+
the resolved reference rather than a bare name.
|
|
31
|
+
|
|
3
32
|
## 0.9.0
|
|
4
33
|
|
|
5
34
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -24,16 +24,16 @@ Language- and framework-agnostic HTTP server for Telo. Declarative routes, schem
|
|
|
24
24
|
kind: Telo.Application
|
|
25
25
|
metadata: { name: hello-http, version: 1.0.0 }
|
|
26
26
|
imports:
|
|
27
|
-
Http:
|
|
28
|
-
JS:
|
|
29
|
-
targets: [Server]
|
|
27
|
+
Http: std/http-server@0.9.0
|
|
28
|
+
JS: std/javascript@0.4.1
|
|
29
|
+
targets: [ !ref Server ]
|
|
30
30
|
---
|
|
31
31
|
kind: Http.Server
|
|
32
32
|
metadata: { name: Server }
|
|
33
33
|
port: 8080
|
|
34
34
|
mounts:
|
|
35
35
|
- path: /api
|
|
36
|
-
|
|
36
|
+
mount: !ref Api
|
|
37
37
|
---
|
|
38
38
|
kind: Http.Api
|
|
39
39
|
metadata: { name: Api }
|
|
@@ -54,7 +54,7 @@ routes:
|
|
|
54
54
|
examples: [ "Ada" ]
|
|
55
55
|
inputs:
|
|
56
56
|
name: "${{ request.params.name }}"
|
|
57
|
-
handler:
|
|
57
|
+
handler: !ref Greet
|
|
58
58
|
returns:
|
|
59
59
|
- status: 200
|
|
60
60
|
content:
|
|
@@ -2,7 +2,7 @@ import { CatchEntry, ReturnEntry } from "@telorun/http-dispatch";
|
|
|
2
2
|
import { type Invocable, type KindRef, type ResourceContext, type ResourceInstance, type RuntimeResource } from "@telorun/sdk";
|
|
3
3
|
import { FastifyInstance } from "fastify";
|
|
4
4
|
/** A mounted Telo.Mount instance (Http.Api, Mcp.HttpEndpoint, …). The kernel injects the
|
|
5
|
-
* live instance into a mount's `
|
|
5
|
+
* live instance into a mount's `mount` slot (x-telo-ref "telo#Mount") — cross-module refs
|
|
6
6
|
* resolve to an imported library's exported mount — and every mountable exposes register(). */
|
|
7
7
|
interface Mountable {
|
|
8
8
|
register(app: FastifyInstance, prefix: string): void | Promise<void>;
|
|
@@ -40,7 +40,7 @@ type HttpServerResource = RuntimeResource & {
|
|
|
40
40
|
};
|
|
41
41
|
mounts?: Array<{
|
|
42
42
|
path?: string;
|
|
43
|
-
|
|
43
|
+
mount?: Mountable;
|
|
44
44
|
}>;
|
|
45
45
|
notFoundHandler?: {
|
|
46
46
|
invoke: KindRef<Invocable>;
|
|
@@ -119,9 +119,9 @@ class HttpServer {
|
|
|
119
119
|
// const resolveSchema = createSchemaResolver(this.ctx);
|
|
120
120
|
for (const mount of mounts) {
|
|
121
121
|
const prefix = mount.path || "";
|
|
122
|
-
// `mount.
|
|
122
|
+
// `mount.mount` is the live Telo.Mount instance injected by the kernel at Phase 5
|
|
123
123
|
// (x-telo-ref "telo#Mount") — a same-module or imported-library mount, uniformly.
|
|
124
|
-
const api = mount.
|
|
124
|
+
const api = mount.mount;
|
|
125
125
|
if (!api || typeof api.register !== "function") {
|
|
126
126
|
throw new Error(`Failed to mount at "${prefix}": mount target did not resolve to a Telo.Mount instance`);
|
|
127
127
|
}
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ import Fastify, { FastifyInstance } from "fastify";
|
|
|
20
20
|
import { fastifyReplySink } from "./fastify-reply-sink.js";
|
|
21
21
|
|
|
22
22
|
/** A mounted Telo.Mount instance (Http.Api, Mcp.HttpEndpoint, …). The kernel injects the
|
|
23
|
-
* live instance into a mount's `
|
|
23
|
+
* live instance into a mount's `mount` slot (x-telo-ref "telo#Mount") — cross-module refs
|
|
24
24
|
* resolve to an imported library's exported mount — and every mountable exposes register(). */
|
|
25
25
|
interface Mountable {
|
|
26
26
|
register(app: FastifyInstance, prefix: string): void | Promise<void>;
|
|
@@ -58,7 +58,7 @@ type HttpServerResource = RuntimeResource & {
|
|
|
58
58
|
path?: string;
|
|
59
59
|
// x-telo-ref "telo#Mount": Phase 5 replaces this slot with the live mounted
|
|
60
60
|
// instance (Http.Api, Mcp.HttpEndpoint, …), local or imported.
|
|
61
|
-
|
|
61
|
+
mount?: Mountable;
|
|
62
62
|
}>;
|
|
63
63
|
notFoundHandler?: {
|
|
64
64
|
invoke: KindRef<Invocable>;
|
|
@@ -201,9 +201,9 @@ class HttpServer implements ResourceInstance {
|
|
|
201
201
|
// const resolveSchema = createSchemaResolver(this.ctx);
|
|
202
202
|
for (const mount of mounts) {
|
|
203
203
|
const prefix = mount.path || "";
|
|
204
|
-
// `mount.
|
|
204
|
+
// `mount.mount` is the live Telo.Mount instance injected by the kernel at Phase 5
|
|
205
205
|
// (x-telo-ref "telo#Mount") — a same-module or imported-library mount, uniformly.
|
|
206
|
-
const api = mount.
|
|
206
|
+
const api = mount.mount;
|
|
207
207
|
if (!api || typeof api.register !== "function") {
|
|
208
208
|
throw new Error(
|
|
209
209
|
`Failed to mount at "${prefix}": mount target did not resolve to a Telo.Mount instance`,
|