@hot-updater/plugin-core 0.29.3 → 0.29.5

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.
@@ -1,7 +1,9 @@
1
1
  const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
2
  const require_calculatePagination = require("./calculatePagination.cjs");
3
3
  const require_createDatabasePlugin = require("./createDatabasePlugin.cjs");
4
+ const require_filterCompatibleAppVersions = require("./filterCompatibleAppVersions.cjs");
4
5
  const require_queryBundles = require("./queryBundles.cjs");
6
+ let _hot_updater_js = require("@hot-updater/js");
5
7
  let es_toolkit = require("es-toolkit");
6
8
  let semver = require("semver");
7
9
  semver = require_runtime.__toESM(semver);
@@ -116,6 +118,31 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
116
118
  const pattern = channel ? platform ? new RegExp(`^${channel}/${platform}/[^/]+/update\\.json$`) : new RegExp(`^${channel}/[^/]+/[^/]+/update\\.json$`) : platform ? new RegExp(`^[^/]+/${platform}/[^/]+/update\\.json$`) : /^[^/]+\/[^/]+\/[^/]+\/update\.json$/;
117
119
  return listObjects(prefix).then((keys) => keys.filter((key) => pattern.test(key)));
118
120
  }
121
+ const getAppVersionUpdateInfo = async ({ appVersion, bundleId, channel = "production", cohort, minBundleId, platform }) => {
122
+ const matchingVersions = require_filterCompatibleAppVersions.filterCompatibleAppVersions(await loadObject(`${channel}/${platform}/target-app-versions.json`) ?? [], appVersion);
123
+ return (0, _hot_updater_js.getUpdateInfo)((await Promise.allSettled(matchingVersions.map(async (targetAppVersion) => {
124
+ return await loadObject(`${channel}/${platform}/${normalizeTargetAppVersion(targetAppVersion) ?? targetAppVersion}/update.json`) ?? [];
125
+ }))).filter((entry) => entry.status === "fulfilled").flatMap((entry) => entry.value), {
126
+ _updateStrategy: "appVersion",
127
+ appVersion,
128
+ bundleId,
129
+ channel,
130
+ cohort,
131
+ minBundleId,
132
+ platform
133
+ });
134
+ };
135
+ const getFingerprintUpdateInfo = async ({ bundleId, channel = "production", cohort, fingerprintHash, minBundleId, platform }) => {
136
+ return (0, _hot_updater_js.getUpdateInfo)(await loadObject(`${channel}/${platform}/${fingerprintHash}/update.json`) ?? [], {
137
+ _updateStrategy: "fingerprint",
138
+ bundleId,
139
+ channel,
140
+ cohort,
141
+ fingerprintHash,
142
+ minBundleId,
143
+ platform
144
+ });
145
+ };
119
146
  const addAppVersionInvalidationPaths = (pathsToInvalidate, { platform, channel, targetAppVersion }) => {
120
147
  if (!isExactVersion(targetAppVersion)) {
121
148
  pathsToInvalidate.add(`${apiBasePath}/app-version/${platform}/*`);
@@ -145,6 +172,10 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
145
172
  if (bundle) return removeBundleInternalKeys(bundle);
146
173
  return (await reloadBundles()).find((bundle) => bundle.id === bundleId) ?? null;
147
174
  },
175
+ async getUpdateInfo(args) {
176
+ if (args._updateStrategy === "appVersion") return getAppVersionUpdateInfo(args);
177
+ return getFingerprintUpdateInfo(args);
178
+ },
148
179
  async getBundles(options) {
149
180
  let allBundles = await reloadBundles();
150
181
  const { where, limit, offset, orderBy } = options;
@@ -1,6 +1,8 @@
1
1
  import { calculatePagination } from "./calculatePagination.mjs";
2
2
  import { createDatabasePlugin } from "./createDatabasePlugin.mjs";
3
+ import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.mjs";
3
4
  import { bundleMatchesQueryWhere, sortBundles } from "./queryBundles.mjs";
5
+ import { getUpdateInfo } from "@hot-updater/js";
4
6
  import { orderBy } from "es-toolkit";
5
7
  import semver from "semver";
6
8
  //#region src/createBlobDatabasePlugin.ts
@@ -114,6 +116,31 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
114
116
  const pattern = channel ? platform ? new RegExp(`^${channel}/${platform}/[^/]+/update\\.json$`) : new RegExp(`^${channel}/[^/]+/[^/]+/update\\.json$`) : platform ? new RegExp(`^[^/]+/${platform}/[^/]+/update\\.json$`) : /^[^/]+\/[^/]+\/[^/]+\/update\.json$/;
115
117
  return listObjects(prefix).then((keys) => keys.filter((key) => pattern.test(key)));
116
118
  }
119
+ const getAppVersionUpdateInfo = async ({ appVersion, bundleId, channel = "production", cohort, minBundleId, platform }) => {
120
+ const matchingVersions = filterCompatibleAppVersions(await loadObject(`${channel}/${platform}/target-app-versions.json`) ?? [], appVersion);
121
+ return getUpdateInfo((await Promise.allSettled(matchingVersions.map(async (targetAppVersion) => {
122
+ return await loadObject(`${channel}/${platform}/${normalizeTargetAppVersion(targetAppVersion) ?? targetAppVersion}/update.json`) ?? [];
123
+ }))).filter((entry) => entry.status === "fulfilled").flatMap((entry) => entry.value), {
124
+ _updateStrategy: "appVersion",
125
+ appVersion,
126
+ bundleId,
127
+ channel,
128
+ cohort,
129
+ minBundleId,
130
+ platform
131
+ });
132
+ };
133
+ const getFingerprintUpdateInfo = async ({ bundleId, channel = "production", cohort, fingerprintHash, minBundleId, platform }) => {
134
+ return getUpdateInfo(await loadObject(`${channel}/${platform}/${fingerprintHash}/update.json`) ?? [], {
135
+ _updateStrategy: "fingerprint",
136
+ bundleId,
137
+ channel,
138
+ cohort,
139
+ fingerprintHash,
140
+ minBundleId,
141
+ platform
142
+ });
143
+ };
117
144
  const addAppVersionInvalidationPaths = (pathsToInvalidate, { platform, channel, targetAppVersion }) => {
118
145
  if (!isExactVersion(targetAppVersion)) {
119
146
  pathsToInvalidate.add(`${apiBasePath}/app-version/${platform}/*`);
@@ -143,6 +170,10 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
143
170
  if (bundle) return removeBundleInternalKeys(bundle);
144
171
  return (await reloadBundles()).find((bundle) => bundle.id === bundleId) ?? null;
145
172
  },
173
+ async getUpdateInfo(args) {
174
+ if (args._updateStrategy === "appVersion") return getAppVersionUpdateInfo(args);
175
+ return getFingerprintUpdateInfo(args);
176
+ },
146
177
  async getBundles(options) {
147
178
  let allBundles = await reloadBundles();
148
179
  const { where, limit, offset, orderBy } = options;
@@ -48,7 +48,7 @@ function createDatabasePlugin(options) {
48
48
  data
49
49
  });
50
50
  };
51
- return {
51
+ const plugin = {
52
52
  name: options.name,
53
53
  async getBundleById(bundleId, context) {
54
54
  if (context === void 0) return getMethods().getBundleById(bundleId);
@@ -95,6 +95,32 @@ function createDatabasePlugin(options) {
95
95
  markChanged("delete", deleteBundle);
96
96
  }
97
97
  };
98
+ Object.defineProperty(plugin, "getUpdateInfo", {
99
+ configurable: true,
100
+ enumerable: true,
101
+ get() {
102
+ const directGetUpdateInfo = getMethods().getUpdateInfo;
103
+ if (!directGetUpdateInfo) {
104
+ Object.defineProperty(plugin, "getUpdateInfo", {
105
+ configurable: true,
106
+ enumerable: true,
107
+ value: void 0
108
+ });
109
+ return;
110
+ }
111
+ const wrappedGetUpdateInfo = async (args, context) => {
112
+ if (context === void 0) return directGetUpdateInfo(args);
113
+ return directGetUpdateInfo(args, context);
114
+ };
115
+ Object.defineProperty(plugin, "getUpdateInfo", {
116
+ configurable: true,
117
+ enumerable: true,
118
+ value: wrappedGetUpdateInfo
119
+ });
120
+ return wrappedGetUpdateInfo;
121
+ }
122
+ });
123
+ return plugin;
98
124
  };
99
125
  };
100
126
  }
