@caido/sdk-frontend 0.51.2-beta.17 → 0.51.2-beta.19

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.51.2-beta.17",
3
+ "version": "0.51.2-beta.19",
4
4
  "description": "Typing for the Caido Frontend SDK",
5
5
  "author": "Caido Labs Inc. <dev@caido.io>",
6
6
  "license": "MIT",
@@ -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, } from "./types/replay";
5
+ export { type ReplayTab, type ReplaySession, 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";
@@ -16,5 +16,6 @@ export type { Workflow, WorkflowKind, OnCreatedWorkflowCallback, OnUpdatedWorkfl
16
16
  export type { ListenerHandle } from "./types/utils";
17
17
  export type { AIProvider } from "./types/ai";
18
18
  export type { SelectedProjectChangeEvent } from "./types/projects";
19
+ export type { CommandPaletteView } from "./sdks/commandPalette";
19
20
  export type { API } from "./sdks";
20
21
  export { Routes } from "./types/navigation";
@@ -1,4 +1,13 @@
1
1
  import { type CommandID } from "../types/commands";
2
+ import { type ComponentDefinition } from "../types/utils";
3
+ /**
4
+ * Command palette view definition for custom UI content.
5
+ * @category Command Palette
6
+ */
7
+ export type CommandPaletteView = {
8
+ type: "Custom";
9
+ definition: ComponentDefinition;
10
+ };
2
11
  /**
3
12
  * Utilities to interact with the command palette.
4
13
  * @category Command Palette
@@ -9,4 +18,9 @@ export type CommandPaletteSDK = {
9
18
  * @param commandId The id of the command to register.
10
19
  */
11
20
  register: (commandId: CommandID) => void;
21
+ /**
22
+ * Push a new view onto the command palette view stack.
23
+ * @param view The view to push onto the stack.
24
+ */
25
+ pushView: (view: CommandPaletteView) => void;
12
26
  };
@@ -1,8 +1,8 @@
1
1
  import { type Extension } from "@codemirror/state";
2
- import { 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 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
- import type { ID } from "../types/utils";
5
+ import type { ID, ListenerHandle } from "../types/utils";
6
6
  /**
7
7
  * Utilities to interact with Replay.
8
8
  * @category Replay
@@ -134,4 +134,20 @@ export type ReplaySDK = {
134
134
  * ```
135
135
  */
136
136
  sendRequest: (sessionId: ID, options: SendRequestOptions) => Promise<void>;
137
+ /**
138
+ * Subscribe to current replay session changes.
139
+ * @param callback The callback to call when the selected session changes.
140
+ * @returns An object with a `stop` method that can be called to stop listening to session changes.
141
+ *
142
+ * @example
143
+ * ```ts
144
+ * const handler = sdk.replay.onCurrentSessionChange((event) => {
145
+ * console.log(`Session ${event.sessionId} got selected!`);
146
+ * });
147
+ *
148
+ * // Later, stop listening
149
+ * handler.stop();
150
+ * ```
151
+ */
152
+ onCurrentSessionChange: (callback: (event: CurrentReplaySessionChangeEvent) => void) => ListenerHandle;
137
153
  };
@@ -166,3 +166,13 @@ export type RequestSource = {
166
166
  type: "ID";
167
167
  id: string;
168
168
  };
169
+ /**
170
+ * Event fired when the current replay session changes.
171
+ * @category Replay
172
+ */
173
+ export type CurrentReplaySessionChangeEvent = {
174
+ /**
175
+ * The ID of the newly selected session, or undefined if no session is selected.
176
+ */
177
+ sessionId: ID | undefined;
178
+ };
@@ -1,8 +1,8 @@
1
1
  import { type CommandID } from "./commands";
2
- import { type ComponentDefinition } from "./utils";
3
- type DefineSlotContent<TType extends string, P extends Record<string, unknown>> = {
2
+ import { type ComponentDefinition, type Prettify } from "./utils";
3
+ type DefineSlotContent<TType extends string, P extends Record<string, unknown>> = Prettify<{
4
4
  type: TType;
5
- } & P;
5
+ } & P>;
6
6
  export type ButtonSlotContent = DefineSlotContent<"Button", {
7
7
  label: string;
8
8
  icon?: string;