@caido/sdk-frontend 0.53.2-beta.8 → 0.53.2-beta.9

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.8",
3
+ "version": "0.53.2-beta.9",
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/",
@@ -5,14 +5,14 @@ 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 { SearchSlot, type SearchSlotContent } from "./types/search";
7
7
  export type { HostedFile } from "./types/files";
8
- export { FilterSlot, type Filter, type FilterSlotContent, } from "./types/filter";
8
+ export { FilterSlot, type Filter, type FilterSlotContent, CurrentFilterChangeEvent, } from "./types/filter";
9
9
  export type { HTTPQL, ID, ComponentDefinition } from "./types/utils";
10
10
  export type { JSONValue, JSONCompatible } from "./types/json";
11
11
  export type { SlotContent, ButtonSlotContent, CustomSlotContent, CommandSlotContent, } from "./types/slots";
12
12
  export type { RequestViewModeOptions, RequestFull, RequestDraft, RequestMeta, } from "./types/request";
13
- 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 { 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
14
  export { MatchReplaceSlot, type MatchReplaceSlotContent, } from "./types/matchReplace";
15
- export { ScopeSlot, type Scope, type ScopeSlotContent } from "./types/scopes";
15
+ export { ScopeSlot, type CurrentScopeChangeEvent, type Scope, type ScopeSlotContent, } from "./types/scopes";
16
16
  export { HTTPHistorySlot, type HTTPHistorySlotContent, } from "./types/httpHistory";
17
17
  export type { EnvironmentVariable } from "./types/environment";
18
18
  export type { Workflow, WorkflowKind, OnCreatedWorkflowCallback, OnUpdatedWorkflowCallback, OnDeletedWorkflowCallback, } from "./types/workflows";
@@ -1,6 +1,6 @@
1
- import { type Filter, type FilterSlotContent } from "../types/filter";
1
+ import { type CurrentFilterChangeEvent, type Filter, type FilterSlotContent } from "../types/filter";
2
2
  import { type DefineAddToSlotFn } from "../types/slots";
3
- import type { HTTPQL, ID } from "../types/utils";
3
+ import type { HTTPQL, ID, ListenerHandle } from "../types/utils";
4
4
  /**
5
5
  * SDK for interacting with the Filters page.
6
6
  * @category Filters
@@ -46,6 +46,27 @@ export type FiltersSDK = {
46
46
  * @param id The ID of the filter to delete.
47
47
  */
48
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;
49
70
  /**
50
71
  * Add a component to a slot.
51
72
  * @param slot The slot to add the component to.
@@ -1,6 +1,6 @@
1
- import { type MatchReplaceCollection, type MatchReplaceRule, type MatchReplaceSection, type MatchReplaceSlotContent, type Source } from "../types/matchReplace";
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 { HTTPQL, ID } from "../types/utils";
3
+ import type { HTTPQL, ID, ListenerHandle } from "../types/utils";
4
4
  /**
5
5
  * Utilities to interact with the Match and Replace page.
6
6
  * @category Match and Replace
@@ -48,6 +48,27 @@ export type MatchReplaceSDK = {
48
48
  * @param id - The ID of the rule, or undefined to clear the selection.
49
49
  */
50
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;
51
72
  /**
52
73
  * Create a rule.
53
74
  * @param options - The options for the rule.
@@ -1,6 +1,6 @@
1
- import { type Scope, type ScopeSlotContent } from "../types/scopes";
1
+ import { type CurrentScopeChangeEvent, type Scope, type ScopeSlotContent } from "../types/scopes";
2
2
  import { type DefineAddToSlotFn } from "../types/slots";
3
- import type { ID } from "../types/utils";
3
+ import type { ID, ListenerHandle } from "../types/utils";
4
4
  /**
5
5
  * Utilities to interact with scopes
6
6
  * @category Scopes
@@ -53,6 +53,27 @@ export type ScopesSDK = {
53
53
  * @returns Whether the scope was deleted.
54
54
  */
55
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;
56
77
  /**
57
78
  * Add a component to a slot.
58
79
  * @param slot The slot to add the component to.
@@ -46,3 +46,13 @@ export type FilterSlotContent = {
46
46
  [FilterSlot.UpdateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
47
47
  [FilterSlot.CreateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
48
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
+ };
@@ -422,4 +422,14 @@ export type MatchReplaceSlotContent = {
422
422
  [MatchReplaceSlot.UpdateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
423
423
  [MatchReplaceSlot.CreateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
424
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
+ };
425
435
  export {};
@@ -41,3 +41,13 @@ export type ScopeSlotContent = {
41
41
  [ScopeSlot.UpdateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
42
42
  [ScopeSlot.CreateHeader]: ButtonSlotContent | CustomSlotContent | CommandSlotContent;
43
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
+ };