@hot-updater/plugin-core 0.16.3 → 0.16.4
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/dist/createBlobDatabasePlugin.d.ts +42 -0
- package/dist/createBlobDatabasePlugin.spec.d.ts +1 -0
- package/dist/index.cjs +1179 -2258
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1144 -2247
- package/package.json +2 -2
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { DatabasePluginHooks } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* @prefix {string} - The prefix to filter the objects in the storage.
|
|
4
|
+
*/
|
|
5
|
+
export type ListObjectsFn = (prefix: string) => Promise<string[]>;
|
|
6
|
+
/**
|
|
7
|
+
* @key {string} - The key of the object to load.
|
|
8
|
+
*/
|
|
9
|
+
export type LoadObjectFn = <T>(key: string) => Promise<T | null>;
|
|
10
|
+
/**
|
|
11
|
+
* @key {string} - The key of the object to upload.
|
|
12
|
+
* @data {any} - The data to upload as a Javascript Object.
|
|
13
|
+
*/
|
|
14
|
+
export type UploadObjectFn = (key: string, data: any) => Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* @key {string} - The key of the object to delete.
|
|
17
|
+
*/
|
|
18
|
+
export type DeleteObjectFn = (key: string) => Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* @paths {string[]} - The paths to invalidate in the CDN.
|
|
21
|
+
*/
|
|
22
|
+
export type InvalidatePathsFn = (paths: string[]) => Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param name - The name of the database plugin
|
|
26
|
+
* @param listObjects - Function to list objects in the storage
|
|
27
|
+
* @param loadObject - Function to load an JSON object from the storage
|
|
28
|
+
* @param uploadObject - Function to upload an JSON object to the storage
|
|
29
|
+
* @param deleteObject - Function to delete an object from the storage
|
|
30
|
+
* @param invalidatePaths - Function to invalidate paths in the CDN
|
|
31
|
+
* @param hooks - Optional hooks for additional functionality - see createDatabasePlugin
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
export declare const createBlobDatabasePlugin: ({ name, listObjects, loadObject, uploadObject, deleteObject, invalidatePaths, hooks, }: {
|
|
35
|
+
name: string;
|
|
36
|
+
listObjects: ListObjectsFn;
|
|
37
|
+
loadObject: LoadObjectFn;
|
|
38
|
+
uploadObject: UploadObjectFn;
|
|
39
|
+
deleteObject: DeleteObjectFn;
|
|
40
|
+
invalidatePaths: InvalidatePathsFn;
|
|
41
|
+
hooks?: DatabasePluginHooks;
|
|
42
|
+
}) => (options: import("./types").BasePluginArgs) => import("./types").DatabasePlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|