@caido/sdk-frontend 0.49.1-beta.1 → 0.49.1-beta.3

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.
Files changed (48) hide show
  1. package/package.json +1 -1
  2. package/src/types/index.d.ts +17 -150
  3. package/src/types/{assets.d.ts → sdks/assets.d.ts} +1 -11
  4. package/src/types/{backend.d.ts → sdks/backend.d.ts} +2 -15
  5. package/src/types/{commandPalette.d.ts → sdks/commandPalette.d.ts} +2 -1
  6. package/src/types/sdks/commands.d.ts +31 -0
  7. package/src/types/{environment.d.ts → sdks/environment.d.ts} +1 -14
  8. package/src/types/{files.d.ts → sdks/files.d.ts} +1 -30
  9. package/src/types/{filters.d.ts → sdks/filters.d.ts} +2 -24
  10. package/src/types/{findings.d.ts → sdks/findings.d.ts} +2 -32
  11. package/src/types/{footer.d.ts → sdks/footer.d.ts} +3 -10
  12. package/src/types/{httpHistory.d.ts → sdks/httpHistory.d.ts} +7 -1
  13. package/src/types/sdks/index.d.ts +137 -0
  14. package/src/types/{intercept.d.ts → sdks/intercept.d.ts} +1 -1
  15. package/src/types/sdks/matchReplace.d.ts +87 -0
  16. package/src/types/sdks/menu.d.ts +21 -0
  17. package/src/types/{replay.d.ts → sdks/replay.d.ts} +3 -54
  18. package/src/types/{scopes.d.ts → sdks/scopes.d.ts} +2 -23
  19. package/src/types/{search.d.ts → sdks/search.d.ts} +1 -1
  20. package/src/types/{shortcuts.d.ts → sdks/shortcuts.d.ts} +1 -1
  21. package/src/types/{sidebar.d.ts → sdks/sidebar.d.ts} +2 -13
  22. package/src/types/{sitemap.d.ts → sdks/sitemap.d.ts} +1 -1
  23. package/src/types/{storage.d.ts → sdks/storage.d.ts} +1 -1
  24. package/src/types/{ui.d.ts → sdks/ui.d.ts} +2 -2
  25. package/src/types/{window.d.ts → sdks/window.d.ts} +3 -10
  26. package/src/types/{workflows.d.ts → sdks/workflows.d.ts} +2 -25
  27. package/src/types/types/assets.d.ts +10 -0
  28. package/src/types/types/backend.d.ts +14 -0
  29. package/src/types/{commands.d.ts → types/commands.d.ts} +5 -28
  30. package/src/types/types/environment.d.ts +14 -0
  31. package/src/types/types/files.d.ts +30 -0
  32. package/src/types/types/filter.d.ts +24 -0
  33. package/src/types/types/findings.d.ts +31 -0
  34. package/src/types/types/footer.d.ts +10 -0
  35. package/src/types/types/json.d.ts +9 -0
  36. package/src/types/{matchReplace.d.ts → types/matchReplace.d.ts} +1 -86
  37. package/src/types/{menu.d.ts → types/menu.d.ts} +2 -21
  38. package/src/types/types/replay.d.ts +53 -0
  39. package/src/types/types/request.d.ts +11 -0
  40. package/src/types/types/scopes.d.ts +23 -0
  41. package/src/types/types/sidebar.d.ts +11 -0
  42. package/src/types/{slots.d.ts → types/slots.d.ts} +1 -1
  43. package/src/types/{utils.d.ts → types/utils.d.ts} +0 -16
  44. package/src/types/types/window.d.ts +8 -0
  45. package/src/types/types/workflows.d.ts +25 -0
  46. /package/src/types/{navigation.d.ts → sdks/navigation.d.ts} +0 -0
  47. /package/src/types/{runtime.d.ts → sdks/runtime.d.ts} +0 -0
  48. /package/src/types/{editor.d.ts → types/editor.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caido/sdk-frontend",
3
- "version": "0.49.1-beta.1",
3
+ "version": "0.49.1-beta.3",
4
4
  "description": "Typing for the Caido Frontend SDK",
5
5
  "author": "Caido Labs Inc. <dev@caido.io>",
6
6
  "license": "MIT",
@@ -1,150 +1,17 @@
1
- import type { Sdk as GraphqlSDK } from "./__generated__/graphql-sdk";
2
- import type { AssetsSDK } from "./assets";
3
- import type { BackendEndpoints, BackendEvents, BackendSDK } from "./backend";
4
- import type { CommandPaletteSDK } from "./commandPalette";
5
- import type { CommandsSDK } from "./commands";
6
- import type { EnvironmentSDK } from "./environment";
7
- import type { FilesSDK } from "./files";
8
- import type { FiltersSDK } from "./filters";
9
- import type { FindingsSDK } from "./findings";
10
- import type { FooterSDK } from "./footer";
11
- import type { HTTPHistorySDK } from "./httpHistory";
12
- import type { InterceptSDK } from "./intercept";
13
- import type { MatchReplaceSDK } from "./matchReplace";
14
- import type { MenuSDK } from "./menu";
15
- import type { NavigationSDK } from "./navigation";
16
- import type { ReplaySDK } from "./replay";
17
- import type { RuntimeSDK } from "./runtime";
18
- import type { ScopesSDK } from "./scopes";
19
- import type { SearchSDK } from "./search";
20
- import type { ShortcutsSDK } from "./shortcuts";
21
- import type { SidebarSDK } from "./sidebar";
22
- import type { SitemapSDK } from "./sitemap";
23
- import type { StorageSDK } from "./storage";
24
- import type { UISDK } from "./ui";
25
- import type { WindowSDK } from "./window";
26
- import type { WorkflowSDK } from "./workflows";
27
- export { FooterSlot } from "./footer";
28
- export type { DialogOptions } from "./window";
29
- export type { CommandContext } from "./commands";
30
- export type { MenuItem } from "./menu";
31
- export { type ReplayTab, type ReplaySession, type ReplayCollection, ReplaySlot, } from "./replay";
32
- export type { HostedFile } from "./files";
33
- export type { Filter } from "./filters";
34
- export type { HTTPQL, ID, JSONValue, JSONCompatible } from "./utils";
35
- export type { SlotContent, ButtonSlotContent, CustomSlotContent, CommandSlotContent, } from "./slots";
36
- 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 "./matchReplace";
37
- export type { Scope } from "./scopes";
38
- export type { EnvironmentVariable } from "./environment";
39
- export type { Workflow, WorkflowKind, OnCreatedWorkflowCallback, OnUpdatedWorkflowCallback, OnDeletedWorkflowCallback, } from "./workflows";
40
- export type { ListenerHandle } from "./utils";
41
- /**
42
- * Utilities for frontend plugins.
43
- * @category SDK
44
- */
45
- export type API<T extends BackendEndpoints = Record<string, never>, E extends BackendEvents = Record<string, never>> = {
46
- /**
47
- * Utilities to interact with the GraphQL API.
48
- */
49
- graphql: GraphqlSDK;
50
- /**
51
- * Utilities to interact with the backend plugin.
52
- */
53
- backend: BackendSDK<T, E>;
54
- /**
55
- * Utilities to create UI components.
56
- */
57
- ui: UISDK;
58
- /**
59
- * Utilities to interact with scopes
60
- */
61
- scopes: ScopesSDK;
62
- /**
63
- * Utilities to interact with findings
64
- */
65
- findings: FindingsSDK;
66
- /**
67
- * Utilities to interact with commands
68
- */
69
- commands: CommandsSDK;
70
- /**
71
- * Utilities to insert menu items and context-menus throughout the UI.
72
- */
73
- menu: MenuSDK;
74
- /**
75
- * Utilities to interact with navigation.
76
- */
77
- navigation: NavigationSDK;
78
- /**
79
- * Utilities to interact with the active page.
80
- */
81
- window: WindowSDK;
82
- /**
83
- * Utilities to interact with frontend-plugin storage.
84
- */
85
- storage: StorageSDK;
86
- /**
87
- * Utilities to interact with the plugin's static assets.
88
- */
89
- assets: AssetsSDK;
90
- /**
91
- * Utilities to interact with shortcuts.
92
- */
93
- shortcuts: ShortcutsSDK;
94
- /**
95
- * Utilities to interact with the command palette.
96
- */
97
- commandPalette: CommandPaletteSDK;
98
- /**
99
- * Utilities to interact with the sidebar.
100
- */
101
- sidebar: SidebarSDK;
102
- /**
103
- * Utilities to interact with the Replay page.
104
- */
105
- replay: ReplaySDK;
106
- /**
107
- * Utilities to interact with the Search page.
108
- */
109
- search: SearchSDK;
110
- /**
111
- * Utilities to interact with the HTTP History page.
112
- */
113
- httpHistory: HTTPHistorySDK;
114
- /**
115
- * Utilities to interact with the Files page.
116
- */
117
- files: FilesSDK;
118
- /**
119
- * Utilities to interact with Filters page.
120
- */
121
- filters: FiltersSDK;
122
- /**
123
- * Utilities to interact with Match and Replace page.
124
- */
125
- matchReplace: MatchReplaceSDK;
126
- /**
127
- * Utilities to interact with the environment.
128
- */
129
- env: EnvironmentSDK;
130
- /**
131
- * Utilities to interact with the Sitemap page.
132
- */
133
- sitemap: SitemapSDK;
134
- /**
135
- * Utilities to interact with the Intercept page.
136
- */
137
- intercept: InterceptSDK;
138
- /**
139
- * Utilities to interact with the runtime.
140
- */
141
- runtime: RuntimeSDK;
142
- /**
143
- * Utilities to interact with workflows.
144
- */
145
- workflows: WorkflowSDK;
146
- /**
147
- * Utilities to interact with the footer.
148
- */
149
- footer: FooterSDK;
150
- };
1
+ export { FooterSlot } from "./types/footer";
2
+ export type { DialogOptions } from "./types/window";
3
+ export type { CommandContext } from "./types/commands";
4
+ export type { MenuItem } from "./types/menu";
5
+ export { type ReplayTab, type ReplaySession, type ReplayCollection, ReplaySlot, } from "./types/replay";
6
+ export type { HostedFile } from "./types/files";
7
+ export type { Filter } from "./types/filter";
8
+ export type { HTTPQL, ID } from "./types/utils";
9
+ export type { JSONValue, JSONCompatible } from "./types/json";
10
+ export type { SlotContent, ButtonSlotContent, CustomSlotContent, CommandSlotContent, } from "./types/slots";
11
+ export type { RequestViewModeOptions } 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";
13
+ export type { Scope } from "./types/scopes";
14
+ export type { EnvironmentVariable } from "./types/environment";
15
+ export type { Workflow, WorkflowKind, OnCreatedWorkflowCallback, OnUpdatedWorkflowCallback, OnDeletedWorkflowCallback, } from "./types/workflows";
16
+ export type { ListenerHandle } from "./types/utils";
17
+ export type { API } from "./sdks";
@@ -1,3 +1,4 @@
1
+ import { type Asset } from "../types/assets";
1
2
  /**
2
3
  * Utilities to interact with the plugin's static assets.
3
4
  * @category Files
@@ -9,14 +10,3 @@ export type AssetsSDK = {
9
10
  */
10
11
  get: (path: string) => Promise<Asset>;
11
12
  };
