@hot-updater/standalone 0.29.5 → 0.29.7

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
@@ -84,6 +84,7 @@ const standaloneRepository = (0, _hot_updater_plugin_core.createDatabasePlugin)(
84
84
  ...routeHeaders
85
85
  });
86
86
  return {
87
+ supportsCursorPagination: true,
87
88
  async getBundleById(bundleId) {
88
89
  try {
89
90
  const { path, headers: routeHeaders } = routes.retrieve(bundleId);
@@ -98,13 +99,17 @@ const standaloneRepository = (0, _hot_updater_plugin_core.createDatabasePlugin)(
98
99
  }
99
100
  },
100
101
  async getBundles(options) {
101
- const { where, limit, offset = 0 } = options ?? {};
102
+ const { where, limit, cursor, page } = options ?? {};
103
+ const internalOffset = options && typeof options === "object" && "offset" in options && typeof options.offset === "number" ? options.offset : void 0;
102
104
  const { path, headers: routeHeaders } = routes.list();
103
105
  const url = new URL(buildUrl(path));
106
+ const resolvedPage = page ?? (internalOffset !== void 0 && limit > 0 ? Math.floor(internalOffset / limit) + 1 : void 0);
104
107
  if (where?.channel !== void 0) url.searchParams.set("channel", where.channel);
105
108
  if (where?.platform !== void 0) url.searchParams.set("platform", where.platform);
106
109
  if (limit !== void 0) url.searchParams.set("limit", String(limit));
107
- url.searchParams.set("offset", String(offset));
110
+ if (resolvedPage !== void 0) url.searchParams.set("page", String(resolvedPage));
111
+ if (cursor?.after !== void 0) url.searchParams.set("after", cursor.after);
112
+ if (cursor?.before !== void 0) url.searchParams.set("before", cursor.before);
108
113
  const response = await fetch(url.toString(), {
109
114
  method: "GET",
110
115
  headers: getHeaders(routeHeaders)
package/dist/index.mjs CHANGED
@@ -81,6 +81,7 @@ const standaloneRepository = createDatabasePlugin({
81
81
  ...routeHeaders
82
82
  });
83
83
  return {
84
+ supportsCursorPagination: true,
84
85
  async getBundleById(bundleId) {
85
86
  try {
86
87
  const { path, headers: routeHeaders } = routes.retrieve(bundleId);
@@ -95,13 +96,17 @@ const standaloneRepository = createDatabasePlugin({
95
96
  }
96
97
  },
97
98
  async getBundles(options) {
98
- const { where, limit, offset = 0 } = options ?? {};
99
+ const { where, limit, cursor, page } = options ?? {};
100
+ const internalOffset = options && typeof options === "object" && "offset" in options && typeof options.offset === "number" ? options.offset : void 0;
99
101
  const { path, headers: routeHeaders } = routes.list();
100
102
  const url = new URL(buildUrl(path));
103
+ const resolvedPage = page ?? (internalOffset !== void 0 && limit > 0 ? Math.floor(internalOffset / limit) + 1 : void 0);
101
104
  if (where?.channel !== void 0) url.searchParams.set("channel", where.channel);
102
105
  if (where?.platform !== void 0) url.searchParams.set("platform", where.platform);
103
106
  if (limit !== void 0) url.searchParams.set("limit", String(limit));
104
- url.searchParams.set("offset", String(offset));
107
+ if (resolvedPage !== void 0) url.searchParams.set("page", String(resolvedPage));
108
+ if (cursor?.after !== void 0) url.searchParams.set("after", cursor.after);
109
+ if (cursor?.before !== void 0) url.searchParams.set("before", cursor.before);
105
110
  const response = await fetch(url.toString(), {
106
111
  method: "GET",
107
112
  headers: getHeaders(routeHeaders)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/standalone",
3
- "version": "0.29.5",
3
+ "version": "0.29.7",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -39,8 +39,8 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@hot-updater/core": "0.29.5",
43
- "@hot-updater/plugin-core": "0.29.5"
42
+ "@hot-updater/core": "0.29.7",
43
+ "@hot-updater/plugin-core": "0.29.7"
44
44
  },
45
45
  "devDependencies": {
46
46
  "mime": "2.6.0",