@caido/sdk-frontend 0.55.4-beta.7 → 0.56.0

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.
@@ -1,7 +1,6 @@
1
1
  export { FooterSlot, type FooterSlotContent } from "./types/footer";
2
2
  export type { DialogOptions } from "./types/window";
3
3
  export type { _AnalyticsSDK } from "./private/analytics";
4
- export type { MessageViewModeOptions, StreamWsMessageMeta, } from "./types/websocket";
5
4
  export type { CommandContext, CommandContextRequest, CommandContextRequestRow, CommandContextResponse, CommandContextBase, } from "./types/commands";
6
5
  export type { MenuItem } from "./types/menu";
7
6
  export { type ReplayTab, type ReplaySession, type ReplayEntry, type ReplayCollection, type SendRequestOptions, ReplaySlot, type ReplaySlotContent, type RequestSource, type CurrentReplaySessionChangeEvent, } from "./types/replay";
@@ -10,12 +9,12 @@ export type { SitemapEntry, SitemapRootEntry, ChildState, } from "./types/sitema
10
9
  export { SearchSlot, type SearchSlotContent } from "./types/search";
11
10
  export type { HostedFile } from "./types/files";
12
11
  export { FilterSlot, type Filter, type FilterSlotContent, type CurrentFilterChangeEvent, } from "./types/filter";
13
- export type { HTTPQL, StreamQL, ID, ComponentDefinition, Selection, QueryInput, } from "./types/utils";
12
+ export type { HTTPQL, ID, ComponentDefinition, Selection } from "./types/utils";
14
13
  export type { JSONValue, JSONCompatible } from "./types/json";
15
14
  export type { SlotContent, ButtonSlotContent, CustomSlotContent, CommandSlotContent, } from "./types/slots";
16
15
  export type { RequestViewModeOptions, RequestFull, RequestDraft, RequestMeta, } from "./types/request";
17
16
  export type { ResponseViewModeOptions, ResponseFull } from "./types/response";
18
- export type { CurrentMatchReplaceRuleChangeEvent, MatchReplaceRule, MatchReplaceCollection, MatchReplaceSection, MatchReplaceSectionRequestAll, MatchReplaceSectionRequestBody, MatchReplaceSectionRequestFirstLine, MatchReplaceSectionRequestHeader, MatchReplaceSectionRequestMethod, MatchReplaceSectionRequestPath, MatchReplaceSectionRequestQuery, MatchReplaceSectionRequestSNI, MatchReplaceSectionResponseAll, MatchReplaceSectionResponseBody, MatchReplaceSectionResponseFirstLine, MatchReplaceSectionResponseHeader, MatchReplaceSectionResponseStatusCode, MatchReplaceOperationStatusCode, MatchReplaceOperationStatusCodeUpdate, MatchReplaceOperationQuery, MatchReplaceOperationQueryRaw, MatchReplaceOperationQueryAdd, MatchReplaceOperationQueryRemove, MatchReplaceOperationQueryUpdate, MatchReplaceOperationPath, MatchReplaceOperationPathRaw, MatchReplaceOperationAll, MatchReplaceOperationAllRaw, MatchReplaceOperationMethod, MatchReplaceOperationMethodUpdate, MatchReplaceOperationHeader, MatchReplaceOperationHeaderRaw, MatchReplaceOperationHeaderAdd, MatchReplaceOperationHeaderRemove, MatchReplaceOperationHeaderUpdate, MatchReplaceOperationBody, MatchReplaceOperationBodyRaw, MatchReplaceOperationFirstLine, MatchReplaceOperationFirstLineRaw, MatchReplaceOperationSNI, MatchReplaceOperationSNIRaw, MatchReplaceReplacer, MatchReplaceReplacerTerm, MatchReplaceReplacerWorkflow, MatchReplaceMatcherName, MatchReplaceMatcherRaw, MatchReplaceMatcherRawFull, MatchReplaceMatcherRawRegex, MatchReplaceMatcherRawValue, MatchReplaceSectionResponseWebsocket, MatchReplaceSectionRequestWebsocket, MatchReplaceOperationWebsocket, MatchReplaceOperationWebsocketRaw, } from "./types/matchReplace";
17
+ 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";
19
18
  export { MatchReplaceSlot, type MatchReplaceSlotContent, } from "./types/matchReplace";
