@owlmeans/client-entrypoint 0.1.18-rc.4 → 0.1.18-rc.40
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 +169 -49
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/client-entrypoint/SKILL.md +33 -30
- package/build/entrypoint.d.ts +2 -3
- package/build/entrypoint.d.ts.map +1 -1
- package/build/entrypoint.js +25 -38
- package/build/entrypoint.js.map +1 -1
- package/build/failure.d.ts +19 -0
- package/build/failure.d.ts.map +1 -0
- package/build/failure.js +25 -0
- package/build/failure.js.map +1 -0
- package/build/helper.d.ts +2 -3
- package/build/helper.d.ts.map +1 -1
- package/build/helper.js +0 -15
- package/build/helper.js.map +1 -1
- package/build/index.d.ts +3 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -2
- package/build/index.js.map +1 -1
- package/build/protocol.d.ts +9 -0
- package/build/protocol.d.ts.map +1 -0
- package/build/protocol.js +15 -0
- package/build/protocol.js.map +1 -0
- package/build/types.d.ts +39 -9
- package/build/types.d.ts.map +1 -1
- package/build/utils/entrypoint.d.ts +2 -4
- package/build/utils/entrypoint.d.ts.map +1 -1
- package/build/utils/entrypoint.js +0 -9
- package/build/utils/entrypoint.js.map +1 -1
- package/build/utils/handler.d.ts +3 -3
- package/build/utils/handler.d.ts.map +1 -1
- package/build/utils/handler.js +54 -31
- package/build/utils/handler.js.map +1 -1
- package/package.json +10 -10
- package/src/entrypoint.ts +35 -48
- package/src/failure.ts +41 -0
- package/src/helper.ts +2 -26
- package/src/index.ts +3 -2
- package/src/protocol.ts +39 -0
- package/src/types.ts +50 -11
- package/src/utils/entrypoint.ts +2 -17
- package/src/utils/handler.ts +64 -40
package/README.md
CHANGED
|
@@ -1,80 +1,200 @@
|
|
|
1
1
|
# @owlmeans/client-entrypoint
|
|
2
2
|
|
|
3
|
-
Client-side entrypoint
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
- `stab` — no-op handler for entrypoints that only need URL resolution (no logic)
|
|
10
|
-
- `provideRequest(alias, path)` — creates an `AbstractRequest` for programmatic entrypoint calls
|
|
11
|
-
- `pickPerSchema(schema, obj)` — extracts fields from an object matching an AJV schema
|
|
12
|
-
- Re-exported as `celevate` from `@owlmeans/server-app`
|
|
3
|
+
Client-side binding of shared entrypoint protocols. It turns an immutable `@owlmeans/entrypoint`
|
|
4
|
+
declaration into a context entrypoint with three verbs: `call()`, `invoke()` and `url()`. Every
|
|
5
|
+
browser and native OwlMeans app uses it, usually through the `bind` / `bindAll` / `bindScreen`
|
|
6
|
+
re-exports of `@owlmeans/web-client` or `@owlmeans/web-panel`. Protocols are declared with
|
|
7
|
+
[`@owlmeans/entrypoint`](../entrypoint), never here. Server handlers are bound with
|
|
8
|
+
[`@owlmeans/server-entrypoint`](../server-entrypoint).
|
|
13
9
|
|
|
14
10
|
## Installation
|
|
15
11
|
|
|
16
12
|
```bash
|
|
17
|
-
bun add @owlmeans/client-entrypoint
|
|
13
|
+
bun add @owlmeans/client-entrypoint@^0.1.18-rc.40
|
|
18
14
|
```
|
|
19
15
|
|
|
20
|
-
##
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
## Concepts
|
|
17
|
+
|
|
18
|
+
- **Protocol** — the shared, immutable declaration of one route, its typed request sections, its
|
|
19
|
+
response, guards and gate. Binding never mutates it, and `context.entrypoint(protocol)` derives
|
|
20
|
+
the request and reply types from it.
|
|
21
|
+
- **Binding** — `bind`, `bindAll` and `bindScreen` materialize protocols into
|
|
22
|
+
`ClientProtocolEntrypoint<Protocol>` values, which the app hands to `context.registerEntrypoints`.
|
|
23
|
+
- **Screen** — a binding that carries a renderer. It is addressed by `url()`; `call()` and
|
|
24
|
+
`invoke()` throw and point the caller at `url()`.
|
|
25
|
+
- **Verbs** — `call()` resolves to the value and throws the reply's error; `invoke()` resolves to
|
|
26
|
+
`{ value, outcome }`; `url()` builds the address with `:params` filled in and the query appended.
|
|
27
|
+
- **Transport selection** — the route's protocol decides the carrier. When a service is registered
|
|
28
|
+
under that protocol's transport alias (a socket or queue transport), it takes the call. Otherwise
|
|
29
|
+
the API client named by `cfg.webService` does — a string, or a map keyed by service name with a
|
|
30
|
+
default key. Callers never branch on it.
|
|
31
|
+
- **Call options** — a request holds only the contract's sections (`params`, `query`, `body`,
|
|
32
|
+
`headers`) plus `CallOptions`: `auth`, `host`, `base`, `unsecure`, `timeout` and `signal`.
|
|
23
33
|
|
|
24
|
-
|
|
25
|
-
import { elevate, stab } from '@owlmeans/client-entrypoint'
|
|
26
|
-
import type { ClientEntrypoint } from '@owlmeans/client-entrypoint'
|
|
34
|
+
## Usage
|
|
27
35
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
### 1. Bind a protocol tree and screens
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { handler } from '@owlmeans/client'
|
|
40
|
+
import { bind, bindAll, bindScreen, stab } from '@owlmeans/client-entrypoint'
|
|
41
|
+
import { apiProtocols, webProtocols } from 'my-app-common'
|
|
42
|
+
import { ProjectListScreen } from './screens/project-list.js'
|
|
43
|
+
|
|
44
|
+
export const clientBindings = [
|
|
45
|
+
// Every API declaration the browser may call, route parents included.
|
|
46
|
+
...bindAll(apiProtocols),
|
|
47
|
+
// A backend route outside that tree.
|
|
48
|
+
bind(apiProtocols.health),
|
|
49
|
+
bindScreen(webProtocols.projectList, handler(ProjectListScreen)),
|
|
50
|
+
// A frontend route only ever addressed by URL, with no component of its own here.
|
|
51
|
+
bindScreen(webProtocols.projectExport, stab),
|
|
31
52
|
]
|
|
32
53
|
|
|
33
|
-
|
|
34
|
-
elevate(appModules, 'project-list', stab)
|
|
35
|
-
|
|
36
|
-
// Backend API call — call() makes a POST request
|
|
37
|
-
elevate(appModules, 'project-create')
|
|
54
|
+
context.registerEntrypoints(clientBindings)
|
|
38
55
|
```
|
|
39
56
|
|
|
40
|
-
|
|
57
|
+
### 2. Per-binding options
|
|
58
|
+
|
|
59
|
+
`bind` and `bindScreen` take `ClientEntrypointOptions`. Use `bind` instead of `bindAll` when one
|
|
60
|
+
protocol needs something the rest do not.
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { authProtocols } from '@owlmeans/auth-common'
|
|
64
|
+
import { bind, bindScreen, stab } from '@owlmeans/client-entrypoint'
|
|
65
|
+
import { apiProtocols, MY_APP_WEB } from 'my-app-common'
|
|
41
66
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})
|
|
67
|
+
export const extraBindings = [
|
|
68
|
+
// Validate the request against the protocol's schemas before it leaves the browser.
|
|
69
|
+
bind(apiProtocols.project.create, { validateOnCall: true }),
|
|
70
|
+
// Pin a frontend route to an explicitly selected service.
|
|
71
|
+
bindScreen(authProtocols.flowEnter, stab, { routeOptions: { overrides: { service: MY_APP_WEB } } }),
|
|
72
|
+
]
|
|
47
73
|
```
|
|
48
74
|
|
|
49
|
-
|
|
75
|
+
### 3. Call, invoke, url
|
|
50
76
|
|
|
51
|
-
|
|
77
|
+
```ts
|
|
78
|
+
import { EntrypointOutcome } from '@owlmeans/entrypoint'
|
|
52
79
|
|
|
53
|
-
|
|
80
|
+
const create = ctx.entrypoint(apiProtocols.project.create)
|
|
54
81
|
|
|
55
|
-
|
|
82
|
+
// Value only. The body type comes from the shared contract; do not add a generic here.
|
|
83
|
+
const project = await create.call({ body: { name: form.name } })
|
|
56
84
|
|
|
57
|
-
|
|
85
|
+
// Value and outcome, when the outcome decides the next step.
|
|
86
|
+
const { value, outcome } = await ctx.entrypoint(apiProtocols.project.get).invoke({ params: { id } })
|
|
87
|
+
if (outcome !== EntrypointOutcome.Ok) {
|
|
88
|
+
throw new ProjectMissing(id)
|
|
89
|
+
}
|
|
58
90
|
|
|
59
|
-
|
|
91
|
+
// A screen address; absolute when the route belongs to another service or when asked for.
|
|
92
|
+
const href = await ctx.entrypoint(webProtocols.project).url({ params: { id: value.id } }, { absolute: true })
|
|
93
|
+
```
|
|
60
94
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
95
|
+
### 4. Timeouts and cancellation
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
const controller = new AbortController()
|
|
99
|
+
const timer = setTimeout(() => controller.abort(), 15_000)
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
const files = await ctx.entrypoint(apiProtocols.files.list).call({
|
|
103
|
+
params: { id: projectId },
|
|
104
|
+
query: { path: '/' },
|
|
105
|
+
timeout: 10_000,
|
|
106
|
+
signal: controller.signal,
|
|
107
|
+
})
|
|
108
|
+
showFiles(files)
|
|
109
|
+
} finally {
|
|
110
|
+
clearTimeout(timer)
|
|
111
|
+
}
|
|
112
|
+
```
|
|
64
113
|
|
|
65
|
-
|
|
114
|
+
A mutation route (`POST`, `PUT`, `PATCH`) always sends a body — `{}` when the contract has none —
|
|
115
|
+
so `call({ params })` is enough. Never add `{ body: {} }` as a workaround.
|
|
66
116
|
|
|
67
|
-
|
|
117
|
+
### 5. Narrowing a payload to a schema
|
|
68
118
|
|
|
69
|
-
|
|
119
|
+
`pickPerSchema(object, schema)` keeps only the keys the AJV schema declares and skips `null` values.
|
|
120
|
+
It is useful when a form model carries more fields than the contract accepts.
|
|
70
121
|
|
|
71
|
-
|
|
122
|
+
```ts
|
|
123
|
+
import { pickPerSchema } from '@owlmeans/client-entrypoint'
|
|
124
|
+
import type { ProjectUpdate } from 'my-app-common'
|
|
125
|
+
import { ProjectUpdateSchema } from 'my-app-common'
|
|
72
126
|
|
|
73
|
-
|
|
127
|
+
const body = pickPerSchema<typeof formValues, ProjectUpdate>(formValues, ProjectUpdateSchema)
|
|
128
|
+
await ctx.entrypoint(apiProtocols.project.update).call({ params: { id }, body })
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## API
|
|
74
132
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
133
|
+
### `@owlmeans/client-entrypoint`
|
|
134
|
+
|
|
135
|
+
| Symbol | Kind | Purpose |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| `bind(protocol, options?)` | function | Materialize one protocol for a client context |
|
|
138
|
+
| `bindAll(tree)` | function | Materialize every protocol in a named declaration tree |
|
|
139
|
+
| `bindScreen(protocol, handler, options?)` | function | Materialize a frontend protocol with its renderer |
|
|
140
|
+
| `stab` | const | No-op `RefedEntrypointHandler` for a URL-only frontend binding |
|
|
141
|
+
| `provideRequest(alias, path)` | function | A minimal `AbstractRequest` for a dynamic boundary (for example a socket request) |
|
|
142
|
+
| `pickPerSchema(object, schema)` | function | Keep only the non-null keys an AJV schema declares |
|
|
143
|
+
| `ClientProtocolEntrypoint<Protocol>` | type | The bound view of a protocol — see *Entrypoint members* |
|
|
144
|
+
| `ClientEntrypoint<T, R>` | type | The untyped bound entrypoint shape the protocol view is built from |
|
|
145
|
+
| `ClientEntrypointOptions` | type | `routeOptions?` (`ClientRouteOptions`), `validateOnCall?`, plus common entrypoint options |
|
|
146
|
+
| `ClientRequest` | type | `AbstractRequest` as the client sends it |
|
|
147
|
+
| `EntrypointCall`, `EntrypointInvoke`, `EntrypointReply`, `EntrypointUrl`, `EntrypointUrlOptions`, `EntrypointFilter` | type | Verb signatures; `EntrypointReply` is `{ value, outcome }`, `EntrypointUrlOptions` is `{ absolute? }` |
|
|
148
|
+
| `EntrypointRef`, `RefedEntrypointHandler` | type | The handler-factory contract `bindScreen` and `stab` use |
|
|
149
|
+
| `ClientEntrypointError` | class | Base client entrypoint error |
|
|
150
|
+
| `ClientValidationError` | class | Thrown by `validate()` when a request does not match its schema |
|
|
151
|
+
|
|
152
|
+
### Entrypoint members
|
|
153
|
+
|
|
154
|
+
| Member | Purpose |
|
|
155
|
+
|---|---|
|
|
156
|
+
| `call(request?)` | Round trip; resolves to the value and throws the reply's error |
|
|
157
|
+
| `invoke(request?)` | Same round trip; resolves to `{ value, outcome }` |
|
|
158
|
+
| `url(request?, { absolute? })` | The address, with `:params` filled and the query appended |
|
|
159
|
+
| `validate(request?)` | Check the request against the protocol's filter schemas |
|
|
160
|
+
| `segment()`, `path()`, `mount()` | This route's segment, the segment under its ancestors, and that path under the service base — computed on every call, never written back |
|
|
161
|
+
| `protocol` | The declaration the binding was made from |
|
|
162
|
+
|
|
163
|
+
### `@owlmeans/client-entrypoint/utils`
|
|
164
|
+
|
|
165
|
+
| Symbol | Kind | Purpose |
|
|
166
|
+
|---|---|---|
|
|
167
|
+
| `apiInvoke(ref, options?)` | function | The round trip behind `invoke()` |
|
|
168
|
+
| `apiHandler(ref)` | function | The handler that picks the transport service or the API client |
|
|
169
|
+
| `entrypointUrl(ref, request?, options?)` | function | The address behind `url()` |
|
|
170
|
+
| `validate(ref)` | function | The filter behind `validate()` |
|
|
171
|
+
| `isEntrypoint(value)` | function | Re-export from `@owlmeans/entrypoint/utils` |
|
|
172
|
+
|
|
173
|
+
## Common pitfalls
|
|
174
|
+
|
|
175
|
+
- **Pass protocol objects, never alias strings.** `context.entrypoint(protocol)` is the lookup;
|
|
176
|
+
`entrypointRef<Request, Response>(alias)` from `@owlmeans/entrypoint` is reserved for a dynamic
|
|
177
|
+
remote declaration that cannot be imported.
|
|
178
|
+
- **Do not add a result generic at the call site.** When a type is wrong, fix the shared contract.
|
|
179
|
+
- **Bind route parents too.** An unbound protocol throws "entrypoint not found" before the request
|
|
180
|
+
is sent, which a broad `catch` easily misreports as a server error.
|
|
181
|
+
- **Screens reject `call()` and `invoke()`.** Use `url()` or navigate to them.
|
|
182
|
+
- **`cfg.webService` must resolve.** A context whose `webService` names no client for the route's
|
|
183
|
+
service (and no default key) throws a `SyntaxError` on the first call.
|
|
184
|
+
- **Socket URLs are always absolute.** A relative value would resolve against the page origin, which
|
|
185
|
+
in a split deployment is the web host rather than the service answering the upgrade.
|
|
186
|
+
- **Never mutate a declaration or a shared declaration collection** to change a guard, gate or
|
|
187
|
+
service. Use binding options, or derive an immutable decoration in the shared package.
|
|
188
|
+
|
|
189
|
+
## Related packages
|
|
190
|
+
|
|
191
|
+
- [`@owlmeans/entrypoint`](../entrypoint) — `protocol()`, `contract()`, `typed()` and protocol trees
|
|
192
|
+
- [`@owlmeans/client`](../client) — `handler`, `useNavigate`, `useEntrypoint`
|
|
193
|
+
- [`@owlmeans/client-route`](../client-route) — client route models and `ClientRouteOptions`
|
|
194
|
+
- [`@owlmeans/api`](../api) — the HTTP client that carries calls
|
|
195
|
+
- [`@owlmeans/client-socket`](../client-socket) — socket transport for socket protocols
|
|
196
|
+
- [`@owlmeans/server-entrypoint`](../server-entrypoint) — the server-side counterpart
|
|
197
|
+
- [`@owlmeans/web-client`](../web-client) — re-exports the binding helpers for browser apps
|
|
78
198
|
|
|
79
199
|
<!-- owlmeans:agent-guidance:start -->
|
|
80
200
|
## Agent guidance
|
|
@@ -84,7 +204,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
84
204
|
your project's skill store (`.agents/skills/`):
|
|
85
205
|
|
|
86
206
|
```sh
|
|
87
|
-
npx @owlmeans/agent-skills
|
|
207
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.41
|
|
88
208
|
```
|
|
89
209
|
|
|
90
210
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/client-entrypoint",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-
|
|
4
|
+
"version": "0.1.18-rc.40",
|
|
5
|
+
"generatedAt": "2026-09-28T02:06:37.875Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -1,50 +1,53 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: client-entrypoint
|
|
3
|
-
description:
|
|
3
|
+
description: Bind shared entrypoint protocols in a client context with typed call(), invoke(), url(), bindAll(), and bindScreen(). Load when wiring client API routes or screens.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
---
|
|
6
6
|
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
7
7
|
|
|
8
8
|
# @owlmeans/client-entrypoint
|
|
9
9
|
|
|
10
|
-
**
|
|
11
|
-
**Install:** `"@owlmeans/client-entrypoint": "^0.1.18-rc.0"` in `dependencies`
|
|
10
|
+
**Install:** `bun add @owlmeans/client-entrypoint@^0.1.18-rc.40`
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
Bind a declaration from `@owlmeans/entrypoint`; never construct or replace a contextual
|
|
13
|
+
entrypoint by alias.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
| `ClientEntrypoint<T>` types | Client entrypoint interface (handler component + call helpers) |
|
|
18
|
-
| `EntrypointCall` / `EntrypointFilter` | Typed call and validation helpers |
|
|
19
|
-
| `EntrypointRef` / `RefedEntrypointHandler` | Handler reference pattern |
|
|
20
|
-
| Entrypoint helpers | Build client entrypoints; resolve callable references |
|
|
15
|
+
```ts
|
|
16
|
+
import { bind, bindAll, bindScreen } from '@owlmeans/client-entrypoint'
|
|
21
17
|
|
|
22
|
-
|
|
18
|
+
context.registerEntrypoints(bindAll(projectProtocols))
|
|
19
|
+
context.registerEntrypoint(bind(projectProtocols.health))
|
|
20
|
+
context.registerEntrypoint(bindScreen(projectProtocols.home, handler(Home)))
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Most app code uses `elevate()` from `@owlmeans/web-client` (which builds on this). Use this directly only for cross-platform entrypoint helpers.
|
|
29
|
-
|
|
30
|
-
```typescript
|
|
31
|
-
import type { ClientEntrypoint } from '@owlmeans/client-entrypoint'
|
|
22
|
+
const value = await context.entrypoint(projectProtocols.create).call({ body })
|
|
23
|
+
const { value, outcome } = await context.entrypoint(projectProtocols.create).invoke({ body })
|
|
24
|
+
const href = await context.entrypoint(projectProtocols.edit).url({ params: { id } })
|
|
32
25
|
```
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
`bindAll(tree)` flattens a nested named declaration tree while preserving the union of its protocol
|
|
28
|
+
types. `bind(protocol)` is appropriate where one protocol must use a distinct client option.
|
|
29
|
+
`bindScreen` is for a frontend route and renderer; screens are addressed by `url` and reject
|
|
30
|
+
`call`/`invoke`.
|
|
37
31
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
`bindScreen` takes a `lazyHandler(...)` result (`@owlmeans/client`) directly, the same as
|
|
33
|
+
`handler(Component)`: both return a `RefedEntrypointHandler`, the lazy one also carrying
|
|
34
|
+
`.preload()`, so no different wiring is needed. Create it at module scope, never in a render.
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
```ts
|
|
37
|
+
const reports = lazyHandler(() => import('./reports.js'), 'Reports', { fallback: <Spinner /> })
|
|
38
|
+
context.registerEntrypoint(bindScreen(projectProtocols.reports, reports))
|
|
44
39
|
```
|
|
45
40
|
|
|
46
|
-
|
|
41
|
+
`context.entrypoint(protocol)` derives `ClientProtocolEntrypoint<Protocol>` from the protocol. Do
|
|
42
|
+
not add an explicit result generic. `entrypointRef<Request, Response>(alias)` is reserved for a
|
|
43
|
+
dynamic remote declaration that cannot be imported.
|
|
47
44
|
|
|
48
|
-
|
|
45
|
+
Client calls include only contract request sections plus `CallOptions` (`auth`, host/port/base,
|
|
46
|
+
timeout, signal). `url` accepts params/query plus the same address options. The route transport is
|
|
47
|
+
chosen by the declaration; callers do not branch for HTTP, socket, or queue.
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
`ensureEntrypointFailureService(context)` returns the context-local failure plugin host. Register
|
|
50
|
+
an `onFailure` plugin there to observe a rejected remote `invoke`/`call`, show a toast, or collect
|
|
51
|
+
diagnostics. Plugins run after the transport fails and the original error is still rethrown to
|
|
52
|
+
the caller. This is the opt-in seam for application-wide failure UI; keep the transport independent
|
|
53
|
+
of the chosen toast library.
|
package/build/entrypoint.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ClientRouteModel } from '@owlmeans/client-route';
|
|
2
1
|
import type { ClientEntrypoint, ClientEntrypointOptions, RefedEntrypointHandler } from './types.js';
|
|
3
2
|
import type { AbstractRequest, CommonEntrypoint } from '@owlmeans/entrypoint';
|
|
4
|
-
|
|
5
|
-
export declare const
|
|
3
|
+
/** Attach client behaviour to an entrypoint already materialized from a protocol. */
|
|
4
|
+
export declare const bindMaterializedEntrypoint: <T, R extends AbstractRequest = AbstractRequest>(arg: CommonEntrypoint, handler?: RefedEntrypointHandler<T, R>, opts?: ClientEntrypointOptions) => ClientEntrypoint<T, R>;
|
|
6
5
|
//# sourceMappingURL=entrypoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoint.d.ts","sourceRoot":"","sources":["../src/entrypoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"entrypoint.d.ts","sourceRoot":"","sources":["../src/entrypoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAiB,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAClH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAO7E,qFAAqF;AACrF,eAAO,MAAM,0BAA0B,GAAI,CAAC,EAAE,CAAC,SAAS,eAAe,GAAG,eAAe,OAClF,gBAAgB,YACX,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,SAC/B,uBAAuB,KAC7B,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAqDvB,CAAA"}
|
package/build/entrypoint.js
CHANGED
|
@@ -1,44 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { validate } from './utils/entrypoint.js';
|
|
2
|
+
import { route } from '@owlmeans/client-route';
|
|
3
|
+
import { apiInvoke, apiHandler, entrypointUrl } from './utils/handler.js';
|
|
4
4
|
import { AppType } from '@owlmeans/context';
|
|
5
|
-
import { normalizePath } from '@owlmeans/route';
|
|
6
5
|
import { provideRequest } from './helper.js';
|
|
7
|
-
|
|
6
|
+
/** Attach client behaviour to an entrypoint already materialized from a protocol. */
|
|
7
|
+
export const bindMaterializedEntrypoint = (arg, handler, opts) => {
|
|
8
8
|
const entrypointHandle = { ref: undefined };
|
|
9
9
|
let _entrypoint;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
else {
|
|
30
|
-
assertExplicitHandler(arg.route.type, handler);
|
|
31
|
-
const _route = route(arg, opts?.routeOptions);
|
|
32
|
-
_entrypoint = makeBasicEntrypoint(_route, { ...opts });
|
|
33
|
-
_entrypoint.route = _route;
|
|
34
|
-
}
|
|
35
|
-
_entrypoint.getPath = (partial) => partial === true ? normalizePath(_entrypoint.route.route.partialPath) : _entrypoint.route.route.path;
|
|
36
|
-
_entrypoint.call = handler != null ? urlCall(entrypointHandle, opts) : apiCall(entrypointHandle, opts);
|
|
10
|
+
const _handler = handler ?? (arg.route.route.type === AppType.Backend ? apiHandler : undefined);
|
|
11
|
+
assertExplicitHandler(arg.route.route.type, handler);
|
|
12
|
+
const routeModel = route(arg.route, opts?.routeOptions);
|
|
13
|
+
_entrypoint = arg;
|
|
14
|
+
_entrypoint.route = routeModel;
|
|
15
|
+
// Binding adds guards, it never swaps them: what the declaration carries still applies.
|
|
16
|
+
_entrypoint.guards = [...new Set([...(arg.guards ?? []), ...(opts?.guards ?? [])])];
|
|
17
|
+
_entrypoint.filter = opts?.filter ?? arg.filter;
|
|
18
|
+
_entrypoint.gate = opts?.gate ?? arg.gate;
|
|
19
|
+
_entrypoint.gateParams = opts?.gateParams ?? arg.gateParams;
|
|
20
|
+
_entrypoint.url = ((req, urlOpts) => entrypointUrl(entrypointHandle, req, urlOpts));
|
|
21
|
+
// An entrypoint carrying a renderer IS a screen: it is addressed by URL, never called over the
|
|
22
|
+
// wire. Saying so here turns what used to be a URL-shaped answer from `call()` into a report.
|
|
23
|
+
_entrypoint.invoke = (handler != null
|
|
24
|
+
? (async () => {
|
|
25
|
+
throw new SyntaxError(`Entrypoint ${_entrypoint.alias} renders a screen - address it with url() instead of call()/invoke()`);
|
|
26
|
+
})
|
|
27
|
+
: apiInvoke(entrypointHandle, opts));
|
|
28
|
+
_entrypoint.call = (async (req) => (await _entrypoint.invoke(req)).value);
|
|
37
29
|
_entrypoint.request = ((request) => {
|
|
38
30
|
if (entrypointHandle.ref == null) {
|
|
39
31
|
throw SyntaxError(`Try to request uninitialized entrypoint ${JSON.stringify(arg)}`);
|
|
40
32
|
}
|
|
41
|
-
const _request = provideRequest(entrypointHandle.ref.
|
|
33
|
+
const _request = provideRequest(entrypointHandle.ref.alias, entrypointHandle.ref.path());
|
|
42
34
|
request != null && Object.entries(request).forEach(([key, value]) => {
|
|
43
35
|
_request[key] = value;
|
|
44
36
|
});
|
|
@@ -46,11 +38,6 @@ export const entrypoint = (arg, handler, opts) => {
|
|
|
46
38
|
});
|
|
47
39
|
_entrypoint.handle = _handler?.(entrypointHandle);
|
|
48
40
|
_entrypoint.validate = validate(entrypointHandle);
|
|
49
|
-
_entrypoint.reinitializeContext = (context) => {
|
|
50
|
-
const newEntrypoint = entrypoint(_entrypoint.route, handler, opts);
|
|
51
|
-
newEntrypoint.ctx = context;
|
|
52
|
-
return newEntrypoint;
|
|
53
|
-
};
|
|
54
41
|
entrypointHandle.ref = _entrypoint;
|
|
55
42
|
return _entrypoint;
|
|
56
43
|
};
|
package/build/entrypoint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../src/entrypoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../src/entrypoint.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,qFAAqF;AACrF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,GAAqB,EACrB,OAAsC,EACtC,IAA8B,EACN,EAAE;IAC1B,MAAM,gBAAgB,GAAwB,EAAE,GAAG,EAAE,SAAS,EAAE,CAAA;IAEhE,IAAI,WAAmC,CAAA;IAEvC,MAAM,QAAQ,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IAE/F,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACpD,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,CAAA;IACvD,WAAW,GAAG,GAA6B,CAAA;IAC3C,WAAW,CAAC,KAAK,GAAG,UAAU,CAAA;IAC9B,wFAAwF;IACxF,WAAW,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IACnF,WAAW,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,GAAG,CAAC,MAAM,CAAA;IAC/C,WAAW,CAAC,IAAI,GAAG,IAAI,EAAE,IAAI,IAAI,GAAG,CAAC,IAAI,CAAA;IACzC,WAAW,CAAC,UAAU,GAAG,IAAI,EAAE,UAAU,IAAI,GAAG,CAAC,UAAU,CAAA;IAE3D,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC,GAAgB,EAAE,OAAgC,EAAE,EAAE,CACxE,aAAa,CAAO,gBAAgB,EAAE,GAAY,EAAE,OAAO,CAAC,CAAkC,CAAA;IAEhG,+FAA+F;IAC/F,8FAA8F;IAC9F,WAAW,CAAC,MAAM,GAAG,CAAC,OAAO,IAAI,IAAI;QACnC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;YACZ,MAAM,IAAI,WAAW,CACnB,cAAc,WAAW,CAAC,KAAK,sEAAsE,CACtG,CAAA;QACH,CAAC,CAAC;QACF,CAAC,CAAC,SAAS,CAAO,gBAAgB,EAAE,IAAI,CAAC,CAAqC,CAAA;IAEhF,WAAW,CAAC,IAAI,GAAG,CAAC,KAAK,EAAE,GAAgB,EAAE,EAAE,CAC7C,CAAC,MAAM,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAmC,CAAA;IAE1E,WAAW,CAAC,OAAO,GAAG,CAAC,CAAC,OAAU,EAAK,EAAE;QACvC,IAAI,gBAAgB,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;YACjC,MAAM,WAAW,CAAC,2CAA2C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACrF,CAAC;QACD,MAAM,QAAQ,GAAG,cAAc,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,EAAE,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,CAAM,CAAA;QAE7F,OAAO,IAAI,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAClE,QAAQ,CAAC,GAAc,CAAC,GAAG,KAAK,CAAA;QAClC,CAAC,CAAC,CAAA;QAEF,OAAO,QAAQ,CAAA;IACjB,CAAC,CAAQ,CAAA;IAET,WAAW,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC,gBAAgB,CAAC,CAAA;IAEjD,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAA;IAEjD,gBAAgB,CAAC,GAAG,GAAG,WAAW,CAAA;IAElC,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAED,MAAM,qBAAqB,GAAG,CAC5B,IAAa,EAAE,OAAiD,EAChE,EAAE;IACF,IAAI,IAAI,KAAK,OAAO,CAAC,OAAO,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QAChD,MAAM,IAAI,WAAW,CAAC,iEAAiE,CAAC,CAAA;IAC1F,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { BasicContext, LazyService } from '@owlmeans/context';
|
|
2
|
+
import type { AbstractRequest } from '@owlmeans/entrypoint';
|
|
3
|
+
export declare const ENTRYPOINT_FAILURE_SERVICE = "client-entrypoint:failure";
|
|
4
|
+
export interface EntrypointFailure {
|
|
5
|
+
alias: string;
|
|
6
|
+
request: AbstractRequest;
|
|
7
|
+
error: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface EntrypointFailurePlugin {
|
|
10
|
+
alias: string;
|
|
11
|
+
onFailure: (failure: EntrypointFailure) => void | Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export interface EntrypointFailureService extends LazyService {
|
|
14
|
+
registerPlugin: (plugin: EntrypointFailurePlugin) => void;
|
|
15
|
+
notify: (failure: EntrypointFailure) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/** Context-local observers for rejected client calls; observers never replace the thrown error. */
|
|
18
|
+
export declare const ensureEntrypointFailureService: (ctx: BasicContext<any>) => EntrypointFailureService;
|
|
19
|
+
//# sourceMappingURL=failure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure.d.ts","sourceRoot":"","sources":["../src/failure.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,eAAO,MAAM,0BAA0B,8BAA8B,CAAA;AAErE,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,eAAe,CAAA;IACxB,KAAK,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAChE;AAED,MAAM,WAAW,wBAAyB,SAAQ,WAAW;IAC3D,cAAc,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,CAAA;IACzD,MAAM,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACtD;AAED,mGAAmG;AACnG,eAAO,MAAM,8BAA8B,QAAS,YAAY,CAAC,GAAG,CAAC,KAAG,wBAiBvE,CAAA"}
|
package/build/failure.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createLazyService } from '@owlmeans/context';
|
|
2
|
+
export const ENTRYPOINT_FAILURE_SERVICE = 'client-entrypoint:failure';
|
|
3
|
+
/** Context-local observers for rejected client calls; observers never replace the thrown error. */
|
|
4
|
+
export const ensureEntrypointFailureService = (ctx) => {
|
|
5
|
+
if (ctx.hasService(ENTRYPOINT_FAILURE_SERVICE)) {
|
|
6
|
+
return ctx.service(ENTRYPOINT_FAILURE_SERVICE);
|
|
7
|
+
}
|
|
8
|
+
const plugins = new Map();
|
|
9
|
+
const service = createLazyService(ENTRYPOINT_FAILURE_SERVICE, {
|
|
10
|
+
registerPlugin: plugin => { plugins.set(plugin.alias, plugin); },
|
|
11
|
+
notify: async (failure) => {
|
|
12
|
+
for (const plugin of plugins.values()) {
|
|
13
|
+
try {
|
|
14
|
+
await plugin.onFailure(failure);
|
|
15
|
+
}
|
|
16
|
+
catch (cause) {
|
|
17
|
+
console.warn('Entrypoint failure observer failed', cause);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
ctx.registerService(service);
|
|
23
|
+
return service;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=failure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure.js","sourceRoot":"","sources":["../src/failure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAIrD,MAAM,CAAC,MAAM,0BAA0B,GAAG,2BAA2B,CAAA;AAkBrE,mGAAmG;AACnG,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,GAAsB,EAA4B,EAAE;IACjG,IAAI,GAAG,CAAC,UAAU,CAAC,0BAA0B,CAAC,EAAE,CAAC;QAC/C,OAAO,GAAG,CAAC,OAAO,CAA2B,0BAA0B,CAAC,CAAA;IAC1E,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAmC,CAAA;IAC1D,MAAM,OAAO,GAAG,iBAAiB,CAA2B,0BAA0B,EAAE;QACtF,cAAc,EAAE,MAAM,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA,CAAC,CAAC;QAC/D,MAAM,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;YACtB,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;gBACtC,IAAI,CAAC;oBAAC,MAAM,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;gBAAC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACrD,OAAO,CAAC,IAAI,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAA;gBAC3D,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC,CAAA;IACF,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;IAC5B,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
|
package/build/helper.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { AbstractRequest
|
|
1
|
+
import type { RefedEntrypointHandler } from './types.js';
|
|
2
|
+
import type { AbstractRequest } from '@owlmeans/entrypoint';
|
|
3
3
|
import type { JSONSchemaType } from "ajv";
|
|
4
|
-
export declare const elevate: <T = {}, R extends AbstractRequest = AbstractRequest>(entrypoints: (CommonEntrypoint | ClientEntrypoint<T, R>)[], alias: string, handler?: RefedEntrypointHandler<T, R> | ClientEntrypointOptions | boolean, opts?: ClientEntrypointOptions | boolean) => ClientEntrypoint<T, R>[];
|
|
5
4
|
export declare const stab: RefedEntrypointHandler<{}>;
|
|
6
5
|
export declare const provideRequest: <T extends {} = {}>(alias: string, path: string) => AbstractRequest<T>;
|
|
7
6
|
export declare const pickPerSchema: <T, R>(object: T, schema: JSONSchemaType<R>) => Partial<R>;
|
package/build/helper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAEzC,eAAO,MAAM,IAAI,EAAE,sBAAsB,CAAC,EAAE,CAE3C,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,EAAE,GAAG,EAAE,SAAS,MAAM,QAAQ,MAAM,KAAG,eAAe,CAAC,CAAC,CAYhG,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,cAAc,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,CAAC,CAQjF,CAAA"}
|
package/build/helper.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
import { entrypoint } from './entrypoint.js';
|
|
2
|
-
import { isClientRouteModel } from '@owlmeans/client-route';
|
|
3
|
-
import { normalizeHelperParams } from './utils/entrypoint.js';
|
|
4
|
-
export const elevate = (entrypoints, alias, handler, opts) => {
|
|
5
|
-
[handler, opts] = normalizeHelperParams(handler, opts);
|
|
6
|
-
const idx = entrypoints.findIndex(({ route }) => route.route.alias === alias);
|
|
7
|
-
if (idx === -1) {
|
|
8
|
-
throw new SyntaxError(`Entrypoint with alias ${alias} not present`);
|
|
9
|
-
}
|
|
10
|
-
if (isClientRouteModel(entrypoints[idx].route) && opts?.force !== true) {
|
|
11
|
-
throw new SyntaxError(`Entrypoint with alias ${alias} is already elevated`);
|
|
12
|
-
}
|
|
13
|
-
entrypoints[idx] = entrypoint(entrypoints[idx], handler, opts);
|
|
14
|
-
return entrypoints;
|
|
15
|
-
};
|
|
16
1
|
export const stab = () => () => {
|
|
17
2
|
return void 0;
|
|
18
3
|
};
|
package/build/helper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,IAAI,GAA+B,GAAG,EAAE,CAAC,GAAG,EAAE;IACzD,OAAO,KAAK,CAAQ,CAAA;AACtB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAoB,KAAa,EAAE,IAAY,EAAsB,EAAE;IACnG,MAAM,OAAO,GAAG;QACd,KAAK;QACL,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,EAAE;QACT,IAAI;QACJ,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,GAAG,IAAI;KACtC,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAO,MAAS,EAAE,MAAyB,EAAc,EAAE,CACtF,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CACnC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACX,IAAI,MAAM,CAAC,GAAc,CAAC,IAAI,IAAI,EAAE,CAAC;QACnC,GAAG,CAAC,GAAc,CAAC,GAAG,MAAM,CAAC,GAAc,CAA0B,CAAA;IACvE,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,EAAE,EAAgB,CACpB,CAAA"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export * from './helper.js';
|
|
2
1
|
export type * from './types.js';
|
|
3
|
-
export * from './entrypoint.js';
|
|
4
2
|
export * from './errors.js';
|
|
3
|
+
export * from './failure.js';
|
|
4
|
+
export * from './protocol.js';
|
|
5
|
+
export { pickPerSchema, provideRequest, stab } from './helper.js';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,
|
|
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,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA"}
|
package/build/index.js
CHANGED
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EntrypointProtocolDeclaration, EntrypointTree } from '@owlmeans/entrypoint';
|
|
2
|
+
import type { ClientEntrypointOptions, ClientProtocolEntrypoint, RefedEntrypointHandler } from './types.js';
|
|
3
|
+
/** Bind a shared protocol to the client context without changing the declaration itself. */
|
|
4
|
+
export declare const bind: <Protocol extends EntrypointProtocolDeclaration>(protocol: Protocol, options?: ClientEntrypointOptions) => ClientProtocolEntrypoint<Protocol>;
|
|
5
|
+
/** Materialize every protocol in an exported declaration tree for a browser context. */
|
|
6
|
+
export declare const bindAll: (tree: EntrypointTree) => ClientProtocolEntrypoint<EntrypointProtocolDeclaration>[];
|
|
7
|
+
/** Bind a frontend protocol to the component that renders it. */
|
|
8
|
+
export declare const bindScreen: <Protocol extends EntrypointProtocolDeclaration>(protocol: Protocol, handler: RefedEntrypointHandler, options?: ClientEntrypointOptions) => ClientProtocolEntrypoint<Protocol>;
|
|
9
|
+
//# sourceMappingURL=protocol.d.ts.map
|