diff --git a/src/reference/sdks/backend/api.md b/src/reference/sdks/backend/api.md index ed6d9f9..fd5d526 100644 --- a/src/reference/sdks/backend/api.md +++ b/src/reference/sdks/backend/api.md @@ -2,7 +2,7 @@ ### APISDK -> **APISDK**\<`API`, `Events`\> = `object` +> **APISDK**\<`SpecOrAPI`, `Events`\> = `object` The SDK for the API RPC service. @@ -10,23 +10,29 @@ The SDK for the API RPC service. | Type Parameter | Default type | | ------ | ------ | -| `API` | `object` | +| `SpecOrAPI` | `object` | | `Events` | `object` | #### Methods ##### register() -> **register**(`name`: keyof `API`, `callback`: (`sdk`: [`SDK`](index.md#sdk), ...`args`: `any`[]) => `any`): `void` +> **register**\<`K`\>(`name`: `K`, `callback`: [`APICallback`](other.md#apicallback)\<[`ResolvedAPI`](other.md#resolvedapi)\<`SpecOrAPI`\>\[`K`\]\>): `void` Registers a new backend function for the RPC. +###### Type Parameters + +| Type Parameter | +| ------ | +| `K` *extends* `string` \| `number` \| `symbol` | + ###### Parameters | Parameter | Type | | ------ | ------ | -| `name` | keyof `API` | -| `callback` | (`sdk`: [`SDK`](index.md#sdk), ...`args`: `any`[]) => `any` | +| `name` | `K` | +| `callback` | [`APICallback`](other.md#apicallback)\<[`ResolvedAPI`](other.md#resolvedapi)\<`SpecOrAPI`\>\[`K`\]\> | ###### Returns @@ -42,16 +48,22 @@ sdk.api.register("multiply", (sdk: SDK, a: number, b: number) => { ##### send() -> **send**(`event`: keyof `Events`, ...`args`: `any`[]): `void` +> **send**\<`K`\>(`event`: `K`, ...`args`: [`EventParameters`](other.md#eventparameters)\<[`ResolvedEvents`](other.md#resolvedevents)\<`SpecOrAPI`, `Events`\>\[`K`\]\>): `void` Sends an event to the frontend plugin. +###### Type Parameters + +| Type Parameter | +| ------ | +| `K` *extends* `string` \| `number` \| `symbol` | + ###### Parameters | Parameter | Type | | ------ | ------ | -| `event` | keyof `Events` | -| ...`args` | `any`[] | +| `event` | `K` | +| ...`args` | [`EventParameters`](other.md#eventparameters)\<[`ResolvedEvents`](other.md#resolvedevents)\<`SpecOrAPI`, `Events`\>\[`K`\]\> | ###### Returns diff --git a/src/reference/sdks/backend/index.md b/src/reference/sdks/backend/index.md index aa58f0c..468e973 100644 --- a/src/reference/sdks/backend/index.md +++ b/src/reference/sdks/backend/index.md @@ -1,7 +1,7 @@ # @caido/sdk-backend This is the reference for the backend SDK used by backend plugins. -[SDK](#events) is the main interface that provides access to various services and functionalities. +[SDK](other.md#events) is the main interface that provides access to various services and functionalities. ## SDK diff --git a/src/reference/sdks/backend/other.md b/src/reference/sdks/backend/other.md index a0e47b6..a1e856c 100644 --- a/src/reference/sdks/backend/other.md +++ b/src/reference/sdks/backend/other.md @@ -145,6 +145,50 @@ The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_ *** +### AnyFn() + +> **AnyFn** = (...`args`: `any`[]) => [`MaybePromise`](shared.md#maybepromise)\<`any`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| ...`args` | `any`[] | + +#### Returns + +[`MaybePromise`](shared.md#maybepromise)\<`any`\> + +*** + +### AnyVoidFn() + +> **AnyVoidFn** = (...`args`: `any`[]) => [`MaybePromise`](shared.md#maybepromise)\<`void`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| ...`args` | `any`[] | + +#### Returns + +[`MaybePromise`](shared.md#maybepromise)\<`void`\> + +*** + +### APICallback + +> **APICallback**\<`T`\> = `T` *extends* [`AnyFn`](#anyfn) ? (`sdk`: [`SDK`](index.md#sdk), ...`args`: `Parameters`\<`T`\>) => `ReturnType`\<`T`\> : [`InvalidCallbackMessage`](#invalidcallbackmessage) + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +*** + ### Console > **Console** = `object` @@ -276,6 +320,54 @@ The value of the environment variable. *** +### EventParameters + +> **EventParameters**\<`T`\> = `T` *extends* [`AnyVoidFn`](#anyvoidfn) ? `A` : [`InvalidEventParametersMessage`](#invalideventparametersmessage) + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +*** + +### ExactPluginPackageKeys + +> **ExactPluginPackageKeys**\<`T`\> = keyof `T` *extends* [`PluginPackageSpecKey`](#pluginpackagespeckey) ? [`PluginPackageSpecKey`](#pluginpackagespeckey) *extends* keyof `T` ? `unknown` : [`PluginPackageSpecKeyError`](#pluginpackagespeckeyerror) : [`PluginPackageSpecKeyError`](#pluginpackagespeckeyerror) + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +*** + +### InvalidCallbackMessage + +> **InvalidCallbackMessage** = `"Your callback must respect the format (sdk: SDK, ...args: unknown[]) => MaybePromise"` + +*** + +### InvalidEventParametersMessage + +> **InvalidEventParametersMessage** = `"Invalid event parameters"` + +*** + +### MaybePromise + +> **MaybePromise**\<`T`\> = `T` \| `Promise`\<`T`\> + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +*** + ### PageInfo > **PageInfo** = `object` @@ -308,6 +400,63 @@ Information on the current page of paginated data. *** +### PluginPackageSpec + +> **PluginPackageSpec** = `object` + +#### Properties + +##### api + +> **api**: `Record`\<`string`, [`AnyFn`](#anyfn)\> + +##### events + +> **events**: `Record`\<`string`, [`AnyVoidFn`](#anyvoidfn)\> + +##### manifestId + +> **manifestId**: `string` + +*** + +### PluginPackageSpecKey + +> **PluginPackageSpecKey** = keyof [`PluginPackageSpec`](#pluginpackagespec) + +*** + +### PluginPackageSpecKeyError + +> **PluginPackageSpecKeyError** = `"Only manifestId, api and events keys are allowed"` + +*** + +### ResolvedAPI + +> **ResolvedAPI**\<`T`\> = `T` *extends* `object` ? `A` : `T` + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +*** + +### ResolvedEvents + +> **ResolvedEvents**\<`T`, `Events`\> = `T` *extends* `object` ? `A` : `Events` + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` | +| `Events` | + +*** + ### Result > **Result** = `object` diff --git a/src/reference/sdks/backend/shared.md b/src/reference/sdks/backend/shared.md index 3efce17..703480f 100644 --- a/src/reference/sdks/backend/shared.md +++ b/src/reference/sdks/backend/shared.md @@ -22,7 +22,7 @@ A cursor for pagination. *** -### DefineAPI +### ~~DefineAPI~~ > **DefineAPI**\<`API`\> = `{ [K in keyof API]: DefineAPICallback }` @@ -50,6 +50,10 @@ export function init(sdk: SDK) { } ``` +#### Deprecated + +Use DefinePluginPackageSpec instead. + *** ### DefineAPICallback @@ -80,7 +84,7 @@ Parser for Plugin backend events callbacks. *** -### DefineEvents +### ~~DefineEvents~~ > **DefineEvents**\<`Events`\> = `{ [K in keyof Events]: DefineEventCallback }` @@ -106,33 +110,57 @@ export function init(sdk: SDK<{}, BackendEvents>) { } ``` +#### Deprecated + +Use DefinePluginPackageSpec instead. + *** -### ID +### DefinePluginPackageSpec -> **ID** = `string` & `object` +> **DefinePluginPackageSpec**\<`TSpec`\> = `TSpec` -A unique identifier. +Define the specification of a Plugin Package. This includes: -#### Type Declaration +- Manifest ID: the unique identifier of the plugin package. +- API: the backend functions that are callable from the frontend plugin. +- Events: the events that the frontend can receive from the backend plugin. -##### \_\_id? +#### Type Parameters -> `optional` **\_\_id**: `never` +| Type Parameter | +| ------ | +| `TSpec` *extends* [`PluginPackageSpec`](other.md#pluginpackagespec) & [`ExactPluginPackageKeys`](other.md#exactpluginpackagekeys)\<`TSpec`\> | + +#### Example + +```typescript +type MyEventData = { id: string; name: string }; + +export type Spec = DefinePluginPackageSpec<{ + manifestId: "myplugin", + api: { + myFunction: (min: number, max: number) => Promise; + }, + events: { + "my-event": (data: MyEventData) => void; + } +}>; +``` *** -### MaybePromise +### ID -> **MaybePromise**\<`T`\> = `T` \| `Promise`\<`T`\> +> **ID** = `string` & `object` -Promise or value. +A unique identifier. -#### Type Parameters +#### Type Declaration -| Type Parameter | -| ------ | -| `T` | +##### \_\_id? + +> `optional` **\_\_id**: `never` *** diff --git a/src/reference/sdks/frontend/automate.md b/src/reference/sdks/frontend/automate.md index a93ae66..90c6780 100644 --- a/src/reference/sdks/frontend/automate.md +++ b/src/reference/sdks/frontend/automate.md @@ -108,7 +108,7 @@ Add an extension to the request editor. ##### addRequestViewMode() -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestReadableViewModeProps`](request.md#requestreadableviewmodeprops)\>) => `void` Add a custom request view mode. @@ -116,7 +116,7 @@ Add a custom request view mode. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestReadableViewModeProps`](request.md#requestreadableviewmodeprops)\> | The view mode options. | ###### Returns @@ -124,7 +124,7 @@ Add a custom request view mode. ##### addResponseViewMode() -> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)) => `void` +> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\>) => `void` Add a custom response view mode. @@ -132,7 +132,7 @@ Add a custom response view mode. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions) | The view mode options. | +| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\> | The view mode options. | ###### Returns diff --git a/src/reference/sdks/frontend/backend.md b/src/reference/sdks/frontend/backend.md index 54b83a6..800c374 100644 --- a/src/reference/sdks/frontend/backend.md +++ b/src/reference/sdks/frontend/backend.md @@ -26,7 +26,7 @@ Events emitted by the backend plugin. ### BackendSDK -> **BackendSDK**\<`T`, `E`\> = `{ [K in keyof T]: (args: Parameters) => PromisifiedReturnType }` & `object` +> **BackendSDK**\<`T`, `E`\> = `{ [K in keyof ResolvedAPI]: (args: Parameters[K]>) => PromisifiedReturnType[K]> }` & `object` Utilities to interact with the backend plugin. @@ -34,7 +34,7 @@ Utilities to interact with the backend plugin. ##### onEvent() -> **onEvent**: \<`K`\>(`event`: `K`, `callback`: `E`\[`K`\]) => `object` +> **onEvent**: \<`K`\>(`event`: `K`, `callback`: [`ResolvedEvents`](other.md#resolvedevents)\<`T`, `E`\>\[`K`\]) => `object` Subscribe to a backend event. @@ -42,14 +42,14 @@ Subscribe to a backend event. | Type Parameter | | ------ | -| `K` *extends* keyof `E` | +| `K` *extends* keyof [`ResolvedEvents`](other.md#resolvedevents)\<`T`, `E`\> | ###### Parameters | Parameter | Type | Description | | ------ | ------ | ------ | | `event` | `K` | The event to subscribe to. | -| `callback` | `E`\[`K`\] | The callback to call when the event is emitted. | +| `callback` | [`ResolvedEvents`](other.md#resolvedevents)\<`T`, `E`\>\[`K`\] | The callback to call when the event is emitted. | ###### Returns @@ -69,5 +69,23 @@ An object with a `stop` method that can be called to stop listening to the event | Type Parameter | | ------ | -| `T` *extends* [`BackendEndpoints`](#backendendpoints) | +| `T` *extends* [`BackendEndpoints`](#backendendpoints) \| [`BackendSpec`](#backendspec) | | `E` *extends* [`BackendEvents`](#backendevents) | + +*** + +### BackendSpec + +> **BackendSpec** = `object` + +A specification for the backend plugin. + +#### Properties + +##### api + +> **api**: [`BackendEndpoints`](#backendendpoints) + +##### events + +> **events**: [`BackendEvents`](#backendevents) diff --git a/src/reference/sdks/frontend/command-palette.md b/src/reference/sdks/frontend/command-palette.md index 0d6f920..f9a24cb 100644 --- a/src/reference/sdks/frontend/command-palette.md +++ b/src/reference/sdks/frontend/command-palette.md @@ -52,8 +52,52 @@ Command palette view definition for custom UI content. ##### definition -> **definition**: [`ComponentDefinition`](utils.md#componentdefinition) +> **definition**: [`ComponentDefinition`](utils.md#componentdefinition)\<[`CommandPaletteViewProps`](#commandpaletteviewprops)\> ##### type > **type**: `"Custom"` + +*** + +### CommandPaletteViewProps + +> **CommandPaletteViewProps** = [`CommandPaletteViewPropsInternal`](#commandpaletteviewpropsinternal) & `object` + +The props for the command palette view. + +#### Type Declaration + +##### sdk + +> **sdk**: [`Caido`](index.md#caido) + +*** + +### CommandPaletteViewPropsInternal + +> **CommandPaletteViewPropsInternal** = `object` + +The internal props for the command palette view. + +#### Properties + +##### onBack() + +> **onBack**: () => `void` + +The function to call when the command palette is backed. + +###### Returns + +`void` + +##### onClose() + +> **onClose**: () => `void` + +The function to call when the command palette is closed. + +###### Returns + +`void` diff --git a/src/reference/sdks/frontend/filter.md b/src/reference/sdks/frontend/filter.md index 5d968a1..062f02c 100644 --- a/src/reference/sdks/frontend/filter.md +++ b/src/reference/sdks/frontend/filter.md @@ -2,16 +2,12 @@ ### FilterSlotContent -> **FilterSlotContent** = `object` +> **FilterSlotContent**\<`TProps`\> = \{ \[K in FilterSlot\]: ButtonSlotContent \| CustomSlotContent\ \| CommandSlotContent \} Content that can be added to filter slots. -#### Properties +#### Type Parameters -##### create-header - -> **create-header**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) - -##### update-header - -> **update-header**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) +| Type Parameter | Default type | +| ------ | ------ | +| `TProps` *extends* [`SlotContentPropsGroup`](slots.md#slotcontentpropsgroup) | [`SlotContentProps`](slots.md#slotcontentprops) | diff --git a/src/reference/sdks/frontend/findings.md b/src/reference/sdks/frontend/findings.md index 2cf77b3..f28b0c6 100644 --- a/src/reference/sdks/frontend/findings.md +++ b/src/reference/sdks/frontend/findings.md @@ -4,7 +4,7 @@ > **Finding** = `object` -Represents a [https://docs.caido.io/reference/features/logging/findings\|Finding](https://docs.caido.io/reference/features/logging/findings|Finding). +Represents a [https://docs.caido.io/app/quickstart/findings.html\|Finding](https://docs.caido.io/app/quickstart/findings.html|Finding). #### Properties @@ -90,7 +90,7 @@ Add an extension to the request editor. ##### addRequestViewMode() -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestReadableViewModeProps`](request.md#requestreadableviewmodeprops)\>) => `void` Add a custom request view mode. @@ -98,7 +98,7 @@ Add a custom request view mode. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestReadableViewModeProps`](request.md#requestreadableviewmodeprops)\> | The view mode options. | ###### Returns @@ -106,7 +106,7 @@ Add a custom request view mode. ##### addResponseViewMode() -> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)) => `void` +> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\>) => `void` Add a custom response view mode. @@ -114,7 +114,7 @@ Add a custom response view mode. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions) | The view mode options. | +| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\> | The view mode options. | ###### Returns diff --git a/src/reference/sdks/frontend/footer.md b/src/reference/sdks/frontend/footer.md index 9611381..abcb7dc 100644 --- a/src/reference/sdks/frontend/footer.md +++ b/src/reference/sdks/frontend/footer.md @@ -50,19 +50,15 @@ addToSlot(FooterSlot.FooterSlotSecondary, { ### FooterSlotContent -> **FooterSlotContent** = `object` +> **FooterSlotContent**\<`TProps`\> = \{ \[K in FooterSlot\]: ButtonSlotContent \| CustomSlotContent\ \| CommandSlotContent \} Content that can be added to footer slots. -#### Properties - -##### footer-primary - -> **footer-primary**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) - -##### footer-secondary +#### Type Parameters -> **footer-secondary**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) +| Type Parameter | Default type | +| ------ | ------ | +| `TProps` *extends* [`SlotContentPropsGroup`](slots.md#slotcontentpropsgroup) | [`SlotContentProps`](slots.md#slotcontentprops) | *** diff --git a/src/reference/sdks/frontend/http-history.md b/src/reference/sdks/frontend/http-history.md index 69ee21d..2f4866c 100644 --- a/src/reference/sdks/frontend/http-history.md +++ b/src/reference/sdks/frontend/http-history.md @@ -44,7 +44,7 @@ Add an extension to the request editor. ##### addRequestViewMode() -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestReadableViewModeProps`](request.md#requestreadableviewmodeprops)\>) => `void` Add a custom request view mode. @@ -52,7 +52,7 @@ Add a custom request view mode. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestReadableViewModeProps`](request.md#requestreadableviewmodeprops)\> | The view mode options. | ###### Returns @@ -76,7 +76,7 @@ Add an extension to the response editor. ##### addResponseViewMode() -> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)) => `void` +> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\>) => `void` Add a custom response view mode. @@ -84,7 +84,7 @@ Add a custom response view mode. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions) | The view mode options. | +| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\> | The view mode options. | ###### Returns @@ -92,7 +92,7 @@ Add a custom response view mode. ##### addToSlot -> **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`HTTPHistorySlotContent`](other.md#httphistoryslotcontent)\> +> **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`HTTPHistorySlotContent`](#httphistoryslotcontent)\> Add a component to a slot. @@ -202,6 +202,20 @@ Set the current scope. *** +### HTTPHistorySlotContent + +> **HTTPHistorySlotContent**\<`TProps`\> = \{ \[K in HTTPHistorySlot\]: ButtonSlotContent \| CustomSlotContent\ \| CommandSlotContent \} + +Content that can be added to HTTP history slots. + +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `TProps` *extends* [`SlotContentPropsGroup`](slots.md#slotcontentpropsgroup) | [`SlotContentProps`](slots.md#slotcontentprops) | + +*** + ### HTTPHistorySlot > `const` **HTTPHistorySlot**: `object` diff --git a/src/reference/sdks/frontend/index.md b/src/reference/sdks/frontend/index.md index 643d174..0b22739 100644 --- a/src/reference/sdks/frontend/index.md +++ b/src/reference/sdks/frontend/index.md @@ -15,7 +15,7 @@ Utilities for frontend plugins. | Type Parameter | Default type | | ------ | ------ | -| `T` *extends* [`BackendEndpoints`](backend.md#backendendpoints) | `Record`\<`string`, `never`\> | +| `T` *extends* [`BackendEndpoints`](backend.md#backendendpoints) \| [`BackendSpec`](backend.md#backendspec) | `Record`\<`string`, `never`\> | | `E` *extends* [`BackendEvents`](backend.md#backendevents) | `Record`\<`string`, `never`\> | #### Properties @@ -194,6 +194,12 @@ Utilities to interact with frontend-plugin storage. Utilities to create UI components. +##### websocket + +> **websocket**: [`WebsocketSDK`](websockets.md#websocketsdk) + +Utilities to interact with the Websocket page. + ##### window > **window**: [`WindowSDK`](window.md#windowsdk) diff --git a/src/reference/sdks/frontend/intercept.md b/src/reference/sdks/frontend/intercept.md index c3bf758..2a6f605 100644 --- a/src/reference/sdks/frontend/intercept.md +++ b/src/reference/sdks/frontend/intercept.md @@ -50,7 +50,7 @@ Utilities to interact with the Intercept page. ##### addRequestViewMode() -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestWritableViewModeProps`](request.md#requestwritableviewmodeprops)\>) => `void` Add a custom request view mode. @@ -58,7 +58,7 @@ Add a custom request view mode. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestWritableViewModeProps`](request.md#requestwritableviewmodeprops)\> | The view mode options. | ###### Returns @@ -66,7 +66,7 @@ Add a custom request view mode. ##### addResponseViewMode() -> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)) => `void` +> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\>) => `void` Add a custom response view mode. @@ -74,7 +74,7 @@ Add a custom response view mode. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions) | The view mode options. | +| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\> | The view mode options. | ###### Returns diff --git a/src/reference/sdks/frontend/match-and-replace.md b/src/reference/sdks/frontend/match-and-replace.md index f6bf36f..607e24b 100644 --- a/src/reference/sdks/frontend/match-and-replace.md +++ b/src/reference/sdks/frontend/match-and-replace.md @@ -496,6 +496,36 @@ An operation to update the response status code. *** +### MatchReplaceOperationWebsocket + +> **MatchReplaceOperationWebsocket** = [`KeepOperation`](other.md#keepoperation)\<[`MatchReplaceOperationWebsocketRaw`](#matchreplaceoperationwebsocketraw)\> + +An operation for the response websocket section. + +*** + +### MatchReplaceOperationWebsocketRaw + +> **MatchReplaceOperationWebsocketRaw** = `object` + +A raw operation for the response websocket section. + +#### Properties + +##### kind + +> **kind**: `"OperationWebsocketRaw"` + +##### matcher + +> **matcher**: [`MatchReplaceMatcherRaw`](#matchreplacematcherraw) + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + ### MatchReplacePageContext > **MatchReplacePageContext** = `object` @@ -712,10 +742,10 @@ Create a rule. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | \{ `collectionId`: [`ID`](utils.md#id); `name`: `string`; `query`: [`HTTPQL`](utils.md#httpql); `section`: [`MatchReplaceSection`](#matchreplacesection); `sources`: [`Source`](#source)[]; \} | The options for the rule. | +| `options` | \{ `collectionId`: [`ID`](utils.md#id); `name`: `string`; `query`: [`QueryInput`](utils.md#queryinput); `section`: [`MatchReplaceSection`](#matchreplacesection); `sources`: [`Source`](#source)[]; \} | The options for the rule. | | `options.collectionId` | [`ID`](utils.md#id) | The ID of the collection the rule belongs to. | | `options.name` | `string` | The name of the rule. | -| `options.query` | [`HTTPQL`](utils.md#httpql) | The HTTPQL query to match the rule against. | +| `options.query` | [`QueryInput`](utils.md#queryinput) | The query to match the rule against. | | `options.section` | [`MatchReplaceSection`](#matchreplacesection) | - | | `options.sources` | [`Source`](#source)[] | The sources the rule belongs to. | @@ -893,9 +923,9 @@ Update a rule. | Parameter | Type | Description | | ------ | ------ | ------ | | `id` | [`ID`](utils.md#id) | The ID of the rule. | -| `options` | \{ `name`: `string`; `query?`: [`HTTPQL`](utils.md#httpql); `section`: [`MatchReplaceSection`](#matchreplacesection); `sources`: [`Source`](#source)[]; \} | The new values for the rule. | +| `options` | \{ `name`: `string`; `query?`: [`QueryInput`](utils.md#queryinput); `section`: [`MatchReplaceSection`](#matchreplacesection); `sources`: [`Source`](#source)[]; \} | The new values for the rule. | | `options.name` | `string` | The new name of the rule. | -| `options.query?` | [`HTTPQL`](utils.md#httpql) | The new HTTPQL query of the rule. | +| `options.query?` | [`QueryInput`](utils.md#queryinput) | The new query of the rule. | | `options.section` | [`MatchReplaceSection`](#matchreplacesection) | The new section of the rule. | | `options.sources` | [`Source`](#source)[] | The new sources of the rule. | @@ -907,7 +937,7 @@ Update a rule. ### MatchReplaceSection -> **MatchReplaceSection** = [`MatchReplaceSectionRequestAll`](#matchreplacesectionrequestall) \| [`MatchReplaceSectionRequestBody`](#matchreplacesectionrequestbody) \| [`MatchReplaceSectionRequestFirstLine`](#matchreplacesectionrequestfirstline) \| [`MatchReplaceSectionRequestHeader`](#matchreplacesectionrequestheader) \| [`MatchReplaceSectionRequestMethod`](#matchreplacesectionrequestmethod) \| [`MatchReplaceSectionRequestPath`](#matchreplacesectionrequestpath) \| [`MatchReplaceSectionRequestQuery`](#matchreplacesectionrequestquery) \| [`MatchReplaceSectionRequestSNI`](#matchreplacesectionrequestsni) \| [`MatchReplaceSectionResponseAll`](#matchreplacesectionresponseall) \| [`MatchReplaceSectionResponseBody`](#matchreplacesectionresponsebody) \| [`MatchReplaceSectionResponseFirstLine`](#matchreplacesectionresponsefirstline) \| [`MatchReplaceSectionResponseHeader`](#matchreplacesectionresponseheader) \| [`MatchReplaceSectionResponseStatusCode`](#matchreplacesectionresponsestatuscode) +> **MatchReplaceSection** = [`MatchReplaceSectionRequestAll`](#matchreplacesectionrequestall) \| [`MatchReplaceSectionRequestBody`](#matchreplacesectionrequestbody) \| [`MatchReplaceSectionRequestFirstLine`](#matchreplacesectionrequestfirstline) \| [`MatchReplaceSectionRequestHeader`](#matchreplacesectionrequestheader) \| [`MatchReplaceSectionRequestMethod`](#matchreplacesectionrequestmethod) \| [`MatchReplaceSectionRequestPath`](#matchreplacesectionrequestpath) \| [`MatchReplaceSectionRequestQuery`](#matchreplacesectionrequestquery) \| [`MatchReplaceSectionRequestSNI`](#matchreplacesectionrequestsni) \| [`MatchReplaceSectionResponseAll`](#matchreplacesectionresponseall) \| [`MatchReplaceSectionResponseBody`](#matchreplacesectionresponsebody) \| [`MatchReplaceSectionResponseFirstLine`](#matchreplacesectionresponsefirstline) \| [`MatchReplaceSectionResponseHeader`](#matchreplacesectionresponseheader) \| [`MatchReplaceSectionResponseStatusCode`](#matchreplacesectionresponsestatuscode) \| [`MatchReplaceSectionResponseWebsocket`](#matchreplacesectionresponsewebsocket) \| [`MatchReplaceSectionRequestWebsocket`](#matchreplacesectionrequestwebsocket) A discriminated union of all possible match and replace sections. @@ -1057,6 +1087,24 @@ A section for the request SNI. *** +### MatchReplaceSectionRequestWebsocket + +> **MatchReplaceSectionRequestWebsocket** = `object` + +A section for the request websocket. + +#### Properties + +##### kind + +> **kind**: `"SectionRequestWebsocket"` + +##### operation + +> **operation**: [`MatchReplaceOperationWebsocket`](#matchreplaceoperationwebsocket) + +*** + ### MatchReplaceSectionResponseAll > **MatchReplaceSectionResponseAll** = `object` @@ -1147,21 +1195,35 @@ A section for the response status code. *** -### MatchReplaceSlotContent +### MatchReplaceSectionResponseWebsocket -> **MatchReplaceSlotContent** = `object` +> **MatchReplaceSectionResponseWebsocket** = `object` -Content that can be added to match and replace slots. +A section for the response websocket. #### Properties -##### create-header +##### kind + +> **kind**: `"SectionResponseWebsocket"` + +##### operation + +> **operation**: [`MatchReplaceOperationWebsocket`](#matchreplaceoperationwebsocket) -> **create-header**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) +*** + +### MatchReplaceSlotContent + +> **MatchReplaceSlotContent**\<`TProps`\> = \{ \[K in MatchReplaceSlot\]: ButtonSlotContent \| CustomSlotContent\ \| CommandSlotContent \} + +Content that can be added to match and replace slots. -##### update-header +#### Type Parameters -> **update-header**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) +| Type Parameter | Default type | +| ------ | ------ | +| `TProps` *extends* [`SlotContentPropsGroup`](slots.md#slotcontentpropsgroup) | [`SlotContentProps`](slots.md#slotcontentprops) | *** diff --git a/src/reference/sdks/frontend/other.md b/src/reference/sdks/frontend/other.md index c3db7ec..c203d1a 100644 --- a/src/reference/sdks/frontend/other.md +++ b/src/reference/sdks/frontend/other.md @@ -57,18 +57,6 @@ A unique command identifier. *** -### HTTPHistorySlotContent - -> **HTTPHistorySlotContent** = `object` - -#### Properties - -##### toolbar-primary - -> **toolbar-primary**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) - -*** - ### JSONPrimitive > **JSONPrimitive** = `string` \| `number` \| `boolean` \| `null` \| `undefined` @@ -111,23 +99,28 @@ A unique command identifier. *** -### ReplaySlotContent +### ResolvedAPI -> **ReplaySlotContent** = `object` +> **ResolvedAPI**\<`T`\> = `T` *extends* `object` ? `A` : `T` -#### Properties +#### Type Parameters -##### session-toolbar-primary +| Type Parameter | +| ------ | +| `T` | -> **session-toolbar-primary**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) +*** -##### session-toolbar-secondary +### ResolvedEvents -> **session-toolbar-secondary**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) +> **ResolvedEvents**\<`T`, `E`\> = `T` *extends* `object` ? `A` : `E` -##### topbar +#### Type Parameters -> **topbar**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) +| Type Parameter | +| ------ | +| `T` | +| `E` | *** @@ -143,40 +136,12 @@ A unique command identifier. *** -### ScopeSlotContent - -> **ScopeSlotContent** = `object` - -#### Properties - -##### create-header - -> **create-header**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) - -##### update-header - -> **update-header**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) - -*** - ### SearchSlot > **SearchSlot** = *typeof* [`SearchSlot`](search.md#searchslot)\[keyof *typeof* [`SearchSlot`](#searchslot-1)\] *** -### SearchSlotContent - -> **SearchSlotContent** = `object` - -#### Properties - -##### search-toolbar-primary - -> **search-toolbar-primary**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) - -*** - ### SettingsSlot > **SettingsSlot** = *typeof* [`SettingsSlot`](#settingsslot)\[keyof *typeof* [`SettingsSlot`](#settingsslot-1)\] diff --git a/src/reference/sdks/frontend/replay.md b/src/reference/sdks/frontend/replay.md index de72144..1cd7b97 100644 --- a/src/reference/sdks/frontend/replay.md +++ b/src/reference/sdks/frontend/replay.md @@ -1,5 +1,40 @@ # Replay +### ConnectionInfo + +> **ConnectionInfo** = `object` + +The connection information to use for the request. + +#### Properties + +##### host + +> **host**: `string` + +The host to use for the request. + +##### isTLS + +> **isTLS**: `boolean` + +Whether the request is TLS. + +##### port + +> **port**: `number` + +The port to use for the request. + +##### SNI? + +> `optional` **SNI**: `string` + +The SNI to use for the request. +If not provided, the SNI will be inferred from the host. + +*** + ### CurrentReplaySessionChangeEvent > **CurrentReplaySessionChangeEvent** = `object` @@ -149,7 +184,7 @@ Add an extension to the request editor. ##### addRequestViewMode() -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestWritableViewModeProps`](request.md#requestwritableviewmodeprops)\>) => `void` Add a custom view mode for requests. @@ -157,7 +192,7 @@ Add a custom view mode for requests. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestWritableViewModeProps`](request.md#requestwritableviewmodeprops)\> | The view mode options. | ###### Returns @@ -165,7 +200,7 @@ Add a custom view mode for requests. ##### addResponseViewMode() -> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)) => `void` +> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\>) => `void` Add a custom response view mode. @@ -173,7 +208,7 @@ Add a custom response view mode. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions) | The view mode options. | +| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\> | The view mode options. | ###### Returns @@ -213,7 +248,7 @@ indicator.remove(); ##### addToSlot -> **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`ReplaySlotContent`](other.md#replayslotcontent)\> +> **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`ReplaySlotContent`](#replayslotcontent)\> Add a component to a slot. @@ -611,7 +646,7 @@ sendRequest(sessionId, { ##### showEntry() -> **showEntry**: (`sessionId`: [`ID`](utils.md#id), `entryId`: [`ID`](utils.md#id), `options?`: `object`) => `Promise`\<`void`\> +> **showEntry**: (`sessionId`: [`ID`](utils.md#id), `entryId`: [`ID`](utils.md#id)) => `Promise`\<`void`\> Show a specific entry in a replay session. This will open the session tab if not already open, set it as the selected session, and display the specified entry. @@ -622,8 +657,6 @@ This will open the session tab if not already open, set it as the selected sessi | ------ | ------ | ------ | | `sessionId` | [`ID`](utils.md#id) | The ID of the session containing the entry. | | `entryId` | [`ID`](utils.md#id) | The ID of the entry to show. | -| `options?` | \{ `overwriteDraft?`: `boolean`; \} | The options for showing the entry. | -| `options.overwriteDraft?` | `boolean` | 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. | ###### Returns @@ -632,9 +665,7 @@ This will open the session tab if not already open, set it as the selected sessi ###### Example ```ts -await sdk.replay.showEntry(sessionId, entryId, { - overwriteDraft: true, -}); +await sdk.replay.showEntry(sessionId, entryId); ``` *** @@ -703,6 +734,20 @@ A unique replay session identifier. *** +### ReplaySlotContent + +> **ReplaySlotContent**\<`TProps`\> = \{ \[K in ReplaySlot\]: ButtonSlotContent \| CustomSlotContent\ \| CommandSlotContent \} + +Content that can be added to replay slots. + +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `TProps` *extends* [`SlotContentPropsGroup`](slots.md#slotcontentpropsgroup) | [`SlotContentProps`](slots.md#slotcontentprops) | + +*** + ### ReplayTab > **ReplayTab** = `object` @@ -721,7 +766,7 @@ The ID of the session associated with this tab. ### RequestSource -> **RequestSource** = \{ `connectionInfo`: [`SendRequestOptions`](#sendrequestoptions)\[`"connectionInfo"`\]; `raw`: `string`; `type`: `"Raw"`; \} \| \{ `id`: `string`; `type`: `"ID"`; \} +> **RequestSource** = \{ `connectionInfo`: [`ConnectionInfo`](#connectioninfo); `raw`: `string`; `type`: `"Raw"`; \} \| \{ `id`: `string`; `type`: `"ID"`; \} #### Remarks @@ -764,66 +809,6 @@ If true, the request will not update the UI. If false, the UI will be updated to display the session and the new request. Defaults to false. -##### connectionClose? - -> `optional` **connectionClose**: `boolean` - -Whether to force close the connection by setting Connection: close header. -Defaults to true. - -##### connectionInfo - -> **connectionInfo**: `object` - -The connection information to use for the request. - -###### host - -> **host**: `string` - -The host to use for the request. - -###### isTLS - -> **isTLS**: `boolean` - -Whether the request is TLS. - -###### port - -> **port**: `number` - -The port to use for the request. - -###### SNI? - -> `optional` **SNI**: `string` - -The SNI to use for the request. -If not provided, the SNI will be inferred from the host. - -##### overwriteDraft? - -> `optional` **overwriteDraft**: `boolean` - -Whether to overwrite the editor's draft content. -If true, draft content will be overwritten with the new request. -If false, the draft will be kept. -Defaults to true. - -##### raw - -> **raw**: `string` - -The raw request to send. - -##### updateContentLength? - -> `optional` **updateContentLength**: `boolean` - -Whether to update the content length automatically to match the body. -Defaults to true. - *** ### ReplaySlot diff --git a/src/reference/sdks/frontend/request.md b/src/reference/sdks/frontend/request.md index f198774..e994b39 100644 --- a/src/reference/sdks/frontend/request.md +++ b/src/reference/sdks/frontend/request.md @@ -24,12 +24,50 @@ Metadata about a request without the raw content. *** +### RequestReadableViewModeProps + +> **RequestReadableViewModeProps** = [`RequestReadableViewModePropsInternal`](#requestreadableviewmodepropsinternal) & `object` + +The props for the request read-only view mode. + +#### Type Declaration + +##### sdk + +> **sdk**: [`Caido`](index.md#caido) + +*** + +### RequestReadableViewModePropsInternal + +> **RequestReadableViewModePropsInternal** = `object` + +The internal props for the request read-only view mode. + +#### Properties + +##### request + +> **request**: [`RequestFull`](#requestfull) + +##### view + +> **view**: `EditorView` + +*** + ### RequestViewModeOptions -> **RequestViewModeOptions** = `object` +> **RequestViewModeOptions**\<`TProps`\> = `object` Options for defining a custom request view mode. +#### Type Parameters + +| Type Parameter | +| ------ | +| `TProps` *extends* [`RequestViewModeProps`](#requestviewmodeprops) | + #### Properties ##### label @@ -40,7 +78,7 @@ The label of the view mode. ##### view -> **view**: [`ComponentDefinition`](utils.md#componentdefinition) +> **view**: [`ComponentDefinition`](utils.md#componentdefinition)\<`TProps`\> The component to render when the view mode is selected. @@ -59,3 +97,47 @@ A function that determines if the view mode should be shown for a given request. ###### Returns `boolean` + +*** + +### RequestViewModeProps + +> **RequestViewModeProps** = [`RequestReadableViewModeProps`](#requestreadableviewmodeprops) \| [`RequestWritableViewModeProps`](#requestwritableviewmodeprops) \| [`RequestReadableViewModePropsInternal`](#requestreadableviewmodepropsinternal) \| [`RequestWritableViewModePropsInternal`](#requestwritableviewmodepropsinternal) + +The props group for the request view mode. + +*** + +### RequestWritableViewModeProps + +> **RequestWritableViewModeProps** = [`RequestWritableViewModePropsInternal`](#requestwritableviewmodepropsinternal) & `object` + +The props for the request writable view mode. + +#### Type Declaration + +##### sdk + +> **sdk**: [`Caido`](index.md#caido) + +*** + +### RequestWritableViewModePropsInternal + +> **RequestWritableViewModePropsInternal** = `object` + +The internal props for the request writable view mode. + +#### Properties + +##### draft + +> **draft**: [`RequestDraft`](#requestdraft) + +##### request + +> **request**: [`RequestFull`](#requestfull) \| `undefined` + +##### view + +> **view**: `EditorView` diff --git a/src/reference/sdks/frontend/response.md b/src/reference/sdks/frontend/response.md index 9bc0ef6..128d219 100644 --- a/src/reference/sdks/frontend/response.md +++ b/src/reference/sdks/frontend/response.md @@ -10,10 +10,16 @@ A complete response with all metadata and raw content. ### ResponseViewModeOptions -> **ResponseViewModeOptions** = `object` +> **ResponseViewModeOptions**\<`TProps`\> = `object` Options for defining a custom response view mode. +#### Type Parameters + +| Type Parameter | +| ------ | +| `TProps` *extends* [`ResponseViewModeProps`](#responseviewmodeprops) \| [`ResponseViewModePropsInternal`](#responseviewmodepropsinternal) | + #### Properties ##### label @@ -24,7 +30,7 @@ The label of the view mode. ##### view -> **view**: [`ComponentDefinition`](utils.md#componentdefinition) +> **view**: [`ComponentDefinition`](utils.md#componentdefinition)\<`TProps`\> The component to render when the view mode is selected. @@ -44,3 +50,35 @@ A function that determines if the view mode should be shown for a given response ###### Returns `boolean` + +*** + +### ResponseViewModeProps + +> **ResponseViewModeProps** = [`ResponseViewModePropsInternal`](#responseviewmodepropsinternal) & `object` + +The props for the response view mode. + +#### Type Declaration + +##### sdk + +> **sdk**: [`Caido`](index.md#caido) + +*** + +### ResponseViewModePropsInternal + +> **ResponseViewModePropsInternal** = `object` + +The internal props for the response view mode. + +#### Properties + +##### response + +> **response**: [`ResponseFull`](#responsefull) + +##### view + +> **view**: `EditorView` diff --git a/src/reference/sdks/frontend/scopes.md b/src/reference/sdks/frontend/scopes.md index cfcb5bd..00f03e3 100644 --- a/src/reference/sdks/frontend/scopes.md +++ b/src/reference/sdks/frontend/scopes.md @@ -68,6 +68,20 @@ Scope page context. *** +### ScopeSlotContent + +> **ScopeSlotContent**\<`TProps`\> = \{ \[K in ScopeSlot\]: ButtonSlotContent \| CustomSlotContent\ \| CommandSlotContent \} + +Content that can be added to scope slots. + +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `TProps` *extends* [`SlotContentPropsGroup`](slots.md#slotcontentpropsgroup) | [`SlotContentProps`](slots.md#slotcontentprops) | + +*** + ### ScopesSDK > **ScopesSDK** = `object` @@ -78,7 +92,7 @@ Utilities to interact with scopes ##### addToSlot -> **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`ScopeSlotContent`](other.md#scopeslotcontent)\> +> **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`ScopeSlotContent`](#scopeslotcontent)\> Add a component to a slot. diff --git a/src/reference/sdks/frontend/search.md b/src/reference/sdks/frontend/search.md index 81d0496..9db89ef 100644 --- a/src/reference/sdks/frontend/search.md +++ b/src/reference/sdks/frontend/search.md @@ -40,7 +40,7 @@ Add an extension to the request editor. ##### addRequestViewMode() -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestReadableViewModeProps`](request.md#requestreadableviewmodeprops)\>) => `void` Add a custom request view mode. @@ -48,7 +48,7 @@ Add a custom request view mode. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestReadableViewModeProps`](request.md#requestreadableviewmodeprops)\> | The view mode options. | ###### Returns @@ -56,7 +56,7 @@ Add a custom request view mode. ##### addResponseViewMode() -> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)) => `void` +> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\>) => `void` Add a custom response view mode. @@ -64,7 +64,7 @@ Add a custom response view mode. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions) | The view mode options. | +| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\> | The view mode options. | ###### Returns @@ -72,7 +72,7 @@ Add a custom response view mode. ##### addToSlot() -> **addToSlot**: \<`T`\>(`slot`: `T`, `content`: [`SearchSlotContent`](other.md#searchslotcontent)\[`T`\]) => `void` +> **addToSlot**: \<`T`\>(`slot`: `T`, `content`: [`SearchSlotContent`](#searchslotcontent)\[`T`\]) => `void` Add content to a slot in the Search UI. @@ -87,7 +87,7 @@ Add content to a slot in the Search UI. | Parameter | Type | Description | | ------ | ------ | ------ | | `slot` | `T` | The slot to add content to. | -| `content` | [`SearchSlotContent`](other.md#searchslotcontent)\[`T`\] | The content to add. | +| `content` | [`SearchSlotContent`](#searchslotcontent)\[`T`\] | The content to add. | ###### Returns @@ -167,6 +167,20 @@ Set the current scope. *** +### SearchSlotContent + +> **SearchSlotContent**\<`TProps`\> = \{ \[K in SearchSlot\]: ButtonSlotContent \| CustomSlotContent\ \| CommandSlotContent \} + +Content that can be added to search slots. + +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `TProps` *extends* [`SlotContentPropsGroup`](slots.md#slotcontentpropsgroup) | [`SlotContentProps`](slots.md#slotcontentprops) | + +*** + ### SearchSlot > `const` **SearchSlot**: `object` diff --git a/src/reference/sdks/frontend/sitemap.md b/src/reference/sdks/frontend/sitemap.md index 8e94a04..4e556b2 100644 --- a/src/reference/sdks/frontend/sitemap.md +++ b/src/reference/sdks/frontend/sitemap.md @@ -160,7 +160,7 @@ Add an extension to the request editor. ##### addRequestViewMode() -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestReadableViewModeProps`](request.md#requestreadableviewmodeprops)\>) => `void` Add a custom request view mode. @@ -168,7 +168,7 @@ Add a custom request view mode. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions)\<[`RequestReadableViewModeProps`](request.md#requestreadableviewmodeprops)\> | The view mode options. | ###### Returns @@ -176,7 +176,7 @@ Add a custom request view mode. ##### addResponseViewMode() -> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)) => `void` +> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\>) => `void` Add a custom response view mode. @@ -184,7 +184,7 @@ Add a custom response view mode. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions) | The view mode options. | +| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)\<[`ResponseViewModeProps`](response.md#responseviewmodeprops)\> | The view mode options. | ###### Returns diff --git a/src/reference/sdks/frontend/slots.md b/src/reference/sdks/frontend/slots.md index 2632206..42e58c4 100644 --- a/src/reference/sdks/frontend/slots.md +++ b/src/reference/sdks/frontend/slots.md @@ -18,10 +18,16 @@ Content for a command slot. ### CustomSlotContent -> **CustomSlotContent** = [`DefineSlotContent`](other.md#defineslotcontent)\<`"Custom"`, \{ `definition`: [`ComponentDefinition`](utils.md#componentdefinition); \}\> +> **CustomSlotContent**\<`TProps`\> = [`DefineSlotContent`](other.md#defineslotcontent)\<`"Custom"`, \{ `definition`: [`ComponentDefinition`](utils.md#componentdefinition)\<`TProps`\>; \}\> Content for a custom component slot. +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `TProps` *extends* [`SlotContentPropsGroup`](#slotcontentpropsgroup) | [`SlotContentProps`](#slotcontentprops) | + *** ### DefineAddToSlotFn() @@ -57,6 +63,42 @@ A function type for adding content to slots. ### SlotContent -> **SlotContent** = [`ButtonSlotContent`](#buttonslotcontent) \| [`CustomSlotContent`](#customslotcontent) \| [`CommandSlotContent`](#commandslotcontent) +> **SlotContent**\<`TProps`\> = [`ButtonSlotContent`](#buttonslotcontent) \| [`CustomSlotContent`](#customslotcontent)\<`TProps`\> \| [`CommandSlotContent`](#commandslotcontent) Union type of all possible slot content types. + +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `TProps` *extends* [`SlotContentPropsGroup`](#slotcontentpropsgroup) | [`SlotContentProps`](#slotcontentprops) | + +*** + +### SlotContentProps + +> **SlotContentProps** = [`SlotContentPropsInternal`](#slotcontentpropsinternal) & `object` + +The props for a slot content. + +#### Type Declaration + +##### sdk + +> **sdk**: [`Caido`](index.md#caido) + +*** + +### SlotContentPropsGroup + +> **SlotContentPropsGroup** = [`SlotContentProps`](#slotcontentprops) \| [`SlotContentPropsInternal`](#slotcontentpropsinternal) + +The props group for a slot content. + +*** + +### SlotContentPropsInternal + +> **SlotContentPropsInternal** = `object` + +The internal props for a slot content. diff --git a/src/reference/sdks/frontend/utils.md b/src/reference/sdks/frontend/utils.md index c28b555..4b8c34a 100644 --- a/src/reference/sdks/frontend/utils.md +++ b/src/reference/sdks/frontend/utils.md @@ -41,15 +41,21 @@ Utility type that adds a type discriminator to a type. ### ComponentDefinition -> **ComponentDefinition** = `object` +> **ComponentDefinition**\<`TProps`\> = `object` A custom component that will be rendered in the UI. +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `TProps` | [`ComponentProps`](#componentprops) | + #### Properties ##### component -> **component**: `VueComponent` +> **component**: `VueComponent`\<`TProps`\> ##### events? @@ -57,7 +63,35 @@ A custom component that will be rendered in the UI. ##### props? -> `optional` **props**: `Record`\<`string`, `unknown`\> +> `optional` **props**: [`ComponentProps`](#componentprops) + +*** + +### ComponentProps + +> **ComponentProps** = `Record`\<`string`, `unknown`\> + +A set of properties that can be passed to a component. + +*** + +### ComponentPropsWithSdk + +> **ComponentPropsWithSdk**\<`TProps`\> = `TProps` & `object` + +A set of properties that can be passed to a component definition with the SDK. + +#### Type Declaration + +##### sdk + +> **sdk**: [`Caido`](index.md#caido) + +#### Type Parameters + +| Type Parameter | +| ------ | +| `TProps` *extends* [`ComponentProps`](#componentprops) | *** @@ -181,6 +215,24 @@ Utility type for converting endpoint return types to promises. *** +### QueryInput + +> **QueryInput** = [`HTTPQL`](#httpql) \| [`StreamQL`](#streamql) + +A query input. + +#### Examples + +```ts +`"req.method.eq:'POST'"` +``` + +```ts +`"ws.raw.cont:'hello'"` +``` + +*** + ### Selection > **Selection**\<`TId`\> = \{ `kind`: `"Empty"`; \} \| \{ `kind`: `"Selected"`; `main`: `TId`; `secondary`: `TId`[]; \} @@ -193,3 +245,23 @@ Main represents the primary selected item, secondary represents additional selec | Type Parameter | | ------ | | `TId` | + +*** + +### StreamQL + +> **StreamQL** = `string` & `object` + +A STREAMQL expression. + +#### Type Declaration + +##### \_\_streamql? + +> `optional` **\_\_streamql**: `never` + +#### Example + +```ts +`ws.raw.cont:"hello"` +``` diff --git a/src/reference/sdks/frontend/websockets.md b/src/reference/sdks/frontend/websockets.md index 4f169fb..786113c 100644 --- a/src/reference/sdks/frontend/websockets.md +++ b/src/reference/sdks/frontend/websockets.md @@ -1,5 +1,83 @@ # Websockets +### MessageViewModeOptions + +> **MessageViewModeOptions**\<`TProps`\> = `object` + +Options for defining a custom message view mode. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `TProps` *extends* [`MessageViewModeProps`](#messageviewmodeprops) \| [`MessageViewModePropsInternal`](#messageviewmodepropsinternal) | + +#### Properties + +##### label + +> **label**: `string` + +The label of the view mode. + +##### view + +> **view**: [`ComponentDefinition`](utils.md#componentdefinition)\<`TProps`\> + +The component to render when the view mode is selected. + +##### when()? + +> `optional` **when**: (`message`: [`StreamWsMessageMeta`](#streamwsmessagemeta)) => `boolean` + +A function that determines if the view mode should be shown for a given message. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `message` | [`StreamWsMessageMeta`](#streamwsmessagemeta) | + +###### Returns + +`boolean` + +*** + +### MessageViewModeProps + +> **MessageViewModeProps** = [`ComponentPropsWithSdk`](utils.md#componentpropswithsdk)\<[`MessageViewModePropsInternal`](#messageviewmodepropsinternal)\> + +The props for the message view mode. + +*** + +### MessageViewModePropsInternal + +> **MessageViewModePropsInternal** = `object` + +The internal props for the message view mode. + +#### Properties + +##### message + +> **message**: [`StreamWsMessageMeta`](#streamwsmessagemeta) + +##### view + +> **view**: `EditorView` + +*** + +### StreamWsMessageMeta + +> **StreamWsMessageMeta** = [`Prettify`](utils.md#prettify)\<[`As`](utils.md#as)\<`"StreamWsMessageMeta"`\> & `object`\> + +A complete message with all metadata and raw content. + +*** + ### WebsocketPageContext > **WebsocketPageContext** = `object` @@ -11,3 +89,29 @@ Certificate page context. ##### kind > **kind**: `"Websocket"` + +*** + +### WebsocketSDK + +> **WebsocketSDK** = `object` + +Utilities to interact with websockets + +#### Properties + +##### addMessageViewMode() + +> **addMessageViewMode**: (`options`: [`MessageViewModeOptions`](#messageviewmodeoptions)\<[`MessageViewModeProps`](#messageviewmodeprops)\>) => `void` + +Add a custom message view mode. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | [`MessageViewModeOptions`](#messageviewmodeoptions)\<[`MessageViewModeProps`](#messageviewmodeprops)\> | The view mode options. | + +###### Returns + +`void` diff --git a/src/reference/sdks/frontend/window.md b/src/reference/sdks/frontend/window.md index 1df4c60..de48949 100644 --- a/src/reference/sdks/frontend/window.md +++ b/src/reference/sdks/frontend/window.md @@ -18,6 +18,14 @@ A dialog instance that can be closed programmatically. *** +### DialogComponent + +> **DialogComponent** = [`ComponentDefinition`](utils.md#componentdefinition)\<[`ComponentPropsWithSdk`](utils.md#componentpropswithsdk)\<[`ComponentProps`](utils.md#componentprops)\>\> + +The component definition for a dialog. + +*** + ### DialogOptions > **DialogOptions** = `object` @@ -126,7 +134,7 @@ An object with a `stop` method that can be called to stop listening to context c ##### showDialog() -> **showDialog**: (`component`: [`ComponentDefinition`](utils.md#componentdefinition), `options?`: [`DialogOptions`](#dialogoptions)) => [`Dialog`](#dialog) +> **showDialog**: (`component`: [`DialogComponent`](#dialogcomponent), `options?`: [`DialogOptions`](#dialogoptions)) => [`Dialog`](#dialog) Show a dialog component. @@ -134,7 +142,7 @@ Show a dialog component. | Parameter | Type | Description | | ------ | ------ | ------ | -| `component` | [`ComponentDefinition`](utils.md#componentdefinition) | The custom slot content to display in the dialog. | +| `component` | [`DialogComponent`](#dialogcomponent) | The custom slot content to display in the dialog. | | `options?` | [`DialogOptions`](#dialogoptions) | Options for the dialog. | ###### Returns