@hot-updater/plugin-core 0.12.7 → 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.
@@ -0,0 +1,3 @@
1
+ export declare const link: (url: string) => string;
2
+ export declare const banner: (version?: string) => string;
3
+ export declare const printBanner: (version?: string) => void;
@@ -1,4 +1,4 @@
1
- export declare const copyDirToTmp: (dir: string) => Promise<{
1
+ export declare const copyDirToTmp: (dir: string, childDirname?: string) => Promise<{
2
2
  tmpDir: string;
3
3
  removeTmpDir: () => Promise<void>;
4
4
  }>;
@@ -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;
@@ -0,0 +1,5 @@
1
+ export declare const createZip: ({ outfile, targetDir, excludeExts, }: {
2
+ targetDir: string;
3
+ outfile: string;
4
+ excludeExts?: string[];
5
+ }) => Promise<string>;