@@ -1,9 +1,10 @@
1
1
  import { DatabaseBundleQueryOptions, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, Paginated } from "./types/index.cjs";
2
- import { Bundle } from "@hot-updater/core";
2
+ import { Bundle, GetBundlesArgs, UpdateInfo } from "@hot-updater/core";
3
3
 
4
4
  //#region src/createDatabasePlugin.d.ts
5
5
  interface AbstractDatabasePlugin<TContext = unknown> {
6
6
  getBundleById: (bundleId: string, context?: HotUpdaterContext<TContext>) => Promise<Bundle | null>;
7
+ getUpdateInfo?: (args: GetBundlesArgs, context?: HotUpdaterContext<TContext>) => Promise<UpdateInfo | null>;
7
8
  getBundles: (options: DatabaseBundleQueryOptions, context?: HotUpdaterContext<TContext>) => Promise<Paginated<Bundle[]>>;
8
9
  getChannels: (context?: HotUpdaterContext<TContext>) => Promise<string[]>;
9
10
  onUnmount?: () => Promise<void>;
@@ -1,9 +1,10 @@
1
1
  import { DatabaseBundleQueryOptions, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, Paginated } from "./types/index.mjs";
2
- import { Bundle } from "@hot-updater/core";
2
+ import { Bundle, GetBundlesArgs, UpdateInfo } from "@hot-updater/core";
3
3
 
4
4
  //#region src/createDatabasePlugin.d.ts
5
5
  interface AbstractDatabasePlugin<TContext = unknown> {
6
6
  getBundleById: (bundleId: string, context?: HotUpdaterContext<TContext>) => Promise<Bundle | null>;
7
+ getUpdateInfo?: (args: GetBundlesArgs, context?: HotUpdaterContext<TContext>) => Promise<UpdateInfo | null>;
7
8
  getBundles: (options: DatabaseBundleQueryOptions, context?: HotUpdaterContext<TContext>) => Promise<Paginated<Bundle[]>>;
8
9
  getChannels: (context?: HotUpdaterContext<TContext>) => Promise<string[]>;
9
10
  onUnmount?: () => Promise<void>;
@@ -47,7 +47,7 @@ function createDatabasePlugin(options) {
47
47
  data
48
48
  });
49
49
  };
