@owlmeans/entrypoint 0.1.18-rc.13 → 0.1.18-rc.14

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
@@ -1,14 +1,13 @@
1
1
  # @owlmeans/entrypoint
2
2
 
3
- Entrypoint system — the URL unit abstraction shared between server and client in OwlMeans apps.
3
+ Entrypoint protocol system — the typed route contract shared between server and client in OwlMeans apps.
4
4
 
5
5
  ## Overview
6
6
 
7
- - An **entrypoint** is a URL unit: an alias + a route declaration + optional guards/gates/filters
8
- - On the server, entrypoints become API routes with attached handlers
9
- - On the client, entrypoints provide URL generation and navigation
10
- - All AJV validation schemas are defined at entrypoint level, keeping data contracts consistent fullstack
11
- - Most commonly used via re-exports in `@owlmeans/server-app` or `@owlmeans/client-entrypoint`
7
+ - A **protocol** is one immutable URL unit: an alias + route + typed contract + access options
8
+ - On the server and client, corresponding bindings add handlers, screens or calls to that protocol
9
+ - All AJV validation schemas live at protocol level, keeping data contracts consistent fullstack
10
+ - Most commonly used with `@owlmeans/server-entrypoint` and `@owlmeans/client-entrypoint`
12
11
 
13
12
  The route declaration an entrypoint carries is immutable: its `path` always stays the segment this
14
13
  entrypoint contributes under its parent. Addresses are computed on demand against the context the
@@ -23,64 +22,58 @@ bun add @owlmeans/entrypoint@^0.1.18-rc.10
23
22
 
24
23
  ## Usage
25
24
 
26
- Define an entrypoint with body validation and a guard:
25
+ Define a protocol with a typed request and guard:
27
26
 
28
27
  ```typescript
29
- import { entrypoint, guard, filter, body, params } from '@owlmeans/server-app'
28
+ import { contract, protocol, typed } from '@owlmeans/entrypoint'
30
29
  import { route } from '@owlmeans/route'
31
30
 
32
- const createStoryEntrypoint = entrypoint(
31
+ const createStoryProtocol = protocol(
33
32
  route('story-create', '/stories', { method: 'POST', parent: 'api' }),
34
- filter(body({
35
- type: 'object',
36
- properties: { story: { type: 'string' }, projectId: { type: 'string' } },
37
- required: ['story', 'projectId']
38
- }), guard('authenticated'))
33
+ contract.request({ body: typed<CreateStory>(CreateStorySchema) }, typed<Story>()),
34
+ { guards: ['authenticated'] },
39
35
  )
40
36
  ```
41
37
 
42
- Use `AbstractRequest` type in a handler:
38
+ Bind the protocol to a typed server handler:
43
39
 
44
40
  ```typescript
45
- import type { AbstractRequest } from '@owlmeans/entrypoint'
46
-
47
- export const create = handleBody(async (body, context, request) => {
48
- const req = request as AbstractRequest<{ id: string }>
49
- const projectId = req.params.id
50
- })
41
+ import { handlers } from '@owlmeans/server-api'
42
+ import { bind } from '@owlmeans/server-entrypoint'
43
+ import type { Context } from 'my-app-backend'
44
+
45
+ const api = handlers<Context>()
46
+ const create = api.params(createStoryProtocol, async ({ id }, context) =>
47
+ context.project().get(id))
48
+ export const entrypoints = [bind(createStoryProtocol, create)]
51
49
  ```
52
50
 
53
51
  ## API
54
52
 
55
- ### `entrypoint(route, opts?): CommonEntrypoint`
56
-
57
- Creates an entrypoint. `opts` is typically produced by `filter()`, `guard()`, or `gate()`.
58
-
59
- ### `guard(guard, opts?): CommonEntrypointOptions`
60
-
61
- Adds an authentication guard requirement.
53
+ ### `protocol(route, contract, options?): EntrypointProtocol`
62
54
 
63
- ### `gate(gate, params, opts?): CommonEntrypointOptions`
55
+ Creates an immutable typed protocol declaration.
64
56
 
65
- Adds an authorization gate with parameters.
57
+ ### `openProtocol(route, options?): EntrypointProtocol`
66
58
 
67
- ### `filter(filter, opts?): CommonEntrypointOptions`
59
+ Creates an intentionally untyped protocol, used only for framework escape hatches.
68
60
 
69
- Attaches validation schemas (AJV format) to the entrypoint.
61
+ ### `contract(...)`, `contract.request(...)`, `typed<T>(schema?)`
70
62
 
71
- ### `body(schema, filter?) / query(schema, filter?) / params(schema, filter?)`
63
+ Describe typed body, params, query, headers and response sections.
72
64
 
73
- Build a `Filter` object with the given AJV schema applied to the corresponding request part.
65
+ Access is declared directly in `EntrypointOptions` as `guards`, `gate` and `sticky`; runtime
66
+ behaviour is added by `bind()`/`bindAll()`/`bindScreen()` in the side-specific package.
74
67
 