20
19
  export { ScopeSlot, type CurrentScopeChangeEvent, type Scope, type ScopeSlotContent, } from "./types/scopes";
21
20
  export { HTTPHistorySlot, type HTTPHistorySlotContent, } from "./types/httpHistory";
@@ -29,7 +29,6 @@ import type { SidebarSDK } from "./sidebar";
29
29
  import type { SitemapSDK } from "./sitemap";
30
30
  import type { StorageSDK } from "./storage";
31
31
  import type { UISDK } from "./ui";
32
- import type { WebsocketSDK } from "./websocket";
33
32
  import type { WindowSDK } from "./window";
34
33
  import type { WorkflowSDK } from "./workflows";
35
34
  /**
@@ -161,10 +160,6 @@ export type API<T extends BackendEndpoints = Record<string, never>, E extends Ba
161
160
  * Utilities to interact with the settings page.
162
161
  */
163
162
  settings: SettingsSDK;
164
- /**
165
- * Utilities to interact with the Websocket page.
166
- */
167
- websocket: WebsocketSDK;
168
163
  /**
169
164
  * @private
170
165
  * Utilities to track analytics events.
@@ -1,6 +1,6 @@
1
1
  import { type CurrentMatchReplaceRuleChangeEvent, type MatchReplaceCollection, type MatchReplaceRule, type MatchReplaceSection, type MatchReplaceSlotContent, type Source } from "../types/matchReplace";
2
2
  import { type DefineAddToSlotFn } from "../types/slots";
3
- import type { AddIndicatorOptions, ID, Indicator, ListenerHandle, QueryInput } from "../types/utils";
3
+ import type { AddIndicatorOptions, HTTPQL, ID, Indicator, ListenerHandle } from "../types/utils";
4
4
  /**
5
5
  * Utilities to interact with the Match and Replace page.
6
6
  * @category Match and Replace
@@ -73,13 +73,13 @@ export type MatchReplaceSDK = {
73
73
  * Create a rule.
74
74
  * @param options - The options for the rule.
75
75
  * @param options.name - The name of the rule.
76
- * @param options.query - The query to match the rule against.
76
+ * @param options.query - The HTTPQL query to match the rule against.
77
77
  * @param options.collectionId - The ID of the collection the rule belongs to.
78
78
  * @param options.sources - The sources the rule belongs to.
79
79
  */
