@caido/sdk-frontend 0.53.2-beta.7 → 0.53.2-beta.8
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 +2 -2
- package/src/types/types/ai.d.ts +8 -0
- package/src/types/types/editor.d.ts +9 -0
- package/src/types/types/environment.d.ts +4 -0
- package/src/types/types/filter.d.ts +4 -0
- package/src/types/types/footer.d.ts +8 -0
- package/src/types/types/json.d.ts +8 -0
- package/src/types/types/matchReplace.d.ts +132 -0
- package/src/types/types/navigation.d.ts +8 -0
- package/src/types/types/request.d.ts +16 -0
- package/src/types/types/slots.d.ts +20 -0
- package/src/types/types/utils.d.ts +17 -1
- package/src/types/types/window.d.ts +8 -0
- package/src/types/types/workflows.d.ts +12 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caido/sdk-frontend",
|
|
3
|
-
"version": "0.53.2-beta.
|
|
3
|
+
"version": "0.53.2-beta.8",
|
|
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/",
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
},
|
|
20
20
|
"peerDependenciesMeta": {},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"
|
|
22
|
+
"generate:doc": "typedoc"
|
|
23
23
|
}
|
|
24
24
|
}
|
package/src/types/types/ai.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { type LanguageModelV2, type ProviderV2 } from "@ai-sdk/provider";
|
|
2
|
+
/**
|
|
3
|
+
* Settings for AI reasoning.
|
|
4
|
+
* @category AI
|
|
5
|
+
*/
|
|
2
6
|
export type AIReasoningSettings = {
|
|
3
7
|
effort: "low" | "medium" | "high";
|
|
4
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Settings for AI language model.
|
|
11
|
+
* @category AI
|
|
12
|
+
*/
|
|
5
13
|
export type AILanguageModelSettings = {
|
|
6
14
|
reasoning?: AIReasoningSettings;
|
|
7
15
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { EditorView } from "@codemirror/view";
|
|
2
2
|
/**
|
|
3
3
|
* Generic editor interface.
|
|
4
|
+
* @category Editor
|
|
4
5
|
*/
|
|
5
6
|
export type Editor = {
|
|
6
7
|
/**
|
|
@@ -27,6 +28,10 @@ export type Editor = {
|
|
|
27
28
|
*/
|
|
28
29
|
getEditorView: () => EditorView;
|
|
29
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* An HTTP request editor interface.
|
|
33
|
+
* @category Editor
|
|
34
|
+
*/
|
|
30
35
|
export type HTTPRequestEditor = {
|
|
31
36
|
/**
|
|
32
37
|
* Get the editor element.
|
|
@@ -40,6 +45,10 @@ export type HTTPRequestEditor = {
|
|
|
40
45
|
*/
|
|
41
46
|
getEditorView: () => EditorView;
|
|
42
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* An HTTP response editor interface.
|
|
50
|
+
* @category Editor
|
|
51
|
+
*/
|
|
43
52
|
export type HTTPResponseEditor = {
|
|
44
53
|
/**
|
|
45
54
|
* Get the editor element.
|
|
@@ -38,6 +38,10 @@ export declare const FilterSlot: {
|
|
|
38
38
|
readonly CreateHeader: "create-header";
|
|
39
39
|
};
|
|
40
40
|
export type FilterSlot = (typeof FilterSlot)[keyof typeof FilterSlot];
|
|
41
|
+
/**
|
|
42
|
+
* Content that can be added to filter slots.
|
|
43
|
+
* @category Filter
|
|
44
|
+
*/
|
|
41
45
|
export type FilterSlotContent = {
|
|
42
46
|
[FilterSlot.UpdateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
43
47
|
[FilterSlot.CreateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent } from "./slots";
|
|
2
|
+
/**
|
|
3
|
+
* The slots in the Footer UI.
|
|
4
|
+
* @category Footer
|
|
5
|
+
*/
|
|
2
6
|
export declare const FooterSlot: {
|
|
3
7
|
readonly FooterSlotPrimary: "footer-primary";
|
|
4
8
|
readonly FooterSlotSecondary: "footer-secondary";
|
|
5
9
|
};
|
|
6
10
|
export type FooterSlot = (typeof FooterSlot)[keyof typeof FooterSlot];
|
|
11
|
+
/**
|
|
12
|
+
* Content that can be added to footer slots.
|
|
13
|
+
* @category Footer
|
|
14
|
+
*/
|
|
7
15
|
export type FooterSlotContent = {
|
|
8
16
|
[FooterSlot.FooterSlotPrimary]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
9
17
|
[FooterSlot.FooterSlotSecondary]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
type JSONPrimitive = string | number | boolean | null | undefined;
|
|
2
|
+
/**
|
|
3
|
+
* A JSON-serializable value.
|
|
4
|
+
* @category JSON
|
|
5
|
+
*/
|
|
2
6
|
export type JSONValue = JSONPrimitive | JSONValue[] | {
|
|
3
7
|
[key: string]: JSONValue;
|
|
4
8
|
};
|
|
5
9
|
type NotAssignableToJson = bigint | symbol | Function;
|
|
10
|
+
/**
|
|
11
|
+
* A type that ensures all properties of T are JSON-compatible.
|
|
12
|
+
* @category JSON
|
|
13
|
+
*/
|
|
6
14
|
export type JSONCompatible<T> = unknown extends T ? never : {
|
|
7
15
|
[P in keyof T]: T[P] extends JSONValue ? T[P] : T[P] extends NotAssignableToJson ? never : JSONCompatible<T[P]>;
|
|
8
16
|
};
|
|
@@ -31,6 +31,10 @@ export type MatchReplaceRule = {
|
|
|
31
31
|
*/
|
|
32
32
|
collectionId: ID;
|
|
33
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* The source of a match and replace rule.
|
|
36
|
+
* @category Match and Replace
|
|
37
|
+
*/
|
|
34
38
|
export declare const Source: {
|
|
35
39
|
readonly Automate: "AUTOMATE";
|
|
36
40
|
readonly Intercept: "INTERCEPT";
|
|
@@ -40,77 +44,165 @@ export declare const Source: {
|
|
|
40
44
|
readonly Workflow: "WORKFLOW";
|
|
41
45
|
};
|
|
42
46
|
export type Source = (typeof Source)[keyof typeof Source];
|
|
47
|
+
/**
|
|
48
|
+
* A discriminated union of all possible match and replace sections.
|
|
49
|
+
* @category Match and Replace
|
|
50
|
+
*/
|
|
43
51
|
export type MatchReplaceSection = MatchReplaceSectionRequestAll | MatchReplaceSectionRequestBody | MatchReplaceSectionRequestFirstLine | MatchReplaceSectionRequestHeader | MatchReplaceSectionRequestMethod | MatchReplaceSectionRequestPath | MatchReplaceSectionRequestQuery | MatchReplaceSectionRequestSNI | MatchReplaceSectionResponseAll | MatchReplaceSectionResponseBody | MatchReplaceSectionResponseFirstLine | MatchReplaceSectionResponseHeader | MatchReplaceSectionResponseStatusCode;
|
|
52
|
+
/**
|
|
53
|
+
* A section for the entire request.
|
|
54
|
+
* @category Match and Replace
|
|
55
|
+
*/
|
|
44
56
|
export type MatchReplaceSectionRequestAll = {
|
|
45
57
|
kind: "SectionRequestAll";
|
|
46
58
|
operation: MatchReplaceOperationAll;
|
|
47
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* A section for the entire response.
|
|
62
|
+
* @category Match and Replace
|
|
63
|
+
*/
|
|
48
64
|
export type MatchReplaceSectionResponseAll = {
|
|
49
65
|
kind: "SectionResponseAll";
|
|
50
66
|
operation: MatchReplaceOperationAll;
|
|
51
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* An operation for the entire request/response section.
|
|
70
|
+
* @category Match and Replace
|
|
71
|
+
*/
|
|
52
72
|
export type MatchReplaceOperationAll = KeepOperation<MatchReplaceOperationAllRaw>;
|
|
73
|
+
/**
|
|
74
|
+
* A raw operation for the entire request/response section.
|
|
75
|
+
* @category Match and Replace
|
|
76
|
+
*/
|
|
53
77
|
export type MatchReplaceOperationAllRaw = {
|
|
54
78
|
kind: "OperationAllRaw";
|
|
55
79
|
matcher: MatchReplaceMatcherRaw;
|
|
56
80
|
replacer: MatchReplaceReplacer;
|
|
57
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* A section for the response status code.
|
|
84
|
+
* @category Match and Replace
|
|
85
|
+
*/
|
|
58
86
|
export type MatchReplaceSectionResponseStatusCode = {
|
|
59
87
|
kind: "SectionResponseStatusCode";
|
|
60
88
|
operation: MatchReplaceOperationStatusCode;
|
|
61
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* An operation for the response status code section.
|
|
92
|
+
* @category Match and Replace
|
|
93
|
+
*/
|
|
62
94
|
export type MatchReplaceOperationStatusCode = KeepOperation<MatchReplaceOperationStatusCodeUpdate>;
|
|
95
|
+
/**
|
|
96
|
+
* An operation to update the response status code.
|
|
97
|
+
* @category Match and Replace
|
|
98
|
+
*/
|
|
63
99
|
export type MatchReplaceOperationStatusCodeUpdate = {
|
|
64
100
|
kind: "OperationStatusCodeUpdate";
|
|
65
101
|
replacer: MatchReplaceReplacer;
|
|
66
102
|
};
|
|
103
|
+
/**
|
|
104
|
+
* A section for the request query string.
|
|
105
|
+
* @category Match and Replace
|
|
106
|
+
*/
|
|
67
107
|
export type MatchReplaceSectionRequestQuery = {
|
|
68
108
|
kind: "SectionRequestQuery";
|
|
69
109
|
operation: MatchReplaceOperationQuery;
|
|
70
110
|
};
|
|
111
|
+
/**
|
|
112
|
+
* An operation for the request query section.
|
|
113
|
+
* @category Match and Replace
|
|
114
|
+
*/
|
|
71
115
|
export type MatchReplaceOperationQuery = MatchReplaceOperationQueryRaw | MatchReplaceOperationQueryAdd | MatchReplaceOperationQueryRemove | MatchReplaceOperationQueryUpdate;
|
|
116
|
+
/**
|
|
117
|
+
* A raw operation for the request query section.
|
|
118
|
+
* @category Match and Replace
|
|
119
|
+
*/
|
|
72
120
|
export type MatchReplaceOperationQueryRaw = {
|
|
73
121
|
kind: "OperationQueryRaw";
|
|
74
122
|
matcher: MatchReplaceMatcherRaw;
|
|
75
123
|
replacer: MatchReplaceReplacer;
|
|
76
124
|
};
|
|
125
|
+
/**
|
|
126
|
+
* An operation to add a query parameter.
|
|
127
|
+
* @category Match and Replace
|
|
128
|
+
*/
|
|
77
129
|
export type MatchReplaceOperationQueryAdd = {
|
|
78
130
|
kind: "OperationQueryAdd";
|
|
79
131
|
matcher: MatchReplaceMatcherName;
|
|
80
132
|
replacer: MatchReplaceReplacer;
|
|
81
133
|
};
|
|
134
|
+
/**
|
|
135
|
+
* An operation to remove a query parameter.
|
|
136
|
+
* @category Match and Replace
|
|
137
|
+
*/
|
|
82
138
|
export type MatchReplaceOperationQueryRemove = {
|
|
83
139
|
kind: "OperationQueryRemove";
|
|
84
140
|
matcher: MatchReplaceMatcherName;
|
|
85
141
|
};
|
|
142
|
+
/**
|
|
143
|
+
* An operation to update a query parameter.
|
|
144
|
+
* @category Match and Replace
|
|
145
|
+
*/
|
|
86
146
|
export type MatchReplaceOperationQueryUpdate = {
|
|
87
147
|
kind: "OperationQueryUpdate";
|
|
88
148
|
matcher: MatchReplaceMatcherName;
|
|
89
149
|
replacer: MatchReplaceReplacer;
|
|
90
150
|
};
|
|
151
|
+
/**
|
|
152
|
+
* A section for the request path.
|
|
153
|
+
* @category Match and Replace
|
|
154
|
+
*/
|
|
91
155
|
export type MatchReplaceSectionRequestPath = {
|
|
92
156
|
kind: "SectionRequestPath";
|
|
93
157
|
operation: MatchReplaceOperationPath;
|
|
94
158
|
};
|
|
159
|
+
/**
|
|
160
|
+
* An operation for the request path section.
|
|
161
|
+
* @category Match and Replace
|
|
162
|
+
*/
|
|
95
163
|
export type MatchReplaceOperationPath = KeepOperation<MatchReplaceOperationPathRaw>;
|
|
164
|
+
/**
|
|
165
|
+
* A raw operation for the request path section.
|
|
166
|
+
* @category Match and Replace
|
|
167
|
+
*/
|
|
96
168
|
export type MatchReplaceOperationPathRaw = {
|
|
97
169
|
kind: "OperationPathRaw";
|
|
98
170
|
matcher: MatchReplaceMatcherRaw;
|
|
99
171
|
replacer: MatchReplaceReplacer;
|
|
100
172
|
};
|
|
173
|
+
/**
|
|
174
|
+
* A section for the request method.
|
|
175
|
+
* @category Match and Replace
|
|
176
|
+
*/
|
|
101
177
|
export type MatchReplaceSectionRequestMethod = {
|
|
102
178
|
kind: "SectionRequestMethod";
|
|
103
179
|
operation: MatchReplaceOperationMethod;
|
|
104
180
|
};
|
|
181
|
+
/**
|
|
182
|
+
* An operation for the request method section.
|
|
183
|
+
* @category Match and Replace
|
|
184
|
+
*/
|
|
105
185
|
export type MatchReplaceOperationMethod = KeepOperation<MatchReplaceOperationMethodUpdate>;
|
|
186
|
+
/**
|
|
187
|
+
* An operation to update the request method.
|
|
188
|
+
* @category Match and Replace
|
|
189
|
+
*/
|
|
106
190
|
export type MatchReplaceOperationMethodUpdate = {
|
|
107
191
|
kind: "OperationMethodUpdate";
|
|
108
192
|
replacer: MatchReplaceReplacer;
|
|
109
193
|
};
|
|
194
|
+
/**
|
|
195
|
+
* A section for the request headers.
|
|
196
|
+
* @category Match and Replace
|
|
197
|
+
*/
|
|
110
198
|
export type MatchReplaceSectionRequestHeader = {
|
|
111
199
|
kind: "SectionRequestHeader";
|
|
112
200
|
operation: MatchReplaceOperationHeader;
|
|
113
201
|
};
|
|
202
|
+
/**
|
|
203
|
+
* A section for the response headers.
|
|
204
|
+
* @category Match and Replace
|
|
205
|
+
*/
|
|
114
206
|
export type MatchReplaceSectionResponseHeader = {
|
|
115
207
|
kind: "SectionResponseHeader";
|
|
116
208
|
operation: MatchReplaceOperationHeader;
|
|
@@ -120,29 +212,53 @@ export type MatchReplaceSectionResponseHeader = {
|
|
|
120
212
|
* @category Match and Replace
|
|
121
213
|
*/
|
|
122
214
|
export type MatchReplaceOperationHeader = MatchReplaceOperationHeaderRaw | MatchReplaceOperationHeaderAdd | MatchReplaceOperationHeaderRemove | MatchReplaceOperationHeaderUpdate;
|
|
215
|
+
/**
|
|
216
|
+
* A raw operation for the header section.
|
|
217
|
+
* @category Match and Replace
|
|
218
|
+
*/
|
|
123
219
|
export type MatchReplaceOperationHeaderRaw = {
|
|
124
220
|
kind: "OperationHeaderRaw";
|
|
125
221
|
matcher: MatchReplaceMatcherRaw;
|
|
126
222
|
replacer: MatchReplaceReplacer;
|
|
127
223
|
};
|
|
224
|
+
/**
|
|
225
|
+
* An operation to add a header.
|
|
226
|
+
* @category Match and Replace
|
|
227
|
+
*/
|
|
128
228
|
export type MatchReplaceOperationHeaderAdd = {
|
|
129
229
|
kind: "OperationHeaderAdd";
|
|
130
230
|
matcher: MatchReplaceMatcherName;
|
|
131
231
|
replacer: MatchReplaceReplacer;
|
|
132
232
|
};
|
|
233
|
+
/**
|
|
234
|
+
* An operation to remove a header.
|
|
235
|
+
* @category Match and Replace
|
|
236
|
+
*/
|
|
133
237
|
export type MatchReplaceOperationHeaderRemove = {
|
|
134
238
|
kind: "OperationHeaderRemove";
|
|
135
239
|
matcher: MatchReplaceMatcherName;
|
|
136
240
|
};
|
|
241
|
+
/**
|
|
242
|
+
* An operation to update a header.
|
|
243
|
+
* @category Match and Replace
|
|
244
|
+
*/
|
|
137
245
|
export type MatchReplaceOperationHeaderUpdate = {
|
|
138
246
|
kind: "OperationHeaderUpdate";
|
|
139
247
|
matcher: MatchReplaceMatcherName;
|
|
140
248
|
replacer: MatchReplaceReplacer;
|
|
141
249
|
};
|
|
250
|
+
/**
|
|
251
|
+
* A section for the request body.
|
|
252
|
+
* @category Match and Replace
|
|
253
|
+
*/
|
|
142
254
|
export type MatchReplaceSectionRequestBody = {
|
|
143
255
|
kind: "SectionRequestBody";
|
|
144
256
|
operation: MatchReplaceOperationBody;
|
|
145
257
|
};
|
|
258
|
+
/**
|
|
259
|
+
* A section for the response body.
|
|
260
|
+
* @category Match and Replace
|
|
261
|
+
*/
|
|
146
262
|
export type MatchReplaceSectionResponseBody = {
|
|
147
263
|
kind: "SectionResponseBody";
|
|
148
264
|
operation: MatchReplaceOperationBody;
|
|
@@ -177,6 +293,10 @@ export type MatchReplaceSectionRequestSNI = {
|
|
|
177
293
|
kind: "SectionRequestSNI";
|
|
178
294
|
operation: MatchReplaceOperationSNI;
|
|
179
295
|
};
|
|
296
|
+
/**
|
|
297
|
+
* An operation for the request SNI section.
|
|
298
|
+
* @category Match and Replace
|
|
299
|
+
*/
|
|
180
300
|
export type MatchReplaceOperationSNI = KeepOperation<MatchReplaceOperationSNIRaw>;
|
|
181
301
|
/**
|
|
182
302
|
* A raw operation for the request SNI.
|
|
@@ -194,6 +314,10 @@ export type MatchReplaceSectionResponseFirstLine = {
|
|
|
194
314
|
kind: "SectionResponseFirstLine";
|
|
195
315
|
operation: MatchReplaceOperationFirstLine;
|
|
196
316
|
};
|
|
317
|
+
/**
|
|
318
|
+
* An operation for the first line section.
|
|
319
|
+
* @category Match and Replace
|
|
320
|
+
*/
|
|
197
321
|
export type MatchReplaceOperationFirstLine = KeepOperation<MatchReplaceOperationFirstLineRaw>;
|
|
198
322
|
/**
|
|
199
323
|
* A raw operation for the request first line.
|
|
@@ -204,6 +328,10 @@ export type MatchReplaceOperationFirstLineRaw = {
|
|
|
204
328
|
matcher: MatchReplaceMatcherRaw;
|
|
205
329
|
replacer: MatchReplaceReplacer;
|
|
206
330
|
};
|
|
331
|
+
/**
|
|
332
|
+
* A matcher that matches by name (for headers, query parameters, etc.).
|
|
333
|
+
* @category Match and Replace
|
|
334
|
+
*/
|
|
207
335
|
export type MatchReplaceMatcherName = {
|
|
208
336
|
kind: "MatcherName";
|
|
209
337
|
name: string;
|
|
@@ -286,6 +414,10 @@ export declare const MatchReplaceSlot: {
|
|
|
286
414
|
readonly CreateHeader: "create-header";
|
|
287
415
|
};
|
|
288
416
|
export type MatchReplaceSlot = (typeof MatchReplaceSlot)[keyof typeof MatchReplaceSlot];
|
|
417
|
+
/**
|
|
418
|
+
* Content that can be added to match and replace slots.
|
|
419
|
+
* @category Match and Replace
|
|
420
|
+
*/
|
|
289
421
|
export type MatchReplaceSlotContent = {
|
|
290
422
|
[MatchReplaceSlot.UpdateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
291
423
|
[MatchReplaceSlot.CreateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Available route identifiers in Caido.
|
|
3
|
+
* @category Navigation
|
|
4
|
+
*/
|
|
1
5
|
export declare const Routes: {
|
|
2
6
|
readonly Sitemap: "Sitemap";
|
|
3
7
|
readonly Intercept: "Intercept";
|
|
@@ -23,6 +27,10 @@ export declare const Routes: {
|
|
|
23
27
|
readonly Settings: "Settings";
|
|
24
28
|
};
|
|
25
29
|
export type Routes = (typeof Routes)[keyof typeof Routes];
|
|
30
|
+
/**
|
|
31
|
+
* Event fired when the page changes.
|
|
32
|
+
* @category Navigation
|
|
33
|
+
*/
|
|
26
34
|
export type PageChangeEvent = {
|
|
27
35
|
type: "Core";
|
|
28
36
|
routeId: Routes;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { type As, type ComponentDefinition, type ID, type Prettify } from "./utils";
|
|
2
|
+
/**
|
|
3
|
+
* A draft request that has not yet been saved to the database.
|
|
4
|
+
* @category Request
|
|
5
|
+
*/
|
|
2
6
|
export type RequestDraft = Prettify<As<"RequestDraft"> & {
|
|
3
7
|
host: string;
|
|
4
8
|
port: number;
|
|
@@ -7,6 +11,10 @@ export type RequestDraft = Prettify<As<"RequestDraft"> & {
|
|
|
7
11
|
isTls: boolean;
|
|
8
12
|
raw: string;
|
|
9
13
|
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Metadata about a request without the raw content.
|
|
16
|
+
* @category Request
|
|
17
|
+
*/
|
|
10
18
|
export type RequestMeta = Prettify<As<"RequestMeta"> & {
|
|
11
19
|
id: ID;
|
|
12
20
|
host: string;
|
|
@@ -16,6 +24,10 @@ export type RequestMeta = Prettify<As<"RequestMeta"> & {
|
|
|
16
24
|
isTls: boolean;
|
|
17
25
|
streamId: ID | undefined;
|
|
18
26
|
}>;
|
|
27
|
+
/**
|
|
28
|
+
* A complete request with all metadata and raw content.
|
|
29
|
+
* @category Request
|
|
30
|
+
*/
|
|
19
31
|
export type RequestFull = Prettify<As<"RequestFull"> & {
|
|
20
32
|
id: ID;
|
|
21
33
|
host: string;
|
|
@@ -26,6 +38,10 @@ export type RequestFull = Prettify<As<"RequestFull"> & {
|
|
|
26
38
|
streamId: ID | undefined;
|
|
27
39
|
raw: string;
|
|
28
40
|
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Options for defining a custom request view mode.
|
|
43
|
+
* @category Request
|
|
44
|
+
*/
|
|
29
45
|
export type RequestViewModeOptions = {
|
|
30
46
|
/**
|
|
31
47
|
* The label of the view mode.
|
|
@@ -3,19 +3,39 @@ import { type ComponentDefinition, type Prettify } from "./utils";
|
|
|
3
3
|
type DefineSlotContent<TType extends string, P extends Record<string, unknown>> = Prettify<{
|
|
4
4
|
type: TType;
|
|
5
5
|
} & P>;
|
|
6
|
+
/**
|
|
7
|
+
* Content for a button slot.
|
|
8
|
+
* @category Slots
|
|
9
|
+
*/
|
|
6
10
|
export type ButtonSlotContent = DefineSlotContent<"Button", {
|
|
7
11
|
label: string;
|
|
8
12
|
icon?: string;
|
|
9
13
|
onClick: () => void;
|
|
10
14
|
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Content for a custom component slot.
|
|
17
|
+
* @category Slots
|
|
18
|
+
*/
|
|
11
19
|
export type CustomSlotContent = DefineSlotContent<"Custom", {
|
|
12
20
|
definition: ComponentDefinition;
|
|
13
21
|
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Content for a command slot.
|
|
24
|
+
* @category Slots
|
|
25
|
+
*/
|
|
14
26
|
export type CommandSlotContent = DefineSlotContent<"Command", {
|
|
15
27
|
commandId: CommandID;
|
|
16
28
|
icon?: string;
|
|
17
29
|
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Union type of all possible slot content types.
|
|
32
|
+
* @category Slots
|
|
33
|
+
*/
|
|
18
34
|
export type SlotContent = ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
35
|
+
/**
|
|
36
|
+
* A function type for adding content to slots.
|
|
37
|
+
* @category Slots
|
|
38
|
+
*/
|
|
19
39
|
export type DefineAddToSlotFn<TMap extends Record<string, DefineSlotContent<string, Record<string, unknown>>>> = {
|
|
20
40
|
<K extends keyof TMap>(slot: K, spec: TMap[K]): void;
|
|
21
41
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Component as VueComponent } from "vue";
|
|
2
2
|
/**
|
|
3
3
|
* A unique Caido identifier per type.
|
|
4
|
+
* @category Utils
|
|
4
5
|
*/
|
|
5
6
|
export type ID = string & {
|
|
6
7
|
__id?: never;
|
|
@@ -8,6 +9,7 @@ export type ID = string & {
|
|
|
8
9
|
/**
|
|
9
10
|
* An HTTPQL expression.
|
|
10
11
|
* @example `req.method.eq:"POST"`
|
|
12
|
+
* @category Utils
|
|
11
13
|
*/
|
|
12
14
|
export type HTTPQL = string & {
|
|
13
15
|
__httpql?: never;
|
|
@@ -15,22 +17,28 @@ export type HTTPQL = string & {
|
|
|
15
17
|
/**
|
|
16
18
|
* A {@link https://fontawesome.com/icons|FontAwesome} icon class.
|
|
17
19
|
* @example "fas fa-rocket"
|
|
20
|
+
* @category Utils
|
|
18
21
|
*/
|
|
19
22
|
export type Icon = string & {
|
|
20
23
|
__icon?: never;
|
|
21
24
|
};
|
|
22
25
|
/**
|
|
23
26
|
* A custom component that will be rendered in the UI.
|
|
24
|
-
*
|
|
27
|
+
* @category Utils
|
|
25
28
|
*/
|
|
26
29
|
export type ComponentDefinition = {
|
|
27
30
|
component: VueComponent;
|
|
28
31
|
props?: Record<string, unknown>;
|
|
29
32
|
events?: Record<string, (...args: unknown[]) => void>;
|
|
30
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Utility type for converting endpoint return types to promises.
|
|
36
|
+
* @category Utils
|
|
37
|
+
*/
|
|
31
38
|
export type PromisifiedReturnType<T extends (...args: unknown[]) => unknown> = ReturnType<T> extends Promise<infer U> ? Promise<U> : Promise<ReturnType<T>>;
|
|
32
39
|
/**
|
|
33
40
|
* A handle for a listener.
|
|
41
|
+
* @category Utils
|
|
34
42
|
*/
|
|
35
43
|
export type ListenerHandle = {
|
|
36
44
|
/**
|
|
@@ -38,9 +46,17 @@ export type ListenerHandle = {
|
|
|
38
46
|
*/
|
|
39
47
|
stop: () => void;
|
|
40
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Utility type that prettifies complex types for better IDE display.
|
|
51
|
+
* @category Utils
|
|
52
|
+
*/
|
|
41
53
|
export type Prettify<T> = {
|
|
42
54
|
[K in keyof T]: T[K];
|
|
43
55
|
} & {};
|
|
56
|
+
/**
|
|
57
|
+
* Utility type that adds a type discriminator to a type.
|
|
58
|
+
* @category Utils
|
|
59
|
+
*/
|
|
44
60
|
export type As<TType extends string> = {
|
|
45
61
|
type: TType;
|
|
46
62
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for configuring a dialog.
|
|
3
|
+
* @category Window
|
|
4
|
+
*/
|
|
1
5
|
export type DialogOptions = {
|
|
2
6
|
title?: string;
|
|
3
7
|
draggable?: boolean;
|
|
@@ -6,6 +10,10 @@ export type DialogOptions = {
|
|
|
6
10
|
modal?: boolean;
|
|
7
11
|
position?: "left" | "right" | "top" | "bottom" | "center" | "topleft" | "topright" | "bottomleft" | "bottomright";
|
|
8
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* A dialog instance that can be closed programmatically.
|
|
15
|
+
* @category Window
|
|
16
|
+
*/
|
|
9
17
|
export type Dialog = {
|
|
10
18
|
close: () => void;
|
|
11
19
|
};
|
|
@@ -14,12 +14,24 @@ export type Workflow = {
|
|
|
14
14
|
* @category Workflows
|
|
15
15
|
*/
|
|
16
16
|
export type WorkflowKind = "Convert" | "Active" | "Passive";
|
|
17
|
+
/**
|
|
18
|
+
* Callback function called when a workflow is created.
|
|
19
|
+
* @category Workflows
|
|
20
|
+
*/
|
|
17
21
|
export type OnCreatedWorkflowCallback = (event: {
|
|
18
22
|
workflow: Workflow;
|
|
19
23
|
}) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Callback function called when a workflow is updated.
|
|
26
|
+
* @category Workflows
|
|
27
|
+
*/
|
|
20
28
|
export type OnUpdatedWorkflowCallback = (event: {
|
|
21
29
|
workflow: Workflow;
|
|
22
30
|
}) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Callback function called when a workflow is deleted.
|
|
33
|
+
* @category Workflows
|
|
34
|
+
*/
|
|
23
35
|
export type OnDeletedWorkflowCallback = (event: {
|
|
24
36
|
id: ID;
|
|
25
37
|
}) => void;
|