75
68
  ### Parentship
76
69
 
77
70
  A child names its parent in the route declaration (`route('story-create', '/stories', { parent: 'api' })`).
78
- `path()` prefixes the parent's segments, and `getGuards()` / `getGates()` collect the parent's on
79
- every call — so a guard added to a parent later still applies.
71
+ `path()` prefixes the parent's segments, and inherited guards/gates are collected when a runtime
72
+ binds the protocol.
80
73
 
81
74
  ### `provideResponse<T>(): AbstractResponse<T>`
82
75
 
83
- Creates a response object for use in non-elevated handlers.
76
+ Creates a response object for use in unbound handlers.
84
77
 
85
78
  ### Transport
86
79
 
@@ -107,8 +100,8 @@ enum EntrypointOutcome { Ok, Accepted, Created, Finished }
107
100
 
108
101
  ## Related Packages
109
102
 
110
- - [`@owlmeans/route`](../route) — `route()` factory used in `entrypoint(route(...), ...)`
111
- - [`@owlmeans/server-entrypoint`](../server-entrypoint) — server-side `elevate()` to attach handlers
103
+ - [`@owlmeans/route`](../route) — `route()` factory used in `protocol(route(...), ... )`
104
+ - [`@owlmeans/server-entrypoint`](../server-entrypoint) — server-side `bind()`/`bindAll()` to attach handlers
112
105
  - [`@owlmeans/client-entrypoint`](../client-entrypoint) — client-side entrypoint with API call support
113
106
  - [`@owlmeans/server-app`](../server-app) — re-exports everything from this package
114
107
 
@@ -120,7 +113,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
120
113
  your project's skill store (`.agents/skills/`):
121
114
 
122
115
  ```sh
123
- npx @owlmeans/agent-skills@^0.1.18-rc.14
116
+ npx @owlmeans/agent-skills@^0.1.18-rc.15
124
117
  ```
125
118
 
126
119
  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/entrypoint",
4
- "version": "0.1.18-rc.13",
5
- "generatedAt": "2026-09-10T23:12:07.518Z",
4
+ "version": "0.1.18-rc.14",
5
+ "generatedAt": "2026-09-12T08:39:52.737Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: entrypoint
3
- description: How to use @owlmeans/entrypoint — immutable typed protocols, adapter references, legacy entrypoint declarations, guards/gates/schemas, address accessors, and the transport seam. Auto-invoked when importing from this package or defining a service entrypoint declaration.
3
+ description: How to declare immutable, typed @owlmeans/entrypoint protocols with protocol(), contract(), typed(), protocol trees, guards, gates, and route transports. Load before defining a shared API, socket, queue, or screen contract.
4
4
  user-invocable: false
5
5
  ---
6
6
  <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
@@ -8,220 +8,82 @@ user-invocable: false
8
8
  # @owlmeans/entrypoint
9
9
 
10
10
  **Layer:** Core
