@caido/sdk-frontend 0.58.3-beta.3 → 0.58.3-beta.4
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 +1 -1
- package/src/types/index.d.ts +1 -1
- package/src/types/sdks/filters.d.ts +1 -0
- package/src/types/sdks/footer.d.ts +1 -0
- package/src/types/sdks/httpHistory.d.ts +1 -0
- package/src/types/sdks/matchReplace.d.ts +1 -0
- package/src/types/sdks/replay.d.ts +14 -12
- package/src/types/sdks/scopes.d.ts +1 -0
- package/src/types/sdks/search.d.ts +3 -1
- package/src/types/sdks/settings.d.ts +1 -0
- package/src/types/types/slots.d.ts +11 -1
package/package.json
CHANGED
package/src/types/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export { FilterSlot, type Filter, type FilterSlotContent, type CurrentFilterChan
|
|
|
16
16
|
export type { HTTPQL, StreamQL, ID, ComponentDefinition, Selection, QueryInput, } from "./types/utils";
|
|
17
17
|
export type { JSONValue, JSONCompatible } from "./types/json";
|
|
18
18
|
export type { KVValue, KVEvents } from "./types/kv";
|
|
19
|
-
export type { SlotContent, ButtonSlotContent, CustomSlotContent, CommandSlotContent, SlotContentPropsInternal, SlotContentProps, } from "./types/slots";
|
|
19
|
+
export type { SlotContent, ButtonSlotContent, CustomSlotContent, CommandSlotContent, SlotContentPropsInternal, SlotContentProps, SlotHandle, } from "./types/slots";
|
|
20
20
|
export type { RequestViewModeOptions, RequestWritableViewModeProps, RequestReadableViewModeProps, RequestReadableViewModePropsInternal, RequestWritableViewModePropsInternal, RequestViewModeProps, RequestFull, RequestDraft, RequestMeta, } from "./types/request";
|
|
21
21
|
export type { ResponseViewModePropsInternal, ResponseViewModeOptions, ResponseViewModeProps, ResponseFull, } from "./types/response";
|
|
22
22
|
export type { CurrentMatchReplaceRuleChangeEvent, MatchReplaceRule, MatchReplaceCollection, MatchReplaceSection, MatchReplaceSectionRequestAll, MatchReplaceSectionRequestBody, MatchReplaceSectionRequestFirstLine, MatchReplaceSectionRequestHeader, MatchReplaceSectionRequestMethod, MatchReplaceSectionRequestPath, MatchReplaceSectionRequestQuery, MatchReplaceSectionRequestSNI, MatchReplaceSectionResponseAll, MatchReplaceSectionResponseBody, MatchReplaceSectionResponseFirstLine, MatchReplaceSectionResponseHeader, MatchReplaceSectionResponseStatusCode, MatchReplaceOperationStatusCode, MatchReplaceOperationStatusCodeUpdate, MatchReplaceOperationQuery, MatchReplaceOperationQueryRaw, MatchReplaceOperationQueryAdd, MatchReplaceOperationQueryRemove, MatchReplaceOperationQueryUpdate, MatchReplaceOperationPath, MatchReplaceOperationPathRaw, MatchReplaceOperationAll, MatchReplaceOperationAllRaw, MatchReplaceOperationMethod, MatchReplaceOperationMethodUpdate, MatchReplaceOperationHeader, MatchReplaceOperationHeaderRaw, MatchReplaceOperationHeaderAdd, MatchReplaceOperationHeaderRemove, MatchReplaceOperationHeaderUpdate, MatchReplaceOperationBody, MatchReplaceOperationBodyRaw, MatchReplaceOperationFirstLine, MatchReplaceOperationFirstLineRaw, MatchReplaceOperationSNI, MatchReplaceOperationSNIRaw, MatchReplaceReplacer, MatchReplaceReplacerTerm, MatchReplaceReplacerWorkflow, MatchReplaceMatcherName, MatchReplaceMatcherRaw, MatchReplaceMatcherRawFull, MatchReplaceMatcherRawRegex, MatchReplaceMatcherRawValue, MatchReplaceSectionResponseWebsocket, MatchReplaceSectionRequestWebsocket, MatchReplaceOperationWebsocket, MatchReplaceOperationWebsocketRaw, } from "./types/matchReplace";
|
|
@@ -71,6 +71,7 @@ export type FiltersSDK = {
|
|
|
71
71
|
* Add a component to a slot.
|
|
72
72
|
* @param slot The slot to add the component to.
|
|
73
73
|
* @param content The content to add to the slot.
|
|
74
|
+
* @returns A handle object with a `remove` method to remove the content from the slot.
|
|
74
75
|
* @example
|
|
75
76
|
* ```ts
|
|
76
77
|
* sdk.filters.addToSlot(FilterSlot.UpdateHeader, {
|
|
@@ -9,6 +9,7 @@ export type FooterSDK = {
|
|
|
9
9
|
* Add a component to a slot.
|
|
10
10
|
* @param slot The slot to add the component to.
|
|
11
11
|
* @param content The content to add to the slot.
|
|
12
|
+
* @returns A handle object with a `remove` method to remove the content from the slot.
|
|
12
13
|
* @example
|
|
13
14
|
* ```ts
|
|
14
15
|
* addToSlot(FooterSlot.FooterSlotPrimary, {
|
|
@@ -68,6 +68,7 @@ export type HTTPHistorySDK = {
|
|
|
68
68
|
* Add a component to a slot.
|
|
69
69
|
* @param slot The slot to add the component to.
|
|
70
70
|
* @param content The content to add to the slot.
|
|
71
|
+
* @returns A handle object with a `remove` method to remove the content from the slot.
|
|
71
72
|
* @example
|
|
72
73
|
* ```ts
|
|
73
74
|
* sdk.httpHistory.addToSlot(HTTPHistorySlot.ToolbarPrimary, {
|
|
@@ -114,6 +114,7 @@ export type MatchReplaceSDK = {
|
|
|
114
114
|
* Add a component to a slot.
|
|
115
115
|
* @param slot The slot to add the component to.
|
|
116
116
|
* @param content The content to add to the slot.
|
|
117
|
+
* @returns A handle object with a `remove` method to remove the content from the slot.
|
|
117
118
|
* @example
|
|
118
119
|
* ```ts
|
|
119
120
|
* sdk.matchReplace.addToSlot(MatchReplaceSlot.UpdateHeader, {
|
|
@@ -142,27 +142,29 @@ export type ReplaySDK = {
|
|
|
142
142
|
* Add a component to a slot.
|
|
143
143
|
* @param slot The slot to add the component to.
|
|
144
144
|
* @param content The content to add to the slot.
|
|
145
|
+
* @returns A handle object with a `remove` method to remove the content from the slot.
|
|
145
146
|
* @example
|
|
146
147
|
* ```ts
|
|
147
|
-
* addToSlot(ReplaySlot.SessionToolbarPrimary, {
|
|
148
|
-
*
|
|
148
|
+
* const command = sdk.replay.addToSlot(ReplaySlot.SessionToolbarPrimary, {
|
|
149
|
+
* type: "Command",
|
|
149
150
|
* commandId: "my-command",
|
|
150
151
|
* icon: "my-icon",
|
|
151
152
|
* });
|
|
152
153
|
*
|
|
153
|
-
* addToSlot(ReplaySlot.SessionToolbarSecondary, {
|
|
154
|
-
*
|
|
155
|
-
*
|
|
154
|
+
* const custom = sdk.replay.addToSlot(ReplaySlot.SessionToolbarSecondary, {
|
|
155
|
+
* type: "Custom",
|
|
156
|
+
* definition: MyComponent,
|
|
156
157
|
* });
|
|
157
158
|
*
|
|
158
|
-
* addToSlot(ReplaySlot.Topbar, {
|
|
159
|
-
*
|
|
160
|
-
* label: "
|
|
161
|
-
* icon: "
|
|
162
|
-
* onClick: () => {
|
|
163
|
-
* console.log("Button clicked");
|
|
164
|
-
* },
|
|
159
|
+
* const button = sdk.replay.addToSlot(ReplaySlot.Topbar, {
|
|
160
|
+
* type: "Button",
|
|
161
|
+
* label: "Hello",
|
|
162
|
+
* icon: "fas fa-user",
|
|
163
|
+
* onClick: () => {},
|
|
165
164
|
* });
|
|
165
|
+
*
|
|
166
|
+
* // Later, remove the content
|
|
167
|
+
* button.remove();
|
|
166
168
|
* ```
|
|
167
169
|
*/
|
|
168
170
|
addToSlot: DefineAddToSlotFn<ReplaySlotContent>;
|
|
@@ -78,6 +78,7 @@ export type ScopesSDK = {
|
|
|
78
78
|
* Add a component to a slot.
|
|
79
79
|
* @param slot The slot to add the component to.
|
|
80
80
|
* @param content The content to add to the slot.
|
|
81
|
+
* @returns A handle object with a `remove` method to remove the content from the slot.
|
|
81
82
|
* @example
|
|
82
83
|
* ```ts
|
|
83
84
|
* sdk.scopes.addToSlot(ScopeSlot.UpdateHeader, {
|
|
@@ -2,6 +2,7 @@ import type { Extension } from "@codemirror/state";
|
|
|
2
2
|
import type { RequestFull, RequestReadableViewModeProps, RequestViewModeOptions } from "../types/request";
|
|
3
3
|
import type { ResponseFull, ResponseViewModeOptions, ResponseViewModeProps } from "../types/response";
|
|
4
4
|
import type { SearchSlot, SearchSlotContent } from "../types/search";
|
|
5
|
+
import type { SlotHandle } from "../types/slots";
|
|
5
6
|
import type { HTTPQL, ID } from "../types/utils";
|
|
6
7
|
/**
|
|
7
8
|
* Utilities to interact with the Search page.
|
|
@@ -62,6 +63,7 @@ export type SearchSDK = {
|
|
|
62
63
|
* Add content to a slot in the Search UI.
|
|
63
64
|
* @param slot The slot to add content to.
|
|
64
65
|
* @param content The content to add.
|
|
66
|
+
* @returns A handle object with a `remove` method to remove the content from the slot.
|
|
65
67
|
*/
|
|
66
|
-
addToSlot: <T extends SearchSlot>(slot: T, content: SearchSlotContent[T]) =>
|
|
68
|
+
addToSlot: <T extends SearchSlot>(slot: T, content: SearchSlotContent[T]) => SlotHandle;
|
|
67
69
|
};
|
|
@@ -9,6 +9,7 @@ export type SettingsSDK = {
|
|
|
9
9
|
* Add a component to a slot.
|
|
10
10
|
* @param slot The slot to add the component to.
|
|
11
11
|
* @param content The content to add to the slot.
|
|
12
|
+
* @returns A handle object with a `remove` method to remove the content from the slot.
|
|
12
13
|
* @example
|
|
13
14
|
* ```ts
|
|
14
15
|
* sdk.settings.addToSlot(SettingsSlot.PluginsSection, {
|
|
@@ -50,11 +50,21 @@ export type CommandSlotContent = DefineSlotContent<"Command", {
|
|
|
50
50
|
* @category Slots
|
|
51
51
|
*/
|
|
52
52
|
export type SlotContent<TProps extends SlotContentPropsGroup = SlotContentProps> = ButtonSlotContent | CustomSlotContent<TProps> | CommandSlotContent;
|
|
53
|
+
/**
|
|
54
|
+
* A handle for slot content added through the SDK.
|
|
55
|
+
* @category Slots
|
|
56
|
+
*/
|
|
57
|
+
export type SlotHandle = {
|
|
58
|
+
/**
|
|
59
|
+
* Remove the content from the slot.
|
|
60
|
+
*/
|
|
61
|
+
remove: () => void;
|
|
62
|
+
};
|
|
53
63
|
/**
|
|
54
64
|
* A function type for adding content to slots.
|
|
55
65
|
* @category Slots
|
|
56
66
|
*/
|
|
57
67
|
export type DefineAddToSlotFn<TMap extends Record<string, DefineSlotContent<string, Record<string, unknown>>>> = {
|
|
58
|
-
<K extends keyof TMap>(slot: K, spec: TMap[K]):
|
|
68
|
+
<K extends keyof TMap>(slot: K, spec: TMap[K]): SlotHandle;
|
|
59
69
|
};
|
|
60
70
|
export {};
|