@hot-updater/cloudflare 0.33.2 → 0.34.0
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 +37 -15
- package/dist/index.mjs +39 -17
- package/dist/worker/index.cjs +38 -16
- package/dist/worker/index.mjs +40 -18
- package/package.json +7 -7
- package/src/cloudflareWorkerDatabase.ts +56 -33
- package/src/d1Database.ts +50 -31
- package/worker/dist/README.md +1 -1
- package/worker/dist/index.js +169 -130
- package/worker/dist/index.js.map +4 -4
package/worker/dist/index.js
CHANGED
|
@@ -1768,8 +1768,8 @@ var require_compare = __commonJS({
|
|
|
1768
1768
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
1769
1769
|
init_performance2();
|
|
1770
1770
|
var SemVer = require_semver();
|
|
1771
|
-
var
|
|
1772
|
-
module.exports =
|
|
1771
|
+
var compare = /* @__PURE__ */ __name((a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)), "compare");
|
|
1772
|
+
module.exports = compare;
|
|
1773
1773
|
}
|
|
1774
1774
|
});
|
|
1775
1775
|
|
|
@@ -1780,8 +1780,8 @@ var require_rcompare = __commonJS({
|
|
|
1780
1780
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
1781
1781
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
1782
1782
|
init_performance2();
|
|
1783
|
-
var
|
|
1784
|
-
var rcompare = /* @__PURE__ */ __name((a, b, loose) =>
|
|
1783
|
+
var compare = require_compare();
|
|
1784
|
+
var rcompare = /* @__PURE__ */ __name((a, b, loose) => compare(b, a, loose), "rcompare");
|
|
1785
1785
|
module.exports = rcompare;
|
|
1786
1786
|
}
|
|
1787
1787
|
});
|
|
@@ -1793,8 +1793,8 @@ var require_compare_loose = __commonJS({
|
|
|
1793
1793
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
1794
1794
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
1795
1795
|
init_performance2();
|
|
1796
|
-
var
|
|
1797
|
-
var compareLoose = /* @__PURE__ */ __name((a, b) =>
|
|
1796
|
+
var compare = require_compare();
|
|
1797
|
+
var compareLoose = /* @__PURE__ */ __name((a, b) => compare(a, b, true), "compareLoose");
|
|
1798
1798
|
module.exports = compareLoose;
|
|
1799
1799
|
}
|
|
1800
1800
|
});
|
|
@@ -1849,8 +1849,8 @@ var require_gt = __commonJS({
|
|
|
1849
1849
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
1850
1850
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
1851
1851
|
init_performance2();
|
|
1852
|
-
var
|
|
1853
|
-
var gt = /* @__PURE__ */ __name((a, b, loose) =>
|
|
1852
|
+
var compare = require_compare();
|
|
1853
|
+
var gt = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) > 0, "gt");
|
|
1854
1854
|
module.exports = gt;
|
|
1855
1855
|
}
|
|
1856
1856
|
});
|
|
@@ -1862,8 +1862,8 @@ var require_lt = __commonJS({
|
|
|
1862
1862
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
1863
1863
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
1864
1864
|
init_performance2();
|
|
1865
|
-
var
|
|
1866
|
-
var lt = /* @__PURE__ */ __name((a, b, loose) =>
|
|
1865
|
+
var compare = require_compare();
|
|
1866
|
+
var lt = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) < 0, "lt");
|
|
1867
1867
|
module.exports = lt;
|
|
1868
1868
|
}
|
|
1869
1869
|
});
|
|
@@ -1875,8 +1875,8 @@ var require_eq = __commonJS({
|
|
|
1875
1875
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
1876
1876
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
1877
1877
|
init_performance2();
|
|
1878
|
-
var
|
|
1879
|
-
var eq = /* @__PURE__ */ __name((a, b, loose) =>
|
|
1878
|
+
var compare = require_compare();
|
|
1879
|
+
var eq = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) === 0, "eq");
|
|
1880
1880
|
module.exports = eq;
|
|
1881
1881
|
}
|
|
1882
1882
|
});
|
|
@@ -1888,8 +1888,8 @@ var require_neq = __commonJS({
|
|
|
1888
1888
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
1889
1889
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
1890
1890
|
init_performance2();
|
|
1891
|
-
var
|
|
1892
|
-
var neq = /* @__PURE__ */ __name((a, b, loose) =>
|
|
1891
|
+
var compare = require_compare();
|
|
1892
|
+
var neq = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) !== 0, "neq");
|
|
1893
1893
|
module.exports = neq;
|
|
1894
1894
|
}
|
|
1895
1895
|
});
|
|
@@ -1901,8 +1901,8 @@ var require_gte = __commonJS({
|
|
|
1901
1901
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
1902
1902
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
1903
1903
|
init_performance2();
|
|
1904
|
-
var
|
|
1905
|
-
var gte = /* @__PURE__ */ __name((a, b, loose) =>
|
|
1904
|
+
var compare = require_compare();
|
|
1905
|
+
var gte = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) >= 0, "gte");
|
|
1906
1906
|
module.exports = gte;
|
|
1907
1907
|
}
|
|
1908
1908
|
});
|
|
@@ -1914,8 +1914,8 @@ var require_lte = __commonJS({
|
|
|
1914
1914
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
1915
1915
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
1916
1916
|
init_performance2();
|
|
1917
|
-
var
|
|
1918
|
-
var lte = /* @__PURE__ */ __name((a, b, loose) =>
|
|
1917
|
+
var compare = require_compare();
|
|
1918
|
+
var lte = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) <= 0, "lte");
|
|
1919
1919
|
module.exports = lte;
|
|
1920
1920
|
}
|
|
1921
1921
|
});
|
|
@@ -2920,12 +2920,12 @@ var require_simplify = __commonJS({
|
|
|
2920
2920
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
2921
2921
|
init_performance2();
|
|
2922
2922
|
var satisfies = require_satisfies();
|
|
2923
|
-
var
|
|
2923
|
+
var compare = require_compare();
|
|
2924
2924
|
module.exports = (versions2, range, options) => {
|
|
2925
2925
|
const set = [];
|
|
2926
2926
|
let first = null;
|
|
2927
2927
|
let prev = null;
|
|
2928
|
-
const v = versions2.sort((a, b) =>
|
|
2928
|
+
const v = versions2.sort((a, b) => compare(a, b, options));
|
|
2929
2929
|
for (const version2 of v) {
|
|
2930
2930
|
const included = satisfies(version2, range, options);
|
|
2931
2931
|
if (included) {
|
|
@@ -2976,7 +2976,7 @@ var require_subset = __commonJS({
|
|
|
2976
2976
|
var Comparator = require_comparator();
|
|
2977
2977
|
var { ANY } = Comparator;
|
|
2978
2978
|
var satisfies = require_satisfies();
|
|
2979
|
-
var
|
|
2979
|
+
var compare = require_compare();
|
|
2980
2980
|
var subset = /* @__PURE__ */ __name((sub, dom, options = {}) => {
|
|
2981
2981
|
if (sub === dom) {
|
|
2982
2982
|
return true;
|
|
@@ -3036,7 +3036,7 @@ var require_subset = __commonJS({
|
|
|
3036
3036
|
}
|
|
3037
3037
|
let gtltComp;
|
|
3038
3038
|
if (gt && lt) {
|
|
3039
|
-
gtltComp =
|
|
3039
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
3040
3040
|
if (gtltComp > 0) {
|
|
3041
3041
|
return null;
|
|
3042
3042
|
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
@@ -3116,14 +3116,14 @@ var require_subset = __commonJS({
|
|
|
3116
3116
|
if (!a) {
|
|
3117
3117
|
return b;
|
|
3118
3118
|
}
|
|
3119
|
-
const comp =
|
|
3119
|
+
const comp = compare(a.semver, b.semver, options);
|
|
3120
3120
|
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
3121
3121
|
}, "higherGT");
|
|
3122
3122
|
var lowerLT = /* @__PURE__ */ __name((a, b, options) => {
|
|
3123
3123
|
if (!a) {
|
|
3124
3124
|
return b;
|
|
3125
3125
|
}
|
|
3126
|
-
const comp =
|
|
3126
|
+
const comp = compare(a.semver, b.semver, options);
|
|
3127
3127
|
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
3128
3128
|
}, "lowerLT");
|
|
3129
3129
|
module.exports = subset;
|
|
@@ -3150,7 +3150,7 @@ var require_semver2 = __commonJS({
|
|
|
3150
3150
|
var minor = require_minor();
|
|
3151
3151
|
var patch = require_patch();
|
|
3152
3152
|
var prerelease = require_prerelease();
|
|
3153
|
-
var
|
|
3153
|
+
var compare = require_compare();
|
|
3154
3154
|
var rcompare = require_rcompare();
|
|
3155
3155
|
var compareLoose = require_compare_loose();
|
|
3156
3156
|
var compareBuild = require_compare_build();
|
|
@@ -3189,7 +3189,7 @@ var require_semver2 = __commonJS({
|
|
|
3189
3189
|
minor,
|
|
3190
3190
|
patch,
|
|
3191
3191
|
prerelease,
|
|
3192
|
-
compare
|
|
3192
|
+
compare,
|
|
3193
3193
|
rcompare,
|
|
3194
3194
|
compareLoose,
|
|
3195
3195
|
compareBuild,
|
|
@@ -4514,17 +4514,17 @@ var require_prerelease2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4514
4514
|
}));
|
|
4515
4515
|
var require_compare2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4516
4516
|
const SemVer = require_semver$1();
|
|
4517
|
-
const
|
|
4518
|
-
module.exports =
|
|
4517
|
+
const compare = /* @__PURE__ */ __name((a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)), "compare");
|
|
4518
|
+
module.exports = compare;
|
|
4519
4519
|
}));
|
|
4520
4520
|
var require_rcompare2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4521
|
-
const
|
|
4522
|
-
const rcompare = /* @__PURE__ */ __name((a, b, loose) =>
|
|
4521
|
+
const compare = require_compare2();
|
|
4522
|
+
const rcompare = /* @__PURE__ */ __name((a, b, loose) => compare(b, a, loose), "rcompare");
|
|
4523
4523
|
module.exports = rcompare;
|
|
4524
4524
|
}));
|
|
4525
4525
|
var require_compare_loose2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4526
|
-
const
|
|
4527
|
-
const compareLoose = /* @__PURE__ */ __name((a, b) =>
|
|
4526
|
+
const compare = require_compare2();
|
|
4527
|
+
const compareLoose = /* @__PURE__ */ __name((a, b) => compare(a, b, true), "compareLoose");
|
|
4528
4528
|
module.exports = compareLoose;
|
|
4529
4529
|
}));
|
|
4530
4530
|
var require_compare_build2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -4547,33 +4547,33 @@ var require_rsort2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4547
4547
|
module.exports = rsort;
|
|
4548
4548
|
}));
|
|
4549
4549
|
var require_gt2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4550
|
-
const
|
|
4551
|
-
const gt = /* @__PURE__ */ __name((a, b, loose) =>
|
|
4550
|
+
const compare = require_compare2();
|
|
4551
|
+
const gt = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) > 0, "gt");
|
|
4552
4552
|
module.exports = gt;
|
|
4553
4553
|
}));
|
|
4554
4554
|
var require_lt2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4555
|
-
const
|
|
4556
|
-
const lt = /* @__PURE__ */ __name((a, b, loose) =>
|
|
4555
|
+
const compare = require_compare2();
|
|
4556
|
+
const lt = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) < 0, "lt");
|
|
4557
4557
|
module.exports = lt;
|
|
4558
4558
|
}));
|
|
4559
4559
|
var require_eq2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4560
|
-
const
|
|
4561
|
-
const eq = /* @__PURE__ */ __name((a, b, loose) =>
|
|
4560
|
+
const compare = require_compare2();
|
|
4561
|
+
const eq = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) === 0, "eq");
|
|
4562
4562
|
module.exports = eq;
|
|
4563
4563
|
}));
|
|
4564
4564
|
var require_neq2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4565
|
-
const
|
|
4566
|
-
const neq = /* @__PURE__ */ __name((a, b, loose) =>
|
|
4565
|
+
const compare = require_compare2();
|
|
4566
|
+
const neq = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) !== 0, "neq");
|
|
4567
4567
|
module.exports = neq;
|
|
4568
4568
|
}));
|
|
4569
4569
|
var require_gte2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4570
|
-
const
|
|
4571
|
-
const gte = /* @__PURE__ */ __name((a, b, loose) =>
|
|
4570
|
+
const compare = require_compare2();
|
|
4571
|
+
const gte = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) >= 0, "gte");
|
|
4572
4572
|
module.exports = gte;
|
|
4573
4573
|
}));
|
|
4574
4574
|
var require_lte2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4575
|
-
const
|
|
4576
|
-
const lte = /* @__PURE__ */ __name((a, b, loose) =>
|
|
4575
|
+
const compare = require_compare2();
|
|
4576
|
+
const lte = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) <= 0, "lte");
|
|
4577
4577
|
module.exports = lte;
|
|
4578
4578
|
}));
|
|
4579
4579
|
var require_cmp2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -5240,12 +5240,12 @@ var require_intersects2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5240
5240
|
}));
|
|
5241
5241
|
var require_simplify2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5242
5242
|
const satisfies = require_satisfies2();
|
|
5243
|
-
const
|
|
5243
|
+
const compare = require_compare2();
|
|
5244
5244
|
module.exports = (versions2, range, options) => {
|
|
5245
5245
|
const set = [];
|
|
5246
5246
|
let first = null;
|
|
5247
5247
|
let prev = null;
|
|
5248
|
-
const v = versions2.sort((a, b) =>
|
|
5248
|
+
const v = versions2.sort((a, b) => compare(a, b, options));
|
|
5249
5249
|
for (const version2 of v) if (satisfies(version2, range, options)) {
|
|
5250
5250
|
prev = version2;
|
|
5251
5251
|
if (!first) first = version2;
|
|
@@ -5271,7 +5271,7 @@ var require_subset2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5271
5271
|
const Comparator = require_comparator2();
|
|
5272
5272
|
const { ANY } = Comparator;
|
|
5273
5273
|
const satisfies = require_satisfies2();
|
|
5274
|
-
const
|
|
5274
|
+
const compare = require_compare2();
|
|
5275
5275
|
const subset = /* @__PURE__ */ __name((sub, dom, options = {}) => {
|
|
5276
5276
|
if (sub === dom) return true;
|
|
5277
5277
|
sub = new Range(sub, options);
|
|
@@ -5304,7 +5304,7 @@ var require_subset2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5304
5304
|
if (eqSet.size > 1) return null;
|
|
5305
5305
|
let gtltComp;
|
|
5306
5306
|
if (gt && lt) {
|
|
5307
|
-
gtltComp =
|
|
5307
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
5308
5308
|
if (gtltComp > 0) return null;
|
|
5309
5309
|
else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
|
|
5310
5310
|
}
|
|
@@ -5349,12 +5349,12 @@ var require_subset2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5349
5349
|
}, "simpleSubset");
|
|
5350
5350
|
const higherGT = /* @__PURE__ */ __name((a, b, options) => {
|
|
5351
5351
|
if (!a) return b;
|
|
5352
|
-
const comp =
|
|
5352
|
+
const comp = compare(a.semver, b.semver, options);
|
|
5353
5353
|
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
5354
5354
|
}, "higherGT");
|
|
5355
5355
|
const lowerLT = /* @__PURE__ */ __name((a, b, options) => {
|
|
5356
5356
|
if (!a) return b;
|
|
5357
|
-
const comp =
|
|
5357
|
+
const comp = compare(a.semver, b.semver, options);
|
|
5358
5358
|
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
5359
5359
|
}, "lowerLT");
|
|
5360
5360
|
module.exports = subset;
|
|
@@ -6706,40 +6706,6 @@ var resolveUpdateInfoFromBundles = /* @__PURE__ */ __name(async ({ args, bundles
|
|
|
6706
6706
|
return info3;
|
|
6707
6707
|
}, "resolveUpdateInfoFromBundles");
|
|
6708
6708
|
|
|
6709
|
-
// ../plugin-core/dist/createDatabasePluginGetUpdateInfo.mjs
|
|
6710
|
-
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
6711
|
-
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
6712
|
-
init_performance2();
|
|
6713
|
-
var normalizeAppVersionArgs = /* @__PURE__ */ __name((args) => ({
|
|
6714
|
-
...args,
|
|
6715
|
-
channel: args.channel ?? "production",
|
|
6716
|
-
minBundleId: args.minBundleId ?? NIL_UUID
|
|
6717
|
-
}), "normalizeAppVersionArgs");
|
|
6718
|
-
var normalizeFingerprintArgs = /* @__PURE__ */ __name((args) => ({
|
|
6719
|
-
...args,
|
|
6720
|
-
channel: args.channel ?? "production",
|
|
6721
|
-
minBundleId: args.minBundleId ?? NIL_UUID
|
|
6722
|
-
}), "normalizeFingerprintArgs");
|
|
6723
|
-
var createDatabasePluginGetUpdateInfo = /* @__PURE__ */ __name(({ getBundlesByFingerprint, getBundlesByTargetAppVersions, listTargetAppVersions }) => {
|
|
6724
|
-
return async (args, context2) => {
|
|
6725
|
-
if (args._updateStrategy === "appVersion") {
|
|
6726
|
-
const normalizedArgs2 = normalizeAppVersionArgs(args);
|
|
6727
|
-
const compatibleAppVersions = filterCompatibleAppVersions(await listTargetAppVersions(normalizedArgs2, context2), normalizedArgs2.appVersion);
|
|
6728
|
-
return resolveUpdateInfoFromBundles({
|
|
6729
|
-
args: normalizedArgs2,
|
|
6730
|
-
bundles: compatibleAppVersions.length > 0 ? await getBundlesByTargetAppVersions(normalizedArgs2, compatibleAppVersions, context2) : [],
|
|
6731
|
-
context: context2
|
|
6732
|
-
});
|
|
6733
|
-
}
|
|
6734
|
-
const normalizedArgs = normalizeFingerprintArgs(args);
|
|
6735
|
-
return resolveUpdateInfoFromBundles({
|
|
6736
|
-
args: normalizedArgs,
|
|
6737
|
-
bundles: await getBundlesByFingerprint(normalizedArgs, context2),
|
|
6738
|
-
context: context2
|
|
6739
|
-
});
|
|
6740
|
-
};
|
|
6741
|
-
}, "createDatabasePluginGetUpdateInfo");
|
|
6742
|
-
|
|
6743
6709
|
// ../plugin-core/dist/createStoragePlugin.mjs
|
|
6744
6710
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
6745
6711
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
@@ -6853,7 +6819,6 @@ init_performance2();
|
|
|
6853
6819
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
6854
6820
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
6855
6821
|
init_performance2();
|
|
6856
|
-
var import_semver3 = __toESM(require_semver2(), 1);
|
|
6857
6822
|
var normalizeNullableString = /* @__PURE__ */ __name((value) => {
|
|
6858
6823
|
if (value === null || value === void 0) {
|
|
6859
6824
|
return null;
|
|
@@ -7149,13 +7114,14 @@ var INIT_BUNDLE_ROLLBACK_UPDATE_INFO2 = {
|
|
|
7149
7114
|
fileHash: null
|
|
7150
7115
|
};
|
|
7151
7116
|
function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
|
|
7117
|
+
const coreOptions = options;
|
|
7152
7118
|
const runWithMutationPlugin = /* @__PURE__ */ __name(async (operation) => {
|
|
7153
|
-
const plugin =
|
|
7119
|
+
const plugin = coreOptions?.createMutationPlugin?.() ?? getPlugin();
|
|
7154
7120
|
try {
|
|
7155
7121
|
return await operation(plugin);
|
|
7156
7122
|
} finally {
|
|
7157
|
-
if (
|
|
7158
|
-
await
|
|
7123
|
+
if (coreOptions?.createMutationPlugin) {
|
|
7124
|
+
await coreOptions.cleanupMutationPlugin?.(plugin);
|
|
7159
7125
|
}
|
|
7160
7126
|
}
|
|
7161
7127
|
}, "runWithMutationPlugin");
|
|
@@ -7256,9 +7222,11 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
|
|
|
7256
7222
|
}), "getBaseWhere");
|
|
7257
7223
|
const api = {
|
|
7258
7224
|
async getBundleById(id, context2) {
|
|
7225
|
+
await coreOptions?.beforeOperation?.();
|
|
7259
7226
|
return getPlugin().getBundleById(id, context2);
|
|
7260
7227
|
},
|
|
7261
7228
|
async getUpdateInfo(args, context2) {
|
|
7229
|
+
await coreOptions?.beforeOperation?.();
|
|
7262
7230
|
const plugin = getPlugin();
|
|
7263
7231
|
const directGetUpdateInfo = plugin.getUpdateInfo;
|
|
7264
7232
|
if (directGetUpdateInfo) {
|
|
@@ -7301,7 +7269,7 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
|
|
|
7301
7269
|
return null;
|
|
7302
7270
|
}
|
|
7303
7271
|
const { storageUri, ...rest } = info3;
|
|
7304
|
-
const readStorageText =
|
|
7272
|
+
const readStorageText = coreOptions?.readStorageText;
|
|
7305
7273
|
if (info3.id === NIL_UUID || !readStorageText) {
|
|
7306
7274
|
const fileUrl2 = await resolveFileUrl(storageUri ?? null, context2);
|
|
7307
7275
|
const baseResponse2 = { ...rest, fileUrl: fileUrl2 };
|
|
@@ -7346,12 +7314,15 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
|
|
|
7346
7314
|
};
|
|
7347
7315
|
},
|
|
7348
7316
|
async getChannels(context2) {
|
|
7317
|
+
await coreOptions?.beforeOperation?.();
|
|
7349
7318
|
return getPlugin().getChannels(context2);
|
|
7350
7319
|
},
|
|
7351
7320
|
async getBundles(options2, context2) {
|
|
7321
|
+
await coreOptions?.beforeOperation?.();
|
|
7352
7322
|
return getPlugin().getBundles(options2, context2);
|
|
7353
7323
|
},
|
|
7354
7324
|
async insertBundle(bundle, context2) {
|
|
7325
|
+
await coreOptions?.beforeOperation?.();
|
|
7355
7326
|
assertBundlePersistenceConstraints(bundle);
|
|
7356
7327
|
await runWithMutationPlugin(async (plugin) => {
|
|
7357
7328
|
await plugin.appendBundle(bundle, context2);
|
|
@@ -7359,6 +7330,7 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
|
|
|
7359
7330
|
});
|
|
7360
7331
|
},
|
|
7361
7332
|
async updateBundleById(bundleId, newBundle, context2) {
|
|
7333
|
+
await coreOptions?.beforeOperation?.();
|
|
7362
7334
|
await runWithMutationPlugin(async (plugin) => {
|
|
7363
7335
|
const current = await plugin.getBundleById(bundleId, context2);
|
|
7364
7336
|
if (!current) {
|
|
@@ -7370,6 +7342,7 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
|
|
|
7370
7342
|
});
|
|
7371
7343
|
},
|
|
7372
7344
|
async deleteBundleById(bundleId, context2) {
|
|
7345
|
+
await coreOptions?.beforeOperation?.();
|
|
7373
7346
|
await runWithMutationPlugin(async (plugin) => {
|
|
7374
7347
|
const bundle = await plugin.getBundleById(bundleId, context2);
|
|
7375
7348
|
if (!bundle) {
|
|
@@ -7385,35 +7358,61 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
|
|
|
7385
7358
|
adapterName: getPlugin().name,
|
|
7386
7359
|
createMigrator: /* @__PURE__ */ __name(() => {
|
|
7387
7360
|
throw new Error(
|
|
7388
|
-
"createMigrator is only available for Kysely/
|
|
7361
|
+
"createMigrator is only available for Kysely/MongoDB database adapters."
|
|
7389
7362
|
);
|
|
7390
7363
|
}, "createMigrator"),
|
|
7391
7364
|
generateSchema: /* @__PURE__ */ __name(() => {
|
|
7392
7365
|
throw new Error(
|
|
7393
|
-
"generateSchema is only available for
|
|
7366
|
+
"generateSchema is only available for Drizzle/Prisma database adapters."
|
|
7394
7367
|
);
|
|
7395
7368
|
}, "generateSchema")
|
|
7396
7369
|
};
|
|
7397
7370
|
}
|
|
7398
7371
|
__name(createPluginDatabaseCore, "createPluginDatabaseCore");
|
|
7399
7372
|
|
|
7400
|
-
// ../../packages/server/src/db/
|
|
7373
|
+
// ../../packages/server/src/db/schemaReadiness.ts
|
|
7401
7374
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
7402
7375
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
7403
7376
|
init_performance2();
|
|
7404
7377
|
|
|
7405
|
-
// ../../
|
|
7378
|
+
// ../../packages/server/src/schema/types.ts
|
|
7406
7379
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
7407
7380
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
7408
7381
|
init_performance2();
|
|
7382
|
+
var HOT_UPDATER_SCHEMA_VERSION = "0.31.0";
|
|
7383
|
+
|
|
7384
|
+
// ../../packages/server/src/db/schemaReadiness.ts
|
|
7385
|
+
var HotUpdaterSchemaMigrationRequiredError = class extends Error {
|
|
7386
|
+
constructor(adapterName, currentVersion) {
|
|
7387
|
+
super(
|
|
7388
|
+
currentVersion === void 0 ? `Hot Updater database schema is not initialized for ${adapterName}. Run \`hot-updater db migrate\` before using this adapter.` : `Hot Updater database schema version ${currentVersion} is not supported by ${adapterName}. Run \`hot-updater db migrate\` to upgrade to ${HOT_UPDATER_SCHEMA_VERSION}.`
|
|
7389
|
+
);
|
|
7390
|
+
this.adapterName = adapterName;
|
|
7391
|
+
this.currentVersion = currentVersion;
|
|
7392
|
+
this.name = "HotUpdaterSchemaMigrationRequiredError";
|
|
7393
|
+
}
|
|
7394
|
+
static {
|
|
7395
|
+
__name(this, "HotUpdaterSchemaMigrationRequiredError");
|
|
7396
|
+
}
|
|
7397
|
+
};
|
|
7398
|
+
var createSchemaReadinessChecker = /* @__PURE__ */ __name((adapterName, createMigrator) => {
|
|
7399
|
+
if (!createMigrator) return async () => {
|
|
7400
|
+
};
|
|
7401
|
+
let ready = false;
|
|
7402
|
+
return async () => {
|
|
7403
|
+
if (ready) return;
|
|
7404
|
+
const version2 = await createMigrator().getVersion();
|
|
7405
|
+
if (version2 !== HOT_UPDATER_SCHEMA_VERSION) {
|
|
7406
|
+
throw new HotUpdaterSchemaMigrationRequiredError(adapterName, version2);
|
|
7407
|
+
}
|
|
7408
|
+
ready = true;
|
|
7409
|
+
};
|
|
7410
|
+
}, "createSchemaReadinessChecker");
|
|
7409
7411
|
|
|
7410
|
-
// ../../
|
|
7412
|
+
// ../../packages/server/src/db/types.ts
|
|
7411
7413
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
7412
7414
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
7413
7415
|
init_performance2();
|
|
7414
|
-
|
|
7415
|
-
// ../../node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk+credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/index.js
|
|
7416
|
-
var import_semver4 = __toESM(require_semver2(), 1);
|
|
7417
7416
|
var sqlProviders = [
|
|
7418
7417
|
"sqlite",
|
|
7419
7418
|
"cockroachdb",
|
|
@@ -7423,8 +7422,6 @@ var sqlProviders = [
|
|
|
7423
7422
|
];
|
|
7424
7423
|
var noSqlProviders = ["mongodb"];
|
|
7425
7424
|
var providers = [...sqlProviders, ...noSqlProviders];
|
|
7426
|
-
|
|
7427
|
-
// ../../packages/server/src/db/types.ts
|
|
7428
7425
|
function isDatabasePluginFactory(adapter) {
|
|
7429
7426
|
return typeof adapter === "function";
|
|
7430
7427
|
}
|
|
@@ -7438,7 +7435,7 @@ __name(isDatabasePlugin, "isDatabasePlugin");
|
|
|
7438
7435
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
7439
7436
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
|
|
7440
7437
|
init_performance2();
|
|
7441
|
-
var
|
|
7438
|
+
var import_semver3 = __toESM(require_semver2(), 1);
|
|
7442
7439
|
|
|
7443
7440
|
// ../../packages/server/src/internalRouter.ts
|
|
7444
7441
|
init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
|
|
@@ -7516,7 +7513,7 @@ init_performance2();
|
|
|
7516
7513
|
// ../../packages/server/package.json
|
|
7517
7514
|
var package_default = {
|
|
7518
7515
|
name: "@hot-updater/server",
|
|
7519
|
-
version: "0.
|
|
7516
|
+
version: "0.34.0",
|
|
7520
7517
|
type: "module",
|
|
7521
7518
|
description: "React Native OTA solution for self-hosted",
|
|
7522
7519
|
sideEffects: false,
|
|
@@ -7574,28 +7571,42 @@ var package_default = {
|
|
|
7574
7571
|
"@hot-updater/core": "workspace:*",
|
|
7575
7572
|
"@hot-updater/plugin-core": "workspace:*",
|
|
7576
7573
|
"@hot-updater/js": "workspace:*",
|
|
7577
|
-
fumadb: "catalog:db",
|
|
7578
|
-
kysely: "catalog:db",
|
|
7579
|
-
mongodb: "catalog:db",
|
|
7580
7574
|
rou3: "0.7.9",
|
|
7581
7575
|
semver: "^7.7.2"
|
|
7582
7576
|
},
|
|
7577
|
+
peerDependencies: {
|
|
7578
|
+
"@prisma/client": "*",
|
|
7579
|
+
"drizzle-orm": "*",
|
|
7580
|
+
kysely: "*",
|
|
7581
|
+
mongodb: "*"
|
|
7582
|
+
},
|
|
7583
|
+
peerDependenciesMeta: {
|
|
7584
|
+
"@prisma/client": {
|
|
7585
|
+
optional: true
|
|
7586
|
+
},
|
|
7587
|
+
"drizzle-orm": {
|
|
7588
|
+
optional: true
|
|
7589
|
+
},
|
|
7590
|
+
kysely: {
|
|
7591
|
+
optional: true
|
|
7592
|
+
},
|
|
7593
|
+
mongodb: {
|
|
7594
|
+
optional: true
|
|
7595
|
+
}
|
|
7596
|
+
},
|
|
7583
7597
|
devDependencies: {
|
|
7584
7598
|
"@electric-sql/pglite": "catalog:db",
|
|
7585
7599
|
"@hot-updater/standalone": "workspace:*",
|
|
7586
7600
|
"@hot-updater/test-utils": "workspace:*",
|
|
7587
7601
|
"@types/node": "catalog:",
|
|
7588
7602
|
"@types/semver": "^7.5.8",
|
|
7603
|
+
"drizzle-orm": "catalog:db",
|
|
7589
7604
|
execa: "catalog:tools",
|
|
7605
|
+
kysely: "catalog:db",
|
|
7590
7606
|
"kysely-pglite-dialect": "catalog:db",
|
|
7607
|
+
mongodb: "catalog:db",
|
|
7591
7608
|
msw: "^2.7.0",
|
|
7592
7609
|
uuidv7: "^1.0.2"
|
|
7593
|
-
},
|
|
7594
|
-
inlinedDependencies: {
|
|
7595
|
-
"@noble/hashes": "1.8.0",
|
|
7596
|
-
"@paralleldrive/cuid2": "2.3.1",
|
|
7597
|
-
"drizzle-orm": "0.45.2",
|
|
7598
|
-
fumadb: "0.2.2"
|
|
7599
7610
|
}
|
|
7600
7611
|
};
|
|
7601
7612
|
|
|
@@ -7621,8 +7632,8 @@ var supportsExplicitNoUpdateResponse = /* @__PURE__ */ __name((request) => {
|
|
|
7621
7632
|
if (!sdkVersion) {
|
|
7622
7633
|
return false;
|
|
7623
7634
|
}
|
|
7624
|
-
const normalizedSdkVersion =
|
|
7625
|
-
return normalizedSdkVersion !== null &&
|
|
7635
|
+
const normalizedSdkVersion = import_semver3.default.valid(sdkVersion);
|
|
7636
|
+
return normalizedSdkVersion !== null && import_semver3.default.gte(normalizedSdkVersion, EXPLICIT_NO_UPDATE_MIN_SDK_VERSION);
|
|
7626
7637
|
}, "supportsExplicitNoUpdateResponse");
|
|
7627
7638
|
var serializeUpdateInfo = /* @__PURE__ */ __name((updateInfo, request) => {
|
|
7628
7639
|
if (updateInfo) {
|
|
@@ -8099,14 +8110,21 @@ function createHotUpdater(options) {
|
|
|
8099
8110
|
"@hot-updater/server/runtime only supports database plugins."
|
|
8100
8111
|
);
|
|
8101
8112
|
}
|
|
8113
|
+
const capabilities = database;
|
|
8102
8114
|
const plugin = isDatabasePluginFactory(database) ? database() : database;
|
|
8115
|
+
const adapterName = capabilities.adapterName ?? plugin.name;
|
|
8116
|
+
const assertSchemaReady = createSchemaReadinessChecker(
|
|
8117
|
+
adapterName,
|
|
8118
|
+
capabilities.createMigrator
|
|
8119
|
+
);
|
|
8103
8120
|
const core = createPluginDatabaseCore(
|
|
8104
8121
|
() => plugin,
|
|
8105
8122
|
resolveFileUrl,
|
|
8106
8123
|
isDatabasePluginFactory(database) ? {
|
|
8107
8124
|
createMutationPlugin: /* @__PURE__ */ __name(() => database(), "createMutationPlugin"),
|
|
8125
|
+
beforeOperation: assertSchemaReady,
|
|
8108
8126
|
readStorageText
|
|
8109
|
-
} : { readStorageText }
|
|
8127
|
+
} : { beforeOperation: assertSchemaReady, readStorageText }
|
|
8110
8128
|
);
|
|
8111
8129
|
const internalHandler = createHandler(core.api, {
|
|
8112
8130
|
basePath,
|
|
@@ -10568,37 +10586,58 @@ var d1WorkerDatabase = /* @__PURE__ */ __name(() => createDatabasePlugin({
|
|
|
10568
10586
|
return rows.map((row) => row.target_app_version);
|
|
10569
10587
|
}, "getTargetAppVersionsForUpdateInfo");
|
|
10570
10588
|
return {
|
|
10571
|
-
getUpdateInfo
|
|
10572
|
-
|
|
10573
|
-
|
|
10574
|
-
|
|
10589
|
+
async getUpdateInfo(args, context2) {
|
|
10590
|
+
const channel2 = args.channel ?? "production";
|
|
10591
|
+
const minBundleId = args.minBundleId ?? NIL_UUID;
|
|
10592
|
+
if (args._updateStrategy === "appVersion") {
|
|
10593
|
+
const targetAppVersions = await getTargetAppVersionsForUpdateInfo(
|
|
10575
10594
|
{
|
|
10576
|
-
|
|
10577
|
-
platform: platform2,
|
|
10595
|
+
platform: args.platform,
|
|
10578
10596
|
channel: channel2,
|
|
10579
|
-
|
|
10580
|
-
gte: minBundleId
|
|
10581
|
-
},
|
|
10582
|
-
targetAppVersionIn: targetAppVersions
|
|
10597
|
+
minBundleId
|
|
10583
10598
|
},
|
|
10584
10599
|
context2
|
|
10585
10600
|
);
|
|
10586
|
-
|
|
10587
|
-
|
|
10588
|
-
|
|
10601
|
+
const compatibleAppVersions = filterCompatibleAppVersions(
|
|
10602
|
+
targetAppVersions,
|
|
10603
|
+
args.appVersion
|
|
10604
|
+
);
|
|
10605
|
+
const bundles2 = compatibleAppVersions.length > 0 ? await queryBundlesForUpdateInfo(
|
|
10589
10606
|
{
|
|
10590
10607
|
enabled: true,
|
|
10591
|
-
platform:
|
|
10608
|
+
platform: args.platform,
|
|
10592
10609
|
channel: channel2,
|
|
10593
10610
|
id: {
|
|
10594
10611
|
gte: minBundleId
|
|
10595
10612
|
},
|
|
10596
|
-
|
|
10613
|
+
targetAppVersionIn: compatibleAppVersions
|
|
10597
10614
|
},
|
|
10598
10615
|
context2
|
|
10599
|
-
);
|
|
10616
|
+
) : [];
|
|
10617
|
+
return resolveUpdateInfoFromBundles({
|
|
10618
|
+
args: { ...args, channel: channel2, minBundleId },
|
|
10619
|
+
bundles: bundles2,
|
|
10620
|
+
context: context2
|
|
10621
|
+
});
|
|
10600
10622
|
}
|
|
10601
|
-
|
|
10623
|
+
const bundles = await queryBundlesForUpdateInfo(
|
|
10624
|
+
{
|
|
10625
|
+
enabled: true,
|
|
10626
|
+
platform: args.platform,
|
|
10627
|
+
channel: channel2,
|
|
10628
|
+
id: {
|
|
10629
|
+
gte: minBundleId
|
|
10630
|
+
},
|
|
10631
|
+
fingerprintHash: args.fingerprintHash
|
|
10632
|
+
},
|
|
10633
|
+
context2
|
|
10634
|
+
);
|
|
10635
|
+
return resolveUpdateInfoFromBundles({
|
|
10636
|
+
args: { ...args, channel: channel2, minBundleId },
|
|
10637
|
+
bundles,
|
|
10638
|
+
context: context2
|
|
10639
|
+
});
|
|
10640
|
+
},
|
|
10602
10641
|
async getBundleById(bundleId, context2) {
|
|
10603
10642
|
const [row, patchMap] = await Promise.all([
|
|
10604
10643
|
queryFirst(
|