@hot-updater/cloudflare 0.6.4 → 0.6.6

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
@@ -889,12 +889,6 @@ var d1Database = (config, hooks) => (_) => {
889
889
  bundles.unshift(inputBundle);
890
890
  markChanged(inputBundle.id);
891
891
  },
892
- async setBundles(inputBundles) {
893
- bundles = inputBundles;
894
- for (const b of inputBundles) {
895
- markChanged(b.id);
896
- }
897
- },
898
892
  async getBundleById(bundleId) {
899
893
  const found = bundles.find((b) => b.id === bundleId);
900
894
  if (found) {
@@ -905,16 +899,17 @@ var d1Database = (config, hooks) => (_) => {
905
899
  `
906
900
  SELECT * FROM bundles WHERE id = ? LIMIT 1`
907
901
  );
908
- const [response] = await cf.d1.database.query(config.databaseId, {
902
+ const singlePage = await cf.d1.database.query(config.databaseId, {
909
903
  account_id: config.accountId,
910
904
  sql,
911
905
  params: [bundleId]
912
906
  });
913
- if (!response.success) {
914
- return null;
907
+ const rows = [];
908
+ for await (const page of singlePage.iterPages()) {
909
+ const data = page.result.flatMap((r) => r.results);
910
+ rows.push(...data);
915
911
  }
916
- const rows = response.results;
917
- if (!rows?.length) {
912
+ if (rows.length === 0) {
918
913
  return null;
919
914
  }
920
915
  const row = rows[0];
@@ -951,17 +946,17 @@ var d1Database = (config, hooks) => (_) => {
951
946
  ORDER BY id DESC
952
947
  `
953
948
  );
954
- const [response] = await cf.d1.database.query(config.databaseId, {
949
+ const singlePage = await cf.d1.database.query(config.databaseId, {
955
950
  account_id: config.accountId,
956
951
  sql,
957
952
  params: []
958
953
  });
959
- if (!response.success) {
960
- bundles = [];
961
- return bundles;
954
+ const rows = [];
955
+ for await (const page of singlePage.iterPages()) {
956
+ const data = page.result.flatMap((r) => r.results);
957
+ rows.push(...data);
962
958
  }
963
- const rows = response.results;
964
- if (!rows?.length) {
959
+ if (rows.length === 0) {
965
960
  bundles = [];
966
961
  } else {
967
962
  bundles = rows.map((row) => ({
package/dist/index.js CHANGED
@@ -356,12 +356,6 @@ var d1Database = (config, hooks) => (_) => {
356
356
  bundles.unshift(inputBundle);
357
357
  markChanged(inputBundle.id);
358
358
  },
359
- async setBundles(inputBundles) {
360
- bundles = inputBundles;
361
- for (const b of inputBundles) {
362
- markChanged(b.id);
363
- }
364
- },
365
359
  async getBundleById(bundleId) {
366
360
  const found = bundles.find((b) => b.id === bundleId);
367
361
  if (found) {
@@ -372,16 +366,17 @@ var d1Database = (config, hooks) => (_) => {
372
366
  `
373
367
  SELECT * FROM bundles WHERE id = ? LIMIT 1`
374
368
  );
375
- const [response] = await cf.d1.database.query(config.databaseId, {
369
+ const singlePage = await cf.d1.database.query(config.databaseId, {
376
370
  account_id: config.accountId,
377
371
  sql,
378
372
  params: [bundleId]
379
373
  });
380
- if (!response.success) {
381
- return null;
374
+ const rows = [];
375
+ for await (const page of singlePage.iterPages()) {
376
+ const data = page.result.flatMap((r) => r.results);
377
+ rows.push(...data);
382
378
  }
383
- const rows = response.results;
384
- if (!rows?.length) {
379
+ if (rows.length === 0) {
385
380
  return null;
386
381
  }
387
382
  const row = rows[0];
@@ -418,17 +413,17 @@ var d1Database = (config, hooks) => (_) => {
418
413
  ORDER BY id DESC
419
414
  `
420
415
  );
421
- const [response] = await cf.d1.database.query(config.databaseId, {
416
+ const singlePage = await cf.d1.database.query(config.databaseId, {
422
417
  account_id: config.accountId,
423
418
  sql,
424
419
  params: []
425
420
  });
426
- if (!response.success) {
427
- bundles = [];
428
- return bundles;
421
+ const rows = [];
422
+ for await (const page of singlePage.iterPages()) {
423
+ const data = page.result.flatMap((r) => r.results);
424
+ rows.push(...data);
429
425
  }
430
- const rows = response.results;
431
- if (!rows?.length) {
426
+ if (rows.length === 0) {
432
427
  bundles = [];
433
428
  } else {
434
429
  bundles = rows.map((row) => ({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/cloudflare",
3
3
  "type": "module",
4
- "version": "0.6.4",
4
+ "version": "0.6.6",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
@@ -39,10 +39,10 @@
39
39
  "package.json"
40
40
  ],
41
41
  "dependencies": {
42
- "@hot-updater/core": "0.6.4",
43
- "@hot-updater/js": "0.6.4",
44
- "@hot-updater/plugin-core": "0.6.4",
45
- "cloudflare": "^4.0.0"
42
+ "@hot-updater/core": "0.6.6",
43
+ "@hot-updater/js": "0.6.6",
44
+ "@hot-updater/plugin-core": "0.6.6",
45
+ "cloudflare": "4.1.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@cloudflare/vitest-pool-workers": "^0.6.4",
@@ -1 +1 @@
1
- This folder contains the built output assets for the worker "hot-updater" generated at 2025-02-04T14:48:12.461Z.
1
+ This folder contains the built output assets for the worker "hot-updater" generated at 2025-02-13T10:46:58.414Z.