@caido/sdk-frontend 0.53.2-beta.4 → 0.53.2-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caido/sdk-frontend",
3
- "version": "0.53.2-beta.4",
3
+ "version": "0.53.2-beta.5",
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/",
@@ -4,13 +4,15 @@ export type { CommandContext, CommandContextRequest, CommandContextRequestRow, C
4
4
  export type { MenuItem } from "./types/menu";
5
5
  export { type ReplayTab, type ReplaySession, type ReplayEntry, type ReplayCollection, type SendRequestOptions, ReplaySlot, type ReplaySlotContent, type RequestSource, type CurrentReplaySessionChangeEvent, } from "./types/replay";
6
6
  export type { HostedFile } from "./types/files";
7
- export type { Filter } from "./types/filter";
7
+ export { FilterSlot, type Filter, type FilterSlotContent, } from "./types/filter";
8
8
  export type { HTTPQL, ID, ComponentDefinition } from "./types/utils";
9
9
  export type { JSONValue, JSONCompatible } from "./types/json";
10
10
  export type { SlotContent, ButtonSlotContent, CustomSlotContent, CommandSlotContent, } from "./types/slots";
11
11
  export type { RequestViewModeOptions, RequestFull, RequestDraft, RequestMeta, } from "./types/request";
12
12
  export type { MatchReplaceRule, MatchReplaceCollection, MatchReplaceSection, MatchReplaceSectionRequestAll, MatchReplaceSectionRequestBody, MatchReplaceSectionRequestFirstLine, MatchReplaceSectionRequestHeader, MatchReplaceSectionRequestMethod, MatchReplaceSectionRequestPath, MatchReplaceSectionRequestQuery, MatchReplaceSectionRequestSNI, MatchReplaceSectionResponseAll, MatchReplaceSectionResponseBody, MatchReplaceSectionResponseFirstLine, MatchReplaceSectionResponseHeader, MatchReplaceSectionResponseStatusCode, MatchReplaceOperationStatusCode, MatchReplaceOperationStatusCodeUpdate, MatchReplaceOperationQuery, MatchReplaceOperationQueryRaw, MatchReplaceOperationQueryAdd, MatchReplaceOperationQueryRemove, MatchReplaceOperationQueryUpdate, MatchReplaceOperationPath, MatchReplaceOperationPathRaw, MatchReplaceOperationAll, MatchReplaceOperationAllRaw, MatchReplaceOperationMethod, MatchReplaceOperationMethodUpdate, MatchReplaceOperationHeader, MatchReplaceOperationHeaderRaw, MatchReplaceOperationHeaderAdd, MatchReplaceOperationHeaderRemove, MatchReplaceOperationHeaderUpdate, MatchReplaceOperationBody, MatchReplaceOperationBodyRaw, MatchReplaceOperationFirstLine, MatchReplaceOperationFirstLineRaw, MatchReplaceOperationSNI, MatchReplaceOperationSNIRaw, MatchReplaceReplacer, MatchReplaceReplacerTerm, MatchReplaceReplacerWorkflow, MatchReplaceMatcherName, MatchReplaceMatcherRaw, MatchReplaceMatcherRawFull, MatchReplaceMatcherRawRegex, MatchReplaceMatcherRawValue, } from "./types/matchReplace";
13
- export type { Scope } from "./types/scopes";
13
+ export { MatchReplaceSlot, type MatchReplaceSlotContent, } from "./types/matchReplace";
14
+ export { ScopeSlot, type Scope, type ScopeSlotContent } from "./types/scopes";
15
+ export { HTTPHistorySlot, type HTTPHistorySlotContent, } from "./types/httpHistory";
14
16
  export type { EnvironmentVariable } from "./types/environment";
15
17
  export type { Workflow, WorkflowKind, OnCreatedWorkflowCallback, OnUpdatedWorkflowCallback, OnDeletedWorkflowCallback, } from "./types/workflows";
16
18
  export type { ListenerHandle } from "./types/utils";
@@ -1,4 +1,5 @@
1
- import { type Filter } from "../types/filter";
1
+ import { type Filter, type FilterSlotContent } from "../types/filter";
2
+ import { type DefineAddToSlotFn } from "../types/slots";
2
3
  import type { HTTPQL, ID } from "../types/utils";
3
4
  /**
4
5
  * SDK for interacting with the Filters page.
@@ -45,4 +46,32 @@ export type FiltersSDK = {
45
46
  * @param id The ID of the filter to delete.
46
47
  */
47
48
  delete: (id: ID) => Promise<void>;
49
+ /**
50
+ * Add a component to a slot.
51
+ * @param slot The slot to add the component to.
52
+ * @param content The content to add to the slot.
53
+ * @example
54
+ * ```ts
55
+ * sdk.filters.addToSlot(FilterSlot.UpdateHeader, {
56
+ * type: "Button",
57
+ * label: "My Button",
58
+ * icon: "my-icon",
59
+ * onClick: () => {
60
+ * console.log("Button clicked");
61
+ * },
62
+ * });
63
+ *
64
+ * sdk.filters.addToSlot(FilterSlot.CreateHeader, {
65
+ * type: "Custom",
66
+ * definition: MyComponent,
67
+ * });
68
+ *
69
+ * sdk.filters.addToSlot(FilterSlot.UpdateHeader, {
70
+ * type: "Command",
71
+ * commandId: "my-command",
72
+ * icon: "my-icon",
73
+ * });
74
+ * ```
75
+ */
76
+ addToSlot: DefineAddToSlotFn<FilterSlotContent>;
48
77
  };
