@owlmeans/client-entrypoint 0.1.18-rc.2 → 0.1.18-rc.21
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 +63 -32
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/client-entrypoint/SKILL.md +22 -34
- 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/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 +2 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -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 +43 -28
- package/build/utils/handler.js.map +1 -1
- package/package.json +10 -10
- package/src/entrypoint.ts +35 -48
- package/src/helper.ts +2 -26
- package/src/index.ts +2 -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 +54 -37
package/README.md
CHANGED
|
@@ -1,66 +1,91 @@
|
|
|
1
1
|
# @owlmeans/client-entrypoint
|
|
2
2
|
|
|
3
|
-
Client-side entrypoint system:
|
|
3
|
+
Client-side entrypoint system: binds shared protocol declarations into API-calling client views.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
- `
|
|
8
|
-
- `
|
|
9
|
-
- `
|
|
7
|
+
- `bind(protocol, opts?)` — binds one shared protocol declaration
|
|
8
|
+
- `bindAll(protocolTree)` — binds every protocol in a shared declaration tree
|
|
9
|
+
- `bindScreen(protocol, handler, opts?)` — binds a screen renderer to a shared frontend protocol
|
|
10
|
+
- `ClientProtocolEntrypoint<Protocol>` exposes three explicit verbs: `call()` for the value,
|
|
11
|
+
`invoke()` for the value plus its outcome, and `url()` for the address
|
|
12
|
+
- `stab` — no-op handler for entrypoints that only need a URL (no logic)
|
|
10
13
|
- `provideRequest(alias, path)` — creates an `AbstractRequest` for programmatic entrypoint calls
|
|
11
14
|
- `pickPerSchema(schema, obj)` — extracts fields from an object matching an AJV schema
|
|
12
|
-
- Re-exported as `celevate` from `@owlmeans/server-app`
|
|
13
15
|
|
|
14
16
|
## Installation
|
|
15
17
|
|
|
16
18
|
```bash
|
|
17
|
-
bun add @owlmeans/client-entrypoint
|
|
19
|
+
bun add @owlmeans/client-entrypoint@^0.1.18-rc.12
|
|
18
20
|
```
|
|
19
21
|
|
|
20
22
|
## Usage
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
Bind shared protocols for browser API calls and screens:
|
|
23
25
|
|
|
24
26
|
```typescript
|
|
25
|
-
import {
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
import { bindAll, bindScreen, stab } from '@owlmeans/client-entrypoint'
|
|
28
|
+
import { appEntrypoints as protocols } from 'my-app-common'
|
|
29
|
+
import { handler } from '@owlmeans/client'
|
|
30
|
+
import { ProjectListScreen } from './screens/project-list.js'
|
|
31
|
+
|
|
32
|
+
const appEntrypoints = [
|
|
33
|
+
...bindAll(protocols.api),
|
|
34
|
+
bindScreen(protocols.web.projectList, handler(ProjectListScreen)),
|
|
35
|
+
bindScreen(protocols.web.project, stab),
|
|
31
36
|
]
|
|
32
|
-
|
|
33
|
-
// Frontend navigation — just a stub, no network call
|
|
34
|
-
elevate(appModules, 'project-list', stab)
|
|
35
|
-
|
|
36
|
-
// Backend API call — call() makes a POST request
|
|
37
|
-
elevate(appModules, 'project-create')
|
|
38
37
|
```
|
|
39
38
|
|
|
40
39
|
Call an entrypoint from a service:
|
|
41
40
|
|
|
42
41
|
```typescript
|
|
43
|
-
const agentEntrypoint = ctx.entrypoint
|
|
44
|
-
const
|
|
45
|
-
body: { prompt: payload.prompt, entity: req.auth?.
|
|
42
|
+
const agentEntrypoint = ctx.entrypoint(agent.project.create)
|
|
43
|
+
const result = await agentEntrypoint.call({
|
|
44
|
+
body: { prompt: payload.prompt, entity: req.auth?.entitySlug }
|
|
46
45
|
})
|
|
47
46
|
```
|
|
48
47
|
|
|
48
|
+
Take the outcome when it decides what happens next, and build a link with `url()`:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
const { value, outcome } = await agentEntrypoint.invoke({ body: payload })
|
|
52
|
+
|
|
53
|
+
const href = await ctx.entrypoint(protocols.web.projectList)
|
|
54
|
+
.url({ params: { id: value.id } }, { absolute: true })
|
|
55
|
+
```
|
|
56
|
+
|
|
49
57
|
## API
|
|
50
58
|
|
|
51
|
-
### `
|
|
59
|
+
### `bind<Protocol>(protocol, opts?): ClientProtocolEntrypoint<Protocol>`
|
|
52
60
|
|
|
53
|
-
|
|
61
|
+
Materializes one immutable protocol declaration for a browser context. The declaration is never mutated.
|
|
62
|
+
|
|
63
|
+
### `bindAll(protocolTree): ClientProtocolEntrypoint[]`
|
|
64
|
+
|
|
65
|
+
Materializes every protocol in a shared declaration tree, preserving each protocol reference for typed context lookup.
|
|
66
|
+
|
|
67
|
+
### `bindScreen<Protocol>(protocol, handler, opts?): ClientProtocolEntrypoint<Protocol>`
|
|
68
|
+
|
|
69
|
+
Materializes a frontend protocol and attaches its renderer.
|
|
54
70
|
|
|
55
71
|
### `stab: RefedEntrypointHandler`
|
|
56
72
|
|
|
57
|
-
No-op handler for frontend-only entrypoints that
|
|
73
|
+
No-op handler for frontend-only entrypoints that are addressed by URL rather than called.
|
|
58
74
|
|
|
59
|
-
### `
|
|
75
|
+
### `ClientProtocolEntrypoint<Protocol>` (type)
|
|
60
76
|
|
|
61
|
-
- `call(request?)` —
|
|
77
|
+
- `call(request?)` — addresses the entrypoint over the wire and resolves to the value, throwing
|
|
78
|
+
whatever error the reply carried
|
|
79
|
+
- `invoke(request?)` — the same round trip, resolving to `{ value, outcome }`
|
|
80
|
+
- `url(request?, { absolute? })` — builds the URL this entrypoint addresses, with `:params` filled in
|
|
81
|
+
and the query appended; absolute when the route belongs to another service or `absolute` is asked for
|
|
62
82
|
- `validate(request?)` — validates the request against the entrypoint filter schema
|
|
63
|
-
- `
|
|
83
|
+
- `segment()` / `path()` / `mount()` — the segment this entrypoint contributes, that segment under its
|
|
84
|
+
ancestors, and the same path under the service base. All three are computed from the declaration
|
|
85
|
+
and the context on every call — nothing is written back into the route.
|
|
86
|
+
|
|
87
|
+
An entrypoint carrying a renderer *is* a screen: it is addressed by URL, never called over the wire,
|
|
88
|
+
so `call()` and `invoke()` throw and point the caller at `url()`.
|
|
64
89
|
|
|
65
90
|
### `provideRequest<T>(alias, path): AbstractRequest<T>`
|
|
66
91
|
|
|
@@ -70,11 +95,17 @@ Creates a minimal request object for programmatic `call()` invocations.
|
|
|
70
95
|
|
|
71
96
|
Extracts only the keys present in the AJV schema from `obj`.
|
|
72
97
|
|
|
98
|
+
### `@owlmeans/client-entrypoint/utils`
|
|
99
|
+
|
|
100
|
+
The low-level pair the verbs are built on, for code that holds an entrypoint reference directly:
|
|
101
|
+
|
|
102
|
+
- `entrypointUrl(ref, request, opts?)` — the address behind `url()`
|
|
103
|
+
- `apiInvoke(ref, opts?)` — the round trip behind `invoke()`
|
|
104
|
+
|
|
73
105
|
## Related Packages
|
|
74
106
|
|
|
75
|
-
- [`@owlmeans/entrypoint`](../entrypoint) — `CommonEntrypoint` base that gets
|
|
76
|
-
- [`@owlmeans/client`](../client) — `useNavigate`
|
|
77
|
-
- [`@owlmeans/server-app`](../server-app) — re-exports `elevate` as `celevate`
|
|
107
|
+
- [`@owlmeans/entrypoint`](../entrypoint) — `CommonEntrypoint` base that gets materialized
|
|
108
|
+
- [`@owlmeans/client`](../client) — `useNavigate` navigates by a bound protocol's `url()`
|
|
78
109
|
|
|
79
110
|
<!-- owlmeans:agent-guidance:start -->
|
|
80
111
|
## Agent guidance
|
|
@@ -84,7 +115,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
84
115
|
your project's skill store (`.agents/skills/`):
|
|
85
116
|
|
|
86
117
|
```sh
|
|
87
|
-
npx @owlmeans/agent-skills
|
|
118
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.20
|
|
88
119
|
```
|
|
89
120
|
|
|
90
121
|
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.21",
|
|
5
|
+
"generatedAt": "2026-09-12T14:18:54.785Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -1,50 +1,38 @@
|
|
|
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.19`
|
|
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(projectEntrypoints))
|
|
19
|
+
context.registerEntrypoint(bind(projectEntrypoints.health))
|
|
20
|
+
context.registerEntrypoint(bindScreen(projectEntrypoints.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'
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## URL Generation via Entrypoint Call
|
|
35
|
-
|
|
36
|
-
Entrypoints with a `handler` (React component) use `urlCall` internally — calling `.call()` returns a URL string. Use `{ full: true }` to get a fully-qualified URL via `makeSecurityHelper`:
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
import type { ClientEntrypoint } from '@owlmeans/client-entrypoint'
|
|
40
|
-
import { HOME } from '@owlmeans/context'
|
|
41
|
-
|
|
42
|
-
const [url] = await context.entrypoint<ClientEntrypoint<string>>(HOME).call({ full: true }) ?? []
|
|
43
|
-
// Returns e.g. "https://app.example.com/"
|
|
22
|
+
const value = await context.entrypoint(projectEntrypoints.create).call({ body })
|
|
23
|
+
const { value, outcome } = await context.entrypoint(projectEntrypoints.create).invoke({ body })
|
|
24
|
+
const href = await context.entrypoint(projectEntrypoints.edit).url({ params: { id } })
|
|
44
25
|
```
|
|
45
26
|
|
|
46
|
-
|
|
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`.
|
|
47
31
|
|
|
48
|
-
|
|
32
|
+
`context.entrypoint(protocol)` derives `ClientProtocolEntrypoint<Protocol>` from the protocol. Do
|
|
33
|
+
not add an explicit result generic. `entrypointRef<Request, Response>(alias)` is reserved for a
|
|
34
|
+
dynamic remote declaration that cannot be imported.
|
|
49
35
|
|
|
50
|
-
|
|
36
|
+
Client calls include only contract request sections plus `CallOptions` (`auth`, host/port/base,
|
|
37
|
+
timeout, signal). `url` accepts params/query plus the same address options. The route transport is
|
|
38
|
+
chosen by the declaration; callers do not branch for HTTP, socket, or queue.
|
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,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AAO,CAAC,OAAO,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QAChD,MAAM,IAAI,WAAW,CAAC,iEAAiE,CAAC,CAAA;IAC1F,CAAC;AACH,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,5 @@
|
|
|
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 './protocol.js';
|
|
4
|
+
export { pickPerSchema, provideRequest, stab } from './helper.js';
|
|
5
5
|
//# 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,
|
|
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,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,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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAEzF,OAAO,KAAK,EACV,uBAAuB,EAAE,wBAAwB,EAAE,sBAAsB,EAC1E,MAAM,YAAY,CAAA;AAEnB,4FAA4F;AAC5F,eAAO,MAAM,IAAI,GAAI,QAAQ,SAAS,6BAA6B,YACvD,QAAQ,YACR,uBAAuB,KAChC,wBAAwB,CAAC,QAAQ,CAQnC,CAAA;AAED,wFAAwF;AACxF,eAAO,MAAM,OAAO,SAAU,cAAc,KAAG,wBAAwB,CAAC,6BAA6B,CAAC,EACrD,CAAA;AAEjD,iEAAiE;AACjE,eAAO,MAAM,UAAU,GAAI,QAAQ,SAAS,6BAA6B,YAC7D,QAAQ,WACT,sBAAsB,YACrB,uBAAuB,KAChC,wBAAwB,CAAC,QAAQ,CAQnC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { materializeEntrypoint, protocols } from '@owlmeans/entrypoint';
|
|
2
|
+
import { bindMaterializedEntrypoint } from './entrypoint.js';
|
|
3
|
+
/** Bind a shared protocol to the client context without changing the declaration itself. */
|
|
4
|
+
export const bind = (protocol, options) => {
|
|
5
|
+
const bound = Object.assign(bindMaterializedEntrypoint(materializeEntrypoint(protocol), undefined, options), { protocol });
|
|
6
|
+
return bound;
|
|
7
|
+
};
|
|
8
|
+
/** Materialize every protocol in an exported declaration tree for a browser context. */
|
|
9
|
+
export const bindAll = (tree) => protocols(tree).map(protocol => bind(protocol));
|
|
10
|
+
/** Bind a frontend protocol to the component that renders it. */
|
|
11
|
+
export const bindScreen = (protocol, handler, options) => {
|
|
12
|
+
const bound = Object.assign(bindMaterializedEntrypoint(materializeEntrypoint(protocol), handler, options), { protocol });
|
|
13
|
+
return bound;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAEvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAK5D,4FAA4F;AAC5F,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,QAAkB,EAClB,OAAiC,EACG,EAAE;IACtC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,0BAA0B,CACpD,qBAAqB,CAAC,QAAQ,CAAC,EAC/B,SAAS,EACT,OAAO,CACR,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;IAEhB,OAAO,KAA2C,CAAA;AACpD,CAAC,CAAA;AAED,wFAAwF;AACxF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAoB,EAA6D,EAAE,CACzG,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEjD,iEAAiE;AACjE,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,QAAkB,EAClB,OAA+B,EAC/B,OAAiC,EACG,EAAE;IACtC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,0BAA0B,CACpD,qBAAqB,CAAC,QAAQ,CAAC,EAC/B,OAAO,EACP,OAAO,CACR,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;IAEhB,OAAO,KAA2C,CAAA;AACpD,CAAC,CAAA"}
|
package/build/types.d.ts
CHANGED
|
@@ -1,33 +1,63 @@
|
|
|
1
1
|
import type { ClientRouteModel, ClientRouteOptions } from '@owlmeans/client-route';
|
|
2
|
-
import type { AbstractRequest,
|
|
2
|
+
import type { AbstractRequest, CommonEntrypoint, CommonEntrypointOptions, EntrypointHandler, EntrypointOutcome, EntrypointProtocolDeclaration, RegisteredEntrypoint, RequestOf } from '@owlmeans/entrypoint';
|
|
3
3
|
export interface ClientEntrypoint<T = {}, R extends ClientRequest = ClientRequest> extends CommonEntrypoint {
|
|
4
4
|
route: ClientRouteModel;
|
|
5
|
+
/**
|
|
6
|
+
* Address the entrypoint and resolve to what it answered. The reply's error is thrown, so a
|
|
7
|
+
* caller that only needs the value never inspects an outcome.
|
|
8
|
+
*/
|
|
5
9
|
call: EntrypointCall<T, R>;
|
|
10
|
+
/**
|
|
11
|
+
* The same round trip as {@link ClientEntrypoint.call}, resolving to the value AND the outcome.
|
|
12
|
+
* Use it only where the outcome decides what happens next.
|
|
13
|
+
*/
|
|
14
|
+
invoke: EntrypointInvoke<T, R>;
|
|
15
|
+
/**
|
|
16
|
+
* Build the URL this entrypoint addresses, with `:params` filled in and the query appended.
|
|
17
|
+
* Absolute when the route belongs to another service, or when `absolute` is asked for.
|
|
18
|
+
*/
|
|
19
|
+
url: EntrypointUrl<R>;
|
|
6
20
|
validate: EntrypointFilter<R>;
|
|
7
|
-
getPath: (partial?: boolean) => string;
|
|
8
21
|
request: (request?: Partial<R>) => R;
|
|
9
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The context-bound client view of a protocol. Unlike the legacy `ClientEntrypoint` generic,
|
|
25
|
+
* its request and reply types are read directly from the declaration and cannot be replaced at a
|
|
26
|
+
* call site.
|
|
27
|
+
*/
|
|
28
|
+
export type ClientProtocolEntrypoint<Protocol extends EntrypointProtocolDeclaration> = Omit<ClientEntrypoint, 'call' | 'invoke' | 'url' | 'validate' | 'request'> & RegisteredEntrypoint<RequestOf<Protocol>, import('@owlmeans/entrypoint').ResponseOf<Protocol>> & {
|
|
29
|
+
readonly protocol: Protocol;
|
|
30
|
+
};
|
|
10
31
|
export interface EntrypointCall<T, Req extends ClientRequest = ClientRequest> {
|
|
11
|
-
<Type extends T, R extends Req = Req
|
|
32
|
+
<Type extends T, R extends Req = Req>(req?: Partial<R>): Promise<Type>;
|
|
33
|
+
}
|
|
34
|
+
export interface EntrypointInvoke<T, Req extends ClientRequest = ClientRequest> {
|
|
35
|
+
<Type extends T, R extends Req = Req>(req?: Partial<R>): Promise<EntrypointReply<Type>>;
|
|
36
|
+
}
|
|
37
|
+
export interface EntrypointReply<T> {
|
|
38
|
+
value: T;
|
|
39
|
+
outcome: EntrypointOutcome;
|
|
40
|
+
}
|
|
41
|
+
export interface EntrypointUrl<Req extends ClientRequest = ClientRequest> {
|
|
42
|
+
<R extends Req = Req>(req?: Partial<R>, opts?: EntrypointUrlOptions): Promise<string>;
|
|
43
|
+
}
|
|
44
|
+
export interface EntrypointUrlOptions {
|
|
45
|
+
/** Force a fully qualified URL even when the route belongs to the current service. */
|
|
46
|
+
absolute?: boolean;
|
|
12
47
|
}
|
|
13
48
|
export interface EntrypointFilter<Req extends AbstractRequest = AbstractRequest> {
|
|
14
49
|
<R extends Req>(req?: Partial<R>): Promise<boolean>;
|
|
15
50
|
}
|
|
16
51
|
export interface ClientRequest<T extends {} = {}> extends AbstractRequest<T> {
|
|
17
|
-
full?: boolean;
|
|
18
52
|
}
|
|
19
53
|
export interface ClientEntrypointOptions extends CommonEntrypointOptions {
|
|
20
|
-
/**
|
|
21
|
-
* Force entrypoint to be elevated even if it is already elevated
|
|
22
|
-
*/
|
|
23
|
-
force?: boolean;
|
|
24
54
|
routeOptions?: ClientRouteOptions;
|
|
25
55
|
validateOnCall?: boolean;
|
|
26
56
|
}
|
|
27
57
|
export interface EntrypointRef<T, R extends AbstractRequest = AbstractRequest> {
|
|
28
58
|
ref?: ClientEntrypoint<T, R>;
|
|
29
59
|
}
|
|
30
|
-
export interface RefedEntrypointHandler<T, R extends AbstractRequest = AbstractRequest> {
|
|
60
|
+
export interface RefedEntrypointHandler<T = {}, R extends AbstractRequest = AbstractRequest> {
|
|
31
61
|
(ref: EntrypointRef<T, R>): EntrypointHandler;
|
|
32
62
|
}
|
|
33
63
|
//# sourceMappingURL=types.d.ts.map
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAClF,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAA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;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,eAAe,GAAG,eAAe;IACzF,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,iBAAiB,CAAA;CAC9C"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type { EntrypointFilter
|
|
1
|
+
import type { EntrypointFilter } from '../types.js';
|
|
2
2
|
import type { AbstractRequest } from '@owlmeans/entrypoint';
|
|
3
|
-
import type { EntrypointRef
|
|
4
|
-
export { entrypoint as makeBasicEntrypoint } from '@owlmeans/entrypoint';
|
|
3
|
+
import type { EntrypointRef } from '../types.js';
|
|
5
4
|
export { isEntrypoint } from '@owlmeans/entrypoint/utils';
|
|
6
5
|
/**
|
|
7
6
|
* @throws {SyntaxError} if data shape doesn't match validation
|
|
8
7
|
* @throws {ClientValidationError} if request is not valid
|
|
9
8
|
*/
|
|
10
9
|
export declare const validate: <T, R extends AbstractRequest = AbstractRequest>(ref: EntrypointRef<T, R>) => EntrypointFilter;
|
|
11
|
-
export declare const normalizeHelperParams: <T, R extends AbstractRequest = AbstractRequest>(handler?: RefedEntrypointHandler<T, R> | ClientEntrypointOptions | boolean, opts?: ClientEntrypointOptions | boolean) => [RefedEntrypointHandler<T, R> | undefined, ClientEntrypointOptions | undefined];
|
|
12
10
|
//# sourceMappingURL=entrypoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoint.d.ts","sourceRoot":"","sources":["../../src/utils/entrypoint.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"entrypoint.d.ts","sourceRoot":"","sources":["../../src/utils/entrypoint.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAKzD;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,SAAS,eAAe,GAAG,eAAe,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,gBAiClG,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Ajv from 'ajv';
|
|
2
2
|
import { ClientValidationError } from '../errors.js';
|
|
3
3
|
import formatsPlugin from 'ajv-formats';
|
|
4
|
-
export { entrypoint as makeBasicEntrypoint } from '@owlmeans/entrypoint';
|
|
5
4
|
export { isEntrypoint } from '@owlmeans/entrypoint/utils';
|
|
6
5
|
const ajv = new Ajv({ strict: false });
|
|
7
6
|
formatsPlugin(ajv);
|
|
@@ -40,12 +39,4 @@ export const validate = (ref) => async (req) => {
|
|
|
40
39
|
}
|
|
41
40
|
return true;
|
|
42
41
|
};
|
|
43
|
-
export const normalizeHelperParams = (handler, opts) => {
|
|
44
|
-
if (typeof handler !== 'function' && handler != null) {
|
|
45
|
-
opts = handler;
|
|
46
|
-
handler = undefined;
|
|
47
|
-
}
|
|
48
|
-
opts = typeof opts === 'boolean' ? { validateOnCall: opts } : opts;
|
|
49
|
-
return [handler, opts];
|
|
50
|
-
};
|
|
51
42
|
//# sourceMappingURL=entrypoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../../src/utils/entrypoint.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AAGrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAGpD,OAAO,aAAa,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../../src/utils/entrypoint.ts"],"names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