@nice-code/action 0.24.0 → 0.25.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 +54 -6
- package/build/{AcceptorHandler-11-QMdx2.d.mts → AcceptorHandler-BizUtq4u.d.mts} +118 -15
- package/build/{AcceptorHandler-CxD0c1BE.d.cts → AcceptorHandler-CxPfZtIl.d.cts} +118 -15
- package/build/{ActionDevtoolsCore-37JP4bOG.d.cts → ActionDevtoolsCore-D9KBBI2V.d.cts} +2 -2
- package/build/{ActionDevtoolsCore-Cgq-go1R.d.mts → ActionDevtoolsCore-xZjAtB4H.d.mts} +2 -2
- package/build/advanced/index.cjs +1 -1
- package/build/advanced/index.d.cts +1 -96
- package/build/advanced/index.d.mts +1 -96
- package/build/advanced/index.mjs +1 -1
- package/build/{createHibernatableWsServerAdapter-C07RfUTH.mjs → createHibernatableWsServerAdapter-BkjESd01.mjs} +11 -9
- package/build/createHibernatableWsServerAdapter-BkjESd01.mjs.map +1 -0
- package/build/{createHibernatableWsServerAdapter-BNi4k9j3.cjs → createHibernatableWsServerAdapter-FSDWrxoF.cjs} +11 -9
- package/build/createHibernatableWsServerAdapter-FSDWrxoF.cjs.map +1 -0
- 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-C3S_bDkL.cjs → httpAcceptorCarrier-BQYaXI9j.cjs} +2 -2
- package/build/{httpAcceptorCarrier-C3S_bDkL.cjs.map → httpAcceptorCarrier-BQYaXI9j.cjs.map} +1 -1
- package/build/{httpAcceptorCarrier-DPBEuewS.mjs → httpAcceptorCarrier-DWqsCz3h.mjs} +2 -2
- package/build/{httpAcceptorCarrier-DPBEuewS.mjs.map → httpAcceptorCarrier-DWqsCz3h.mjs.map} +1 -1
- package/build/index.cjs +6 -2
- package/build/index.d.cts +2 -2
- package/build/index.d.mts +2 -2
- package/build/index.mjs +3 -3
- package/build/platform/cloudflare/index.cjs +45 -1
- package/build/platform/cloudflare/index.cjs.map +1 -1
- package/build/platform/cloudflare/index.d.cts +40 -2
- package/build/platform/cloudflare/index.d.mts +40 -2
- package/build/platform/cloudflare/index.mjs +45 -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/createHibernatableWsServerAdapter-BNi4k9j3.cjs.map +0 -1
- package/build/createHibernatableWsServerAdapter-C07RfUTH.mjs.map +0 -1
|
@@ -1,52 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { An as TOnResolveIncomingResponseJson, At as IHibernatableWsServerAdapterOptions, B as decodeExchangeReply, Bn as Transport, Cn as IUpdateActionRunConfig_Output, Dn as TOnResolveIncomingRequest, En as TOnResolveAnyIncomingActionData_Json, Fn as TTransportStatusInfo, Ft as createConnectionStateStore, G as IExchangeAcceptorSecurity, Gn as IClientHandshakeConfig, H as encodeExchange, Hn as createSecureAcceptorHandler, In as TTransportStatusInfo_GetTransport_Output, Jn as IHandshakeEncryptionKeyMaterial, Jt as IActionWireFormat, Kt as IBinaryWireSessionOptions, Ln as TUpdateActionRunConfig, Mn as TSendReturnDataMethod, Mt as ConnectionStateStore, Nn as TTransportCache, Nt as IConnectionAttachment, On as TOnResolveIncomingRequestJson, Pn as TTransportInitializationFinishedInfo, Pt as IConnectionStateStoreOptions, Qn as createClientHandshake, R as TExchangeReply, Rn as TransportConnection, Sn as ITransportStatusInfo_Unsupported, Tn as TOnResolveAnyIncomingActionData, U as ExchangeAcceptor, Un as EHandshakeMessageType, V as decodeExchangeRequest, Vn as ISecureAcceptorHandlerOptions, W as IExchangeAcceptorConfig, Xn as IServerHandshakeConfig, Yn as IHandshakeResult, Yt as IDuplexCarrier, Zn as THandshakeMessage, Zt as IExchangeCarrier, _n as ITransportRouteInfo, a as TAcceptorConnectionCaseFn, an as ETransportStatus, bn as ITransportStatusInfo_Initializing, c as createAcceptorHandler, cn as IActionTransportReady, dn as IActionTransportResolvers, er as createServerHandshake, fn as ISecureClientConfig, gn as ITransportRouteClientParams, hn as ITransportRouteActionParams, i as TAcceptorCaseFn, in as ETransportShape, jn as TSendActionDataMethod, jt as createHibernatableWsServerAdapter, kn as TOnResolveIncomingResponse, kt as IDuplexConnectionRouter, l as ActionDomain, ln as IActionTransportReadyData_Base, mn as ITransportMethod_SendActionData_Input, n as IAcceptorConnectionBinding, nn as createConnectorHandler, nr as decodeHandshakeMessage, o as TActionChannelFormatMessage, on as IActionTransportDef, pn as ITransportDispatchAction, qt as createBinaryWireSessionFactory, r as IAcceptorHandlerOptions, rn as PeerLinkHandler, rr as encodeHandshakeMessage, s as TActionConnectionEncoding, sn as IActionTransportInitialized, t as AcceptorHandler, tn as ConnectorHandler, u as ActionRuntime, un as IActionTransportReadyData_Methods, vn as ITransportStatusInfo_Base, wn as TGetTransportFn, xn as ITransportStatusInfo_Ready, yn as ITransportStatusInfo_Failed, z as TExchangeRequest, zn as ITransportConnectionContext } from "../AcceptorHandler-CxPfZtIl.cjs";
|
|
2
2
|
import { ClientCryptoKeyLink, TTypeAndId } from "@nice-code/util";
|
|
3
3
|
|
|
4
|
-
//#region src/ActionRuntime/Transport/SecureSession/exchangeAcceptor.d.ts
|
|
5
|
-
/** Acceptor secure config for the exchange (HTTP) endpoint — same identity an `AcceptorHandler` uses. */
|
|
6
|
-
interface IExchangeAcceptorSecurity {
|
|
7
|
-
/** This acceptor's crypto identity (verify + exchange key pairs, optionally persisted). */
|
|
8
|
-
link: ClientCryptoKeyLink;
|
|
9
|
-
/** This acceptor's coordinate — its identity to clients during the handshake. */
|
|
10
|
-
localCoordinate: IRuntimeCoordinate;
|
|
11
|
-
/** Wire dictionary version; the handshake rejects a client on a mismatch. */
|
|
12
|
-
dictionaryVersion: string;
|
|
13
|
-
/** Accepted level(s) — a single level is strict, an array is a negotiable allowed set. */
|
|
14
|
-
securityLevel: ESecurityLevel | readonly ESecurityLevel[];
|
|
15
|
-
/** Trust decision for a client's verify key (defaults to in-memory TOFU inside the handshake). */
|
|
16
|
-
verifyKeyResolver?: IClientVerifyKeyResolver;
|
|
17
|
-
}
|
|
18
|
-
interface IExchangeAcceptorConfig {
|
|
19
|
-
security: IExchangeAcceptorSecurity;
|
|
20
|
-
/** The runtime that executes an inbound action wire and produces its result. */
|
|
21
|
-
runtime: ActionRuntime;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Acceptor (accept-in) side of the secure exchange protocol — the HTTP counterpart to
|
|
25
|
-
* {@link AcceptorSecureSession}. Each POST body is one {@link decodeExchangeRequest} envelope; the
|
|
26
|
-
* acceptor drives the server handshake over the two `hs` POSTs (correlated by `hsid`, since stateless
|
|
27
|
-
* requests can't rely on channel ordering), mints a session **token** on accept, and on every later `act`
|
|
28
|
-
* POST resolves the session by token, decrypts the body (at `encrypted`), routes it through the runtime,
|
|
29
|
-
* and returns the (encrypted) result inline as the reply.
|
|
30
|
-
*
|
|
31
|
-
* Sessions and in-flight handshakes are held in memory — fine for a single-instance server. (Surviving a
|
|
32
|
-
* Durable-Object eviction would persist each token's `keyMaterial` and re-derive the key on a miss, the
|
|
33
|
-
* same primitive `AcceptorSecureSession.rehydrate` uses; left as a follow-up.)
|
|
34
|
-
*/
|
|
35
|
-
declare class ExchangeAcceptor {
|
|
36
|
-
private readonly _security;
|
|
37
|
-
private readonly _runtime;
|
|
38
|
-
private readonly _allowedLevels;
|
|
39
|
-
private readonly _noneAllowed;
|
|
40
|
-
private readonly _pendingHandshakes;
|
|
41
|
-
private readonly _sessions;
|
|
42
|
-
constructor(config: IExchangeAcceptorConfig);
|
|
43
|
-
/** Process one POST body (an exchange envelope), returning the reply body to send back. */
|
|
44
|
-
handlePost(body: string): Promise<string>;
|
|
45
|
-
private _handleHandshake;
|
|
46
|
-
private _handleAction;
|
|
47
|
-
private _err;
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
4
|
//#region src/ActionRuntime/Handler/PeerLink/Acceptor/createActionFetchHandler.d.ts
|
|
51
5
|
interface IActionFetchHandlerOptions {
|
|
52
6
|
/**
|
|
@@ -291,54 +245,5 @@ declare class LinkTransport extends Transport<ETransportShape.duplex> {
|
|
|
291
245
|
getRouteInfo(input: ITransportRouteActionParams): ITransportRouteInfo;
|
|
292
246
|
}
|
|
293
247
|
//#endregion
|
|
294
|
-
//#region src/ActionRuntime/Transport/SecureSession/exchangeProtocol.d.ts
|
|
295
|
-
/**
|
|
296
|
-
* The application-level envelope for secure action traffic over an {@link IExchangeCarrier} (HTTP). An
|
|
297
|
-
* exchange carrier only moves one request frame → one reply frame with no unsolicited push, so the
|
|
298
|
-
* handshake and the per-action token + crypto all ride in this envelope (a JSON string body) rather than
|
|
299
|
-
* on a persistent channel. The three security levels share it:
|
|
300
|
-
*
|
|
301
|
-
* - `none` — no handshake, no token: an `act` envelope carries the plaintext wire both ways.
|
|
302
|
-
* - `authenticated` — a one-time handshake yields a session `token`; each later `act` carries it +
|
|
303
|
-
* the plaintext wire.
|
|
304
|
-
* - `encrypted` — same, but the wire is AES-GCM ciphertext, base64 in the `c` field.
|
|
305
|
-
*
|
|
306
|
-
* The handshake runs as two `hs` exchanges (hello→welcome, prove→accept) correlated by a client-chosen
|
|
307
|
-
* `hsid`, since stateless requests can't rely on channel ordering. The `accept` reply carries the token.
|
|
308
|
-
*/
|
|
309
|
-
type TWireJson = TActionPayload_Any_JsonObject<any, any>;
|
|
310
|
-
/** Connector → acceptor request envelope. */
|
|
311
|
-
type TExchangeRequest = {
|
|
312
|
-
k: "hs";
|
|
313
|
-
hsid: string;
|
|
314
|
-
m: string;
|
|
315
|
-
} | {
|
|
316
|
-
k: "act";
|
|
317
|
-
t?: string;
|
|
318
|
-
w: TWireJson;
|
|
319
|
-
} | {
|
|
320
|
-
k: "act";
|
|
321
|
-
t?: string;
|
|
322
|
-
c: string;
|
|
323
|
-
};
|
|
324
|
-
/** Acceptor → connector reply envelope. */
|
|
325
|
-
type TExchangeReply = {
|
|
326
|
-
k: "hs";
|
|
327
|
-
m: string;
|
|
328
|
-
t?: string;
|
|
329
|
-
} | {
|
|
330
|
-
k: "act";
|
|
331
|
-
w: TWireJson;
|
|
332
|
-
} | {
|
|
333
|
-
k: "act";
|
|
334
|
-
c: string;
|
|
335
|
-
} | {
|
|
336
|
-
k: "err";
|
|
337
|
-
message: string;
|
|
338
|
-
};
|
|
339
|
-
declare function encodeExchange(envelope: TExchangeRequest | TExchangeReply): string;
|
|
340
|
-
declare function decodeExchangeRequest(raw: string): TExchangeRequest | undefined;
|
|
341
|
-
declare function decodeExchangeReply(raw: string): TExchangeReply | undefined;
|
|
342
|
-
//#endregion
|
|
343
248
|
export { AcceptorHandler, ConnectionStateStore, ConnectorHandler, EHandshakeMessageType, ETransportShape, ETransportStatus, ExchangeAcceptor, ExchangeTransport, type IAcceptorConnectionBinding, type IAcceptorHandlerOptions, type IActionFetchHandlerOptions, type IActionFrameCrypto, type IActionFrameCryptoConfig, IActionTransportDef, IActionTransportInitialized, IActionTransportReady, IActionTransportReadyData_Base, type IActionTransportReadyData_Exchange, type IActionTransportReadyData_Link, IActionTransportReadyData_Methods, IActionTransportResolvers, type IActionWireFormat, type IBinaryWireSessionOptions, type IClientHandshakeConfig, type IConnectionAttachment, type IConnectionStateStoreOptions, type IDuplexConnectionRouter, type IExchangeAcceptorConfig, type IExchangeAcceptorSecurity, type IExchangeTransportOptions, type IHandshakeEncryptionKeyMaterial, type IHandshakeResult, type IHibernatableWsServerAdapterOptions, type ILinkTransportOptions, type ISecureAcceptorHandlerOptions, ISecureClientConfig, type IServerHandshakeConfig, type ITransportConnectionContext, ITransportDispatchAction, ITransportMethod_SendActionData_Input, ITransportRouteActionParams, ITransportRouteClientParams, ITransportRouteInfo, ITransportStatusInfo_Base, ITransportStatusInfo_Failed, ITransportStatusInfo_Initializing, ITransportStatusInfo_Ready, ITransportStatusInfo_Unsupported, IUpdateActionRunConfig_Output, LinkTransport, PeerLinkHandler, type TAcceptorCaseFn, type TAcceptorConnectionCaseFn, type TActionChannelFormatMessage, type TActionConnectionEncoding, type TExchangeReply, type TExchangeRequest, TGetTransportFn, type THandshakeMessage, type TLinkFormatMessage, TOnResolveAnyIncomingActionData, TOnResolveAnyIncomingActionData_Json, TOnResolveIncomingRequest, TOnResolveIncomingRequestJson, TOnResolveIncomingResponse, TOnResolveIncomingResponseJson, TSendActionDataMethod, TSendReturnDataMethod, TTransportCache, TTransportInitializationFinishedInfo, TTransportStatusInfo, TTransportStatusInfo_GetTransport_Output, TUpdateActionRunConfig, Transport, createAcceptorHandler, createActionFetchHandler, createActionFrameCrypto, createBinaryWireAdapter, createBinaryWireSessionFactory, createClientHandshake, createConnectionStateStore, createConnectorHandler, createHibernatableWsServerAdapter, createSecureAcceptorHandler, createServerHandshake, decodeExchangeReply, decodeExchangeRequest, decodeHandshakeMessage, encodeExchange, encodeHandshakeMessage };
|
|
344
249
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1,52 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { An as TOnResolveIncomingResponseJson, At as IHibernatableWsServerAdapterOptions, B as decodeExchangeReply, Bn as Transport, Cn as IUpdateActionRunConfig_Output, Dn as TOnResolveIncomingRequest, En as TOnResolveAnyIncomingActionData_Json, Fn as TTransportStatusInfo, Ft as createConnectionStateStore, G as IExchangeAcceptorSecurity, Gn as IClientHandshakeConfig, H as encodeExchange, Hn as createSecureAcceptorHandler, In as TTransportStatusInfo_GetTransport_Output, Jn as IHandshakeEncryptionKeyMaterial, Jt as IActionWireFormat, Kt as IBinaryWireSessionOptions, Ln as TUpdateActionRunConfig, Mn as TSendReturnDataMethod, Mt as ConnectionStateStore, Nn as TTransportCache, Nt as IConnectionAttachment, On as TOnResolveIncomingRequestJson, Pn as TTransportInitializationFinishedInfo, Pt as IConnectionStateStoreOptions, Qn as createClientHandshake, R as TExchangeReply, Rn as TransportConnection, Sn as ITransportStatusInfo_Unsupported, Tn as TOnResolveAnyIncomingActionData, U as ExchangeAcceptor, Un as EHandshakeMessageType, V as decodeExchangeRequest, Vn as ISecureAcceptorHandlerOptions, W as IExchangeAcceptorConfig, Xn as IServerHandshakeConfig, Yn as IHandshakeResult, Yt as IDuplexCarrier, Zn as THandshakeMessage, Zt as IExchangeCarrier, _n as ITransportRouteInfo, a as TAcceptorConnectionCaseFn, an as ETransportStatus, bn as ITransportStatusInfo_Initializing, c as createAcceptorHandler, cn as IActionTransportReady, dn as IActionTransportResolvers, er as createServerHandshake, fn as ISecureClientConfig, gn as ITransportRouteClientParams, hn as ITransportRouteActionParams, i as TAcceptorCaseFn, in as ETransportShape, jn as TSendActionDataMethod, jt as createHibernatableWsServerAdapter, kn as TOnResolveIncomingResponse, kt as IDuplexConnectionRouter, l as ActionDomain, ln as IActionTransportReadyData_Base, mn as ITransportMethod_SendActionData_Input, n as IAcceptorConnectionBinding, nn as createConnectorHandler, nr as decodeHandshakeMessage, o as TActionChannelFormatMessage, on as IActionTransportDef, pn as ITransportDispatchAction, qt as createBinaryWireSessionFactory, r as IAcceptorHandlerOptions, rn as PeerLinkHandler, rr as encodeHandshakeMessage, s as TActionConnectionEncoding, sn as IActionTransportInitialized, t as AcceptorHandler, tn as ConnectorHandler, u as ActionRuntime, un as IActionTransportReadyData_Methods, vn as ITransportStatusInfo_Base, wn as TGetTransportFn, xn as ITransportStatusInfo_Ready, yn as ITransportStatusInfo_Failed, z as TExchangeRequest, zn as ITransportConnectionContext } from "../AcceptorHandler-BizUtq4u.mjs";
|
|
2
2
|
import { ClientCryptoKeyLink, TTypeAndId } from "@nice-code/util";
|
|
3
3
|
|
|
4
|
-
//#region src/ActionRuntime/Transport/SecureSession/exchangeAcceptor.d.ts
|
|
5
|
-
/** Acceptor secure config for the exchange (HTTP) endpoint — same identity an `AcceptorHandler` uses. */
|
|
6
|
-
interface IExchangeAcceptorSecurity {
|
|
7
|
-
/** This acceptor's crypto identity (verify + exchange key pairs, optionally persisted). */
|
|
8
|
-
link: ClientCryptoKeyLink;
|
|
9
|
-
/** This acceptor's coordinate — its identity to clients during the handshake. */
|
|
10
|
-
localCoordinate: IRuntimeCoordinate;
|
|
11
|
-
/** Wire dictionary version; the handshake rejects a client on a mismatch. */
|
|
12
|
-
dictionaryVersion: string;
|
|
13
|
-
/** Accepted level(s) — a single level is strict, an array is a negotiable allowed set. */
|
|
14
|
-
securityLevel: ESecurityLevel | readonly ESecurityLevel[];
|
|
15
|
-
/** Trust decision for a client's verify key (defaults to in-memory TOFU inside the handshake). */
|
|
16
|
-
verifyKeyResolver?: IClientVerifyKeyResolver;
|
|
17
|
-
}
|
|
18
|
-
interface IExchangeAcceptorConfig {
|
|
19
|
-
security: IExchangeAcceptorSecurity;
|
|
20
|
-
/** The runtime that executes an inbound action wire and produces its result. */
|
|
21
|
-
runtime: ActionRuntime;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Acceptor (accept-in) side of the secure exchange protocol — the HTTP counterpart to
|
|
25
|
-
* {@link AcceptorSecureSession}. Each POST body is one {@link decodeExchangeRequest} envelope; the
|
|
26
|
-
* acceptor drives the server handshake over the two `hs` POSTs (correlated by `hsid`, since stateless
|
|
27
|
-
* requests can't rely on channel ordering), mints a session **token** on accept, and on every later `act`
|
|
28
|
-
* POST resolves the session by token, decrypts the body (at `encrypted`), routes it through the runtime,
|
|
29
|
-
* and returns the (encrypted) result inline as the reply.
|
|
30
|
-
*
|
|
31
|
-
* Sessions and in-flight handshakes are held in memory — fine for a single-instance server. (Surviving a
|
|
32
|
-
* Durable-Object eviction would persist each token's `keyMaterial` and re-derive the key on a miss, the
|
|
33
|
-
* same primitive `AcceptorSecureSession.rehydrate` uses; left as a follow-up.)
|
|
34
|
-
*/
|
|
35
|
-
declare class ExchangeAcceptor {
|
|
36
|
-
private readonly _security;
|
|
37
|
-
private readonly _runtime;
|
|
38
|
-
private readonly _allowedLevels;
|
|
39
|
-
private readonly _noneAllowed;
|
|
40
|
-
private readonly _pendingHandshakes;
|
|
41
|
-
private readonly _sessions;
|
|
42
|
-
constructor(config: IExchangeAcceptorConfig);
|
|
43
|
-
/** Process one POST body (an exchange envelope), returning the reply body to send back. */
|
|
44
|
-
handlePost(body: string): Promise<string>;
|
|
45
|
-
private _handleHandshake;
|
|
46
|
-
private _handleAction;
|
|
47
|
-
private _err;
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
4
|
//#region src/ActionRuntime/Handler/PeerLink/Acceptor/createActionFetchHandler.d.ts
|
|
51
5
|
interface IActionFetchHandlerOptions {
|
|
52
6
|
/**
|
|
@@ -291,54 +245,5 @@ declare class LinkTransport extends Transport<ETransportShape.duplex> {
|
|
|
291
245
|
getRouteInfo(input: ITransportRouteActionParams): ITransportRouteInfo;
|
|
292
246
|
}
|
|
293
247
|
//#endregion
|
|
294
|
-
//#region src/ActionRuntime/Transport/SecureSession/exchangeProtocol.d.ts
|
|
295
|
-
/**
|
|
296
|
-
* The application-level envelope for secure action traffic over an {@link IExchangeCarrier} (HTTP). An
|
|
297
|
-
* exchange carrier only moves one request frame → one reply frame with no unsolicited push, so the
|
|
298
|
-
* handshake and the per-action token + crypto all ride in this envelope (a JSON string body) rather than
|
|
299
|
-
* on a persistent channel. The three security levels share it:
|
|
300
|
-
*
|
|
301
|
-
* - `none` — no handshake, no token: an `act` envelope carries the plaintext wire both ways.
|
|
302
|
-
* - `authenticated` — a one-time handshake yields a session `token`; each later `act` carries it +
|
|
303
|
-
* the plaintext wire.
|
|
304
|
-
* - `encrypted` — same, but the wire is AES-GCM ciphertext, base64 in the `c` field.
|
|
305
|
-
*
|
|
306
|
-
* The handshake runs as two `hs` exchanges (hello→welcome, prove→accept) correlated by a client-chosen
|
|
307
|
-
* `hsid`, since stateless requests can't rely on channel ordering. The `accept` reply carries the token.
|
|
308
|
-
*/
|
|
309
|
-
type TWireJson = TActionPayload_Any_JsonObject<any, any>;
|
|
310
|
-
/** Connector → acceptor request envelope. */
|
|
311
|
-
type TExchangeRequest = {
|
|
312
|
-
k: "hs";
|
|
313
|
-
hsid: string;
|
|
314
|
-
m: string;
|
|
315
|
-
} | {
|
|
316
|
-
k: "act";
|
|
317
|
-
t?: string;
|
|
318
|
-
w: TWireJson;
|
|
319
|
-
} | {
|
|
320
|
-
k: "act";
|
|
321
|
-
t?: string;
|
|
322
|
-
c: string;
|
|
323
|
-
};
|
|
324
|
-
/** Acceptor → connector reply envelope. */
|
|
325
|
-
type TExchangeReply = {
|
|
326
|
-
k: "hs";
|
|
327
|
-
m: string;
|
|
328
|
-
t?: string;
|
|
329
|
-
} | {
|
|
330
|
-
k: "act";
|
|
331
|
-
w: TWireJson;
|
|
332
|
-
} | {
|
|
333
|
-
k: "act";
|
|
334
|
-
c: string;
|
|
335
|
-
} | {
|
|
336
|
-
k: "err";
|
|
337
|
-
message: string;
|
|
338
|
-
};
|
|
339
|
-
declare function encodeExchange(envelope: TExchangeRequest | TExchangeReply): string;
|
|
340
|
-
declare function decodeExchangeRequest(raw: string): TExchangeRequest | undefined;
|
|
341
|
-
declare function decodeExchangeReply(raw: string): TExchangeReply | undefined;
|
|
342
|
-
//#endregion
|
|
343
248
|
export { AcceptorHandler, ConnectionStateStore, ConnectorHandler, EHandshakeMessageType, ETransportShape, ETransportStatus, ExchangeAcceptor, ExchangeTransport, type IAcceptorConnectionBinding, type IAcceptorHandlerOptions, type IActionFetchHandlerOptions, type IActionFrameCrypto, type IActionFrameCryptoConfig, IActionTransportDef, IActionTransportInitialized, IActionTransportReady, IActionTransportReadyData_Base, type IActionTransportReadyData_Exchange, type IActionTransportReadyData_Link, IActionTransportReadyData_Methods, IActionTransportResolvers, type IActionWireFormat, type IBinaryWireSessionOptions, type IClientHandshakeConfig, type IConnectionAttachment, type IConnectionStateStoreOptions, type IDuplexConnectionRouter, type IExchangeAcceptorConfig, type IExchangeAcceptorSecurity, type IExchangeTransportOptions, type IHandshakeEncryptionKeyMaterial, type IHandshakeResult, type IHibernatableWsServerAdapterOptions, type ILinkTransportOptions, type ISecureAcceptorHandlerOptions, ISecureClientConfig, type IServerHandshakeConfig, type ITransportConnectionContext, ITransportDispatchAction, ITransportMethod_SendActionData_Input, ITransportRouteActionParams, ITransportRouteClientParams, ITransportRouteInfo, ITransportStatusInfo_Base, ITransportStatusInfo_Failed, ITransportStatusInfo_Initializing, ITransportStatusInfo_Ready, ITransportStatusInfo_Unsupported, IUpdateActionRunConfig_Output, LinkTransport, PeerLinkHandler, type TAcceptorCaseFn, type TAcceptorConnectionCaseFn, type TActionChannelFormatMessage, type TActionConnectionEncoding, type TExchangeReply, type TExchangeRequest, TGetTransportFn, type THandshakeMessage, type TLinkFormatMessage, TOnResolveAnyIncomingActionData, TOnResolveAnyIncomingActionData_Json, TOnResolveIncomingRequest, TOnResolveIncomingRequestJson, TOnResolveIncomingResponse, TOnResolveIncomingResponseJson, TSendActionDataMethod, TSendReturnDataMethod, TTransportCache, TTransportInitializationFinishedInfo, TTransportStatusInfo, TTransportStatusInfo_GetTransport_Output, TUpdateActionRunConfig, Transport, createAcceptorHandler, createActionFetchHandler, createActionFrameCrypto, createBinaryWireAdapter, createBinaryWireSessionFactory, createClientHandshake, createConnectionStateStore, createConnectorHandler, createHibernatableWsServerAdapter, createSecureAcceptorHandler, createServerHandshake, decodeExchangeReply, decodeExchangeRequest, decodeHandshakeMessage, encodeExchange, encodeHandshakeMessage };
|
|
344
249
|
//# sourceMappingURL=index.d.mts.map
|
package/build/advanced/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as encodeHandshakeMessage, C as EHandshakeMessageType, D as createServerHandshake, F as ConnectorHandler, I as createConnectorHandler, L as PeerLinkHandler, R as ETransportShape, T as createClientHandshake, _ as extractWirePayload, a as ExchangeAcceptor, b as createAcceptorHandler, c as decodeExchangeReply, d as Transport, f as createBinaryWireSessionFactory, g as buildActionRouteDictionary, h as assembleWireJson, i as createActionFetchHandler, k as decodeHandshakeMessage, l as decodeExchangeRequest, m as ReversePayloadType, n as ConnectionStateStore, o as LinkTransport, p as PayloadTypeToInt, r as createConnectionStateStore, s as ExchangeTransport, t as createHibernatableWsServerAdapter, u as encodeExchange, v as createSecureAcceptorHandler, x as createActionFrameCrypto, y as AcceptorHandler, z as ETransportStatus } from "../createHibernatableWsServerAdapter-
|
|
1
|
+
import { A as encodeHandshakeMessage, C as EHandshakeMessageType, D as createServerHandshake, F as ConnectorHandler, I as createConnectorHandler, L as PeerLinkHandler, R as ETransportShape, T as createClientHandshake, _ as extractWirePayload, a as ExchangeAcceptor, b as createAcceptorHandler, c as decodeExchangeReply, d as Transport, f as createBinaryWireSessionFactory, g as buildActionRouteDictionary, h as assembleWireJson, i as createActionFetchHandler, k as decodeHandshakeMessage, l as decodeExchangeRequest, m as ReversePayloadType, n as ConnectionStateStore, o as LinkTransport, p as PayloadTypeToInt, r as createConnectionStateStore, s as ExchangeTransport, t as createHibernatableWsServerAdapter, u as encodeExchange, v as createSecureAcceptorHandler, x as createActionFrameCrypto, y as AcceptorHandler, z as ETransportStatus } from "../createHibernatableWsServerAdapter-BkjESd01.mjs";
|
|
2
2
|
import { pack, unpack } from "msgpackr";
|
|
3
3
|
//#region src/ActionRuntime/Transport/codec/createBinaryWireAdapter.ts
|
|
4
4
|
/**
|
|
@@ -1403,11 +1403,13 @@ var ActionRuntime = class {
|
|
|
1403
1403
|
* Used to locate the return-path channel for dispatching results back to the action origin.
|
|
1404
1404
|
* Returns `undefined` if no handler matches (score > 0 required, i.e. at least id must match).
|
|
1405
1405
|
*
|
|
1406
|
-
* A handler that currently holds the origin's *live* connection always wins
|
|
1407
|
-
*
|
|
1408
|
-
*
|
|
1409
|
-
*
|
|
1410
|
-
*
|
|
1406
|
+
* A handler that currently holds the origin's *live* connection always wins, regardless of its
|
|
1407
|
+
* coordinate score — owning the live socket bound to the origin's exact coordinate (set from the
|
|
1408
|
+
* handshake) is a strictly more precise match than any env-level `peerClient` score. This lets one
|
|
1409
|
+
* server accept clients of *several* envs over a single acceptor (a multi-role Durable Object): the
|
|
1410
|
+
* result/push routes back over the carrier the client actually connected on even when the handler's
|
|
1411
|
+
* `clientEnv` is unset or names a different env. Only when no handler owns a live connection do we fall
|
|
1412
|
+
* back to the plain best-coordinate-score pick (the offline-return and connector-only cases).
|
|
1411
1413
|
*/
|
|
1412
1414
|
getReturnHandlerForOrigin(originClient) {
|
|
1413
1415
|
if (originClient.envId === "_unset_") return void 0;
|
|
@@ -1422,12 +1424,12 @@ var ActionRuntime = class {
|
|
|
1422
1424
|
bestScore = score;
|
|
1423
1425
|
bestHandler = handler;
|
|
1424
1426
|
}
|
|
1425
|
-
if (
|
|
1427
|
+
if (handler.ownsLiveConnectionFor(originClient) && score > bestOwnedScore) {
|
|
1426
1428
|
bestOwnedScore = score;
|
|
1427
1429
|
bestOwnedHandler = handler;
|
|
1428
1430
|
}
|
|
1429
1431
|
}
|
|
1430
|
-
if (bestOwnedHandler != null
|
|
1432
|
+
if (bestOwnedHandler != null) return bestOwnedHandler;
|
|
1431
1433
|
return bestScore > 0 ? bestHandler : void 0;
|
|
1432
1434
|
}
|
|
1433
1435
|
resetRuntime() {
|
|
@@ -2170,7 +2172,7 @@ var AcceptorHandler = class extends PeerLinkHandler {
|
|
|
2170
2172
|
_codecByConn = /* @__PURE__ */ new Map();
|
|
2171
2173
|
_sessionByConn = /* @__PURE__ */ new Map();
|
|
2172
2174
|
constructor(options) {
|
|
2173
|
-
super(options.clientEnv);
|
|
2175
|
+
super(options.clientEnv ?? RuntimeCoordinate.unknown);
|
|
2174
2176
|
this._formatMessage = options.formatMessage;
|
|
2175
2177
|
this._createFormatMessage = options.createFormatMessage;
|
|
2176
2178
|
this._send = options.send;
|
|
@@ -3715,4 +3717,4 @@ function createHibernatableWsServerAdapter(options) {
|
|
|
3715
3717
|
//#endregion
|
|
3716
3718
|
export { ActionPayload_Request as $, encodeHandshakeMessage as A, EErrId_NiceTransport as B, EHandshakeMessageType as C, createServerHandshake as D, createInMemoryTofuVerifyKeyResolver as E, ConnectorHandler as F, ActionSchema as G, err_nice_external_client as H, createConnectorHandler as I, isActionPayload_Result_JsonObject as J, EActionResponseMode as K, PeerLinkHandler as L, ActionLocalHandler as M, createLocalHandler as N, createStorageTofuVerifyKeyResolver as O, ActionRuntime as P, RunningAction as Q, ETransportShape as R, decodeActionFrame as S, createClientHandshake as T, isActionPayload_Any_JsonObject as U, err_nice_transport as V, isActionPayload_Request_JsonObject as W, EErrId_NiceAction as X, isAction_Base_JsonObject as Y, err_nice_action as Z, extractWirePayload as _, ExchangeAcceptor as a, RuntimeCoordinate as at, createAcceptorHandler as b, decodeExchangeReply as c, Transport as d, ActionPayload_Result as et, createBinaryWireSessionFactory as f, buildActionRouteDictionary as g, assembleWireJson as h, createActionFetchHandler as i, ActionBase as it, runtimeLinkId as j, decodeHandshakeMessage as k, decodeExchangeRequest as l, ReversePayloadType as m, ConnectionStateStore as n, EActionProgressType as nt, LinkTransport as o, runtimeCoordinateToStringIds as ot, PayloadTypeToInt as p, actionSchema as q, createConnectionStateStore as r, ActionPayload as rt, ExchangeTransport as s, createHibernatableWsServerAdapter as t, EActionPayloadType as tt, encodeExchange as u, createSecureAcceptorHandler as v, ESecurityLevel as w, createActionFrameCrypto as x, AcceptorHandler as y, ETransportStatus as z };
|
|
3717
3719
|
|
|
3718
|
-
//# sourceMappingURL=createHibernatableWsServerAdapter-
|
|
3720
|
+
//# sourceMappingURL=createHibernatableWsServerAdapter-BkjESd01.mjs.map
|