11
- **Install:** `"@owlmeans/entrypoint": "^0.1.18-rc.13"` in `dependencies`
12
-
13
- An entrypoint is an **addressable unit**. New code declares an immutable typed `protocol` once in a
14
- shared package, then binds that declaration on the client or server. The older mutable
15
- `entrypoint(...)` + `elevate(...)` form remains supported while applications migrate.
16
-
17
- ## Key Exports
18
-
19
- | Export | Description |
20
- |--------|-------------|
21
- | `protocol(route, contract, opts?)` / `openProtocol(route, opts?)` | Declare an immutable shared protocol |
22
- | `contract(...)` / `contract.request(...)` | Declare the request sections and response together |
23
- | `schema<T>(value)` / `typed<T>()` | Carry runtime validation plus type inference, or type information only |
24
- | `protocols(tree)` | Flatten a named protocol tree for a layer binding |
25
- | `entrypointRef<Request, Response>(alias)` | Typed adapter reference for dynamic registries |
26
- | `decorateEntrypoint(protocol, opts)` | Return an immutable protocol with added access/options |
27
- | `entrypoint(route, opts?)` | Declare an entrypoint on a route model |
28
- | `guard(alias, opts?)` | Require a guard; returns options, so it wraps rather than takes them |
29
- | `gate(alias, params, opts?)` | Require a gate; passed as the `opts` of `guard(...)` |
30
- | `filter(filter, opts?)` | Attach request validators |
31
- | `body(Schema)` / `params(Schema)` / `query(Schema)` / `headers(Schema)` / `response(Schema, code?)` | AJV validators composed into a `Filter` |
32
- | `CommonEntrypoint` | The entrypoint interface — declaration, guards/gates, address accessors |
33
- | `AbstractRequest` / `AbstractResponse` | The request and reply shapes every handler sees |
34
- | `ResolvedEntity` | `req.entity` — the organization entity's `{ id, slug, iamKey }` |
35
- | `provideResponse(original?)` | Build a reply object a handler resolves or rejects |
36
- | `EntrypointHandler` | What a handler implements: `(req, res) => value` |
37
- | `Filter` | The composed validator set: `{ body, params, query, headers, response }` |
38
- | `GuardService` / `GateService` | What a guard and a gate implement |
39
- | `EntrypointOutcome` | Enum: Ok, Accepted, Created, Finished |
40
- | `EntrypointTransport` | `{ protocol, handle }` — a carrier bound to a route protocol |
41
- | `transportAlias(protocol?)` | The service alias a transport registers under (`transport:<protocol>`) |
42
-
43
- ## Typed protocol form
44
-
45
- Application contracts export protocol objects, not alias strings or already context-bound
46
- entrypoints. A protocol owns the route, request/response contract, guards, gate and sticky flag; it
47
- is frozen and never mutated by either runtime.
48
-
49
- ```typescript
50
- import { contract, openProtocol, protocol, protocols, schema, typed } from '@owlmeans/entrypoint'
51
- import { frontend, route, RouteMethod } from '@owlmeans/route'
52
-
53
- const ItemParamsSchema = schema<{ id: string }>({
54
- type: 'object', properties: { id: { type: 'string' } }, required: ['id'], additionalProperties: false,
55
- })
56
-
57
- const apiBase = protocol(route('api:item', '/items'), contract())
58
- export const item = {
59
- base: apiBase,
60
- get: protocol(
61
- route('api:item:get', '/:id', { parent: apiBase, method: RouteMethod.GET }),
62
- contract.request({ params: ItemParamsSchema }, typed<Item>()),
63
- ),
64
- }
65
- export const web = {
66
- items: openProtocol(route('web:items', '/items', frontend())),
67
- }
68
- export const itemEntrypoints = protocols(item)
69
- ```
70
-
71
- `contract()` means no payload and an `undefined` reply. With one source it declares only the
72
- response; with two it declares body then response. Use `contract.request` when params, query,
73
- headers or several request sections participate. `schema<T>` is the preferred source when runtime
74
- validation exists; `typed<T>()` is only the compile-time half.
75
-
76
- `context.entrypoint(protocolOrRef)` infers the exact registered `call`/`invoke`/`url` signature.
77
- Use the protocol object inside an application. Use `entrypointRef` only in an adapter package that
78
- must address a dynamically registered surface without importing its declaration tree.
79
-
80
- `guard`, `gate` and `filter` are **options-object combinators, not variadic composers**. Each
81
- returns a `CommonEntrypointOptions` and takes the next one as its final argument, so they nest:
82
-
83
- ```typescript
84
- entrypoint(
85
- route(app.api.item.remove, '/:id', { parent: app.api.item, method: RouteMethod.DELETE }),
86
- guard(DEFAULT_GUARD, gate(OIDC_GATE, ['item--delete@id']))
87
- )
88
- ```
89
-
90
- Guards and gates are **inherited by child entrypoints** and enforced by the framework before a
91
- handler runs — a handler that re-checks them is duplicating an enforced rule, and is wrong even
92
- when it agrees.
93
-
94
- `sticky: true` in the options exempts a frontend entrypoint from the **service** filter the client
95
- router applies while building its entrypoint tree: without it, only entrypoints that name no service
96
- or name the context's own service are attached, so a route belonging to another service (an
97
- authentication dispatcher, say) needs it to reach the router at all. It changes nothing else — not
98
- the frontend-only restriction, not route matching — and defaults to `false`.
99
-
100
- ## Subpath Exports
101
-
102
- - `./utils` — entrypoint construction helpers (`isEntrypoint`, `CreateEntrypointSignature`)
103
-
104
- ## Declaration and model
105
-
106
- The `RouteDeclaration` an entrypoint carries is plain, immutable data: its `path` is the **segment**
107
- this entrypoint contributes under its parent, and nothing rewrites it. `RouteModel` only wraps that
108
- declaration. Every address question is therefore a question about the declaration asked **against
109
- the context that asks it** — computed on demand, never stored — so the same declaration answers one
110
- way in a server and another in a client without being touched.
111
-
112
- | Accessor | Answers |
113
- |----------|---------|
114
- | `segment()` | The segment declared under the parent |
115
- | `path()` | Every ancestor's segment, then this one |
116
- | `mount()` | `base` + `path()` — what a server registers and a client requests |
117
- | `service()` | The resolved service route this entrypoint answers on |
118
- | `address()` | `{ host, port, base, secure, protocol }` — where it actually answers |
119
- | `isLocal()` | Does it belong to the service the asking context IS? |
120
- | `parent()` | The parent entrypoint, or `null` |
121
- | `getGuards()` | Own guards plus every ancestor's, deduped |
122
- | `getGates()` | Own gate plus every ancestor's, as `[gate, params]` |
123
-
124
- `getGuards()` and `getGates()` walk the chain afresh on every call and are never memoised: a guard
125
- attached to an ancestor after this entrypoint was first asked still has to count.
126
-
127
- ## What a handler receives
128
11
 
