@caido/sdk-frontend 0.49.1-beta.5 → 0.49.1-beta.7
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 } from "./types/commands";
|
|
4
4
|
export type { MenuItem } from "./types/menu";
|
|
5
|
-
export { type ReplayTab, type ReplaySession, type ReplayCollection, ReplaySlot, type ReplaySlotContent, } from "./types/replay";
|
|
5
|
+
export { type ReplayTab, type ReplaySession, type ReplayCollection, type SendRequestOptions, ReplaySlot, type ReplaySlotContent, } 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";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Extension } from "@codemirror/state";
|
|
2
|
-
import { type ReplayCollection, type ReplaySession, type ReplaySlotContent, type ReplayTab } from "../types/replay";
|
|
2
|
+
import { type OpenTabOptions, type ReplayCollection, type ReplaySession, type ReplaySlotContent, type ReplayTab, type SendRequestOptions } from "../types/replay";
|
|
3
3
|
import { type DefineAddToSlotFn } from "../types/slots";
|
|
4
4
|
import type { ID } from "../types/utils";
|
|
5
5
|
/**
|
|
@@ -10,8 +10,9 @@ export type ReplaySDK = {
|
|
|
10
10
|
/**
|
|
11
11
|
* Open a replay tab for the given session.
|
|
12
12
|
* @param sessionId The ID of the session to open.
|
|
13
|
+
* @param options The options for opening the tab.
|
|
13
14
|
*/
|
|
14
|
-
openTab: (sessionId: ID) => void;
|
|
15
|
+
openTab: (sessionId: ID, options?: OpenTabOptions) => void;
|
|
15
16
|
/**
|
|
16
17
|
* Close a replay tab for the given session.
|
|
17
18
|
* @param sessionId The ID of the session to close.
|
|
@@ -102,4 +103,22 @@ export type ReplaySDK = {
|
|
|
102
103
|
* @param extension The extension to add.
|
|
103
104
|
*/
|
|
104
105
|
addRequestEditorExtension: (extension: Extension) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Send a request to the Replay backend.
|
|
108
|
+
* @param request The request to send.
|
|
109
|
+
* @param options The options for sending the request.
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* sendRequest(sessionId, {
|
|
113
|
+
* connectionInfo: {
|
|
114
|
+
* SNI: "example.com",
|
|
115
|
+
* host: "example.com",
|
|
116
|
+
* isTLS: true,
|
|
117
|
+
* port: 443,
|
|
118
|
+
* },
|
|
119
|
+
* raw: "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n",
|
|
120
|
+
* updateContentLength: false,
|
|
121
|
+
* });
|
|
122
|
+
*/
|
|
123
|
+
sendRequest: (sessionId: ID, options: SendRequestOptions) => Promise<void>;
|
|
105
124
|
};
|
|
@@ -7,7 +7,7 @@ export type ShortcutsSDK = {
|
|
|
7
7
|
/**
|
|
8
8
|
* Register a shortcut.
|
|
9
9
|
* @param commandId The id of the command to run when the shortcut is triggered.
|
|
10
|
-
* @param keys The keys of the shortcut. Check out {@link https://
|
|
10
|
+
* @param keys The keys of the shortcut. Check out {@link https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values KeyboardEvent.key} for the list of supported keys.
|
|
11
11
|
*/
|
|
12
12
|
register: (commandId: CommandID, keys: string[]) => void;
|
|
13
13
|
};
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent } from "./slots";
|
|
2
2
|
import { type ID } from "./utils";
|
|
3
|
+
/**
|
|
4
|
+
* The slots in the Replay UI.
|
|
5
|
+
* @category Replay
|
|
6
|
+
*/
|
|
3
7
|
export declare const ReplaySlot: {
|
|
8
|
+
/**
|
|
9
|
+
* The left side of the session toolbar.
|
|
10
|
+
*/
|
|
4
11
|
readonly SessionToolbarPrimary: "session-toolbar-primary";
|
|
12
|
+
/**
|
|
13
|
+
* The right side of the session toolbar.
|
|
14
|
+
*/
|
|
5
15
|
readonly SessionToolbarSecondary: "session-toolbar-secondary";
|
|
16
|
+
/**
|
|
17
|
+
* The left side of the topbar.
|
|
18
|
+
*/
|
|
6
19
|
readonly Topbar: "topbar";
|
|
7
20
|
};
|
|
8
21
|
export type ReplaySlot = (typeof ReplaySlot)[keyof typeof ReplaySlot];
|
|
@@ -11,6 +24,17 @@ export type ReplaySlotContent = {
|
|
|
11
24
|
[ReplaySlot.SessionToolbarSecondary]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
12
25
|
[ReplaySlot.Topbar]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
13
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Options for opening a tab.
|
|
29
|
+
* @category Replay
|
|
30
|
+
*/
|
|
31
|
+
export type OpenTabOptions = {
|
|
32
|
+
/**
|
|
33
|
+
* Whether to select the tab after opening it.
|
|
34
|
+
* Defaults to true.
|
|
35
|
+
*/
|
|
36
|
+
select?: boolean;
|
|
37
|
+
};
|
|
14
38
|
/**
|
|
15
39
|
* A replay tab.
|
|
16
40
|
* @category Replay
|
|
@@ -57,3 +81,40 @@ export type ReplayCollection = {
|
|
|
57
81
|
*/
|
|
58
82
|
sessionIds: ID[];
|
|
59
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* Options for sending a request.
|
|
86
|
+
* @category Replay
|
|
87
|
+
*/
|
|
88
|
+
export type SendRequestOptions = {
|
|
89
|
+
/**
|
|
90
|
+
* The connection information to use for the request.
|
|
91
|
+
*/
|
|
92
|
+
connectionInfo: {
|
|
93
|
+
/**
|
|
94
|
+
* The host to use for the request.
|
|
95
|
+
*/
|
|
96
|
+
host: string;
|
|
97
|
+
/**
|
|
98
|
+
* The port to use for the request.
|
|
99
|
+
*/
|
|
100
|
+
port: number;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the request is TLS.
|
|
103
|
+
*/
|
|
104
|
+
isTLS: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* The SNI to use for the request.
|
|
107
|
+
* If not provided, the SNI will be inferred from the host.
|
|
108
|
+
*/
|
|
109
|
+
SNI?: string;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* The raw request to send.
|
|
113
|
+
*/
|
|
114
|
+
raw: string;
|
|
115
|
+
/**
|
|
116
|
+
* Whether to update the content length automatically to match the body.
|
|
117
|
+
* Defaults to true.
|
|
118
|
+
*/
|
|
119
|
+
updateContentLength?: boolean;
|
|
120
|
+
};
|