@caido/sdk-frontend 0.51.2-beta.16 → 0.51.2-beta.18
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/package.json
CHANGED
package/src/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { FooterSlot, type FooterSlotContent } from "./types/footer";
|
|
|
2
2
|
export type { DialogOptions } from "./types/window";
|
|
3
3
|
export type { CommandContext, CommandContextRequest, CommandContextRequestRow, CommandContextResponse, CommandContextBase, } from "./types/commands";
|
|
4
4
|
export type { MenuItem } from "./types/menu";
|
|
5
|
-
export { type ReplayTab, type ReplaySession, type ReplayCollection, type SendRequestOptions, ReplaySlot, type ReplaySlotContent, type RequestSource, } from "./types/replay";
|
|
5
|
+
export { type ReplayTab, type ReplaySession, type ReplayCollection, type SendRequestOptions, ReplaySlot, type ReplaySlotContent, type RequestSource, type CurrentReplaySessionChangeEvent, } from "./types/replay";
|
|
6
6
|
export type { HostedFile } from "./types/files";
|
|
7
7
|
export type { Filter } from "./types/filter";
|
|
8
8
|
export type { HTTPQL, ID, ComponentDefinition } from "./types/utils";
|
|
@@ -15,5 +15,6 @@ export type { EnvironmentVariable } from "./types/environment";
|
|
|
15
15
|
export type { Workflow, WorkflowKind, OnCreatedWorkflowCallback, OnUpdatedWorkflowCallback, OnDeletedWorkflowCallback, } from "./types/workflows";
|
|
16
16
|
export type { ListenerHandle } from "./types/utils";
|
|
17
17
|
export type { AIProvider } from "./types/ai";
|
|
18
|
+
export type { SelectedProjectChangeEvent } from "./types/projects";
|
|
18
19
|
export type { API } from "./sdks";
|
|
19
20
|
export { Routes } from "./types/navigation";
|
|
@@ -16,6 +16,7 @@ import type { InterceptSDK } from "./intercept";
|
|
|
16
16
|
import type { MatchReplaceSDK } from "./matchReplace";
|
|
17
17
|
import type { MenuSDK } from "./menu";
|
|
18
18
|
import type { NavigationSDK } from "./navigation";
|
|
19
|
+
import type { ProjectsSDK } from "./projects";
|
|
19
20
|
import type { ReplaySDK } from "./replay";
|
|
20
21
|
import type { RuntimeSDK } from "./runtime";
|
|
21
22
|
import type { ScopesSDK } from "./scopes";
|
|
@@ -68,6 +69,10 @@ export type API<T extends BackendEndpoints = Record<string, never>, E extends Ba
|
|
|
68
69
|
* Utilities to interact with navigation.
|
|
69
70
|
*/
|
|
70
71
|
navigation: NavigationSDK;
|
|
72
|
+
/**
|
|
73
|
+
* Utilities to interact with projects.
|
|
74
|
+
*/
|
|
75
|
+
projects: ProjectsSDK;
|
|
71
76
|
/**
|
|
72
77
|
* Utilities to interact with the active page.
|
|
73
78
|
*/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type SelectedProjectChangeEvent } from "../types/projects";
|
|
2
|
+
import { type ListenerHandle } from "../types/utils";
|
|
3
|
+
/**
|
|
4
|
+
* Utilities to interact with projects.
|
|
5
|
+
* @category Projects
|
|
6
|
+
*/
|
|
7
|
+
export type ProjectsSDK = {
|
|
8
|
+
/**
|
|
9
|
+
* Subscribe to selected project changes.
|
|
10
|
+
* @param callback The callback to call when the selected project changes.
|
|
11
|
+
* @returns An object with a `stop` method that can be called to stop listening to project changes.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const handler = sdk.projects.onCurrentProjectChange((event) => {
|
|
16
|
+
* console.log('Selected project changed to:', event.projectId);
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Later, stop listening
|
|
20
|
+
* handler.stop();
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
onCurrentProjectChange: (callback: (event: SelectedProjectChangeEvent) => void) => ListenerHandle;
|
|
24
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Extension } from "@codemirror/state";
|
|
2
|
-
import { type OpenTabOptions, type ReplayCollection, type ReplaySession, type ReplaySlotContent, type ReplayTab, type RequestSource, type SendRequestOptions } from "../types/replay";
|
|
2
|
+
import { type CurrentReplaySessionChangeEvent, type OpenTabOptions, type ReplayCollection, type ReplaySession, type ReplaySlotContent, type ReplayTab, type RequestSource, type SendRequestOptions } from "../types/replay";
|
|
3
3
|
import type { RequestViewModeOptions } from "../types/request";
|
|
4
4
|
import { type DefineAddToSlotFn } from "../types/slots";
|
|
5
|
-
import type { ID } from "../types/utils";
|
|
5
|
+
import type { ID, ListenerHandle } from "../types/utils";
|
|
6
6
|
/**
|
|
7
7
|
* Utilities to interact with Replay.
|
|
8
8
|
* @category Replay
|
|
@@ -134,4 +134,20 @@ export type ReplaySDK = {
|
|
|
134
134
|
* ```
|
|
135
135
|
*/
|
|
136
136
|
sendRequest: (sessionId: ID, options: SendRequestOptions) => Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Subscribe to current replay session changes.
|
|
139
|
+
* @param callback The callback to call when the selected session changes.
|
|
140
|
+
* @returns An object with a `stop` method that can be called to stop listening to session changes.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* const handler = sdk.replay.onCurrentSessionChange((event) => {
|
|
145
|
+
* console.log(`Session ${event.sessionId} got selected!`);
|
|
146
|
+
* });
|
|
147
|
+
*
|
|
148
|
+
* // Later, stop listening
|
|
149
|
+
* handler.stop();
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
onCurrentSessionChange: (callback: (event: CurrentReplaySessionChangeEvent) => void) => ListenerHandle;
|
|
137
153
|
};
|
|
@@ -166,3 +166,13 @@ export type RequestSource = {
|
|
|
166
166
|
type: "ID";
|
|
167
167
|
id: string;
|
|
168
168
|
};
|
|
169
|
+
/**
|
|
170
|
+
* Event fired when the current replay session changes.
|
|
171
|
+
* @category Replay
|
|
172
|
+
*/
|
|
173
|
+
export type CurrentReplaySessionChangeEvent = {
|
|
174
|
+
/**
|
|
175
|
+
* The ID of the newly selected session, or undefined if no session is selected.
|
|
176
|
+
*/
|
|
177
|
+
sessionId: ID | undefined;
|
|
178
|
+
};
|