129
- `AbstractRequest` carries `params`, `body`, `query`, `headers` and `path`, plus `auth` once a guard
130
- has run. `req.entity` is the organization entity resolved from `auth.entitySlug` **once**, at the
131
- server boundary: `entity.id` is the stable value to key records, grants and generated names by,
132
- `entity.slug` is the renameable name a person reads, and `entity.iamKey` is the frozen identifier
133
- external systems already know the organization under. It is absent when no resolver is registered,
134
- so read it defensively rather than assuming it.
12
+ An entrypoint protocol is the immutable shared contract for one addressable route. It owns the
13
+ route, typed request sections, response type, schemas, guards, gate, and sticky flag. Server and
14
+ client behaviour is added only by the corresponding binding package.
135
15
 
136
- `timeout` and `signal` on a request are forwarded to the transport, so a caller can bound or abort a
137
- single round trip.
16
+ ## Declare a named tree
138
17
 
139
- ## Calling an entrypoint
18
+ ```ts
19
+ import { contract, protocol, typed } from '@owlmeans/entrypoint'
20
+ import { backend, route, RouteMethod } from '@owlmeans/route'
140
21
 
141
- Three explicit verbs, so the caller says which answer it wants:
142
-
143
- ```typescript
144
- const project = await ep.call({ params: { id } }) // the VALUE; the reply error is thrown
145
- const { value, outcome } = await ep.invoke({ body }) // value AND outcome
146
- const href = await ep.url({ params: { id } }, { absolute: true }) // the URL string
22
+ export const projectEntrypoints = {
23
+ base: protocol(route('project', '/projects', backend()), contract(typed<void>())),
24
+ create: protocol(
25
+ route('project:create', '/', backend('project', RouteMethod.POST)),
26
+ contract.request({ body: typed<CreateProject>(CreateProjectSchema) }, typed<Project>()),
27
+ { guards: DEFAULT_GUARD }
28
+ ),
29
+ get: protocol(
30
+ route('project:get', '/:id', backend('project')),
31
+ contract.request({ params: typed<{ id: string }>() }, typed<Project>())
32
+ ),
33
+ }
147
34
  ```
148
35
 
149
- Use `invoke` only where the outcome decides what happens next; `call` covers everything else. An
150
- entrypoint that **renders a screen** is addressed by URL and never over the wire — it throws from
151
- `call()`/`invoke()` telling the caller to use `url()`.
152
-
153
- The three verbs sit on the callable entrypoint that `@owlmeans/client-entrypoint` produces; the
154
- declaration built here is what they address.
155
-
156
- ## Elevation
157
-
158
- `elevate` replaces the declaration in the entrypoint list with its elevated counterpart, so it is
159
- **idempotent**: elevating the same alias again simply replaces the element once more. Guards passed
160
- at elevation are **unioned** with the ones the entrypoint declared — elevating adds guards, it never
161
- swaps them. Server-side elevation lives in `@owlmeans/server-entrypoint`, client-side callability is
162
- an explicit opt-in through `@owlmeans/client-entrypoint`.
163
-
164
- ## Transport seam
165
-
166
- A route names the protocol it answers on, and a protocol may be carried by something other than
167
- HTTP. A service registered under `transportAlias(protocol)` implementing `EntrypointTransport` takes
168
- the call, so a consumer writes `ep.call(...)` and never learns whether that became an HTTP request,
169
- a socket message or a queued job. Bind nothing and the call goes over HTTP.
170
-
171
- ```typescript
172
- import { transportAlias } from '@owlmeans/entrypoint'
173
- import type { EntrypointTransport } from '@owlmeans/entrypoint'
174
- import { RouteProtocols } from '@owlmeans/route'
175
- import { createService } from '@owlmeans/context'
176
-
177
- const transport = createService<EntrypointTransport>(transportAlias(RouteProtocols.SOCKET), {
178
- protocol: RouteProtocols.SOCKET,
179
- handle: async (req, res) => { /* carry the call, resolve or reject res */ }
180
- }, service => async () => { service.initialized = true })
181
-
182
- context.registerService(transport)
36
+ - Export an object whose property names describe the contract. Its protocol values are the only
37
+ cross-layer references. Flatten it with `protocols(projectEntrypoints)` only at registration.
38
+ - Use `protocol(route, contract, options?)` for every typed boundary.
39
+ - `openProtocol(route, options?)` is an intentional untyped escape hatch; do not use it merely to
40
+ avoid declaring an input or output type.
41
+ - Use `decorateEntrypoint(protocol, options)` only when deriving an immutable decoration; never
42
+ mutate guards, gates, schemas, or a declaration collection.
43
+
44
+ ## Contract sources
45
+
46
+ | Source | Use |
47
+ |---|---|
48
+ | `typed<Model>(schema)` | A type paired with its AJV runtime validator. Prefer at declaration boundaries. |
49
+ | `typed<Model>()` | A type-only request section or response. |
50
+ | `schema<Model>(schema)` | A reusable named typed AJV schema. |
51
+ | `contract(body, response)` | A body-only contract. |
52
+ | `contract.request({ body, params, query, headers }, response)` | Independently typed request sections. |
53
+
54
+ Use `typed<Model>(schema)` rather than a bare `JSONSchemaType<Model>` when the model must remain
55
+ exact. A bare AJV generic can widen a protocol section to `OpenValue`.
56
+
57
+ `RequestOf<Protocol>`, `ResponseOf<Protocol>`, `BodyOf<Protocol>`, `ParamsOf<Protocol>`,
58
+ `QueryOf<Protocol>`, and `HeadersOf<Protocol>` derive the contract types. A handler receives
59
+ `HandlerRequest<RequestOf<Protocol>>`, which includes the transport metadata as well as the typed
60
+ sections. Use `entrypointRef<Request, Response>(alias)` only for a dynamic remote address whose
61
+ declaration is unavailable to import.
62
+
63
+ ## Authorization and addressing
64
+
65
+ Add `guards`, `gate`, and `sticky` directly in `EntrypointOptions`:
66
+
67
+ ```ts
68
+ protocol(route(...), contract(...), {
69
+ guards: [DEFAULT_GUARD, AUDIT_GUARD],
70
+ gate: { alias: PROJECT_GATE, params: ['project--read@id'] },
71
+ sticky: true,
72
+ })
183
73
  ```
