@owlmeans/server-entrypoint 0.1.18-rc.10 → 0.1.18-rc.11

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/README.md CHANGED
@@ -12,7 +12,7 @@ Elevates route definitions into runnable server entrypoints with attached reques
12
12
  ## Installation
13
13
 
14
14
  ```bash
15
- bun add @owlmeans/server-entrypoint
15
+ bun add @owlmeans/server-entrypoint@^0.1.18-rc.10
16
16
  ```
17
17
 
18
18
  ## Usage
@@ -76,7 +76,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
76
76
  your project's skill store (`.agents/skills/`):
77
77
 
78
78
  ```sh
79
- npx @owlmeans/agent-skills
79
+ npx @owlmeans/agent-skills@^0.1.18-rc.12
80
80
  ```
81
81
 
82
82
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/server-entrypoint",
4
- "version": "0.1.18-rc.10",
5
- "generatedAt": "2026-09-01T17:39:40.763Z",
4
+ "version": "0.1.18-rc.11",
5
+ "generatedAt": "2026-09-04T22:43:25.444Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: server-entrypoint
3
- description: How to use @owlmeans/server-entrypoint — server-side entrypoints extending @owlmeans/entrypoint with handler attachment, intermediates and mount(). Auto-invoked when importing server-entrypoint types.
3
+ description: How to use @owlmeans/server-entrypoint — server-side entrypoints extending @owlmeans/entrypoint with handler attachment, elevate() forms, intermediates, guards and mount(). Auto-invoked when importing server-entrypoint types or writing a custom entrypoint helper.
4
4
  user-invocable: false
5
5
  ---
6
6
  <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
@@ -8,32 +8,68 @@ user-invocable: false
8
8
  # @owlmeans/server-entrypoint
9
9
 
10
10
  **Layer:** Server
11
- **Install:** `"@owlmeans/server-entrypoint": "^0.1.18-rc.10"` in `dependencies`
11
+ **Install:** `"@owlmeans/server-entrypoint": "^0.1.18-rc.11"` in `dependencies`
12
12
 
13
13
  ## Key Exports
14
14
 
15
15
  | Export | Description |
16
16
  |--------|-------------|
17
- | `ServerEntrypoint<R>` | Server entrypoint interface — a `ServerRouteModel` plus a `handle` |
18
- | `entrypoint(arg, handler?, opts?)` | Build a server entrypoint from a route model or an existing declaration |
19
- | `elevate(entrypoints, alias, handler?, opts?)` | Attach a handler (or just guards) to a declared entrypoint |
20
- | `guard(alias, opts?)` | Require a guard, returning server entrypoint options |
21
- | `EntrypointOptions<R>` | Options for elevating: `handler`, `fixer`, `intermediate`, `routeOptions`, guards/gates/filter |
22
- | `EntrypointRef` / `RefedEntrypointHandler` | Handler reference pattern |
23
- | `FixerService` | Per-entrypoint error rendering (`handle(reply, error)`) |
17
+ | `ServerEntrypoint<R>` | Server entrypoint interface — a common entrypoint whose `route` is a `ServerRouteModel` plus `handle` and an optional `fixer` |
18
+ | `entrypoint(arg, handler?, opts?)` | Build one from an existing declaration, a server route model, or a plain route model |
19
+ | `elevate(entrypoints, alias, handler?, opts?)` | Replace the declaration under `alias` in-place with its elevated counterpart |
20
+ | `guard(alias, opts?)` | Options that require a guard, ready to pass as `opts` |
21
+ | `EntrypointOptions<R>` | `fixer`, `intermediate`, `routeOptions`, plus everything a common entrypoint declares. `elevate()` reads only `route`-shaping and access keys from it — `intermediate`, `routeOptions`, `filter`, `guards`, `gate`, `gateParams`, `fixer`; `handle` and `sticky` are silently ignored there |
22
+ | `EntrypointRef<R>` / `RefedEntrypointHandler<R>` | `(ref) => handler` — the wrapper is handed a ref that resolves to the entrypoint being built, which is how a handler reaches its own `ctx` |
23
+ | `FixerService` | Per-entrypoint error rendering (`handle(reply, error)`), named by `opts.fixer` and resolved as a service |
24
24
 
