@caido/sdk-frontend 0.44.2-beta.9 → 0.45.1-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caido/sdk-frontend",
3
- "version": "0.44.2-beta.9",
3
+ "version": "0.45.1-beta.0",
4
4
  "description": "Typing for the Caido Frontend SDK",
5
5
  "author": "Caido Labs Inc. <dev@caido.io>",
6
6
  "license": "MIT",
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Utilities to interact with the plugin's static assets.
3
+ * @category Files
4
+ */
5
+ export type AssetsSDK = {
6
+ /**
7
+ * Get a file from the assets folder.
8
+ * @returns The asset file.
9
+ */
10
+ get: (path: string) => Promise<Asset>;
11
+ };
12
+ /**
13
+ * A static asset.
14
+ * @category Files
15
+ */
16
+ type Asset = {
17
+ asReadableStream: () => ReadableStream;
18
+ asArrayBuffer: () => Promise<ArrayBuffer>;
19
+ asString: () => Promise<string>;
20
+ asJson: <T = unknown>() => Promise<T>;
21
+ };
22
+ export {};
@@ -9,4 +9,23 @@ export type EnvironmentSDK = {
9
9
  * @returns The value of the environment variable.
10
10
  */
11
11
  getVar: (name: string) => string | undefined;
12
+ /**
13
+ * Get all environment variables available in the global environment and the selected environment.
14
+ * @returns All environment variables.
15
+ */
16
+ getVars: () => EnvironmentVariable[];
17
+ };
18
+ export type EnvironmentVariable = {
19
+ /**
20
+ * The name of the environment variable.
21
+ */
22
+ name: string;
23
+ /**
24
+ * The value of the environment variable.
25
+ */
26
+ value: string;
27
+ /**
28
+ * Whether the environment variable is a secret.
29
+ */
30
+ isSecret: boolean;
12
31
  };
@@ -1,4 +1,4 @@
1
- import type { HTTPQL } from "./utils";
1
+ import type { HTTPQL, ID } from "./utils";
2
2
  /**
3
3
  * Utilities to interact with the HTTP History page.
4
4
  * @category HTTP History
@@ -14,4 +14,14 @@ export type HTTPHistorySDK = {
14
14
  * @returns The current HTTPQL query.
15
15
  */
16
16
  getQuery: () => HTTPQL;
17
+ /**
18
+ * Get the current scope ID.
19
+ * @returns The current scope ID.
20
+ */
21
+ getScopeId: () => ID | undefined;
22
+ /**
23
+ * Set the current scope.
24
+ * @param id The ID of the scope to set.
25
+ */
26
+ setScope: (id: ID | undefined) => Promise<void>;
17
27
  };
@@ -1,4 +1,5 @@
1
1
  import type { Sdk as GraphqlSDK } from "./__generated__/graphql-sdk";
2
+ import type { AssetsSDK } from "./assets";
2
3
  import type { BackendEndpoints, BackendEvents, BackendSDK } from "./backend";
3
4
  import type { CommandPaletteSDK } from "./commandPalette";
4
5
  import type { CommandsSDK } from "./commands";
@@ -7,6 +8,7 @@ import type { FilesSDK } from "./files";
7
8
  import type { FiltersSDK } from "./filters";
8
9
  import type { FindingsSDK } from "./findings";
9
10
  import type { HTTPHistorySDK } from "./httpHistory";
11
+ import type { InterceptSDK } from "./intercept";
10
12
  import type { MatchReplaceSDK } from "./matchReplace";
11
13
  import type { MenuSDK } from "./menu";
12
14
  import type { NavigationSDK } from "./navigation";
@@ -15,6 +17,7 @@ import type { ScopesSDK } from "./scopes";
15
17
  import type { SearchSDK } from "./search";
16
18
  import type { ShortcutsSDK } from "./shortcuts";
17
19
  import type { SidebarSDK } from "./sidebar";
20
+ import type { SitemapSDK } from "./sitemap";
18
21
  import type { StorageSDK } from "./storage";
