@nice-code/action 0.8.0 → 0.9.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/build/ActionDevtoolsCore-B4s6aGvI.d.ts +79 -0
- package/build/ActionDevtoolsCore-BLeY_N-3.js +159 -0
- package/build/ActionDevtoolsCore-BLeY_N-3.js.map +1 -0
- package/build/ActionDevtoolsCore-Pg7ERO3L.d.ts +79 -0
- package/build/ActionDevtoolsCore-yfJ9tkvl.js +154 -0
- package/build/ActionDevtoolsCore-yfJ9tkvl.js.map +1 -0
- package/build/ActionPayload.types-BN-rXFBK.d.ts +2328 -0
- package/build/ActionPayload.types-D28ELKXC.d.ts +2328 -0
- package/build/RunningAction.types-C176rqHG.js +22 -0
- package/build/RunningAction.types-C176rqHG.js.map +1 -0
- package/build/RunningAction.types-DjCX1xp5.js +39 -0
- package/build/RunningAction.types-DjCX1xp5.js.map +1 -0
- package/build/devtools/browser/index.d.ts +17 -0
- package/build/devtools/browser/index.js +3762 -5145
- package/build/devtools/browser/index.js.map +1 -0
- package/build/devtools/server/index.d.ts +35 -0
- package/build/devtools/server/index.js +97 -261
- package/build/devtools/server/index.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +3872 -3870
- package/build/index.js.map +1 -0
- package/build/react-query/index.d.ts +17 -0
- package/build/react-query/index.js +60 -60
- package/build/react-query/index.js.map +1 -0
- package/package.json +11 -10
- package/build/types/ActionDefinition/Action/Action.combined.types.d.ts +0 -37
- package/build/types/ActionDefinition/Action/ActionBase.d.ts +0 -14
- package/build/types/ActionDefinition/Action/ActionBase.types.d.ts +0 -24
- package/build/types/ActionDefinition/Action/Context/ActionContext.d.ts +0 -25
- package/build/types/ActionDefinition/Action/Context/ActionContext.types.d.ts +0 -35
- package/build/types/ActionDefinition/Action/Core/ActionCore.d.ts +0 -19
- package/build/types/ActionDefinition/Action/Core/ActionCore.types.d.ts +0 -10
- package/build/types/ActionDefinition/Action/Payload/ActionPayload.d.ts +0 -14
- package/build/types/ActionDefinition/Action/Payload/ActionPayload.types.d.ts +0 -110
- package/build/types/ActionDefinition/Action/Payload/ActionPayload_Progress.d.ts +0 -15
- package/build/types/ActionDefinition/Action/Payload/ActionPayload_Request.d.ts +0 -26
- package/build/types/ActionDefinition/Action/Payload/ActionPayload_Result.d.ts +0 -19
- package/build/types/ActionDefinition/Action/RunningAction.d.ts +0 -36
- package/build/types/ActionDefinition/Action/RunningAction.types.d.ts +0 -73
- package/build/types/ActionDefinition/Domain/ActionDomain.d.ts +0 -42
- package/build/types/ActionDefinition/Domain/ActionDomain.types.d.ts +0 -43
- package/build/types/ActionDefinition/Domain/ActionDomainBase.d.ts +0 -14
- package/build/types/ActionDefinition/Domain/ActionRootDomain.d.ts +0 -24
- package/build/types/ActionDefinition/Domain/helpers/createRootActionDomain.d.ts +0 -5
- package/build/types/ActionDefinition/Schema/ActionSchema.d.ts +0 -68
- package/build/types/ActionDefinition/Schema/ActionSchema.types.d.ts +0 -28
- package/build/types/ActionRuntime/ActionDomainManager.d.ts +0 -13
- package/build/types/ActionRuntime/ActionRuntime.d.ts +0 -78
- package/build/types/ActionRuntime/ActionRuntime.types.d.ts +0 -22
- package/build/types/ActionRuntime/ActionRuntimeManager.d.ts +0 -20
- package/build/types/ActionRuntime/Handler/ActionHandler.d.ts +0 -16
- package/build/types/ActionRuntime/Handler/ActionHandler.types.d.ts +0 -65
- package/build/types/ActionRuntime/Handler/ExternalClient/ActionExternalClientHandler.d.ts +0 -45
- package/build/types/ActionRuntime/Handler/ExternalClient/ActionExternalClientHandler.types.d.ts +0 -7
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/ConnectionTransportManager.d.ts +0 -16
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/Custom/CustomConnection.d.ts +0 -7
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/Custom/CustomTransport.d.ts +0 -43
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/Custom/TransportCustom.types.d.ts +0 -11
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/Http/HttpConnection.d.ts +0 -8
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/Http/HttpTransport.d.ts +0 -26
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/Http/TransportHttp.types.d.ts +0 -16
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/Transport.d.ts +0 -27
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/Transport.types.d.ts +0 -131
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/TransportConnection.d.ts +0 -27
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/WebSocket/TransportWebSocket.types.d.ts +0 -41
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/WebSocket/WebSocketConnection.d.ts +0 -34
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/WebSocket/WebSocketTransport.d.ts +0 -60
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/WebSocket/actionFrameCrypto.d.ts +0 -31
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/WebSocket/actionWireCodec.d.ts +0 -41
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/WebSocket/actionWsHandshake.d.ts +0 -187
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/WebSocket/createBinaryWsAdapter.d.ts +0 -20
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/WebSocket/createBinaryWsSessionFactory.d.ts +0 -31
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/WebSocket/secureWsChannel.d.ts +0 -63
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/WebSocket/ws_util.d.ts +0 -11
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/err_nice_transport.d.ts +0 -36
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/err_nice_transport_ws.d.ts +0 -18
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/helpers/addTransportStatusMetadata.d.ts +0 -2
- package/build/types/ActionRuntime/Handler/ExternalClient/Transport/helpers/createUnsetTransportResolvers.d.ts +0 -2
- package/build/types/ActionRuntime/Handler/ExternalClient/err_nice_external_client.d.ts +0 -5
- package/build/types/ActionRuntime/Handler/Local/ActionLocalHandler.d.ts +0 -55
- package/build/types/ActionRuntime/Handler/Local/ActionLocalHandler.types.d.ts +0 -7
- package/build/types/ActionRuntime/Handler/Server/ActionServerHandler.d.ts +0 -254
- package/build/types/ActionRuntime/Handler/Server/WsConnectionStateStore.d.ts +0 -61
- package/build/types/ActionRuntime/Handler/Server/createActionFetchHandler.d.ts +0 -40
- package/build/types/ActionRuntime/Handler/Server/createSecureActionServer.d.ts +0 -71
- package/build/types/ActionRuntime/HandlerCallStack.d.ts +0 -3
- package/build/types/ActionRuntime/Routing/ActionRouter.d.ts +0 -55
- package/build/types/ActionRuntime/Routing/ActionRouter.types.d.ts +0 -20
- package/build/types/ActionRuntime/RuntimeCoordinate.d.ts +0 -58
- package/build/types/ActionRuntime/test/helpers/new_action_test_data.d.ts +0 -207
- package/build/types/ActionRuntime/utils/runtimeCoordinateToStringIds.d.ts +0 -2
- package/build/types/devtools/browser/NiceActionDevtools.d.ts +0 -14
- package/build/types/devtools/browser/components/ActionErrorDisplay.d.ts +0 -5
- package/build/types/devtools/browser/components/CallStackSection.d.ts +0 -8
- package/build/types/devtools/browser/components/ChildDispatchChips.d.ts +0 -6
- package/build/types/devtools/browser/components/Chip.d.ts +0 -22
- package/build/types/devtools/browser/components/DetailSection.d.ts +0 -5
- package/build/types/devtools/browser/components/DomainChip.d.ts +0 -8
- package/build/types/devtools/browser/components/HandlerChips.d.ts +0 -21
- package/build/types/devtools/browser/components/Icon.d.ts +0 -16
- package/build/types/devtools/browser/components/MetaSection.d.ts +0 -4
- package/build/types/devtools/browser/components/NiceErrorDisplay.d.ts +0 -19
- package/build/types/devtools/browser/components/OriginChip.d.ts +0 -15
- package/build/types/devtools/browser/components/RoutingSection.d.ts +0 -5
- package/build/types/devtools/browser/components/RunningTimer.d.ts +0 -7
- package/build/types/devtools/browser/components/SectionLabel.d.ts +0 -1
- package/build/types/devtools/browser/components/StackTraceSection.d.ts +0 -9
- package/build/types/devtools/browser/components/Tooltip.d.ts +0 -1
- package/build/types/devtools/browser/components/action_detail/ActionDetailPanel.d.ts +0 -7
- package/build/types/devtools/browser/components/action_list/ActionEntryRow.d.ts +0 -14
- package/build/types/devtools/browser/components/action_list/ActionInputAndOutputChip.d.ts +0 -11
- package/build/types/devtools/browser/components/action_list/ActionList.d.ts +0 -10
- package/build/types/devtools/browser/components/action_list/IoTooltipContent.d.ts +0 -3
- package/build/types/devtools/browser/components/action_list/action_list.types.d.ts +0 -4
- package/build/types/devtools/browser/components/sourceMapResolver.d.ts +0 -6
- package/build/types/devtools/browser/components/utils.d.ts +0 -20
- package/build/types/devtools/browser/devtools_storage.d.ts +0 -6
- package/build/types/devtools/browser/index.d.ts +0 -3
- package/build/types/devtools/browser/ui_util/size.d.ts +0 -6
- package/build/types/devtools/core/ActionDevtools.types.d.ts +0 -55
- package/build/types/devtools/core/ActionDevtoolsCore.d.ts +0 -17
- package/build/types/devtools/core/devtools_colors.d.ts +0 -38
- package/build/types/devtools/server/NiceActionServerDevtools.d.ts +0 -30
- package/build/types/devtools/server/index.d.ts +0 -3
- package/build/types/errors/err_nice_action.d.ts +0 -96
- package/build/types/index.d.ts +0 -43
- package/build/types/nice_action.static.d.ts +0 -3
- package/build/types/react-query/hooks/useActionMutation.d.ts +0 -10
- package/build/types/react-query/hooks/useActionQuery.d.ts +0 -17
- package/build/types/react-query/index.d.ts +0 -2
- package/build/types/utils/assertIsActionJson.d.ts +0 -2
- package/build/types/utils/decodeActionFrame.d.ts +0 -17
- package/build/types/utils/getAssumedRuntimeEnvironment.d.ts +0 -2
- package/build/types/utils/hashPayloadData.d.ts +0 -5
- package/build/types/utils/isActionPayload_Any_JsonObject.d.ts +0 -2
- package/build/types/utils/isActionPayload_Progress_JsonObject.d.ts +0 -2
- package/build/types/utils/isActionPayload_Request_JsonObject.d.ts +0 -2
- package/build/types/utils/isActionPayload_Result_JsonObject.d.ts +0 -2
- package/build/types/utils/isAction_Any_Instance.d.ts +0 -3
- package/build/types/utils/isAction_Any_JsonObject.d.ts +0 -2
- package/build/types/utils/isAction_Base_JsonObject.d.ts +0 -2
- package/build/types/utils/isAction_Context_JsonObject.d.ts +0 -2
- package/build/types/utils/isAction_Core_JsonObject.d.ts +0 -2
- package/build/types/utils/typescript/MaybePromise.d.ts +0 -1
- package/build/types/utils/wait.utils.d.ts +0 -13
package/build/types/ActionRuntime/Handler/ExternalClient/Transport/ConnectionTransportManager.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type IActionTransportReady, type ITransportRouteActionParams, type TTransportCache } from "./Transport.types";
|
|
2
|
-
import type { TransportConnection } from "./TransportConnection";
|
|
3
|
-
export declare class ConnectionTransportManager {
|
|
4
|
-
private _cache;
|
|
5
|
-
private _transports;
|
|
6
|
-
constructor(_cache: TTransportCache);
|
|
7
|
-
addTransport(transport: TransportConnection): void;
|
|
8
|
-
/**
|
|
9
|
-
* The highest-priority transport (first declared). Used to label an action's route *before* the
|
|
10
|
-
* transport has finished connecting — so a still-connecting action shows its (expected) destination
|
|
11
|
-
* instead of an "unknown" hop. {@link getReadyTransport} still decides the real winner, and the
|
|
12
|
-
* caller corrects the hop if a lower-priority transport ends up serving the action.
|
|
13
|
-
*/
|
|
14
|
-
getPreferredTransport(): TransportConnection | undefined;
|
|
15
|
-
getReadyTransport(routeActionParams: ITransportRouteActionParams): Promise<IActionTransportReady>;
|
|
16
|
-
}
|
package/build/types/ActionRuntime/Handler/ExternalClient/Transport/Custom/CustomConnection.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ETransportType, type IActionTransportReadyData_Methods, type ITransportRouteActionParams } from "../Transport.types";
|
|
2
|
-
import { TransportConnection } from "../TransportConnection";
|
|
3
|
-
import type { IActionTransportDef_Custom, IActionTransportInitialized_Custom, IActionTransportReadyData_Custom, TActionTransportDef_Custom_NoType } from "./TransportCustom.types";
|
|
4
|
-
export declare class CustomConnection extends TransportConnection<ETransportType.custom, ITransportRouteActionParams, IActionTransportReadyData_Custom, IActionTransportInitialized_Custom, IActionTransportDef_Custom> {
|
|
5
|
-
constructor(def: TActionTransportDef_Custom_NoType);
|
|
6
|
-
protected _finalizeTransportMethods(inputs: IActionTransportReadyData_Custom): IActionTransportReadyData_Methods;
|
|
7
|
-
}
|
package/build/types/ActionRuntime/Handler/ExternalClient/Transport/Custom/CustomTransport.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { type ITransportConnectionContext, Transport } from "../Transport";
|
|
2
|
-
import { ETransportType, type ITransportMethod_SendActionData_Input, type ITransportRouteActionParams, type ITransportRouteInfo, type TSendReturnDataMethod, type TUpdateActionRunConfig } from "../Transport.types";
|
|
3
|
-
import { CustomConnection } from "./CustomConnection";
|
|
4
|
-
import type { IActionTransportInitialized_Custom } from "./TransportCustom.types";
|
|
5
|
-
interface ICustomTransportSharedOptions {
|
|
6
|
-
updateRunConfig?: TUpdateActionRunConfig;
|
|
7
|
-
getTransportCacheKey?: (input: ITransportRouteActionParams) => string[];
|
|
8
|
-
/** Short label shown in the devtools chip (defaults to "custom"). */
|
|
9
|
-
label?: string;
|
|
10
|
-
/** Override the devtools route info for a specific action. */
|
|
11
|
-
getRouteInfo?: (input: ITransportRouteActionParams) => ITransportRouteInfo;
|
|
12
|
-
}
|
|
13
|
-
export interface ICustomTransportSendOptions extends ICustomTransportSharedOptions {
|
|
14
|
-
/** Send a request/progress payload to the external client. */
|
|
15
|
-
sendActionData: (input: ITransportMethod_SendActionData_Input) => void;
|
|
16
|
-
/** Optional return-path dispatch for bidirectional channels. */
|
|
17
|
-
sendReturnData?: TSendReturnDataMethod;
|
|
18
|
-
closeTransport?: (input?: ITransportRouteActionParams) => void;
|
|
19
|
-
}
|
|
20
|
-
export interface ICustomTransportAdvancedOptions extends ICustomTransportSharedOptions {
|
|
21
|
-
/** Full control over readiness/initialization for the custom channel. */
|
|
22
|
-
getTransport: IActionTransportInitialized_Custom["getTransport"];
|
|
23
|
-
}
|
|
24
|
-
export type TCustomTransportOptions = (ICustomTransportSendOptions & {
|
|
25
|
-
mode: "send";
|
|
26
|
-
}) | (ICustomTransportAdvancedOptions & {
|
|
27
|
-
mode: "advanced";
|
|
28
|
-
});
|
|
29
|
-
/**
|
|
30
|
-
* Reusable custom transport definition for channels nice-action doesn't model natively. Create one
|
|
31
|
-
* with `CustomTransport.create({ sendActionData })` for the simple case, or
|
|
32
|
-
* `CustomTransport.createAdvanced({ getTransport })` for full control over the lifecycle.
|
|
33
|
-
*/
|
|
34
|
-
export declare class CustomTransport extends Transport<ETransportType.custom> {
|
|
35
|
-
private readonly options;
|
|
36
|
-
readonly type = ETransportType.custom;
|
|
37
|
-
constructor(options: TCustomTransportOptions);
|
|
38
|
-
static create(options: ICustomTransportSendOptions): CustomTransport;
|
|
39
|
-
static createAdvanced(options: ICustomTransportAdvancedOptions): CustomTransport;
|
|
40
|
-
_createConnection(_ctx: ITransportConnectionContext): CustomConnection;
|
|
41
|
-
getRouteInfo(input: ITransportRouteActionParams): ITransportRouteInfo;
|
|
42
|
-
}
|
|
43
|
-
export {};
|
package/build/types/ActionRuntime/Handler/ExternalClient/Transport/Custom/TransportCustom.types.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ETransportType, IActionTransportDef, IActionTransportInitialized, IActionTransportReadyData_Base, ITransportMethod_SendActionData_Input, ITransportRouteActionParams, TSendReturnDataMethod } from "../Transport.types";
|
|
2
|
-
export interface IActionTransportReadyData_Custom extends IActionTransportReadyData_Base {
|
|
3
|
-
sendActionData: (input: ITransportMethod_SendActionData_Input) => void;
|
|
4
|
-
sendReturnData?: TSendReturnDataMethod;
|
|
5
|
-
closeTransport: (input?: ITransportRouteActionParams) => void;
|
|
6
|
-
}
|
|
7
|
-
export interface IActionTransportInitialized_Custom extends IActionTransportInitialized<ITransportRouteActionParams, IActionTransportReadyData_Custom> {
|
|
8
|
-
}
|
|
9
|
-
export interface IActionTransportDef_Custom extends IActionTransportDef<ETransportType.custom, IActionTransportInitialized_Custom> {
|
|
10
|
-
}
|
|
11
|
-
export type TActionTransportDef_Custom_NoType = Omit<IActionTransportDef_Custom, "type">;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ETransportType, type IActionTransportReadyData_Methods, type ITransportDispatchAction, type ITransportRouteActionParams } from "../Transport.types";
|
|
2
|
-
import { TransportConnection } from "../TransportConnection";
|
|
3
|
-
import type { IActionTransportDef_Http, IActionTransportInitialized_Http, IActionTransportReadyData_Http, IActionTransportReadyParams_Http } from "./TransportHttp.types";
|
|
4
|
-
export declare class HttpConnection extends TransportConnection<ETransportType.http, ITransportRouteActionParams, IActionTransportReadyData_Http, IActionTransportInitialized_Http, IActionTransportDef_Http> {
|
|
5
|
-
constructor(def: Omit<IActionTransportDef_Http, "type">);
|
|
6
|
-
_finalizeTransportMethods(methods: IActionTransportReadyData_Http): IActionTransportReadyData_Methods;
|
|
7
|
-
protected send(input: ITransportDispatchAction<IActionTransportReadyParams_Http>): Promise<void>;
|
|
8
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type ITransportConnectionContext, Transport } from "../Transport";
|
|
2
|
-
import { ETransportType, type ITransportRouteActionParams, type ITransportRouteInfo, type TUpdateActionRunConfig } from "../Transport.types";
|
|
3
|
-
import { HttpConnection } from "./HttpConnection";
|
|
4
|
-
import type { IHttpRequestParams } from "./TransportHttp.types";
|
|
5
|
-
export interface IHttpTransportOptions {
|
|
6
|
-
/**
|
|
7
|
-
* Build the HTTP request for an action. Return a static request for the simple case, or derive the
|
|
8
|
-
* url / headers / body from the action params for full control.
|
|
9
|
-
*/
|
|
10
|
-
createRequest: (input: ITransportRouteActionParams) => IHttpRequestParams;
|
|
11
|
-
updateRunConfig?: TUpdateActionRunConfig;
|
|
12
|
-
getTransportCacheKey?: (input: ITransportRouteActionParams) => string[];
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Reusable HTTP transport definition. Create one with `HttpTransport.create({ createRequest })` — the
|
|
16
|
-
* single `createRequest` function lets you keep it simple (`() => ({ url })`) or derive the request
|
|
17
|
-
* per action.
|
|
18
|
-
*/
|
|
19
|
-
export declare class HttpTransport extends Transport<ETransportType.http> {
|
|
20
|
-
private readonly options;
|
|
21
|
-
readonly type = ETransportType.http;
|
|
22
|
-
constructor(options: IHttpTransportOptions);
|
|
23
|
-
static create(options: IHttpTransportOptions): HttpTransport;
|
|
24
|
-
_createConnection(_ctx: ITransportConnectionContext): HttpConnection;
|
|
25
|
-
getRouteInfo(input: ITransportRouteActionParams): ITransportRouteInfo;
|
|
26
|
-
}
|
package/build/types/ActionRuntime/Handler/ExternalClient/Transport/Http/TransportHttp.types.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ETransportType, IActionTransportDef, IActionTransportInitialized, IActionTransportReadyData_Base, ITransportRouteActionParams } from "../Transport.types";
|
|
2
|
-
export interface IHttpRequestParams {
|
|
3
|
-
url: string;
|
|
4
|
-
headers?: Record<string, string>;
|
|
5
|
-
body?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface IActionTransportReadyParams_Http {
|
|
8
|
-
request: IHttpRequestParams;
|
|
9
|
-
}
|
|
10
|
-
export interface IActionTransportReadyData_Http extends IActionTransportReadyData_Base {
|
|
11
|
-
createRequest: (input: ITransportRouteActionParams) => IHttpRequestParams;
|
|
12
|
-
}
|
|
13
|
-
export interface IActionTransportInitialized_Http extends IActionTransportInitialized<ITransportRouteActionParams, IActionTransportReadyData_Http> {
|
|
14
|
-
}
|
|
15
|
-
export interface IActionTransportDef_Http extends IActionTransportDef<ETransportType.http, IActionTransportInitialized_Http> {
|
|
16
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { IActionTransportResolvers } from "./Transport.types";
|
|
2
|
-
import { type ETransportType, type ITransportRouteActionParams, type ITransportRouteInfo } from "./Transport.types";
|
|
3
|
-
import type { TransportConnection } from "./TransportConnection";
|
|
4
|
-
/**
|
|
5
|
-
* Context handed to a {@link Transport} definition when a handler builds a live connection from it.
|
|
6
|
-
* Only bidirectional transports (WebSocket / Custom) make use of `resolvers`.
|
|
7
|
-
*/
|
|
8
|
-
export interface ITransportConnectionContext {
|
|
9
|
-
resolvers?: IActionTransportResolvers;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Reusable transport definition. Devs construct these (`HttpTransport.create({ createRequest })`,
|
|
13
|
-
* `WebSocketTransport.create({ createWebSocket })`, …) and pass them to an
|
|
14
|
-
* `ActionExternalClientHandler`. A single
|
|
15
|
-
* definition can be shared across multiple handlers — each handler builds its own live
|
|
16
|
-
* {@link TransportConnection} via {@link TransportConnection._createConnection}.
|
|
17
|
-
*/
|
|
18
|
-
export declare abstract class Transport<T extends ETransportType = ETransportType> {
|
|
19
|
-
abstract readonly type: T;
|
|
20
|
-
/** Internal: build a fresh, per-handler live connection from this definition. */
|
|
21
|
-
abstract _createConnection(ctx: ITransportConnectionContext): TransportConnection<T>;
|
|
22
|
-
/**
|
|
23
|
-
* Resolve human-readable info about how a specific action would be routed through this transport
|
|
24
|
-
* (e.g. the request URL/method, or the WebSocket endpoint). Surfaced in the action devtools.
|
|
25
|
-
*/
|
|
26
|
-
abstract getRouteInfo(input: ITransportRouteActionParams): ITransportRouteInfo;
|
|
27
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import type { NiceError } from "@nice-code/error";
|
|
2
|
-
import type { IActionPayload_Request_JsonObject, IActionPayload_Result_JsonObject, TActionPayload_Any_Instance, TActionPayload_Any_JsonObject } from "../../../../ActionDefinition/Action/Payload/ActionPayload.types";
|
|
3
|
-
import type { ActionPayload_Request } from "../../../../ActionDefinition/Action/Payload/ActionPayload_Request";
|
|
4
|
-
import type { ActionPayload_Result } from "../../../../ActionDefinition/Action/Payload/ActionPayload_Result";
|
|
5
|
-
import type { RunningAction } from "../../../../ActionDefinition/Action/RunningAction";
|
|
6
|
-
import type { RuntimeCoordinate } from "../../../RuntimeCoordinate";
|
|
7
|
-
import type { TransportConnection } from "./TransportConnection";
|
|
8
|
-
export declare enum ETransportType {
|
|
9
|
-
ws = "ws",
|
|
10
|
-
http = "http",
|
|
11
|
-
custom = "custom"
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Serializable, display-only description of how an action was routed through a transport. Stored on
|
|
15
|
-
* the action's route items and shown in the devtools external-handler chips. Keep this free of
|
|
16
|
-
* sensitive data (e.g. auth headers) — route items travel over the wire.
|
|
17
|
-
*/
|
|
18
|
-
export interface ITransportRouteInfo {
|
|
19
|
-
type: ETransportType;
|
|
20
|
-
/** Short label for chips, e.g. "POST /resolve_action" or "ws host/resolve_action/ws". */
|
|
21
|
-
summary?: string;
|
|
22
|
-
url?: string;
|
|
23
|
-
method?: string;
|
|
24
|
-
detail?: Record<string, string | number | boolean>;
|
|
25
|
-
}
|
|
26
|
-
export interface IUpdateActionRunConfig_Output {
|
|
27
|
-
timeout?: number;
|
|
28
|
-
}
|
|
29
|
-
export type TUpdateActionRunConfig = (input: ITransportRouteActionParams & {
|
|
30
|
-
timeout: number;
|
|
31
|
-
}) => IUpdateActionRunConfig_Output;
|
|
32
|
-
export interface IActionTransportReadyData_Base {
|
|
33
|
-
updateRunConfig?: TUpdateActionRunConfig;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* TRANSPORT READINESS RESPONSE
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
|
-
export declare enum ETransportStatus {
|
|
41
|
-
uninitialized = "uninitialized",
|
|
42
|
-
unsupported = "unsupported",
|
|
43
|
-
initializing = "initializing",
|
|
44
|
-
ready = "ready",
|
|
45
|
-
failed = "failed"
|
|
46
|
-
}
|
|
47
|
-
export interface ITransportStatusInfo_Base<S extends ETransportStatus> {
|
|
48
|
-
status: S;
|
|
49
|
-
}
|
|
50
|
-
export interface ITransportStatusInfo_Failed extends ITransportStatusInfo_Base<ETransportStatus.failed> {
|
|
51
|
-
error: NiceError;
|
|
52
|
-
timeFailed: number;
|
|
53
|
-
}
|
|
54
|
-
export interface ITransportStatusInfo_Unsupported extends ITransportStatusInfo_Base<ETransportStatus.unsupported> {
|
|
55
|
-
}
|
|
56
|
-
export interface ITransportStatusInfo_Ready<READY extends IActionTransportReadyData_Base> extends ITransportStatusInfo_Base<ETransportStatus.ready> {
|
|
57
|
-
readyData: READY;
|
|
58
|
-
}
|
|
59
|
-
export type TTransportInitializationFinishedInfo<READY extends IActionTransportReadyData_Base> = ITransportStatusInfo_Ready<READY> | ITransportStatusInfo_Failed | ITransportStatusInfo_Unsupported;
|
|
60
|
-
export interface ITransportStatusInfo_Initializing<READY extends IActionTransportReadyData_Base> extends ITransportStatusInfo_Base<ETransportStatus.initializing> {
|
|
61
|
-
timeStarted: number;
|
|
62
|
-
initializationPromise: Promise<TTransportInitializationFinishedInfo<READY>>;
|
|
63
|
-
}
|
|
64
|
-
export type TTransportStatusInfo<READY extends IActionTransportReadyData_Base> = ITransportStatusInfo_Base<ETransportStatus.uninitialized> | ITransportStatusInfo_Unsupported | ITransportStatusInfo_Initializing<READY> | ITransportStatusInfo_Ready<READY> | ITransportStatusInfo_Failed;
|
|
65
|
-
export type TTransportStatusInfo_GetTransport_Output<READY extends IActionTransportReadyData_Base> = ITransportStatusInfo_Base<ETransportStatus.uninitialized> | ITransportStatusInfo_Unsupported | Omit<ITransportStatusInfo_Initializing<READY>, "timeStarted"> | ITransportStatusInfo_Ready<READY> | Omit<ITransportStatusInfo_Failed, "timeFailed">;
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
* TRANSPORT ROUTING
|
|
69
|
-
*
|
|
70
|
-
*/
|
|
71
|
-
export interface ITransportRouteClientParams {
|
|
72
|
-
localClient: RuntimeCoordinate;
|
|
73
|
-
externalClient: RuntimeCoordinate;
|
|
74
|
-
}
|
|
75
|
-
export interface ITransportRouteActionParams extends ITransportRouteClientParams {
|
|
76
|
-
action: TActionPayload_Any_Instance<any, any>;
|
|
77
|
-
}
|
|
78
|
-
export interface ITransportMethod_SendActionData_Input extends ITransportRouteActionParams {
|
|
79
|
-
runningAction: RunningAction<any, any>;
|
|
80
|
-
timeout: number;
|
|
81
|
-
}
|
|
82
|
-
export interface ITransportDispatchAction<P> extends ITransportMethod_SendActionData_Input {
|
|
83
|
-
params: P;
|
|
84
|
-
}
|
|
85
|
-
export type TSendActionDataMethod = (input: ITransportMethod_SendActionData_Input) => void;
|
|
86
|
-
export type TSendReturnDataMethod = (payload: TActionPayload_Any_Instance<any, any>,
|
|
87
|
-
/**
|
|
88
|
-
* The local/external client pair this payload is being returned over. Bidirectional transports use
|
|
89
|
-
* it to build the full route params their outgoing formatter expects (e.g. binary packing). Optional
|
|
90
|
-
* so existing return-data implementations keep type-checking.
|
|
91
|
-
*/
|
|
92
|
-
clients?: ITransportRouteClientParams) => void;
|
|
93
|
-
export interface IActionTransportReadyData_Methods extends IActionTransportReadyData_Base {
|
|
94
|
-
sendActionData: TSendActionDataMethod;
|
|
95
|
-
/**
|
|
96
|
-
* Optional — implement on bidirectional transports (WebSocket, Custom) to enable return-path
|
|
97
|
-
* routing. When present, the runtime uses this to dispatch results and progress payloads directly
|
|
98
|
-
* back to `originClient` without going through the original request transport.
|
|
99
|
-
*/
|
|
100
|
-
sendReturnData?: TSendReturnDataMethod;
|
|
101
|
-
addOnDisconnectListener?: (callback: () => void) => void;
|
|
102
|
-
/**
|
|
103
|
-
* Optional — implement on transports holding a long-lived connection (WebSocket, Custom) to close it
|
|
104
|
-
* deliberately. Called by `ActionExternalClientHandler.clearTransportCache()` so a teardown actually
|
|
105
|
-
* releases the underlying socket instead of leaving it open until GC.
|
|
106
|
-
*/
|
|
107
|
-
disconnect?: () => void;
|
|
108
|
-
}
|
|
109
|
-
export interface IActionTransportReady {
|
|
110
|
-
methods: IActionTransportReadyData_Methods;
|
|
111
|
-
transport: TransportConnection;
|
|
112
|
-
}
|
|
113
|
-
export type TTransportCache = Map<string, IActionTransportReady | Promise<IActionTransportReady>>;
|
|
114
|
-
export type TOnResolveIncomingRequest = (request: ActionPayload_Request<any>) => void;
|
|
115
|
-
export type TOnResolveIncomingRequestJson = (request: IActionPayload_Request_JsonObject<any>) => void;
|
|
116
|
-
export type TOnResolveIncomingResponse = (response: ActionPayload_Result<any>) => void;
|
|
117
|
-
export type TOnResolveIncomingResponseJson = (response: IActionPayload_Result_JsonObject<any>) => void;
|
|
118
|
-
export type TOnResolveAnyIncomingActionData = (actionData: ActionPayload_Request<any> | ActionPayload_Result<any>) => void;
|
|
119
|
-
export type TOnResolveAnyIncomingActionData_Json = (actionData: TActionPayload_Any_JsonObject<any>) => void;
|
|
120
|
-
export interface IActionTransportResolvers {
|
|
121
|
-
onIncomingActionDataJson: TOnResolveAnyIncomingActionData_Json;
|
|
122
|
-
}
|
|
123
|
-
export type TGetTransportFn<IN extends ITransportRouteActionParams, READY extends IActionTransportReadyData_Base> = (input: IN) => TTransportStatusInfo_GetTransport_Output<READY>;
|
|
124
|
-
export interface IActionTransportInitialized<IN extends ITransportRouteActionParams, READY extends IActionTransportReadyData_Base> {
|
|
125
|
-
getTransportCacheKey?: (input: IN) => string[];
|
|
126
|
-
getTransport: TGetTransportFn<IN, READY>;
|
|
127
|
-
}
|
|
128
|
-
export interface IActionTransportDef<TYPE extends ETransportType, INIT extends IActionTransportInitialized<any, any>> {
|
|
129
|
-
type: TYPE;
|
|
130
|
-
initialize: () => INIT;
|
|
131
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Transport } from "./Transport";
|
|
2
|
-
import { type ETransportType, type IActionTransportDef, type IActionTransportInitialized, type IActionTransportReadyData_Base, type IActionTransportReadyData_Methods, type ITransportRouteActionParams, type ITransportRouteInfo, type TTransportStatusInfo } from "./Transport.types";
|
|
3
|
-
/**
|
|
4
|
-
* Live, per-handler transport runtime built from a reusable {@link Transport} definition. Holds the
|
|
5
|
-
* connection-scoped state (ordinal, initialized config, sockets / abort sets) that must not be shared
|
|
6
|
-
* across handlers. Construct these via `definition._createConnection(...)`, never directly.
|
|
7
|
-
*/
|
|
8
|
-
export declare abstract class TransportConnection<T extends ETransportType = ETransportType, RP extends ITransportRouteActionParams = ITransportRouteActionParams, RD extends IActionTransportReadyData_Base = IActionTransportReadyData_Base, I extends IActionTransportInitialized<RP, RD> = IActionTransportInitialized<RP, RD>, DEF extends IActionTransportDef<T, I> = IActionTransportDef<T, I>> {
|
|
9
|
-
readonly def: DEF;
|
|
10
|
-
readonly transOrd: number;
|
|
11
|
-
readonly type: T;
|
|
12
|
-
readonly initialized: I;
|
|
13
|
-
/** Backref to the public definition that created this connection (used for devtools route info). */
|
|
14
|
-
definition?: Transport<T>;
|
|
15
|
-
constructor(def: DEF);
|
|
16
|
-
/**
|
|
17
|
-
* Devtools route info for an action routed through this live connection. Defaults to the stateless
|
|
18
|
-
* {@link definition}'s info; connections override to enrich it from live state (e.g. the actual
|
|
19
|
-
* resolved socket URL) when the definition couldn't resolve it on its own.
|
|
20
|
-
*/
|
|
21
|
-
getRouteInfo(input: RP): ITransportRouteInfo | undefined;
|
|
22
|
-
protected abstract _finalizeTransportMethods(inputs: RD): IActionTransportReadyData_Methods;
|
|
23
|
-
protected _getCacheKey(input: RP): string | null;
|
|
24
|
-
getCacheKey(input: RP): string | null;
|
|
25
|
-
getTransport(input: RP): TTransportStatusInfo<IActionTransportReadyData_Methods>;
|
|
26
|
-
protected _processTransportStatus(input: RP): TTransportStatusInfo<IActionTransportReadyData_Methods>;
|
|
27
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { ClientCryptoKeyLink } from "@nice-code/util";
|
|
2
|
-
import type { TActionPayload_Any_JsonObject } from "../../../../../ActionDefinition/Action/Payload/ActionPayload.types";
|
|
3
|
-
import type { IRuntimeCoordinate } from "../../../../RuntimeCoordinate";
|
|
4
|
-
import type { ETransportType, IActionTransportDef, IActionTransportInitialized, IActionTransportReadyData_Base, ITransportRouteActionParams } from "../Transport.types";
|
|
5
|
-
import type { ESecurityLevel } from "./actionWsHandshake";
|
|
6
|
-
/**
|
|
7
|
-
* Client-side secure-channel config for a WebSocket. When present (and `securityLevel !== none`), the
|
|
8
|
-
* connection runs the {@link createClientHandshake} handshake during initialization — authenticating
|
|
9
|
-
* the identity and, for the `encrypted` level, deriving a shared key that encrypts every action frame.
|
|
10
|
-
*/
|
|
11
|
-
export interface IWsClientSecureChannel {
|
|
12
|
-
securityLevel: ESecurityLevel;
|
|
13
|
-
/** This client's crypto identity (verify + exchange key pairs, optionally persisted). */
|
|
14
|
-
link: ClientCryptoKeyLink;
|
|
15
|
-
/** This client's runtime coordinate — its authenticated identity to the server. */
|
|
16
|
-
localCoordinate: IRuntimeCoordinate;
|
|
17
|
-
/** Wire dictionary version; the server rejects the handshake on a mismatch. */
|
|
18
|
-
dictionaryVersion: string;
|
|
19
|
-
}
|
|
20
|
-
export interface IActionTransportReadyData_Ws extends IActionTransportReadyData_Base {
|
|
21
|
-
formatMessage?: {
|
|
22
|
-
/**
|
|
23
|
-
* Pack an outgoing action payload. Return a `string` for text frames (JSON) or a binary
|
|
24
|
-
* `Uint8Array`/`ArrayBuffer` for optimized binary frames (e.g. msgpackr).
|
|
25
|
-
*/
|
|
26
|
-
outgoing: (input: ITransportRouteActionParams) => string | Uint8Array | ArrayBuffer;
|
|
27
|
-
/**
|
|
28
|
-
* Unpack an incoming frame back into the wire JSON object the runtime hydrates + validates.
|
|
29
|
-
* Return `undefined` to defer to the connection's built-in JSON parser — this is how binary
|
|
30
|
-
* adapters stay backward compatible with plain-JSON clients on the same socket.
|
|
31
|
-
*/
|
|
32
|
-
incoming?: (input: string | ArrayBuffer | Uint8Array | Blob) => TActionPayload_Any_JsonObject<any, any> | undefined;
|
|
33
|
-
};
|
|
34
|
-
ws: WebSocket;
|
|
35
|
-
/** Optional authenticated/encrypted channel; the connection runs the handshake during init. */
|
|
36
|
-
secureChannel?: IWsClientSecureChannel;
|
|
37
|
-
}
|
|
38
|
-
export interface IActionTransportInitialized_Ws extends IActionTransportInitialized<ITransportRouteActionParams, IActionTransportReadyData_Ws> {
|
|
39
|
-
}
|
|
40
|
-
export interface IActionTransportDef_Ws extends IActionTransportDef<ETransportType.ws, IActionTransportInitialized_Ws> {
|
|
41
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ETransportType, type IActionTransportReadyData_Methods, type IActionTransportResolvers, type ITransportRouteActionParams, type ITransportRouteInfo, type TTransportStatusInfo } from "../Transport.types";
|
|
2
|
-
import { TransportConnection } from "../TransportConnection";
|
|
3
|
-
import type { IActionTransportDef_Ws, IActionTransportInitialized_Ws, IActionTransportReadyData_Ws } from "./TransportWebSocket.types";
|
|
4
|
-
export declare class WebSocketConnection extends TransportConnection<ETransportType.ws, ITransportRouteActionParams, IActionTransportReadyData_Ws, IActionTransportInitialized_Ws, IActionTransportDef_Ws> {
|
|
5
|
-
private resolvers;
|
|
6
|
-
/** URL of the most recently resolved live socket — surfaced to devtools when the definition can't. */
|
|
7
|
-
private _liveSocketUrl?;
|
|
8
|
-
/** Sockets we closed on purpose (via `disconnect`), so their `close` event stays quiet. */
|
|
9
|
-
private _intentionalCloses;
|
|
10
|
-
constructor(def: Omit<IActionTransportDef_Ws, "type">, resolvers?: IActionTransportResolvers);
|
|
11
|
-
protected _getCacheKey(_input: ITransportRouteActionParams): string;
|
|
12
|
-
protected _processTransportStatus(input: ITransportRouteActionParams): TTransportStatusInfo<IActionTransportReadyData_Methods>;
|
|
13
|
-
getRouteInfo(input: ITransportRouteActionParams): ITransportRouteInfo | undefined;
|
|
14
|
-
private _isSecure;
|
|
15
|
-
private _awaitOpen;
|
|
16
|
-
/** Non-secure connections finalize synchronously; secure ones run the handshake first. */
|
|
17
|
-
private _finalize;
|
|
18
|
-
_finalizeTransportMethods(wsData: IActionTransportReadyData_Ws): IActionTransportReadyData_Methods;
|
|
19
|
-
/**
|
|
20
|
-
* Secure path: a single message listener feeds the handshake until it completes, then routes action
|
|
21
|
-
* frames (decrypting for the `encrypted` level). Frames that arrive in the gap between accept and
|
|
22
|
-
* activation are buffered and flushed, so nothing is lost.
|
|
23
|
-
*/
|
|
24
|
-
private _finalizeSecureMethods;
|
|
25
|
-
private _runClientHandshake;
|
|
26
|
-
private _buildSendMethods;
|
|
27
|
-
/** Decode (and, when encrypted, decrypt) one inbound action frame and hand it to the runtime. */
|
|
28
|
-
private _handleIncomingActionFrame;
|
|
29
|
-
/** Accept text + binary frames (ArrayBuffer / Uint8Array / Blob); Blobs are converted to a buffer. */
|
|
30
|
-
private _normalizeFrame;
|
|
31
|
-
private _captureSocketUrl;
|
|
32
|
-
private _attachLifecycle;
|
|
33
|
-
private _abortAll;
|
|
34
|
-
}
|
package/build/types/ActionRuntime/Handler/ExternalClient/Transport/WebSocket/WebSocketTransport.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { type ITransportConnectionContext, Transport } from "../Transport";
|
|
2
|
-
import { ETransportType, type ITransportRouteActionParams, type ITransportRouteInfo, type TUpdateActionRunConfig } from "../Transport.types";
|
|
3
|
-
import type { IActionTransportInitialized_Ws, IActionTransportReadyData_Ws } from "./TransportWebSocket.types";
|
|
4
|
-
import { WebSocketConnection } from "./WebSocketConnection";
|
|
5
|
-
interface IWebSocketTransportSharedOptions {
|
|
6
|
-
/** Custom (de)serialization of action payloads on the wire (shared across all sockets). */
|
|
7
|
-
formatMessage?: IActionTransportReadyData_Ws["formatMessage"];
|
|
8
|
-
/**
|
|
9
|
-
* Per-socket codec factory — called once for each socket so stateful codecs (e.g. the
|
|
10
|
-
* `createBinaryWsSessionFactory` session, which holds per-connection correlation + identity state)
|
|
11
|
-
* get their own instance and reset cleanly on reconnect. Takes precedence over `formatMessage`.
|
|
12
|
-
*/
|
|
13
|
-
createFormatMessage?: () => IActionTransportReadyData_Ws["formatMessage"];
|
|
14
|
-
updateRunConfig?: TUpdateActionRunConfig;
|
|
15
|
-
/**
|
|
16
|
-
* Keys that identify a reusable socket, so a single socket is shared across actions to the same
|
|
17
|
-
* endpoint instead of opening one per action.
|
|
18
|
-
*/
|
|
19
|
-
getTransportCacheKey?: (input: ITransportRouteActionParams) => string[];
|
|
20
|
-
/** Override the devtools route info for a specific action. */
|
|
21
|
-
getRouteInfo?: (input: ITransportRouteActionParams) => ITransportRouteInfo;
|
|
22
|
-
/**
|
|
23
|
-
* Secure-channel config. When set (and `securityLevel !== none`), the connection runs the
|
|
24
|
-
* authenticated handshake during initialization and, at the `encrypted` level, encrypts every frame.
|
|
25
|
-
*/
|
|
26
|
-
security?: IActionTransportReadyData_Ws["secureChannel"];
|
|
27
|
-
}
|
|
28
|
-
export interface IWebSocketTransportSocketOptions extends IWebSocketTransportSharedOptions {
|
|
29
|
-
/** Open (or reuse) the WebSocket for an action — keep it simple or derive it per action. */
|
|
30
|
-
createWebSocket: (input: ITransportRouteActionParams) => WebSocket;
|
|
31
|
-
}
|
|
32
|
-
export interface IWebSocketTransportAdvancedOptions extends IWebSocketTransportSharedOptions {
|
|
33
|
-
/**
|
|
34
|
-
* Full control over readiness/initialization. Use this for contextual support detection (return
|
|
35
|
-
* `{ status: ETransportStatus.unsupported }` when the socket shouldn't be used) or async url
|
|
36
|
-
* building (return `{ status: ETransportStatus.initializing, initializationPromise }` that resolves
|
|
37
|
-
* to a `ready` socket).
|
|
38
|
-
*/
|
|
39
|
-
getTransport: IActionTransportInitialized_Ws["getTransport"];
|
|
40
|
-
}
|
|
41
|
-
export type TWebSocketTransportOptions = (IWebSocketTransportSocketOptions & {
|
|
42
|
-
mode: "socket";
|
|
43
|
-
}) | (IWebSocketTransportAdvancedOptions & {
|
|
44
|
-
mode: "advanced";
|
|
45
|
-
});
|
|
46
|
-
/**
|
|
47
|
-
* Reusable WebSocket transport definition. Create one with `WebSocketTransport.create({ createWebSocket })`
|
|
48
|
-
* for the common case, or `WebSocketTransport.createAdvanced({ getTransport })` for full control over
|
|
49
|
-
* readiness. The underlying socket is cached (via `getTransportCacheKey`) and reused across actions.
|
|
50
|
-
*/
|
|
51
|
-
export declare class WebSocketTransport extends Transport<ETransportType.ws> {
|
|
52
|
-
private readonly options;
|
|
53
|
-
readonly type = ETransportType.ws;
|
|
54
|
-
constructor(options: TWebSocketTransportOptions);
|
|
55
|
-
static create(options: IWebSocketTransportSocketOptions): WebSocketTransport;
|
|
56
|
-
static createAdvanced(options: IWebSocketTransportAdvancedOptions): WebSocketTransport;
|
|
57
|
-
_createConnection(ctx: ITransportConnectionContext): WebSocketConnection;
|
|
58
|
-
getRouteInfo(input: ITransportRouteActionParams): ITransportRouteInfo;
|
|
59
|
-
}
|
|
60
|
-
export {};
|
package/build/types/ActionRuntime/Handler/ExternalClient/Transport/WebSocket/actionFrameCrypto.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { ClientCryptoKeyLink, TTypeAndId } from "@nice-code/util";
|
|
2
|
-
/**
|
|
3
|
-
* Async AES-GCM transform for the `encrypted` security level. It wraps the opaque binary frame a
|
|
4
|
-
* session codec produces (it does NOT look inside it), encrypting on the way out and decrypting on the
|
|
5
|
-
* way in with the shared key established by the handshake.
|
|
6
|
-
*
|
|
7
|
-
* It is deliberately separate from the (synchronous) session `formatMessage`: WebCrypto is always
|
|
8
|
-
* Promise-based, so encryption has to happen at the transport's async I/O boundary — the connection
|
|
9
|
-
* encrypts after `session.outgoing()` and decrypts before `session.incoming()`. The `authenticated`
|
|
10
|
-
* and `none` levels use no crypto transform at all (frames go out as the session produced them).
|
|
11
|
-
*
|
|
12
|
-
* Wire shape of an encrypted frame: `pack([nonceBytes, ciphertextBytes])` — msgpack carries the two
|
|
13
|
-
* binary fields with a couple of bytes of overhead, no base64 inflation.
|
|
14
|
-
*/
|
|
15
|
-
export interface IActionFrameCrypto {
|
|
16
|
-
/** Encrypt one session frame for sending. */
|
|
17
|
-
encryptFrame(frame: Uint8Array): Promise<Uint8Array>;
|
|
18
|
-
/** Decrypt one received frame back to the session frame. Throws on a non-binary / malformed /
|
|
19
|
-
* tampered frame — the caller (transport) decides how to react (drop / close). */
|
|
20
|
-
decryptFrame(frame: string | ArrayBuffer | Uint8Array): Promise<Uint8Array>;
|
|
21
|
-
}
|
|
22
|
-
export interface IActionFrameCryptoConfig {
|
|
23
|
-
link: ClientCryptoKeyLink;
|
|
24
|
-
/** The handshake-established link id for the remote (key + connection-registry id). */
|
|
25
|
-
linkedClientId: TTypeAndId;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Build the encrypt/decrypt transform for a connection whose handshake settled on the `encrypted`
|
|
29
|
-
* level. Keyed by the link + `linkedClientId`, so it reuses the cached shared AES-GCM key.
|
|
30
|
-
*/
|
|
31
|
-
export declare function createActionFrameCrypto({ link, linkedClientId, }: IActionFrameCryptoConfig): IActionFrameCrypto;
|
package/build/types/ActionRuntime/Handler/ExternalClient/Transport/WebSocket/actionWireCodec.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { IActionContext_Data_JsonObject } from "../../../../../ActionDefinition/Action/Context/ActionContext.types";
|
|
2
|
-
import { EActionPayloadType, type TActionPayload_Any_JsonObject } from "../../../../../ActionDefinition/Action/Payload/ActionPayload.types";
|
|
3
|
-
import type { ActionDomain } from "../../../../../ActionDefinition/Domain/ActionDomain";
|
|
4
|
-
import type { TPossibleDomainIdList } from "../../../../../ActionDefinition/Domain/ActionDomain.types";
|
|
5
|
-
/**
|
|
6
|
-
* Shared building blocks for the binary action codecs (the stateless {@link createBinaryWsAdapter} and
|
|
7
|
-
* the per-connection `createBinaryWsSessionFactory`). Both map a `domain:id` route to a tiny integer
|
|
8
|
-
* and reduce the verbose JSON wire to a positional tuple — they only differ in how much context they
|
|
9
|
-
* carry per frame, so the dictionary + payload (de)assembly live here.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Tiny integer codes for the payload type, so the verbose `"request"`/`"result"`/`"progress"`
|
|
13
|
-
* strings never hit the wire. The index in {@link ReversePayloadType} must line up with the value.
|
|
14
|
-
*/
|
|
15
|
-
export declare const PayloadTypeToInt: Record<EActionPayloadType.request | EActionPayloadType.result | EActionPayloadType.progress, number>;
|
|
16
|
-
export declare const ReversePayloadType: readonly [EActionPayloadType.request, EActionPayloadType.result, EActionPayloadType.progress];
|
|
17
|
-
export interface IActionRouteMeta {
|
|
18
|
-
domain: string;
|
|
19
|
-
id: string;
|
|
20
|
-
allDomains: TPossibleDomainIdList;
|
|
21
|
-
}
|
|
22
|
-
export interface IActionRouteDictionary {
|
|
23
|
-
/** `domain:id` → wire integer. */
|
|
24
|
-
routeToInt: Map<string, number>;
|
|
25
|
-
/** wire integer → route metadata for reconstruction. */
|
|
26
|
-
intToRoute: IActionRouteMeta[];
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Build the positional `domain:id` ↔ integer dictionary. Both ends of a channel MUST build it from
|
|
30
|
-
* the same domains in the same order — the mapping is positional, so a mismatch routes to the wrong
|
|
31
|
-
* action. Add new transported domains to the end of the list.
|
|
32
|
-
*/
|
|
33
|
-
export declare function buildActionRouteDictionary(domains: ActionDomain<any>[]): IActionRouteDictionary;
|
|
34
|
-
/** Pull the type-specific payload (`input` / `result` / `progress`) out of a wire JSON object. */
|
|
35
|
-
export declare function extractWirePayload(json: TActionPayload_Any_JsonObject<any, any>): unknown;
|
|
36
|
-
/**
|
|
37
|
-
* Reassemble a full wire JSON object from its decoded parts. `inputHash`/`outputHash` are emitted
|
|
38
|
-
* empty — the hydration constructors recompute them — and the result still satisfies
|
|
39
|
-
* `isActionPayload_Any_JsonObject` so it flows through validation like a JSON frame.
|
|
40
|
-
*/
|
|
41
|
-
export declare function assembleWireJson(routeMeta: IActionRouteMeta, payloadType: (typeof ReversePayloadType)[number], time: number, context: IActionContext_Data_JsonObject, payloadData: any): TActionPayload_Any_JsonObject<any, any>;
|