@nice-code/action 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -59
- package/build/{ActionDevtoolsCore-baIHExfj.d.mts → ActionDevtoolsCore-CQ0vrvPD.d.cts} +2 -2
- package/build/{ActionDevtoolsCore-dApyYvTS.d.cts → ActionDevtoolsCore-CiLBYC3K.d.mts} +2 -2
- package/build/{ActionPayload.types-CQM1HRw_.d.cts → ActionPayload.types-Dx1JPyfs.d.mts} +133 -30
- package/build/{ActionPayload.types-DXGiw1SF.d.mts → ActionPayload.types-L9k0LyBd.d.cts} +133 -30
- package/build/devtools/browser/index.d.cts +1 -1
- package/build/devtools/browser/index.d.mts +1 -1
- package/build/devtools/server/index.d.cts +1 -1
- package/build/devtools/server/index.d.mts +1 -1
- package/build/httpAcceptorCarrier-DL8lf0xB.mjs +3906 -0
- package/build/httpAcceptorCarrier-DL8lf0xB.mjs.map +1 -0
- package/build/httpAcceptorCarrier-OnJxzsAD.cjs +4291 -0
- package/build/httpAcceptorCarrier-OnJxzsAD.cjs.map +1 -0
- package/build/index.cjs +368 -4139
- package/build/index.cjs.map +1 -1
- package/build/index.d.cts +2 -2
- package/build/index.d.mts +2 -2
- package/build/index.mjs +299 -4069
- package/build/index.mjs.map +1 -1
- package/build/platform/cloudflare/index.cjs +30 -2
- package/build/platform/cloudflare/index.cjs.map +1 -1
- package/build/platform/cloudflare/index.d.cts +55 -2
- package/build/platform/cloudflare/index.d.mts +55 -2
- package/build/platform/cloudflare/index.mjs +28 -2
- package/build/platform/cloudflare/index.mjs.map +1 -1
- package/build/react-query/index.d.cts +1 -1
- package/build/react-query/index.d.mts +1 -1
- package/package.json +4 -4
- package/build/wsAcceptorCarrier-BDJRIPfu.cjs +0 -103
- package/build/wsAcceptorCarrier-BDJRIPfu.cjs.map +0 -1
- package/build/wsAcceptorCarrier-CW2qX25W.mjs +0 -80
- package/build/wsAcceptorCarrier-CW2qX25W.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { INiceErrorDomainProps, InferNiceError, NiceError, NiceErrorDomain, err_cast_not_nice } from "@nice-code/error";
|
|
2
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
3
|
import { RuntimeName } from "std-env";
|
|
3
4
|
import { ClientCryptoKeyLink, StorageAdapter, TSerializedCryptoKeyData_Ed25519_Raw, TSerializedCryptoKeyData_X25519_Raw, TTypeAndId } from "@nice-code/util";
|
|
4
5
|
import * as v from "valibot";
|
|
5
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
6
|
|
|
7
7
|
//#region src/ActionDefinition/Schema/ActionSchema.types.d.ts
|
|
8
8
|
type TTransportedValue<RAW_VAL, SERDE_VAL> = [RAW_VAL] | [RAW_VAL, SERDE_VAL];
|
|
@@ -1529,12 +1529,21 @@ type IAcceptorHandlerOptions<TConn> = IAcceptorHandlerBaseOptions<TConn> & ({
|
|
|
1529
1529
|
formatMessage?: never;
|
|
1530
1530
|
});
|
|
1531
1531
|
/**
|
|
1532
|
-
* A connection-aware execution case (see {@link AcceptorHandler.forConnectionDomainCases}). It
|
|
1533
|
-
*
|
|
1534
|
-
*
|
|
1535
|
-
*
|
|
1532
|
+
* A connection-aware execution case (see {@link AcceptorHandler.forConnectionDomainCases}). It receives
|
|
1533
|
+
* the primed request plus a per-invocation `context` — whatever the wiring's context mapper produces from
|
|
1534
|
+
* the originating connection. The low-level handler passes the raw connection (`TConn | undefined`); the
|
|
1535
|
+
* higher-level `serveChannel` enriches it into an `IConnectionContext` (state + broadcast + pushBack). A
|
|
1536
|
+
* case may return the action's raw output, a result payload, or nothing (auto-wrapped as an empty
|
|
1537
|
+
* success) — exactly like a local handler case.
|
|
1536
1538
|
*/
|
|
1537
|
-
type
|
|
1539
|
+
type TAcceptorCaseFn<DOM extends IActionDomain, ID extends keyof DOM["actionSchema"] & string, TCtx> = (action: TDistributeActionPayload_Request<DOM, ID>, context: TCtx) => ReturnType<THandleActionExecutionFn<DOM, ID>> | void;
|
|
1540
|
+
/**
|
|
1541
|
+
* The connection-aware case the bare {@link AcceptorHandler} serves: its `context` is the originating
|
|
1542
|
+
* client's live connection (resolved from the request's `originClient`, `undefined` if the socket is
|
|
1543
|
+
* gone). It's {@link TAcceptorCaseFn} fixed to `TConn | undefined` — the un-enriched shape used by
|
|
1544
|
+
* {@link AcceptorHandler.forConnectionDomainCases} and `acceptChannelConnections`.
|
|
1545
|
+
*/
|
|
1546
|
+
type TAcceptorConnectionCaseFn<DOM extends IActionDomain, ID extends keyof DOM["actionSchema"] & string, TConn> = TAcceptorCaseFn<DOM, ID, TConn | undefined>;
|
|
1538
1547
|
/**
|
|
1539
1548
|
* Server-side handler for backends that accept many client connections over a single open channel
|
|
1540
1549
|
* (WebSockets, Durable Objects, …). It is transport-agnostic: you feed it inbound frames with
|
|
@@ -1648,11 +1657,15 @@ declare class AcceptorHandler<TConn = unknown> extends PeerLinkHandler {
|
|
|
1648
1657
|
forConnectionDomainCases<FOR_DOM extends IActionDomain>(domain: ActionDomain<FOR_DOM>, cases: { [ID in keyof FOR_DOM["actionSchema"] & string]?: TAcceptorConnectionCaseFn<FOR_DOM, ID, TConn> }): ActionLocalHandler;
|
|
1649
1658
|
/**
|
|
1650
1659
|
* Like {@link forConnectionDomainCases} but spanning several domains with one merged case map — used
|
|
1651
|
-
* by channel-derived wiring (`acceptChannelConnections`) where the channel's
|
|
1652
|
-
* served together. Each domain takes only the cases whose ids it owns, so a
|
|
1653
|
-
* several domains and unrelated ids are ignored.
|
|
1660
|
+
* by channel-derived wiring (`acceptChannelConnections` / `serveChannel`) where the channel's
|
|
1661
|
+
* `toAcceptor` domains are served together. Each domain takes only the cases whose ids it owns, so a
|
|
1662
|
+
* single map can cover several domains and unrelated ids are ignored.
|
|
1663
|
+
*
|
|
1664
|
+
* `mapContext` turns the resolved connection into whatever the case's second argument should be: the
|
|
1665
|
+
* raw connection for the low-level helper, or an enriched `IConnectionContext` for `serveChannel`. It's
|
|
1666
|
+
* called once per inbound action, after the originating connection is resolved.
|
|
1654
1667
|
*/
|
|
1655
|
-
forConnectionDomainCasesMulti(domains: readonly ActionDomain<any>[], cases: Record<string,
|
|
1668
|
+
forConnectionDomainCasesMulti<TCtx>(domains: readonly ActionDomain<any>[], cases: Record<string, TAcceptorCaseFn<any, any, TCtx> | undefined>, mapContext: (connection: TConn | undefined, request: ActionPayload_Request<any, any>) => TCtx): ActionLocalHandler;
|
|
1656
1669
|
/**
|
|
1657
1670
|
* Fan a server-initiated request out to every currently-bound connection. A fresh request is built
|
|
1658
1671
|
* per connection (each push mutates its own action context) and dispatched fire-and-forget. Pass
|
|
@@ -1958,14 +1971,16 @@ interface IConnectChannelOptions<TO_CONNECTOR extends readonly ActionDomain<any>
|
|
|
1958
1971
|
* Returns the {@link ConnectorHandler} so the caller can later `clearTransportCache()` it.
|
|
1959
1972
|
*/
|
|
1960
1973
|
declare function connectChannel<TO_ACCEPTOR extends readonly ActionDomain<any>[], TO_CONNECTOR extends readonly ActionDomain<any>[]>(runtime: ActionRuntime, channel: ISecureChannel<TO_ACCEPTOR, TO_CONNECTOR>, options: IConnectChannelOptions<TO_CONNECTOR>): ConnectorHandler;
|
|
1961
|
-
type TDomainAcceptorCases<D,
|
|
1974
|
+
type TDomainAcceptorCases<D, TCtx> = D extends ActionDomain<infer DEF> ? { [ID in keyof DEF["actionSchema"] & string]?: TAcceptorCaseFn<DEF, ID, TCtx> } : never;
|
|
1962
1975
|
/**
|
|
1963
1976
|
* The connection-aware case map for a channel's acceptor side: the merged set of every
|
|
1964
|
-
* connector→acceptor (`toAcceptor`) action handler, each receiving the primed request plus
|
|
1965
|
-
*
|
|
1966
|
-
*
|
|
1977
|
+
* connector→acceptor (`toAcceptor`) action handler, each receiving the primed request plus a per-action
|
|
1978
|
+
* `context`. `TCtx` is whatever the wiring supplies as that second argument — the raw connection
|
|
1979
|
+
* (`TConn | undefined`) for the low-level `acceptChannelConnections`, or an enriched `IConnectionContext`
|
|
1980
|
+
* for `serveChannel`'s `channelCases`. Derived from the channel's `toAcceptorDomains`, so the keys and
|
|
1981
|
+
* input/output types follow the channel.
|
|
1967
1982
|
*/
|
|
1968
|
-
type TChannelAcceptorCases<TO_ACCEPTOR extends readonly ActionDomain<any>[],
|
|
1983
|
+
type TChannelAcceptorCases<TO_ACCEPTOR extends readonly ActionDomain<any>[], TCtx> = TUnionToIntersection<TDomainAcceptorCases<TO_ACCEPTOR[number], TCtx>>;
|
|
1969
1984
|
/**
|
|
1970
1985
|
* Register an acceptor handler's execution for a channel straight from its definition: the channel's
|
|
1971
1986
|
* `toAcceptor` domains are served together with one merged, connection-aware case map (each case gets
|
|
@@ -1975,8 +1990,11 @@ type TChannelAcceptorCases<TO_ACCEPTOR extends readonly ActionDomain<any>[], TCo
|
|
|
1975
1990
|
* ```ts
|
|
1976
1991
|
* runtime.addHandlers([acceptChannelConnections(serverHandler, channel, { … }), serverHandler]);
|
|
1977
1992
|
* ```
|
|
1993
|
+
*
|
|
1994
|
+
* The case's second argument is the raw connection (`TConn | undefined`). For the richer state +
|
|
1995
|
+
* broadcast + pushBack context, serve the channel through `serveChannel`'s `channelCases` instead.
|
|
1978
1996
|
*/
|
|
1979
|
-
declare function acceptChannelConnections<TO_ACCEPTOR extends readonly ActionDomain<any>[], TConn>(serverHandler: AcceptorHandler<TConn>, channel: IActionChannel<TO_ACCEPTOR, any>, cases: TChannelAcceptorCases<TO_ACCEPTOR, TConn>): ActionLocalHandler;
|
|
1997
|
+
declare function acceptChannelConnections<TO_ACCEPTOR extends readonly ActionDomain<any>[], TConn>(serverHandler: AcceptorHandler<TConn>, channel: IActionChannel<TO_ACCEPTOR, any>, cases: TChannelAcceptorCases<TO_ACCEPTOR, TConn | undefined>): ActionLocalHandler;
|
|
1980
1998
|
interface IAcceptChannelOptions<TConn> {
|
|
1981
1999
|
/**
|
|
1982
2000
|
* Coordinate of the *connecting clients* (typically env-only, e.g. `RuntimeCoordinate.env("web_app")`),
|
|
@@ -2274,6 +2292,43 @@ interface IServeConnectionStateOptions<TApp> {
|
|
|
2274
2292
|
*/
|
|
2275
2293
|
schema?: StandardSchemaV1<unknown, TApp>;
|
|
2276
2294
|
}
|
|
2295
|
+
/**
|
|
2296
|
+
* The per-action handle a `serveChannel` `channelCases` case receives as its second argument — the
|
|
2297
|
+
* originating connection enriched with everything a case typically reaches for, so it never threads
|
|
2298
|
+
* `ws` through `this.connections` / `this.server` by hand:
|
|
2299
|
+
*
|
|
2300
|
+
* - {@link state} / {@link setState} / {@link clearState} — the connection's typed app state (when
|
|
2301
|
+
* `connectionState` is configured), co-stored with the routing binding so it survives hibernation.
|
|
2302
|
+
* - {@link broadcast} — fan a server push to every other connection (skip self with `exceptSelf`).
|
|
2303
|
+
* - {@link pushBack} — push a server-initiated action down *this* same connection.
|
|
2304
|
+
*
|
|
2305
|
+
* Over the HTTP-exchange path there is no live socket: {@link connection} is `null`, {@link state} reads
|
|
2306
|
+
* `null`, {@link setState}/{@link clearState} are no-ops, and {@link pushBack} throws (an exchange reply
|
|
2307
|
+
* rides its own request — it can't carry an unsolicited push).
|
|
2308
|
+
*/
|
|
2309
|
+
interface IConnectionContext<TConn, TApp = unknown> {
|
|
2310
|
+
/** The originating live connection, or `null` on the HTTP-exchange path (escape hatch). */
|
|
2311
|
+
connection: TConn | null;
|
|
2312
|
+
/** The originating client's coordinate (`= action.context.originClient`). */
|
|
2313
|
+
origin: RuntimeCoordinate;
|
|
2314
|
+
/** This connection's app state, or `null` if unset / no live socket. */
|
|
2315
|
+
state: TApp | null;
|
|
2316
|
+
/** Set this connection's app state (no-op without a live socket). Preserves the routing binding. */
|
|
2317
|
+
setState: (value: TApp) => void;
|
|
2318
|
+
/** Clear this connection's app state but keep the routing binding (no-op without a live socket). */
|
|
2319
|
+
clearState: () => void;
|
|
2320
|
+
/** Fan a server-initiated action out to every connection; `exceptSelf` skips this one. */
|
|
2321
|
+
broadcast: <DOM extends IActionDomain, ID extends keyof DOM["actionSchema"] & string>(makeRequest: () => ActionPayload_Request<DOM, ID>, options?: {
|
|
2322
|
+
exceptSelf?: boolean;
|
|
2323
|
+
where?: (connection: TConn) => boolean;
|
|
2324
|
+
timeout?: number;
|
|
2325
|
+
onError?: (error: unknown, connection: TConn) => void;
|
|
2326
|
+
}) => void;
|
|
2327
|
+
/** Push a server-initiated action down this same connection. Throws if there is no live socket. */
|
|
2328
|
+
pushBack: <DOM extends IActionDomain, ID extends keyof DOM["actionSchema"] & string>(request: ActionPayload_Request<DOM, ID>, options?: {
|
|
2329
|
+
timeout?: number;
|
|
2330
|
+
}) => RunningAction<DOM, ID>;
|
|
2331
|
+
}
|
|
2277
2332
|
interface IServeChannelOptions<TO_ACCEPTOR extends readonly ActionDomain<any>[], TConn, TApp = unknown> {
|
|
2278
2333
|
/**
|
|
2279
2334
|
* Coordinate of the *connecting clients* (typically env-only, e.g. `RuntimeCoordinate.env("web_app")`),
|
|
@@ -2320,10 +2375,11 @@ interface IServeChannelOptions<TO_ACCEPTOR extends readonly ActionDomain<any>[],
|
|
|
2320
2375
|
connectionState?: IServeConnectionStateOptions<TApp>;
|
|
2321
2376
|
/**
|
|
2322
2377
|
* Connection-aware action cases for the channel's acceptor (`toAcceptor`) domains — each case receives the
|
|
2323
|
-
* primed request *and*
|
|
2324
|
-
*
|
|
2378
|
+
* primed request *and* an {@link IConnectionContext} (the connection plus its typed `state` and
|
|
2379
|
+
* `broadcast`/`pushBack`). The connection-aware dual of `handlers`, registered on the runtime for you.
|
|
2380
|
+
* Requires exactly one duplex carrier.
|
|
2325
2381
|
*/
|
|
2326
|
-
channelCases?: TChannelAcceptorCases<TO_ACCEPTOR, TConn
|
|
2382
|
+
channelCases?: TChannelAcceptorCases<TO_ACCEPTOR, IConnectionContext<TConn, TApp>>;
|
|
2327
2383
|
}
|
|
2328
2384
|
/**
|
|
2329
2385
|
* One server serving a secure channel over several carriers — the accept-in dual of `connectChannel`,
|
|
@@ -2342,11 +2398,17 @@ interface IChannelServer<TConn, TApp = unknown> {
|
|
|
2342
2398
|
*/
|
|
2343
2399
|
fetch: (request: Request) => Promise<Response>;
|
|
2344
2400
|
/**
|
|
2345
|
-
*
|
|
2346
|
-
*
|
|
2347
|
-
*
|
|
2401
|
+
* Feed one inbound frame from a live connection into the server — forward your host's "message" event
|
|
2402
|
+
* here (a Durable Object's `webSocketMessage`, a Bun `websocket.message`, a Node `ws.on("message")`).
|
|
2403
|
+
* Routes to the sole duplex carrier; throws with a clear message when there are zero or several duplex
|
|
2404
|
+
* carriers (for the multi-carrier case feed each `handlers[i]` / carrier handle directly).
|
|
2348
2405
|
*/
|
|
2349
|
-
|
|
2406
|
+
receive: (connection: TConn, frame: string | Uint8Array | ArrayBuffer) => void;
|
|
2407
|
+
/**
|
|
2408
|
+
* Forget a connection on close/error — forward your host's "close"/"error" event here. Routes to the
|
|
2409
|
+
* sole duplex carrier; a no-op when there are none (an HTTP-only server has no sockets to drop).
|
|
2410
|
+
*/
|
|
2411
|
+
drop: (connection: TConn) => void;
|
|
2350
2412
|
/**
|
|
2351
2413
|
* Push a server-initiated action to a connected client (the runtime is bound in, so unlike
|
|
2352
2414
|
* {@link AcceptorHandler.pushToClient} you pass only the target + request). It routes through the duplex
|
|
@@ -2380,21 +2442,24 @@ interface IChannelServer<TConn, TApp = unknown> {
|
|
|
2380
2442
|
* `(runtime, channel)` and fans them across every carrier, so the WebSocket and the secure-HTTP endpoint
|
|
2381
2443
|
* can never drift apart. It registers your handlers (plus the duplex acceptor it builds) on the runtime,
|
|
2382
2444
|
* wires hibernation when the duplex carrier exposes an attachment store, and returns a single
|
|
2383
|
-
* {@link IChannelServer} whose `fetch` / `
|
|
2384
|
-
* the host:
|
|
2445
|
+
* {@link IChannelServer} whose `fetch` / `receive` / `drop` / `pushToClient` / `broadcast` you forward
|
|
2446
|
+
* straight to the host:
|
|
2385
2447
|
* ```ts
|
|
2386
2448
|
* const server = serveChannel(runtime, channel, {
|
|
2387
2449
|
* clientEnv, storage,
|
|
2388
2450
|
* carriers: [wsAcceptorCarrier({ send, upgrade, attachmentStore }), httpAcceptorCarrier()],
|
|
2389
2451
|
* connectionState: { schema: vs_player }, // optional: co-store per-connection app state (survives hibernation)
|
|
2390
|
-
* channelCases: { join: (action, conn) => { … } }, //
|
|
2452
|
+
* channelCases: { join: (action, conn) => { conn.setState(action.input); … } }, // connection-aware cases
|
|
2391
2453
|
* });
|
|
2392
2454
|
* // fetch(req) => server.fetch(req)
|
|
2393
|
-
* // webSocketMessage(conn, m) => server.
|
|
2394
|
-
* // webSocketClose/Error(conn) => server.
|
|
2455
|
+
* // webSocketMessage(conn, m) => server.receive(conn, m)
|
|
2456
|
+
* // webSocketClose/Error(conn) => server.drop(conn)
|
|
2395
2457
|
* // server.connections.get(conn) / server.broadcast(() => push.request(…), { except: conn })
|
|
2396
2458
|
* ```
|
|
2397
2459
|
*
|
|
2460
|
+
* On Cloudflare, `serveDurableObject` folds the whole DO transport stack (carriers + storage + keepalive)
|
|
2461
|
+
* into this — reach for it instead of assembling the carriers by hand.
|
|
2462
|
+
*
|
|
2398
2463
|
* `TConn` (the live-connection token a duplex carrier hands back through `send`/`receive`/`drop`) is
|
|
2399
2464
|
* inferred from the carriers — `WebSocket` for `wsAcceptorCarrier`, the data-channel type for a WebRTC
|
|
2400
2465
|
* carrier, and so on — so it stays carrier-agnostic. Passing `connectionState` narrows the return so
|
|
@@ -2407,6 +2472,44 @@ declare function serveChannel<TO_ACCEPTOR extends readonly ActionDomain<any>[],
|
|
|
2407
2472
|
};
|
|
2408
2473
|
declare function serveChannel<TO_ACCEPTOR extends readonly ActionDomain<any>[] = readonly ActionDomain<any>[], TO_CONNECTOR extends readonly ActionDomain<any>[] = readonly ActionDomain<any>[], TConn = unknown, TApp = unknown>(runtime: ActionRuntime, channel: ISecureChannel<TO_ACCEPTOR, TO_CONNECTOR>, options: IServeChannelOptions<TO_ACCEPTOR, TConn, TApp>): IChannelServer<TConn, TApp>;
|
|
2409
2474
|
//#endregion
|
|
2475
|
+
//#region src/ActionRuntime/Channel/serveHost.d.ts
|
|
2476
|
+
/**
|
|
2477
|
+
* An environment-neutral description of *where* a channel is served — the accept-in dual of a connector's
|
|
2478
|
+
* transport stack, factored out so a platform adapter (a Cloudflare Durable Object, a Bun/Node WebSocket
|
|
2479
|
+
* server, …) supplies only what differs per environment while the channel + case wiring stays identical.
|
|
2480
|
+
* A host bundles:
|
|
2481
|
+
*
|
|
2482
|
+
* - the {@link carriers} the channel is served over (e.g. a WebSocket + an HTTP fallback),
|
|
2483
|
+
* - the {@link storage} backing the server's crypto identity, and
|
|
2484
|
+
* - an {@link onServed} hook run once the server exists (e.g. registering a keepalive auto-response).
|
|
2485
|
+
*
|
|
2486
|
+
* Build one with a platform helper (`cloudflareDurableObjectHost`) and hand it to {@link serveHost}.
|
|
2487
|
+
*/
|
|
2488
|
+
interface IChannelHostAdapter<TConn> {
|
|
2489
|
+
/** The carriers this channel is served over — the accept-in dual of `connectChannel`'s `transports`. */
|
|
2490
|
+
carriers: readonly TAcceptorCarrier<TConn>[];
|
|
2491
|
+
/** Backing store for the server's crypto identity + TOFU pins. Required when any carrier is secure. */
|
|
2492
|
+
storage?: StorageAdapter;
|
|
2493
|
+
/** Run once after the server is built — e.g. register a transport keepalive. */
|
|
2494
|
+
onServed?: (server: IChannelServer<TConn, unknown>) => void;
|
|
2495
|
+
}
|
|
2496
|
+
/** {@link serveChannel}'s options minus what the host adapter supplies (`carriers`, `storage`). */
|
|
2497
|
+
type TServeHostOptions<TO_ACCEPTOR extends readonly ActionDomain<any>[], TConn, TApp = unknown> = Omit<IServeChannelOptions<TO_ACCEPTOR, TConn, TApp>, "carriers" | "storage">;
|
|
2498
|
+
/**
|
|
2499
|
+
* Serve a channel over a {@link IChannelHostAdapter} — the environment-neutral core every platform helper
|
|
2500
|
+
* (e.g. `serveDurableObject`) composes. It folds the host's carriers + storage into `serveChannel`, then
|
|
2501
|
+
* runs the host's `onServed` hook. Everything else (`clientEnv`, `channelCases`, `connectionState`,
|
|
2502
|
+
* `handlers`, …) is the same `serveChannel` surface, so moving a server between environments is swapping
|
|
2503
|
+
* the host adapter and nothing else. Passing `connectionState` narrows the return so `server.connections`
|
|
2504
|
+
* is non-optional, exactly as with `serveChannel`.
|
|
2505
|
+
*/
|
|
2506
|
+
declare function serveHost<TO_ACCEPTOR extends readonly ActionDomain<any>[], TO_CONNECTOR extends readonly ActionDomain<any>[], TConn, TApp>(runtime: ActionRuntime, channel: ISecureChannel<TO_ACCEPTOR, TO_CONNECTOR>, host: IChannelHostAdapter<TConn>, options: TServeHostOptions<TO_ACCEPTOR, TConn, TApp> & {
|
|
2507
|
+
connectionState: IServeConnectionStateOptions<TApp>;
|
|
2508
|
+
}): IChannelServer<TConn, TApp> & {
|
|
2509
|
+
connections: ConnectionStateStore<TConn, TApp>;
|
|
2510
|
+
};
|
|
2511
|
+
declare function serveHost<TO_ACCEPTOR extends readonly ActionDomain<any>[] = readonly ActionDomain<any>[], TO_CONNECTOR extends readonly ActionDomain<any>[] = readonly ActionDomain<any>[], TConn = unknown, TApp = unknown>(runtime: ActionRuntime, channel: ISecureChannel<TO_ACCEPTOR, TO_CONNECTOR>, host: IChannelHostAdapter<TConn>, options: TServeHostOptions<TO_ACCEPTOR, TConn, TApp>): IChannelServer<TConn, TApp>;
|
|
2512
|
+
//#endregion
|
|
2410
2513
|
//#region src/ActionRuntime/Transport/SecureSession/exchangeAcceptor.d.ts
|
|
2411
2514
|
/** Acceptor secure config for the exchange (HTTP) endpoint — same identity an `AcceptorHandler` uses. */
|
|
2412
2515
|
interface IExchangeAcceptorSecurity {
|
|
@@ -3264,5 +3367,5 @@ interface IActionPayload_Result_JsonObject<DOM extends IActionDomain = IActionDo
|
|
|
3264
3367
|
type TActionPayload_Any_Instance<DOM extends IActionDomain = IActionDomain, ID extends keyof DOM["actionSchema"] & string = keyof DOM["actionSchema"] & string> = ActionPayload_Request<DOM, ID> | ActionPayload_Result<DOM, ID> | ActionPayload_Progress<DOM, ID>;
|
|
3265
3368
|
type TActionPayload_Any_JsonObject<DOM extends IActionDomain = IActionDomain, ID extends keyof DOM["actionSchema"] & string = keyof DOM["actionSchema"] & string> = IActionPayload_Request_JsonObject<DOM, ID> | IActionPayload_Progress_JsonObject<DOM, ID> | IActionPayload_Result_JsonObject<DOM, ID>;
|
|
3266
3369
|
//#endregion
|
|
3267
|
-
export { wsAcceptorCarrier as $,
|
|
3268
|
-
//# sourceMappingURL=ActionPayload.types-
|
|
3370
|
+
export { wsAcceptorCarrier as $, TTransportStatusInfo_GetTransport_Output as $n, TPossibleDomainId as $r, IDuplexCarrier as $t, encodeExchange as A, ITransportDispatchAction as An, ERunningActionUpdateType as Ar, TAcceptorCarrier as At, IActionFrameCrypto as B, IUpdateActionRunConfig_Output as Bn, IRuntimeCoordinateSpecifics as Br, IActionChannel as Bt, decodeActionFrame as C, IActionTransportDef as Cn, RunningAction as Cr, IConnectionContext as Ct, TExchangeRequest as D, IActionTransportReadyData_Methods as Dn, IActionCore_JsonObject as Dr, IAcceptorAttachmentStore as Dt, TExchangeReply as E, IActionTransportReadyData_Base as En, IActionCore as Er, serveChannel as Et, EErrId_NiceTransport as F, ITransportStatusInfo_Base as Fn, TRunningActionUpdate as Fr, ConnectionStateStore as Ft, IHttpCarrierRequest as G, TOnResolveIncomingRequestJson as Gn, IActionDomain as Gr, acceptChannel as Gt, createActionFrameCrypto as H, TOnResolveAnyIncomingActionData as Hn, RuntimeCoordinate as Hr, IConnectTransport as Ht, err_nice_transport as I, ITransportStatusInfo_Failed as In, TRunningActionUpdateFinished as Ir, IConnectionAttachment as It, IHttpAcceptorCarrierOptions as J, TSendActionDataMethod as Jn, TActionDomainChildDef as Jr, defineChannel as Jt, TCarrierFetch as K, TOnResolveIncomingResponse as Kn, IActionDomainChildOptions as Kr, acceptChannelConnections as Kt, ExchangeTransport as L, ITransportStatusInfo_Initializing as Ln, TRunningActionUpdateListener as Lr, IConnectionStateStoreOptions as Lt, LinkTransport as M, ITransportRouteActionParams as Mn, IRunningActionUpdate_Progress as Mr, IDuplexConnectionRouter as Mt, IActionTransportReadyData_Link as N, ITransportRouteClientParams as Nn, IRunningActionUpdate_Started as Nr, IHibernatableWsServerAdapterOptions as Nt, decodeExchangeReply as O, IActionTransportResolvers as On, ERunningActionFinishedType as Or, IDuplexAcceptorCarrier as Ot, TLinkFormatMessage as P, ITransportRouteInfo as Pn, IRunningActionUpdate_Success as Pr, createHibernatableWsServerAdapter as Pt, IWsAcceptorCarrierOptions as Q, TTransportStatusInfo as Qn, TInferOutputFromSchema as Qr, createBinaryWireSessionFactory as Qt, IExchangeTransportOptions as R, ITransportStatusInfo_Ready as Rn, ActionPayload_Result as Rr, createConnectionStateStore as Rt, IActionFrameDecoder as S, ETransportStatus as Sn, MaybePromise as Sr, IChannelServer as St, err_nice_action as T, IActionTransportReady as Tn, ActionPayload_Request as Tr, IServeConnectionStateOptions as Tt, createBinaryWireAdapter as U, TOnResolveAnyIncomingActionData_Json as Un, TRuntimeCoordinateEnvId as Ur, TChannelAcceptorCases as Ut, IActionFrameCryptoConfig as V, TGetTransportFn as Vn, IRuntimeFullCoordinates as Vr, IConnectChannelOptions as Vt, IHttpCarrierOptions as W, TOnResolveIncomingRequest as Wn, TRuntimeCoordinateStringId as Wr, TChannelPushHandlers as Wt, IWsCarrierOptions as X, TTransportCache as Xn, TDomainActionId as Xr, defineSecureChannel as Xt, httpAcceptorCarrier as Y, TSendReturnDataMethod as Yn, TActionDomainSchema as Yr, ISecureChannel as Yt, wsCarrier as Z, TTransportInitializationFinishedInfo as Zn, TInferInputFromSchema as Zr, IBinaryWireSessionOptions as Zt, TActionProgress as _, ActionRootDomain as _n, encodeHandshakeMessage as _r, IExchangeAcceptorConfig as _t, IActionPayload_Data_Base as a, TActionSchemaOptions as ai, AcceptorHandler as an, IClientHandshakeConfig as ar, rtcDataChannelByteChannel as at, isActionPayload_Request_JsonObject as b, createConnectorHandler as bn, ActionLocalHandler as br, TServeHostOptions as bt, IActionPayload_Request_JsonObject as c, TAcceptorCaseFn as cn, IHandshakeEncryptionKeyMaterial as cr, IInMemoryChannelPair as ct, IActionProgress_Custom as d, TActionConnectionEncoding as dn, THandshakeMessage as dr, err_nice_external_client as dt, TPossibleDomainIdList as ei, IDuplexCarrierSource as en, TUpdateActionRunConfig as er, EErrId_NiceTransport_WebSocket as et, IActionProgress_None as f, createAcceptorHandler as fn, createClientHandshake as fr, ISecureAcceptorHandlerOptions as ft, TActionPayload_Any_JsonObject as g, ActionDomain as gn, decodeHandshakeMessage as gr, ExchangeAcceptor as gt, TActionPayload_Any_Instance as h, ActionCore as hn, createStorageTofuVerifyKeyResolver as hr, createActionFetchHandler as ht, IActionPayload_Base_JsonObject as i, actionSchema as ii, TFrame$1 as in, ESecurityLevel as ir, IRtcDataChannelLike as it, ILinkTransportOptions as j, ITransportMethod_SendActionData_Input as jn, IRunningActionUpdate_Abort as jr, isExchangeAcceptorCarrier as jt, decodeExchangeRequest as k, ISecureClientConfig as kn, ERunningActionState as kr, IExchangeAcceptorCarrier as kt, IActionPayload_Result as l, TAcceptorConnectionCaseFn as ln, IHandshakeResult as lr, IInMemoryServerEndpoint as lt, IActionRouteItemHandler as m, createActionRootDomain as mn, createServerHandshake as mr, IActionFetchHandlerOptions as mt, EActionProgressType as n, EActionResponseMode as ni, IExchangeCarrierSource as nn, Transport as nr, IRtcCarrierOptions as nt, IActionPayload_Progress as o, TActionSerializationDefinition as oi, IAcceptorConnectionBinding as on, IClientVerifyKeyResolveInput as or, IInMemoryCarrier as ot, IActionProgress_Percentage as p, IActionWireFormat as pn, createInMemoryTofuVerifyKeyResolver as pr, createSecureAcceptorHandler as pt, httpCarrier as q, TOnResolveIncomingResponseJson as qn, IActionRootDomain as qr, connectChannel as qt, IActionPayload_Base as r, TInferActionError as ri, TCarrier as rn, EHandshakeMessageType as rr, rtcCarrier as rt, IActionPayload_Progress_JsonObject as s, TTransportedValue as si, IAcceptorHandlerOptions as sn, IClientVerifyKeyResolver as sr, inMemoryCarrier as st, EActionPayloadType as t, ActionSchema as ti, IExchangeCarrier as tn, ITransportConnectionContext as tr, err_nice_transport_ws as tt, IActionPayload_Result_JsonObject as u, TActionChannelFormatMessage as un, IServerHandshakeConfig as ur, createInMemoryChannelPair as ut, TActionResultOutcome as v, ActionRuntime as vn, runtimeLinkId as vr, IExchangeAcceptorSecurity as vt, EErrId_NiceAction as w, IActionTransportInitialized as wn, ActionPayload_Progress as wr, IServeChannelOptions as wt, isActionPayload_Any_JsonObject as x, ETransportShape as xn, createLocalHandler as xr, serveHost as xt, isActionPayload_Result_JsonObject as y, ConnectorHandler as yn, PeerLinkHandler as yr, IChannelHostAdapter as yt, IActionTransportReadyData_Exchange as z, ITransportStatusInfo_Unsupported as zn, IRuntimeCoordinate as zr, IAcceptChannelOptions as zt };
|
|
3371
|
+
//# sourceMappingURL=ActionPayload.types-L9k0LyBd.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as TDevtoolsActionStatus, i as IDevtoolsObservableDomain, n as IActionDevtoolsCoreOptions, o as TDevtoolsListener, r as IDevtoolsActionEntry, s as TDevtoolsPosition, t as ActionDevtoolsCore } from "../../ActionDevtoolsCore-
|
|
1
|
+
import { a as TDevtoolsActionStatus, i as IDevtoolsObservableDomain, n as IActionDevtoolsCoreOptions, o as TDevtoolsListener, r as IDevtoolsActionEntry, s as TDevtoolsPosition, t as ActionDevtoolsCore } from "../../ActionDevtoolsCore-CQ0vrvPD.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/devtools/browser/NiceActionDevtools.d.ts
|
|
4
4
|
interface INiceActionDevtoolsProps {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as TDevtoolsActionStatus, i as IDevtoolsObservableDomain, n as IActionDevtoolsCoreOptions, o as TDevtoolsListener, r as IDevtoolsActionEntry, s as TDevtoolsPosition, t as ActionDevtoolsCore } from "../../ActionDevtoolsCore-
|
|
1
|
+
import { a as TDevtoolsActionStatus, i as IDevtoolsObservableDomain, n as IActionDevtoolsCoreOptions, o as TDevtoolsListener, r as IDevtoolsActionEntry, s as TDevtoolsPosition, t as ActionDevtoolsCore } from "../../ActionDevtoolsCore-CiLBYC3K.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/devtools/browser/NiceActionDevtools.d.ts
|
|
4
4
|
interface INiceActionDevtoolsProps {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as TDevtoolsActionStatus, i as IDevtoolsObservableDomain, n as IActionDevtoolsCoreOptions, o as TDevtoolsListener, r as IDevtoolsActionEntry, t as ActionDevtoolsCore } from "../../ActionDevtoolsCore-
|
|
1
|
+
import { a as TDevtoolsActionStatus, i as IDevtoolsObservableDomain, n as IActionDevtoolsCoreOptions, o as TDevtoolsListener, r as IDevtoolsActionEntry, t as ActionDevtoolsCore } from "../../ActionDevtoolsCore-CQ0vrvPD.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/devtools/server/NiceActionServerDevtools.d.ts
|
|
4
4
|
type TServerDevtoolsLogFn = (message: string, data?: Record<string, unknown>) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as TDevtoolsActionStatus, i as IDevtoolsObservableDomain, n as IActionDevtoolsCoreOptions, o as TDevtoolsListener, r as IDevtoolsActionEntry, t as ActionDevtoolsCore } from "../../ActionDevtoolsCore-
|
|
1
|
+
import { a as TDevtoolsActionStatus, i as IDevtoolsObservableDomain, n as IActionDevtoolsCoreOptions, o as TDevtoolsListener, r as IDevtoolsActionEntry, t as ActionDevtoolsCore } from "../../ActionDevtoolsCore-CiLBYC3K.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/devtools/server/NiceActionServerDevtools.d.ts
|
|
4
4
|
type TServerDevtoolsLogFn = (message: string, data?: Record<string, unknown>) => void;
|