@hot-updater/aws 0.20.11 → 0.20.12

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.
@@ -34,8 +34,7 @@ const NIL_UUID = "00000000-0000-0000-0000-000000000000";
34
34
  //#region ../../node_modules/.pnpm/hono@4.6.3/node_modules/hono/dist/utils/body.js
35
35
  var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
36
36
  const { all = false, dot = false } = options;
37
- const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
38
- const contentType = headers.get("Content-Type");
37
+ const contentType = (request instanceof HonoRequest ? request.raw.headers : request.headers).get("Content-Type");
39
38
  if (contentType?.startsWith("multipart/form-data") || contentType?.startsWith("application/x-www-form-urlencoded")) return parseFormData(request, {
40
39
  all,
41
40
  dot
@@ -50,13 +49,11 @@ async function parseFormData(request, options) {
50
49
  function convertFormDataToBodyData(formData, options) {
51
50
  const form = /* @__PURE__ */ Object.create(null);
52
51
  formData.forEach((value, key) => {
53
- const shouldParseAllValues = options.all || key.endsWith("[]");
54
- if (!shouldParseAllValues) form[key] = value;
52
+ if (!(options.all || key.endsWith("[]"))) form[key] = value;
55
53
  else handleParsingAllValues(form, key, value);
56
54
  });
57
55
  if (options.dot) Object.entries(form).forEach(([key, value]) => {
58
- const shouldParseDotValues = key.includes(".");
59
- if (shouldParseDotValues) {
56
+ if (key.includes(".")) {
60
57
  handleParsingNestedValues(form, key, value);
61
58
  delete form[key];
62
59
  }
@@ -89,8 +86,7 @@ var splitPath = (path) => {
89
86
  };
90
87
  var splitRoutingPath = (routePath) => {
91
88
  const { groups, path } = extractGroupsFromPath(routePath);
92
- const paths = splitPath(path);
93
- return replaceGroupMarks(paths, groups);
89
+ return replaceGroupMarks(splitPath(path), groups);
94
90
  };
95
91
  var extractGroupsFromPath = (path) => {
96
92
  const groups = [];
@@ -216,7 +212,7 @@ var _getQueryParam = (url, key, multiple) => {
216
212
  keyIndex2 = url.indexOf(`&${key}`, keyIndex2 + 1);
217
213
  }
218
214
  encoded = /[%+]/.test(url);
219
- if (!encoded) return void 0;
215
+ if (!encoded) return;
220
216
  }
221
217
  const results = {};
222
218
  encoded ??= /[%+]/.test(url);
@@ -646,8 +642,7 @@ var Hono$1 = class {
646
642
  #path = "/";
647
643
  routes = [];
648
644
  constructor(options = {}) {
649
- const allMethods = [...METHODS, METHOD_NAME_ALL_LOWERCASE];
650
- allMethods.forEach((method) => {
645
+ [...METHODS, METHOD_NAME_ALL_LOWERCASE].forEach((method) => {
651
646
  this[method] = (args1, ...args) => {
652
647
  if (typeof args1 === "string") this.#path = args1;
653
648
  else this.addRoute(method, this.#path, args1);
@@ -892,8 +887,7 @@ var Node$1 = class {
892
887
  node.insert(restTokens, index, paramMap, context, pathErrorCheckOnly);
893
888
  }
894
889
  buildRegExpStr() {
895
- const childKeys = Object.keys(this.children).sort(compareKey);
896
- const strList = childKeys.map((k) => {
890
+ const strList = Object.keys(this.children).sort(compareKey).map((k) => {
897
891
  const c = this.children[k];
898
892
  return (typeof c.varIndex === "number" ? `(${k})@${c.varIndex}` : regExpMetaChars.has(k) ? `\\${k}` : k) + c.buildRegExpStr();
899
893
  });
@@ -1021,9 +1015,8 @@ function buildMatcherFromPreprocessedRoutes(routes) {
1021
1015
  ];
1022
1016
  }
1023
1017
  function findMiddleware(middleware, path) {
1024
- if (!middleware) return void 0;
1018
+ if (!middleware) return;
1025
1019
  for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) if (buildWildcardRegExp(k).test(path)) return [...middleware[k]];
1026
- return void 0;
1027
1020
  }
1028
1021
  var RegExpRouter = class {
1029
1022
  name = "RegExpRouter";
@@ -1206,13 +1199,12 @@ var Node = class {
1206
1199
  }
1207
1200
  if (!curNode.methods.length) curNode.methods = [];
1208
1201
  const m = /* @__PURE__ */ Object.create(null);
1209
- const handlerSet = {
1202
+ m[method] = {
1210
1203
  handler: handler$1,
1211
1204
  possibleKeys: possibleKeys.filter((v, i, a) => a.indexOf(v) === i),
1212
1205
  name: this.name,
1213
1206
  score: this.order
1214
1207
  };
1215
- m[method] = handlerSet;
1216
1208
  curNode.methods.push(m);
1217
1209
  return curNode;
1218
1210
  }
@@ -1237,8 +1229,7 @@ var Node = class {
1237
1229
  search(method, path) {
1238
1230
  const handlerSets = [];
1239
1231
  this.params = /* @__PURE__ */ Object.create(null);
1240
- const curNode = this;
1241
- let curNodes = [curNode];
1232
+ let curNodes = [this];
1242
1233
  const parts = splitPath(path);
1243
1234
  for (let i = 0, len = parts.length; i < len; i++) {
1244
1235
  const part = parts[i];
@@ -1290,10 +1281,9 @@ var Node = class {
1290
1281
  }
1291
1282
  curNodes = tempNodes;
1292
1283
  }
1293
- const results = handlerSets.sort((a, b) => {
1284
+ return [handlerSets.sort((a, b) => {
1294
1285
  return a.score - b.score;
1295
- });
1296
- return [results.map(({ handler: handler$1, params }) => [handler$1, params])];
1286
+ }).map(({ handler: handler$1, params }) => [handler$1, params])];
1297
1287
  }
1298
1288
  };
1299
1289
 
@@ -1361,7 +1351,7 @@ var convertHeaders = (headers) => {
1361
1351
  };
1362
1352
  var handle = (app$1) => {
1363
1353
  return async (event, context, callback) => {
1364
- const res = await app$1.fetch(createRequest(event), {
1354
+ return createResult(await app$1.fetch(createRequest(event), {
1365
1355
  event,
1366
1356
  context,
1367
1357
  callback: (err, result) => {
@@ -1370,8 +1360,7 @@ var handle = (app$1) => {
1370
1360
  config: event.Records[0].cf.config,
1371
1361
  request: event.Records[0].cf.request,
1372
1362
  response: event.Records[0].cf.response
1373
- });
1374
- return createResult(res);
1363
+ }));
1375
1364
  };
1376
1365
  };
1377
1366
  var createResult = async (res) => {
@@ -1402,8 +1391,8 @@ var createRequest = (event) => {
1402
1391
  });
1403
1392
  };
1404
1393
  var createBody = (method, requestBody) => {
1405
- if (!requestBody || !requestBody.data) return void 0;
1406
- if (method === "GET" || method === "HEAD") return void 0;
1394
+ if (!requestBody || !requestBody.data) return;
1395
+ if (method === "GET" || method === "HEAD") return;
1407
1396
  if (requestBody.encoding === "base64") return decodeBase64(requestBody.data);
1408
1397
  return requestBody.data;
1409
1398
  };
@@ -1495,8 +1484,7 @@ var require_dist_cjs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
1495
1484
  }
1496
1485
  __name(getSignedCookies, "getSignedCookies");
1497
1486
  function getPolicyResources(policy) {
1498
- const parsedPolicy = typeof policy === "string" ? JSON.parse(policy) : policy;
1499
- return (parsedPolicy?.Statement ?? []).map((s) => s.Resource);
1487
+ return ((typeof policy === "string" ? JSON.parse(policy) : policy)?.Statement ?? []).map((s) => s.Resource);
1500
1488
  }
1501
1489
  __name(getPolicyResources, "getPolicyResources");
1502
1490
  function getResource(url) {
@@ -1554,16 +1542,14 @@ var require_dist_cjs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
1554
1542
  validateIP(ipStr) {
1555
1543
  const octets = ipStr.split(".");
1556
1544
  if (octets.length !== 4) throw new Error(`IP does not contain four octets.`);
1557
- const isValid = octets.every((octet) => {
1545
+ if (!octets.every((octet) => {
1558
1546
  const num = Number(octet);
1559
1547
  return Number.isInteger(num) && num >= 0 && num <= 255;
1560
- });
1561
- if (!isValid) throw new Error("invalid IP octets");
1548
+ })) throw new Error("invalid IP octets");
1562
1549
  }
1563
1550
  validateMask(maskStr) {
1564
1551
  const mask = Number(maskStr);
1565
- const isValid = Number.isInteger(mask) && mask >= 0 && mask <= 32;
1566
- if (!isValid) throw new Error("invalid mask");
1552
+ if (!(Number.isInteger(mask) && mask >= 0 && mask <= 32)) throw new Error("invalid mask");
1567
1553
  }
1568
1554
  parseCIDR(cidrStr) {
1569
1555
  try {
@@ -1586,7 +1572,7 @@ var require_dist_cjs = /* @__PURE__ */ __commonJS$1({ "../../node_modules/.pnpm/
1586
1572
  return Math.round(date.getTime() / 1e3);
1587
1573
  }
1588
1574
  parseDate(date) {
1589
- if (!date) return void 0;
1575
+ if (!date) return;
1590
1576
  const parsedDate = new Date(date);
1591
1577
  return isNaN(parsedDate.getTime()) ? void 0 : this.epochTime(parsedDate);
1592
1578
  }
@@ -1669,31 +1655,27 @@ var require_constants = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/s
1669
1655
  const SEMVER_SPEC_VERSION = "2.0.0";
1670
1656
  const MAX_LENGTH$2 = 256;
1671
1657
  const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || 9007199254740991;
1672
- const MAX_SAFE_COMPONENT_LENGTH$1 = 16;
1673
- const MAX_SAFE_BUILD_LENGTH$1 = MAX_LENGTH$2 - 6;
1674
- const RELEASE_TYPES = [
1675
- "major",
1676
- "premajor",
1677
- "minor",
1678
- "preminor",
1679
- "patch",
1680
- "prepatch",
1681
- "prerelease"
1682
- ];
1683
1658
  module$1.exports = {
1684
1659
  MAX_LENGTH: MAX_LENGTH$2,
1685
- MAX_SAFE_COMPONENT_LENGTH: MAX_SAFE_COMPONENT_LENGTH$1,
1686
- MAX_SAFE_BUILD_LENGTH: MAX_SAFE_BUILD_LENGTH$1,
1660
+ MAX_SAFE_COMPONENT_LENGTH: 16,
1661
+ MAX_SAFE_BUILD_LENGTH: MAX_LENGTH$2 - 6,
1687
1662
  MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
1688
- RELEASE_TYPES,
1663
+ RELEASE_TYPES: [
1664
+ "major",
1665
+ "premajor",
1666
+ "minor",
1667
+ "preminor",
1668
+ "patch",
1669
+ "prepatch",
1670
+ "prerelease"
1671
+ ],
1689
1672
  SEMVER_SPEC_VERSION,
1690
1673
  FLAG_INCLUDE_PRERELEASE: 1,
1691
1674
  FLAG_LOOSE: 2
1692
1675
  };
1693
1676
  }) });
1694
1677
  var require_debug = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js": ((exports$1, module$1) => {
1695
- const debug$4 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
1696
- module$1.exports = debug$4;
1678
+ module$1.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
1697
1679
  }) });
1698
1680
  var require_re = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js": ((exports$1, module$1) => {
1699
1681
  const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH: MAX_LENGTH$1 } = require_constants();
@@ -1805,10 +1787,10 @@ var require_semver$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/se
1805
1787
  const { safeRe: re$3, t: t$3 } = require_re();
1806
1788
  const parseOptions$2 = require_parse_options();
1807
1789
  const { compareIdentifiers } = require_identifiers();
1808
- var SemVer$15 = class SemVer$15$1 {
1790
+ module$1.exports = class SemVer$15 {
1809
1791
  constructor(version, options) {
1810
1792
  options = parseOptions$2(options);
1811
- if (version instanceof SemVer$15$1) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
1793
+ if (version instanceof SemVer$15) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
1812
1794
  else version = version.version;
1813
1795
  else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
1814
1796
  if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
@@ -1846,19 +1828,19 @@ var require_semver$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/se
1846
1828
  }
1847
1829
  compare(other) {
1848
1830
  debug$2("SemVer.compare", this.version, this.options, other);
1849
- if (!(other instanceof SemVer$15$1)) {
1831
+ if (!(other instanceof SemVer$15)) {
1850
1832
  if (typeof other === "string" && other === this.version) return 0;
1851
- other = new SemVer$15$1(other, this.options);
1833
+ other = new SemVer$15(other, this.options);
1852
1834
  }
1853
1835
  if (other.version === this.version) return 0;
1854
1836
  return this.compareMain(other) || this.comparePre(other);
1855
1837
  }
1856
1838
  compareMain(other) {
1857
- if (!(other instanceof SemVer$15$1)) other = new SemVer$15$1(other, this.options);
1839
+ if (!(other instanceof SemVer$15)) other = new SemVer$15(other, this.options);
1858
1840
  return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
1859
1841
  }
1860
1842
  comparePre(other) {
1861
- if (!(other instanceof SemVer$15$1)) other = new SemVer$15$1(other, this.options);
1843
+ if (!(other instanceof SemVer$15)) other = new SemVer$15(other, this.options);
1862
1844
  if (this.prerelease.length && !other.prerelease.length) return -1;
1863
1845
  else if (!this.prerelease.length && other.prerelease.length) return 1;
1864
1846
  else if (!this.prerelease.length && !other.prerelease.length) return 0;
@@ -1875,7 +1857,7 @@ var require_semver$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/se
1875
1857
  } while (++i);
1876
1858
  }
1877
1859
  compareBuild(other) {
1878
- if (!(other instanceof SemVer$15$1)) other = new SemVer$15$1(other, this.options);
1860
+ if (!(other instanceof SemVer$15)) other = new SemVer$15(other, this.options);
1879
1861
  let i = 0;
1880
1862
  do {
1881
1863
  const a = this.build[i];
@@ -1968,7 +1950,6 @@ var require_semver$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/se
1968
1950
  return this;
1969
1951
  }
1970
1952
  };
1971
- module$1.exports = SemVer$15;
1972
1953
  }) });
1973
1954
  var require_parse = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.js": ((exports$1, module$1) => {
1974
1955
  const SemVer$14 = require_semver$1();
@@ -2026,8 +2007,7 @@ var require_diff = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semver
2026
2007
  const highVersion = v1Higher ? v1 : v2;
2027
2008
  const lowVersion = v1Higher ? v2 : v1;
2028
2009
  const highHasPre = !!highVersion.prerelease.length;
2029
- const lowHasPre = !!lowVersion.prerelease.length;
2030
- if (lowHasPre && !highHasPre) {
2010
+ if (!!lowVersion.prerelease.length && !highHasPre) {
2031
2011
  if (!lowVersion.patch && !lowVersion.minor) return "major";
2032
2012
  if (lowVersion.compareMain(highVersion) === 0) {
2033
2013
  if (lowVersion.minor && !lowVersion.patch) return "minor";
@@ -2181,11 +2161,7 @@ var require_coerce = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semv
2181
2161
  }
2182
2162
  if (match === null) return null;
2183
2163
  const major$2 = match[2];
2184
- const minor$2 = match[3] || "0";
2185
- const patch$2 = match[4] || "0";
2186
- const prerelease$2 = options.includePrerelease && match[5] ? `-${match[5]}` : "";
2187
- const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
2188
- return parse$1(`${major$2}.${minor$2}.${patch$2}${prerelease$2}${build}`, options);
2164
+ return parse$1(`${major$2}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
2189
2165
  };
2190
2166
  module$1.exports = coerce$1;
2191
2167
  }) });
@@ -2197,7 +2173,7 @@ var require_lrucache = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/se
2197
2173
  }
2198
2174
  get(key) {
2199
2175
  const value = this.map.get(key);
2200
- if (value === void 0) return void 0;
2176
+ if (value === void 0) return;
2201
2177
  else {
2202
2178
  this.map.delete(key);
2203
2179
  this.map.set(key, value);
@@ -2208,8 +2184,7 @@ var require_lrucache = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/se
2208
2184
  return this.map.delete(key);
2209
2185
  }
2210
2186
  set(key, value) {
2211
- const deleted = this.delete(key);
2212
- if (!deleted && value !== void 0) {
2187
+ if (!this.delete(key) && value !== void 0) {
2213
2188
  if (this.map.size >= this.max) {
2214
2189
  const firstKey = this.map.keys().next().value;
2215
2190
  this.delete(firstKey);
@@ -2223,11 +2198,11 @@ var require_lrucache = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/se
2223
2198
  }) });
2224
2199
  var require_range = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js": ((exports$1, module$1) => {
2225
2200
  const SPACE_CHARACTERS = /\s+/g;
2226
- var Range$11 = class Range$11$1 {
2201
+ module$1.exports = class Range$11 {
2227
2202
  constructor(range, options) {
2228
2203
  options = parseOptions$1(options);
2229
- if (range instanceof Range$11$1) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
2230
- else return new Range$11$1(range.raw, options);
2204
+ if (range instanceof Range$11) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
2205
+ else return new Range$11(range.raw, options);
2231
2206
  if (range instanceof Comparator$4) {
2232
2207
  this.raw = range.value;
2233
2208
  this.set = [[range]];
@@ -2274,8 +2249,7 @@ var require_range = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semve
2274
2249
  return this.range;
2275
2250
  }
2276
2251
  parseRange(range) {
2277
- const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
2278
- const memoKey = memoOpts + ":" + range;
2252
+ const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
2279
2253
  const cached = cache$1.get(memoKey);
2280
2254
  if (cached) return cached;
2281
2255
  const loose = this.options.loose;
@@ -2306,7 +2280,7 @@ var require_range = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semve
2306
2280
  return result;
2307
2281
  }
2308
2282
  intersects(range, options) {
2309
- if (!(range instanceof Range$11$1)) throw new TypeError("a Range is required");
2283
+ if (!(range instanceof Range$11)) throw new TypeError("a Range is required");
2310
2284
  return this.set.some((thisComparators) => {
2311
2285
  return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
2312
2286
  return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
@@ -2328,9 +2302,7 @@ var require_range = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semve
2328
2302
  return false;
2329
2303
  }
2330
2304
  };
2331
- module$1.exports = Range$11;
2332
- const LRU = require_lrucache();
2333
- const cache$1 = new LRU();
2305
+ const cache$1 = new (require_lrucache())();
2334
2306
  const parseOptions$1 = require_parse_options();
2335
2307
  const Comparator$4 = require_comparator();
2336
2308
  const debug$1 = require_debug();
@@ -2495,13 +2467,13 @@ var require_range = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semve
2495
2467
  }) });
2496
2468
  var require_comparator = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js": ((exports$1, module$1) => {
2497
2469
  const ANY$2 = Symbol("SemVer ANY");
2498
- var Comparator$3 = class Comparator$3$1 {
2470
+ module$1.exports = class Comparator$3 {
2499
2471
  static get ANY() {
2500
2472
  return ANY$2;
2501
2473
  }
2502
2474
  constructor(comp, options) {
2503
2475
  options = parseOptions(options);
2504
- if (comp instanceof Comparator$3$1) if (comp.loose === !!options.loose) return comp;
2476
+ if (comp instanceof Comparator$3) if (comp.loose === !!options.loose) return comp;
2505
2477
  else comp = comp.value;
2506
2478
  comp = comp.trim().split(/\s+/).join(" ");
2507
2479
  debug("comparator", comp, options);
@@ -2535,7 +2507,7 @@ var require_comparator = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
2535
2507
  return cmp$1(version, this.operator, this.semver, this.options);
2536
2508
  }
2537
2509
  intersects(comp, options) {
2538
- if (!(comp instanceof Comparator$3$1)) throw new TypeError("a Comparator is required");
2510
+ if (!(comp instanceof Comparator$3)) throw new TypeError("a Comparator is required");
2539
2511
  if (this.operator === "") {
2540
2512
  if (this.value === "") return true;
2541
2513
  return new Range$10(comp.value, options).test(this.value);
@@ -2554,7 +2526,6 @@ var require_comparator = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
2554
2526
  return false;
2555
2527
  }
2556
2528
  };
2557
- module$1.exports = Comparator$3;
2558
2529
  const parseOptions = require_parse_options();
2559
2530
  const { safeRe: re, t } = require_re();
2560
2531
  const cmp$1 = require_cmp();
@@ -2753,16 +2724,13 @@ var require_simplify = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/se
2753
2724
  let first = null;
2754
2725
  let prev = null;
2755
2726
  const v = versions.sort((a, b) => compare$2(a, b, options));
2756
- for (const version of v) {
2757
- const included = satisfies$2(version, range, options);
2758
- if (included) {
2759
- prev = version;
2760
- if (!first) first = version;
2761
- } else {
2762
- if (prev) set.push([first, prev]);
2763
- prev = null;
2764
- first = null;
2765
- }
2727
+ for (const version of v) if (satisfies$2(version, range, options)) {
2728
+ prev = version;
2729
+ if (!first) first = version;
2730
+ } else {
2731
+ if (prev) set.push([first, prev]);
2732
+ prev = null;
2733
+ first = null;
2766
2734
  }
2767
2735
  if (first) set.push([first, null]);
2768
2736
  const ranges = [];
@@ -2869,86 +2837,49 @@ var require_subset = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semv
2869
2837
  };
2870
2838
  module$1.exports = subset$1;
2871
2839
  }) });
2872
- var require_semver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js": ((exports$1, module$1) => {
2840
+ var import_semver = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js": ((exports$1, module$1) => {
2873
2841
  const internalRe = require_re();
2874
2842
  const constants = require_constants();
2875
2843
  const SemVer = require_semver$1();
2876
2844
  const identifiers = require_identifiers();
2877
- const parse = require_parse();
2878
- const valid = require_valid$1();
2879
- const clean = require_clean();
2880
- const inc = require_inc();
2881
- const diff = require_diff();
2882
- const major = require_major();
2883
- const minor = require_minor();
2884
- const patch = require_patch();
2885
- const prerelease = require_prerelease();
2886
- const compare = require_compare();
2887
- const rcompare = require_rcompare();
2888
- const compareLoose = require_compare_loose();
2889
- const compareBuild = require_compare_build();
2890
- const sort = require_sort();
2891
- const rsort = require_rsort();
2892
- const gt = require_gt();
2893
- const lt = require_lt();
2894
- const eq = require_eq();
2895
- const neq = require_neq();
2896
- const gte = require_gte();
2897
- const lte = require_lte();
2898
- const cmp = require_cmp();
2899
- const coerce = require_coerce();
2900
- const Comparator = require_comparator();
2901
- const Range = require_range();
2902
- const satisfies = require_satisfies();
2903
- const toComparators = require_to_comparators();
2904
- const maxSatisfying = require_max_satisfying();
2905
- const minSatisfying = require_min_satisfying();
2906
- const minVersion = require_min_version();
2907
- const validRange = require_valid();
2908
- const outside = require_outside();
2909
- const gtr = require_gtr();
2910
- const ltr = require_ltr();
2911
- const intersects = require_intersects();
2912
- const simplifyRange = require_simplify();
2913
- const subset = require_subset();
2914
2845
  module$1.exports = {
2915
- parse,
2916
- valid,
2917
- clean,
2918
- inc,
2919
- diff,
2920
- major,
2921
- minor,
2922
- patch,
2923
- prerelease,
2924
- compare,
2925
- rcompare,
2926
- compareLoose,
2927
- compareBuild,
2928
- sort,
2929
- rsort,
2930
- gt,
2931
- lt,
2932
- eq,
2933
- neq,
2934
- gte,
2935
- lte,
2936
- cmp,
2937
- coerce,
2938
- Comparator,
2939
- Range,
2940
- satisfies,
2941
- toComparators,
2942
- maxSatisfying,
2943
- minSatisfying,
2944
- minVersion,
2945
- validRange,
2946
- outside,
2947
- gtr,
2948
- ltr,
2949
- intersects,
2950
- simplifyRange,
2951
- subset,
2846
+ parse: require_parse(),
2847
+ valid: require_valid$1(),
2848
+ clean: require_clean(),
2849
+ inc: require_inc(),
2850
+ diff: require_diff(),
2851
+ major: require_major(),
2852
+ minor: require_minor(),
2853
+ patch: require_patch(),
2854
+ prerelease: require_prerelease(),
2855
+ compare: require_compare(),
2856
+ rcompare: require_rcompare(),
2857
+ compareLoose: require_compare_loose(),
2858
+ compareBuild: require_compare_build(),
2859
+ sort: require_sort(),
2860
+ rsort: require_rsort(),
2861
+ gt: require_gt(),
2862
+ lt: require_lt(),
2863
+ eq: require_eq(),
2864
+ neq: require_neq(),
2865
+ gte: require_gte(),
2866
+ lte: require_lte(),
2867
+ cmp: require_cmp(),
2868
+ coerce: require_coerce(),
2869
+ Comparator: require_comparator(),
2870
+ Range: require_range(),
2871
+ satisfies: require_satisfies(),
2872
+ toComparators: require_to_comparators(),
2873
+ maxSatisfying: require_max_satisfying(),
2874
+ minSatisfying: require_min_satisfying(),
2875
+ minVersion: require_min_version(),
2876
+ validRange: require_valid(),
2877
+ outside: require_outside(),
2878
+ gtr: require_gtr(),
2879
+ ltr: require_ltr(),
2880
+ intersects: require_intersects(),
2881
+ simplifyRange: require_simplify(),
2882
+ subset: require_subset(),
2952
2883
  SemVer,
2953
2884
  re: internalRe.re,
2954
2885
  src: internalRe.src,
@@ -2958,13 +2889,23 @@ var require_semver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/semv
2958
2889
  compareIdentifiers: identifiers.compareIdentifiers,
2959
2890
  rcompareIdentifiers: identifiers.rcompareIdentifiers
2960
2891
  };
2961
- }) });
2962
- var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
2892
+ }) }))(), 1);
2963
2893
  const semverSatisfies = (targetAppVersion, currentVersion) => {
2964
2894
  const currentCoerce = import_semver.default.coerce(currentVersion);
2965
2895
  if (!currentCoerce) return false;
2966
2896
  return import_semver.default.satisfies(currentCoerce.version, targetAppVersion);
2967
2897
  };
2898
+ /**
2899
+ * Filters target app versions that are compatible with the current app version.
2900
+ * Returns only versions that are compatible with the current version according to semver rules.
2901
+ *
2902
+ * @param targetAppVersionList - List of target app versions to filter
2903
+ * @param currentVersion - Current app version
2904
+ * @returns Array of target app versions compatible with the current version
2905
+ */
2906
+ const filterCompatibleAppVersions = (targetAppVersionList, currentVersion) => {
2907
+ return targetAppVersionList.filter((version) => semverSatisfies(version, currentVersion)).sort((a, b) => b.localeCompare(a));
2908
+ };
2968
2909
  const INIT_BUNDLE_ROLLBACK_UPDATE_INFO = {
2969
2910
  message: null,
2970
2911
  id: NIL_UUID,
@@ -2999,7 +2940,7 @@ const appVersionStrategy$1 = async (bundles, { channel = "production", minBundle
2999
2940
  let latestCandidate = null;
3000
2941
  let updateCandidate = null;
3001
2942
  let rollbackCandidate = null;
3002
- let currentBundle = void 0;
2943
+ let currentBundle;
3003
2944
  for (const b of candidateBundles) {
3004
2945
  if (!latestCandidate || b.id.localeCompare(latestCandidate.id) > 0) latestCandidate = b;
3005
2946
  if (b.id === bundleId) currentBundle = b;
@@ -3037,7 +2978,7 @@ const fingerprintStrategy$1 = async (bundles, { channel = "production", minBundl
3037
2978
  let latestCandidate = null;
3038
2979
  let updateCandidate = null;
3039
2980
  let rollbackCandidate = null;
3040
- let currentBundle = void 0;
2981
+ let currentBundle;
3041
2982
  for (const b of candidateBundles) {
3042
2983
  if (!latestCandidate || b.id.localeCompare(latestCandidate.id) > 0) latestCandidate = b;
3043
2984
  if (b.id === bundleId) currentBundle = b;
@@ -3062,18 +3003,6 @@ const fingerprintStrategy$1 = async (bundles, { channel = "production", minBundl
3062
3003
  if (minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;
3063
3004
  return INIT_BUNDLE_ROLLBACK_UPDATE_INFO;
3064
3005
  };
3065
- /**
3066
- * Filters target app versions that are compatible with the current app version.
3067
- * Returns only versions that are compatible with the current version according to semver rules.
3068
- *
3069
- * @param targetAppVersionList - List of target app versions to filter
3070
- * @param currentVersion - Current app version
3071
- * @returns Array of target app versions compatible with the current version
3072
- */
3073
- const filterCompatibleAppVersions = (targetAppVersionList, currentVersion) => {
3074
- const compatibleAppVersionList = targetAppVersionList.filter((version) => semverSatisfies(version, currentVersion));
3075
- return compatibleAppVersionList.sort((a, b) => b.localeCompare(a));
3076
- };
3077
3006
  const encoder = new TextEncoder();
3078
3007
  const decoder = new TextDecoder();
3079
3008
  const minute = 60;
@@ -3117,21 +3046,18 @@ const getUpdateInfo = async ({ baseUrl, keyPairId, privateKey }, args) => {
3117
3046
  }
3118
3047
  };
3119
3048
  const appVersionStrategy = async ({ baseUrl, keyPairId, privateKey }, { platform, appVersion, bundleId, minBundleId = NIL_UUID, channel = "production" }) => {
3120
- const targetAppVersions = await getCdnJson({
3049
+ const matchingVersions = filterCompatibleAppVersions(await getCdnJson({
3121
3050
  baseUrl,
3122
3051
  key: `${channel}/${platform}/target-app-versions.json`,
3123
3052
  keyPairId,
3124
3053
  privateKey
3125
- });
3126
- const matchingVersions = filterCompatibleAppVersions(targetAppVersions ?? [], appVersion);
3127
- const results = await Promise.allSettled(matchingVersions.map((targetAppVersion) => getCdnJson({
3054
+ }) ?? [], appVersion);
3055
+ return getUpdateInfo$1((await Promise.allSettled(matchingVersions.map((targetAppVersion) => getCdnJson({
3128
3056
  baseUrl,
3129
3057
  key: `${channel}/${platform}/${targetAppVersion}/update.json`,
3130
3058
  keyPairId,
3131
3059
  privateKey
3132
- })));
3133
- const bundles = results.filter((r) => r.status === "fulfilled").flatMap((r) => r.value ?? []);
3134
- return getUpdateInfo$1(bundles, {
3060
+ })))).filter((r) => r.status === "fulfilled").flatMap((r) => r.value ?? []), {
3135
3061
  platform,
3136
3062
  bundleId,
3137
3063
  appVersion,
@@ -3173,13 +3099,12 @@ var import_dist_cjs = /* @__PURE__ */ __toESM$1(require_dist_cjs(), 1);
3173
3099
  */
3174
3100
  const withSignedUrl = async ({ data, reqUrl, keyPairId, privateKey, expiresSeconds = 60 }) => {
3175
3101
  if (!data) return null;
3176
- const { storageUri,...rest } = data;
3102
+ const { storageUri: _,...rest } = data;
3177
3103
  if (data.id === NIL_UUID || !data.storageUri) return {
3178
3104
  ...rest,
3179
3105
  fileUrl: null
3180
3106
  };
3181
- const storageUrl = new URL(data.storageUri);
3182
- const key = storageUrl.pathname;
3107
+ const key = new URL(data.storageUri).pathname;
3183
3108
  const url = new URL(reqUrl);
3184
3109
  url.pathname = key;
3185
3110
  const signedUrl = (0, import_dist_cjs.getSignedUrl)({
@@ -3213,8 +3138,7 @@ const processDefaultValues = (channel, minBundleId) => ({
3213
3138
  });
3214
3139
  const handleUpdateRequest = async (c, params, strategy, expiresSeconds) => {
3215
3140
  try {
3216
- const cdnHost = c.req.header("host");
3217
- if (!cdnHost) return c.json({ error: "Missing host header." }, 500);
3141
+ if (!c.req.header("host")) return c.json({ error: "Missing host header." }, 500);
3218
3142
  const updateConfig = {
3219
3143
  platform: params.platform,
3220
3144
  bundleId: params.bundleId,
@@ -3263,15 +3187,13 @@ app.get("/api/check-update", async (c) => {
3263
3187
  if (requiredError) return c.json({ error: requiredError }, 400);
3264
3188
  if (!validatePlatform(platform)) return c.json({ error: "Invalid platform. Must be 'ios' or 'android'." }, 400);
3265
3189
  if (!appVersion && !fingerprintHash) return c.json({ error: "Missing required headers (x-app-version or x-fingerprint-hash)." }, 400);
3266
- const params = {
3190
+ return handleUpdateRequest(c, {
3267
3191
  platform,
3268
3192
  bundleId,
3269
3193
  channel,
3270
3194
  minBundleId,
3271
3195
  ...fingerprintHash ? { fingerprintHash } : { appVersion }
3272
- };
3273
- const expiresSeconds = 60;
3274
- return handleUpdateRequest(c, params, fingerprintHash ? "fingerprint" : "appVersion", expiresSeconds);
3196
+ }, fingerprintHash ? "fingerprint" : "appVersion", 60);
3275
3197
  } catch (error) {
3276
3198
  console.error("Legacy endpoint error:", error);
3277
3199
  return c.json({ error: "Internal Server Error" }, 500);
@@ -3291,15 +3213,13 @@ app.get("/api/check-update/app-version/:platform/:appVersion/:channel/:minBundle
3291
3213
  if (requiredError) return c.json({ error: requiredError }, 400);
3292
3214
  if (!validatePlatform(platform)) return c.json({ error: "Invalid platform. Must be 'ios' or 'android'." }, 400);
3293
3215
  const { actualChannel, actualMinBundleId } = processDefaultValues(channel, minBundleId);
3294
- const params = {
3216
+ return handleUpdateRequest(c, {
3295
3217
  platform,
3296
3218
  bundleId,
3297
3219
  channel: actualChannel,
3298
3220
  minBundleId: actualMinBundleId,
3299
3221
  appVersion
3300
- };
3301
- const expiresSeconds = 3600 * 24 * 365;
3302
- return handleUpdateRequest(c, params, "appVersion", expiresSeconds);
3222
+ }, "appVersion", 3600 * 24 * 365);
3303
3223
  });
3304
3224
  app.get("/api/check-update/fingerprint/:platform/:fingerprintHash/:channel/:minBundleId/:bundleId", async (c) => {
3305
3225
  const { platform, fingerprintHash, channel, minBundleId, bundleId } = c.req.param();
@@ -3315,15 +3235,13 @@ app.get("/api/check-update/fingerprint/:platform/:fingerprintHash/:channel/:minB
3315
3235
  if (requiredError) return c.json({ error: requiredError }, 400);
3316
3236
  if (!validatePlatform(platform)) return c.json({ error: "Invalid platform. Must be 'ios' or 'android'." }, 400);
3317
3237
  const { actualChannel, actualMinBundleId } = processDefaultValues(channel, minBundleId);
3318
- const params = {
3238
+ return handleUpdateRequest(c, {
3319
3239
  platform,
3320
3240
  bundleId,
3321
3241
  channel: actualChannel,
3322
3242
  minBundleId: actualMinBundleId,
3323
3243
  fingerprintHash
3324
- };
3325
- const expiresSeconds = 3600 * 24 * 365;
3326
- return handleUpdateRequest(c, params, "fingerprint", expiresSeconds);
3244
+ }, "fingerprint", 3600 * 24 * 365);
3327
3245
  });
3328
3246
  app.get("*", async (c) => {
3329
3247
  return c.env.callback(null, c.env.request);