184
74
 
185
- `@owlmeans/queue` is the worked example: `appendQueueTransport(context)` binds
186
- `RouteProtocols.QUEUE`, and a declaration built with `job()` instead of `backend()` is then carried
187
- as a broker job. Nothing at the call site changes — which is the point of putting the protocol on
188
- the route rather than at the call.
189
-
190
- ## Legacy declaration form
191
-
192
- Existing applications may define entrypoints in a shared `common` package, then `elevate()` them
193
- with handlers in server/web packages. Do not introduce this form into a protocol-based surface.
194
-
195
- ```typescript
196
- import { entrypoint, guard, gate, filter, body } from '@owlmeans/entrypoint'
197
- import { route, RouteMethod } from '@owlmeans/route'
198
- import { DEFAULT_GUARD } from '@owlmeans/auth-common'
199
- import { OIDC_GATE } from '@owlmeans/oidc'
200
- import { CreateProjectSchema } from './schemas.js'
201
-
202
- export const managerEntrypoints = [
203
- entrypoint(
204
- route(manager.back.account.base, '/account'),
205
- guard(DEFAULT_GUARD, gate(OIDC_GATE, [`my-service-account-{entity}`]))
206
- ),
207
- entrypoint(
208
- route(manager.back.project.create, '/create', {
209
- parent: manager.back.project.base,
210
- method: RouteMethod.POST,
211
- }),
212
- filter(body(CreateProjectSchema))
213
- ),
214
- ]
215
- ```
75
+ Guards and gates are inherited through the parent route by the bound runtime entrypoint. A route's
76
+ protocol chooses the carrier (HTTP, socket, or queue); callers only use `call`, `invoke`, or `url`
77
+ on the client-bound protocol and do not branch on a transport.
216
78
 
217
- ## Depends On
79
+ ## Bind, never replace
218
80
 
219
- - `@owlmeans/route` — `RouteModel`, `RouteAddress`, `RouteProtocols`, and the address helpers under `/utils`
220
- - `@owlmeans/context` — `appendContextual`, and the `BasicEntrypoint` / service shapes an entrypoint and its guards, gates and transports register as
221
- - `@owlmeans/auth` — `Auth`, the type behind `req.auth`
222
- - `ajv` — the JSON-schema types `body()` / `params()` / `query()` / `headers()` / `response()` are declared with
81
+ - Server: `bind(protocol, handlers<Context>().body|params|request(...))` from
82
+ `@owlmeans/server-entrypoint` / `@owlmeans/server-api`.
83
+ - Socket: `bind(protocol, connection(protocol, handler))`.
84
+ - Client API route: `bind(protocol)` or `bindAll(tree)` from `@owlmeans/client-entrypoint`.
85
+ - Client screen: `bindScreen(protocol, componentHandler)`.
223
86
 