12
- /**
13
- * A static asset.
14
- * @category Files
15
- */
16
- type Asset = {
17
- asReadableStream: () => ReadableStream;
18
- asArrayBuffer: () => Promise<ArrayBuffer>;
19
- asString: () => Promise<string>;
20
- asJson: <T = unknown>() => Promise<T>;
21
- };
22
- export {};
@@ -1,18 +1,5 @@
1
- import type { PromisifiedReturnType } from "./utils";
2
- /**
3
- * Endpoints provided by the backend plugin.
4
- * @category Backend
5
- */
6
- export type BackendEndpoints = {
7
- [key: string]: (...args: any[]) => any;
8
- };
9
- /**
10
- * Events emitted by the backend plugin.
11
- * @category Backend
12
- */
13
- export type BackendEvents = {
14
- [key: string]: (...args: any[]) => void;
15
- };
1
+ import { type BackendEndpoints, type BackendEvents } from "../types/backend";
2
+ import type { PromisifiedReturnType } from "../types/utils";
16
3
  /**
17
4
  * Utilities to interact with the backend plugin.
18
5
  * @category Backend
@@ -1,3 +1,4 @@
1
+ import { type CommandID } from "../types/commands";
1
2
  /**
2
3
  * Utilities to interact with the command palette.
3
4
  * @category Command Palette
@@ -8,5 +9,5 @@ export type CommandPaletteSDK = {
8
9
  * @deprecated Use `sdk.commandPalette.addToSlot` instead.
9
10
  * @param commandId The id of the command to register.
10
11
  */
