@hot-updater/plugin-core 0.12.6 → 0.13.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/dist/banner.d.ts +3 -0
- package/dist/copyDirToTmp.d.ts +1 -1
- package/dist/createDatabasePlugin.d.ts +44 -0
- package/dist/createZip.d.ts +5 -0
- package/dist/index.cjs +84871 -60
- package/dist/index.cjs.LICENSE.txt +48 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +84410 -62
- package/dist/index.js.LICENSE.txt +48 -0
- package/dist/loadConfig.d.ts +9 -5
- package/dist/makeEnv.d.ts +6 -0
- package/dist/transformEnv.d.ts +1 -0
- package/dist/transformEnv.spec.d.ts +1 -0
- package/dist/transformTemplate.d.ts +15 -0
- package/dist/transformTsEnv.d.ts +1 -0
- package/dist/transformTsEnv.spec.d.ts +1 -0
- package/dist/{types.d.ts → types/index.d.ts} +21 -4
- package/dist/types/utils.d.ts +12 -0
- package/package.json +26 -6
- package/LICENSE +0 -21
package/dist/banner.d.ts
ADDED
package/dist/copyDirToTmp.d.ts
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Bundle } from "@hot-updater/core";
|
|
2
|
+
import type { BasePluginArgs, DatabasePlugin, DatabasePluginHooks } from "./types";
|
|
3
|
+
export interface BaseDatabaseUtils {
|
|
4
|
+
cwd: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AbstractDatabasePlugin extends Pick<DatabasePlugin, "getBundleById" | "getBundles" | "getChannels" | "onUnmount"> {
|
|
7
|
+
commitBundle: ({ changedSets, }: {
|
|
8
|
+
changedSets: {
|
|
9
|
+
operation: "insert" | "update" | "delete";
|
|
10
|
+
data: Bundle;
|
|
11
|
+
}[];
|
|
12
|
+
}) => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates a database plugin with the given implementation.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const myDatabasePlugin = createDatabasePlugin("myDatabase", (utils) => {
|
|
20
|
+
* return {
|
|
21
|
+
* async getBundleById(bundleId) {
|
|
22
|
+
* // Implementation to get a bundle by ID
|
|
23
|
+
* return bundle;
|
|
24
|
+
* },
|
|
25
|
+
* async getBundles(options) {
|
|
26
|
+
* // Implementation to get bundles with options
|
|
27
|
+
* return bundles;
|
|
28
|
+
* },
|
|
29
|
+
* async getChannels() {
|
|
30
|
+
* // Implementation to get available channels
|
|
31
|
+
* return channels;
|
|
32
|
+
* },
|
|
33
|
+
* async commitBundle({ changedMap }) {
|
|
34
|
+
* // Implementation to commit changed bundles
|
|
35
|
+
* }
|
|
36
|
+
* };
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param name - The name of the database plugin
|
|
41
|
+
* @param initializer - A function that initializes the database plugin implementation
|
|
42
|
+
* @returns A function that creates a database plugin instance
|
|
43
|
+
*/
|
|
44
|
+
export declare function createDatabasePlugin(name: string, abstractPlugin: AbstractDatabasePlugin, hooks?: DatabasePluginHooks): (options: BasePluginArgs) => DatabasePlugin;
|