@caido/sdk-frontend 0.57.2-beta.0 → 0.57.2-beta.1

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.57.2-beta.0",
3
+ "version": "0.57.2-beta.1",
4
4
  "description": "Typing for the Caido Frontend SDK",
5
5
  "author": "Caido Labs Inc. <dev@caido.io>",
6
6
  "repository": "https://github.com/caido/sdk-js/",
@@ -2,11 +2,12 @@ import type { DefineComponent } from "vue";
2
2
  import type { HTTPQLEditorProps } from "./types/httpqlEditor";
3
3
  export { FooterSlot, type FooterSlotContent } from "./types/footer";
4
4
  export type { DialogOptions, DialogComponent } from "./types/window";
5
+ export type { Editor } from "./types/editor";
5
6
  export type { _AnalyticsSDK } from "./private/analytics";
6
7
  export type { MessageViewModeOptions, StreamWsMessageMeta, MessageViewModePropsInternal, MessageViewModeProps, } from "./types/websocket";
7
8
  export type { CommandContext, CommandContextRequest, CommandContextRequestRow, CommandContextResponse, CommandContextBase, } from "./types/commands";
8
9
  export type { MenuItem } from "./types/menu";
9
- export { type AddCollectionIndicatorOptions, type AddSessionIndicatorOptions, type ReplayTab, type ReplaySession, type ReplayEntry, type ReplayCollection, type SendRequestOptions, ReplaySlot, type ReplaySlotContent, type RequestSource, type CurrentReplaySessionChangeEvent, ReplaySessionKind, type ReplayPageContext, } from "./types/replay";
10
+ export { type AddCollectionIndicatorOptions, type AddSessionIndicatorOptions, type ReplayTab, type ReplaySession, type ReplayEntry, type ReplaySelectedExchange, type ReplayWebSocketMessage, type ReplayCollection, type SendRequestOptions, ReplaySlot, type ReplaySlotContent, type RequestSource, type CurrentReplaySessionChangeEvent, ReplaySessionKind, type ReplayPageContext, } from "./types/replay";
10
11
  export type { AutomateSession, AutomateEntry } from "./types/automate";
11
12
  export type { SitemapEntry, SitemapRootEntry, ChildState, } from "./types/sitemap";
12
13
  export { SearchSlot, type SearchSlotContent } from "./types/search";
@@ -1,13 +1,23 @@
1
1
  import type { Extension } from "@codemirror/state";
2
2
  import type { AutomateEntry, AutomateSession } from "../types/automate";