11
- register: (commandId: string) => void;
12
+ register: (commandId: CommandID) => void;
12
13
  };
@@ -0,0 +1,31 @@
1
+ import type { CommandContext, CommandID } from "../types/commands";
2
+ /**
3
+ * Utilities to interact with commands
4
+ * @category Commands
5
+ */
6
+ export type CommandsSDK = {
7
+ /**
8
+ * Register a command.
9
+ * @param id The id of the command.
10
+ * @param options Options for the command.
11
+ * @param options.name The name of the command.
12
+ * @param options.run The function to run when the command is executed.
13
+ * @param options.group The group this command belongs to.
14
+ * @param options.when A function to determine if the command is available.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * sdk.commands.register("hello", {
19
+ * name: "Print to console.",
20
+ * run: () => console.log("Hello world!"),
21
+ * group: "Custom Commands",
22
+ * });
23
+ * ```
24
+ */
25
+ register: (id: CommandID, options: {
26
+ name: string;
27
+ run: (context: CommandContext) => Promise<void> | void;
28
+ group?: string;
29
+ when?: (context: CommandContext) => Promise<boolean> | boolean;
30
+ }) => void;
31
+ };
@@ -1,3 +1,4 @@
1
+ import { type EnvironmentVariable } from "../types/environment";
1
2
  /**
2
3
  * Utilities to interact with the environment.
3
4
  * @category Environment
@@ -15,17 +16,3 @@ export type EnvironmentSDK = {
15
16
  */