25
25
  ## Usage
26
26
 
27
- Most app code uses `elevate()` from `@owlmeans/server-app` (which builds on this package). Import directly only when implementing custom entrypoint helpers.
27
+ Most app code uses `elevate()` from `@owlmeans/server-app` (which re-exports this one). Import
28
+ directly only when implementing custom entrypoint helpers.
28
29
 
29
30
  ```typescript
31
+ import { elevate, guard } from '@owlmeans/server-entrypoint'
30
32
  import type { ServerEntrypoint } from '@owlmeans/server-entrypoint'
31
33
  ```
32
34
 
33
- Elevating is **idempotent** — elevating the same alias again simply replaces the element once more,
34
- and an intermediate stays intermediate unless the new call says otherwise. Guards passed at
35
- elevation are **unioned** with the ones the declaration already carries, so what the entrypoint
36
- declared still applies.
35
+ ### elevate forms
36
+
37
+ The third argument is overloaded, and all four forms are legal:
38
+
39
+ ```typescript
40
+ elevate(entrypoints, alias) // bare — make it a server entrypoint, nothing more
41
+ elevate(entrypoints, alias, handler) // attach a handler
42
+ elevate(entrypoints, alias, guard(DAUTH_GUARD)) // options only
43
+ elevate(entrypoints, alias, handler, true) // trailing boolean === { intermediate: true }
44
+ ```
45
+
46
+ `DAUTH_GUARD` above is `@owlmeans/server-auth`'s `DEFAULT_ALIAS` (`auth`), re-exported under that
47
+ name by `@owlmeans/server-app`.
48
+
49
+ It throws `SyntaxError` when no entrypoint in the list carries that alias, and it mutates the array
50
+ it is given — the elevated entrypoint replaces the element, and the same array is returned.
51
+
52
+ **A handler only ever arrives as the third argument.** `elevate` passes the options through
53
+ `entrypoint()`, which on an already-declared entrypoint applies `route`, `filter`, `guards`, `gate`,
54
+ `gateParams`, `intermediate` and `fixer` and nothing else — so `elevate(list, ALIAS, { handle: fn })`
55
+ type-checks, drops the function, and leaves an entrypoint the server never binds.
56
+
57
+ Elevating is **idempotent**: elevating the same alias again simply replaces the element once more.
58
+ An entrypoint stays intermediate unless the new call says otherwise, guards passed at elevation are
59
+ **unioned** with the ones the declaration already carries (so what the entrypoint declared still
60
+ applies), and a `fixer` already set survives a call that does not name one.
61
+
62
+ The **bare** form only converts the declaration into a server entrypoint — a `ServerRouteModel`
63
+ that `canServeModule` recognises. It creates no route group: an entrypoint with no `handle` is never
64
+ bound as a route, guarded or not, and `intermediate` defaults to what the declaration already was
65
+ (`false` for a common declaration), so a bare elevate does not put it in the intermediate chain
66
+ either. A live intermediate is `elevate(list, ALIAS, handleIntermediate(fn), true)` — a handler plus
67
+ `true`, with `handleIntermediate` from `@owlmeans/server-api`.
68
+
69
+ A parent alias that carries only a `guard()` for its children needs no elevation at all:
70
+ `getGuards()` walks `parent()`, which resolves the alias against the context, and a registered
71
+ declaration answers there whether or not it was elevated. `gate()` is not in this package — it comes
72
+ from `@owlmeans/entrypoint`, and only `guard()` is defined here.
37
73
 
38
74
  ## What a server registers
39
75
 
@@ -47,9 +83,14 @@ server.route({ url: entrypoint.mount(), method, handler })
47
83
  entrypoint.route.match(request, entrypoint.mount()) // intermediates test the same mount