80
80
  createRule: (options: {
81
81
  name: string;
82
- query: QueryInput;
82
+ query: HTTPQL;
83
83
  section: MatchReplaceSection;
84
84
  collectionId: ID;
85
85
  sources: Array<Source>;
@@ -89,13 +89,13 @@ export type MatchReplaceSDK = {
89
89
  * @param id - The ID of the rule.
90
90
  * @param options - The new values for the rule.
91
91
  * @param options.name - The new name of the rule.
92
- * @param options.query - The new query of the rule.
92
+ * @param options.query - The new HTTPQL query of the rule.
93
93
  * @param options.section - The new section of the rule.
94
94
  * @param options.sources - The new sources of the rule.
95
95
  */
96
96
  updateRule: (id: ID, options: {
97
97
  name: string;
98
- query?: QueryInput;
98
+ query?: HTTPQL;
99
99
  section: MatchReplaceSection;
100
100
  sources: Array<Source>;
101
101
  }) => Promise<MatchReplaceRule>;
@@ -159,12 +159,18 @@ export type ReplaySDK = {
159
159
  * This will open the session tab if not already open, set it as the selected session, and display the specified entry.
160
160
  * @param sessionId The ID of the session containing the entry.
161
161
  * @param entryId The ID of the entry to show.
162
+ * @param options The options for showing the entry.
163
+ * @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.
162
164
  * @example
163
165
  * ```ts
164
- * await sdk.replay.showEntry(sessionId, entryId);
166
+ * await sdk.replay.showEntry(sessionId, entryId, {
167
+ * overwriteDraft: true,
168
+ * });
165
169
  * ```
166
170
  */
167
- showEntry: (sessionId: ID, entryId: ID) => Promise<void>;
171
+ showEntry: (sessionId: ID, entryId: ID, options?: {
172
+ overwriteDraft?: boolean;
173
+ }) => Promise<void>;
168
174
  /**
169
175
  * Get a replay entry by its ID.
170
176
  * @param entryId The ID of the entry to get.
@@ -1,6 +1,6 @@
1
1
  import { type ID, type Selection } from "./utils";
2
2
  /**
3
- * Represents a {@link https://docs.caido.io/app/quickstart/findings.html|Finding}.
3
+ * Represents a {@link https://docs.caido.io/reference/features/logging/findings|Finding}.
4
4
  * @category Findings
5
5
  */
6
6
  export type Finding = {
@@ -48,7 +48,7 @@ export type Source = (typeof Source)[keyof typeof Source];
48
48
  * A discriminated union of all possible match and replace sections.
49
49
  * @category Match and Replace
50
50
  */
51
- export type MatchReplaceSection = MatchReplaceSectionRequestAll | MatchReplaceSectionRequestBody | MatchReplaceSectionRequestFirstLine | MatchReplaceSectionRequestHeader | MatchReplaceSectionRequestMethod | MatchReplaceSectionRequestPath | MatchReplaceSectionRequestQuery | MatchReplaceSectionRequestSNI | MatchReplaceSectionResponseAll | MatchReplaceSectionResponseBody | MatchReplaceSectionResponseFirstLine | MatchReplaceSectionResponseHeader | MatchReplaceSectionResponseStatusCode | MatchReplaceSectionResponseWebsocket | MatchReplaceSectionRequestWebsocket;
51
+ export type MatchReplaceSection = MatchReplaceSectionRequestAll | MatchReplaceSectionRequestBody | MatchReplaceSectionRequestFirstLine | MatchReplaceSectionRequestHeader | MatchReplaceSectionRequestMethod | MatchReplaceSectionRequestPath | MatchReplaceSectionRequestQuery | MatchReplaceSectionRequestSNI | MatchReplaceSectionResponseAll | MatchReplaceSectionResponseBody | MatchReplaceSectionResponseFirstLine | MatchReplaceSectionResponseHeader | MatchReplaceSectionResponseStatusCode;
52
52
  /**
53
53
  * A section for the entire request.
54
54
  * @category Match and Replace
@@ -100,36 +100,6 @@ export type MatchReplaceOperationStatusCodeUpdate = {
100
100
  kind: "OperationStatusCodeUpdate";
101
101
  replacer: MatchReplaceReplacer;
102
102
  };
103
- /**
104
- * A section for the response websocket.
105
- * @category Match and Replace
106
- */
107
- export type MatchReplaceSectionResponseWebsocket = {
108
- kind: "SectionResponseWebsocket";
109
- operation: MatchReplaceOperationWebsocket;
110
- };
111
- /**
112
- * A section for the request websocket.
113
- * @category Match and Replace
114
- */
115
- export type MatchReplaceSectionRequestWebsocket = {
116
- kind: "SectionRequestWebsocket";
117
- operation: MatchReplaceOperationWebsocket;
118
- };
119
- /**
120
- * An operation for the response websocket section.
121
- * @category Match and Replace
122
- */
123
- export type MatchReplaceOperationWebsocket = KeepOperation<MatchReplaceOperationWebsocketRaw>;
124
- /**
125
- * A raw operation for the response websocket section.
126
- * @category Match and Replace
127
- */
128
- export type MatchReplaceOperationWebsocketRaw = {
129
- kind: "OperationWebsocketRaw";
130
- matcher: MatchReplaceMatcherRaw;
131
- replacer: MatchReplaceReplacer;
132
- };
133
103
  /**
134
104
  * A section for the request query string.
135
105
  * @category Match and Replace
@@ -1,28 +1,5 @@
1
1
  import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent } from "./slots";
2
2
  import { type ID, type Selection } from "./utils";
3
- /**
4
- * The connection information to use for the request.
5
- * @category Replay
6
- */
7
- type ConnectionInfo = {
8
- /**
9
- * The host to use for the request.
10
- */
11
- host: string;
12
- /**
13
- * The port to use for the request.
14
- */
15
- port: number;
16
- /**
17
- * Whether the request is TLS.
18
- */
19
- isTLS: boolean;
20
- /**
21
- * The SNI to use for the request.
22
- * If not provided, the SNI will be inferred from the host.
23
- */
24
- SNI?: string;
25
- };
26
3
  /**
27
4
  * The slots in the Replay UI.
28
5
  * @category Replay
@@ -131,6 +108,49 @@ export type ReplayCollection = {
131
108
  * @category Replay
132
109
  */
133
110
  export type SendRequestOptions = {
111
+ /**
112
+ * The connection information to use for the request.
113
+ */
114
+ connectionInfo: {
115
+ /**
116
+ * The host to use for the request.
117
+ */
118
+ host: string;
119
+ /**
120
+ * The port to use for the request.
121
+ */
122
+ port: number;
123
+ /**
124
+ * Whether the request is TLS.
125
+ */
126
+ isTLS: boolean;
127
+ /**
128
+ * The SNI to use for the request.
129
+ * If not provided, the SNI will be inferred from the host.
130
+ */
131
+ SNI?: string;
132
+ };
133
+ /**
134
+ * The raw request to send.
135
+ */
136
+ raw: string;
137
+ /**
138
+ * Whether to update the content length automatically to match the body.
139
+ * Defaults to true.
140
+ */
141
+ updateContentLength?: boolean;
142
+ /**
143
+ * Whether to force close the connection by setting Connection: close header.
144
+ * Defaults to true.
145
+ */
146
+ connectionClose?: boolean;
147
+ /**
148
+ * Whether to overwrite the editor's draft content.
149
+ * If true, draft content will be overwritten with the new request.
150
+ * If false, the draft will be kept.
151
+ * Defaults to true.
152
+ */
153
+ overwriteDraft?: boolean;
134
154
  /**
135
155
  * Whether to send the request in the background without updating the UI.
136
156
  * If true, the request will not update the UI.
@@ -163,7 +183,7 @@ export type SendRequestOptions = {
163
183
  export type RequestSource = {
164
184
  type: "Raw";
165
185
  raw: string;
166
- connectionInfo: ConnectionInfo;
186
+ connectionInfo: SendRequestOptions["connectionInfo"];
167
187
  } | {
168
188
  type: "ID";
169
189
  id: string;
@@ -14,21 +14,6 @@ export type ID = string & {
14
14
  export type HTTPQL = string & {
15
15
  __httpql?: never;
16
16
  };
17
- /**
18
- * A STREAMQL expression.
19
- * @example `ws.raw.cont:"hello"`
20
- * @category Utils
21
- */
22
- export type StreamQL = string & {
23
- __streamql?: never;
24
- };
25
- /**
26
- * A query input.
27
- * @example `"req.method.eq:'POST'"`
28
- * @example `"ws.raw.cont:'hello'"`
29
- * @category Utils
30
- */
31
- export type QueryInput = HTTPQL | StreamQL;
32
17
  /**
33
18
  * A {@link https://fontawesome.com/icons|FontAwesome} icon class.
34
19
  * @example "fas fa-rocket"
@@ -1,4 +1,3 @@
1
- import type { As, ComponentDefinition, ID, Prettify } from "./utils";
2
1
  /**
3
2
  * Certificate page context.
4
3
  * @category Websockets
@@ -6,36 +5,3 @@ import type { As, ComponentDefinition, ID, Prettify } from "./utils";
6
5
  export type WebsocketPageContext = {
7
6
  kind: "Websocket";
8
7
  };
9
- /**
10
- * A complete message with all metadata and raw content.
11
- * @category Websockets
12
- */
13
- export type StreamWsMessageMeta = Prettify<As<"StreamWsMessageMeta"> & {
14
- id: ID;
15
- streamId: ID;
16
- head: {
17
- id: ID;
18
- length: number;
19
- direction: "CLIENT" | "SERVER";
20
- format: "BINARY" | "CLOSE" | "PING" | "PONG" | "TEXT";
21
- createdAt: Date;
22
- };
23
- }>;
24
- /**
25
- * Options for defining a custom message view mode.
26
- * @category Websockets
27
- */
28
- export type MessageViewModeOptions = {
29
- /**
30
- * The label of the view mode.
31
- */
32
- label: string;
33
- /**
34
- * The component to render when the view mode is selected.
35
- */
36
- view: ComponentDefinition;
37
- /**
38
- * A function that determines if the view mode should be shown for a given message.
39
- */
40
- when?: (message: StreamWsMessageMeta) => boolean;
41
- };
@@ -1,12 +0,0 @@
1
- import type { MessageViewModeOptions } from "../types/websocket";
2
- /**
3
- * Utilities to interact with websockets
4
- * @category Websockets
5
- */
6
- export type WebsocketSDK = {
7
- /**
8
- * Add a custom message view mode.
9
- * @param options The view mode options.
10
- */
11
- addMessageViewMode: (options: MessageViewModeOptions) => void;
12
- };