16
17
  getVars: () => EnvironmentVariable[];
17
18
  };
18
- export type EnvironmentVariable = {
19
- /**
20
- * The name of the environment variable.
21
- */
22
- name: string;
23
- /**
24
- * The value of the environment variable.
25
- */
26
- value: string;
27
- /**
28
- * Whether the environment variable is a secret.
29
- */
30
- isSecret: boolean;
31
- };
@@ -1,3 +1,4 @@
1
+ import { type HostedFile } from "../types/files";
1
2
  /**
2
3
  * SDK for interacting with the Files page.
3
4
  * @category Files
@@ -28,33 +29,3 @@ export type FilesSDK = {
28
29
  */
29
30
  delete: (id: string) => Promise<void>;
30
31
  };
31
- /**
32
- * A hosted file.
33
- * @category Files
34
- */
35
- export type HostedFile = {
36
- /**
37
- * The ID of the file.
38
- */
39
- id: string;
40
- /**
41
- * The name of the file.
42
- */
43
- name: string;
44
- /**
45
- * The size of the file in bytes.
46
- */
47
- size: number;
48
- /**
49
- * The path of the file.
50
- */
51
- path: string;
52
- /**
53
- * The date the file was created.
54
- */
55
- createdAt: Date;
56
- /**
57
- * The date the file was updated.
58
- */
59
- updatedAt: Date;
60
- };
@@ -1,4 +1,5 @@
1
- import type { HTTPQL, ID } from "./utils";
1
+ import { type Filter } from "../types/filter";
2
+ import type { HTTPQL, ID } from "../types/utils";
2
3
  /**
3
4
  * SDK for interacting with the Filters page.
4
5
  * @category Filters
@@ -45,26 +46,3 @@ export type FiltersSDK = {
45
46
  */
46
47
  delete: (id: ID) => Promise<void>;
47
48
  };
