@hot-updater/plugin-core 0.1.4 → 0.1.6-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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { Platform, UpdateSource } from '@hot-updater/utils';
2
- export { Platform, UpdateSource } from '@hot-updater/utils';
1
+ import { Platform, Bundle } from '@hot-updater/core';
2
+ export { Bundle, Platform } from '@hot-updater/core';
3
3
 
4
4
  declare const log: {
5
5
  normal: (message: string | number | null | undefined) => void;
@@ -18,27 +18,36 @@ interface BasePluginArgs {
18
18
  interface BuildPluginArgs extends BasePluginArgs {
19
19
  platform: Platform;
20
20
  }
21
- interface DeployPlugin {
22
- getUpdateSources: (refresh?: boolean) => Promise<UpdateSource[]>;
23
- updateUpdateSource: (targetBundleVersion: number, newSource: Partial<UpdateSource>) => Promise<void>;
24
- setUpdateSources: (sources: UpdateSource[]) => Promise<void>;
25
- appendUpdateSource: (source: UpdateSource) => Promise<void>;
26
- commitUpdateSource: () => Promise<void>;
27
- uploadBundle: (platform: Platform, bundleVersion: number, bundlePath: string) => Promise<{
28
- file: string;
21
+ interface DatabasePlugin {
22
+ getBundleById: (bundleId: string) => Promise<Bundle | null>;
23
+ getBundles: (refresh?: boolean) => Promise<Bundle[]>;
24
+ updateBundle: (targetBundleId: string, newBundle: Partial<Bundle>) => Promise<void>;
25
+ setBundles: (bundles: Bundle[]) => Promise<void>;
26
+ appendBundle: (bundles: Bundle) => Promise<void>;
27
+ commitBundle: () => Promise<void>;
28
+ onUnmount?: () => Promise<void>;
29
+ }
30
+ interface DatabasePluginHooks {
31
+ onDatabaseUpdated?: () => Promise<void>;
32
+ }
33
+ interface StoragePlugin {
34
+ uploadBundle: (bundleId: string, bundlePath: string) => Promise<{
35
+ fileUrl: string;
29
36
  }>;
30
- deleteBundle: (platform: Platform, bundleVersion: number) => Promise<string>;
37
+ deleteBundle: (bundleId: string) => Promise<string>;
38
+ }
39
+ interface StoragePluginHooks {
40
+ onStorageUploaded?: () => Promise<void>;
31
41
  }
32
42
  type Config = {
33
- server: string;
34
- secretKey: string;
35
43
  build: (args: BuildPluginArgs) => Promise<{
36
44
  buildPath: string;
37
- outputs: string[];
45
+ bundleId: string;
38
46
  }>;
39
- deploy: (args: BasePluginArgs) => DeployPlugin;
47
+ storage: (args: BasePluginArgs) => StoragePlugin;
48
+ database: (args: BasePluginArgs) => DatabasePlugin;
40
49
  };
41
50
 
42
51
  declare const loadConfig: () => Promise<Config | null>;
43
52
 
44
- export { type BasePluginArgs, type BuildPluginArgs, type Config, type DeployPlugin, getCwd, loadConfig, log };
53
+ export { type BasePluginArgs, type BuildPluginArgs, type Config, type DatabasePlugin, type DatabasePluginHooks, type StoragePlugin, type StoragePluginHooks, getCwd, loadConfig, log };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Platform, UpdateSource } from '@hot-updater/utils';
2
- export { Platform, UpdateSource } from '@hot-updater/utils';
1
+ import { Platform, Bundle } from '@hot-updater/core';
2
+ export { Bundle, Platform } from '@hot-updater/core';
3
3
 
4
4
  declare const log: {
5
5
  normal: (message: string | number | null | undefined) => void;
@@ -18,27 +18,36 @@ interface BasePluginArgs {
18
18
  interface BuildPluginArgs extends BasePluginArgs {
19
19
  platform: Platform;
20
20
  }
21
- interface DeployPlugin {
22
- getUpdateSources: (refresh?: boolean) => Promise<UpdateSource[]>;
23
- updateUpdateSource: (targetBundleVersion: number, newSource: Partial<UpdateSource>) => Promise<void>;
24
- setUpdateSources: (sources: UpdateSource[]) => Promise<void>;
25
- appendUpdateSource: (source: UpdateSource) => Promise<void>;
26
- commitUpdateSource: () => Promise<void>;
27
- uploadBundle: (platform: Platform, bundleVersion: number, bundlePath: string) => Promise<{
28
- file: string;
21
+ interface DatabasePlugin {
22
+ getBundleById: (bundleId: string) => Promise<Bundle | null>;
23
+ getBundles: (refresh?: boolean) => Promise<Bundle[]>;
24
+ updateBundle: (targetBundleId: string, newBundle: Partial<Bundle>) => Promise<void>;
25
+ setBundles: (bundles: Bundle[]) => Promise<void>;
26
+ appendBundle: (bundles: Bundle) => Promise<void>;
27
+ commitBundle: () => Promise<void>;
28
+ onUnmount?: () => Promise<void>;
29
+ }
30
+ interface DatabasePluginHooks {
31
+ onDatabaseUpdated?: () => Promise<void>;
32
+ }
33
+ interface StoragePlugin {
34
+ uploadBundle: (bundleId: string, bundlePath: string) => Promise<{
35
+ fileUrl: string;
29
36
  }>;
30
- deleteBundle: (platform: Platform, bundleVersion: number) => Promise<string>;
37
+ deleteBundle: (bundleId: string) => Promise<string>;
38
+ }
39
+ interface StoragePluginHooks {
40
+ onStorageUploaded?: () => Promise<void>;
31
41
  }
32
42
  type Config = {
33
- server: string;
34
- secretKey: string;
35
43
  build: (args: BuildPluginArgs) => Promise<{
36
44
  buildPath: string;
37
- outputs: string[];
45
+ bundleId: string;
38
46
  }>;
39
- deploy: (args: BasePluginArgs) => DeployPlugin;
47
+ storage: (args: BasePluginArgs) => StoragePlugin;
48
+ database: (args: BasePluginArgs) => DatabasePlugin;
40
49
  };
41
50
 
42
51
  declare const loadConfig: () => Promise<Config | null>;
43
52
 
44
- export { type BasePluginArgs, type BuildPluginArgs, type Config, type DeployPlugin, getCwd, loadConfig, log };
53
+ export { type BasePluginArgs, type BuildPluginArgs, type Config, type DatabasePlugin, type DatabasePluginHooks, type StoragePlugin, type StoragePluginHooks, getCwd, loadConfig, log };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/plugin-core",
3
- "version": "0.1.4",
3
+ "version": "0.1.6-0",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -38,7 +38,7 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@hot-updater/utils": "0.1.4",
41
+ "@hot-updater/core": "0.1.6-0",
42
42
  "cosmiconfig": "^9.0.0",
43
43
  "cosmiconfig-typescript-loader": "^5.0.0",
44
44
  "picocolors": "^1.0.0",