48
84
  ```
49
85
 
86
+ Guards and gates are read with `getGuards()` / `getGates()`, which include everything the ancestors
87
+ declared, and they run before the handler — a handler that re-checks them duplicates an enforced
88
+ rule.
89
+
50
90
  ## Cross-Service URL Generation
51
91
 
52
- Use `makeSecurityHelper` from `@owlmeans/config` to build URLs pointing at other services (OAuth redirect URIs, webhook callbacks, etc.):
92
+ Use `makeSecurityHelper` from `@owlmeans/config` to build URLs pointing at other services (OAuth
93
+ redirect URIs, webhook callbacks, etc.):
53
94
 
54
95
  ```typescript
55
96
  import { makeSecurityHelper } from '@owlmeans/config'
@@ -59,4 +100,4 @@ const url = helper.makeUrl(entrypoint.address(), '/callback')
59
100
 
60
101
  ## Depends On
61
102
 
62
- - `@owlmeans/entrypoint`, `@owlmeans/server-route`, `@owlmeans/server-context`
103
+ - `@owlmeans/entrypoint`, `@owlmeans/server-route`, `@owlmeans/route`, `@owlmeans/context`
@@ -1 +1 @@
1
- {"version":3,"file":"entrypoint.d.ts","sourceRoot":"","sources":["../src/entrypoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAiB,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAG5G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,eAAO,MAAM,UAAU,GAAI,CAAC,EAC1B,KAAK,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,UAAU,EAAE,UAAU,sBAAsB,CAAC,CAAC,CAAC,EAAE,OAAO,iBAAiB,CAAC,CAAC,CAAC,KACzH,gBAAgB,CAAC,CAAC,CAmCpB,CAAA"}
1
+ {"version":3,"file":"entrypoint.d.ts","sourceRoot":"","sources":["../src/entrypoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAiB,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAG5G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,eAAO,MAAM,UAAU,GAAI,CAAC,OACrB,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,UAAU,YAAY,sBAAsB,CAAC,CAAC,CAAC,SAAS,iBAAiB,CAAC,CAAC,CAAC,KACzH,gBAAgB,CAAC,CAAC,CAmCpB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAG7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,EACvB,aAAa,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,EACvD,OAAO,MAAM,EACb,UAAU,sBAAsB,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,iBAAiB,CAAC,CAAC,CAAC,EACpE,OAAO,OAAO,GAAG,iBAAiB,CAAC,CAAC,CAAC,KACpC,gBAAgB,CAAC,CAAC,CAAC,EAmBrB,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,OAAO,MAAM,EAAE,OAAO,iBAAiB,CAAC,CAAC,CAAC,KAAG,iBAAiB,CAAC,CAAC,CACjD,CAAA"}
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAG7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,eACV,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,SAChD,MAAM,YACH,sBAAsB,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,iBAAiB,CAAC,CAAC,CAAC,SAC7D,OAAO,GAAG,iBAAiB,CAAC,CAAC,CAAC,KACpC,gBAAgB,CAAC,CAAC,CAAC,EAmBrB,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,MAAM,SAAS,iBAAiB,CAAC,CAAC,CAAC,KAAG,iBAAiB,CAAC,CAAC,CACjD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/server-entrypoint",
3
- "version": "0.1.18-rc.10",
3
+ "version": "0.1.18-rc.11",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -21,10 +21,10 @@
21
21
  }
22
22
  },
23
23
  "dependencies": {
24
- "@owlmeans/context": "^0.1.18-rc.7",
25
- "@owlmeans/entrypoint": "^0.1.18-rc.10",
26
- "@owlmeans/route": "^0.1.18-rc.8",
27
- "@owlmeans/server-route": "^0.1.18-rc.8"
24
+ "@owlmeans/context": "^0.1.18-rc.8",
25
+ "@owlmeans/entrypoint": "^0.1.18-rc.11",
26
+ "@owlmeans/route": "^0.1.18-rc.9",
27
+ "@owlmeans/server-route": "^0.1.18-rc.9"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@owlmeans/dep-config": "workspace:*",