48
- /**
49
- * Represents a filter.
50
- * @category Filters
51
- */
52
- export type Filter = {
53
- /**
54
- * The ID of the filter.
55
- */
56
- id: ID;
57
- /**
58
- * The name of the filter.
59
- */
60
- name: string;
61
- /**
62
- * The alias of the filter.
63
- * This alias is used when referencing the filter in an HTTPQL query (e.g. `preset:my-alias`).
64
- */
65
- alias: string;
66
- /**
67
- * The HTTPQL expression of the filter.
68
- */
69
- query: HTTPQL;
70
- };
@@ -1,4 +1,5 @@
1
- import type { ID } from "./utils";
1
+ import { type Finding } from "../types/findings";
2
+ import type { ID } from "../types/utils";
2
3
  /**
3
4
  * Utilities to interact with findings
4
5
  * @category Findings
@@ -21,34 +22,3 @@ export type FindingsSDK = {
21
22
  dedupeKey?: string;
22
23
  }) => Promise<Finding | undefined>;
23
24
  };
24
- /**
25
- * Represents a {@link https://docs.caido.io/reference/features/logging/findings|Finding}.
26
- * @category Findings
27
- */
28
- type Finding = {
29
- /**
30
- * The ID of the finding.
31
- */
32
- id: ID;
33
- /**
34
- * The title of the finding.
35
- */
36
- title: string;
37
- /**
38
- * The description of the finding.
39
- */
40
- description?: string;
41
- /**
42
- * The reporter of the finding.
43
- */
44
- reporter: string;
45
- /**
46
- * The host of the request attached to this finding
47
- */
48
- host: string;
49
- /**
50
- * The path of the request attached to this finding
51
- */
52
- path: string;
53
- };
54
- export {};
@@ -1,9 +1,5 @@
1
- import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent, type DefineAddToSlotFn } from "./slots";
2
- export declare const FooterSlot: {
3
- readonly FooterSlotPrimary: "footer-primary";
4
- readonly FooterSlotSecondary: "footer-secondary";
5
- };
6
- export type FooterSlot = (typeof FooterSlot)[keyof typeof FooterSlot];
1
+ import { type FooterSlotContent } from "../types/footer";
2
+ import { type DefineAddToSlotFn } from "../types/slots";
7
3
  /**
8
4
  * Utilities to interact with the footer.
9
5
  * @category Footer
@@ -36,8 +32,5 @@ export type FooterSDK = {
36
32
  * });
37
33
  * ```
38
34
  */
39
- addToSlot: DefineAddToSlotFn<{
40
- [FooterSlot.FooterSlotPrimary]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
41
- [FooterSlot.FooterSlotSecondary]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
42
- }>;
35
+ addToSlot: DefineAddToSlotFn<FooterSlotContent>;
43
36
  };
@@ -1,5 +1,6 @@
1
1
  import type { Extension } from "@codemirror/state";
2
- import type { HTTPQL, ID } from "./utils";
2
+ import type { RequestViewModeOptions } from "../types/request";
3
+ import type { HTTPQL, ID } from "../types/utils";
3
4
  /**
4
5
  * Utilities to interact with the HTTP History page.
5
6
  * @category HTTP History
@@ -35,4 +36,9 @@ export type HTTPHistorySDK = {
35
36
  * @param extension The extension to add.
36
37
  */
37
38
  addResponseEditorExtension: (extension: Extension) => void;
39
+ /**
40
+ * Add a custom request view mode.
41
+ * @param options The view mode options.
42
+ */
43
+ addRequestViewMode: (options: RequestViewModeOptions) => void;
38
44
  };
