@hot-updater/plugin-core 0.29.2 → 0.29.4

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,17 +1,13 @@
1
- import { Bundle, PaginationInfo } from "./types/index.cjs";
1
+ import { PaginationInfo } from "./types/index.cjs";
2
2
 
3
3
  //#region src/calculatePagination.d.ts
4
4
  interface PaginationOptions {
5
5
  limit: number;
6
6
  offset: number;
7
7
  }
8
- interface PaginatedResult {
9
- data: Bundle[];
10
- pagination: PaginationInfo;
11
- }
12
8
  /**
13
9
  * Calculate pagination information based on total count, limit, and offset
14
10
  */
15
11
  declare function calculatePagination(total: number, options: PaginationOptions): PaginationInfo;
16
12
  //#endregion
17
- export { PaginatedResult, PaginationOptions, calculatePagination };
13
+ export { PaginationOptions, calculatePagination };
@@ -1,17 +1,13 @@
1
- import { Bundle, PaginationInfo } from "./types/index.mjs";
1
+ import { PaginationInfo } from "./types/index.mjs";
2
2
 
3
3
  //#region src/calculatePagination.d.ts
4
4
  interface PaginationOptions {
5
5
  limit: number;
6
6
  offset: number;
7
7
  }
8
- interface PaginatedResult {
9
- data: Bundle[];
10
- pagination: PaginationInfo;
11
- }
12
8
  /**
13
9
  * Calculate pagination information based on total count, limit, and offset
14
10
  */
15
11
  declare function calculatePagination(total: number, options: PaginationOptions): PaginationInfo;
16
12
  //#endregion
17
- export { PaginatedResult, PaginationOptions, calculatePagination };
13
+ export { PaginationOptions, calculatePagination };
@@ -41,6 +41,11 @@ function getSemverNormalizedVersions(version) {
41
41
  if (coerced.minor === 0 && coerced.patch === 0) versions.add(`${coerced.major}`);
42
42
  return Array.from(versions);
43
43
  }
