From 6bb30c03fb91c455ec5becbad1527e28f18a62d1 Mon Sep 17 00:00:00 2001 From: Caido Bot Date: Tue, 14 Jan 2025 21:39:49 +0000 Subject: [PATCH] 0.45.2-beta.0 --- packages/sdk-frontend/package.json | 2 +- packages/sdk-frontend/src/types/assets.d.ts | 22 +++++++++++++++++++++ packages/sdk-frontend/src/types/index.d.ts | 5 +++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 packages/sdk-frontend/src/types/assets.d.ts diff --git a/packages/sdk-frontend/package.json b/packages/sdk-frontend/package.json index a645da3..f596965 100644 --- a/packages/sdk-frontend/package.json +++ b/packages/sdk-frontend/package.json @@ -1,6 +1,6 @@ { "name": "@caido/sdk-frontend", - "version": "v0.45.1", + "version": "0.45.2-beta.0", "description": "Typing for the Caido Frontend SDK", "author": "Caido Labs Inc. ", "license": "MIT", diff --git a/packages/sdk-frontend/src/types/assets.d.ts b/packages/sdk-frontend/src/types/assets.d.ts new file mode 100644 index 0000000..27d3aa6 --- /dev/null +++ b/packages/sdk-frontend/src/types/assets.d.ts @@ -0,0 +1,22 @@ +/** + * Utilities to interact with the plugin's static assets. + * @category Files + */ +export type AssetsSDK = { + /** + * Get a file from the assets folder. + * @returns The asset file. + */ + get: (path: string) => Promise; +}; +/** + * A static asset. + * @category Files + */ +type Asset = { + asReadableStream: () => ReadableStream; + asArrayBuffer: () => Promise; + asString: () => Promise; + asJson: () => Promise; +}; +export {}; diff --git a/packages/sdk-frontend/src/types/index.d.ts b/packages/sdk-frontend/src/types/index.d.ts index e7839e2..a1e51e0 100644 --- a/packages/sdk-frontend/src/types/index.d.ts +++ b/packages/sdk-frontend/src/types/index.d.ts @@ -1,4 +1,5 @@ import type { Sdk as GraphqlSDK } from "./__generated__/graphql-sdk"; +import type { AssetsSDK } from "./assets"; import type { BackendEndpoints, BackendEvents, BackendSDK } from "./backend"; import type { CommandPaletteSDK } from "./commandPalette"; import type { CommandsSDK } from "./commands"; @@ -74,6 +75,10 @@ export type API, E extends Ba * Utilities to interact with frontend-plugin storage. */ storage: StorageSDK; + /** + * Utilities to interact with the plugin's static assets. + */ + assets: AssetsSDK; /** * Utilities to interact with shortcuts. */