@@ -0,0 +1,137 @@
1
+ import type { Sdk as GraphqlSDK } from "../__generated__/graphql-sdk";
2
+ import { type BackendEndpoints, type BackendEvents } from "../types/backend";
3
+ import type { AssetsSDK } from "./assets";
4
+ import type { BackendSDK } from "./backend";
5
+ import type { CommandPaletteSDK } from "./commandPalette";
6
+ import type { CommandsSDK } from "./commands";
7
+ import type { EnvironmentSDK } from "./environment";
8
+ import type { FilesSDK } from "./files";
9
+ import type { FiltersSDK } from "./filters";
10
+ import type { FindingsSDK } from "./findings";
11
+ import type { FooterSDK } from "./footer";
12
+ import type { HTTPHistorySDK } from "./httpHistory";
13
+ import type { InterceptSDK } from "./intercept";
14
+ import type { MatchReplaceSDK } from "./matchReplace";
15
+ import type { MenuSDK } from "./menu";
16
+ import type { NavigationSDK } from "./navigation";
17
+ import type { ReplaySDK } from "./replay";
18
+ import type { RuntimeSDK } from "./runtime";
19
+ import type { ScopesSDK } from "./scopes";
20
+ import type { SearchSDK } from "./search";
21
+ import type { ShortcutsSDK } from "./shortcuts";
22
+ import type { SidebarSDK } from "./sidebar";
23
+ import type { SitemapSDK } from "./sitemap";
24
+ import type { StorageSDK } from "./storage";
25
+ import type { UISDK } from "./ui";
26
+ import type { WindowSDK } from "./window";
27
+ import type { WorkflowSDK } from "./workflows";
28
+ /**
29
+ * Utilities for frontend plugins.
30
+ * @category SDK
31
+ */
32
+ export type API<T extends BackendEndpoints = Record<string, never>, E extends BackendEvents = Record<string, never>> = {
33
+ /**
34
+ * Utilities to interact with the GraphQL API.
35
+ */
36
+ graphql: GraphqlSDK;
37
+ /**
38
+ * Utilities to interact with the backend plugin.
39
+ */
40
+ backend: BackendSDK<T, E>;
41
+ /**
42
+ * Utilities to create UI components.
43
+ */
44
+ ui: UISDK;
45
+ /**
46
+ * Utilities to interact with scopes
47
+ */
48
+ scopes: ScopesSDK;
49
+ /**
50
+ * Utilities to interact with findings
51
+ */
52
+ findings: FindingsSDK;
53
+ /**
54
+ * Utilities to interact with commands
55
+ */
56
+ commands: CommandsSDK;
57
+ /**
58
+ * Utilities to insert menu items and context-menus throughout the UI.
59
+ */
60
+ menu: MenuSDK;
61
+ /**
62
+ * Utilities to interact with navigation.
63
+ */
64
+ navigation: NavigationSDK;
65
+ /**
66
+ * Utilities to interact with the active page.
67
+ */
68
+ window: WindowSDK;
69
+ /**
70
+ * Utilities to interact with frontend-plugin storage.
71
+ */
72
+ storage: StorageSDK;
73
+ /**
74
+ * Utilities to interact with the plugin's static assets.
75
+ */
76
+ assets: AssetsSDK;
77
+ /**
78
+ * Utilities to interact with shortcuts.
79
+ */
80
+ shortcuts: ShortcutsSDK;
81
+ /**
82
+ * Utilities to interact with the command palette.
83
+ */
84
+ commandPalette: CommandPaletteSDK;
85
+ /**
86
+ * Utilities to interact with the sidebar.
87
+ */
88
+ sidebar: SidebarSDK;
89
+ /**
90
+ * Utilities to interact with the Replay page.
91
+ */
92
+ replay: ReplaySDK;
93
+ /**
94
+ * Utilities to interact with the Search page.
95
+ */
96
+ search: SearchSDK;
97
+ /**
98
+ * Utilities to interact with the HTTP History page.
99
+ */
100
+ httpHistory: HTTPHistorySDK;
101
+ /**
102
+ * Utilities to interact with the Files page.
103
+ */
104
+ files: FilesSDK;
105
+ /**
106
+ * Utilities to interact with Filters page.
107
+ */
108
+ filters: FiltersSDK;
109
+ /**
110
+ * Utilities to interact with Match and Replace page.
111
+ */
112
+ matchReplace: MatchReplaceSDK;
113
+ /**
114
+ * Utilities to interact with the environment.
115
+ */
116
+ env: EnvironmentSDK;
117
+ /**
118
+ * Utilities to interact with the Sitemap page.
119
+ */
120
+ sitemap: SitemapSDK;
121
+ /**
122
+ * Utilities to interact with the Intercept page.
123
+ */
124
+ intercept: InterceptSDK;
125
+ /**
126
+ * Utilities to interact with the runtime.
127
+ */
128
+ runtime: RuntimeSDK;
129
+ /**
130
+ * Utilities to interact with workflows.
131
+ */
132
+ workflows: WorkflowSDK;
133
+ /**
134
+ * Utilities to interact with the footer.
135
+ */
136
+ footer: FooterSDK;
137
+ };
@@ -1,4 +1,4 @@
1
- import type { ID } from "./utils";
1
+ import type { ID } from "../types/utils";
2
2
  /**
3
3
  * Utilities to interact with the Intercept page.
4
4
  * @category Intercept
@@ -0,0 +1,87 @@
1
+ import { type MatchReplaceCollection, type MatchReplaceRule, type MatchReplaceSection } from "../types/matchReplace";
2
+ import type { HTTPQL, ID } from "../types/utils";
3
+ /**
4
+ * Utilities to interact with the Match and Replace page.
5
+ * @category Match and Replace
6
+ */
7
+ export type MatchReplaceSDK = {
8
+ /**
9
+ * Get all collections.
10
+ */
11
+ getCollections: () => MatchReplaceCollection[];
12
+ /**
13
+ * Create a collection.
14
+ * @param options - The options for the collection.
15
+ * @param options.name - The name of the collection.
16
+ */
17
+ createCollection: (options: {
18
+ name: string;
19
+ }) => Promise<MatchReplaceCollection>;
20
+ /**
21
+ * Update a collection.
22
+ * @param id - The ID of the collection.
23
+ * @param options - The new values for the collection.
24
+ * @param options.name - The new name of the collection.
25
+ */
26
+ updateCollection: (id: ID, options: {
27
+ name: string;
28
+ }) => Promise<MatchReplaceCollection>;
29
+ /**
30
+ * Delete a collection.
31
+ * @param id - The ID of the collection.
32
+ */
33
+ deleteCollection: (id: ID) => Promise<void>;
34
+ /**
35
+ * Get all rules.
36
+ * @returns All rules.
37
+ */
38
+ getRules: () => MatchReplaceRule[];
39
+ /**
40
+ * Get all active rules.
41
+ * Rules are ordered in priority from highest to lowest.
42
+ * @returns All active rules.
43
+ */
44
+ getActiveRules: () => MatchReplaceRule[];
45
+ /**
46
+ * Select a rule to be displayed in the UI.
47
+ * @param id - The ID of the rule, or undefined to clear the selection.
48
+ */
49
+ selectRule: (id: ID | undefined) => void;
50
+ /**
51
+ * Create a rule.
52
+ * @param options - The options for the rule.
53
+ * @param options.name - The name of the rule.
54
+ * @param options.query - The HTTPQL query to match the rule against.
55
+ * @param options.collectionId - The ID of the collection the rule belongs to.
56
+ */
57
+ createRule: (options: {
58
+ name: string;
59
+ query: HTTPQL;
60
+ section: MatchReplaceSection;
61
+ collectionId: ID;
62
+ }) => Promise<MatchReplaceRule>;
63
+ /**
64
+ * Update a rule.
65
+ * @param id - The ID of the rule.
66
+ * @param options - The new values for the rule.
67
+ * @param options.name - The new name of the rule.
68
+ * @param options.query - The new HTTPQL query of the rule.
69
+ * @param options.section - The new section of the rule.
70
+ */
71
+ updateRule: (id: ID, options: {
72
+ name: string;
73
+ query?: HTTPQL;
74
+ section: MatchReplaceSection;
75
+ }) => Promise<MatchReplaceRule>;
76
+ /**
77
+ * Toggle a rule.
78
+ * @param id - The ID of the rule.
79
+ * @param enabled - Whether the rule should be enabled.
80
+ */
81
+ toggleRule: (id: ID, enabled: boolean) => Promise<void>;
82
+ /**
83
+ * Delete a rule.
84
+ * @param id - The ID of the rule.
85
+ */
86
+ deleteRule: (id: ID) => Promise<void>;
87
+ };