@caido/sdk-frontend 0.34.1 → 0.36.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.
@@ -1,28 +1,25 @@
1
1
  export type Commands = {
2
- register: (id: string, options: CommandOptions) => void;
2
+ register: (id: string, options: CommandOptions) => void;
3
3
  };
4
-
5
4
  type CommandOptions = {
6
- name: string;
7
- run: (context: CommandContext) => void;
8
- group?: string;
9
- when?: (context: CommandContext) => boolean;
5
+ name: string;
6
+ run: (context: CommandContext) => void;
7
+ group?: string;
8
+ when?: (context: CommandContext) => boolean;
10
9
  };
11
-
12
10
  type CommandContextBase = {
13
- type: "BaseContext";
11
+ type: "BaseContext";
14
12
  };
15
-
16
13
  type CommandContextRequestRow = {
17
- type: "RequestRowContext";
18
- request: {
19
- id: string;
20
- host: string;
21
- port: number;
22
- path: string;
23
- query: string;
24
- isTls: boolean;
25
- };
14
+ type: "RequestRowContext";
15
+ requests: {
16
+ id: string;
17
+ host: string;
18
+ port: number;
19
+ path: string;
20
+ query: string;
21
+ isTls: boolean;
22
+ }[];
26
23
  };
27
-
28
24
  export type CommandContext = CommandContextBase | CommandContextRequestRow;
25
+ export {};
@@ -1,49 +1,34 @@
1
+ import type { Sdk } from "./__generated__/graphql-sdk";
1
2
  import type { Commands } from "./commands";
2
3
  import type { Menu } from "./menu";
4
+ import type { Navigation } from "./navigation";
3
5
  import type { Scopes } from "./scopes";
4
6
  import type { UI } from "./ui";
5
-
7
+ import type { Window } from "./window";
6
8
  export type { CommandContext } from "./commands";
7
-
8
9
  export type API = {
9
- ui: UI;
10
- scopes: Scopes;
11
- commands: Commands;
12
- menu: Menu;
13
-
14
- navigation: {
15
- goTo: (path: string) => void;
16
- addPage: (path: string, options: PageOptions) => void;
17
- };
18
-
19
- shortcuts: {
20
- register: (commandId: string, keys: string[]) => void;
21
- };
22
-
23
- commandPalette: {
24
- register: (commandId: string) => void;
25
- };
26
-
27
- sidebar: {
28
- registerItem: (
29
- name: string,
30
- path: string,
31
- options?: SidebarItemOptions,
32
- ) => SidebarItem;
33
- };
10
+ ui: UI;
11
+ scopes: Scopes;
12
+ commands: Commands;
13
+ menu: Menu;
14
+ navigation: Navigation;
15
+ window: Window;
16
+ shortcuts: {
17
+ register: (commandId: string, keys: string[]) => void;
18
+ };
19
+ commandPalette: {
20
+ register: (commandId: string) => void;
21
+ };
22
+ sidebar: {
23
+ registerItem: (name: string, path: string, options?: SidebarItemOptions) => SidebarItem;
24
+ };
25
+ graphql: Sdk;
34
26
  };
35
-
36
- type PageOptions = {
37
- body: HTMLElement;
38
- topbar?: HTMLElement;
39
- };
40
-
41
27
  type SidebarItemOptions = {
42
- icon?: string;
43
- group?: string;
44
- isExternal?: boolean;
28
+ icon?: string;
29
+ group?: string;
30
+ isExternal?: boolean;
45
31
  };
46
-
47
32
  type SidebarItem = {
48
- setCount: (count: number) => void;
33
+ setCount: (count: number) => void;
49
34
  };
@@ -1,13 +1,16 @@
1
- type MenuId = "RequestRow";
2
-
3
1
  export type Menu = {
4
- registerItem: (
5
- menuId: MenuId,
6
- commandId: string,
7
- options?: MenuOptions,
8
- ) => void;
2
+ registerItem: (item: MenuItem) => void;
9
3
  };
