@caido/sdk-frontend 0.56.3-beta.2 → 0.57.1-beta.10

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,10 +1,12 @@
1
+ import type { DefineComponent } from "vue";
2
+ import type { HTTPQLEditorProps } from "./types/httpqlEditor";
1
3
  export { FooterSlot, type FooterSlotContent } from "./types/footer";
2
4
  export type { DialogOptions, DialogComponent } from "./types/window";
3
5
  export type { _AnalyticsSDK } from "./private/analytics";
4
6
  export type { MessageViewModeOptions, StreamWsMessageMeta, MessageViewModePropsInternal, MessageViewModeProps, } from "./types/websocket";
5
7
  export type { CommandContext, CommandContextRequest, CommandContextRequestRow, CommandContextResponse, CommandContextBase, } from "./types/commands";
6
8
  export type { MenuItem } from "./types/menu";
7
- export { type AddSessionIndicatorOptions, type ReplayTab, type ReplaySession, type ReplayEntry, type ReplayCollection, type SendRequestOptions, ReplaySlot, type ReplaySlotContent, type RequestSource, type CurrentReplaySessionChangeEvent, } from "./types/replay";
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";
8
10
  export type { AutomateSession, AutomateEntry } from "./types/automate";
9
11
  export type { SitemapEntry, SitemapRootEntry, ChildState, } from "./types/sitemap";
10
12
  export { SearchSlot, type SearchSlotContent } from "./types/search";
@@ -43,9 +45,12 @@ export type { FindingsPageContext } from "./types/findings";
43
45
  export type { HTTPHistoryPageContext } from "./types/httpHistory";
44
46
  export type { InterceptPageContext } from "./types/intercept";
45
47
  export type { ProjectsPageContext } from "./types/projects";
46
- export type { ReplayPageContext } from "./types/replay";
47
48
  export type { ScopePageContext } from "./types/scopes";
48
49
  export type { SearchPageContext } from "./types/search";
49
50
  export type { SitemapPageContext } from "./types/sitemap";
50
51
  export type { MatchReplacePageContext } from "./types/matchReplace";
51
52
  export type { WorkflowsPageContext } from "./types/workflows";
53
+ export type { HTTPQLEditorProps };
54
+ export declare const HTTPQLEditor: DefineComponent<HTTPQLEditorProps & {
55
+ modelValue?: string;
56
+ }>;
@@ -1,5 +1,5 @@
1
- import { type ListenerHandle } from "src/types/utils";
2
1
  import { type HostedFile } from "../types/files";
2
+ import { type ListenerHandle } from "../types/utils";
3
3
  /**
4
4
  * SDK for interacting with the Files page.
5
5
  * @category Files
@@ -39,6 +39,23 @@ import type { WorkflowSDK } from "./workflows";
39
39
  export type API<T extends BackendEndpoints | BackendSpec = Record<string, never>, E extends BackendEvents = Record<string, never>> = {
40
40
  /**
41
41
  * Utilities to interact with the GraphQL API.
42
+ *
43
+ * Queries and mutations return a promise; subscriptions return an
44
+ * `AsyncIterable`. On success they resolve with the response data or yield
45
+ * it. On failure (network error or any GraphQL errors returned by the
46
+ * server) the promise rejects, or the iterator throws into the `for await`
47
+ * loop, with the underlying error. Failures can be handled with `try`/
48
+ * `catch` or `.catch()`.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * try {
53
+ * const result = await sdk.graphql.automateEntry({ id: "1" });
54
+ * // use result
55
+ * } catch (err) {
56
+ * // err.message, err.graphQLErrors, err.networkError
57
+ * }
58
+ * ```
42
59
  */
43
60
  graphql: GraphqlSDK;
44
61
  /**
@@ -1,5 +1,5 @@
1
1
  import { type Extension } from "@codemirror/state";
2
- import { type AddSessionIndicatorOptions, type CurrentReplaySessionChangeEvent, type OpenTabOptions, type ReplayCollection, type ReplayCollectionCreatedEvent, type ReplayEntry, type ReplaySession, type ReplaySessionCreatedEvent, type ReplaySlotContent, type ReplayTab, type RequestSource, type SendRequestOptions } from "../types/replay";
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
3
  import type { RequestViewModeOptions, RequestWritableViewModeProps } from "../types/request";
4
4
  import type { ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
5
5
  import { type DefineAddToSlotFn } from "../types/slots";
@@ -27,9 +27,13 @@ export type ReplaySDK = {
27
27
  getTabs: () => ReplayTab[];
28
28
  /**
29
29
  * Get the list of all replay sessions.
30
+ * @param options The options for getting the sessions.
31
+ * @param options.collectionId The ID of the collection to get the sessions for.
30
32
  * @returns The list of all replay sessions.
31
33
  */