@@ -1,5 +1,7 @@
1
1
  import type { Extension } from "@codemirror/state";
2
+ import type { HTTPHistorySlotContent } from "../types/httpHistory";
2
3
  import type { RequestViewModeOptions } from "../types/request";
4
+ import { type DefineAddToSlotFn } from "../types/slots";
3
5
  import type { HTTPQL, ID } from "../types/utils";
4
6
  /**
5
7
  * Utilities to interact with the HTTP History page.
@@ -46,4 +48,32 @@ export type HTTPHistorySDK = {
46
48
  * @param id The ID of the entry to scroll to.
47
49
  */
48
50
  scrollTo: (id: ID) => void;
51
+ /**
52
+ * Add a component to a slot.
53
+ * @param slot The slot to add the component to.
54
+ * @param content The content to add to the slot.
55
+ * @example
56
+ * ```ts
57
+ * sdk.httpHistory.addToSlot(HTTPHistorySlot.ToolbarPrimary, {
58
+ * type: "Button",
59
+ * label: "My Button",
60
+ * icon: "my-icon",
61
+ * onClick: () => {
62
+ * console.log("Button clicked");
63
+ * },
64
+ * });
65
+ *
66
+ * sdk.httpHistory.addToSlot(HTTPHistorySlot.ToolbarPrimary, {
67
+ * type: "Custom",
68
+ * definition: MyComponent,
69
+ * });
70
+ *
71
+ * sdk.httpHistory.addToSlot(HTTPHistorySlot.ToolbarPrimary, {
72
+ * type: "Command",
73
+ * commandId: "my-command",
74
+ * icon: "my-icon",
75
+ * });
76
+ * ```
77
+ */
78
+ addToSlot: DefineAddToSlotFn<HTTPHistorySlotContent>;
49
79
  };
@@ -1,4 +1,5 @@
1
- import { type MatchReplaceCollection, type MatchReplaceRule, type MatchReplaceSection, type Source } from "../types/matchReplace";
1
+ import { type MatchReplaceCollection, type MatchReplaceRule, type MatchReplaceSection, type MatchReplaceSlotContent, type Source } from "../types/matchReplace";
2
+ import { type DefineAddToSlotFn } from "../types/slots";
2
3
  import type { HTTPQL, ID } from "../types/utils";
3
4
  /**
4
5
  * Utilities to interact with the Match and Replace page.
@@ -88,4 +89,32 @@ export type MatchReplaceSDK = {
88
89
  * @param id - The ID of the rule.
89
90
  */
90
91
  deleteRule: (id: ID) => Promise<void>;
92
+ /**
93
+ * Add a component to a slot.
94
+ * @param slot The slot to add the component to.
95
+ * @param content The content to add to the slot.
96
+ * @example
97
+ * ```ts
98
+ * sdk.matchReplace.addToSlot(MatchReplaceSlot.UpdateHeader, {
99
+ * type: "Button",
100
+ * label: "My Button",
101
+ * icon: "my-icon",
102
+ * onClick: () => {
103
+ * console.log("Button clicked");
104
+ * },
105
+ * });
106
+ *
107
+ * sdk.matchReplace.addToSlot(MatchReplaceSlot.CreateHeader, {
108
+ * type: "Custom",
109
+ * definition: MyComponent,
110
+ * });
111
+ *
112
+ * sdk.matchReplace.addToSlot(MatchReplaceSlot.UpdateHeader, {
113
+ * type: "Command",
114
+ * commandId: "my-command",
115
+ * icon: "my-icon",
116
+ * });
117
+ * ```
118
+ */
119
+ addToSlot: DefineAddToSlotFn<MatchReplaceSlotContent>;
91
120
  };
@@ -1,4 +1,5 @@
1
- import { type Scope } from "../types/scopes";
1
+ import { type Scope, type ScopeSlotContent } from "../types/scopes";
2
+ import { type DefineAddToSlotFn } from "../types/slots";
2
3
  import type { ID } from "../types/utils";
3
4
  /**
4
5
  * Utilities to interact with scopes
@@ -52,4 +53,32 @@ export type ScopesSDK = {
52
53
  * @returns Whether the scope was deleted.
53
54
  */
54
55
  deleteScope: (id: ID) => Promise<boolean>;
