@caido/sdk-frontend 0.53.2-beta.0 → 0.53.2-beta.10
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/__generated__/graphql-sdk.d.ts +13 -3
- package/src/types/index.d.ts +8 -5
- package/src/types/sdks/filters.d.ts +52 -2
- package/src/types/sdks/httpHistory.d.ts +30 -0
- package/src/types/sdks/matchReplace.d.ts +52 -2
- package/src/types/sdks/replay.d.ts +75 -1
- package/src/types/sdks/scopes.d.ts +52 -2
- package/src/types/sdks/search.d.ts +7 -0
- package/src/types/types/ai.d.ts +19 -1
- 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 +34 -0
- package/src/types/types/footer.d.ts +8 -0
- package/src/types/types/httpHistory.d.ts +15 -0
- package/src/types/types/json.d.ts +8 -0
- package/src/types/types/matchReplace.d.ts +162 -0
- package/src/types/types/navigation.d.ts +8 -0
- package/src/types/types/replay.d.ts +42 -0
- package/src/types/types/request.d.ts +16 -0
- package/src/types/types/scopes.d.ts +30 -0
- package/src/types/types/search.d.ts +15 -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.10",
|
|
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
|
}
|
|
@@ -3160,6 +3160,7 @@ export type Runtime = {
|
|
|
3160
3160
|
logs: Scalars["Uri"]["output"];
|
|
3161
3161
|
platform: Scalars["String"]["output"];
|
|
3162
3162
|
version: Scalars["String"]["output"];
|
|
3163
|
+
workspace?: Maybe<Workspace>;
|
|
3163
3164
|
};
|
|
3164
3165
|
export type Scope = {
|
|
3165
3166
|
allowlist: Array<Scalars["String"]["output"]>;
|
|
@@ -3563,6 +3564,7 @@ export type SubscriptionRoot = {
|
|
|
3563
3564
|
updatedAutomateTask: UpdatedAutomateTaskPayload;
|
|
3564
3565
|
updatedBackup: UpdatedBackupPayload;
|
|
3565
3566
|
updatedBrowser: UpdatedBrowserPayload;
|
|
3567
|
+
updatedCloudStatus: UpdatedCloudStatusPayload;
|
|
3566
3568
|
updatedDataExport: UpdatedDataExportPayload;
|
|
3567
3569
|
updatedDeleteInterceptEntriesTask: UpdatedDeleteInterceptEntriesTaskPayload;
|
|
3568
3570
|
updatedDnsRewrite: UpdatedDnsRewritePayload;
|
|
@@ -4438,6 +4440,9 @@ export type UpdatedBackupPayload = {
|
|
|
4438
4440
|
export type UpdatedBrowserPayload = {
|
|
4439
4441
|
browser: Browser;
|
|
4440
4442
|
};
|
|
4443
|
+
export type UpdatedCloudStatusPayload = {
|
|
4444
|
+
cloudStatus: CloudStatus;
|
|
4445
|
+
};
|
|
4441
4446
|
export type UpdatedDnsRewritePayload = {
|
|
4442
4447
|
rewrite: DnsRewrite;
|
|
4443
4448
|
};
|
|
@@ -4682,6 +4687,11 @@ export type WorkflowUserError = UserError & {
|
|
|
4682
4687
|
node?: Maybe<Scalars["String"]["output"]>;
|
|
4683
4688
|
reason: WorkflowErrorReason;
|
|
4684
4689
|
};
|
|
4690
|
+
export type Workspace = {
|
|
4691
|
+
generation: Scalars["Int"]["output"];
|
|
4692
|
+
id: Scalars["ID"]["output"];
|
|
4693
|
+
name: Scalars["String"]["output"];
|
|
4694
|
+
};
|
|
4685
4695
|
export type AssistantMessageFullFragment = {
|
|
4686
4696
|
__typename: "AssistantMessage";
|
|
4687
4697
|
id: string;
|
|
@@ -9603,7 +9613,7 @@ export type CreateFindingMutation = {
|
|
|
9603
9613
|
};
|
|
9604
9614
|
};
|
|
9605
9615
|
export type DeleteFindingsMutationVariables = Exact<{
|
|
9606
|
-
input
|
|
9616
|
+
input?: InputMaybe<DeleteFindingsInput>;
|
|
9607
9617
|
}>;
|
|
9608
9618
|
export type DeleteFindingsMutation = {
|
|
9609
9619
|
deleteFindings: {
|
|
@@ -23681,7 +23691,7 @@ export declare const CreatedFindingDocument = "\n subscription createdFinding
|
|
|
23681
23691
|
export declare const DeletedFindingsDocument = "\n subscription deletedFindings {\n deletedFindings {\n deletedFindingIds\n snapshot\n }\n}\n ";
|
|
23682
23692
|
export declare const UpdatedFindingsDocument = "\n subscription updatedFindings($order: FindingOrderInput) {\n updatedFindings {\n findings {\n findingEdge(order: $order) {\n ...findingEdgeMeta\n }\n snapshot\n }\n }\n}\n \n fragment findingEdgeMeta on FindingEdge {\n cursor\n node {\n ...findingMeta\n }\n}\n \n\n fragment findingMeta on Finding {\n id\n title\n reporter\n host\n path\n createdAt\n request {\n ...requestMeta\n }\n}\n \n\n fragment requestMeta on Request {\n __typename\n id\n host\n port\n path\n query\n method\n edited\n isTls\n sni\n length\n alteration\n metadata {\n ...requestMetadataFull\n }\n fileExtension\n source\n createdAt\n response {\n ...responseMeta\n }\n stream {\n id\n }\n}\n \n\n fragment requestMetadataFull on RequestMetadata {\n __typename\n id\n color\n}\n \n\n fragment responseMeta on Response {\n __typename\n id\n statusCode\n roundtripTime\n length\n createdAt\n alteration\n edited\n}\n ";
|
|
23683
23693
|
export declare const CreateFindingDocument = "\n mutation createFinding($requestId: ID!, $input: CreateFindingInput!) {\n createFinding(requestId: $requestId, input: $input) {\n finding {\n ...findingFull\n }\n error {\n ... on OtherUserError {\n ...otherUserErrorFull\n }\n ... on UnknownIdUserError {\n ...unknownIdUserErrorFull\n }\n }\n }\n}\n \n fragment findingFull on Finding {\n ...findingMeta\n description\n}\n \n\n fragment findingMeta on Finding {\n id\n title\n reporter\n host\n path\n createdAt\n request {\n ...requestMeta\n }\n}\n \n\n fragment requestMeta on Request {\n __typename\n id\n host\n port\n path\n query\n method\n edited\n isTls\n sni\n length\n alteration\n metadata {\n ...requestMetadataFull\n }\n fileExtension\n source\n createdAt\n response {\n ...responseMeta\n }\n stream {\n id\n }\n}\n \n\n fragment requestMetadataFull on RequestMetadata {\n __typename\n id\n color\n}\n \n\n fragment responseMeta on Response {\n __typename\n id\n statusCode\n roundtripTime\n length\n createdAt\n alteration\n edited\n}\n \n\n fragment otherUserErrorFull on OtherUserError {\n ...userErrorFull\n}\n \n\n fragment userErrorFull on UserError {\n __typename\n code\n}\n \n\n fragment unknownIdUserErrorFull on UnknownIdUserError {\n ...userErrorFull\n id\n}\n ";
|
|
23684
|
-
export declare const DeleteFindingsDocument = "\n mutation deleteFindings($input: DeleteFindingsInput
|
|
23694
|
+
export declare const DeleteFindingsDocument = "\n mutation deleteFindings($input: DeleteFindingsInput) {\n deleteFindings(input: $input) {\n deletedIds\n }\n}\n ";
|
|
23685
23695
|
export declare const UpdateFindingDocument = "\n mutation updateFinding($id: ID!, $input: UpdateFindingInput!) {\n updateFinding(id: $id, input: $input) {\n finding {\n ...findingMeta\n }\n error {\n ... on OtherUserError {\n ...otherUserErrorFull\n }\n ... on UnknownIdUserError {\n ...unknownIdUserErrorFull\n }\n }\n }\n}\n \n fragment findingMeta on Finding {\n id\n title\n reporter\n host\n path\n createdAt\n request {\n ...requestMeta\n }\n}\n \n\n fragment requestMeta on Request {\n __typename\n id\n host\n port\n path\n query\n method\n edited\n isTls\n sni\n length\n alteration\n metadata {\n ...requestMetadataFull\n }\n fileExtension\n source\n createdAt\n response {\n ...responseMeta\n }\n stream {\n id\n }\n}\n \n\n fragment requestMetadataFull on RequestMetadata {\n __typename\n id\n color\n}\n \n\n fragment responseMeta on Response {\n __typename\n id\n statusCode\n roundtripTime\n length\n createdAt\n alteration\n edited\n}\n \n\n fragment otherUserErrorFull on OtherUserError {\n ...userErrorFull\n}\n \n\n fragment userErrorFull on UserError {\n __typename\n code\n}\n \n\n fragment unknownIdUserErrorFull on UnknownIdUserError {\n ...userErrorFull\n id\n}\n ";
|
|
23686
23696
|
export declare const ExportFindingsDocument = "\n mutation exportFindings($input: ExportFindingsInput!) {\n exportFindings(input: $input) {\n export {\n ...dataExportOnDemandMeta\n }\n error {\n ... on OtherUserError {\n ...otherUserErrorFull\n }\n ... on PermissionDeniedUserError {\n ...permissionDeniedUserErrorFull\n }\n }\n }\n}\n \n fragment dataExportOnDemandMeta on DataExportOnDemand {\n downloadUri\n id\n}\n \n\n fragment otherUserErrorFull on OtherUserError {\n ...userErrorFull\n}\n \n\n fragment userErrorFull on UserError {\n __typename\n code\n}\n \n\n fragment permissionDeniedUserErrorFull on PermissionDeniedUserError {\n ...userErrorFull\n permissionDeniedReason: reason\n}\n ";
|
|
23687
23697
|
export declare const InterceptEntriesDocument = "\n query interceptEntries($after: String, $first: Int, $before: String, $last: Int, $order: InterceptEntryOrderInput, $filter: HTTPQL, $scopeId: ID) {\n interceptEntries(\n after: $after\n first: $first\n before: $before\n last: $last\n order: $order\n filter: $filter\n scopeId: $scopeId\n ) {\n edges {\n ...interceptEntryEdgeMeta\n }\n snapshot\n pageInfo {\n ...pageInfoFull\n }\n }\n}\n \n fragment interceptEntryEdgeMeta on InterceptEntryEdge {\n __typename\n cursor\n node {\n ...interceptEntryMeta\n }\n}\n \n\n fragment interceptEntryMeta on InterceptEntry {\n __typename\n id\n request {\n ...requestMeta\n }\n}\n \n\n fragment requestMeta on Request {\n __typename\n id\n host\n port\n path\n query\n method\n edited\n isTls\n sni\n length\n alteration\n metadata {\n ...requestMetadataFull\n }\n fileExtension\n source\n createdAt\n response {\n ...responseMeta\n }\n stream {\n id\n }\n}\n \n\n fragment requestMetadataFull on RequestMetadata {\n __typename\n id\n color\n}\n \n\n fragment responseMeta on Response {\n __typename\n id\n statusCode\n roundtripTime\n length\n createdAt\n alteration\n edited\n}\n \n\n fragment pageInfoFull on PageInfo {\n __typename\n hasPreviousPage\n hasNextPage\n startCursor\n endCursor\n}\n ";
|
|
@@ -23990,7 +24000,7 @@ export declare function getSdk<C>(requester: Requester<C>): {
|
|
|
23990
24000
|
deletedFindings(variables?: DeletedFindingsSubscriptionVariables, options?: C): AsyncIterable<DeletedFindingsSubscription>;
|
|
23991
24001
|
updatedFindings(variables?: UpdatedFindingsSubscriptionVariables, options?: C): AsyncIterable<UpdatedFindingsSubscription>;
|
|
23992
24002
|
createFinding(variables: CreateFindingMutationVariables, options?: C): Promise<CreateFindingMutation>;
|
|
23993
|
-
deleteFindings(variables
|
|
24003
|
+
deleteFindings(variables?: DeleteFindingsMutationVariables, options?: C): Promise<DeleteFindingsMutation>;
|
|
23994
24004
|
updateFinding(variables: UpdateFindingMutationVariables, options?: C): Promise<UpdateFindingMutation>;
|
|
23995
24005
|
exportFindings(variables: ExportFindingsMutationVariables, options?: C): Promise<ExportFindingsMutation>;
|
|
23996
24006
|
interceptEntries(variables?: InterceptEntriesQueryVariables, options?: C): Promise<InterceptEntriesQuery>;
|
package/src/types/index.d.ts
CHANGED
|
@@ -2,19 +2,22 @@ export { FooterSlot, type FooterSlotContent } from "./types/footer";
|
|
|
2
2
|
export type { DialogOptions } from "./types/window";
|
|
3
3
|
export type { CommandContext, CommandContextRequest, CommandContextRequestRow, CommandContextResponse, CommandContextBase, } from "./types/commands";
|
|
4
4
|
export type { MenuItem } from "./types/menu";
|
|
5
|
-
export { type ReplayTab, type ReplaySession, type ReplayCollection, type SendRequestOptions, ReplaySlot, type ReplaySlotContent, type RequestSource, type CurrentReplaySessionChangeEvent, } from "./types/replay";
|
|
5
|
+
export { type ReplayTab, type ReplaySession, type ReplayEntry, type ReplayCollection, type SendRequestOptions, ReplaySlot, type ReplaySlotContent, type RequestSource, type CurrentReplaySessionChangeEvent, } from "./types/replay";
|
|
6
|
+
export { SearchSlot, type SearchSlotContent } from "./types/search";
|
|
6
7
|
export type { HostedFile } from "./types/files";
|
|
7
|
-
export type
|
|
8
|
+
export { FilterSlot, type Filter, type FilterSlotContent, type CurrentFilterChangeEvent, } from "./types/filter";
|
|
8
9
|
export type { HTTPQL, ID, ComponentDefinition } from "./types/utils";
|
|
9
10
|
export type { JSONValue, JSONCompatible } from "./types/json";
|
|
10
11
|
export type { SlotContent, ButtonSlotContent, CustomSlotContent, CommandSlotContent, } from "./types/slots";
|
|
11
12
|
export type { RequestViewModeOptions, RequestFull, RequestDraft, RequestMeta, } from "./types/request";
|
|
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 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, } from "./types/matchReplace";
|
|
14
|
+
export { MatchReplaceSlot, type MatchReplaceSlotContent, } from "./types/matchReplace";
|
|
15
|
+
export { ScopeSlot, type CurrentScopeChangeEvent, type Scope, type ScopeSlotContent, } from "./types/scopes";
|
|
16
|
+
export { HTTPHistorySlot, type HTTPHistorySlotContent, } from "./types/httpHistory";
|
|
14
17
|
export type { EnvironmentVariable } from "./types/environment";
|
|
15
18
|
export type { Workflow, WorkflowKind, OnCreatedWorkflowCallback, OnUpdatedWorkflowCallback, OnDeletedWorkflowCallback, } from "./types/workflows";
|
|
16
19
|
export type { ListenerHandle } from "./types/utils";
|
|
17
|
-
export type { AIProvider } from "./types/ai";
|
|
20
|
+
export type { AIProvider, AILanguageModelSettings, AIReasoningSettings, } from "./types/ai";
|
|
18
21
|
export type { SelectedProjectChangeEvent } from "./types/projects";
|
|
19
22
|
export type { CommandPaletteView } from "./sdks/commandPalette";
|
|
20
23
|
export type { LogSDK } from "./sdks/log";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type Filter } from "../types/filter";
|
|
2
|
-
import
|
|
1
|
+
import { type CurrentFilterChangeEvent, type Filter, type FilterSlotContent } from "../types/filter";
|
|
2
|
+
import { type DefineAddToSlotFn } from "../types/slots";
|
|
3
|
+
import type { HTTPQL, ID, ListenerHandle } from "../types/utils";
|
|
3
4
|
/**
|
|
4
5
|
* SDK for interacting with the Filters page.
|
|
5
6
|
* @category Filters
|
|
@@ -45,4 +46,53 @@ 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
|
+
* Get the currently selected filter.
|
|
51
|
+
* @returns The currently selected filter, or undefined if no filter is selected.
|
|
52
|
+
*/
|
|
53
|
+
getCurrentFilter: () => Filter | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Subscribe to current filter changes.
|
|
56
|
+
* @param callback The callback to call when the selected filter changes.
|
|
57
|
+
* @returns An object with a `stop` method that can be called to stop listening to filter changes.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const handler = sdk.filters.onCurrentFilterChange((event) => {
|
|
62
|
+
* console.log(`Filter ${event.filterId} got selected!`);
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* // Later, stop listening
|
|
66
|
+
* handler.stop();
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
onCurrentFilterChange: (callback: (event: CurrentFilterChangeEvent) => void) => ListenerHandle;
|
|
70
|
+
/**
|
|
71
|
+
* Add a component to a slot.
|
|
72
|
+
* @param slot The slot to add the component to.
|
|
73
|
+
* @param content The content to add to the slot.
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* sdk.filters.addToSlot(FilterSlot.UpdateHeader, {
|
|
77
|
+
* type: "Button",
|
|
78
|
+
* label: "My Button",
|
|
79
|
+
* icon: "my-icon",
|
|
80
|
+
* onClick: () => {
|
|
81
|
+
* console.log("Button clicked");
|
|
82
|
+
* },
|
|
83
|
+
* });
|
|
84
|
+
*
|
|
85
|
+
* sdk.filters.addToSlot(FilterSlot.CreateHeader, {
|
|
86
|
+
* type: "Custom",
|
|
87
|
+
* definition: MyComponent,
|
|
88
|
+
* });
|
|
89
|
+
*
|
|
90
|
+
* sdk.filters.addToSlot(FilterSlot.UpdateHeader, {
|
|
91
|
+
* type: "Command",
|
|
92
|
+
* commandId: "my-command",
|
|
93
|
+
* icon: "my-icon",
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
addToSlot: DefineAddToSlotFn<FilterSlotContent>;
|
|
48
98
|
};
|
|
@@ -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,5 +1,6 @@
|
|
|
1
|
-
import { type MatchReplaceCollection, type MatchReplaceRule, type MatchReplaceSection, type Source } from "../types/matchReplace";
|
|
2
|
-
import
|
|
1
|
+
import { type CurrentMatchReplaceRuleChangeEvent, type MatchReplaceCollection, type MatchReplaceRule, type MatchReplaceSection, type MatchReplaceSlotContent, type Source } from "../types/matchReplace";
|
|
2
|
+
import { type DefineAddToSlotFn } from "../types/slots";
|
|
3
|
+
import type { HTTPQL, ID, ListenerHandle } from "../types/utils";
|
|
3
4
|
/**
|
|
4
5
|
* Utilities to interact with the Match and Replace page.
|
|
5
6
|
* @category Match and Replace
|
|
@@ -47,6 +48,27 @@ export type MatchReplaceSDK = {
|
|
|
47
48
|
* @param id - The ID of the rule, or undefined to clear the selection.
|
|
48
49
|
*/
|
|
49
50
|
selectRule: (id: ID | undefined) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Get the currently selected rule.
|
|
53
|
+
* @returns The currently selected rule, or undefined if no rule is selected.
|
|
54
|
+
*/
|
|
55
|
+
getCurrentRule: () => MatchReplaceRule | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Subscribe to current rule changes.
|
|
58
|
+
* @param callback The callback to call when the selected rule changes.
|
|
59
|
+
* @returns An object with a `stop` method that can be called to stop listening to rule changes.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const handler = sdk.matchReplace.onCurrentRuleChange((event) => {
|
|
64
|
+
* console.log(`Rule ${event.ruleId} got selected!`);
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
* // Later, stop listening
|
|
68
|
+
* handler.stop();
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
onCurrentRuleChange: (callback: (event: CurrentMatchReplaceRuleChangeEvent) => void) => ListenerHandle;
|
|
50
72
|
/**
|
|
51
73
|
* Create a rule.
|
|
52
74
|
* @param options - The options for the rule.
|
|
@@ -88,4 +110,32 @@ export type MatchReplaceSDK = {
|
|
|
88
110
|
* @param id - The ID of the rule.
|
|
89
111
|
*/
|
|
90
112
|
deleteRule: (id: ID) => Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Add a component to a slot.
|
|
115
|
+
* @param slot The slot to add the component to.
|
|
116
|
+
* @param content The content to add to the slot.
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* sdk.matchReplace.addToSlot(MatchReplaceSlot.UpdateHeader, {
|
|
120
|
+
* type: "Button",
|
|
121
|
+
* label: "My Button",
|
|
122
|
+
* icon: "my-icon",
|
|
123
|
+
* onClick: () => {
|
|
124
|
+
* console.log("Button clicked");
|
|
125
|
+
* },
|
|
126
|
+
* });
|
|
127
|
+
*
|
|
128
|
+
* sdk.matchReplace.addToSlot(MatchReplaceSlot.CreateHeader, {
|
|
129
|
+
* type: "Custom",
|
|
130
|
+
* definition: MyComponent,
|
|
131
|
+
* });
|
|
132
|
+
*
|
|
133
|
+
* sdk.matchReplace.addToSlot(MatchReplaceSlot.UpdateHeader, {
|
|
134
|
+
* type: "Command",
|
|
135
|
+
* commandId: "my-command",
|
|
136
|
+
* icon: "my-icon",
|
|
137
|
+
* });
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
addToSlot: DefineAddToSlotFn<MatchReplaceSlotContent>;
|
|
91
141
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Extension } from "@codemirror/state";
|
|
2
|
-
import { type CurrentReplaySessionChangeEvent, type OpenTabOptions, type ReplayCollection, type ReplaySession, type ReplaySlotContent, type ReplayTab, type RequestSource, type SendRequestOptions } from "../types/replay";
|
|
2
|
+
import { type CurrentReplaySessionChangeEvent, type OpenTabOptions, type ReplayCollection, type 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";
|
|
@@ -29,6 +29,20 @@ export type ReplaySDK = {
|
|
|
29
29
|
* @returns The list of all replay sessions.
|
|
30
30
|
*/
|
|
31
31
|
getSessions: () => ReplaySession[];
|
|
32
|
+
/**
|
|
33
|
+
* Get the currently selected replay session.
|
|
34
|
+
* @returns The currently selected replay session, or undefined if no session is selected.
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const currentSession = sdk.replay.getCurrentSession();
|
|
38
|
+
* if (currentSession) {
|
|
39
|
+
* console.log(`Current session: ${currentSession.name}`);
|
|
40
|
+
* } else {
|
|
41
|
+
* console.log("No session is currently selected");
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
getCurrentSession: () => ReplaySession | undefined;
|
|
32
46
|
/**
|
|
33
47
|
* Rename a session.
|
|
34
48
|
* @param id The ID of the session to rename.
|
|
@@ -134,6 +148,34 @@ export type ReplaySDK = {
|
|
|
134
148
|
* ```
|
|
135
149
|
*/
|
|
136
150
|
sendRequest: (sessionId: ID, options: SendRequestOptions) => Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Show a specific entry in a replay session.
|
|
153
|
+
* This will open the session tab if not already open, set it as the selected session, and display the specified entry.
|
|
154
|
+
* @param sessionId The ID of the session containing the entry.
|
|
155
|
+
* @param entryId The ID of the entry to show.
|
|
156
|
+
* @param options The options for showing the entry.
|
|
157
|
+
* @param options.overwriteDraft 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.
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* await sdk.replay.showEntry(sessionId, entryId, {
|
|
161
|
+
* overwriteDraft: true,
|
|
162
|
+
* });
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
showEntry: (sessionId: ID, entryId: ID, options?: {
|
|
166
|
+
overwriteDraft?: boolean;
|
|
167
|
+
}) => Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Get a replay entry by its ID.
|
|
170
|
+
* @param entryId The ID of the entry to get.
|
|
171
|
+
* @returns The replay entry.
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* const entry = await sdk.replay.getEntry(entryId);
|
|
175
|
+
* console.log(entry.id, entry.sessionId, entry.requestId);
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
getEntry: (entryId: ID) => ReplayEntry;
|
|
137
179
|
/**
|
|
138
180
|
* Subscribe to current replay session changes.
|
|
139
181
|
* @param callback The callback to call when the selected session changes.
|
|
@@ -150,4 +192,36 @@ export type ReplaySDK = {
|
|
|
150
192
|
* ```
|
|
151
193
|
*/
|
|
152
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;
|
|
153
227
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type Scope } from "../types/scopes";
|
|
2
|
-
import type
|
|
1
|
+
import { type CurrentScopeChangeEvent, type Scope, type ScopeSlotContent } from "../types/scopes";
|
|
2
|
+
import { type DefineAddToSlotFn } from "../types/slots";
|
|
3
|
+
import type { ID, ListenerHandle } from "../types/utils";
|
|
3
4
|
/**
|
|
4
5
|
* Utilities to interact with scopes
|
|
5
6
|
* @category Scopes
|
|
@@ -52,4 +53,53 @@ export type ScopesSDK = {
|
|
|
52
53
|
* @returns Whether the scope was deleted.
|
|
53
54
|
*/
|
|
54
55
|
deleteScope: (id: ID) => Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Get the currently selected scope.
|
|
58
|
+
* @returns The currently selected scope, or undefined if no scope is selected.
|
|
59
|
+
*/
|
|
60
|
+
getCurrentScope: () => Scope | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Subscribe to current scope changes.
|
|
63
|
+
* @param callback The callback to call when the selected scope changes.
|
|
64
|
+
* @returns An object with a `stop` method that can be called to stop listening to scope changes.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const handler = sdk.scopes.onCurrentScopeChange((event) => {
|
|
69
|
+
* console.log(`Scope ${event.scopeId} got selected!`);
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* // Later, stop listening
|
|
73
|
+
* handler.stop();
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
onCurrentScopeChange: (callback: (event: CurrentScopeChangeEvent) => void) => ListenerHandle;
|
|
77
|
+
/**
|
|
78
|
+
* Add a component to a slot.
|
|
79
|
+
* @param slot The slot to add the component to.
|
|
80
|
+
* @param content The content to add to the slot.
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* sdk.scopes.addToSlot(ScopeSlot.UpdateHeader, {
|
|
84
|
+
* type: "Button",
|
|
85
|
+
* label: "My Button",
|
|
86
|
+
* icon: "my-icon",
|
|
87
|
+
* onClick: () => {
|
|
88
|
+
* console.log("Button clicked");
|
|
89
|
+
* },
|
|
90
|
+
* });
|
|
91
|
+
*
|
|
92
|
+
* sdk.scopes.addToSlot(ScopeSlot.CreateHeader, {
|
|
93
|
+
* type: "Custom",
|
|
94
|
+
* definition: MyComponent,
|
|
95
|
+
* });
|
|
96
|
+
*
|
|
97
|
+
* sdk.scopes.addToSlot(ScopeSlot.UpdateHeader, {
|
|
98
|
+
* type: "Command",
|
|
99
|
+
* commandId: "my-command",
|
|
100
|
+
* icon: "my-icon",
|
|
101
|
+
* });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
addToSlot: DefineAddToSlotFn<ScopeSlotContent>;
|
|
55
105
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Extension } from "@codemirror/state";
|
|
2
2
|
import type { RequestViewModeOptions } from "../types/request";
|
|
3
|
+
import type { SearchSlot, SearchSlotContent } from "../types/search";
|
|
3
4
|
import type { HTTPQL, ID } from "../types/utils";
|
|
4
5
|
/**
|
|
5
6
|
* Utilities to interact with the Search page.
|
|
@@ -41,4 +42,10 @@ export type SearchSDK = {
|
|
|
41
42
|
* @param id The ID of the request to scroll to.
|
|
42
43
|
*/
|
|
43
44
|
scrollTo: (id: ID) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Add content to a slot in the Search UI.
|
|
47
|
+
* @param slot The slot to add content to.
|
|
48
|
+
* @param content The content to add.
|
|
49
|
+
*/
|
|
50
|
+
addToSlot: <T extends SearchSlot>(slot: T, content: SearchSlotContent[T]) => void;
|
|
44
51
|
};
|
package/src/types/types/ai.d.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { type LanguageModelV2, type ProviderV2 } from "@ai-sdk/provider";
|
|
2
|
+
/**
|
|
3
|
+
* Settings for AI reasoning.
|
|
4
|
+
* @category AI
|
|
5
|
+
*/
|
|
6
|
+
export type AIReasoningSettings = {
|
|
7
|
+
effort: "low" | "medium" | "high";
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Settings for AI language model.
|
|
11
|
+
* @category AI
|
|
12
|
+
*/
|
|
13
|
+
export type AILanguageModelSettings = {
|
|
14
|
+
reasoning?: AIReasoningSettings;
|
|
15
|
+
capabilities?: {
|
|
16
|
+
reasoning: boolean;
|
|
17
|
+
structured_output: boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
2
20
|
/**
|
|
3
21
|
* Official AI Provider to be used by the [ai](https://ai-sdk.dev/) library.
|
|
4
22
|
* @category AI
|
|
5
23
|
*/
|
|
6
|
-
export type AIProvider = ProviderV2 & ((modelId: string) => LanguageModelV2);
|
|
24
|
+
export type AIProvider = ProviderV2 & ((modelId: string, settings?: AILanguageModelSettings) => LanguageModelV2);
|
|
@@ -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.
|
|
@@ -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,36 @@ 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
|
+
/**
|
|
42
|
+
* Content that can be added to filter slots.
|
|
43
|
+
* @category Filter
|
|
44
|
+
*/
|
|
45
|
+
export type FilterSlotContent = {
|
|
46
|
+
[FilterSlot.UpdateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
47
|
+
[FilterSlot.CreateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Event fired when the current filter changes.
|
|
51
|
+
* @category Filters
|
|
52
|
+
*/
|
|
53
|
+
export type CurrentFilterChangeEvent = {
|
|
54
|
+
/**
|
|
55
|
+
* The ID of the newly selected filter, or undefined if no filter is selected.
|
|
56
|
+
*/
|
|
57
|
+
filterId: ID | undefined;
|
|
58
|
+
};
|
|
@@ -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;
|
|
@@ -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,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
|
};
|
|
@@ -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.
|
|
@@ -30,6 +31,10 @@ export type MatchReplaceRule = {
|
|
|
30
31
|
*/
|
|
31
32
|
collectionId: ID;
|
|
32
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* The source of a match and replace rule.
|
|
36
|
+
* @category Match and Replace
|
|
37
|
+
*/
|
|
33
38
|
export declare const Source: {
|
|
34
39
|
readonly Automate: "AUTOMATE";
|
|
35
40
|
readonly Intercept: "INTERCEPT";
|
|
@@ -39,77 +44,165 @@ export declare const Source: {
|
|
|
39
44
|
readonly Workflow: "WORKFLOW";
|
|
40
45
|
};
|
|
41
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
|
+
*/
|
|
42
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
|
+
*/
|
|
43
56
|
export type MatchReplaceSectionRequestAll = {
|
|
44
57
|
kind: "SectionRequestAll";
|
|
45
58
|
operation: MatchReplaceOperationAll;
|
|
46
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* A section for the entire response.
|
|
62
|
+
* @category Match and Replace
|
|
63
|
+
*/
|
|
47
64
|
export type MatchReplaceSectionResponseAll = {
|
|
48
65
|
kind: "SectionResponseAll";
|
|
49
66
|
operation: MatchReplaceOperationAll;
|
|
50
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* An operation for the entire request/response section.
|
|
70
|
+
* @category Match and Replace
|
|
71
|
+
*/
|
|
51
72
|
export type MatchReplaceOperationAll = KeepOperation<MatchReplaceOperationAllRaw>;
|
|
73
|
+
/**
|
|
74
|
+
* A raw operation for the entire request/response section.
|
|
75
|
+
* @category Match and Replace
|
|
76
|
+
*/
|
|
52
77
|
export type MatchReplaceOperationAllRaw = {
|
|
53
78
|
kind: "OperationAllRaw";
|
|
54
79
|
matcher: MatchReplaceMatcherRaw;
|
|
55
80
|
replacer: MatchReplaceReplacer;
|
|
56
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* A section for the response status code.
|
|
84
|
+
* @category Match and Replace
|
|
85
|
+
*/
|
|
57
86
|
export type MatchReplaceSectionResponseStatusCode = {
|
|
58
87
|
kind: "SectionResponseStatusCode";
|
|
59
88
|
operation: MatchReplaceOperationStatusCode;
|
|
60
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* An operation for the response status code section.
|
|
92
|
+
* @category Match and Replace
|
|
93
|
+
*/
|
|
61
94
|
export type MatchReplaceOperationStatusCode = KeepOperation<MatchReplaceOperationStatusCodeUpdate>;
|
|
95
|
+
/**
|
|
96
|
+
* An operation to update the response status code.
|
|
97
|
+
* @category Match and Replace
|
|
98
|
+
*/
|
|
62
99
|
export type MatchReplaceOperationStatusCodeUpdate = {
|
|
63
100
|
kind: "OperationStatusCodeUpdate";
|
|
64
101
|
replacer: MatchReplaceReplacer;
|
|
65
102
|
};
|
|
103
|
+
/**
|
|
104
|
+
* A section for the request query string.
|
|
105
|
+
* @category Match and Replace
|
|
106
|
+
*/
|
|
66
107
|
export type MatchReplaceSectionRequestQuery = {
|
|
67
108
|
kind: "SectionRequestQuery";
|
|
68
109
|
operation: MatchReplaceOperationQuery;
|
|
69
110
|
};
|
|
111
|
+
/**
|
|
112
|
+
* An operation for the request query section.
|
|
113
|
+
* @category Match and Replace
|
|
114
|
+
*/
|
|
70
115
|
export type MatchReplaceOperationQuery = MatchReplaceOperationQueryRaw | MatchReplaceOperationQueryAdd | MatchReplaceOperationQueryRemove | MatchReplaceOperationQueryUpdate;
|
|
116
|
+
/**
|
|
117
|
+
* A raw operation for the request query section.
|
|
118
|
+
* @category Match and Replace
|
|
119
|
+
*/
|
|
71
120
|
export type MatchReplaceOperationQueryRaw = {
|
|
72
121
|
kind: "OperationQueryRaw";
|
|
73
122
|
matcher: MatchReplaceMatcherRaw;
|
|
74
123
|
replacer: MatchReplaceReplacer;
|
|
75
124
|
};
|
|
125
|
+
/**
|
|
126
|
+
* An operation to add a query parameter.
|
|
127
|
+
* @category Match and Replace
|
|
128
|
+
*/
|
|
76
129
|
export type MatchReplaceOperationQueryAdd = {
|
|
77
130
|
kind: "OperationQueryAdd";
|
|
78
131
|
matcher: MatchReplaceMatcherName;
|
|
79
132
|
replacer: MatchReplaceReplacer;
|
|
80
133
|
};
|
|
134
|
+
/**
|
|
135
|
+
* An operation to remove a query parameter.
|
|
136
|
+
* @category Match and Replace
|
|
137
|
+
*/
|
|
81
138
|
export type MatchReplaceOperationQueryRemove = {
|
|
82
139
|
kind: "OperationQueryRemove";
|
|
83
140
|
matcher: MatchReplaceMatcherName;
|
|
84
141
|
};
|
|
142
|
+
/**
|
|
143
|
+
* An operation to update a query parameter.
|
|
144
|
+
* @category Match and Replace
|
|
145
|
+
*/
|
|
85
146
|
export type MatchReplaceOperationQueryUpdate = {
|
|
86
147
|
kind: "OperationQueryUpdate";
|
|
87
148
|
matcher: MatchReplaceMatcherName;
|
|
88
149
|
replacer: MatchReplaceReplacer;
|
|
89
150
|
};
|
|
151
|
+
/**
|
|
152
|
+
* A section for the request path.
|
|
153
|
+
* @category Match and Replace
|
|
154
|
+
*/
|
|
90
155
|
export type MatchReplaceSectionRequestPath = {
|
|
91
156
|
kind: "SectionRequestPath";
|
|
92
157
|
operation: MatchReplaceOperationPath;
|
|
93
158
|
};
|
|
159
|
+
/**
|
|
160
|
+
* An operation for the request path section.
|
|
161
|
+
* @category Match and Replace
|
|
162
|
+
*/
|
|
94
163
|
export type MatchReplaceOperationPath = KeepOperation<MatchReplaceOperationPathRaw>;
|
|
164
|
+
/**
|
|
165
|
+
* A raw operation for the request path section.
|
|
166
|
+
* @category Match and Replace
|
|
167
|
+
*/
|
|
95
168
|
export type MatchReplaceOperationPathRaw = {
|
|
96
169
|
kind: "OperationPathRaw";
|
|
97
170
|
matcher: MatchReplaceMatcherRaw;
|
|
98
171
|
replacer: MatchReplaceReplacer;
|
|
99
172
|
};
|
|
173
|
+
/**
|
|
174
|
+
* A section for the request method.
|
|
175
|
+
* @category Match and Replace
|
|
176
|
+
*/
|
|
100
177
|
export type MatchReplaceSectionRequestMethod = {
|
|
101
178
|
kind: "SectionRequestMethod";
|
|
102
179
|
operation: MatchReplaceOperationMethod;
|
|
103
180
|
};
|
|
181
|
+
/**
|
|
182
|
+
* An operation for the request method section.
|
|
183
|
+
* @category Match and Replace
|
|
184
|
+
*/
|
|
104
185
|
export type MatchReplaceOperationMethod = KeepOperation<MatchReplaceOperationMethodUpdate>;
|
|
186
|
+
/**
|
|
187
|
+
* An operation to update the request method.
|
|
188
|
+
* @category Match and Replace
|
|
189
|
+
*/
|
|
105
190
|
export type MatchReplaceOperationMethodUpdate = {
|
|
106
191
|
kind: "OperationMethodUpdate";
|
|
107
192
|
replacer: MatchReplaceReplacer;
|
|
108
193
|
};
|
|
194
|
+
/**
|
|
195
|
+
* A section for the request headers.
|
|
196
|
+
* @category Match and Replace
|
|
197
|
+
*/
|
|
109
198
|
export type MatchReplaceSectionRequestHeader = {
|
|
110
199
|
kind: "SectionRequestHeader";
|
|
111
200
|
operation: MatchReplaceOperationHeader;
|
|
112
201
|
};
|
|
202
|
+
/**
|
|
203
|
+
* A section for the response headers.
|
|
204
|
+
* @category Match and Replace
|
|
205
|
+
*/
|
|
113
206
|
export type MatchReplaceSectionResponseHeader = {
|
|
114
207
|
kind: "SectionResponseHeader";
|
|
115
208
|
operation: MatchReplaceOperationHeader;
|
|
@@ -119,29 +212,53 @@ export type MatchReplaceSectionResponseHeader = {
|
|
|
119
212
|
* @category Match and Replace
|
|
120
213
|
*/
|
|
121
214
|
export type MatchReplaceOperationHeader = MatchReplaceOperationHeaderRaw | MatchReplaceOperationHeaderAdd | MatchReplaceOperationHeaderRemove | MatchReplaceOperationHeaderUpdate;
|
|
215
|
+
/**
|
|
216
|
+
* A raw operation for the header section.
|
|
217
|
+
* @category Match and Replace
|
|
218
|
+
*/
|
|
122
219
|
export type MatchReplaceOperationHeaderRaw = {
|
|
123
220
|
kind: "OperationHeaderRaw";
|
|
124
221
|
matcher: MatchReplaceMatcherRaw;
|
|
125
222
|
replacer: MatchReplaceReplacer;
|
|
126
223
|
};
|
|
224
|
+
/**
|
|
225
|
+
* An operation to add a header.
|
|
226
|
+
* @category Match and Replace
|
|
227
|
+
*/
|
|
127
228
|
export type MatchReplaceOperationHeaderAdd = {
|
|
128
229
|
kind: "OperationHeaderAdd";
|
|
129
230
|
matcher: MatchReplaceMatcherName;
|
|
130
231
|
replacer: MatchReplaceReplacer;
|
|
131
232
|
};
|
|
233
|
+
/**
|
|
234
|
+
* An operation to remove a header.
|
|
235
|
+
* @category Match and Replace
|
|
236
|
+
*/
|
|
132
237
|
export type MatchReplaceOperationHeaderRemove = {
|
|
133
238
|
kind: "OperationHeaderRemove";
|
|
134
239
|
matcher: MatchReplaceMatcherName;
|
|
135
240
|
};
|
|
241
|
+
/**
|
|
242
|
+
* An operation to update a header.
|
|
243
|
+
* @category Match and Replace
|
|
244
|
+
*/
|
|
136
245
|
export type MatchReplaceOperationHeaderUpdate = {
|
|
137
246
|
kind: "OperationHeaderUpdate";
|
|
138
247
|
matcher: MatchReplaceMatcherName;
|
|
139
248
|
replacer: MatchReplaceReplacer;
|
|
140
249
|
};
|
|
250
|
+
/**
|
|
251
|
+
* A section for the request body.
|
|
252
|
+
* @category Match and Replace
|
|
253
|
+
*/
|
|
141
254
|
export type MatchReplaceSectionRequestBody = {
|
|
142
255
|
kind: "SectionRequestBody";
|
|
143
256
|
operation: MatchReplaceOperationBody;
|
|
144
257
|
};
|
|
258
|
+
/**
|
|
259
|
+
* A section for the response body.
|
|
260
|
+
* @category Match and Replace
|
|
261
|
+
*/
|
|
145
262
|
export type MatchReplaceSectionResponseBody = {
|
|
146
263
|
kind: "SectionResponseBody";
|
|
147
264
|
operation: MatchReplaceOperationBody;
|
|
@@ -176,6 +293,10 @@ export type MatchReplaceSectionRequestSNI = {
|
|
|
176
293
|
kind: "SectionRequestSNI";
|
|
177
294
|
operation: MatchReplaceOperationSNI;
|
|
178
295
|
};
|
|
296
|
+
/**
|
|
297
|
+
* An operation for the request SNI section.
|
|
298
|
+
* @category Match and Replace
|
|
299
|
+
*/
|
|
179
300
|
export type MatchReplaceOperationSNI = KeepOperation<MatchReplaceOperationSNIRaw>;
|
|
180
301
|
/**
|
|
181
302
|
* A raw operation for the request SNI.
|
|
@@ -193,6 +314,10 @@ export type MatchReplaceSectionResponseFirstLine = {
|
|
|
193
314
|
kind: "SectionResponseFirstLine";
|
|
194
315
|
operation: MatchReplaceOperationFirstLine;
|
|
195
316
|
};
|
|
317
|
+
/**
|
|
318
|
+
* An operation for the first line section.
|
|
319
|
+
* @category Match and Replace
|
|
320
|
+
*/
|
|
196
321
|
export type MatchReplaceOperationFirstLine = KeepOperation<MatchReplaceOperationFirstLineRaw>;
|
|
197
322
|
/**
|
|
198
323
|
* A raw operation for the request first line.
|
|
@@ -203,6 +328,10 @@ export type MatchReplaceOperationFirstLineRaw = {
|
|
|
203
328
|
matcher: MatchReplaceMatcherRaw;
|
|
204
329
|
replacer: MatchReplaceReplacer;
|
|
205
330
|
};
|
|
331
|
+
/**
|
|
332
|
+
* A matcher that matches by name (for headers, query parameters, etc.).
|
|
333
|
+
* @category Match and Replace
|
|
334
|
+
*/
|
|
206
335
|
export type MatchReplaceMatcherName = {
|
|
207
336
|
kind: "MatcherName";
|
|
208
337
|
name: string;
|
|
@@ -270,4 +399,37 @@ export type MatchReplaceCollection = {
|
|
|
270
399
|
type KeepOperation<T> = T & {
|
|
271
400
|
__operation?: never;
|
|
272
401
|
};
|
|
402
|
+
/**
|
|
403
|
+
* The slots in the Match and Replace UI.
|
|
404
|
+
* @category Match and Replace
|
|
405
|
+
*/
|
|
406
|
+
export declare const MatchReplaceSlot: {
|
|
407
|
+
/**
|
|
408
|
+
* The header area of the rule form update component.
|
|
409
|
+
*/
|
|
410
|
+
readonly UpdateHeader: "update-header";
|
|
411
|
+
/**
|
|
412
|
+
* The header area of the rule form create component.
|
|
413
|
+
*/
|
|
414
|
+
readonly CreateHeader: "create-header";
|
|
415
|
+
};
|
|
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
|
+
*/
|
|
421
|
+
export type MatchReplaceSlotContent = {
|
|
422
|
+
[MatchReplaceSlot.UpdateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
423
|
+
[MatchReplaceSlot.CreateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
424
|
+
};
|
|
425
|
+
/**
|
|
426
|
+
* Event fired when the current match and replace rule changes.
|
|
427
|
+
* @category Match and Replace
|
|
428
|
+
*/
|
|
429
|
+
export type CurrentMatchReplaceRuleChangeEvent = {
|
|
430
|
+
/**
|
|
431
|
+
* The ID of the newly selected rule, or undefined if no rule is selected.
|
|
432
|
+
*/
|
|
433
|
+
ruleId: ID | undefined;
|
|
434
|
+
};
|
|
273
435
|
export {};
|
|
@@ -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;
|
|
@@ -62,6 +62,28 @@ export type ReplaySession = {
|
|
|
62
62
|
* The ID of the collection the session belongs to.
|
|
63
63
|
*/
|
|
64
64
|
collectionId: ID;
|
|
65
|
+
/**
|
|
66
|
+
* The IDs of all entries in this session.
|
|
67
|
+
*/
|
|
68
|
+
entryIds: ID[];
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* A replay entry.
|
|
72
|
+
* @category Replay
|
|
73
|
+
*/
|
|
74
|
+
export type ReplayEntry = {
|
|
75
|
+
/**
|
|
76
|
+
* The ID of the entry.
|
|
77
|
+
*/
|
|
78
|
+
id: ID;
|
|
79
|
+
/**
|
|
80
|
+
* The ID of the session this entry belongs to.
|
|
81
|
+
*/
|
|
82
|
+
sessionId: ID;
|
|
83
|
+
/**
|
|
84
|
+
* The ID of the request associated with this entry, if any.
|
|
85
|
+
*/
|
|
86
|
+
requestId?: ID;
|
|
65
87
|
};
|
|
66
88
|
/**
|
|
67
89
|
* A collection in Replay.
|
|
@@ -176,3 +198,23 @@ export type CurrentReplaySessionChangeEvent = {
|
|
|
176
198
|
*/
|
|
177
199
|
sessionId: ID | undefined;
|
|
178
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,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.
|
|
@@ -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,32 @@ 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
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Event fired when the current scope changes.
|
|
46
|
+
* @category Scopes
|
|
47
|
+
*/
|
|
48
|
+
export type CurrentScopeChangeEvent = {
|
|
49
|
+
/**
|
|
50
|
+
* The ID of the newly selected scope, or undefined if no scope is selected.
|
|
51
|
+
*/
|
|
52
|
+
scopeId: ID | undefined;
|
|
53
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent } from "./slots";
|
|
2
|
+
/**
|
|
3
|
+
* The slots in the Search UI.
|
|
4
|
+
* @category Search
|
|
5
|
+
*/
|
|
6
|
+
export declare const SearchSlot: {
|
|
7
|
+
/**
|
|
8
|
+
* The primary slot in the search toolbar.
|
|
9
|
+
*/
|
|
10
|
+
readonly ToolbarPrimary: "search-toolbar-primary";
|
|
11
|
+
};
|
|
12
|
+
export type SearchSlot = (typeof SearchSlot)[keyof typeof SearchSlot];
|
|
13
|
+
export type SearchSlotContent = {
|
|
14
|
+
[SearchSlot.ToolbarPrimary]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
|
|
15
|
+
};
|
|
@@ -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;
|