@nice-code/action 0.20.0 → 0.21.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 +49 -50
- package/build/{ActionDevtoolsCore-D_JvgPmz.d.mts → ActionDevtoolsCore-baIHExfj.d.mts} +2 -2
- package/build/{ActionDevtoolsCore-dV-IVPcP.d.cts → ActionDevtoolsCore-dApyYvTS.d.cts} +2 -2
- package/build/{ActionPayload.types-CnfWlkA1.d.cts → ActionPayload.types-CQM1HRw_.d.cts} +161 -194
- package/build/{ActionPayload.types-D0DM-g65.d.mts → ActionPayload.types-DXGiw1SF.d.mts} +161 -194
- 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/index.cjs +1763 -1722
- 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 +1764 -1721
- package/build/index.mjs.map +1 -1
- package/build/platform/cloudflare/index.d.cts +1 -1
- package/build/platform/cloudflare/index.d.mts +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
|
@@ -1283,16 +1283,16 @@ declare class ActionRuntime {
|
|
|
1283
1283
|
*/
|
|
1284
1284
|
addHandlers(handlers: TActionRuntimeHandler[]): this;
|
|
1285
1285
|
/**
|
|
1286
|
+
* @internal Low-level primitive — the public way to open a connection is `connectChannel`, which
|
|
1287
|
+
* derives routing from a channel and binds the crypto identity for you. This stays as the raw building
|
|
1288
|
+
* block it sits on (it restates domain lists by hand) and is not part of the supported surface.
|
|
1289
|
+
*
|
|
1286
1290
|
* Declare an external "backend client" in one call: build an
|
|
1287
1291
|
* {@link ConnectorHandler} for `externalCoordinate` carrying the given
|
|
1288
1292
|
* `transports`, route the listed `domains`/`actions` to it, register it (plus any
|
|
1289
1293
|
* `localHandlers` — e.g. server→client push handlers that share the same channel)
|
|
1290
1294
|
* on this runtime, and `apply()`. Returns the external handler so the caller can
|
|
1291
1295
|
* later `clearTransportCache()` it.
|
|
1292
|
-
*
|
|
1293
|
-
* Sugar over `new ConnectorHandler(...).forDomain(...)` + `addHandlers([...])`,
|
|
1294
|
-
* so a single runtime can host one handler per backend target with its transports
|
|
1295
|
-
* declared once and reused across every action routed to that backend.
|
|
1296
1296
|
*/
|
|
1297
1297
|
connectTo(externalCoordinate: RuntimeCoordinate, options: {
|
|
1298
1298
|
transports: Transport[];
|
|
@@ -1679,6 +1679,97 @@ declare class AcceptorHandler<TConn = unknown> extends PeerLinkHandler {
|
|
|
1679
1679
|
}
|
|
1680
1680
|
declare const createAcceptorHandler: <TConn = unknown>(options: IAcceptorHandlerOptions<TConn>) => AcceptorHandler<TConn>;
|
|
1681
1681
|
//#endregion
|
|
1682
|
+
//#region src/ActionRuntime/Transport/Carrier/Carrier.types.d.ts
|
|
1683
|
+
/**
|
|
1684
|
+
* Carrier shapes — the only transport-specific surface a new protocol must implement. The secure
|
|
1685
|
+
* session (handshake + frame crypto + codec) and the action routing on top of it are carrier-agnostic;
|
|
1686
|
+
* a carrier just moves frames. Two shapes capture every carrier:
|
|
1687
|
+
*
|
|
1688
|
+
* - {@link IDuplexCarrier} — a persistent, push-capable byte stream (WebSocket, WebRTC `RTCDataChannel`,
|
|
1689
|
+
* Bluetooth GATT, an in-memory pipe). Either side can send at any time, so it supports server→client
|
|
1690
|
+
* pushes (the return path + broadcast).
|
|
1691
|
+
* - {@link IExchangeCarrier} — a request → single-correlated-reply carrier with no unsolicited push
|
|
1692
|
+
* (HTTP, and anything request/response-shaped). The reply rides the response to its own request.
|
|
1693
|
+
*
|
|
1694
|
+
* Frames are `string` (text — handshake control messages and JSON action frames) or binary
|
|
1695
|
+
* (`Uint8Array`/`ArrayBuffer` — the optimized binary wire / encrypted frames).
|
|
1696
|
+
*/
|
|
1697
|
+
type TFrame$1 = string | Uint8Array | ArrayBuffer;
|
|
1698
|
+
/**
|
|
1699
|
+
* A bidirectional, push-capable byte stream. Reduces every duplex carrier to "open, send bytes, receive
|
|
1700
|
+
* bytes, close" — a WebSocket, a WebRTC data channel, a Bluetooth characteristic, or an in-memory pipe
|
|
1701
|
+
* all satisfy this, so the identical secure session runs over each.
|
|
1702
|
+
*/
|
|
1703
|
+
interface IDuplexCarrier {
|
|
1704
|
+
/** Resolves once the carrier is open and ready to send; rejects if it closes/errors before opening. */
|
|
1705
|
+
readonly ready: Promise<void>;
|
|
1706
|
+
/** Whether the carrier is currently open (a synchronous guard before `send`). */
|
|
1707
|
+
isOpen(): boolean;
|
|
1708
|
+
/** Write one frame to the peer. */
|
|
1709
|
+
send(frame: TFrame$1): void;
|
|
1710
|
+
/**
|
|
1711
|
+
* Register the carrier's handlers. Called exactly once by the session after `ready`. `onMessage`
|
|
1712
|
+
* receives every inbound frame; `onClose` fires when the carrier goes away.
|
|
1713
|
+
*/
|
|
1714
|
+
attach(handlers: {
|
|
1715
|
+
onMessage: (frame: TFrame$1) => void;
|
|
1716
|
+
onClose: () => void;
|
|
1717
|
+
onError?: (error: unknown) => void;
|
|
1718
|
+
}): void;
|
|
1719
|
+
/** Close the carrier deliberately (a teardown). */
|
|
1720
|
+
close(): void;
|
|
1721
|
+
/** Optional human-readable endpoint for the devtools route chip. */
|
|
1722
|
+
readonly label?: string;
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* A request → single-correlated-reply carrier with no unsolicited push (HTTP). One `exchange` sends a
|
|
1726
|
+
* frame and resolves with exactly the one reply frame for it; the carrier itself correlates them (the
|
|
1727
|
+
* HTTP transaction), so no correlation id is needed on the wire.
|
|
1728
|
+
*/
|
|
1729
|
+
interface IExchangeCarrier {
|
|
1730
|
+
/** Send one frame, await the single correlated reply frame. */
|
|
1731
|
+
exchange(frame: TFrame$1, opts?: {
|
|
1732
|
+
signal?: AbortSignal;
|
|
1733
|
+
}): Promise<TFrame$1>;
|
|
1734
|
+
/** Optional human-readable endpoint for the devtools route chip. */
|
|
1735
|
+
readonly label?: string;
|
|
1736
|
+
}
|
|
1737
|
+
type TCarrier = IDuplexCarrier | IExchangeCarrier;
|
|
1738
|
+
/**
|
|
1739
|
+
* A reusable opener for a {@link IDuplexCarrier} plus the per-action metadata a duplex transport needs.
|
|
1740
|
+
* Built by the small carrier factories (`wsCarrier`, `rtcCarrier`, `inMemoryCarrier`) and handed to
|
|
1741
|
+
* {@link secureTransport} / `LinkTransport` — so adding a new carrier is "write one of these", nothing
|
|
1742
|
+
* else.
|
|
1743
|
+
*/
|
|
1744
|
+
interface IDuplexCarrierSource {
|
|
1745
|
+
/** Open (or reuse) the carrier for an action. */
|
|
1746
|
+
open: (input: ITransportRouteActionParams) => IDuplexCarrier;
|
|
1747
|
+
/** Keys identifying a reusable carrier, so one carrier is shared across actions to the same peer. */
|
|
1748
|
+
getCacheKey?: (input: ITransportRouteActionParams) => string[];
|
|
1749
|
+
/** Devtools route info for an action routed over this carrier. */
|
|
1750
|
+
getRouteInfo?: (input: ITransportRouteActionParams) => ITransportRouteInfo;
|
|
1751
|
+
/** Short carrier-kind label for the devtools chip (e.g. `"ws"`, `"webrtc"`, `"memory"`). */
|
|
1752
|
+
readonly carrierLabel: string;
|
|
1753
|
+
}
|
|
1754
|
+
/**
|
|
1755
|
+
* The exchange-shape counterpart to {@link IDuplexCarrierSource}: a reusable opener for an
|
|
1756
|
+
* {@link IExchangeCarrier} plus the per-action metadata an exchange transport needs. Built by
|
|
1757
|
+
* `httpCarrier` and handed to {@link secureTransport} — adding a new request/reply protocol is "write
|
|
1758
|
+
* one of these". The `shape` tag lets {@link secureTransport} pick the duplex vs exchange transport.
|
|
1759
|
+
*/
|
|
1760
|
+
interface IExchangeCarrierSource {
|
|
1761
|
+
/** Discriminant so a generic factory can tell an exchange source from a duplex one. */
|
|
1762
|
+
readonly shape: "exchange";
|
|
1763
|
+
/** Open (or reuse) the carrier for an action. */
|
|
1764
|
+
open: (input: ITransportRouteActionParams) => IExchangeCarrier;
|
|
1765
|
+
/** Keys identifying a reusable carrier, so one carrier is shared across actions to the same peer. */
|
|
1766
|
+
getCacheKey?: (input: ITransportRouteActionParams) => string[];
|
|
1767
|
+
/** Devtools route info for an action routed over this carrier. */
|
|
1768
|
+
getRouteInfo?: (input: ITransportRouteActionParams) => ITransportRouteInfo;
|
|
1769
|
+
/** Short carrier-kind label for the devtools chip (e.g. `"http"`). */
|
|
1770
|
+
readonly carrierLabel: string;
|
|
1771
|
+
}
|
|
1772
|
+
//#endregion
|
|
1682
1773
|
//#region src/ActionRuntime/Transport/codec/createBinaryWireSessionFactory.d.ts
|
|
1683
1774
|
type TFormatMessage = IActionWireFormat;
|
|
1684
1775
|
interface IBinaryWireSessionOptions {
|
|
@@ -1794,32 +1885,79 @@ type TDomainPushHandlers<D> = D extends ActionDomain<infer DEF> ? Partial<TWrapp
|
|
|
1794
1885
|
* the keys and input types follow the channel definition.
|
|
1795
1886
|
*/
|
|
1796
1887
|
type TChannelPushHandlers<TO_CONNECTOR extends readonly ActionDomain<any>[]> = TUnionToIntersection<TDomainPushHandlers<TO_CONNECTOR[number]>>;
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1888
|
+
/**
|
|
1889
|
+
* One transport to the peer, declared by *carrier* — the dial-out dual of `serveChannel`'s acceptor
|
|
1890
|
+
* carriers. {@link connectChannel} binds the shared facts (channel codec/version, runtime, crypto
|
|
1891
|
+
* identity) into each one, so a descriptor only carries what differs between transports: the carrier and
|
|
1892
|
+
* whether it runs the secure handshake.
|
|
1893
|
+
*
|
|
1894
|
+
* A duplex carrier (`wsCarrier(url)`, `rtcCarrier(dc)`) builds a push-capable link; an exchange carrier
|
|
1895
|
+
* (`httpCarrier(...)`) builds a request/reply transport. List them in preference order — the connection
|
|
1896
|
+
* prefers the first that's ready and falls through on failure (e.g. secure WS preferred, HTTP fallback).
|
|
1897
|
+
*/
|
|
1898
|
+
interface IConnectTransport {
|
|
1899
|
+
/** How to reach the peer — a duplex carrier (push-capable) or an exchange carrier (request/reply). */
|
|
1900
|
+
carrier: IDuplexCarrierSource | IExchangeCarrierSource;
|
|
1800
1901
|
/**
|
|
1801
|
-
*
|
|
1802
|
-
*
|
|
1803
|
-
*
|
|
1902
|
+
* Run the authenticated/encrypted handshake over this carrier. Defaults to `true`. A secure transport
|
|
1903
|
+
* draws its identity from the connection's shared `link`/`storage`; set `false` for a plain transport
|
|
1904
|
+
* (e.g. a bare HTTP fallback beside a secure WS), which then needs no `storage`.
|
|
1804
1905
|
*/
|
|
1805
|
-
|
|
1906
|
+
secure?: boolean;
|
|
1907
|
+
/** Security level for this secure transport; defaults to the connection-level `securityLevel`. */
|
|
1908
|
+
securityLevel?: ESecurityLevel;
|
|
1909
|
+
/**
|
|
1910
|
+
* Optional availability gate — when it returns `false` this transport is skipped and the connection
|
|
1911
|
+
* falls through to the next in preference order, re-evaluated per dispatch. Omit = always available.
|
|
1912
|
+
*/
|
|
1913
|
+
available?: (input: ITransportRouteActionParams) => boolean;
|
|
1914
|
+
/** Override the devtools chip label (defaults to the carrier's own label). */
|
|
1915
|
+
label?: string;
|
|
1916
|
+
}
|
|
1917
|
+
interface IConnectChannelOptions<TO_CONNECTOR extends readonly ActionDomain<any>[]> {
|
|
1918
|
+
/** The peer's runtime coordinate — the acceptor this connection dials. */
|
|
1919
|
+
peer: RuntimeCoordinate;
|
|
1920
|
+
/**
|
|
1921
|
+
* The transports to the peer, by carrier, in preference order (e.g. secure WS preferred, HTTP fallback).
|
|
1922
|
+
* They all carry the channel's `toAcceptor` domains; the connection prefers the first that's ready and
|
|
1923
|
+
* falls through on failure. {@link connectChannel} binds the channel + runtime + crypto identity into
|
|
1924
|
+
* each — the dial-out dual of `serveChannel`'s `carriers`.
|
|
1925
|
+
*/
|
|
1926
|
+
transports: readonly IConnectTransport[];
|
|
1927
|
+
/**
|
|
1928
|
+
* One backing store for this connection's crypto identity, fanned across every *secure* transport so
|
|
1929
|
+
* they present the same verify/exchange keys. Required when any transport is secure (the default); a
|
|
1930
|
+
* fully-plain connection (every transport `secure: false`) may omit it. Pass `link` instead to share an
|
|
1931
|
+
* existing identity.
|
|
1932
|
+
*/
|
|
1933
|
+
storage?: StorageAdapter;
|
|
1934
|
+
/** The connection's crypto identity. Defaults to a fresh {@link ClientCryptoKeyLink} over `storage`. */
|
|
1935
|
+
link?: ClientCryptoKeyLink;
|
|
1936
|
+
/** Default security level for secure transports; defaults to `authenticated`. */
|
|
1937
|
+
securityLevel?: ESecurityLevel;
|
|
1806
1938
|
/** Handlers for the channel's acceptor→connector pushes. Optional — omit for a send-only connection. */
|
|
1807
1939
|
onPush?: TChannelPushHandlers<TO_CONNECTOR>;
|
|
1808
1940
|
/** Default per-action timeout for this connection. */
|
|
1809
1941
|
defaultTimeout?: number;
|
|
1810
1942
|
}
|
|
1811
1943
|
/**
|
|
1812
|
-
*
|
|
1813
|
-
* the
|
|
1814
|
-
* `
|
|
1815
|
-
*
|
|
1816
|
-
*
|
|
1817
|
-
* fallback)
|
|
1818
|
-
*
|
|
1819
|
-
*
|
|
1820
|
-
*
|
|
1944
|
+
* Open a connection to a peer from a single call — the dial-out dual of `serveChannel`. The channel is
|
|
1945
|
+
* the single source of truth for *what* is routed (`toAcceptor` domains forwarded to the peer,
|
|
1946
|
+
* `toConnector` pushes handled locally from `onPush`); the call binds the shared facts — the channel's
|
|
1947
|
+
* codec/dictionary version, the runtime, and one crypto identity (a {@link ClientCryptoKeyLink} over
|
|
1948
|
+
* `storage`) — into every transport in `transports`, so none of them restate the channel or runtime.
|
|
1949
|
+
* List several transports to make the path transport-agnostic (secure WS preferred, HTTP fallback):
|
|
1950
|
+
* ```ts
|
|
1951
|
+
* const handler = connectChannel(runtime, lobbyChannel, {
|
|
1952
|
+
* peer: runtime_coordinate_lobby_do,
|
|
1953
|
+
* storage,
|
|
1954
|
+
* transports: [{ carrier: wsCarrier(url) }, { carrier: httpCarrier(...), secure: false }],
|
|
1955
|
+
* onPush: { player_joined: (p) => { … } },
|
|
1956
|
+
* });
|
|
1957
|
+
* ```
|
|
1958
|
+
* Returns the {@link ConnectorHandler} so the caller can later `clearTransportCache()` it.
|
|
1821
1959
|
*/
|
|
1822
|
-
declare function connectChannel<TO_ACCEPTOR extends readonly ActionDomain<any>[], TO_CONNECTOR extends readonly ActionDomain<any>[]>(runtime: ActionRuntime,
|
|
1960
|
+
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;
|
|
1823
1961
|
type TDomainAcceptorCases<D, TConn> = D extends ActionDomain<infer DEF> ? { [ID in keyof DEF["actionSchema"] & string]?: TAcceptorConnectionCaseFn<DEF, ID, TConn> } : never;
|
|
1824
1962
|
/**
|
|
1825
1963
|
* The connection-aware case map for a channel's acceptor side: the merged set of every
|
|
@@ -2001,97 +2139,6 @@ interface IDuplexConnectionRouter<TConn> {
|
|
|
2001
2139
|
*/
|
|
2002
2140
|
declare function createHibernatableWsServerAdapter<TConn>(options: IHibernatableWsServerAdapterOptions<TConn>): IDuplexConnectionRouter<TConn>;
|
|
2003
2141
|
//#endregion
|
|
2004
|
-
//#region src/ActionRuntime/Transport/Carrier/Carrier.types.d.ts
|
|
2005
|
-
/**
|
|
2006
|
-
* Carrier shapes — the only transport-specific surface a new protocol must implement. The secure
|
|
2007
|
-
* session (handshake + frame crypto + codec) and the action routing on top of it are carrier-agnostic;
|
|
2008
|
-
* a carrier just moves frames. Two shapes capture every carrier:
|
|
2009
|
-
*
|
|
2010
|
-
* - {@link IDuplexCarrier} — a persistent, push-capable byte stream (WebSocket, WebRTC `RTCDataChannel`,
|
|
2011
|
-
* Bluetooth GATT, an in-memory pipe). Either side can send at any time, so it supports server→client
|
|
2012
|
-
* pushes (the return path + broadcast).
|
|
2013
|
-
* - {@link IExchangeCarrier} — a request → single-correlated-reply carrier with no unsolicited push
|
|
2014
|
-
* (HTTP, and anything request/response-shaped). The reply rides the response to its own request.
|
|
2015
|
-
*
|
|
2016
|
-
* Frames are `string` (text — handshake control messages and JSON action frames) or binary
|
|
2017
|
-
* (`Uint8Array`/`ArrayBuffer` — the optimized binary wire / encrypted frames).
|
|
2018
|
-
*/
|
|
2019
|
-
type TFrame$1 = string | Uint8Array | ArrayBuffer;
|
|
2020
|
-
/**
|
|
2021
|
-
* A bidirectional, push-capable byte stream. Reduces every duplex carrier to "open, send bytes, receive
|
|
2022
|
-
* bytes, close" — a WebSocket, a WebRTC data channel, a Bluetooth characteristic, or an in-memory pipe
|
|
2023
|
-
* all satisfy this, so the identical secure session runs over each.
|
|
2024
|
-
*/
|
|
2025
|
-
interface IDuplexCarrier {
|
|
2026
|
-
/** Resolves once the carrier is open and ready to send; rejects if it closes/errors before opening. */
|
|
2027
|
-
readonly ready: Promise<void>;
|
|
2028
|
-
/** Whether the carrier is currently open (a synchronous guard before `send`). */
|
|
2029
|
-
isOpen(): boolean;
|
|
2030
|
-
/** Write one frame to the peer. */
|
|
2031
|
-
send(frame: TFrame$1): void;
|
|
2032
|
-
/**
|
|
2033
|
-
* Register the carrier's handlers. Called exactly once by the session after `ready`. `onMessage`
|
|
2034
|
-
* receives every inbound frame; `onClose` fires when the carrier goes away.
|
|
2035
|
-
*/
|
|
2036
|
-
attach(handlers: {
|
|
2037
|
-
onMessage: (frame: TFrame$1) => void;
|
|
2038
|
-
onClose: () => void;
|
|
2039
|
-
onError?: (error: unknown) => void;
|
|
2040
|
-
}): void;
|
|
2041
|
-
/** Close the carrier deliberately (a teardown). */
|
|
2042
|
-
close(): void;
|
|
2043
|
-
/** Optional human-readable endpoint for the devtools route chip. */
|
|
2044
|
-
readonly label?: string;
|
|
2045
|
-
}
|
|
2046
|
-
/**
|
|
2047
|
-
* A request → single-correlated-reply carrier with no unsolicited push (HTTP). One `exchange` sends a
|
|
2048
|
-
* frame and resolves with exactly the one reply frame for it; the carrier itself correlates them (the
|
|
2049
|
-
* HTTP transaction), so no correlation id is needed on the wire.
|
|
2050
|
-
*/
|
|
2051
|
-
interface IExchangeCarrier {
|
|
2052
|
-
/** Send one frame, await the single correlated reply frame. */
|
|
2053
|
-
exchange(frame: TFrame$1, opts?: {
|
|
2054
|
-
signal?: AbortSignal;
|
|
2055
|
-
}): Promise<TFrame$1>;
|
|
2056
|
-
/** Optional human-readable endpoint for the devtools route chip. */
|
|
2057
|
-
readonly label?: string;
|
|
2058
|
-
}
|
|
2059
|
-
type TCarrier = IDuplexCarrier | IExchangeCarrier;
|
|
2060
|
-
/**
|
|
2061
|
-
* A reusable opener for a {@link IDuplexCarrier} plus the per-action metadata a duplex transport needs.
|
|
2062
|
-
* Built by the small carrier factories (`wsCarrier`, `rtcCarrier`, `inMemoryCarrier`) and handed to
|
|
2063
|
-
* {@link secureTransport} / `LinkTransport` — so adding a new carrier is "write one of these", nothing
|
|
2064
|
-
* else.
|
|
2065
|
-
*/
|
|
2066
|
-
interface IDuplexCarrierSource {
|
|
2067
|
-
/** Open (or reuse) the carrier for an action. */
|
|
2068
|
-
open: (input: ITransportRouteActionParams) => IDuplexCarrier;
|
|
2069
|
-
/** Keys identifying a reusable carrier, so one carrier is shared across actions to the same peer. */
|
|
2070
|
-
getCacheKey?: (input: ITransportRouteActionParams) => string[];
|
|
2071
|
-
/** Devtools route info for an action routed over this carrier. */
|
|
2072
|
-
getRouteInfo?: (input: ITransportRouteActionParams) => ITransportRouteInfo;
|
|
2073
|
-
/** Short carrier-kind label for the devtools chip (e.g. `"ws"`, `"webrtc"`, `"memory"`). */
|
|
2074
|
-
readonly carrierLabel: string;
|
|
2075
|
-
}
|
|
2076
|
-
/**
|
|
2077
|
-
* The exchange-shape counterpart to {@link IDuplexCarrierSource}: a reusable opener for an
|
|
2078
|
-
* {@link IExchangeCarrier} plus the per-action metadata an exchange transport needs. Built by
|
|
2079
|
-
* `httpCarrier` and handed to {@link secureTransport} — adding a new request/reply protocol is "write
|
|
2080
|
-
* one of these". The `shape` tag lets {@link secureTransport} pick the duplex vs exchange transport.
|
|
2081
|
-
*/
|
|
2082
|
-
interface IExchangeCarrierSource {
|
|
2083
|
-
/** Discriminant so a generic factory can tell an exchange source from a duplex one. */
|
|
2084
|
-
readonly shape: "exchange";
|
|
2085
|
-
/** Open (or reuse) the carrier for an action. */
|
|
2086
|
-
open: (input: ITransportRouteActionParams) => IExchangeCarrier;
|
|
2087
|
-
/** Keys identifying a reusable carrier, so one carrier is shared across actions to the same peer. */
|
|
2088
|
-
getCacheKey?: (input: ITransportRouteActionParams) => string[];
|
|
2089
|
-
/** Devtools route info for an action routed over this carrier. */
|
|
2090
|
-
getRouteInfo?: (input: ITransportRouteActionParams) => ITransportRouteInfo;
|
|
2091
|
-
/** Short carrier-kind label for the devtools chip (e.g. `"http"`). */
|
|
2092
|
-
readonly carrierLabel: string;
|
|
2093
|
-
}
|
|
2094
|
-
//#endregion
|
|
2095
2142
|
//#region src/ActionRuntime/Transport/Carrier/AcceptorCarrier.types.d.ts
|
|
2096
2143
|
/**
|
|
2097
2144
|
* Acceptor-side carrier descriptors — the accept-in dual of the connector's {@link IDuplexCarrierSource}
|
|
@@ -2943,47 +2990,6 @@ declare class LinkTransport extends Transport<ETransportShape.duplex> {
|
|
|
2943
2990
|
getRouteInfo(input: ITransportRouteActionParams): ITransportRouteInfo;
|
|
2944
2991
|
}
|
|
2945
2992
|
//#endregion
|
|
2946
|
-
//#region src/ActionRuntime/Transport/plainTransport.d.ts
|
|
2947
|
-
interface IPlainTransportOptions {
|
|
2948
|
-
/**
|
|
2949
|
-
* How to reach the peer with no security layer. A duplex carrier (`wsCarrier(url)`,
|
|
2950
|
-
* `rtcCarrier(dc)`, `inMemoryCarrier().carrier`) builds a push-capable {@link LinkTransport}; an
|
|
2951
|
-
* exchange carrier (`httpCarrier(...)`) builds a request/reply {@link ExchangeTransport}.
|
|
2952
|
-
*/
|
|
2953
|
-
carrier: IDuplexCarrierSource | IExchangeCarrierSource;
|
|
2954
|
-
/**
|
|
2955
|
-
* Codec for a *duplex* carrier (a duplex link frames the action wire itself). Required for duplex;
|
|
2956
|
-
* ignored for an exchange carrier, which JSON-encodes the action wire in its envelope.
|
|
2957
|
-
*/
|
|
2958
|
-
formatMessage?: TLinkFormatMessage;
|
|
2959
|
-
/** Per-channel codec factory for stateful duplex codecs (e.g. the binary session). */
|
|
2960
|
-
createFormatMessage?: () => TLinkFormatMessage;
|
|
2961
|
-
/**
|
|
2962
|
-
* Optional availability gate. When it returns `false`, this transport reports as `unsupported` for that
|
|
2963
|
-
* action and the manager falls through to the next transport in preference order — without opening the
|
|
2964
|
-
* carrier or computing its cache key. Re-evaluated per dispatch, so a transport can become available
|
|
2965
|
-
* later (e.g. once a session/connection precondition holds) with no reconnect. Omit = always available.
|
|
2966
|
-
*/
|
|
2967
|
-
available?: (input: ITransportRouteActionParams) => boolean;
|
|
2968
|
-
updateRunConfig?: TUpdateActionRunConfig;
|
|
2969
|
-
/** Override the devtools chip label (defaults to the carrier's `carrierLabel`). */
|
|
2970
|
-
label?: string;
|
|
2971
|
-
}
|
|
2972
|
-
/**
|
|
2973
|
-
* The plain (no-handshake, no-crypto) sibling of {@link secureTransport}: swap the carrier to change
|
|
2974
|
-
* protocol, with no security layer. Over an {@link IExchangeCarrierSource} it builds an
|
|
2975
|
-
* {@link ExchangeTransport} that POSTs the bare action wire and completes inline (HTTP is just
|
|
2976
|
-
* `carrier: httpCarrier(...)`); over an {@link IDuplexCarrierSource} it builds a push-capable
|
|
2977
|
-
* {@link LinkTransport} with the given codec. HTTP is therefore no longer a bespoke transport class —
|
|
2978
|
-
* it is "just another carrier", exactly like a WebSocket under {@link secureTransport}.
|
|
2979
|
-
*/
|
|
2980
|
-
declare function plainTransport(options: IPlainTransportOptions & {
|
|
2981
|
-
carrier: IExchangeCarrierSource;
|
|
2982
|
-
}): ExchangeTransport;
|
|
2983
|
-
declare function plainTransport(options: IPlainTransportOptions & {
|
|
2984
|
-
carrier: IDuplexCarrierSource;
|
|
2985
|
-
}): LinkTransport;
|
|
2986
|
-
//#endregion
|
|
2987
2993
|
//#region src/ActionRuntime/Transport/SecureSession/exchangeProtocol.d.ts
|
|
2988
2994
|
/**
|
|
2989
2995
|
* The application-level envelope for secure action traffic over an {@link IExchangeCarrier} (HTTP). An
|
|
@@ -3033,45 +3039,6 @@ declare function encodeExchange(envelope: TExchangeRequest | TExchangeReply): st
|
|
|
3033
3039
|
declare function decodeExchangeRequest(raw: string): TExchangeRequest | undefined;
|
|
3034
3040
|
declare function decodeExchangeReply(raw: string): TExchangeReply | undefined;
|
|
3035
3041
|
//#endregion
|
|
3036
|
-
//#region src/ActionRuntime/Transport/secureTransport.d.ts
|
|
3037
|
-
interface ISecureTransportOptions {
|
|
3038
|
-
/** The shared channel identity (per-connection codec + dictionary version) — same one both ends use. */
|
|
3039
|
-
channel: ISecureChannel;
|
|
3040
|
-
/** This client's runtime — its coordinate is the authenticated identity sent in the handshake. */
|
|
3041
|
-
runtime: ActionRuntime;
|
|
3042
|
-
/** Backing store for this client's crypto identity (a stable verify key across reloads). */
|
|
3043
|
-
storageAdapter: StorageAdapter;
|
|
3044
|
-
/** The level this client requests; the peer must allow it. */
|
|
3045
|
-
securityLevel: ESecurityLevel;
|
|
3046
|
-
/**
|
|
3047
|
-
* Optional availability gate. When it returns `false`, this transport reports as `unsupported` for that
|
|
3048
|
-
* action and the manager falls through to the next transport in preference order — without opening the
|
|
3049
|
-
* carrier or computing its cache key. Re-evaluated per dispatch, so a transport can become available
|
|
3050
|
-
* later (e.g. once a session/connection precondition holds) with no reconnect. Omit = always available.
|
|
3051
|
-
*/
|
|
3052
|
-
available?: (input: ITransportRouteActionParams) => boolean;
|
|
3053
|
-
/**
|
|
3054
|
-
* How to reach the peer. A duplex carrier (`wsCarrier(url)`, `rtcCarrier(dc)`,
|
|
3055
|
-
* `inMemoryCarrier().carrier`) runs the push-capable session; an exchange carrier (`httpCarrier(...)`)
|
|
3056
|
-
* runs the request/reply session over the same handshake + crypto.
|
|
3057
|
-
*/
|
|
3058
|
-
carrier: IDuplexCarrierSource | IExchangeCarrierSource;
|
|
3059
|
-
}
|
|
3060
|
-
/**
|
|
3061
|
-
* The one secure-transport factory — swap the carrier to change protocol. Folds in the boilerplate (the
|
|
3062
|
-
* {@link ClientCryptoKeyLink} from `storageAdapter`, the `security` block from the runtime coordinate +
|
|
3063
|
-
* channel version) and drives it over whatever carrier you pass: a {@link IDuplexCarrierSource} builds a
|
|
3064
|
-
* push-capable {@link LinkTransport} (WS is just `carrier: wsCarrier(url)`), an
|
|
3065
|
-
* {@link IExchangeCarrierSource} builds a request/reply {@link ExchangeTransport} (HTTP, with the same
|
|
3066
|
-
* authentication/encryption). Replaces the old `createSecureWebSocketTransport` / `createSecureLinkTransport`.
|
|
3067
|
-
*/
|
|
3068
|
-
declare function secureTransport(options: ISecureTransportOptions & {
|
|
3069
|
-
carrier: IDuplexCarrierSource;
|
|
3070
|
-
}): LinkTransport;
|
|
3071
|
-
declare function secureTransport(options: ISecureTransportOptions & {
|
|
3072
|
-
carrier: IExchangeCarrierSource;
|
|
3073
|
-
}): ExchangeTransport;
|
|
3074
|
-
//#endregion
|
|
3075
3042
|
//#region src/errors/err_nice_action.d.ts
|
|
3076
3043
|
declare enum EErrId_NiceAction {
|
|
3077
3044
|
not_implemented = "not_implemented",
|
|
@@ -3297,5 +3264,5 @@ interface IActionPayload_Result_JsonObject<DOM extends IActionDomain = IActionDo
|
|
|
3297
3264
|
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>;
|
|
3298
3265
|
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>;
|
|
3299
3266
|
//#endregion
|
|
3300
|
-
export {
|
|
3301
|
-
//# sourceMappingURL=ActionPayload.types-
|
|
3267
|
+
export { wsAcceptorCarrier as $, ESecurityLevel as $n, actionSchema as $r, TCarrier as $t, encodeExchange as A, ITransportStatusInfo_Base as An, TRunningActionUpdate as Ar, createHibernatableWsServerAdapter as At, IActionFrameCrypto as B, TOnResolveIncomingRequestJson as Bn, IActionDomain as Br, TChannelPushHandlers as Bt, decodeActionFrame as C, IActionTransportResolvers as Cn, ERunningActionFinishedType as Cr, IAcceptorAttachmentStore as Ct, TExchangeRequest as D, ITransportRouteActionParams as Dn, IRunningActionUpdate_Progress as Dr, isExchangeAcceptorCarrier as Dt, TExchangeReply as E, ITransportMethod_SendActionData_Input as En, IRunningActionUpdate_Abort as Er, TAcceptorCarrier as Et, EErrId_NiceTransport as F, IUpdateActionRunConfig_Output as Fn, IRuntimeCoordinateSpecifics as Fr, IAcceptChannelOptions as Ft, IHttpCarrierRequest as G, TTransportCache as Gn, TDomainActionId as Gr, ISecureChannel as Gt, createActionFrameCrypto as H, TOnResolveIncomingResponseJson as Hn, IActionRootDomain as Hr, acceptChannelConnections as Ht, err_nice_transport as I, TGetTransportFn as In, IRuntimeFullCoordinates as Ir, IActionChannel as It, IHttpAcceptorCarrierOptions as J, TTransportStatusInfo_GetTransport_Output as Jn, TPossibleDomainId as Jr, createBinaryWireSessionFactory as Jt, TCarrierFetch as K, TTransportInitializationFinishedInfo as Kn, TInferInputFromSchema as Kr, defineSecureChannel as Kt, ExchangeTransport as L, TOnResolveAnyIncomingActionData as Ln, RuntimeCoordinate as Lr, IConnectChannelOptions as Lt, LinkTransport as M, ITransportStatusInfo_Initializing as Mn, TRunningActionUpdateListener as Mr, IConnectionAttachment as Mt, IActionTransportReadyData_Link as N, ITransportStatusInfo_Ready as Nn, ActionPayload_Result as Nr, IConnectionStateStoreOptions as Nt, decodeExchangeReply as O, ITransportRouteClientParams as On, IRunningActionUpdate_Started as Or, IDuplexConnectionRouter as Ot, TLinkFormatMessage as P, ITransportStatusInfo_Unsupported as Pn, IRuntimeCoordinate as Pr, createConnectionStateStore as Pt, IWsAcceptorCarrierOptions as Q, EHandshakeMessageType as Qn, TInferActionError as Qr, IExchangeCarrierSource as Qt, IExchangeTransportOptions as R, TOnResolveAnyIncomingActionData_Json as Rn, TRuntimeCoordinateEnvId as Rr, IConnectTransport as Rt, IActionFrameDecoder as S, IActionTransportReadyData_Methods as Sn, IActionCore_JsonObject as Sr, serveChannel as St, err_nice_action as T, ITransportDispatchAction as Tn, ERunningActionUpdateType as Tr, IExchangeAcceptorCarrier as Tt, createBinaryWireAdapter as U, TSendActionDataMethod as Un, TActionDomainChildDef as Ur, connectChannel as Ut, IActionFrameCryptoConfig as V, TOnResolveIncomingResponse as Vn, IActionDomainChildOptions as Vr, acceptChannel as Vt, IHttpCarrierOptions as W, TSendReturnDataMethod as Wn, TActionDomainSchema as Wr, defineChannel as Wt, IWsCarrierOptions as X, ITransportConnectionContext as Xn, ActionSchema as Xr, IDuplexCarrierSource as Xt, httpAcceptorCarrier as Y, TUpdateActionRunConfig as Yn, TPossibleDomainIdList as Yr, IDuplexCarrier as Yt, wsCarrier as Z, Transport as Zn, EActionResponseMode as Zr, IExchangeCarrier as Zt, TActionProgress as _, ETransportStatus as _n, MaybePromise as _r, IExchangeAcceptorConfig as _t, IActionPayload_Data_Base as a, TActionChannelFormatMessage as an, IServerHandshakeConfig as ar, rtcDataChannelByteChannel as at, isActionPayload_Request_JsonObject as b, IActionTransportReady as bn, ActionPayload_Request as br, IServeChannelOptions as bt, IActionPayload_Request_JsonObject as c, IActionWireFormat as cn, createInMemoryTofuVerifyKeyResolver as cr, IInMemoryChannelPair as ct, IActionProgress_Custom as d, ActionDomain as dn, decodeHandshakeMessage as dr, err_nice_external_client as dt, TActionSchemaOptions as ei, TFrame$1 as en, IClientHandshakeConfig as er, EErrId_NiceTransport_WebSocket as et, IActionProgress_None as f, ActionRootDomain as fn, encodeHandshakeMessage as fr, ISecureAcceptorHandlerOptions as ft, TActionPayload_Any_JsonObject as g, ETransportShape as gn, createLocalHandler as gr, ExchangeAcceptor as gt, TActionPayload_Any_Instance as h, createConnectorHandler as hn, ActionLocalHandler as hr, createActionFetchHandler as ht, IActionPayload_Base_JsonObject as i, TAcceptorConnectionCaseFn as in, IHandshakeResult as ir, IRtcDataChannelLike as it, ILinkTransportOptions as j, ITransportStatusInfo_Failed as jn, TRunningActionUpdateFinished as jr, ConnectionStateStore as jt, decodeExchangeRequest as k, ITransportRouteInfo as kn, IRunningActionUpdate_Success as kr, IHibernatableWsServerAdapterOptions as kt, IActionPayload_Result as l, createActionRootDomain as ln, createServerHandshake as lr, IInMemoryServerEndpoint as lt, IActionRouteItemHandler as m, ConnectorHandler as mn, PeerLinkHandler as mr, IActionFetchHandlerOptions as mt, EActionProgressType as n, TTransportedValue as ni, IAcceptorConnectionBinding as nn, IClientVerifyKeyResolver as nr, IRtcCarrierOptions as nt, IActionPayload_Progress as o, TActionConnectionEncoding as on, THandshakeMessage as or, IInMemoryCarrier as ot, IActionProgress_Percentage as p, ActionRuntime as pn, runtimeLinkId as pr, createSecureAcceptorHandler as pt, httpCarrier as q, TTransportStatusInfo as qn, TInferOutputFromSchema as qr, IBinaryWireSessionOptions as qt, IActionPayload_Base as r, IAcceptorHandlerOptions as rn, IHandshakeEncryptionKeyMaterial as rr, rtcCarrier as rt, IActionPayload_Progress_JsonObject as s, createAcceptorHandler as sn, createClientHandshake as sr, inMemoryCarrier as st, EActionPayloadType as t, TActionSerializationDefinition as ti, AcceptorHandler as tn, IClientVerifyKeyResolveInput as tr, err_nice_transport_ws as tt, IActionPayload_Result_JsonObject as u, ActionCore as un, createStorageTofuVerifyKeyResolver as ur, createInMemoryChannelPair as ut, TActionResultOutcome as v, IActionTransportDef as vn, RunningAction as vr, IExchangeAcceptorSecurity as vt, EErrId_NiceAction as w, ISecureClientConfig as wn, ERunningActionState as wr, IDuplexAcceptorCarrier as wt, isActionPayload_Any_JsonObject as x, IActionTransportReadyData_Base as xn, IActionCore as xr, IServeConnectionStateOptions as xt, isActionPayload_Result_JsonObject as y, IActionTransportInitialized as yn, ActionPayload_Progress as yr, IChannelServer as yt, IActionTransportReadyData_Exchange as z, TOnResolveIncomingRequest as zn, TRuntimeCoordinateStringId as zr, TChannelAcceptorCases as zt };
|
|
3268
|
+
//# sourceMappingURL=ActionPayload.types-CQM1HRw_.d.cts.map
|