56
+ /**
57
+ * Add a component to a slot.
58
+ * @param slot The slot to add the component to.
59
+ * @param content The content to add to the slot.
60
+ * @example
61
+ * ```ts
62
+ * sdk.scopes.addToSlot(ScopeSlot.UpdateHeader, {
63
+ * type: "Button",
64
+ * label: "My Button",
65
+ * icon: "my-icon",
66
+ * onClick: () => {
67
+ * console.log("Button clicked");
68
+ * },
69
+ * });
70
+ *
71
+ * sdk.scopes.addToSlot(ScopeSlot.CreateHeader, {
72
+ * type: "Custom",
73
+ * definition: MyComponent,
74
+ * });
75
+ *
76
+ * sdk.scopes.addToSlot(ScopeSlot.UpdateHeader, {
77
+ * type: "Command",
78
+ * commandId: "my-command",
79
+ * icon: "my-icon",
80
+ * });
81
+ * ```
82
+ */
83
+ addToSlot: DefineAddToSlotFn<ScopeSlotContent>;
55
84
  };
@@ -1,3 +1,4 @@
1
+ import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent } from "./slots";
1
2
  import { type HTTPQL, type ID } from "./utils";
2
3
  /**
3
4
  * Represents a filter.
@@ -22,3 +23,22 @@ export type Filter = {
22
23
  */
23
24
  query: HTTPQL;
24
25
  };
26
+ /**
27
+ * The slots in the Filters UI.
28
+ * @category Filters
29
+ */
30
+ export declare const FilterSlot: {
31
+ /**
32
+ * The header area of the preset form update component.
33
+ */
34
+ readonly UpdateHeader: "update-header";
35
+ /**
36
+ * The header area of the preset form create component.
37
+ */
38
+ readonly CreateHeader: "create-header";
39
+ };
40
+ export type FilterSlot = (typeof FilterSlot)[keyof typeof FilterSlot];
41
+ export type FilterSlotContent = {
42
+ [FilterSlot.UpdateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
43
+ [FilterSlot.CreateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
44
+ };
@@ -0,0 +1,15 @@
1
+ import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent } from "./slots";
2
+ /**
3
+ * The slots in the HTTP History UI.
4
+ * @category HTTP History
5
+ */
6
+ export declare const HTTPHistorySlot: {
7
+ /**
8
+ * The toolbar.
9
+ */
10
+ readonly ToolbarPrimary: "toolbar-primary";
11
+ };
12
+ export type HTTPHistorySlot = (typeof HTTPHistorySlot)[keyof typeof HTTPHistorySlot];
13
+ export type HTTPHistorySlotContent = {
14
+ [HTTPHistorySlot.ToolbarPrimary]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
15
+ };
@@ -1,3 +1,4 @@
1
+ import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent } from "./slots";
1
2
  import { type HTTPQL, type ID } from "./utils";
2
3
  /**
3
4
  * A rule in Match and Replace.
@@ -270,4 +271,23 @@ export type MatchReplaceCollection = {
270
271
  type KeepOperation<T> = T & {
271
272
  __operation?: never;
272
273
  };
274
+ /**
275
+ * The slots in the Match and Replace UI.
276
+ * @category Match and Replace
277
+ */
278
+ export declare const MatchReplaceSlot: {
279
+ /**
280
+ * The header area of the rule form update component.
281
+ */
282
+ readonly UpdateHeader: "update-header";
283
+ /**
284
+ * The header area of the rule form create component.
285
+ */
286
+ readonly CreateHeader: "create-header";
287
+ };
288
+ export type MatchReplaceSlot = (typeof MatchReplaceSlot)[keyof typeof MatchReplaceSlot];
289
+ export type MatchReplaceSlotContent = {
290
+ [MatchReplaceSlot.UpdateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
291
+ [MatchReplaceSlot.CreateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
292
+ };
273
293
  export {};
@@ -1,3 +1,4 @@
1
+ import { type ButtonSlotContent, type CommandSlotContent, type CustomSlotContent } from "./slots";
1
2
  import { type ID } from "./utils";
2
3
  /**
3
4
  * Represents a scope.
@@ -21,3 +22,22 @@ export type Scope = {
21
22
  */
22
23
  denylist: string[];
23
24
  };
25
+ /**
26
+ * The slots in the Scopes UI.
27
+ * @category Scopes
28
+ */
29
+ export declare const ScopeSlot: {
30
+ /**
31
+ * The header area of the preset form update component, to the left of the ScopeTooltip.
32
+ */
33
+ readonly UpdateHeader: "update-header";
34
+ /**
35
+ * The header area of the preset form create component, to the left of the ScopeTooltip.
36
+ */
37
+ readonly CreateHeader: "create-header";
38
+ };
39
+ export type ScopeSlot = (typeof ScopeSlot)[keyof typeof ScopeSlot];
40
+ export type ScopeSlotContent = {
41
+ [ScopeSlot.UpdateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
42
+ [ScopeSlot.CreateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
43
+ };