@caido/sdk-frontend 0.36.1 → 0.38.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/index.d.ts +1 -11
- package/src/index.js +0 -1
- package/src/types/__generated__/graphql-sdk.d.ts +2358 -1298
- package/src/types/commands.d.ts +31 -1
- package/src/types/index.d.ts +2 -0
- package/src/types/menu.d.ts +11 -1
- package/src/types/storage.d.ts +14 -0
- package/src/types/window.d.ts +5 -0
package/src/types/commands.d.ts
CHANGED
|
@@ -21,5 +21,35 @@ type CommandContextRequestRow = {
|
|
|
21
21
|
isTls: boolean;
|
|
22
22
|
}[];
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
type CommandContextRequest = {
|
|
25
|
+
type: "RequestContext";
|
|
26
|
+
request: {
|
|
27
|
+
host: string;
|
|
28
|
+
port: number;
|
|
29
|
+
path: string;
|
|
30
|
+
query: string;
|
|
31
|
+
isTls: boolean;
|
|
32
|
+
raw: string;
|
|
33
|
+
};
|
|
34
|
+
selection: string;
|
|
35
|
+
};
|
|
36
|
+
type CommandContextResponse = {
|
|
37
|
+
type: "ResponseContext";
|
|
38
|
+
request: {
|
|
39
|
+
id: string;
|
|
40
|
+
host: string;
|
|
41
|
+
port: number;
|
|
42
|
+
path: string;
|
|
43
|
+
query: string;
|
|
44
|
+
isTls: boolean;
|
|
45
|
+
};
|
|
46
|
+
response: {
|
|
47
|
+
id: string;
|
|
48
|
+
raw: string;
|
|
49
|
+
statusCode: number;
|
|
50
|
+
roundtripTime: number;
|
|
51
|
+
};
|
|
52
|
+
selection: string;
|
|
53
|
+
};
|
|
54
|
+
export type CommandContext = CommandContextBase | CommandContextRequestRow | CommandContextRequest | CommandContextResponse;
|
|
25
55
|
export {};
|
package/src/types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Commands } from "./commands";
|
|
|
3
3
|
import type { Menu } from "./menu";
|
|
4
4
|
import type { Navigation } from "./navigation";
|
|
5
5
|
import type { Scopes } from "./scopes";
|
|
6
|
+
import type { Storage } from "./storage";
|
|
6
7
|
import type { UI } from "./ui";
|
|
7
8
|
import type { Window } from "./window";
|
|
8
9
|
export type { CommandContext } from "./commands";
|
|
@@ -13,6 +14,7 @@ export type API = {
|
|
|
13
14
|
menu: Menu;
|
|
14
15
|
navigation: Navigation;
|
|
15
16
|
window: Window;
|
|
17
|
+
storage: Storage;
|
|
16
18
|
shortcuts: {
|
|
17
19
|
register: (commandId: string, keys: string[]) => void;
|
|
18
20
|
};
|
package/src/types/menu.d.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
export type Menu = {
|
|
2
2
|
registerItem: (item: MenuItem) => void;
|
|
3
3
|
};
|
|
4
|
-
type MenuItem = RequestRowMenuItem | SettingsMenuItem;
|
|
4
|
+
type MenuItem = RequestRowMenuItem | SettingsMenuItem | RequestMenuItem | ResponseMenuItem;
|
|
5
5
|
type RequestRowMenuItem = {
|
|
6
6
|
type: "RequestRow";
|
|
7
7
|
commandId: string;
|
|
8
8
|
leadingIcon?: string;
|
|
9
9
|
};
|
|
10
|
+
type RequestMenuItem = {
|
|
11
|
+
type: "Request";
|
|
12
|
+
commandId: string;
|
|
13
|
+
leadingIcon?: string;
|
|
14
|
+
};
|
|
15
|
+
type ResponseMenuItem = {
|
|
16
|
+
type: "Response";
|
|
17
|
+
commandId: string;
|
|
18
|
+
leadingIcon?: string;
|
|
19
|
+
};
|
|
10
20
|
type SettingsMenuItem = {
|
|
11
21
|
type: "Settings";
|
|
12
22
|
label: string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type JSONPrimitive = string | number | boolean | null | undefined;
|
|
2
|
+
type JSONValue = JSONPrimitive | JSONValue[] | {
|
|
3
|
+
[key: string]: JSONValue;
|
|
4
|
+
};
|
|
5
|
+
type NotAssignableToJson = bigint | symbol | Function;
|
|
6
|
+
type JSONCompatible<T> = unknown extends T ? never : {
|
|
7
|
+
[P in keyof T]: T[P] extends JSONValue ? T[P] : T[P] extends NotAssignableToJson ? never : JSONCompatible<T[P]>;
|
|
8
|
+
};
|
|
9
|
+
export type Storage = {
|
|
10
|
+
get: () => JSONValue;
|
|
11
|
+
set: <T>(value: JSONCompatible<T>) => Promise<void>;
|
|
12
|
+
onChange: (callback: (value: JSONValue) => void) => void;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
package/src/types/window.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export type Window = {
|
|
2
2
|
getActiveEditor: () => Editor | undefined;
|
|
3
|
+
showToast: (message: string, options?: ToastOptions) => void;
|
|
4
|
+
};
|
|
5
|
+
type ToastOptions = {
|
|
6
|
+
variant?: "success" | "error" | "warning" | "info";
|
|
7
|
+
duration?: number;
|
|
3
8
|
};
|
|
4
9
|
type Editor = {
|
|
5
10
|
getSelectedText: () => string;
|