@caido/sdk-frontend 0.51.1-beta.0 → 0.51.1-beta.1

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.51.1-beta.0",
3
+ "version": "0.51.1-beta.1",
4
4
  "description": "Typing for the Caido Frontend SDK",
5
5
  "author": "Caido Labs Inc. <dev@caido.io>",
6
6
  "license": "MIT",
@@ -1,6 +1,6 @@
1
1
  export { FooterSlot, type FooterSlotContent } from "./types/footer";
2
2
  export type { DialogOptions } from "./types/window";
3
- export type { CommandContext } from "./types/commands";
3
+ export type { CommandContext, CommandContextRequest, CommandContextRequestRow, CommandContextResponse, CommandContextBase, } from "./types/commands";
4
4
  export type { MenuItem } from "./types/menu";
5
5
  export { type ReplayTab, type ReplaySession, type ReplayCollection, type SendRequestOptions, ReplaySlot, type ReplaySlotContent, type RequestSource, } from "./types/replay";
6
6
  export type { HostedFile } from "./types/files";
@@ -8,7 +8,7 @@ export type { Filter } 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
- export type { RequestViewModeOptions } from "./types/request";
11
+ export type { RequestViewModeOptions, RequestFull, RequestDraft, RequestMeta, } from "./types/request";
12
12
  export type { MatchReplaceRule, MatchReplaceCollection, MatchReplaceSection, MatchReplaceSectionRequestBody, MatchReplaceSectionRequestFirstLine, MatchReplaceSectionRequestHeader, MatchReplaceSectionRequestMethod, MatchReplaceSectionRequestPath, MatchReplaceSectionRequestQuery, MatchReplaceSectionResponseBody, MatchReplaceSectionResponseFirstLine, MatchReplaceSectionResponseHeader, MatchReplaceSectionResponseStatusCode, MatchReplaceOperationStatusCode, MatchReplaceOperationStatusCodeUpdate, MatchReplaceOperationQuery, MatchReplaceOperationQueryRaw, MatchReplaceOperationQueryAdd, MatchReplaceOperationQueryRemove, MatchReplaceOperationQueryUpdate, MatchReplaceOperationPath, MatchReplaceOperationPathRaw, MatchReplaceOperationMethod, MatchReplaceOperationMethodUpdate, MatchReplaceOperationHeader, MatchReplaceOperationHeaderRaw, MatchReplaceOperationHeaderAdd, MatchReplaceOperationHeaderRemove, MatchReplaceOperationHeaderUpdate, MatchReplaceOperationBody, MatchReplaceOperationBodyRaw, MatchReplaceOperationFirstLine, MatchReplaceOperationFirstLineRaw, MatchReplaceReplacer, MatchReplaceReplacerTerm, MatchReplaceReplacerWorkflow, MatchReplaceMatcherName, MatchReplaceMatcherRaw, MatchReplaceMatcherRawFull, MatchReplaceMatcherRawRegex, MatchReplaceMatcherRawValue, } from "./types/matchReplace";
13
13
  export type { Scope } from "./types/scopes";
14
14
  export type { EnvironmentVariable } from "./types/environment";
@@ -1,3 +1,4 @@
1
+ import { type RequestDraft, type RequestFull, type RequestMeta } from "./request";
1
2
  import { type ID } from "./utils";
2
3
  /**
3
4
  * A unique command identifier.
@@ -16,48 +17,31 @@ export type CommandContext = CommandContextBase | CommandContextRequestRow | Com
16
17
  * This context is used for commands that are not executed in a specific context, such as via shortcuts and the command palette.
17
18
  * @category Commands
18
19
  */
19
- type CommandContextBase = {
20
+ export type CommandContextBase = {
20
21
  type: "BaseContext";
21
22
  };
22
23
  /**
23
24
  * The context for a command that is executed on a row in the request table.
24
25
  * @category Commands
25
26
  */
26
- type CommandContextRequestRow = {
27
+ export type CommandContextRequestRow = {
27
28
  type: "RequestRowContext";
28
29
  /**
29
30
  * The requests that are selected in the request table.
30
31
  */
31
- requests: {
32
- id: ID;
33
- host: string;
34
- port: number;
35
- path: string;
36
- query: string;
37
- isTls: boolean;
38
- streamId?: ID;
39
- }[];
32
+ requests: RequestMeta[];
40
33
  };
41
34
  /**
42
35
  * The context for a command that is executed on a request pane.
43
36
  * @category Commands
44
37
  */
45
- type CommandContextRequest = {
38
+ export type CommandContextRequest = {
46
39
  type: "RequestContext";
47
40
  /**
48
41
  * The request that is currently open in the request pane.
49
42
  * If the request has not yet been saved in the database, the id will be undefined.
50
43
  */
51
- request: {
52
- id: ID | undefined;
53
- host: string;
54
- port: number;
55
- path: string;
56
- query: string;
57
- isTls: boolean;
58
- raw: string;
59
- streamId?: ID;
60
- };
44
+ request: RequestDraft | RequestFull;
61
45
  /**
62
46
  * The currently selected text in the request pane.
63
47
  */
@@ -67,20 +51,12 @@ type CommandContextRequest = {
67
51
  * The context for a command that is executed on a response pane.
68
52
  * @category Commands
69
53
  */
70
- type CommandContextResponse = {
54
+ export type CommandContextResponse = {
71
55
  type: "ResponseContext";
72
56
  /**
73
57
  * The request that is associated with the response.
74
58
  */
75
- request: {
76
- id: ID;
77
- host: string;
78
- port: number;
79
- path: string;
80
- query: string;
81
- isTls: boolean;
82
- streamId?: ID;
83
- };
59
+ request: RequestMeta;
84
60
  /**
85
61
  * The response that is currently open in the response pane.
86
62
  */
@@ -95,4 +71,3 @@ type CommandContextResponse = {
95
71
  */
96
72
  selection: string;
97
73
  };
98
- export {};
@@ -1,4 +1,31 @@
1
- import { type ComponentDefinition } from "./utils";
1
+ import { type As, type ComponentDefinition, type ID, type Prettify } from "./utils";
2
+ export type RequestDraft = Prettify<As<"RequestDraft"> & {
3
+ host: string;
4
+ port: number;
5
+ path: string;
6
+ query: string;
7
+ isTls: boolean;
8
+ raw: string;
9
+ }>;
10
+ export type RequestMeta = Prettify<As<"RequestMeta"> & {
11
+ id: ID;
12
+ host: string;
13
+ port: number;
14
+ path: string;
15
+ query: string;
16
+ isTls: boolean;
17
+ streamId: ID | undefined;
18
+ }>;
19
+ export type RequestFull = Prettify<As<"RequestFull"> & {
20
+ id: ID;
21
+ host: string;
22
+ port: number;
23
+ path: string;
24
+ query: string;
25
+ isTls: boolean;
26
+ streamId: ID | undefined;
27
+ raw: string;
28
+ }>;
2
29
  export type RequestViewModeOptions = {
3
30
  /**
4
31
  * The label of the view mode.
@@ -38,3 +38,9 @@ export type ListenerHandle = {
38
38
  */
39
39
  stop: () => void;
40
40
  };
41
+ export type Prettify<T> = {
42
+ [K in keyof T]: T[K];
43
+ } & {};
44
+ export type As<TType extends string> = {
45
+ type: TType;
46
+ };