@hot-updater/plugin-core 0.18.4 → 0.19.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.cjs CHANGED
@@ -20083,7 +20083,10 @@ function createDatabasePlugin(name, abstractPlugin, hooks) {
20083
20083
  onUnmount: abstractPlugin.onUnmount ? async () => {
20084
20084
  const context = memoizedContext();
20085
20085
  await abstractPlugin.onUnmount?.(context);
20086
- } : void 0
20086
+ } : void 0,
20087
+ async deleteBundle(deleteBundle) {
20088
+ markChanged("delete", deleteBundle);
20089
+ }
20087
20090
  });
20088
20091
  }
20089
20092
 
@@ -30525,6 +30528,20 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
30525
30528
  else if (data.targetAppVersion) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/${data.targetAppVersion}/${data.channel}/*`);
30526
30529
  continue;
30527
30530
  }
30531
+ if (operation === "delete") {
30532
+ let bundle$1 = pendingBundlesMap.get(data.id);
30533
+ if (!bundle$1) bundle$1 = bundlesMap.get(data.id);
30534
+ if (!bundle$1) throw new Error("Bundle to delete not found");
30535
+ bundlesMap.delete(data.id);
30536
+ pendingBundlesMap.delete(data.id);
30537
+ const key = bundle$1._updateJsonKey;
30538
+ removalsByKey[key] = removalsByKey[key] || [];
30539
+ removalsByKey[key].push(bundle$1.id);
30540
+ pathsToInvalidate.add(`/${key}`);
30541
+ if (bundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle$1.platform}/${bundle$1.fingerprintHash}/${bundle$1.channel}/*`);
30542
+ else if (bundle$1.targetAppVersion) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/${bundle$1.targetAppVersion}/${bundle$1.channel}/*`);
30543
+ continue;
30544
+ }
30528
30545
  let bundle = pendingBundlesMap.get(data.id);
30529
30546
  if (!bundle) bundle = bundlesMap.get(data.id);
30530
30547
  if (!bundle) throw new Error("targetBundleId not found");
package/dist/index.d.cts CHANGED
@@ -42,10 +42,11 @@ interface DatabasePlugin {
42
42
  pagination: PaginationInfo;
43
43
  }>;
44
44
  updateBundle: (targetBundleId: string, newBundle: Partial<Bundle$1>) => Promise<void>;
45
- appendBundle: (bundles: Bundle$1) => Promise<void>;
45
+ appendBundle: (insertBundle: Bundle$1) => Promise<void>;
46
46
  commitBundle: () => Promise<void>;
47
47
  onUnmount?: () => Promise<void>;
48
48
  name: string;
49
+ deleteBundle: (deleteBundle: Bundle$1) => Promise<void>;
49
50
  }
50
51
  interface DatabasePluginHooks {
51
52
  onDatabaseUpdated?: () => Promise<void>;
@@ -53,11 +54,9 @@ interface DatabasePluginHooks {
53
54
  interface BuildPlugin {
54
55
  build: (args: {
55
56
  platform: Platform$1;
56
- channel: string;
57
57
  }) => Promise<{
58
58
  buildPath: string;
59
59
  bundleId: string;
60
- channel: string;
61
60
  stdout: string | null;
62
61
  }>;
63
62
  name: string;
@@ -66,7 +65,9 @@ interface StoragePlugin {
66
65
  uploadBundle: (bundleId: string, bundlePath: string) => Promise<{
67
66
  storageUri: string;
68
67
  }>;
69
- deleteBundle: (bundleId: string) => Promise<string>;
68
+ deleteBundle: (bundleId: string) => Promise<{
69
+ storageUri: string;
70
+ }>;
70
71
  name: string;
71
72
  }
72
73
  interface StoragePluginHooks {
package/dist/index.d.ts CHANGED
@@ -42,10 +42,11 @@ interface DatabasePlugin {
42
42
  pagination: PaginationInfo;
43
43
  }>;
44
44
  updateBundle: (targetBundleId: string, newBundle: Partial<Bundle$1>) => Promise<void>;
45
- appendBundle: (bundles: Bundle$1) => Promise<void>;
45
+ appendBundle: (insertBundle: Bundle$1) => Promise<void>;
46
46
  commitBundle: () => Promise<void>;
47
47
  onUnmount?: () => Promise<void>;
48
48
  name: string;
49
+ deleteBundle: (deleteBundle: Bundle$1) => Promise<void>;
49
50
  }
50
51
  interface DatabasePluginHooks {
51
52
  onDatabaseUpdated?: () => Promise<void>;
@@ -53,11 +54,9 @@ interface DatabasePluginHooks {
53
54
  interface BuildPlugin {
54
55
  build: (args: {
55
56
  platform: Platform$1;
56
- channel: string;
57
57
  }) => Promise<{
58
58
  buildPath: string;
59
59
  bundleId: string;
60
- channel: string;
61
60
  stdout: string | null;
62
61
  }>;
63
62
  name: string;
@@ -66,7 +65,9 @@ interface StoragePlugin {
66
65
  uploadBundle: (bundleId: string, bundlePath: string) => Promise<{
67
66
  storageUri: string;
68
67
  }>;
69
- deleteBundle: (bundleId: string) => Promise<string>;
68
+ deleteBundle: (bundleId: string) => Promise<{
69
+ storageUri: string;
70
+ }>;
70
71
  name: string;
71
72
  }
72
73
  interface StoragePluginHooks {
package/dist/index.js CHANGED
@@ -20085,7 +20085,10 @@ function createDatabasePlugin(name, abstractPlugin, hooks) {
20085
20085
  onUnmount: abstractPlugin.onUnmount ? async () => {
20086
20086
  const context = memoizedContext();
20087
20087
  await abstractPlugin.onUnmount?.(context);
20088
- } : void 0
20088
+ } : void 0,
20089
+ async deleteBundle(deleteBundle) {
20090
+ markChanged("delete", deleteBundle);
20091
+ }
20089
20092
  });
20090
20093
  }
20091
20094
 
@@ -30527,6 +30530,20 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
30527
30530
  else if (data.targetAppVersion) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/${data.targetAppVersion}/${data.channel}/*`);
30528
30531
  continue;
30529
30532
  }
30533
+ if (operation === "delete") {
30534
+ let bundle$1 = pendingBundlesMap.get(data.id);
30535
+ if (!bundle$1) bundle$1 = bundlesMap.get(data.id);
30536
+ if (!bundle$1) throw new Error("Bundle to delete not found");
30537
+ bundlesMap.delete(data.id);
30538
+ pendingBundlesMap.delete(data.id);
30539
+ const key = bundle$1._updateJsonKey;
30540
+ removalsByKey[key] = removalsByKey[key] || [];
30541
+ removalsByKey[key].push(bundle$1.id);
30542
+ pathsToInvalidate.add(`/${key}`);
30543
+ if (bundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle$1.platform}/${bundle$1.fingerprintHash}/${bundle$1.channel}/*`);
30544
+ else if (bundle$1.targetAppVersion) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/${bundle$1.targetAppVersion}/${bundle$1.channel}/*`);
30545
+ continue;
30546
+ }
30530
30547
  let bundle = pendingBundlesMap.get(data.id);
30531
30548
  if (!bundle) bundle = bundlesMap.get(data.id);
30532
30549
  if (!bundle) throw new Error("targetBundleId not found");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/plugin-core",
3
- "version": "0.18.4",
3
+ "version": "0.19.0",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -11,6 +11,10 @@
11
11
  ".": {
12
12
  "import": "./dist/index.js",
13
13
  "require": "./dist/index.cjs"
14
+ },
15
+ "./test-utils": {
16
+ "import": "./src/test-utils/index.ts",
17
+ "require": "./src/test-utils/index.ts"
14
18
  }
15
19
  },
16
20
  "files": [
@@ -41,7 +45,7 @@
41
45
  "cosmiconfig": "9.0.0",
42
46
  "cosmiconfig-typescript-loader": "5.0.0",
43
47
  "oxc-transform": "0.72.0",
44
- "@hot-updater/core": "0.18.4"
48
+ "@hot-updater/core": "0.19.0"
45
49
  },
46
50
  "devDependencies": {
47
51
  "@types/node": "^22.7.5",
@@ -50,7 +54,8 @@
50
54
  "jszip": "^3.10.1",
51
55
  "picocolors": "^1.0.0",
52
56
  "typescript": "5.8.2",
53
- "workspace-tools": "^0.36.4"
57
+ "workspace-tools": "^0.36.4",
58
+ "@hot-updater/plugin-core": "0.19.0"
54
59
  },
55
60
  "scripts": {
56
61
  "build": "tsdown",