@nice-code/action 0.2.18 → 0.3.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/devtools/browser/index.js +836 -422
- package/build/index.js +21 -1
- package/build/types/ActionRuntime/ActionRuntime.d.ts +1 -0
- package/build/types/ActionRuntime/Handler/ExternalClient/ActionExternalClientHandler.d.ts +1 -0
- package/build/types/devtools/browser/NiceActionDevtools.d.ts +5 -1
- package/build/types/devtools/browser/components/DomainChip.d.ts +2 -1
- package/build/types/devtools/browser/components/Icon.d.ts +1 -1
- package/build/types/devtools/browser/components/StackTraceSection.d.ts +4 -2
- package/build/types/devtools/browser/components/action_list/ActionEntryRow.d.ts +2 -1
- package/build/types/devtools/browser/components/action_list/ActionInputAndOutputChip.d.ts +11 -0
- package/build/types/devtools/browser/components/action_list/ActionList.d.ts +10 -0
- package/build/types/devtools/browser/components/action_list/IoTooltipContent.d.ts +6 -0
- package/build/types/devtools/browser/components/action_list/action_list.types.d.ts +4 -0
- package/build/types/devtools/browser/devtools_storage.d.ts +6 -0
- package/build/types/devtools/core/ActionDevtools.types.d.ts +2 -5
- package/build/types/errors/err_nice_action.d.ts +2 -0
- package/package.json +4 -3
package/build/index.js
CHANGED
|
@@ -603,6 +603,7 @@ var EErrId_NiceAction;
|
|
|
603
603
|
EErrId_NiceAction2["wire_not_action_data"] = "wire_not_action_data";
|
|
604
604
|
EErrId_NiceAction2["client_runtime_already_registered"] = "client_runtime_already_registered";
|
|
605
605
|
EErrId_NiceAction2["client_runtime_not_registered"] = "client_runtime_not_registered";
|
|
606
|
+
EErrId_NiceAction2["runtime_reset"] = "runtime_reset";
|
|
606
607
|
EErrId_NiceAction2["no_client_runtimes_registered"] = "no_client_runtimes_registered";
|
|
607
608
|
EErrId_NiceAction2["action_input_validation_failed"] = "action_input_validation_failed";
|
|
608
609
|
EErrId_NiceAction2["action_input_validation_promise"] = "action_input_validation_promise";
|
|
@@ -643,6 +644,9 @@ var err_nice_action = err_nice.createChildDomain({
|
|
|
643
644
|
["wire_not_action_data" /* wire_not_action_data */]: err({
|
|
644
645
|
message: () => `Cannot handle wire for action: expected an object with a "domain" property of type string, a "form" property of "${"data" /* data */}" and a "type" property of "${"request" /* request */}", "${"progress" /* progress */}" or "${"result" /* result */}".`
|
|
645
646
|
}),
|
|
647
|
+
["runtime_reset" /* runtime_reset */]: err({
|
|
648
|
+
message: () => `Runtime has been reset.`
|
|
649
|
+
}),
|
|
646
650
|
["client_runtime_already_registered" /* client_runtime_already_registered */]: err({
|
|
647
651
|
message: ({ context, client }) => `Environment is already registered${context?.domain ? ` on domain "${context.domain}"` : ""} for client [${client.stringId}]. Each client specifier (exact match on all properties) may only be registered once.`
|
|
648
652
|
}),
|
|
@@ -1079,6 +1083,14 @@ class ActionRuntime {
|
|
|
1079
1083
|
}
|
|
1080
1084
|
return bestScore > 0 ? bestHandler : undefined;
|
|
1081
1085
|
}
|
|
1086
|
+
resetRuntime() {
|
|
1087
|
+
for (const ra of this._pendingRunningActions.values()) {
|
|
1088
|
+
ra._abort(err_nice_action.fromId("runtime_reset" /* runtime_reset */));
|
|
1089
|
+
}
|
|
1090
|
+
for (const handler of this._registeredExternalHandlers) {
|
|
1091
|
+
handler.clearTransportCache();
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1082
1094
|
_trySetupReturnDispatch(runningAction) {
|
|
1083
1095
|
const originClient = runningAction.context.originClient;
|
|
1084
1096
|
if (originClient.envId === UNSET_RUNTIME_ENV_ID || originClient.isSameFor(this._coordinate).id) {
|
|
@@ -2312,7 +2324,12 @@ class ActionExternalClientHandler extends ActionHandler {
|
|
|
2312
2324
|
handler: this.toHandlerRouteItem(transport),
|
|
2313
2325
|
time: Date.now()
|
|
2314
2326
|
});
|
|
2315
|
-
const runningAction = new RunningAction({
|
|
2327
|
+
const runningAction = new RunningAction({
|
|
2328
|
+
context: action.context,
|
|
2329
|
+
request: action,
|
|
2330
|
+
parentCuid,
|
|
2331
|
+
callSite
|
|
2332
|
+
});
|
|
2316
2333
|
localRuntime.registerRunningAction(runningAction);
|
|
2317
2334
|
const routeActionParams = {
|
|
2318
2335
|
action,
|
|
@@ -2362,6 +2379,9 @@ class ActionExternalClientHandler extends ActionHandler {
|
|
|
2362
2379
|
transType: transport.type
|
|
2363
2380
|
};
|
|
2364
2381
|
}
|
|
2382
|
+
clearTransportCache() {
|
|
2383
|
+
this._transportCache.clear();
|
|
2384
|
+
}
|
|
2365
2385
|
}
|
|
2366
2386
|
var createExternalClientHandler = (config) => {
|
|
2367
2387
|
return new ActionExternalClientHandler(config);
|
|
@@ -51,5 +51,6 @@ export declare class ActionRuntime {
|
|
|
51
51
|
* Returns `undefined` if no handler matches (score > 0 required, i.e. at least id must match).
|
|
52
52
|
*/
|
|
53
53
|
getReturnHandlerForOrigin(originClient: RuntimeCoordinate): ActionExternalClientHandler | undefined;
|
|
54
|
+
resetRuntime(): void;
|
|
54
55
|
private _trySetupReturnDispatch;
|
|
55
56
|
}
|
|
@@ -38,5 +38,6 @@ export declare class ActionExternalClientHandler extends ActionHandler<EActionHa
|
|
|
38
38
|
}): Promise<boolean>;
|
|
39
39
|
toJsonObject(): IActionHandler_ExternalClient_Json;
|
|
40
40
|
toHandlerRouteItem(transport: Transport): IActionRouteItemHandler;
|
|
41
|
+
clearTransportCache(): void;
|
|
41
42
|
}
|
|
42
43
|
export declare const createExternalClientHandler: (config: IActionExternalClientRequestHandlerConfig) => ActionExternalClientHandler;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type { TDevtoolsPosition } from "../core/ActionDevtools.types";
|
|
1
|
+
import type { IDevtoolsActionEntry, TDevtoolsPosition } from "../core/ActionDevtools.types";
|
|
2
2
|
import type { ActionDevtoolsCore } from "../core/ActionDevtoolsCore";
|
|
3
3
|
export interface INiceActionDevtoolsProps {
|
|
4
4
|
core: ActionDevtoolsCore;
|
|
5
5
|
position?: TDevtoolsPosition;
|
|
6
6
|
initialOpen?: boolean;
|
|
7
7
|
}
|
|
8
|
+
export interface IEntryGroup {
|
|
9
|
+
representative: IDevtoolsActionEntry;
|
|
10
|
+
rest: IDevtoolsActionEntry[];
|
|
11
|
+
}
|
|
8
12
|
export declare function NiceActionDevtools(props: INiceActionDevtoolsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ESize } from "../ui_util/size";
|
|
2
|
-
export declare function DomainChip({ subtle, domain, allDomains, size, }: {
|
|
2
|
+
export declare function DomainChip({ compact, subtle, domain, allDomains, size, }: {
|
|
3
|
+
compact?: boolean;
|
|
3
4
|
subtle?: boolean;
|
|
4
5
|
domain: string;
|
|
5
6
|
allDomains: string[];
|
|
@@ -4,7 +4,7 @@ import { type ESemanticThing } from "../../core/devtools_colors";
|
|
|
4
4
|
import { ESize } from "../ui_util/size";
|
|
5
5
|
import { type ITooltipConfig } from "./Tooltip";
|
|
6
6
|
interface IIconProps {
|
|
7
|
-
icon: LucideIcon;
|
|
7
|
+
icon: LucideIcon | LucideIcon[];
|
|
8
8
|
color: ESemanticThing;
|
|
9
9
|
size?: ESize;
|
|
10
10
|
subtle?: boolean;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
1
|
+
import type { IRuntimeCoordinate } from "../../../ActionRuntime/RuntimeCoordinate";
|
|
2
|
+
export declare function countUserFrames(_runtime: IRuntimeCoordinate, stack: string | undefined): number;
|
|
3
|
+
export declare function StackTraceSection({ label, stack, color, runtime, minFrameCount, }: {
|
|
3
4
|
label: string;
|
|
4
5
|
stack: string | undefined;
|
|
6
|
+
runtime: IRuntimeCoordinate;
|
|
5
7
|
color?: string;
|
|
6
8
|
minFrameCount?: number;
|
|
7
9
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IDevtoolsActionEntry } from "../../../core/ActionDevtools.types";
|
|
2
|
+
import { EBreakGroupReason } from "./action_list.types";
|
|
2
3
|
export declare function ActionEntryRow({ entry, isSelected, onClick, isLatest, latestTime, childEntries, breakReasons, groupEntries, selectedGroupCuid, onSelectGroupEntry, }: {
|
|
3
4
|
entry: IDevtoolsActionEntry;
|
|
4
5
|
isSelected: boolean;
|
|
@@ -6,7 +7,7 @@ export declare function ActionEntryRow({ entry, isSelected, onClick, isLatest, l
|
|
|
6
7
|
isLatest?: boolean;
|
|
7
8
|
latestTime?: number;
|
|
8
9
|
childEntries?: IDevtoolsActionEntry[];
|
|
9
|
-
breakReasons
|
|
10
|
+
breakReasons: EBreakGroupReason[];
|
|
10
11
|
groupEntries?: IDevtoolsActionEntry[];
|
|
11
12
|
selectedGroupCuid?: string | null;
|
|
12
13
|
onSelectGroupEntry?: (cuid: string) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IDevtoolsActionEntry } from "../../../core/ActionDevtools.types";
|
|
2
|
+
import { ESize } from "../../ui_util/size";
|
|
3
|
+
import { EBreakGroupReason } from "./action_list.types";
|
|
4
|
+
interface IActionInputAndOutputChipProps {
|
|
5
|
+
entry: IDevtoolsActionEntry;
|
|
6
|
+
breakReasons: EBreakGroupReason[];
|
|
7
|
+
subtle?: boolean;
|
|
8
|
+
size?: ESize;
|
|
9
|
+
}
|
|
10
|
+
export declare const ActionInputAndOutputChip: ({ entry, breakReasons, subtle, size, }: IActionInputAndOutputChipProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDevtoolsActionEntry } from "../../../server";
|
|
2
|
+
import type { IEntryGroup } from "../../NiceActionDevtools";
|
|
3
|
+
export declare function ActionList({ groups, selectedCuid, onGroupClick, onSubClick, childEntriesMap, style, }: {
|
|
4
|
+
groups: IEntryGroup[];
|
|
5
|
+
selectedCuid: string | null;
|
|
6
|
+
onGroupClick: (group: IEntryGroup) => void;
|
|
7
|
+
onSubClick: (cuid: string, isSelected: boolean) => void;
|
|
8
|
+
childEntriesMap: Map<string, IDevtoolsActionEntry[]>;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TRuntimeCoordinateEnvId } from "../../ActionRuntime/RuntimeCoordinate";
|
|
2
|
+
interface TBrowserDevtoolsTypedStorage {
|
|
3
|
+
runtimeToProjectFilePath: Record<TRuntimeCoordinateEnvId, string>;
|
|
4
|
+
}
|
|
5
|
+
export declare const devtools_storage: import("@nice-code/util").ITypedStorage<TBrowserDevtoolsTypedStorage>;
|
|
6
|
+
export {};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import type { TActionProgress } from "../../ActionDefinition/Action/Payload/ActionPayload.types";
|
|
2
|
+
import type { IRuntimeCoordinate } from "../../ActionRuntime/RuntimeCoordinate";
|
|
2
3
|
export type TDevtoolsActionStatus = "running" | "success" | "action-error" | "failed" | "aborted";
|
|
3
4
|
export type TDevtoolsPosition = "bottom-right" | "bottom-left" | "top-right" | "top-left" | "dock-bottom" | "dock-top" | "dock-left" | "dock-right";
|
|
4
5
|
export interface IDevtoolsRouteItem {
|
|
5
|
-
runtime:
|
|
6
|
-
envId: string;
|
|
7
|
-
perId?: string;
|
|
8
|
-
insId?: string;
|
|
9
|
-
};
|
|
6
|
+
runtime: IRuntimeCoordinate;
|
|
10
7
|
handlerType: "local" | "external";
|
|
11
8
|
handlerClient?: {
|
|
12
9
|
envId: string;
|
|
@@ -13,6 +13,7 @@ export declare enum EErrId_NiceAction {
|
|
|
13
13
|
wire_not_action_data = "wire_not_action_data",
|
|
14
14
|
client_runtime_already_registered = "client_runtime_already_registered",
|
|
15
15
|
client_runtime_not_registered = "client_runtime_not_registered",
|
|
16
|
+
runtime_reset = "runtime_reset",
|
|
16
17
|
no_client_runtimes_registered = "no_client_runtimes_registered",
|
|
17
18
|
action_input_validation_failed = "action_input_validation_failed",
|
|
18
19
|
action_input_validation_promise = "action_input_validation_promise",
|
|
@@ -61,6 +62,7 @@ export declare const err_nice_action: import("@nice-code/error").NiceErrorDomain
|
|
|
61
62
|
actionState: string | undefined;
|
|
62
63
|
}, import("@nice-code/error").JSONSerializableValue>;
|
|
63
64
|
wire_not_action_data: import("@nice-code/error").INiceErrorIdMetadata<any, import("@nice-code/error").JSONSerializableValue>;
|
|
65
|
+
runtime_reset: import("@nice-code/error").INiceErrorIdMetadata<any, import("@nice-code/error").JSONSerializableValue>;
|
|
64
66
|
client_runtime_already_registered: import("@nice-code/error").INiceErrorIdMetadata<{
|
|
65
67
|
context?: IActionRuntimeManagerContext;
|
|
66
68
|
client: RuntimeCoordinate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice-code/action",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -44,8 +44,9 @@
|
|
|
44
44
|
"build-types": "tsc --project tsconfig.build.json"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@nice-code/common-errors": "0.
|
|
48
|
-
"@nice-code/error": "0.
|
|
47
|
+
"@nice-code/common-errors": "0.3.0",
|
|
48
|
+
"@nice-code/error": "0.3.0",
|
|
49
|
+
"@nice-code/util": "0.3.0",
|
|
49
50
|
"@standard-schema/spec": "^1.1.0",
|
|
50
51
|
"@tanstack/react-virtual": "^3.13.26",
|
|
51
52
|
"http-status-codes": "^2.3.0",
|