@hot-updater/cloudflare 0.32.0 → 0.33.1

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.
@@ -59,7 +59,7 @@ var import_dayjs_min = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((
59
59
  "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
60
60
  })(exports, (function() {
61
61
  "use strict";
62
- var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = {
62
+ var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = {
63
63
  name: "en",
64
64
  weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
65
65
  months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
@@ -329,8 +329,8 @@ var import_dayjs_min = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((
329
329
  }, m.toString = function() {
330
330
  return this.$d.toUTCString();
331
331
  }, M;
332
- }(), k = _.prototype;
333
- return O.prototype = k, [
332
+ }(), Y = _.prototype;
333
+ return O.prototype = Y, [
334
334
  ["$ms", r],
335
335
  ["$s", i],
336
336
  ["$m", s],
@@ -340,7 +340,7 @@ var import_dayjs_min = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((
340
340
  ["$y", h],
341
341
  ["$D", d]
342
342
  ].forEach((function(t) {
343
- k[t[1]] = function(e) {
343
+ Y[t[1]] = function(e) {
344
344
  return this.$g(e, t[0], t[1]);
345
345
  };
346
346
  })), O.extend = function(t, e) {
@@ -922,7 +922,7 @@ const fallbackSymbols = {
922
922
  const figures = isUnicodeSupported() ? mainSymbols : fallbackSymbols;
923
923
  Object.entries(specialMainSymbols);
924
924
  //#endregion
925
- //#region ../../node_modules/.pnpm/yoctocolors@2.1.1/node_modules/yoctocolors/base.js
925
+ //#region ../../node_modules/.pnpm/yoctocolors@2.1.2/node_modules/yoctocolors/base.js
926
926
  const hasColors = node_tty.default?.WriteStream?.prototype?.hasColors?.() ?? false;
927
927
  const format = (open, close) => {
928
928
  if (!hasColors) return (input) => input;
@@ -934,8 +934,9 @@ const format = (open, close) => {
934
934
  if (index === -1) return openCode + string + closeCode;
935
935
  let result = openCode;
936
936
  let lastIndex = 0;
937
+ const replaceCode = (close === 22 ? closeCode : "") + openCode;
937
938
  while (index !== -1) {
938
- result += string.slice(lastIndex, index) + openCode;
939
+ result += string.slice(lastIndex, index) + replaceCode;
939
940
  lastIndex = index + closeCode.length;
940
941
  index = string.indexOf(closeCode, lastIndex);
941
942
  }
@@ -3335,7 +3336,7 @@ function parseMilliseconds(milliseconds) {
3335
3336
  throw new TypeError("Expected a finite number or bigint");
3336
3337
  }
3337
3338
  //#endregion
3338
- //#region ../../node_modules/.pnpm/pretty-ms@9.2.0/node_modules/pretty-ms/index.js
3339
+ //#region ../../node_modules/.pnpm/pretty-ms@9.3.0/node_modules/pretty-ms/index.js
3339
3340
  const isZero = (value) => value === 0 || value === 0n;
3340
3341
  const pluralize = (word, count) => count === 1 || count === 1n ? word : `${word}s`;
3341
3342
  const SECOND_ROUNDING_EPSILON = 1e-7;
@@ -3384,7 +3385,7 @@ function prettyMilliseconds(milliseconds, options) {
3384
3385
  add(Number(parsed.hours), "hour", "h");
3385
3386
  }
3386
3387
  add(Number(parsed.minutes), "minute", "m");
3387
- if (!options.hideSeconds) if (options.separateMilliseconds || options.formatSubMilliseconds || !options.colonNotation && milliseconds < 1e3) {
3388
+ if (!options.hideSeconds) if (options.separateMilliseconds || options.formatSubMilliseconds || !options.colonNotation && milliseconds < 1e3 && !options.subSecondsAsDecimals) {
3388
3389
  const seconds = Number(parsed.seconds);
3389
3390
  const milliseconds = Number(parsed.milliseconds);
3390
3391
  const microseconds = Number(parsed.microseconds);
@@ -51,7 +51,7 @@ var import_dayjs_min = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((
51
51
  "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
52
52
  })(exports, (function() {
53
53
  "use strict";
54
- var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = {
54
+ var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = {
55
55
  name: "en",
56
56
  weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
57
57
  months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
@@ -321,8 +321,8 @@ var import_dayjs_min = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((
321
321
  }, m.toString = function() {
322
322
  return this.$d.toUTCString();
323
323
  }, M;
324
- }(), k = _.prototype;
325
- return O.prototype = k, [
324
+ }(), Y = _.prototype;
325
+ return O.prototype = Y, [
326
326
  ["$ms", r],
327
327
  ["$s", i],
328
328
  ["$m", s],
@@ -332,7 +332,7 @@ var import_dayjs_min = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((
332
332
  ["$y", h],
333
333
  ["$D", d]
334
334
  ].forEach((function(t) {
335
- k[t[1]] = function(e) {
335
+ Y[t[1]] = function(e) {
336
336
  return this.$g(e, t[0], t[1]);
337
337
  };
338
338
  })), O.extend = function(t, e) {
@@ -914,7 +914,7 @@ const fallbackSymbols = {
914
914
  const figures = isUnicodeSupported() ? mainSymbols : fallbackSymbols;
915
915
  Object.entries(specialMainSymbols);
916
916
  //#endregion
917
- //#region ../../node_modules/.pnpm/yoctocolors@2.1.1/node_modules/yoctocolors/base.js
917
+ //#region ../../node_modules/.pnpm/yoctocolors@2.1.2/node_modules/yoctocolors/base.js
918
918
  const hasColors = tty?.WriteStream?.prototype?.hasColors?.() ?? false;
919
919
  const format = (open, close) => {
920
920
  if (!hasColors) return (input) => input;
@@ -926,8 +926,9 @@ const format = (open, close) => {
926
926
  if (index === -1) return openCode + string + closeCode;
927
927
  let result = openCode;
928
928
  let lastIndex = 0;
929
+ const replaceCode = (close === 22 ? closeCode : "") + openCode;
929
930
  while (index !== -1) {
930
- result += string.slice(lastIndex, index) + openCode;
931
+ result += string.slice(lastIndex, index) + replaceCode;
931
932
  lastIndex = index + closeCode.length;
932
933
  index = string.indexOf(closeCode, lastIndex);
933
934
  }
@@ -3327,7 +3328,7 @@ function parseMilliseconds(milliseconds) {
3327
3328
  throw new TypeError("Expected a finite number or bigint");
3328
3329
  }
3329
3330
  //#endregion
3330
- //#region ../../node_modules/.pnpm/pretty-ms@9.2.0/node_modules/pretty-ms/index.js
3331
+ //#region ../../node_modules/.pnpm/pretty-ms@9.3.0/node_modules/pretty-ms/index.js
3331
3332
  const isZero = (value) => value === 0 || value === 0n;
3332
3333
  const pluralize = (word, count) => count === 1 || count === 1n ? word : `${word}s`;
3333
3334
  const SECOND_ROUNDING_EPSILON = 1e-7;
@@ -3376,7 +3377,7 @@ function prettyMilliseconds(milliseconds, options) {
3376
3377
  add(Number(parsed.hours), "hour", "h");
3377
3378
  }
3378
3379
  add(Number(parsed.minutes), "minute", "m");
3379
- if (!options.hideSeconds) if (options.separateMilliseconds || options.formatSubMilliseconds || !options.colonNotation && milliseconds < 1e3) {
3380
+ if (!options.hideSeconds) if (options.separateMilliseconds || options.formatSubMilliseconds || !options.colonNotation && milliseconds < 1e3 && !options.subSecondsAsDecimals) {
3380
3381
  const seconds = Number(parsed.seconds);
3381
3382
  const milliseconds = Number(parsed.milliseconds);
3382
3383
  const microseconds = Number(parsed.microseconds);
package/dist/index.cjs CHANGED
@@ -50,7 +50,7 @@ let node_fs = require("node:fs");
50
50
  let node_stream_promises = require("node:stream/promises");
51
51
  let node_stream = require("node:stream");
52
52
  let node_buffer = require("node:buffer");
53
- //#region ../../node_modules/.pnpm/pg-minify@1.6.5/node_modules/pg-minify/lib/utils.js
53
+ //#region ../../node_modules/.pnpm/pg-minify@1.8.0/node_modules/pg-minify/lib/utils.js
54
54
  var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
55
55
  const { inspect: inspect$2 } = require("util");
56
56
  function getIndexPos(text, index) {
@@ -80,7 +80,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
80
80
  };
81
81
  }));
82
82
  //#endregion
83
- //#region ../../node_modules/.pnpm/pg-minify@1.6.5/node_modules/pg-minify/lib/error.js
83
+ //#region ../../node_modules/.pnpm/pg-minify@1.8.0/node_modules/pg-minify/lib/error.js
84
84
  var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
85
85
  const { EOL } = require("os");
86
86
  const { addInspection, messageGap } = require_utils();
@@ -141,7 +141,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
141
141
  };
142
142
  }));
143
143
  //#endregion
144
- //#region ../../node_modules/.pnpm/pg-minify@1.6.5/node_modules/pg-minify/lib/parser.js
144
+ //#region ../../node_modules/.pnpm/pg-minify@1.8.0/node_modules/pg-minify/lib/parser.js
145
145
  var require_parser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
146
146
  const { parsingErrorCode, SQLParsingError } = require_error();
147
147
  const { getIndexPos } = require_utils();
@@ -281,6 +281,11 @@ var import_lib = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((export
281
281
  parser.parsingErrorCode = error.parsingErrorCode;
282
282
  module.exports = parser;
283
283
  })))(), 1);
284
+ const buildJsonEachInClause = (columnName, values, params) => {
285
+ if (values.length === 0) return "1 = 0";
286
+ params.push(JSON.stringify(values));
287
+ return `${columnName} IN (SELECT value FROM json_each(?))`;
288
+ };
284
289
  async function resolvePage(singlePage) {
285
290
  const results = [];
286
291
  for await (const page of singlePage.iterPages()) {
@@ -304,11 +309,7 @@ function buildWhereClause(conditions) {
304
309
  clauses.push("enabled = ?");
305
310
  params.push(conditions.enabled ? 1 : 0);
306
311
  }
307
- if (conditions.id?.in) if (conditions.id.in.length === 0) clauses.push("1 = 0");
308
- else {
309
- clauses.push(`id IN (${conditions.id.in.map(() => "?").join(", ")})`);
310
- params.push(...conditions.id.in);
311
- }
312
+ if (conditions.id?.in) clauses.push(buildJsonEachInClause("id", conditions.id.in, params));
312
313
  if (conditions.id?.eq) {
313
314
  clauses.push("id = ?");
314
315
  params.push(conditions.id.eq);
@@ -335,11 +336,7 @@ function buildWhereClause(conditions) {
335
336
  clauses.push("target_app_version = ?");
336
337
  params.push(conditions.targetAppVersion);
337
338
  }
338
- if (conditions.targetAppVersionIn) if (conditions.targetAppVersionIn.length === 0) clauses.push("1 = 0");
339
- else {
340
- clauses.push(`target_app_version IN (${conditions.targetAppVersionIn.map(() => "?").join(", ")})`);
341
- params.push(...conditions.targetAppVersionIn);
342
- }
339
+ if (conditions.targetAppVersionIn) clauses.push(buildJsonEachInClause("target_app_version", conditions.targetAppVersionIn, params));
343
340
  if (conditions.fingerprintHash !== void 0) if (conditions.fingerprintHash === null) clauses.push("fingerprint_hash IS NULL");
344
341
  else {
345
342
  clauses.push("fingerprint_hash = ?");
@@ -424,13 +421,13 @@ const d1Database = (0, _hot_updater_plugin_core.createDatabasePlugin)({
424
421
  const sql = (0, import_lib.default)(`
425
422
  SELECT *
426
423
  FROM bundle_patches
427
- WHERE bundle_id IN (${bundleIds.map(() => "?").join(", ")})
424
+ WHERE bundle_id IN (SELECT value FROM json_each(?))
428
425
  ORDER BY order_index ASC, base_bundle_id ASC
429
426
  `);
430
427
  const rows = await resolvePage(await cf.d1.database.query(config.databaseId, {
431
428
  account_id: config.accountId,
432
429
  sql,
433
- params: bundleIds
430
+ params: [JSON.stringify(bundleIds)]
434
431
  }));
435
432
  for (const row of rows) {
436
433
  const current = patchMap.get(row.bundle_id) ?? [];
@@ -1352,7 +1349,7 @@ const fallbackSymbols = {
1352
1349
  const figures = isUnicodeSupported() ? mainSymbols : fallbackSymbols;
1353
1350
  Object.entries(specialMainSymbols);
1354
1351
  //#endregion
1355
- //#region ../../node_modules/.pnpm/yoctocolors@2.1.1/node_modules/yoctocolors/base.js
1352
+ //#region ../../node_modules/.pnpm/yoctocolors@2.1.2/node_modules/yoctocolors/base.js
1356
1353
  const hasColors = node_tty.default?.WriteStream?.prototype?.hasColors?.() ?? false;
1357
1354
  const format = (open, close) => {
1358
1355
  if (!hasColors) return (input) => input;
@@ -1364,8 +1361,9 @@ const format = (open, close) => {
1364
1361
  if (index === -1) return openCode + string + closeCode;
1365
1362
  let result = openCode;
1366
1363
  let lastIndex = 0;
1364
+ const replaceCode = (close === 22 ? closeCode : "") + openCode;
1367
1365
  while (index !== -1) {
1368
- result += string.slice(lastIndex, index) + openCode;
1366
+ result += string.slice(lastIndex, index) + replaceCode;
1369
1367
  lastIndex = index + closeCode.length;
1370
1368
  index = string.indexOf(closeCode, lastIndex);
1371
1369
  }
@@ -3765,7 +3763,7 @@ function parseMilliseconds(milliseconds) {
3765
3763
  throw new TypeError("Expected a finite number or bigint");
3766
3764
  }
3767
3765
  //#endregion
3768
- //#region ../../node_modules/.pnpm/pretty-ms@9.2.0/node_modules/pretty-ms/index.js
3766
+ //#region ../../node_modules/.pnpm/pretty-ms@9.3.0/node_modules/pretty-ms/index.js
3769
3767
  const isZero = (value) => value === 0 || value === 0n;
3770
3768
  const pluralize = (word, count) => count === 1 || count === 1n ? word : `${word}s`;
3771
3769
  const SECOND_ROUNDING_EPSILON = 1e-7;
@@ -3814,7 +3812,7 @@ function prettyMilliseconds(milliseconds, options) {
3814
3812
  add(Number(parsed.hours), "hour", "h");
3815
3813
  }
3816
3814
  add(Number(parsed.minutes), "minute", "m");
3817
- if (!options.hideSeconds) if (options.separateMilliseconds || options.formatSubMilliseconds || !options.colonNotation && milliseconds < 1e3) {
3815
+ if (!options.hideSeconds) if (options.separateMilliseconds || options.formatSubMilliseconds || !options.colonNotation && milliseconds < 1e3 && !options.subSecondsAsDecimals) {
3818
3816
  const seconds = Number(parsed.seconds);
3819
3817
  const milliseconds = Number(parsed.milliseconds);
3820
3818
  const microseconds = Number(parsed.microseconds);
package/dist/index.mjs CHANGED
@@ -45,7 +45,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
45
45
  }) : target, mod));
46
46
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
47
47
  //#endregion
48
- //#region ../../node_modules/.pnpm/pg-minify@1.6.5/node_modules/pg-minify/lib/utils.js
48
+ //#region ../../node_modules/.pnpm/pg-minify@1.8.0/node_modules/pg-minify/lib/utils.js
49
49
  var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
50
50
  const { inspect: inspect$1 } = __require("util");
51
51
  function getIndexPos(text, index) {
@@ -75,7 +75,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
75
75
  };
76
76
  }));
77
77
  //#endregion
78
- //#region ../../node_modules/.pnpm/pg-minify@1.6.5/node_modules/pg-minify/lib/error.js
78
+ //#region ../../node_modules/.pnpm/pg-minify@1.8.0/node_modules/pg-minify/lib/error.js
79
79
  var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
80
80
  const { EOL } = __require("os");
81
81
  const { addInspection, messageGap } = require_utils();
@@ -136,7 +136,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
136
136
  };
137
137
  }));
138
138
  //#endregion
139
- //#region ../../node_modules/.pnpm/pg-minify@1.6.5/node_modules/pg-minify/lib/parser.js
139
+ //#region ../../node_modules/.pnpm/pg-minify@1.8.0/node_modules/pg-minify/lib/parser.js
140
140
  var require_parser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
141
141
  const { parsingErrorCode, SQLParsingError } = require_error();
142
142
  const { getIndexPos } = require_utils();
@@ -276,6 +276,11 @@ var import_lib = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((export
276
276
  parser.parsingErrorCode = error.parsingErrorCode;
277
277
  module.exports = parser;
278
278
  })))(), 1);
279
+ const buildJsonEachInClause = (columnName, values, params) => {
280
+ if (values.length === 0) return "1 = 0";
281
+ params.push(JSON.stringify(values));
282
+ return `${columnName} IN (SELECT value FROM json_each(?))`;
283
+ };
279
284
  async function resolvePage(singlePage) {
280
285
  const results = [];
281
286
  for await (const page of singlePage.iterPages()) {
@@ -299,11 +304,7 @@ function buildWhereClause(conditions) {
299
304
  clauses.push("enabled = ?");
300
305
  params.push(conditions.enabled ? 1 : 0);
301
306
  }
302
- if (conditions.id?.in) if (conditions.id.in.length === 0) clauses.push("1 = 0");
303
- else {
304
- clauses.push(`id IN (${conditions.id.in.map(() => "?").join(", ")})`);
305
- params.push(...conditions.id.in);
306
- }
307
+ if (conditions.id?.in) clauses.push(buildJsonEachInClause("id", conditions.id.in, params));
307
308
  if (conditions.id?.eq) {
308
309
  clauses.push("id = ?");
309
310
  params.push(conditions.id.eq);
@@ -330,11 +331,7 @@ function buildWhereClause(conditions) {
330
331
  clauses.push("target_app_version = ?");
331
332
  params.push(conditions.targetAppVersion);
332
333
  }
333
- if (conditions.targetAppVersionIn) if (conditions.targetAppVersionIn.length === 0) clauses.push("1 = 0");
334
- else {
335
- clauses.push(`target_app_version IN (${conditions.targetAppVersionIn.map(() => "?").join(", ")})`);
336
- params.push(...conditions.targetAppVersionIn);
337
- }
334
+ if (conditions.targetAppVersionIn) clauses.push(buildJsonEachInClause("target_app_version", conditions.targetAppVersionIn, params));
338
335
  if (conditions.fingerprintHash !== void 0) if (conditions.fingerprintHash === null) clauses.push("fingerprint_hash IS NULL");
339
336
  else {
340
337
  clauses.push("fingerprint_hash = ?");
@@ -419,13 +416,13 @@ const d1Database = createDatabasePlugin({
419
416
  const sql = (0, import_lib.default)(`
420
417
  SELECT *
421
418
  FROM bundle_patches
422
- WHERE bundle_id IN (${bundleIds.map(() => "?").join(", ")})
419
+ WHERE bundle_id IN (SELECT value FROM json_each(?))
423
420
  ORDER BY order_index ASC, base_bundle_id ASC
424
421
  `);
425
422
  const rows = await resolvePage(await cf.d1.database.query(config.databaseId, {
426
423
  account_id: config.accountId,
427
424
  sql,
428
- params: bundleIds
425
+ params: [JSON.stringify(bundleIds)]
429
426
  }));
430
427
  for (const row of rows) {
431
428
  const current = patchMap.get(row.bundle_id) ?? [];
@@ -1347,7 +1344,7 @@ const fallbackSymbols = {
1347
1344
  const figures = isUnicodeSupported() ? mainSymbols : fallbackSymbols;
1348
1345
  Object.entries(specialMainSymbols);
1349
1346
  //#endregion
1350
- //#region ../../node_modules/.pnpm/yoctocolors@2.1.1/node_modules/yoctocolors/base.js
1347
+ //#region ../../node_modules/.pnpm/yoctocolors@2.1.2/node_modules/yoctocolors/base.js
1351
1348
  const hasColors = tty?.WriteStream?.prototype?.hasColors?.() ?? false;
1352
1349
  const format = (open, close) => {
1353
1350
  if (!hasColors) return (input) => input;
@@ -1359,8 +1356,9 @@ const format = (open, close) => {
1359
1356
  if (index === -1) return openCode + string + closeCode;
1360
1357
  let result = openCode;
1361
1358
  let lastIndex = 0;
1359
+ const replaceCode = (close === 22 ? closeCode : "") + openCode;
1362
1360
  while (index !== -1) {
1363
- result += string.slice(lastIndex, index) + openCode;
1361
+ result += string.slice(lastIndex, index) + replaceCode;
1364
1362
  lastIndex = index + closeCode.length;
1365
1363
  index = string.indexOf(closeCode, lastIndex);
1366
1364
  }
@@ -3760,7 +3758,7 @@ function parseMilliseconds(milliseconds) {
3760
3758
  throw new TypeError("Expected a finite number or bigint");
3761
3759
  }
3762
3760
  //#endregion
3763
- //#region ../../node_modules/.pnpm/pretty-ms@9.2.0/node_modules/pretty-ms/index.js
3761
+ //#region ../../node_modules/.pnpm/pretty-ms@9.3.0/node_modules/pretty-ms/index.js
3764
3762
  const isZero = (value) => value === 0 || value === 0n;
3765
3763
  const pluralize = (word, count) => count === 1 || count === 1n ? word : `${word}s`;
3766
3764
  const SECOND_ROUNDING_EPSILON = 1e-7;
@@ -3809,7 +3807,7 @@ function prettyMilliseconds(milliseconds, options) {
3809
3807
  add(Number(parsed.hours), "hour", "h");
3810
3808
  }
3811
3809
  add(Number(parsed.minutes), "minute", "m");
3812
- if (!options.hideSeconds) if (options.separateMilliseconds || options.formatSubMilliseconds || !options.colonNotation && milliseconds < 1e3) {
3810
+ if (!options.hideSeconds) if (options.separateMilliseconds || options.formatSubMilliseconds || !options.colonNotation && milliseconds < 1e3 && !options.subSecondsAsDecimals) {
3813
3811
  const seconds = Number(parsed.seconds);
3814
3812
  const milliseconds = Number(parsed.milliseconds);
3815
3813
  const microseconds = Number(parsed.microseconds);
@@ -3,6 +3,11 @@ let _hot_updater_js = require("@hot-updater/js");
3
3
  let _hot_updater_core = require("@hot-updater/core");
4
4
  let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
5
5
  //#region src/cloudflareWorkerDatabase.ts
6
+ const buildJsonEachInClause = (columnName, values, params) => {
7
+ if (values.length === 0) return "1 = 0";
8
+ params.push(JSON.stringify(values));
9
+ return `${columnName} IN (SELECT value FROM json_each(?))`;
10
+ };
6
11
  function buildWhereClause(conditions) {
7
12
  if (!conditions) return {
8
13
  sql: "",
@@ -22,11 +27,7 @@ function buildWhereClause(conditions) {
22
27
  clauses.push("enabled = ?");
23
28
  params.push(conditions.enabled ? 1 : 0);
24
29
  }
25
- if (conditions.id?.in) if (conditions.id.in.length === 0) clauses.push("1 = 0");
26
- else {
27
- clauses.push(`id IN (${conditions.id.in.map(() => "?").join(", ")})`);
28
- params.push(...conditions.id.in);
29
- }
30
+ if (conditions.id?.in) clauses.push(buildJsonEachInClause("id", conditions.id.in, params));
30
31
  if (conditions.id?.eq) {
31
32
  clauses.push("id = ?");
32
33
  params.push(conditions.id.eq);
@@ -53,11 +54,7 @@ function buildWhereClause(conditions) {
53
54
  clauses.push("target_app_version = ?");
54
55
  params.push(conditions.targetAppVersion);
55
56
  }
56
- if (conditions.targetAppVersionIn) if (conditions.targetAppVersionIn.length === 0) clauses.push("1 = 0");
57
- else {
58
- clauses.push(`target_app_version IN (${conditions.targetAppVersionIn.map(() => "?").join(", ")})`);
59
- params.push(...conditions.targetAppVersionIn);
60
- }
57
+ if (conditions.targetAppVersionIn) clauses.push(buildJsonEachInClause("target_app_version", conditions.targetAppVersionIn, params));
61
58
  if (conditions.fingerprintHash !== void 0) if (conditions.fingerprintHash === null) clauses.push("fingerprint_hash IS NULL");
62
59
  else {
63
60
  clauses.push("fingerprint_hash = ?");
@@ -152,9 +149,9 @@ const d1WorkerDatabase = () => (0, _hot_updater_plugin_core.createDatabasePlugin
152
149
  const rows = await queryAll(`
153
150
  SELECT *
154
151
  FROM bundle_patches
155
- WHERE bundle_id IN (${bundleIds.map(() => "?").join(", ")})
152
+ WHERE bundle_id IN (SELECT value FROM json_each(?))
156
153
  ORDER BY order_index ASC, base_bundle_id ASC
157
- `, bundleIds, context);
154
+ `, [JSON.stringify(bundleIds)], context);
158
155
  for (const row of rows) {
159
156
  const current = patchMap.get(row.bundle_id) ?? [];
160
157
  current.push(row);
@@ -2,6 +2,11 @@ import { signToken, verifyJwtSignedUrl } from "@hot-updater/js";
2
2
  import { DEFAULT_ROLLOUT_COHORT_COUNT, getAssetBaseStorageUri, getBundlePatches, getManifestFileHash, getManifestStorageUri, stripBundleArtifactMetadata } from "@hot-updater/core";
3
3
  import { calculatePagination, createDatabasePlugin, createDatabasePluginGetUpdateInfo, createRuntimeStoragePlugin } from "@hot-updater/plugin-core";
4
4
  //#region src/cloudflareWorkerDatabase.ts
5
+ const buildJsonEachInClause = (columnName, values, params) => {
6
+ if (values.length === 0) return "1 = 0";
7
+ params.push(JSON.stringify(values));
8
+ return `${columnName} IN (SELECT value FROM json_each(?))`;
9
+ };
5
10
  function buildWhereClause(conditions) {
6
11
  if (!conditions) return {
7
12
  sql: "",
@@ -21,11 +26,7 @@ function buildWhereClause(conditions) {
21
26
  clauses.push("enabled = ?");
22
27
  params.push(conditions.enabled ? 1 : 0);
23
28
  }
24
- if (conditions.id?.in) if (conditions.id.in.length === 0) clauses.push("1 = 0");
25
- else {
26
- clauses.push(`id IN (${conditions.id.in.map(() => "?").join(", ")})`);
27
- params.push(...conditions.id.in);
28
- }
29
+ if (conditions.id?.in) clauses.push(buildJsonEachInClause("id", conditions.id.in, params));
29
30
  if (conditions.id?.eq) {
30
31
  clauses.push("id = ?");
31
32
  params.push(conditions.id.eq);
@@ -52,11 +53,7 @@ function buildWhereClause(conditions) {
52
53
  clauses.push("target_app_version = ?");
53
54
  params.push(conditions.targetAppVersion);
54
55
  }
55
- if (conditions.targetAppVersionIn) if (conditions.targetAppVersionIn.length === 0) clauses.push("1 = 0");
56
- else {
57
- clauses.push(`target_app_version IN (${conditions.targetAppVersionIn.map(() => "?").join(", ")})`);
58
- params.push(...conditions.targetAppVersionIn);
59
- }
56
+ if (conditions.targetAppVersionIn) clauses.push(buildJsonEachInClause("target_app_version", conditions.targetAppVersionIn, params));
60
57
  if (conditions.fingerprintHash !== void 0) if (conditions.fingerprintHash === null) clauses.push("fingerprint_hash IS NULL");
61
58
  else {
62
59
  clauses.push("fingerprint_hash = ?");
@@ -151,9 +148,9 @@ const d1WorkerDatabase = () => createDatabasePlugin({
151
148
  const rows = await queryAll(`
152
149
  SELECT *
153
150
  FROM bundle_patches
154
- WHERE bundle_id IN (${bundleIds.map(() => "?").join(", ")})
151
+ WHERE bundle_id IN (SELECT value FROM json_each(?))
155
152
  ORDER BY order_index ASC, base_bundle_id ASC
156
- `, bundleIds, context);
153
+ `, [JSON.stringify(bundleIds)], context);
157
154
  for (const row of rows) {
158
155
  const current = patchMap.get(row.bundle_id) ?? [];
159
156
  current.push(row);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/cloudflare",
3
3
  "type": "module",
4
- "version": "0.32.0",
4
+ "version": "0.33.1",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.mjs",
@@ -27,7 +27,10 @@
27
27
  "./package.json": "./package.json"
28
28
  },
29
29
  "license": "MIT",
30
- "repository": "https://github.com/gronxb/hot-updater",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/gronxb/hot-updater"
33
+ },
31
34
  "author": "gronxb <gron1gh1@gmail.com> (https://github.com/gronxb)",
32
35
  "bugs": {
33
36
  "url": "https://github.com/gronxb/hot-updater/issues"
@@ -47,17 +50,17 @@
47
50
  "package.json"
48
51
  ],
49
52
  "dependencies": {
50
- "@aws-sdk/client-s3": "3.1008.0",
53
+ "@aws-sdk/client-s3": "3.1066.0",
51
54
  "@aws-sdk/lib-storage": "3.1008.0",
52
55
  "@aws-sdk/s3-request-presigner": "3.1008.0",
53
56
  "cloudflare": "4.2.0",
54
57
  "hono": "4.12.9",
55
58
  "uuidv7": "^1.0.2",
56
- "@hot-updater/core": "0.32.0",
57
- "@hot-updater/js": "0.32.0",
58
- "@hot-updater/plugin-core": "0.32.0",
59
- "@hot-updater/server": "0.32.0",
60
- "@hot-updater/cli-tools": "0.32.0"
59
+ "@hot-updater/cli-tools": "0.33.1",
60
+ "@hot-updater/core": "0.33.1",
61
+ "@hot-updater/js": "0.33.1",
62
+ "@hot-updater/plugin-core": "0.33.1",
63
+ "@hot-updater/server": "0.33.1"
61
64
  },
62
65
  "devDependencies": {
63
66
  "@cloudflare/vitest-pool-workers": "0.13.0",
@@ -74,7 +77,7 @@
74
77
  "vitest": "4.1.4",
75
78
  "wrangler": "^4.5.0",
76
79
  "xdg-app-paths": "^8.3.0",
77
- "@hot-updater/test-utils": "0.32.0"
80
+ "@hot-updater/test-utils": "0.33.1"
78
81
  },
79
82
  "scripts": {
80
83
  "build": "tsdown && pnpm build:worker",