44
+ function resolveStorageTarget({ targetAppVersion, fingerprintHash }) {
45
+ const target = normalizeTargetAppVersion(targetAppVersion) ?? fingerprintHash;
46
+ if (!target) throw new Error("target not found");
47
+ return target;
48
+ }
44
49
  /**
45
50
  * Creates a blob storage-based database plugin with lazy initialization.
46
51
  *
@@ -176,8 +181,7 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
176
181
  if (data.targetAppVersion !== void 0) isTargetAppVersionChanged = true;
177
182
  if (operation === "update" && data.channel !== void 0) isChannelChanged = true;
178
183
  if (operation === "insert") {
179
- const target = normalizeTargetAppVersion(data.targetAppVersion) ?? data.fingerprintHash;
180
- if (!target) throw new Error("target not found");
184
+ const target = resolveStorageTarget(data);
181
185
  const key = `${data.channel}/${data.platform}/${target}/update.json`;
182
186
  const bundleWithKey = {
183
187
  ...data,
@@ -206,20 +210,16 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
206
210
  if (!bundle) bundle = bundlesMap.get(data.id);
207
211
  if (!bundle) throw new Error("targetBundleId not found");
208
212
  if (operation === "update") {
209
- const newChannel = data.channel !== void 0 ? data.channel : bundle.channel;
210
- const newPlatform = data.platform !== void 0 ? data.platform : bundle.platform;
211
- const target = data.fingerprintHash ?? bundle.fingerprintHash ?? normalizeTargetAppVersion(data.targetAppVersion) ?? normalizeTargetAppVersion(bundle.targetAppVersion);
212
- if (!target) throw new Error("target not found");
213
- const newKey = `${newChannel}/${newPlatform}/${target}/update.json`;
213
+ const updatedBundle = {
214
+ ...bundle,
215
+ ...data
216
+ };
217
+ const newKey = `${updatedBundle.channel}/${updatedBundle.platform}/${resolveStorageTarget(updatedBundle)}/update.json`;
214
218
  if (newKey !== bundle._updateJsonKey) {
215
219
  const oldKey = bundle._updateJsonKey;
216
220
  removalsByKey[oldKey] = removalsByKey[oldKey] || [];
217
221
  removalsByKey[oldKey].push(bundle.id);
218
222
  changedBundlesByKey[newKey] = changedBundlesByKey[newKey] || [];
219
- const updatedBundle = {
220
- ...bundle,
221
- ...data
222
- };
223
223
  updatedBundle._oldUpdateJsonKey = oldKey;
224
224
  updatedBundle._updateJsonKey = newKey;
225
225
  bundlesMap.set(data.id, updatedBundle);
@@ -239,10 +239,6 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
239
239
  continue;
240
240
  }
241
241
  const currentKey = bundle._updateJsonKey;
242
- const updatedBundle = {
243
- ...bundle,
244
- ...data
245
- };
246
242
  bundlesMap.set(data.id, updatedBundle);
247
243
  pendingBundlesMap.set(data.id, updatedBundle);
248
244
  changedBundlesByKey[currentKey] = changedBundlesByKey[currentKey] || [];
@@ -39,6 +39,11 @@ function getSemverNormalizedVersions(version) {
39
39
  if (coerced.minor === 0 && coerced.patch === 0) versions.add(`${coerced.major}`);
40
40
  return Array.from(versions);
41
41
  }
42
+ function resolveStorageTarget({ targetAppVersion, fingerprintHash }) {
43
+ const target = normalizeTargetAppVersion(targetAppVersion) ?? fingerprintHash;
44
+ if (!target) throw new Error("target not found");
45
+ return target;
46
+ }
42
47
  /**
43
48
  * Creates a blob storage-based database plugin with lazy initialization.
44
49
  *
@@ -174,8 +179,7 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
174
179
  if (data.targetAppVersion !== void 0) isTargetAppVersionChanged = true;
175
180
  if (operation === "update" && data.channel !== void 0) isChannelChanged = true;
176
181
  if (operation === "insert") {
177
- const target = normalizeTargetAppVersion(data.targetAppVersion) ?? data.fingerprintHash;
178
- if (!target) throw new Error("target not found");
182
+ const target = resolveStorageTarget(data);
179
183
  const key = `${data.channel}/${data.platform}/${target}/update.json`;
180
184
  const bundleWithKey = {
181
185
  ...data,
@@ -204,20 +208,16 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
204
208
  if (!bundle) bundle = bundlesMap.get(data.id);
205
209
  if (!bundle) throw new Error("targetBundleId not found");
206
210
  if (operation === "update") {
207
- const newChannel = data.channel !== void 0 ? data.channel : bundle.channel;
208
- const newPlatform = data.platform !== void 0 ? data.platform : bundle.platform;
209
- const target = data.fingerprintHash ?? bundle.fingerprintHash ?? normalizeTargetAppVersion(data.targetAppVersion) ?? normalizeTargetAppVersion(bundle.targetAppVersion);
210
- if (!target) throw new Error("target not found");
211
- const newKey = `${newChannel}/${newPlatform}/${target}/update.json`;
211
+ const updatedBundle = {
212
+ ...bundle,
213
+ ...data
214
+ };
215
+ const newKey = `${updatedBundle.channel}/${updatedBundle.platform}/${resolveStorageTarget(updatedBundle)}/update.json`;
212
216
  if (newKey !== bundle._updateJsonKey) {
213
217
  const oldKey = bundle._updateJsonKey;
214
218
  removalsByKey[oldKey] = removalsByKey[oldKey] || [];
215
219
  removalsByKey[oldKey].push(bundle.id);
216
220
  changedBundlesByKey[newKey] = changedBundlesByKey[newKey] || [];
217
- const updatedBundle = {
218
- ...bundle,
219
- ...data
220
- };
221
221
  updatedBundle._oldUpdateJsonKey = oldKey;
222
222
  updatedBundle._updateJsonKey = newKey;
223
223
  bundlesMap.set(data.id, updatedBundle);
@@ -237,10 +237,6 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
237
237
  continue;
238
238
  }
239
239
  const currentKey = bundle._updateJsonKey;
240
- const updatedBundle = {
241
- ...bundle,
242
- ...data
243
- };
244
240
  bundlesMap.set(data.id, updatedBundle);
245
241
  pendingBundlesMap.set(data.id, updatedBundle);
246
242
  changedBundlesByKey[currentKey] = changedBundlesByKey[currentKey] || [];
@@ -35,12 +35,12 @@ function mergeBundleUpdate(baseBundle, patch) {
35
35
  */