224
- Guard and gate **aliases** are not declared here: an entrypoint names a guard by string, and the
225
- package that implements the guard owns the constant (`DEFAULT_GUARD` comes from
226
- `@owlmeans/auth-common`, `OIDC_GATE` from `@owlmeans/oidc`). That is what keeps this package free of
227
- any dependency on the auth stack.
87
+ Do not construct contextual compatibility entrypoints, look a protocol up by alias with a generic,
88
+ or replace an item in an entrypoint array. Import the declaration and bind that exact object. This
89
+ keeps declarations immutable and lets TypeScript infer requests and replies end to end.
package/build/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  export type * from './types.js';
2
- export * from './entrypoint.js';
3
- export * from './filter.js';
4
- export * from './helper.js';
5
2
  export * from './consts.js';
6
3
  export * from './protocol.js';
7
4
  export * from './materialize.js';
5
+ export { provideResponse } from './helper.js';
8
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}
package/build/index.js CHANGED
@@ -1,7 +1,5 @@
1
- export * from './entrypoint.js';
2
- export * from './filter.js';
3
- export * from './helper.js';
4
1
  export * from './consts.js';
5
2
  export * from './protocol.js';
6
3
  export * from './materialize.js';
4
+ export { provideResponse } from './helper.js';
7
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}
@@ -30,5 +30,5 @@ const optionsOf = (protocol) => ({
30
30
  * Make a local, mutable registration from a shared declaration. The protocol is never mutated;
31
31
  * guards, route resolution and handlers belong exclusively to this materialized entrypoint.
32
32
  */
33
- export const materializeEntrypoint = (protocol) => Object.assign(entrypoint(protocol.route, optionsOf(protocol)), { protocol });
33
+ export const materializeEntrypoint = (protocol) => Object.assign(entrypoint({ route: { ...protocol.route.route } }, optionsOf(protocol)), { protocol });
34
34
  //# sourceMappingURL=materialize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"materialize.js","sourceRoot":"","sources":["../src/materialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAS5C,MAAM,QAAQ,GAAG,CAAC,QAAuC,EAAsB,EAAE;IAC/E,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAA;IACjD,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAA;IAEnD,IAAI,OAAO,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI;QAAE,OAAO,SAAS,CAAA;IAEzD,OAAO;QACL,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC;QACvE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC;QAC7E,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC;QAC1E,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC;QAChF,QAAQ,EAAE,QAAQ,EAAE,QAAQ,IAAI,IAAI;YAClC,CAAC,CAAC,QAAQ,EAAE,OAAO,IAAI,IAAI,CA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C,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;oBAChF,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;iBAChC,CAAC,CAAC;aACN;KACF,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,QAAuC,EAA2B,EAAE,CAAC,CAAC;IACvF,MAAM,EAAE,QAAQ,CAAC,MAAM;IACvB,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC5B,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK;IAC1B,UAAU,EAAE,QAAQ,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;IACzE,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC;CAC3B,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,QAAkB,EACgB,EAAE,CAAC,MAAM,CAAC,MAAM,CAClD,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,EACvE,EAAE,QAAQ,EAAE,CACb,CAAA"}
@@ -4,6 +4,7 @@ import type { JSONSchemaType, AnySchemaObject } from 'ajv';
4
4
  import type { RouteModel } from '@owlmeans/route';
5
5
  import type { EntrypointOutcome } from './consts.js';
6
6
  import type { ResolvedEntity } from './types.js';
7
+ import type { AbstractRequest } from './types.js';
7
8
  /** A deliberately broad value used only by declarations without an I/O contract. */
8
9
  export type OpenValue = object | string | number | boolean | bigint | null | undefined;
9
10
  /** The request accepted by a declaration that intentionally supplies no contract. */
@@ -92,6 +93,11 @@ export interface EntrypointProtocolDeclaration {
92
93
  readonly params: readonly string[];
93
94
  };
94
95
  }
96
+ /** An access gate declared by a protocol, including inherited parent declarations. */
97
+ export interface EntrypointGate {
98
+ readonly alias: string;
99
+ readonly params: readonly string[];
100
+ }
95
101
  type SourceValue<Source> = Source extends Typed<infer Value> ? Value : Source extends EntrypointSchema<infer Value> ? Value : Source extends JSONSchemaType<infer Value> ? Value extends OpenValue ? Value : OpenValue : OpenValue;
96
102
  type RequestFromSources<Sources extends RequestSources> = (Sources extends {
97
103
  body: infer Source;
@@ -161,7 +167,13 @@ export interface EntrypointRequestMeta {
161
167
  canceled?: boolean;
162
168
  cancel?: () => void;
163
169
  }
164
- export type HandlerRequest<Request extends RequestShape> = Request & EntrypointRequestMeta;
170
+ /**
171
+ * A protocol request at an implementation boundary.
172
+ *
173
+ * Transport metadata and empty request sections remain available to handlers; a declared section
174
+ * then refines that base shape to its protocol contract.
175
+ */
176
+ export type HandlerRequest<Request extends RequestShape> = AbstractRequest & Request & EntrypointRequestMeta;
165
177
  /** The context-bound counterpart of an immutable protocol declaration. */
166
178
  export interface RegisteredEntrypoint<Request extends RequestShape, Response> extends BasicEntrypoint {
167
179
  readonly protocol: EntrypointProtocol<Request, Response>;
@@ -192,7 +204,7 @@ export type HeadersOf<Protocol extends EntrypointProtocolDeclaration> = RequestO
192
204
  headers: infer Headers;
193
205
  } ? Headers : object;
194
206
  export type CallRequestOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> & CallOptions;
195
- /** Create the immutable protocol form while legacy contextual entrypoints are migrated. */
207
+ /** Create an immutable protocol declaration from a route and its contract. */
196
208
  export declare const protocol: <Request extends RequestShape, Response>(route: RouteModel, entrypointContract: EntrypointContract<Request, Response>, options?: EntrypointOptions) => EntrypointProtocol<Request, Response>;
197
209
  export declare const openProtocol: (route: RouteModel, options?: EntrypointOptions) => EntrypointProtocol<OpenRequest, OpenValue>;
198
210
  export declare const entrypointRef: <Request extends RequestShape = OpenRequest, Response = OpenValue>(alias: string) => EntrypointReference<RegisteredEntrypoint<Request, Response>>;
@@ -203,6 +215,8 @@ export interface EntrypointTree {
203
215
  }
204
216
  /** Flatten an exported protocol tree for a layer-specific materializer. */
205
217
  export declare const protocols: (tree: EntrypointTree) => EntrypointProtocolDeclaration[];
218
+ /** Resolve the gates a protocol inherits through its route parents without materializing it. */
219
+ export declare const gatesOf: (protocol: EntrypointProtocolDeclaration, tree: EntrypointTree) => readonly EntrypointGate[];
206
220
  /** Clone an immutable protocol while preserving its request/response pair. */
207
221
  export declare const decorateEntrypoint: <Protocol extends EntrypointProtocolDeclaration>(protocol: Protocol, options: EntrypointOptions) => Protocol;
208
222
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,KAAK,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,oFAAoF;AACpF,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;AAEtF,qFAAqF;AACrF,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CA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2E;AAC3E,eAAO,MAAM,SAAS,SAAU,cAAc,KAAG,6BAA6B,EAe7E,CAAA;AAED,gGAAgG;AAChG,eAAO,MAAM,OAAO,aACR,6BAA6B,QACjC,cAAc,KACnB,SAAS,cAAc,EAiBzB,CAAA;AAED,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,GAAI,QAAQ,SAAS,6BAA6B,YACrE,QAAQ,WACT,iBAAiB,KACzB,QAKD,CAAA"}
package/build/protocol.js CHANGED
@@ -49,7 +49,7 @@ const gateOf = (gate) => gate == null
49
49
  alias: gate.alias,
50
50
  params: gate.params == null ? [] : typeof gate.params === 'string' ? [gate.params] : [...gate.params],
51
51
  };
52
- /** Create the immutable protocol form while legacy contextual entrypoints are migrated. */
52
+ /** Create an immutable protocol declaration from a route and its contract. */
53
53
  export const protocol = (route, entrypointContract, options) => Object.freeze({
54
54
  kind: 'entrypoint-protocol',
55
55
  alias: route.route.alias,
@@ -86,6 +86,23 @@ export const protocols = (tree) => {
86
86
  visit(tree);
87
87
  return result;
88
88
  };
89
+ /** Resolve the gates a protocol inherits through its route parents without materializing it. */
90
+ export const gatesOf = (protocol, tree) => {
91
+ const byAlias = new Map(protocols(tree).map(candidate => [candidate.alias, candidate]));
92
+ const result = [];
93
+ const visited = new Set();
94
+ let current = protocol;
95
+ while (current != null && !visited.has(current.alias)) {
96
+ visited.add(current.alias);
97
+ if (current.gate != null && !result.some(gate => gate.alias === current.gate.alias)) {
98
+ result.push(current.gate);
99
+ }
100
+ current = current.route.route.parent == null
101
+ ? undefined
102
+ : byAlias.get(current.route.route.parent);
103
+ }
104
+ return result;
105
+ };
89
106
  /** Clone an immutable protocol while preserving its request/response pair. */
90
107
  export const decorateEntrypoint = (protocol, options) => Object.freeze({
91
108
  ...protocol,
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAsDA,MAAM,CAAC,MAAM,MAAM,GAAG,CAAI,KAAwB,EAAuB,E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  "scripts": {
@@ -28,9 +28,9 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "@owlmeans/auth": "^0.1.18-rc.11",
32
- "@owlmeans/context": "^0.1.18-rc.10",
33
- "@owlmeans/route": "^0.1.18-rc.11",
31
+ "@owlmeans/auth": "^0.1.18-rc.12",
32
+ "@owlmeans/context": "^0.1.18-rc.11",
33
+ "@owlmeans/route": "^0.1.18-rc.12",
34
34
  "ajv": "^8.17.1"
35
35
  },
36
36
  "devDependencies": {
package/src/index.ts CHANGED
@@ -1,8 +1,6 @@
1
1
 
2
2
  export type * from './types.js'
3
- export * from './entrypoint.js'
4
- export * from './filter.js'
5
- export * from './helper.js'
6
3
  export * from './consts.js'
7
4
  export * from './protocol.js'
8
5
  export * from './materialize.js'
6
+ export { provideResponse } from './helper.js'
@@ -44,6 +44,6 @@ const optionsOf = (protocol: EntrypointProtocolDeclaration): CommonEntrypointOpt
44
44
  export const materializeEntrypoint = <Protocol extends EntrypointProtocolDeclaration>(
45
45
  protocol: Protocol,
46
46
  ): MaterializedEntrypoint<Protocol> => Object.assign(
47
- entrypoint(protocol.route, optionsOf(protocol)),
47
+ entrypoint({ route: { ...protocol.route.route } }, optionsOf(protocol)),
48
48
  { protocol },
49
49
  )
package/src/protocol.ts CHANGED
@@ -4,6 +4,7 @@ import type { JSONSchemaType, AnySchemaObject } from 'ajv'
4
4
  import type { RouteModel } from '@owlmeans/route'
5
5
  import type { EntrypointOutcome } from './consts.js'
6
6
  import type { ResolvedEntity } from './types.js'
7
+ import type { AbstractRequest } from './types.js'
7
8
 
8
9
  /** A deliberately broad value used only by declarations without an I/O contract. */
9
10
  export type OpenValue = object | string | number | boolean | bigint | null | undefined
@@ -115,6 +116,12 @@ export interface EntrypointProtocolDeclaration {
115
116
  }
116
117
  }
117
118
 
119
+ /** An access gate declared by a protocol, including inherited parent declarations. */
120
+ export interface EntrypointGate {
121
+ readonly alias: string
122
+ readonly params: readonly string[]
123
+ }
124
+
118
125
  type SourceValue<Source> =
119
126
  Source extends Typed<infer Value> ? Value
120
127
  : Source extends EntrypointSchema<infer Value> ? Value
@@ -219,7 +226,13 @@ export interface EntrypointRequestMeta {
219
226
  cancel?: () => void
220
227
  }
221
228
 
222
- export type HandlerRequest<Request extends RequestShape> = Request & EntrypointRequestMeta
229
+ /**
230
+ * A protocol request at an implementation boundary.
231
+ *
232
+ * Transport metadata and empty request sections remain available to handlers; a declared section
233
+ * then refines that base shape to its protocol contract.
234
+ */
235
+ export type HandlerRequest<Request extends RequestShape> = AbstractRequest & Request & EntrypointRequestMeta
223
236
 
224
237
  /** The context-bound counterpart of an immutable protocol declaration. */
225
238
  export interface RegisteredEntrypoint<Request extends RequestShape, Response> extends BasicEntrypoint {
@@ -278,7 +291,7 @@ const gateOf = (gate: EntrypointOptions['gate']): EntrypointProtocol['gate'] =>
278
291
  params: gate.params == null ? [] : typeof gate.params === 'string' ? [gate.params] : [...gate.params],
279
292
  }
280
293
 
281
- /** Create the immutable protocol form while legacy contextual entrypoints are migrated. */
294
+ /** Create an immutable protocol declaration from a route and its contract. */
282
295
  export const protocol = <Request extends RequestShape, Response>(
283
296
  route: RouteModel,
284
297
  entrypointContract: EntrypointContract<Request, Response>,
@@ -337,6 +350,29 @@ export const protocols = (tree: EntrypointTree): EntrypointProtocolDeclaration[]
337
350
  return result
338
351
  }
339
352
 
353
+ /** Resolve the gates a protocol inherits through its route parents without materializing it. */
354
+ export const gatesOf = (
355
+ protocol: EntrypointProtocolDeclaration,
356
+ tree: EntrypointTree,
357
+ ): readonly EntrypointGate[] => {
358
+ const byAlias = new Map(protocols(tree).map(candidate => [candidate.alias, candidate]))
359
+ const result: EntrypointGate[] = []
360
+ const visited = new Set<string>()
361
+ let current: EntrypointProtocolDeclaration | undefined = protocol
362
+
363
+ while (current != null && !visited.has(current.alias)) {
364
+ visited.add(current.alias)
365
+ if (current.gate != null && !result.some(gate => gate.alias === current!.gate!.alias)) {
366
+ result.push(current.gate)
367
+ }
368
+ current = current.route.route.parent == null
369
+ ? undefined
370
+ : byAlias.get(current.route.route.parent)
371
+ }
372
+
373
+ return result
374
+ }
375
+
340
376
  /** Clone an immutable protocol while preserving its request/response pair. */
341
377
  export const decorateEntrypoint = <Protocol extends EntrypointProtocolDeclaration>(
342
378
  protocol: Protocol,