50
- return {
50
+ const plugin = {
51
51
  name: options.name,
52
52
  async getBundleById(bundleId, context) {
53
53
  if (context === void 0) return getMethods().getBundleById(bundleId);
@@ -94,6 +94,32 @@ function createDatabasePlugin(options) {
94
94
  markChanged("delete", deleteBundle);
95
95
  }
96
96
  };
97
+ Object.defineProperty(plugin, "getUpdateInfo", {
98
+ configurable: true,
99
+ enumerable: true,
100
+ get() {
101
+ const directGetUpdateInfo = getMethods().getUpdateInfo;
102
+ if (!directGetUpdateInfo) {
103
+ Object.defineProperty(plugin, "getUpdateInfo", {
104
+ configurable: true,
105
+ enumerable: true,
106
+ value: void 0
107
+ });
108
+ return;
109
+ }
110
+ const wrappedGetUpdateInfo = async (args, context) => {
111
+ if (context === void 0) return directGetUpdateInfo(args);
112
+ return directGetUpdateInfo(args, context);
113
+ };
114
+ Object.defineProperty(plugin, "getUpdateInfo", {
115
+ configurable: true,
116
+ enumerable: true,
117
+ value: wrappedGetUpdateInfo
118
+ });
119
+ return wrappedGetUpdateInfo;
120
+ }
121
+ });
122
+ return plugin;
97
123
  };
98
124
  };
99
125
  }
package/dist/index.cjs CHANGED
@@ -2,12 +2,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_calculatePagination = require("./calculatePagination.cjs");
3
3
  const require_compressionFormat = require("./compressionFormat.cjs");
4
4
  const require_createDatabasePlugin = require("./createDatabasePlugin.cjs");
5
+ const require_semverSatisfies = require("./semverSatisfies.cjs");
6
+ const require_filterCompatibleAppVersions = require("./filterCompatibleAppVersions.cjs");
5
7
  const require_queryBundles = require("./queryBundles.cjs");
6
8
  const require_createBlobDatabasePlugin = require("./createBlobDatabasePlugin.cjs");
7
9
  const require_createStorageKeyBuilder = require("./createStorageKeyBuilder.cjs");
8
10
  const require_createStoragePlugin = require("./createStoragePlugin.cjs");
