@caido/sdk-frontend 0.51.2-beta.9 → 0.52.1-beta.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/package.json +1 -1
- package/src/types/__generated__/graphql-sdk.d.ts +719 -45
- package/src/types/index.d.ts +5 -2
- package/src/types/sdks/commandPalette.d.ts +14 -0
- package/src/types/sdks/index.d.ts +5 -0
- package/src/types/sdks/intercept.d.ts +6 -0
- package/src/types/sdks/navigation.d.ts +26 -3
- package/src/types/sdks/projects.d.ts +24 -0
- package/src/types/sdks/replay.d.ts +24 -2
- package/src/types/types/matchReplace.d.ts +15 -1
- package/src/types/types/navigation.d.ts +33 -0
- package/src/types/types/projects.d.ts +8 -0
- package/src/types/types/replay.d.ts +10 -0
- package/src/types/types/slots.d.ts +3 -3
package/src/types/index.d.ts
CHANGED
|
@@ -2,17 +2,20 @@ 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";
|
|
9
9
|
export type { JSONValue, JSONCompatible } from "./types/json";
|
|
10
10
|
export type { SlotContent, ButtonSlotContent, CustomSlotContent, CommandSlotContent, } from "./types/slots";
|
|
11
11
|
export type { RequestViewModeOptions, RequestFull, RequestDraft, RequestMeta, } from "./types/request";
|
|
12
|
-
export type { MatchReplaceRule, MatchReplaceCollection, MatchReplaceSection, MatchReplaceSectionRequestBody, MatchReplaceSectionRequestFirstLine, MatchReplaceSectionRequestHeader, MatchReplaceSectionRequestMethod, MatchReplaceSectionRequestPath, MatchReplaceSectionRequestQuery, MatchReplaceSectionResponseBody, MatchReplaceSectionResponseFirstLine, MatchReplaceSectionResponseHeader, MatchReplaceSectionResponseStatusCode, MatchReplaceOperationStatusCode, MatchReplaceOperationStatusCodeUpdate, MatchReplaceOperationQuery, MatchReplaceOperationQueryRaw, MatchReplaceOperationQueryAdd, MatchReplaceOperationQueryRemove, MatchReplaceOperationQueryUpdate, MatchReplaceOperationPath, MatchReplaceOperationPathRaw, MatchReplaceOperationMethod, MatchReplaceOperationMethodUpdate, MatchReplaceOperationHeader, MatchReplaceOperationHeaderRaw, MatchReplaceOperationHeaderAdd, MatchReplaceOperationHeaderRemove, MatchReplaceOperationHeaderUpdate, MatchReplaceOperationBody, MatchReplaceOperationBodyRaw, MatchReplaceOperationFirstLine, MatchReplaceOperationFirstLineRaw, MatchReplaceReplacer, MatchReplaceReplacerTerm, MatchReplaceReplacerWorkflow, MatchReplaceMatcherName, MatchReplaceMatcherRaw, MatchReplaceMatcherRawFull, MatchReplaceMatcherRawRegex, MatchReplaceMatcherRawValue, } from "./types/matchReplace";
|
|
12
|
+
export type { MatchReplaceRule, MatchReplaceCollection, MatchReplaceSection, MatchReplaceSectionRequestAll, MatchReplaceSectionRequestBody, MatchReplaceSectionRequestFirstLine, MatchReplaceSectionRequestHeader, MatchReplaceSectionRequestMethod, MatchReplaceSectionRequestPath, MatchReplaceSectionRequestQuery, MatchReplaceSectionResponseAll, MatchReplaceSectionResponseBody, MatchReplaceSectionResponseFirstLine, MatchReplaceSectionResponseHeader, MatchReplaceSectionResponseStatusCode, MatchReplaceOperationStatusCode, MatchReplaceOperationStatusCodeUpdate, MatchReplaceOperationQuery, MatchReplaceOperationQueryRaw, MatchReplaceOperationQueryAdd, MatchReplaceOperationQueryRemove, MatchReplaceOperationQueryUpdate, MatchReplaceOperationPath, MatchReplaceOperationPathRaw, MatchReplaceOperationAll, MatchReplaceOperationAllRaw, MatchReplaceOperationMethod, MatchReplaceOperationMethodUpdate, MatchReplaceOperationHeader, MatchReplaceOperationHeaderRaw, MatchReplaceOperationHeaderAdd, MatchReplaceOperationHeaderRemove, MatchReplaceOperationHeaderUpdate, MatchReplaceOperationBody, MatchReplaceOperationBodyRaw, MatchReplaceOperationFirstLine, MatchReplaceOperationFirstLineRaw, MatchReplaceReplacer, MatchReplaceReplacerTerm, MatchReplaceReplacerWorkflow, MatchReplaceMatcherName, MatchReplaceMatcherRaw, MatchReplaceMatcherRawFull, MatchReplaceMatcherRawRegex, MatchReplaceMatcherRawValue, } from "./types/matchReplace";
|
|
13
13
|
export type { Scope } from "./types/scopes";
|
|
14
14
|
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";
|
|
19
|
+
export type { CommandPaletteView } from "./sdks/commandPalette";
|
|
18
20
|
export type { API } from "./sdks";
|
|
21
|
+
export { Routes } from "./types/navigation";
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { type CommandID } from "../types/commands";
|
|
2
|
+
import { type ComponentDefinition } from "../types/utils";
|
|
3
|
+
/**
|
|
4
|
+
* Command palette view definition for custom UI content.
|
|
5
|
+
* @category Command Palette
|
|
6
|
+
*/
|
|
7
|
+
export type CommandPaletteView = {
|
|
8
|
+
type: "Custom";
|
|
9
|
+
definition: ComponentDefinition;
|
|
10
|
+
};
|
|
2
11
|
/**
|
|
3
12
|
* Utilities to interact with the command palette.
|
|
4
13
|
* @category Command Palette
|
|
@@ -9,4 +18,9 @@ export type CommandPaletteSDK = {
|
|
|
9
18
|
* @param commandId The id of the command to register.
|
|
10
19
|
*/
|
|
11
20
|
register: (commandId: CommandID) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Push a new view onto the command palette view stack.
|
|
23
|
+
* @param view The view to push onto the stack.
|
|
24
|
+
*/
|
|
25
|
+
pushView: (view: CommandPaletteView) => void;
|
|
12
26
|
};
|
|
@@ -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
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RequestViewModeOptions } from "../types/request";
|
|
1
2
|
import type { ID } from "../types/utils";
|
|
2
3
|
/**
|
|
3
4
|
* Utilities to interact with the Intercept page.
|
|
@@ -14,4 +15,9 @@ export type InterceptSDK = {
|
|
|
14
15
|
* @param scopeId The ID of the scope to set.
|
|
15
16
|
*/
|
|
16
17
|
setScope: (id: ID | undefined) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Add a custom request view mode.
|
|
20
|
+
* @param options The view mode options.
|
|
21
|
+
*/
|
|
22
|
+
addRequestViewMode: (options: RequestViewModeOptions) => void;
|
|
17
23
|
};
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
+
import { type PageChangeEvent, type Routes } from "../types/navigation";
|
|
2
|
+
import { type ListenerHandle } from "../types/utils";
|
|
1
3
|
/**
|
|
2
4
|
* Utilities to interact with navigation.
|
|
3
5
|
* @category Navigation
|
|
4
6
|
*/
|
|
5
7
|
export type NavigationSDK = {
|
|
6
8
|
/**
|
|
7
|
-
* Navigate to a path.
|
|
8
|
-
* @param
|
|
9
|
+
* Navigate to a route or path.
|
|
10
|
+
* @param route The route to navigate to. Can be a route ID object or a custom path string.
|
|
9
11
|
*
|
|
10
12
|
* @example
|
|
11
13
|
* ```ts
|
|
14
|
+
* sdk.navigation.goTo({ id: Routes.Replay });
|
|
15
|
+
* sdk.navigation.goTo({ id: Routes.Projects });
|
|
12
16
|
* sdk.navigation.goTo("/my-plugin-page");
|
|
13
17
|
* ```
|
|
14
18
|
*/
|
|
15
|
-
goTo: (
|
|
19
|
+
goTo: (route: string | {
|
|
20
|
+
id: Routes;
|
|
21
|
+
}) => void;
|
|
16
22
|
/**
|
|
17
23
|
* Add a page to the navigation.
|
|
18
24
|
* @param path The path of the page.
|
|
@@ -26,4 +32,21 @@ export type NavigationSDK = {
|
|
|
26
32
|
topbar?: HTMLElement;
|
|
27
33
|
onEnter?: () => void;
|
|
28
34
|
}) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Subscribe to page changes.
|
|
37
|
+
* @param callback The callback to call when the page changes.
|
|
38
|
+
* @returns An object with a `stop` method that can be called to stop listening to page changes.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const handler = sdk.navigation.onPageChange((event) => {
|
|
43
|
+
* console.log('Page changed to:', event.routeId);
|
|
44
|
+
* console.log('- path:', event.path);
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* // Later, stop listening
|
|
48
|
+
* handler.stop();
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
onPageChange: (callback: (route: PageChangeEvent) => void) => ListenerHandle;
|
|
29
52
|
};
|
|
@@ -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,7 +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
|
+
import type { RequestViewModeOptions } from "../types/request";
|
|
3
4
|
import { type DefineAddToSlotFn } from "../types/slots";
|
|
4
|
-
import type { ID } from "../types/utils";
|
|
5
|
+
import type { ID, ListenerHandle } from "../types/utils";
|
|
5
6
|
/**
|
|
6
7
|
* Utilities to interact with Replay.
|
|
7
8
|
* @category Replay
|
|
@@ -109,6 +110,11 @@ export type ReplaySDK = {
|
|
|
109
110
|
* @param extension The extension to add.
|
|
110
111
|
*/
|
|
111
112
|
addRequestEditorExtension: (extension: Extension) => void;
|
|
113
|
+
/**
|
|
114
|
+
* Add a custom view mode for requests.
|
|
115
|
+
* @param options The view mode options.
|
|
116
|
+
*/
|
|
117
|
+
addRequestViewMode: (options: RequestViewModeOptions) => void;
|
|
112
118
|
/**
|
|
113
119
|
* Send a request to the Replay backend.
|
|
114
120
|
* @param request The request to send.
|
|
@@ -128,4 +134,20 @@ export type ReplaySDK = {
|
|
|
128
134
|
* ```
|
|
129
135
|
*/
|
|
130
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;
|
|
131
153
|
};
|
|
@@ -30,7 +30,21 @@ export type MatchReplaceRule = {
|
|
|
30
30
|
*/
|
|
31
31
|
collectionId: ID;
|
|
32
32
|
};
|
|
33
|
-
export type MatchReplaceSection = MatchReplaceSectionRequestBody | MatchReplaceSectionRequestFirstLine | MatchReplaceSectionRequestHeader | MatchReplaceSectionRequestMethod | MatchReplaceSectionRequestPath | MatchReplaceSectionRequestQuery | MatchReplaceSectionResponseBody | MatchReplaceSectionResponseFirstLine | MatchReplaceSectionResponseHeader | MatchReplaceSectionResponseStatusCode;
|
|
33
|
+
export type MatchReplaceSection = MatchReplaceSectionRequestAll | MatchReplaceSectionRequestBody | MatchReplaceSectionRequestFirstLine | MatchReplaceSectionRequestHeader | MatchReplaceSectionRequestMethod | MatchReplaceSectionRequestPath | MatchReplaceSectionRequestQuery | MatchReplaceSectionResponseAll | MatchReplaceSectionResponseBody | MatchReplaceSectionResponseFirstLine | MatchReplaceSectionResponseHeader | MatchReplaceSectionResponseStatusCode;
|
|
34
|
+
export type MatchReplaceSectionRequestAll = {
|
|
35
|
+
kind: "SectionRequestAll";
|
|
36
|
+
operation: MatchReplaceOperationAll;
|
|
37
|
+
};
|
|
38
|
+
export type MatchReplaceSectionResponseAll = {
|
|
39
|
+
kind: "SectionResponseAll";
|
|
40
|
+
operation: MatchReplaceOperationAll;
|
|
41
|
+
};
|
|
42
|
+
export type MatchReplaceOperationAll = KeepOperation<MatchReplaceOperationAllRaw>;
|
|
43
|
+
export type MatchReplaceOperationAllRaw = {
|
|
44
|
+
kind: "OperationAllRaw";
|
|
45
|
+
matcher: MatchReplaceMatcherRaw;
|
|
46
|
+
replacer: MatchReplaceReplacer;
|
|
47
|
+
};
|
|
34
48
|
export type MatchReplaceSectionResponseStatusCode = {
|
|
35
49
|
kind: "SectionResponseStatusCode";
|
|
36
50
|
operation: MatchReplaceOperationStatusCode;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const Routes: {
|
|
2
|
+
readonly Sitemap: "Sitemap";
|
|
3
|
+
readonly Intercept: "Intercept";
|
|
4
|
+
readonly Search: "Search";
|
|
5
|
+
readonly HTTPHistory: "HTTPHistory";
|
|
6
|
+
readonly Websockets: "Websockets";
|
|
7
|
+
readonly Workflows: "Workflows";
|
|
8
|
+
readonly Replay: "Replay";
|
|
9
|
+
readonly Automate: "Automate";
|
|
10
|
+
readonly Projects: "Projects";
|
|
11
|
+
readonly Backups: "Backups";
|
|
12
|
+
readonly MatchReplace: "Tamper";
|
|
13
|
+
readonly Assistant: "Assistant";
|
|
14
|
+
readonly Environment: "Environment";
|
|
15
|
+
readonly Scope: "Scope";
|
|
16
|
+
readonly Filter: "Filter";
|
|
17
|
+
readonly Exports: "Exports";
|
|
18
|
+
readonly Findings: "Findings";
|
|
19
|
+
readonly Files: "Files";
|
|
20
|
+
readonly Plugins: "Plugins";
|
|
21
|
+
readonly Certificate: "Certificate";
|
|
22
|
+
readonly About: "About";
|
|
23
|
+
readonly Settings: "Settings";
|
|
24
|
+
};
|
|
25
|
+
export type Routes = (typeof Routes)[keyof typeof Routes];
|
|
26
|
+
export type PageChangeEvent = {
|
|
27
|
+
type: "Core";
|
|
28
|
+
routeId: Routes;
|
|
29
|
+
path: string;
|
|
30
|
+
} | {
|
|
31
|
+
type: "Plugin";
|
|
32
|
+
path: string;
|
|
33
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type CommandID } from "./commands";
|
|
2
|
-
import { type ComponentDefinition } from "./utils";
|
|
3
|
-
type DefineSlotContent<TType extends string, P extends Record<string, unknown>> = {
|
|
2
|
+
import { type ComponentDefinition, type Prettify } from "./utils";
|
|
3
|
+
type DefineSlotContent<TType extends string, P extends Record<string, unknown>> = Prettify<{
|
|
4
4
|
type: TType;
|
|
5
|
-
} & P
|
|
5
|
+
} & P>;
|
|
6
6
|
export type ButtonSlotContent = DefineSlotContent<"Button", {
|
|
7
7
|
label: string;
|
|
8
8
|
icon?: string;
|