3
- import type { RequestReadableViewModeProps, RequestViewModeOptions } from "../types/request";
4
- import type { ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
3
+ import type { RequestFull, RequestReadableViewModeProps, RequestViewModeOptions } from "../types/request";
4
+ import type { ResponseFull, ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
5
5
  import type { AddIndicatorOptions, ID, Indicator } from "../types/utils";
6
6
  /**
7
7
  * Utilities to interact with the Automate page.
8
8
  * @category Automate
9
9
  */
10
10
  export type AutomateSDK = {
11
+ /**
12
+ * Get the currently selected request.
13
+ * @returns The currently selected request.
14
+ */
15
+ getSelectedRequest: () => RequestFull | undefined;
16
+ /**
17
+ * Get the currently selected response.
18
+ * @returns The currently selected response.
19
+ */
20
+ getSelectedResponse: () => ResponseFull | undefined;
11
21
  /**
12
22
  * Add an extension to the request editor.
13
23
  * @param extension The extension to add.
@@ -1,7 +1,7 @@
1
1
  import type { Extension } from "@codemirror/state";
2
2
  import { type Finding } from "../types/findings";
3
- import type { RequestReadableViewModeProps, RequestViewModeOptions } from "../types/request";
4
- import type { ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
3
+ import type { RequestFull, RequestReadableViewModeProps, RequestViewModeOptions } from "../types/request";
4
+ import type { ResponseFull, ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
5
5
  import type { ID } from "../types/utils";
6
6
  /**
7
7
  * Utilities to interact with findings
@@ -24,6 +24,16 @@ export type FindingsSDK = {
24
24
  reporter: string;
25
25
  dedupeKey?: string;
26
26
  }) => Promise<Finding | undefined>;
27
+ /**
28
+ * Get the currently selected request.
29
+ * @returns The currently selected request.
30
+ */
31
+ getSelectedRequest: () => RequestFull | undefined;
32
+ /**
33
+ * Get the currently selected response.
34
+ * @returns The currently selected response.
35
+ */
36
+ getSelectedResponse: () => ResponseFull | undefined;
27
37
  /**
28
38
  * Add an extension to the request editor.
29
39
  * @param extension The extension to add.
@@ -1,7 +1,7 @@
1
1
  import type { Extension } from "@codemirror/state";
2
2
  import type { HTTPHistorySlotContent } from "../types/httpHistory";
3
- import type { RequestReadableViewModeProps, RequestViewModeOptions } from "../types/request";
4
- import type { ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
3
+ import type { RequestFull, RequestReadableViewModeProps, RequestViewModeOptions } from "../types/request";
4
+ import type { ResponseFull, ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
5
5
  import { type DefineAddToSlotFn } from "../types/slots";
6
6
  import type { HTTPQL, ID } from "../types/utils";
7
7
  /**
@@ -24,6 +24,16 @@ export type HTTPHistorySDK = {
24
24
  * @returns The current scope ID.
25
25
  */
26
26
  getScopeId: () => ID | undefined;
27
+ /**
28
+ * Get the currently selected request.
29
+ * @returns The currently selected request.
30
+ */
31
+ getSelectedRequest: () => RequestFull | undefined;
32
+ /**
33
+ * Get the currently selected response.
34
+ * @returns The currently selected response.
35
+ */
36
+ getSelectedResponse: () => ResponseFull | undefined;
27
37
  /**
28
38
  * Set the current scope.
29
39
  * @param id The ID of the scope to set.
@@ -1,5 +1,5 @@
1
- import type { RequestViewModeOptions, RequestWritableViewModeProps } from "../types/request";
2
- import type { ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
1
+ import type { RequestFull, RequestViewModeOptions, RequestWritableViewModeProps } from "../types/request";
2
+ import type { ResponseFull, ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
3
3
  import type { ID } from "../types/utils";
4
4
  /**
5
5
  * Utilities to interact with the Intercept page.
@@ -11,6 +11,16 @@ export type InterceptSDK = {
11
11
  * @returns The current scope ID.
12
12
  */
13
13
  getScopeId: () => ID | undefined;
14
+ /**
15
+ * Get the currently selected request.
16
+ * @returns The currently selected request.
17
+ */
18
+ getSelectedRequest: () => RequestFull | undefined;
19
+ /**
20
+ * Get the currently selected response.
21
+ * @returns The currently selected response.
22
+ */
23
+ getSelectedResponse: () => ResponseFull | undefined;
14
24
  /**
15
25
  * Set the current scope.
16
26
  * @param scopeId The ID of the scope to set.
@@ -1,7 +1,7 @@
1
1
  import { type Extension } from "@codemirror/state";
2
- import { type AddCollectionIndicatorOptions, type AddSessionIndicatorOptions, type CurrentReplaySessionChangeEvent, type OpenTabOptions, type ReplayCollection, type ReplayCollectionCreatedEvent, type ReplayEntry, type ReplaySession, type ReplaySessionCreatedEvent, type ReplaySessionKind, type ReplaySlotContent, type ReplayTab, type RequestSource, type SendRequestOptions } from "../types/replay";
3
- import type { RequestViewModeOptions, RequestWritableViewModeProps } from "../types/request";
4
- import type { ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
2
+ import { type AddCollectionIndicatorOptions, type AddSessionIndicatorOptions, type CurrentReplaySessionChangeEvent, type OpenTabOptions, type ReplayCollection, type ReplayCollectionCreatedEvent, type ReplayEntry, type ReplaySelectedExchange, type ReplaySession, type ReplaySessionCreatedEvent, type ReplaySessionKind, type ReplaySlotContent, type ReplayTab, type RequestSource, type SendRequestOptions } from "../types/replay";
3
+ import type { RequestFull, RequestViewModeOptions, RequestWritableViewModeProps } from "../types/request";
4
+ import type { ResponseFull, ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
5
5
  import { type DefineAddToSlotFn } from "../types/slots";
6
6
  import type { ID, Indicator, ListenerHandle } from "../types/utils";
7
7
  import type { MessageViewModeOptions, MessageViewModeProps } from "../types/websocket";
@@ -63,6 +63,21 @@ export type ReplaySDK = {
63
63
  * ```
64
64
  */
65
65
  getCurrentEntry: () => ReplayEntry | undefined;
66
+ /**
67
+ * Get the currently selected Replay exchange.
68
+ * @returns The currently selected Replay exchange.
69
+ */
70
+ getSelectedExchange: () => ReplaySelectedExchange | undefined;
71
+ /**
72
+ * Get the currently selected request.
73
+ * @returns The currently selected request.
74
+ */
75
+ getSelectedRequest: () => RequestFull | undefined;
76
+ /**
77
+ * Get the currently selected response.
78
+ * @returns The currently selected response.
79
+ */
80
+ getSelectedResponse: () => ResponseFull | undefined;
66
81
  /**
67
82
  * Rename a session.
68
83
  * @param id The ID of the session to rename.
@@ -1,6 +1,6 @@
1
1
  import type { Extension } from "@codemirror/state";
2
- import type { RequestReadableViewModeProps, RequestViewModeOptions } from "../types/request";
3
- import type { ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
2
+ import type { RequestFull, RequestReadableViewModeProps, RequestViewModeOptions } from "../types/request";
3
+ import type { ResponseFull, ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
4
4
  import type { SearchSlot, SearchSlotContent } from "../types/search";
5
5
  import type { HTTPQL, ID } from "../types/utils";
6
6
  /**
@@ -23,6 +23,16 @@ export type SearchSDK = {
23
23
  * @returns The current scope ID.
24
24
  */
25
25
  getScopeId: () => ID | undefined;
26
+ /**
27
+ * Get the currently selected request.
28
+ * @returns The currently selected request.
29
+ */
30
+ getSelectedRequest: () => RequestFull | undefined;
31
+ /**
32
+ * Get the currently selected response.
33
+ * @returns The currently selected response.
34
+ */
35
+ getSelectedResponse: () => ResponseFull | undefined;
26
36
  /**
27
37
  * Set the current scope.
28
38
  * @param id The ID of the scope to set.
@@ -1,6 +1,6 @@
1
1
  import type { Extension } from "@codemirror/state";
2
- import type { RequestReadableViewModeProps, RequestViewModeOptions } from "../types/request";
3
- import type { ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
2
+ import type { RequestFull, RequestReadableViewModeProps, RequestViewModeOptions } from "../types/request";
3
+ import type { ResponseFull, ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
4
4
  import type { SitemapEntry, SitemapEntryChildStateUpdateEvent, SitemapRootEntry } from "../types/sitemap";
5
5
  import type { AddIndicatorOptions, ID, Indicator, ListenerHandle } from "../types/utils";
6
6
  /**
@@ -39,6 +39,16 @@ export type SitemapSDK = {
39
39
  * @returns The current scope ID.
40
40
  */
41
41
  getScopeId: () => ID | undefined;
42
+ /**
43
+ * Get the currently selected request.
44
+ * @returns The currently selected request.
45
+ */
46
+ getSelectedRequest: () => RequestFull | undefined;
47
+ /**
48
+ * Get the currently selected response.
49
+ * @returns The currently selected response.
50
+ */
51
+ getSelectedResponse: () => ResponseFull | undefined;
42
52
  /**
43
53
  * Set the current scope.
44
54
  * @param id The ID of the scope to set.
@@ -11,6 +11,16 @@ export type WindowSDK = {
11
11
  * @returns The active editor.
12
12
  */
13
13
  getActiveEditor: () => Editor | undefined;
14
+ /**
15
+ * Get the active request editor.
16
+ * @returns The active request editor.
17
+ */
18
+ getActiveRequestEditor: () => Editor | undefined;
19
+ /**
20
+ * Get the active response editor.
21
+ * @returns The active response editor.
22
+ */
23
+ getActiveResponseEditor: () => Editor | undefined;
14
24
  /**
15
25
  * Show a toast message.
16
26
  * @param message The message to show.
@@ -1,3 +1,5 @@
1
+ import type { RequestFull } from "./request";
2
+ import type { ResponseFull } from "./response";
1
3
  import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent, type SlotContentProps, type SlotContentPropsGroup } from "./slots";
2
4
  import { type AddIndicatorOptions, type ID, type Selection } from "./utils";
3
5
  /**
@@ -110,6 +112,35 @@ export type ReplayEntry = {
110
112
  */
111
113
  requestId?: ID;
112
114
  };
115
+ /**
116
+ * The currently selected Replay exchange.
117
+ * @category Replay
118
+ */
119
+ export type ReplaySelectedExchange = {
120
+ kind: typeof ReplaySessionKind.Http;
121
+ entryId: ID;
122
+ sessionId: ID;
123
+ request: RequestFull;
124
+ response?: ResponseFull;
125
+ } | {
126
+ kind: typeof ReplaySessionKind.Ws;
127
+ entryId: ID;
128
+ sessionId: ID;
129
+ streamId?: ID;
130
+ activeTab: "http-upgrade" | "messages";
131
+ upgradeRequest?: RequestFull;
132
+ upgradeResponse?: ResponseFull;
133
+ message?: ReplayWebSocketMessage;
134
+ };
135
+ /**
136
+ * The currently edited WebSocket message in Replay.
137
+ * @category Replay
138
+ */
139
+ export type ReplayWebSocketMessage = {
140
+ raw: string;
141
+ direction: "CLIENT" | "SERVER";
142
+ format: "BINARY" | "CLOSE" | "PING" | "PONG" | "TEXT";
143
+ };
113
144
  /**
114
145
  * A collection in Replay.
115
146
  * @category Replay