@caido/sdk-frontend 0.53.2-beta.3 → 0.53.2-beta.5
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 +4 -2
- package/src/types/sdks/filters.d.ts +30 -1
- package/src/types/sdks/httpHistory.d.ts +30 -0
- package/src/types/sdks/matchReplace.d.ts +30 -1
- package/src/types/sdks/replay.d.ts +33 -1
- package/src/types/sdks/scopes.d.ts +30 -1
- package/src/types/types/filter.d.ts +20 -0
- package/src/types/types/httpHistory.d.ts +15 -0
- package/src/types/types/matchReplace.d.ts +20 -0
- package/src/types/types/replay.d.ts +20 -0
- package/src/types/types/scopes.d.ts +20 -0
package/package.json
CHANGED
package/src/types/index.d.ts
CHANGED
|
@@ -4,13 +4,15 @@ export type { CommandContext, CommandContextRequest, CommandContextRequestRow, C
|
|
|
4
4
|
export type { MenuItem } from "./types/menu";
|
|
5
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
|
-
export type
|
|
7
|
+
export { FilterSlot, type Filter, type FilterSlotContent, } from "./types/filter";
|
|
8
8
|
export type { HTTPQL, ID, ComponentDefinition } from "./types/utils";
|
|
9
9
|
export type { JSONValue, JSONCompatible } from "./types/json";
|
|
10
10
|
export type { SlotContent, ButtonSlotContent, CustomSlotContent, CommandSlotContent, } from "./types/slots";
|
|
11
11
|
export type { RequestViewModeOptions, RequestFull, RequestDraft, RequestMeta, } from "./types/request";
|
|
12
12
|
export type { 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, } from "./types/matchReplace";
|
|
13
|
-
export type
|
|
13
|
+
export { MatchReplaceSlot, type MatchReplaceSlotContent, } from "./types/matchReplace";
|
|
14
|
+
export { ScopeSlot, type Scope, type ScopeSlotContent } from "./types/scopes";
|
|
15
|
+
export { HTTPHistorySlot, type HTTPHistorySlotContent, } from "./types/httpHistory";
|
|
14
16
|
export type { EnvironmentVariable } from "./types/environment";
|
|
15
17
|
export type { Workflow, WorkflowKind, OnCreatedWorkflowCallback, OnUpdatedWorkflowCallback, OnDeletedWorkflowCallback, } from "./types/workflows";
|
|
16
18
|
export type { ListenerHandle } from "./types/utils";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Filter } from "../types/filter";
|
|
1
|
+
import { type Filter, type FilterSlotContent } from "../types/filter";
|
|
2
|
+
import { type DefineAddToSlotFn } from "../types/slots";
|
|
2
3
|
import type { HTTPQL, ID } from "../types/utils";
|
|
3
4
|
/**
|
|
4
5
|
* SDK for interacting with the Filters page.
|
|
@@ -45,4 +46,32 @@ export type FiltersSDK = {
|
|
|
45
46
|
* @param id The ID of the filter to delete.
|
|
46
47
|
*/
|
|
47
48
|
delete: (id: ID) => Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Add a component to a slot.
|
|
51
|
+
* @param slot The slot to add the component to.
|
|
52
|
+
* @param content The content to add to the slot.
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* sdk.filters.addToSlot(FilterSlot.UpdateHeader, {
|
|
56
|
+
* type: "Button",
|
|
57
|
+
* label: "My Button",
|
|
58
|
+
* icon: "my-icon",
|
|
59
|
+
* onClick: () => {
|
|
60
|
+
* console.log("Button clicked");
|
|
61
|
+
* },
|
|
62
|
+
* });
|
|
63
|
+
*
|
|
64
|
+
* sdk.filters.addToSlot(FilterSlot.CreateHeader, {
|
|
65
|
+
* type: "Custom",
|
|
66
|
+
* definition: MyComponent,
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* sdk.filters.addToSlot(FilterSlot.UpdateHeader, {
|
|
70
|
+
* type: "Command",
|
|
71
|
+
* commandId: "my-command",
|
|
72
|
+
* icon: "my-icon",
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
addToSlot: DefineAddToSlotFn<FilterSlotContent>;
|
|
48
77
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Extension } from "@codemirror/state";
|
|
2
|
+
import type { HTTPHistorySlotContent } from "../types/httpHistory";
|
|
2
3
|
import type { RequestViewModeOptions } from "../types/request";
|
|
4
|
+
import { type DefineAddToSlotFn } from "../types/slots";
|
|
3
5
|
import type { HTTPQL, ID } from "../types/utils";
|
|
4
6
|
/**
|
|
5
7
|
* Utilities to interact with the HTTP History page.
|
|
@@ -46,4 +48,32 @@ export type HTTPHistorySDK = {
|
|
|
46
48
|
* @param id The ID of the entry to scroll to.
|
|
47
49
|
*/
|
|
48
50
|
scrollTo: (id: ID) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Add a component to a slot.
|
|
53
|
+
* @param slot The slot to add the component to.
|
|
54
|
+
* @param content The content to add to the slot.
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* sdk.httpHistory.addToSlot(HTTPHistorySlot.ToolbarPrimary, {
|
|
58
|
+
* type: "Button",
|
|
59
|
+
* label: "My Button",
|
|
60
|
+
* icon: "my-icon",
|
|
61
|
+
* onClick: () => {
|
|
62
|
+
* console.log("Button clicked");
|
|
63
|
+
* },
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* sdk.httpHistory.addToSlot(HTTPHistorySlot.ToolbarPrimary, {
|
|
67
|
+
* type: "Custom",
|
|
68
|
+
* definition: MyComponent,
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* sdk.httpHistory.addToSlot(HTTPHistorySlot.ToolbarPrimary, {
|
|
72
|
+
* type: "Command",
|
|
73
|
+
* commandId: "my-command",
|
|
74
|
+
* icon: "my-icon",
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
addToSlot: DefineAddToSlotFn<HTTPHistorySlotContent>;
|
|
49
79
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type MatchReplaceCollection, type MatchReplaceRule, type MatchReplaceSection, type Source } from "../types/matchReplace";
|
|
1
|
+
import { type MatchReplaceCollection, type MatchReplaceRule, type MatchReplaceSection, type MatchReplaceSlotContent, type Source } from "../types/matchReplace";
|
|
2
|
+
import { type DefineAddToSlotFn } from "../types/slots";
|
|
2
3
|
import type { HTTPQL, ID } from "../types/utils";
|
|
3
4
|
/**
|
|
4
5
|
* Utilities to interact with the Match and Replace page.
|
|
@@ -88,4 +89,32 @@ export type MatchReplaceSDK = {
|
|
|
88
89
|
* @param id - The ID of the rule.
|
|
89
90
|
*/
|
|
90
91
|
deleteRule: (id: ID) => Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Add a component to a slot.
|
|
94
|
+
* @param slot The slot to add the component to.
|
|
95
|
+
* @param content The content to add to the slot.
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* sdk.matchReplace.addToSlot(MatchReplaceSlot.UpdateHeader, {
|
|
99
|
+
* type: "Button",
|
|
100
|
+
* label: "My Button",
|
|
101
|
+
* icon: "my-icon",
|
|
102
|
+
* onClick: () => {
|
|
103
|
+
* console.log("Button clicked");
|
|
104
|
+
* },
|
|
105
|
+
* });
|
|
106
|
+
*
|
|
107
|
+
* sdk.matchReplace.addToSlot(MatchReplaceSlot.CreateHeader, {
|
|
108
|
+
* type: "Custom",
|
|
109
|
+
* definition: MyComponent,
|
|
110
|
+
* });
|
|
111
|
+
*
|
|
112
|
+
* sdk.matchReplace.addToSlot(MatchReplaceSlot.UpdateHeader, {
|
|
113
|
+
* type: "Command",
|
|
114
|
+
* commandId: "my-command",
|
|
115
|
+
* icon: "my-icon",
|
|
116
|
+
* });
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
addToSlot: DefineAddToSlotFn<MatchReplaceSlotContent>;
|
|
91
120
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Extension } from "@codemirror/state";
|
|
2
|
-
import { type CurrentReplaySessionChangeEvent, type OpenTabOptions, type ReplayCollection, type ReplayEntry, type ReplaySession, type ReplaySlotContent, type ReplayTab, type RequestSource, type SendRequestOptions } from "../types/replay";
|
|
2
|
+
import { 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";
|
|
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";
|
|
@@ -192,4 +192,36 @@ export type ReplaySDK = {
|
|
|
192
192
|
* ```
|
|
193
193
|
*/
|
|
194
194
|
onCurrentSessionChange: (callback: (event: CurrentReplaySessionChangeEvent) => void) => ListenerHandle;
|
|
195
|
+
/**
|
|
196
|
+
* Subscribe to replay session creation events.
|
|
197
|
+
* @param callback The callback to call when a session is created.
|
|
198
|
+
* @returns An object with a `stop` method that can be called to stop listening to session creation events.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```ts
|
|
202
|
+
* const handler = sdk.replay.onSessionCreate((event) => {
|
|
203
|
+
* console.log(`Session ${event.session.id} was created!`);
|
|
204
|
+
* });
|
|
205
|
+
*
|
|
206
|
+
* // Later, stop listening
|
|
207
|
+
* handler.stop();
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
onSessionCreate: (callback: (event: ReplaySessionCreatedEvent) => void) => ListenerHandle;
|
|
211
|
+
/**
|
|
212
|
+
* Subscribe to replay collection creation events.
|
|
213
|
+
* @param callback The callback to call when a collection is created.
|
|
214
|
+
* @returns An object with a `stop` method that can be called to stop listening to collection creation events.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```ts
|
|
218
|
+
* const handler = sdk.replay.onCollectionCreate((event) => {
|
|
219
|
+
* console.log(`Collection ${event.collection.id} was created!`);
|
|
220
|
+
* });
|
|
221
|
+
*
|
|
222
|
+
* // Later, stop listening
|
|
223
|
+
* handler.stop();
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
onCollectionCreate: (callback: (event: ReplayCollectionCreatedEvent) => void) => ListenerHandle;
|
|
195
227
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Scope } from "../types/scopes";
|
|
1
|
+
import { type Scope, type ScopeSlotContent } from "../types/scopes";
|
|
2
|
+
import { type DefineAddToSlotFn } from "../types/slots";
|
|
2
3
|
import type { ID } from "../types/utils";
|
|
3
4
|
/**
|
|
4
5
|
* Utilities to interact with scopes
|
|
@@ -52,4 +53,32 @@ export type ScopesSDK = {
|
|
|
52
53
|
* @returns Whether the scope was deleted.
|
|
53
54
|
*/
|
|
54
55
|
deleteScope: (id: ID) => Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Add a component to a slot.
|
|
58
|
+
* @param slot The slot to add the component to.
|
|
59
|
+
* @param content The content to add to the slot.
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* sdk.scopes.addToSlot(ScopeSlot.UpdateHeader, {
|
|
63
|
+
* type: "Button",
|
|
64
|
+
* label: "My Button",
|
|
65
|
+
* icon: "my-icon",
|
|
66
|
+
* onClick: () => {
|
|
67
|
+
* console.log("Button clicked");
|
|
68
|
+
* },
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* sdk.scopes.addToSlot(ScopeSlot.CreateHeader, {
|
|
72
|
+
* type: "Custom",
|
|
73
|
+
* definition: MyComponent,
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* sdk.scopes.addToSlot(ScopeSlot.UpdateHeader, {
|
|
77
|
+
* type: "Command",
|
|
78
|
+
* commandId: "my-command",
|
|
79
|
+
* icon: "my-icon",
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
addToSlot: DefineAddToSlotFn<ScopeSlotContent>;
|
|
55
84
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent } from "./slots";
|
|
1
2
|
import { type HTTPQL, type ID } from "./utils";
|
|
2
3
|
/**
|
|
3
4
|
* Represents a filter.
|
|
@@ -22,3 +23,22 @@ export type Filter = {
|
|
|
22
23
|
*/
|
|
23
24
|
query: HTTPQL;
|
|
24
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* The slots in the Filters UI.
|
|
28
|
+
* @category Filters
|
|
29
|
+
*/
|
|
30
|
+
export declare const FilterSlot: {
|
|
31
|
+
/**
|
|
32
|
+
* The header area of the preset form update component.
|
|
33
|
+
*/
|
|
34
|
+
readonly UpdateHeader: "update-header";
|
|
35
|
+
/**
|
|
36
|
+
* The header area of the preset form create component.
|
|
37
|
+
*/
|
|
38
|
+
readonly CreateHeader: "create-header";
|
|
39
|
+
};
|
|
40
|
+
export type FilterSlot = (typeof FilterSlot)[keyof typeof FilterSlot];
|
|
41
|
+
export type FilterSlotContent = {
|
|
42
|
+
[FilterSlot.UpdateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
43
|
+
[FilterSlot.CreateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
44
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent } from "./slots";
|
|
2
|
+
/**
|
|
3
|
+
* The slots in the HTTP History UI.
|
|
4
|
+
* @category HTTP History
|
|
5
|
+
*/
|
|
6
|
+
export declare const HTTPHistorySlot: {
|
|
7
|
+
/**
|
|
8
|
+
* The toolbar.
|
|
9
|
+
*/
|
|
10
|
+
readonly ToolbarPrimary: "toolbar-primary";
|
|
11
|
+
};
|
|
12
|
+
export type HTTPHistorySlot = (typeof HTTPHistorySlot)[keyof typeof HTTPHistorySlot];
|
|
13
|
+
export type HTTPHistorySlotContent = {
|
|
14
|
+
[HTTPHistorySlot.ToolbarPrimary]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
15
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent } from "./slots";
|
|
1
2
|
import { type HTTPQL, type ID } from "./utils";
|
|
2
3
|
/**
|
|
3
4
|
* A rule in Match and Replace.
|
|
@@ -270,4 +271,23 @@ export type MatchReplaceCollection = {
|
|
|
270
271
|
type KeepOperation<T> = T & {
|
|
271
272
|
__operation?: never;
|
|
272
273
|
};
|
|
274
|
+
/**
|
|
275
|
+
* The slots in the Match and Replace UI.
|
|
276
|
+
* @category Match and Replace
|
|
277
|
+
*/
|
|
278
|
+
export declare const MatchReplaceSlot: {
|
|
279
|
+
/**
|
|
280
|
+
* The header area of the rule form update component.
|
|
281
|
+
*/
|
|
282
|
+
readonly UpdateHeader: "update-header";
|
|
283
|
+
/**
|
|
284
|
+
* The header area of the rule form create component.
|
|
285
|
+
*/
|
|
286
|
+
readonly CreateHeader: "create-header";
|
|
287
|
+
};
|
|
288
|
+
export type MatchReplaceSlot = (typeof MatchReplaceSlot)[keyof typeof MatchReplaceSlot];
|
|
289
|
+
export type MatchReplaceSlotContent = {
|
|
290
|
+
[MatchReplaceSlot.UpdateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
291
|
+
[MatchReplaceSlot.CreateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
292
|
+
};
|
|
273
293
|
export {};
|
|
@@ -198,3 +198,23 @@ export type CurrentReplaySessionChangeEvent = {
|
|
|
198
198
|
*/
|
|
199
199
|
sessionId: ID | undefined;
|
|
200
200
|
};
|
|
201
|
+
/**
|
|
202
|
+
* Event fired when a replay session is created.
|
|
203
|
+
* @category Replay
|
|
204
|
+
*/
|
|
205
|
+
export type ReplaySessionCreatedEvent = {
|
|
206
|
+
/**
|
|
207
|
+
* The newly created replay session.
|
|
208
|
+
*/
|
|
209
|
+
session: ReplaySession;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Event fired when a replay collection is created.
|
|
213
|
+
* @category Replay
|
|
214
|
+
*/
|
|
215
|
+
export type ReplayCollectionCreatedEvent = {
|
|
216
|
+
/**
|
|
217
|
+
* The newly created replay collection.
|
|
218
|
+
*/
|
|
219
|
+
collection: ReplayCollection;
|
|
220
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent } from "./slots";
|
|
1
2
|
import { type ID } from "./utils";
|
|
2
3
|
/**
|
|
3
4
|
* Represents a scope.
|
|
@@ -21,3 +22,22 @@ export type Scope = {
|
|
|
21
22
|
*/
|
|
22
23
|
denylist: string[];
|
|
23
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* The slots in the Scopes UI.
|
|
27
|
+
* @category Scopes
|
|
28
|
+
*/
|
|
29
|
+
export declare const ScopeSlot: {
|
|
30
|
+
/**
|
|
31
|
+
* The header area of the preset form update component, to the left of the ScopeTooltip.
|
|
32
|
+
*/
|
|
33
|
+
readonly UpdateHeader: "update-header";
|
|
34
|
+
/**
|
|
35
|
+
* The header area of the preset form create component, to the left of the ScopeTooltip.
|
|
36
|
+
*/
|
|
37
|
+
readonly CreateHeader: "create-header";
|
|
38
|
+
};
|
|
39
|
+
export type ScopeSlot = (typeof ScopeSlot)[keyof typeof ScopeSlot];
|
|
40
|
+
export type ScopeSlotContent = {
|
|
41
|
+
[ScopeSlot.UpdateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
42
|
+
[ScopeSlot.CreateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
43
|
+
};
|