36
36
  function createDatabasePlugin(options) {
37
37
  return (config, hooks) => {
38
+ let cachedMethods = null;
39
+ const getMethods = () => {
40
+ if (!cachedMethods) cachedMethods = options.factory(config);
41
+ return cachedMethods;
42
+ };
38
43
  return () => {
39
- let cachedMethods = null;
40
- const getMethods = () => {
41
- if (!cachedMethods) cachedMethods = options.factory(config);
42
- return cachedMethods;
43
- };
44
44
  const changedMap = /* @__PURE__ */ new Map();
45
45
  const markChanged = (operation, data) => {
46
46
  changedMap.set(data.id, {
@@ -71,8 +71,8 @@ function createDatabasePlugin(options) {
71
71
  const params = { changedSets: Array.from(changedMap.values()) };
72
72
  if (context === void 0) await methods.commitBundle(params);
73
73
  else await methods.commitBundle(params, context);
74
- await hooks?.onDatabaseUpdated?.();
75
74
  changedMap.clear();
75
+ await hooks?.onDatabaseUpdated?.();
76
76
  },
77
77
  async updateBundle(targetBundleId, newBundle, context) {
78
78
  const pendingChange = changedMap.get(targetBundleId);
@@ -1,13 +1,10 @@
1
- import { DatabaseBundleQueryOptions, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, PaginationInfo } from "./types/index.cjs";
1
+ import { DatabaseBundleQueryOptions, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, Paginated } from "./types/index.cjs";
2
2
  import { Bundle } 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
- getBundles: (options: DatabaseBundleQueryOptions, context?: HotUpdaterContext<TContext>) => Promise<{
8
- data: Bundle[];
9
- pagination: PaginationInfo;
10
- }>;
7
+ getBundles: (options: DatabaseBundleQueryOptions, context?: HotUpdaterContext<TContext>) => Promise<Paginated<Bundle[]>>;
11
8
  getChannels: (context?: HotUpdaterContext<TContext>) => Promise<string[]>;
12
9
  onUnmount?: () => Promise<void>;
13
10
  commitBundle: (params: {
@@ -1,13 +1,10 @@
1
- import { DatabaseBundleQueryOptions, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, PaginationInfo } from "./types/index.mjs";
1
+ import { DatabaseBundleQueryOptions, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, Paginated } from "./types/index.mjs";
2
2
  import { Bundle } 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
- getBundles: (options: DatabaseBundleQueryOptions, context?: HotUpdaterContext<TContext>) => Promise<{
8
- data: Bundle[];
9
- pagination: PaginationInfo;
10
- }>;
7
+ getBundles: (options: DatabaseBundleQueryOptions, context?: HotUpdaterContext<TContext>) => Promise<Paginated<Bundle[]>>;
11
8
  getChannels: (context?: HotUpdaterContext<TContext>) => Promise<string[]>;
12
9
  onUnmount?: () => Promise<void>;
13
10
  commitBundle: (params: {
@@ -34,12 +34,12 @@ function mergeBundleUpdate(baseBundle, patch) {
34
34
  */
35
35
  function createDatabasePlugin(options) {
36
36
  return (config, hooks) => {
37
+ let cachedMethods = null;
38
+ const getMethods = () => {
39
+ if (!cachedMethods) cachedMethods = options.factory(config);
40
+ return cachedMethods;
41
+ };
37
42
  return () => {
38
- let cachedMethods = null;
39
- const getMethods = () => {
40
- if (!cachedMethods) cachedMethods = options.factory(config);
41
- return cachedMethods;
42
- };
43
43
  const changedMap = /* @__PURE__ */ new Map();
44
44
  const markChanged = (operation, data) => {
45
45
  changedMap.set(data.id, {
@@ -70,8 +70,8 @@ function createDatabasePlugin(options) {
70
70
  const params = { changedSets: Array.from(changedMap.values()) };
71
71
  if (context === void 0) await methods.commitBundle(params);
72
72
  else await methods.commitBundle(params, context);
73
- await hooks?.onDatabaseUpdated?.();
74
73
  changedMap.clear();
74
+ await hooks?.onDatabaseUpdated?.();
75
75
  },
76
76
  async updateBundle(targetBundleId, newBundle, context) {
77
77
  const pendingChange = changedMap.get(targetBundleId);
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
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, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, supportedIosPlatforms } from "./types/index.cjs";
3
- import { PaginatedResult, PaginationOptions, calculatePagination } from "./calculatePagination.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";
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";
6
6
  import { AbstractDatabasePlugin, CreateDatabasePluginOptions, createDatabasePlugin } from "./createDatabasePlugin.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, 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, 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 };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
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, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, supportedIosPlatforms } from "./types/index.mjs";
3
- import { PaginatedResult, PaginationOptions, calculatePagination } from "./calculatePagination.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";
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";
6
6
  import { AbstractDatabasePlugin, CreateDatabasePluginOptions, createDatabasePlugin } from "./createDatabasePlugin.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, 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, 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 };
@@ -12,6 +12,11 @@ interface PaginationInfo {
12
12
  currentPage: number;
13
13
  totalPages: number;
14
14
  }
15
+ interface Paginated<TData> {
16
+ data: TData;
17
+ pagination: PaginationInfo;
18
+ }
19
+ type PaginatedResult = Paginated<Bundle[]>;
15
20
  interface DatabaseBundleIdFilter {
16
21
  eq?: string;
17
22
  gt?: string;
@@ -46,10 +51,7 @@ interface BuildPluginConfig {
46
51
  interface DatabasePlugin<TContext = unknown> {
47
52
  getChannels: (context?: HotUpdaterContext<TContext>) => Promise<string[]>;
48
53
  getBundleById: (bundleId: string, context?: HotUpdaterContext<TContext>) => Promise<Bundle | null>;
49
- getBundles: (options: DatabaseBundleQueryOptions, context?: HotUpdaterContext<TContext>) => Promise<{
50
- data: Bundle[];
51
- pagination: PaginationInfo;
52
- }>;
54
+ getBundles: (options: DatabaseBundleQueryOptions, context?: HotUpdaterContext<TContext>) => Promise<Paginated<Bundle[]>>;
53
55
  updateBundle: (targetBundleId: string, newBundle: Partial<Bundle>, context?: HotUpdaterContext<TContext>) => Promise<void>;
54
56
  appendBundle: (insertBundle: Bundle, context?: HotUpdaterContext<TContext>) => Promise<void>;
55
57
  commitBundle: (context?: HotUpdaterContext<TContext>) => Promise<void>;
@@ -389,4 +391,4 @@ interface NativeBuildOptions {
389
391
  scheme?: string;
390
392
  }
391
393
  //#endregion
392
- export { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, PaginationInfo, type Platform$1 as Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, supportedIosPlatforms };
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 };
@@ -12,6 +12,11 @@ interface PaginationInfo {
12
12
  currentPage: number;
13
13
  totalPages: number;
14
14
  }
15
+ interface Paginated<TData> {
16
+ data: TData;
17
+ pagination: PaginationInfo;
18
+ }
19
+ type PaginatedResult = Paginated<Bundle[]>;
15
20
  interface DatabaseBundleIdFilter {
16
21
  eq?: string;
17
22
  gt?: string;
@@ -46,10 +51,7 @@ interface BuildPluginConfig {
46
51
  interface DatabasePlugin<TContext = unknown> {
47
52
  getChannels: (context?: HotUpdaterContext<TContext>) => Promise<string[]>;
48
53
  getBundleById: (bundleId: string, context?: HotUpdaterContext<TContext>) => Promise<Bundle | null>;
49
- getBundles: (options: DatabaseBundleQueryOptions, context?: HotUpdaterContext<TContext>) => Promise<{
50
- data: Bundle[];
51
- pagination: PaginationInfo;
52
- }>;
54
+ getBundles: (options: DatabaseBundleQueryOptions, context?: HotUpdaterContext<TContext>) => Promise<Paginated<Bundle[]>>;
53
55
  updateBundle: (targetBundleId: string, newBundle: Partial<Bundle>, context?: HotUpdaterContext<TContext>) => Promise<void>;
54
56
  appendBundle: (insertBundle: Bundle, context?: HotUpdaterContext<TContext>) => Promise<void>;
55
57
  commitBundle: (context?: HotUpdaterContext<TContext>) => Promise<void>;
@@ -389,4 +391,4 @@ interface NativeBuildOptions {
389
391
  scheme?: string;
390
392
  }
391
393
  //#endregion
392
- export { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, PaginationInfo, type Platform$1 as Platform, PlatformConfig, RequestEnvContext, SigningConfig, StoragePlugin, StoragePluginHooks, StorageResolveContext, supportedIosPlatforms };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/plugin-core",
3
- "version": "0.29.2",
3
+ "version": "0.29.4",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -42,13 +42,13 @@
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.2"
45
+ "@hot-updater/core": "0.29.4"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^20",
49
49
  "@types/semver": "^7.5.8",
50
- "typescript": "5.8.2",
51
- "@hot-updater/test-utils": "0.29.2"
50
+ "typescript": "6.0.2",
51
+ "@hot-updater/test-utils": "0.29.4"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "tsdown",