19
22
  import type { UISDK } from "./ui";
20
23
  import type { WindowSDK } from "./window";
@@ -25,6 +28,8 @@ export type { HostedFile } from "./files";
25
28
  export type { Filter } from "./filters";
26
29
  export type { HTTPQL, ID } from "./utils";
27
30
  export type { MatchReplaceRule, MatchReplaceCollection, MatchReplaceStrategy, } from "./matchReplace";
31
+ export type { Scope } from "./scopes";
32
+ export type { EnvironmentVariable } from "./environment";
28
33
  /**
29
34
  * Utilities for frontend plugins.
30
35
  * @category SDK
@@ -70,6 +75,10 @@ export type API<T extends BackendEndpoints = Record<string, never>, E extends Ba
70
75
  * Utilities to interact with frontend-plugin storage.
71
76
  */
72
77
  storage: StorageSDK;
78
+ /**
79
+ * Utilities to interact with the plugin's static assets.
80
+ */
81
+ assets: AssetsSDK;
73
82
  /**
74
83
  * Utilities to interact with shortcuts.
75
84
  */
@@ -110,4 +119,12 @@ export type API<T extends BackendEndpoints = Record<string, never>, E extends Ba
110
119
  * Utilities to interact with the environment.
111
120
  */
112
121
  env: EnvironmentSDK;
122
+ /**
123
+ * Utilities to interact with the Sitemap page.
124
+ */
125
+ sitemap: SitemapSDK;
126
+ /**
127
+ * Utilities to interact with the Intercept page.
128
+ */
129
+ intercept: InterceptSDK;
113
130
  };
@@ -0,0 +1,17 @@
1
+ import type { ID } from "./utils";
2
+ /**
3
+ * Utilities to interact with the Intercept page.
4
+ * @category Intercept
5
+ */
6
+ export type InterceptSDK = {
7
+ /**
8
+ * Get the current scope ID.
9
+ * @returns The current scope ID.
10
+ */
11
+ getScopeId: () => ID | undefined;
12
+ /**
13
+ * Set the current scope.
14
+ * @param scopeId The ID of the scope to set.
15
+ */
16
+ setScope: (id: ID | undefined) => void;
17
+ };
@@ -56,7 +56,7 @@ export type ScopesSDK = {
56
56
  * Represents a scope.
57
57
  * @category Scopes
58
58
  */
59
- type Scope = {
59
+ export type Scope = {
60
60
  /**
61
61
  * The unique ID of the scope.
62
62
  */
@@ -74,4 +74,3 @@ type Scope = {
74
74
  */
75
75
  denylist: string[];
76
76
  };
77
- export {};
@@ -1,4 +1,4 @@
1
- import type { HTTPQL } from "./utils";
1
+ import type { HTTPQL, ID } from "./utils";
2
2
  /**
3
3
  * Utilities to interact with the Search page.
4
4
  * @category Search
@@ -14,4 +14,14 @@ export type SearchSDK = {
14
14
  * @returns The current HTTPQL query.
15
15
  */
16
16
  getQuery: () => HTTPQL;
17
+ /**
18
+ * Get the current scope ID.
19
+ * @returns The current scope ID.
20
+ */
21
+ getScopeId: () => ID | undefined;
22
+ /**
23
+ * Set the current scope.
24
+ * @param id The ID of the scope to set.
25
+ */
26
+ setScope: (id: ID | undefined) => Promise<void>;
17
27
  };
@@ -0,0 +1,17 @@
1
+ import type { ID } from "./utils";
2
+ /**
3
+ * Utilities to interact with the Sitemap page.
4
+ * @category Sitemap
5
+ */
6
+ export type SitemapSDK = {
7
+ /**
8
+ * Get the current scope ID.
9
+ * @returns The current scope ID.
10
+ */
11
+ getScopeId: () => ID | undefined;
12
+ /**
13
+ * Set the current scope.
14
+ * @param id The ID of the scope to set.
15
+ */
16
+ setScope: (id: ID | undefined) => void;
17
+ };