9
- const require_semverSatisfies = require("./semverSatisfies.cjs");
10
- const require_filterCompatibleAppVersions = require("./filterCompatibleAppVersions.cjs");
11
11
  const require_generateMinBundleId = require("./generateMinBundleId.cjs");
12
12
  const require_parseStorageUri = require("./parseStorageUri.cjs");
13
13
  const require_index = require("./types/index.cjs");
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.cjs";
2
- import { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, supportedIosPlatforms } from "./types/index.cjs";
2
+ import { AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintGetBundlesArgs, GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, UpdateInfo, supportedIosPlatforms } from "./types/index.cjs";
3
3
  import { PaginationOptions, calculatePagination } from "./calculatePagination.cjs";
4
4
  import { CompressionFormat, CompressionFormatInfo, detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.cjs";
5
5
  import { BlobOperations, createBlobDatabasePlugin } from "./createBlobDatabasePlugin.cjs";
@@ -11,4 +11,4 @@ import { generateMinBundleId } from "./generateMinBundleId.cjs";
11
11
  import { ParsedStorageUri, parseStorageUri } from "./parseStorageUri.cjs";
12
12
  import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.cjs";
13
13
  import { semverSatisfies } from "./semverSatisfies.cjs";
14
- export { AbstractDatabasePlugin, ApplePlatform, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, CreateStoragePluginOptions, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createStoragePlugin, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, parseStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
14
+ export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, CreateStoragePluginOptions, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintGetBundlesArgs, GetBundlesArgs, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, UpdateInfo, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createStoragePlugin, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, parseStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.mjs";
2
- import { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, supportedIosPlatforms } from "./types/index.mjs";
2
+ import { AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintGetBundlesArgs, GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, UpdateInfo, supportedIosPlatforms } from "./types/index.mjs";
3
3
  import { PaginationOptions, calculatePagination } from "./calculatePagination.mjs";
4
4
  import { CompressionFormat, CompressionFormatInfo, detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.mjs";
5
5
  import { BlobOperations, createBlobDatabasePlugin } from "./createBlobDatabasePlugin.mjs";
@@ -11,4 +11,4 @@ import { generateMinBundleId } from "./generateMinBundleId.mjs";
11
11
  import { ParsedStorageUri, parseStorageUri } from "./parseStorageUri.mjs";
12
12
  import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.mjs";
13
13
  import { semverSatisfies } from "./semverSatisfies.mjs";
14
- export { AbstractDatabasePlugin, ApplePlatform, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, CreateStoragePluginOptions, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createStoragePlugin, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, parseStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
14
+ export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, CreateStoragePluginOptions, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintGetBundlesArgs, GetBundlesArgs, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, UpdateInfo, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createStoragePlugin, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, parseStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import { calculatePagination } from "./calculatePagination.mjs";
2
2
  import { detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.mjs";
3
3
  import { createDatabasePlugin } from "./createDatabasePlugin.mjs";
4
+ import { semverSatisfies } from "./semverSatisfies.mjs";
5
+ import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.mjs";
4
6
  import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.mjs";
5
7
  import { createBlobDatabasePlugin } from "./createBlobDatabasePlugin.mjs";
6
8
  import { createStorageKeyBuilder } from "./createStorageKeyBuilder.mjs";
7
9
  import { createStoragePlugin } from "./createStoragePlugin.mjs";
8
- import { semverSatisfies } from "./semverSatisfies.mjs";
9
- import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.mjs";
10
10
  import { generateMinBundleId } from "./generateMinBundleId.mjs";
11
11
  import { parseStorageUri } from "./parseStorageUri.mjs";
12
12
  import { supportedIosPlatforms } from "./types/index.mjs";
@@ -1,5 +1,5 @@
1
1
  import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./utils.cjs";
2
- import { Bundle, Bundle as Bundle$1, Platform, Platform as Platform$1 } from "@hot-updater/core";
2
+ import { AppVersionGetBundlesArgs, Bundle, Bundle as Bundle$1, FingerprintGetBundlesArgs, GetBundlesArgs, GetBundlesArgs as GetBundlesArgs$1, Platform, Platform as Platform$1, UpdateInfo, UpdateInfo as UpdateInfo$1 } from "@hot-updater/core";
3
3
 
4
4
  //#region src/types/index.d.ts
5
5
  interface BasePluginArgs {
@@ -51,6 +51,7 @@ interface BuildPluginConfig {
51
51
  interface DatabasePlugin<TContext = unknown> {
52
52
  getChannels: (context?: HotUpdaterContext<TContext>) => Promise<string[]>;
53
53
  getBundleById: (bundleId: string, context?: HotUpdaterContext<TContext>) => Promise<Bundle | null>;
54
+ getUpdateInfo?: (args: GetBundlesArgs, context?: HotUpdaterContext<TContext>) => Promise<UpdateInfo | null>;
54
55
  getBundles: (options: DatabaseBundleQueryOptions, context?: HotUpdaterContext<TContext>) => Promise<Paginated<Bundle[]>>;
55
56
  updateBundle: (targetBundleId: string, newBundle: Partial<Bundle>, context?: HotUpdaterContext<TContext>) => Promise<void>;
56
57
  appendBundle: (insertBundle: Bundle, context?: HotUpdaterContext<TContext>) => Promise<void>;
@@ -391,4 +392,4 @@ interface NativeBuildOptions {
391
392
  scheme?: string;
392
393
  }
393
394
  //#endregion
394
- export { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, type Platform$1 as Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, supportedIosPlatforms };
395
+ export { type AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, type FingerprintGetBundlesArgs, type GetBundlesArgs$1 as GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, type Platform$1 as Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, type UpdateInfo$1 as UpdateInfo, supportedIosPlatforms };
@@ -1,5 +1,5 @@
1
1
  import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./utils.mjs";
2
- import { Bundle, Bundle as Bundle$1, Platform, Platform as Platform$1 } from "@hot-updater/core";
2
+ import { AppVersionGetBundlesArgs, Bundle, Bundle as Bundle$1, FingerprintGetBundlesArgs, GetBundlesArgs, GetBundlesArgs as GetBundlesArgs$1, Platform, Platform as Platform$1, UpdateInfo, UpdateInfo as UpdateInfo$1 } from "@hot-updater/core";
3
3
 
4
4
  //#region src/types/index.d.ts
5
5
  interface BasePluginArgs {
@@ -51,6 +51,7 @@ interface BuildPluginConfig {
51
51
  interface DatabasePlugin<TContext = unknown> {
52
52
  getChannels: (context?: HotUpdaterContext<TContext>) => Promise<string[]>;
53
53
  getBundleById: (bundleId: string, context?: HotUpdaterContext<TContext>) => Promise<Bundle | null>;
54
+ getUpdateInfo?: (args: GetBundlesArgs, context?: HotUpdaterContext<TContext>) => Promise<UpdateInfo | null>;
54
55
  getBundles: (options: DatabaseBundleQueryOptions, context?: HotUpdaterContext<TContext>) => Promise<Paginated<Bundle[]>>;
55
56
  updateBundle: (targetBundleId: string, newBundle: Partial<Bundle>, context?: HotUpdaterContext<TContext>) => Promise<void>;
56
57
  appendBundle: (insertBundle: Bundle, context?: HotUpdaterContext<TContext>) => Promise<void>;
@@ -391,4 +392,4 @@ interface NativeBuildOptions {
391
392
  scheme?: string;
392
393
  }
393
394
  //#endregion
394
- export { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, type Platform$1 as Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, supportedIosPlatforms };
395
+ export { type AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, type FingerprintGetBundlesArgs, type GetBundlesArgs$1 as GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, type Platform$1 as Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, type UpdateInfo$1 as UpdateInfo, supportedIosPlatforms };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/plugin-core",
3
- "version": "0.29.3",
3
+ "version": "0.29.5",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -42,13 +42,14 @@
42
42
  "es-toolkit": "^1.32.0",
43
43
  "mime": "^4.0.4",
44
44
  "semver": "^7.7.2",
45
- "@hot-updater/core": "0.29.3"
45
+ "@hot-updater/core": "0.29.5",
46
+ "@hot-updater/js": "0.29.5"
46
47
  },
47
48
  "devDependencies": {
48
49
  "@types/node": "^20",
49
50
  "@types/semver": "^7.5.8",
50
- "typescript": "5.8.2",
51
- "@hot-updater/test-utils": "0.29.3"
51
+ "typescript": "6.0.2",
52
+ "@hot-updater/test-utils": "0.29.5"
52
53
  },
53
54
  "scripts": {
54
55
  "build": "tsdown",