@caido/sdk-frontend 0.53.2-beta.0 → 0.53.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.53.2-beta.0",
3
+ "version": "0.53.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,7 +2,7 @@ export { FooterSlot, type FooterSlotContent } from "./types/footer";
2
2
  export type { DialogOptions } from "./types/window";
3
3
  export type { CommandContext, CommandContextRequest, CommandContextRequestRow, CommandContextResponse, CommandContextBase, } from "./types/commands";
4
4
  export type { MenuItem } from "./types/menu";
5
- export { type ReplayTab, type ReplaySession, type ReplayCollection, type SendRequestOptions, ReplaySlot, type ReplaySlotContent, type RequestSource, type CurrentReplaySessionChangeEvent, } from "./types/replay";
5
+ export { type ReplayTab, type ReplaySession, type ReplayEntry, type ReplayCollection, type SendRequestOptions, ReplaySlot, type ReplaySlotContent, type RequestSource, type CurrentReplaySessionChangeEvent, } from "./types/replay";
6
6
  export type { HostedFile } from "./types/files";
7
7
  export type { Filter } from "./types/filter";
8
8
  export type { HTTPQL, ID, ComponentDefinition } from "./types/utils";
@@ -1,5 +1,5 @@
1
1
  import { type Extension } from "@codemirror/state";
2
- import { type CurrentReplaySessionChangeEvent, type OpenTabOptions, type ReplayCollection, type ReplaySession, type ReplaySlotContent, type ReplayTab, type RequestSource, type SendRequestOptions } from "../types/replay";
2
+ import { type CurrentReplaySessionChangeEvent, type OpenTabOptions, type ReplayCollection, type ReplayEntry, type ReplaySession, type ReplaySlotContent, type ReplayTab, type RequestSource, type SendRequestOptions } from "../types/replay";
3
3
  import type { RequestViewModeOptions } from "../types/request";
4
4
  import { type DefineAddToSlotFn } from "../types/slots";
5
5
  import type { ID, ListenerHandle } from "../types/utils";
@@ -134,6 +134,34 @@ export type ReplaySDK = {
134
134
  * ```
135
135
  */
136
136
  sendRequest: (sessionId: ID, options: SendRequestOptions) => Promise<void>;
137
+ /**
138
+ * Show a specific entry in a replay session.
139
+ * This will open the session tab if not already open, set it as the selected session, and display the specified entry.
140
+ * @param sessionId The ID of the session containing the entry.
141
+ * @param entryId The ID of the entry to show.
142
+ * @param options The options for showing the entry.
143
+ * @param options.overwriteDraft Whether to overwrite the request draft. If true, the draft will be removed and the entry's raw request will be shown. If false, the draft will be kept.
144
+ * @example
145
+ * ```ts
146
+ * await sdk.replay.showEntry(sessionId, entryId, {
147
+ * overwriteDraft: true,
148
+ * });
149
+ * ```
150
+ */
151
+ showEntry: (sessionId: ID, entryId: ID, options?: {
152
+ overwriteDraft?: boolean;
153
+ }) => Promise<void>;
154
+ /**
155
+ * Get a replay entry by its ID.
156
+ * @param entryId The ID of the entry to get.
157
+ * @returns The replay entry.
158
+ * @example
159
+ * ```ts
160
+ * const entry = await sdk.replay.getEntry(entryId);
161
+ * console.log(entry.id, entry.sessionId, entry.requestId);
162
+ * ```
163
+ */
164
+ getEntry: (entryId: ID) => ReplayEntry;
137
165
  /**
138
166
  * Subscribe to current replay session changes.
139
167
  * @param callback The callback to call when the selected session changes.
@@ -62,6 +62,28 @@ export type ReplaySession = {
62
62
  * The ID of the collection the session belongs to.
63
63
  */
64
64
  collectionId: ID;
65
+ /**
66
+ * The IDs of all entries in this session.
67
+ */
68
+ entryIds: ID[];
69
+ };
70
+ /**
71
+ * A replay entry.
72
+ * @category Replay
73
+ */
74
+ export type ReplayEntry = {
75
+ /**
76
+ * The ID of the entry.
77
+ */
78
+ id: ID;
79
+ /**
80
+ * The ID of the session this entry belongs to.
81
+ */
82
+ sessionId: ID;
83
+ /**
84
+ * The ID of the request associated with this entry, if any.
85
+ */
86
+ requestId?: ID;
65
87
  };
66
88
  /**
67
89
  * A collection in Replay.