10
-
11
- type MenuOptions = {
12
- leadingIcon?: string;
4
+ type MenuItem = RequestRowMenuItem | SettingsMenuItem;
5
+ type RequestRowMenuItem = {
6
+ type: "RequestRow";
7
+ commandId: string;
8
+ leadingIcon?: string;
13
9
  };
10
+ type SettingsMenuItem = {
11
+ type: "Settings";
12
+ label: string;
13
+ path: string;
14
+ leadingIcon?: string;
15
+ };
16
+ export {};
@@ -0,0 +1,9 @@
1
+ export type { CommandContext } from "./commands";
2
+ export type Navigation = {
3
+ goTo: (path: string) => void;
4
+ addPage: (path: string, options: PageOptions) => void;
5
+ };
6
+ type PageOptions = {
7
+ body: HTMLElement;
8
+ topbar?: HTMLElement;
9
+ };
@@ -1,28 +1,23 @@
1
1
  export type Scopes = {
2
- getScopes: () => Scope[];
3
- createScope: (options: CreateScopeOptions) => Promise<Scope | undefined>;
4
- updateScope: (
5
- id: string,
6
- options: UpdateScopeOptions,
7
- ) => Promise<Scope | undefined>;
8
- deleteScope: (id: string) => Promise<boolean>;
2
+ getScopes: () => Scope[];
3
+ createScope: (options: CreateScopeOptions) => Promise<Scope | undefined>;
4
+ updateScope: (id: string, options: UpdateScopeOptions) => Promise<Scope | undefined>;
5
+ deleteScope: (id: string) => Promise<boolean>;
9
6
  };
10
-
11
7
  type Scope = {
12
- id: string;
13
- name: string;
14
- allowlist: string[];
15
- denylist: string[];
8
+ id: string;
9
+ name: string;
10
+ allowlist: string[];
11
+ denylist: string[];
16
12
  };
17
-
18
13
  type CreateScopeOptions = {
19
- name: string;
20
- allowlist: string[];
21
- denylist: string[];
14
+ name: string;
15
+ allowlist: string[];
16
+ denylist: string[];
22
17
  };
23
-
24
18
  type UpdateScopeOptions = {
25
- name?: string;
26
- allowlist?: string[];
27
- denylist?: string[];
19
+ name?: string;
20
+ allowlist?: string[];
21
+ denylist?: string[];
28
22
  };
23
+ export {};
package/src/types/ui.d.ts CHANGED
@@ -1,25 +1,23 @@
1
1
  export type UI = {
2
- button: (options?: ButtonOptions) => HTMLElement;
3
- card: (options?: CardOptions) => HTMLElement;
4
- well: (options?: WellOptions) => HTMLElement;
2
+ button: (options?: ButtonOptions) => HTMLElement;
3
+ card: (options?: CardOptions) => HTMLElement;
4
+ well: (options?: WellOptions) => HTMLElement;
5
5
  };
6
-
7
6
  type ButtonOptions = {
8
- variant?: "primary" | "secondary" | "tertiary";
9
- label?: string;
10
- leadingIcon?: string;
11
- trailingIcon?: string;
12
- size?: "small" | "medium" | "large";
7
+ variant?: "primary" | "secondary" | "tertiary";
8
+ label?: string;
9
+ leadingIcon?: string;
10
+ trailingIcon?: string;
11
+ size?: "small" | "medium" | "large";
13
12
  };
14
-
15
13
  type CardOptions = {
16
- header?: HTMLElement;
17
- body?: HTMLElement;
18
- footer?: HTMLElement;
14
+ header?: HTMLElement;
15
+ body?: HTMLElement;
16
+ footer?: HTMLElement;
19
17
  };
20
-
21
18
  type WellOptions = {
22
- header?: HTMLElement;
23
- body?: HTMLElement;
24
- footer?: HTMLElement;
19
+ header?: HTMLElement;
20
+ body?: HTMLElement;
21
+ footer?: HTMLElement;
25
22
  };
23
+ export {};
@@ -0,0 +1,10 @@
1
+ export type Window = {
2
+ getActiveEditor: () => Editor | undefined;
3
+ };
4
+ type Editor = {
5
+ getSelectedText: () => string;
6
+ replaceSelectedText: (text: string) => void;
7
+ isReadOnly: () => boolean;
8
+ focus: () => void;
9
+ };
10
+ export {};