32
- getSessions: () => ReplaySession[];
34
+ getSessions: (options?: {
35
+ collectionId?: ID;
36
+ }) => ReplaySession[];
33
37
  /**
34
38
  * Get the currently selected replay session.
35
39
  * @returns The currently selected replay session, or undefined if no session is selected.
@@ -44,6 +48,20 @@ export type ReplaySDK = {
44
48
  * ```
45
49
  */
46
50
  getCurrentSession: () => ReplaySession | undefined;
51
+ /**
52
+ * Get the entry currently displayed in the active replay session.
53
+ * @returns The active entry, or undefined if no entry is currently loaded.
54
+ * @example
55
+ * ```ts
56
+ * const currentEntry = sdk.replay.getCurrentEntry();
57
+ * if (currentEntry) {
58
+ * console.log(`Currently viewing entry ${currentEntry.id}`);
59
+ * } else {
60
+ * console.log("No entry is currently displayed");
61
+ * }
62
+ * ```
63
+ */
64
+ getCurrentEntry: () => ReplayEntry | undefined;
47
65
  /**
48
66
  * Rename a session.
49
67
  * @param id The ID of the session to rename.
@@ -65,10 +83,22 @@ export type ReplaySDK = {
65
83
  deleteSessions: (sessionIds: ID[]) => Promise<ID[]>;
66
84
  /**
67
85
  * Create a session.
68
- * @param sessionId The ID of the request to add.
69
- * @param collectionId The ID of the collection to add the request.
86
+ * @param source The source of the session to create.
87
+ * @param collectionId The ID of the collection to add the session to.
88
+ * @example
89
+ * ```ts
90
+ * sdk.replay.createSession({
91
+ * type: "Raw",
92
+ * raw: "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n",
93
+ * connectionInfo: {
94
+ * host: "example.com",
95
+ * port: 443,
96
+ * isTLS: true,
97
+ * },
98
+ * });
99
+ * ```
70
100
  */
71
- createSession: (source: RequestSource, collectionId?: ID) => Promise<void>;
101
+ createSession: (source: RequestSource, collectionId?: ID, sessionKind?: ReplaySessionKind) => Promise<ReplaySession>;
72
102
  /**
73
103
  * Get the list of all replay collections.
74
104
  * @returns The list of all replay collections.
@@ -243,4 +273,22 @@ export type ReplaySDK = {
243
273
  *
244
274
  */
245
275
  addSessionIndicator: (sessionId: ID, indicator: AddSessionIndicatorOptions) => Indicator;
276
+ /**
277
+ * Add an indicator to a replay collection.
278
+ * Indicators are displayed next to the collection name in the collections tree.
279
+ * @param collectionId The ID of the collection to add the indicator to.
280
+ * @param indicator The indicator configuration.
281
+ * @returns A handle object with a `remove` method to remove the indicator.
282
+ * @example
283
+ *
284
+ * const indicator = sdk.replay.addCollectionIndicator(collectionId, {
285
+ * icon: "fas fa-folder-open",
286
+ * description: "Has unresolved findings",
287
+ * });
288
+ *
289
+ * // Later, remove the indicator
290
+ * indicator.remove();
291
+ *
292
+ */
293
+ addCollectionIndicator: (collectionId: ID, indicator: AddCollectionIndicatorOptions) => Indicator;
246
294
  };
@@ -0,0 +1,3 @@
1
+ export type HTTPQLEditorProps = {
2
+ isReadOnly?: boolean;
3
+ };
@@ -219,6 +219,24 @@ export type AddSessionIndicatorOptions = AddIndicatorOptions & {
219
219
  */
220
220
  showTabIcon?: boolean;
221
221
  };
222
+ /**
223
+ * Options for adding an indicator to a replay collection.
224
+ * @category Replay
225
+ */
226
+ export type AddCollectionIndicatorOptions = AddIndicatorOptions;
227
+ /**
228
+ * The kind of a replay session.
229
+ * @category Replay
230
+ */
231
+ export declare const ReplaySessionKind: {
232
+ readonly Http: "HTTP";
233
+ readonly Ws: "WS";
234
+ };
235
+ /**
236
+ * The kind of a replay session.
237
+ * @category Replay
238
+ */
239
+ export type ReplaySessionKind = (typeof ReplaySessionKind)[keyof typeof ReplaySessionKind];
222
240
  /**
223
241
  * A unique replay session identifier.
224
242
  * @category Replay