@hot-updater/standalone 0.18.1 → 0.18.3

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
@@ -1335,7 +1335,7 @@ var require_mime = __commonJS({ "../../node_modules/.pnpm/mime@2.6.0/node_module
1335
1335
 
1336
1336
  //#endregion
1337
1337
  //#region src/standaloneStorage.ts
1338
- var import_mime = __toESM(require_mime(), 1);
1338
+ var import_mime = __toESM(require_mime());
1339
1339
  const defaultRoutes$1 = {
1340
1340
  uploadBundle: (bundleId, bundlePath) => ({ path: "/uploadBundle" }),
1341
1341
  deleteBundle: (bundleId) => ({ path: "/deleteBundle" })
@@ -1459,12 +1459,23 @@ const standaloneRepository = (config, hooks) => {
1459
1459
  let filteredBundles = bundles;
1460
1460
  if (where?.channel) filteredBundles = filteredBundles.filter((b) => b.channel === where.channel);
1461
1461
  if (where?.platform) filteredBundles = filteredBundles.filter((b) => b.platform === where.platform);
1462
- if (limit) return filteredBundles.slice(offset, offset + limit);
1463
- return filteredBundles;
1462
+ const total = filteredBundles.length;
1463
+ const data = limit ? filteredBundles.slice(offset, offset + limit) : filteredBundles;
1464
+ const pagination = (0, __hot_updater_plugin_core.calculatePagination)(total, {
1465
+ limit,
1466
+ offset
1467
+ });
1468
+ return {
1469
+ data,
1470
+ pagination
1471
+ };
1464
1472
  },
1465
1473
  async getChannels(_) {
1466
- const allBundles = await this.getBundles(_);
1467
- return [...new Set(allBundles.map((b) => b.channel))];
1474
+ const result = await this.getBundles(_, {
1475
+ limit: 50,
1476
+ offset: 0
1477
+ });
1478
+ return [...new Set(result.data.map((b) => b.channel))];
1468
1479
  },
1469
1480
  async commitBundle(_, { changedSets }) {
1470
1481
  const changedBundles = changedSets.map((set) => set.data);
package/dist/index.d.cts CHANGED
@@ -17,7 +17,6 @@ interface StandaloneRepositoryConfig {
17
17
  routes?: Routes;
18
18
  }
19
19
  declare const standaloneRepository: (config: StandaloneRepositoryConfig, hooks?: DatabasePluginHooks) => (options: _hot_updater_plugin_core0.BasePluginArgs) => _hot_updater_plugin_core0.DatabasePlugin;
20
-
21
20
  //#endregion
22
21
  //#region src/standaloneStorage.d.ts
23
22
  interface StorageRoutes {
@@ -30,6 +29,5 @@ interface StandaloneStorageConfig {
30
29
  routes?: StorageRoutes;
31
30
  }
32
31
  declare const standaloneStorage: (config: StandaloneStorageConfig, hooks?: StoragePluginHooks) => (_: BasePluginArgs) => StoragePlugin;
33
-
34
32
  //#endregion
35
33
  export { RouteConfig, Routes, StandaloneRepositoryConfig, StandaloneStorageConfig, StorageRoutes, standaloneRepository, standaloneStorage };
package/dist/index.d.ts CHANGED
@@ -17,7 +17,6 @@ interface StandaloneRepositoryConfig {
17
17
  routes?: Routes;
18
18
  }
19
19
  declare const standaloneRepository: (config: StandaloneRepositoryConfig, hooks?: DatabasePluginHooks) => (options: _hot_updater_plugin_core0.BasePluginArgs) => _hot_updater_plugin_core0.DatabasePlugin;
20
-
21
20
  //#endregion
22
21
  //#region src/standaloneStorage.d.ts
23
22
  interface StorageRoutes {
@@ -30,6 +29,5 @@ interface StandaloneStorageConfig {
30
29
  routes?: StorageRoutes;
31
30
  }
32
31
  declare const standaloneStorage: (config: StandaloneStorageConfig, hooks?: StoragePluginHooks) => (_: BasePluginArgs) => StoragePlugin;
33
-
34
32
  //#endregion
35
33
  export { RouteConfig, Routes, StandaloneRepositoryConfig, StandaloneStorageConfig, StorageRoutes, standaloneRepository, standaloneStorage };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import path from "path";
2
2
  import fs from "fs/promises";
3
- import { createDatabasePlugin } from "@hot-updater/plugin-core";
3
+ import { calculatePagination, createDatabasePlugin } from "@hot-updater/plugin-core";
4
4
 
5
5
  //#region rolldown:runtime
6
6
  var __create = Object.create;
@@ -1335,7 +1335,7 @@ var require_mime = __commonJS({ "../../node_modules/.pnpm/mime@2.6.0/node_module
1335
1335
 
1336
1336
  //#endregion
1337
1337
  //#region src/standaloneStorage.ts
1338
- var import_mime = __toESM(require_mime(), 1);
1338
+ var import_mime = __toESM(require_mime());
1339
1339
  const defaultRoutes$1 = {
1340
1340
  uploadBundle: (bundleId, bundlePath) => ({ path: "/uploadBundle" }),
1341
1341
  deleteBundle: (bundleId) => ({ path: "/deleteBundle" })
@@ -1459,12 +1459,23 @@ const standaloneRepository = (config, hooks) => {
1459
1459
  let filteredBundles = bundles;
1460
1460
  if (where?.channel) filteredBundles = filteredBundles.filter((b) => b.channel === where.channel);
1461
1461
  if (where?.platform) filteredBundles = filteredBundles.filter((b) => b.platform === where.platform);
1462
- if (limit) return filteredBundles.slice(offset, offset + limit);
1463
- return filteredBundles;
1462
+ const total = filteredBundles.length;
1463
+ const data = limit ? filteredBundles.slice(offset, offset + limit) : filteredBundles;
1464
+ const pagination = calculatePagination(total, {
1465
+ limit,
1466
+ offset
1467
+ });
1468
+ return {
1469
+ data,
1470
+ pagination
1471
+ };
1464
1472
  },
1465
1473
  async getChannels(_) {
1466
- const allBundles = await this.getBundles(_);
1467
- return [...new Set(allBundles.map((b) => b.channel))];
1474
+ const result = await this.getBundles(_, {
1475
+ limit: 50,
1476
+ offset: 0
1477
+ });
1478
+ return [...new Set(result.data.map((b) => b.channel))];
1468
1479
  },
1469
1480
  async commitBundle(_, { changedSets }) {
1470
1481
  const changedBundles = changedSets.map((set) => set.data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/standalone",
3
- "version": "0.18.1",
3
+ "version": "0.18.3",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -38,8 +38,8 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@hot-updater/core": "0.18.1",
42
- "@hot-updater/plugin-core": "0.18.1"
41
+ "@hot-updater/core": "0.18.3",
42
+ "@hot-updater/plugin-core": "0.18.3"
43
43
  },
44
44
  "devDependencies": {
45
45
  "mime": "2.6.0",