@caido/sdk-frontend 0.40.1-beta.2 → 0.40.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caido/sdk-frontend",
3
- "version": "0.40.1-beta.2",
3
+ "version": "0.40.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",
@@ -10,6 +10,8 @@
10
10
  "files": [
11
11
  "src/*"
12
12
  ],
13
- "peerDependencies": {},
13
+ "peerDependencies": {
14
+ "@codemirror/view": "^6.0.0"
15
+ },
14
16
  "peerDependenciesMeta": {}
15
17
  }
@@ -1,3 +1,4 @@
1
+ import type { EditorView } from "@codemirror/view";
1
2
  /**
2
3
  * Generic editor interface.
3
4
  */
@@ -21,3 +22,11 @@ export type Editor = {
21
22
  */
22
23
  focus: () => void;
23
24
  };
25
+ export type HTTPRequestEditor = {
26
+ getElement: () => HTMLElement;
27
+ getEditorView: () => EditorView;
28
+ };
29
+ export type HTTPResponseEditor = {
30
+ getElement: () => HTMLElement;
31
+ getEditorView: () => EditorView;
32
+ };
@@ -1,7 +1,7 @@
1
1
  import type { Sdk } from "./__generated__/graphql-sdk";
2
2
  import type { BackendEndpoints, BackendEvents, ToBackendRPC } from "./backend";
3
3
  import type { CommandContext } from "./commands";
4
- import type { Editor } from "./editor";
4
+ import type { Editor, HTTPRequestEditor, HTTPResponseEditor } from "./editor";
5
5
  import type { Finding } from "./findings";
6
6
  import type { MenuItem } from "./menu";
7
7
  import type { Scope } from "./scopes";
@@ -59,6 +59,16 @@ export type API<T extends BackendEndpoints = Record<string, never>, E extends Ba
59
59
  body?: HTMLElement;
60
60
  footer?: HTMLElement;
61
61
  }) => HTMLElement;
62
+ /**
63
+ * Create an HTTP request editor
64
+ * @returns The HTTP request editor.
65
+ */
66
+ httpRequestEditor: () => HTTPRequestEditor;
67
+ /**
68
+ * Create an HTTP response editor
69
+ * @returns The HTTP response editor.
70
+ */
71
+ httpResponseEditor: () => HTTPResponseEditor;
62
72
  };
63
73
  /**
64
74
  * Utilities to interact with scopes