@boxes-dev/dvb-runtime 1.0.1115 → 1.0.1117

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/bin/dvbd.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="49e43ad2-daea-5188-8687-f5d818219194")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f5bd4e15-77b6-5881-a922-54cf15b6400e")}catch(e){}}();
4
4
  import { createRequire as __dvbCreateRequire } from "node:module";
5
5
  import { dirname as __dvbDirname } from "node:path";
6
6
  import { fileURLToPath as __dvbFileURLToPath } from "node:url";
@@ -4205,9 +4205,12 @@ var init_loopbackServer = __esm({
4205
4205
  });
4206
4206
 
4207
4207
  // ../../../../shared/devboxCore/dist/boxesLogoSvg.js
4208
+ var BOXES_LOGO_LIGHT_BG_SVG, BOXES_LOGO_DARK_BG_SVG;
4208
4209
  var init_boxesLogoSvg = __esm({
4209
4210
  "../../../../shared/devboxCore/dist/boxesLogoSvg.js"() {
4210
4211
  "use strict";
4212
+ BOXES_LOGO_LIGHT_BG_SVG = '<svg class="logo-light-bg" role="img" aria-label="boxes.dev" width="256" height="47" viewBox="0 0 256 47" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.4834 47V43.8672H41.5176L5.4834 47ZM47 41.5176H43.8672V5.4834L47 41.5176ZM3.13379 41.5166L0 5.4834H3.13379V41.5166ZM41.5166 41.5166H5.4834V5.4834H41.5166V41.5166ZM202.834 39.7979L202.498 39.8818L202.834 39.7949V39.7979ZM206.068 34.9678C206.068 35.3875 206.11 35.6956 206.194 35.8916C206.278 36.0876 206.46 36.2705 206.74 36.4385L209.345 38.0342V38.1182L202.834 39.7949V35.9609C202.195 36.9296 201.384 37.7469 200.398 38.4121C199.278 39.1401 197.906 39.5039 196.282 39.5039C194.462 39.5039 192.838 39.0142 191.41 38.0342C189.982 37.0262 188.863 35.6819 188.051 34.002C187.267 32.294 186.874 30.404 186.874 28.332C186.874 26.064 187.351 24.0062 188.303 22.1582C189.255 20.3103 190.542 18.868 192.166 17.832C193.818 16.7681 195.624 16.2364 197.584 16.2363C199.124 16.2363 200.412 16.5442 201.448 17.1602C201.855 17.3958 202.219 17.6459 202.54 17.9102V11.3223C202.54 10.8185 202.498 10.5106 202.414 10.3984C202.358 10.2864 202.134 10.1595 201.742 10.0195L198.845 9.05371V8.88574L205.69 6.4502H206.068V34.9678ZM73.6016 19.2568C74.1736 18.5208 74.8587 17.8911 75.6602 17.3701C76.7801 16.6141 78.1524 16.2363 79.7764 16.2363C81.5962 16.2364 83.2205 16.7401 84.6484 17.748C86.0763 18.728 87.1819 20.0724 87.9658 21.7803C88.7778 23.4602 89.1836 25.3363 89.1836 27.4082C89.1836 29.6761 88.7078 31.7341 87.7559 33.582C86.8039 35.43 85.5016 36.8862 83.8496 37.9502C82.2257 38.986 80.4335 39.5039 78.4736 39.5039C76.9339 39.5039 75.6322 39.1959 74.5684 38.5801C73.9371 38.2047 73.4106 37.7918 72.9873 37.3438L70.3262 39.6299H70.0742V11.5322C70.0742 11.0288 70.0321 10.7207 69.9482 10.6084C69.8923 10.4964 69.6681 10.3704 69.2764 10.2305L66.3779 9.26367V9.0957L73.2236 6.66016H73.6016V19.2568ZM103.539 16.2363C105.499 16.2363 107.277 16.7262 108.873 17.7061C110.497 18.6861 111.771 20.0583 112.695 21.8223C113.647 23.5862 114.123 25.6022 114.123 27.8701C114.123 30.1381 113.647 32.154 112.695 33.918C111.771 35.6819 110.497 37.0542 108.873 38.0342C107.277 39.014 105.499 39.5039 103.539 39.5039C101.579 39.5038 99.787 39.0141 98.1631 38.0342C96.5672 37.0542 95.2938 35.6818 94.3418 33.918C93.4178 32.154 92.9551 30.1381 92.9551 27.8701C92.9551 25.6021 93.4178 23.5862 94.3418 21.8223C95.2937 20.0584 96.5672 18.686 98.1631 17.7061C99.787 16.7261 101.579 16.2364 103.539 16.2363ZM147.088 16.2363C148.964 16.2363 150.616 16.6702 152.044 17.5381C153.5 18.4061 154.634 19.6524 155.446 21.2764C156.258 22.8723 156.664 24.7764 156.664 26.9883H140.837C140.901 29.7964 141.556 32.0503 142.805 33.75C144.121 35.5139 146.095 36.3965 148.727 36.3965C150.154 36.3964 151.414 36.1016 152.506 35.5137C153.626 34.9257 154.704 34.0161 155.74 32.7842L156.16 33.0361C155.32 35.0521 154.158 36.6343 152.674 37.7822C151.218 38.93 149.412 39.5039 147.256 39.5039C145.268 39.5038 143.49 39.0281 141.922 38.0762C140.354 37.0962 139.123 35.7238 138.227 33.96C137.359 32.196 136.924 30.1661 136.924 27.8701C136.924 25.5742 137.345 23.5582 138.185 21.8223C139.025 20.0584 140.214 18.686 141.754 17.7061C143.294 16.7261 145.072 16.2364 147.088 16.2363ZM182.342 33.792C183.21 33.792 183.909 34.058 184.441 34.5898C185.001 35.1218 185.281 35.8084 185.281 36.6484C185.281 37.5162 185.001 38.2161 184.441 38.748C183.909 39.2519 183.21 39.5039 182.342 39.5039C181.474 39.5039 180.759 39.252 180.199 38.748C179.667 38.2162 179.401 37.5161 179.401 36.6484C179.401 35.8085 179.667 35.1218 180.199 34.5898C180.759 34.0578 181.474 33.792 182.342 33.792ZM221.818 16.2363C223.694 16.2363 225.346 16.6702 226.774 17.5381C228.23 18.4061 229.365 19.6524 230.177 21.2764C230.989 22.8723 231.395 24.7764 231.395 26.9883H215.567C215.632 29.7964 216.287 32.0503 217.535 33.75C218.851 35.5138 220.825 36.3965 223.457 36.3965C224.885 36.3964 226.144 36.1016 227.236 35.5137C228.356 34.9257 229.435 34.0161 230.471 32.7842L230.891 33.0361C230.051 35.0521 228.888 36.6343 227.404 37.7822C225.948 38.93 224.142 39.5039 221.986 39.5039C219.998 39.5038 218.22 39.0281 216.652 38.0762C215.084 37.0962 213.853 35.7238 212.957 33.96C212.089 32.196 211.654 30.1661 211.654 27.8701C211.654 25.5742 212.075 23.5582 212.915 21.8223C213.755 20.0584 214.944 18.686 216.484 17.7061C218.024 16.7261 219.802 16.2364 221.818 16.2363ZM240.083 16.9082L237.983 18.4619C237.676 18.6858 237.508 18.8538 237.479 18.9658C237.451 19.0778 237.522 19.3298 237.689 19.7217L244.26 35.2773L250.878 19.4277C250.99 19.148 251.004 18.9378 250.92 18.7979C250.864 18.6299 250.681 18.4619 250.373 18.2939L247.77 16.9082V16.7402H255.455V16.9082L253.355 18.4619C253.104 18.6578 252.908 18.8399 252.768 19.0078C252.628 19.1757 252.502 19.4138 252.39 19.7217L244.031 39.5039H242.184L233.741 19.7217C233.601 19.4138 233.461 19.1757 233.321 19.0078C233.181 18.8399 232.985 18.6578 232.733 18.4619L230.634 16.9082V16.7402H240.083V16.9082ZM167.443 16.2783C168.731 16.2503 170.076 16.4462 171.476 16.8662C172.875 17.2862 174.093 17.846 175.129 18.5459L174.583 23.8799H174.415L174.037 22.7461C173.505 21.1502 172.623 19.8898 171.392 18.9658C170.16 18.0419 168.801 17.6081 167.317 17.6641C166.141 17.6921 165.119 18.0419 164.251 18.7139C163.411 19.3859 163.005 20.2404 163.033 21.2764C163.089 22.1442 163.453 22.9701 164.125 23.7539C164.797 24.5099 165.763 25.0416 167.023 25.3496L170.677 26.1904C174.373 26.9744 176.277 28.9483 176.389 32.1123C176.417 33.5401 176.095 34.7997 175.423 35.8916C174.751 36.9556 173.813 37.7961 172.609 38.4121C171.433 39.0001 170.103 39.3219 168.619 39.3779C167.107 39.4339 165.637 39.28 164.209 38.916C162.809 38.552 161.605 38.0203 160.597 37.3203L160.219 31.9443L160.387 31.9023L161.102 32.9102C163.426 36.3539 166.001 38.0342 168.829 37.9502C170.117 37.8942 171.209 37.5164 172.105 36.8164C173.029 36.1164 173.477 35.15 173.449 33.918C173.421 33.0501 173.127 32.2383 172.567 31.4824C172.007 30.6984 171.069 30.1518 169.753 29.8438L165.931 28.9199C164.251 28.5279 162.907 27.8421 161.899 26.8623C160.891 25.8823 160.359 24.622 160.303 23.082C160.275 21.822 160.556 20.6877 161.144 19.6797C161.732 18.6719 162.571 17.874 163.663 17.2861C164.783 16.6701 166.043 16.3343 167.443 16.2783ZM123.394 16.9082L121.587 18.2939C121.363 18.4618 121.237 18.6159 121.209 18.7559C121.209 18.8958 121.293 19.0919 121.461 19.3438L125.558 25.2021L130.071 19.3438C130.267 19.0918 130.351 18.8958 130.323 18.7559C130.295 18.6159 130.141 18.4619 129.861 18.2939L127.51 16.9082V16.7402H134.565V16.9082L132.76 18.4619C132.284 18.8819 131.919 19.2737 131.667 19.6377L126.406 26.416L133.18 36.1016C133.46 36.5496 133.809 36.9423 134.229 37.2783L136.035 38.832V39H127.258V38.832L129.063 37.4463C129.287 37.2784 129.399 37.1243 129.399 36.9844C129.427 36.8444 129.343 36.6483 129.147 36.3965L124.025 29.0703L118.689 36.3965C118.494 36.6484 118.41 36.8444 118.438 36.9844C118.494 37.1243 118.662 37.2784 118.941 37.4463L121.293 38.832V39H114.153V38.832L115.959 37.2783C116.351 36.9423 116.716 36.5496 117.052 36.1016L123.161 27.835L117.43 19.6377C117.15 19.1897 116.799 18.7979 116.379 18.4619L114.573 16.9082V16.7402H123.394V16.9082ZM103.623 17.6221C101.551 17.6222 99.9558 18.546 98.8359 20.3936C97.7159 22.2136 97.1553 24.7061 97.1553 27.8701C97.1553 31.0341 97.702 33.5397 98.7939 35.3877C99.9139 37.2076 101.495 38.118 103.539 38.1182C105.583 38.1182 107.165 37.1937 108.285 35.3457C109.405 33.4977 109.966 30.978 109.966 27.7861C109.966 24.6501 109.419 22.1716 108.327 20.3516C107.235 18.5319 105.667 17.6221 103.623 17.6221ZM77.9697 18.7139C76.4779 18.7139 75.0225 19.2588 73.6016 20.3457V32.4355C73.7265 33.4698 73.9926 34.3558 74.4004 35.0938C75.0164 36.1297 75.772 36.8863 76.668 37.3623C77.5639 37.8103 78.4745 38.0342 79.3984 38.0342C80.6021 38.0341 81.666 37.6561 82.5898 36.9004C83.5138 36.1164 84.2284 35.024 84.7324 33.624C85.2364 32.224 85.4883 30.6139 85.4883 28.7939C85.4883 26.5821 85.1244 24.72 84.3965 23.208C83.6965 21.696 82.772 20.5757 81.624 19.8477C80.4761 19.0917 79.2577 18.7139 77.9697 18.7139ZM9.20996 37.791H37.791V9.20996H9.20996V37.791ZM196.66 17.7061C195.456 17.7061 194.393 18.0981 193.469 18.8818C192.545 19.6378 191.83 20.7162 191.326 22.1162C190.822 23.5162 190.57 25.1264 190.57 26.9463C190.57 29.1582 190.92 31.0203 191.62 32.5322C192.348 34.0442 193.287 35.1776 194.435 35.9336C195.582 36.6615 196.8 37.0263 198.088 37.0264C199.609 37.0264 201.093 36.4607 202.54 35.3311V24.7617C202.54 23.082 202.232 21.7244 201.616 20.6885C201.028 19.6245 200.287 18.8679 199.391 18.4199C198.495 17.9439 197.584 17.7061 196.66 17.7061ZM146.752 17.4961C144.96 17.4962 143.518 18.2938 142.426 19.8896C141.491 21.2679 140.968 23.1442 140.854 25.5176H152.459C152.407 23.1274 151.906 21.2232 150.952 19.8057C149.916 18.2658 148.516 17.4961 146.752 17.4961ZM221.482 17.4961C219.691 17.4962 218.248 18.2937 217.156 19.8896C216.221 21.2679 215.698 23.1442 215.585 25.5176H227.189C227.137 23.1274 226.636 21.2232 225.683 19.8057C224.647 18.2658 223.246 17.4961 221.482 17.4961ZM41.5166 3.13379H5.4834L41.5166 0V3.13379Z" fill="currentColor"/>\n</svg>';
4213
+ BOXES_LOGO_DARK_BG_SVG = BOXES_LOGO_LIGHT_BG_SVG.replace('class="logo-light-bg"', 'class="logo-dark-bg"');
4211
4214
  }
4212
4215
  });
4213
4216
 
@@ -20459,10 +20462,10 @@ var init_ajvProvider_97rDpkRx = __esm({
20459
20462
  Ajv2.ValidationError = validation_error_1.default;
20460
20463
  Ajv2.MissingRefError = ref_error_1.default;
20461
20464
  exports.default = Ajv2;
20462
- function checkOptions(checkOpts, options, msg, log3 = "error") {
20465
+ function checkOptions(checkOpts, options, msg, log4 = "error") {
20463
20466
  for (const key in checkOpts) {
20464
20467
  const opt = key;
20465
- if (opt in options) this.logger[log3](`${msg}: option ${key}. ${checkOpts[opt]}`);
20468
+ if (opt in options) this.logger[log4](`${msg}: option ${key}. ${checkOpts[opt]}`);
20466
20469
  }
20467
20470
  }
20468
20471
  function getSchEnv(keyRef) {
@@ -24283,7 +24286,7 @@ var init_logger = __esm({
24283
24286
  shouldLog = (minLevel, level) => levelOrder[level] >= levelOrder[minLevel];
24284
24287
  createLogger = (component) => {
24285
24288
  const minLevel = normalizeLevel(process.env.DEVBOX_LOG_LEVEL);
24286
- const log3 = (level, message, fields) => {
24289
+ const log4 = (level, message, fields) => {
24287
24290
  if (!shouldLog(minLevel, level))
24288
24291
  return;
24289
24292
  const payload = {
@@ -24296,10 +24299,10 @@ var init_logger = __esm({
24296
24299
  console.error(JSON.stringify(payload));
24297
24300
  };
24298
24301
  return {
24299
- debug: (message, fields) => log3("debug", message, fields),
24300
- info: (message, fields) => log3("info", message, fields),
24301
- warn: (message, fields) => log3("warn", message, fields),
24302
- error: (message, fields) => log3("error", message, fields)
24302
+ debug: (message, fields) => log4("debug", message, fields),
24303
+ info: (message, fields) => log4("info", message, fields),
24304
+ warn: (message, fields) => log4("warn", message, fields),
24305
+ error: (message, fields) => log4("error", message, fields)
24303
24306
  };
24304
24307
  };
24305
24308
  }
@@ -29808,13 +29811,13 @@ function _INTERNAL_captureLog(beforeLog, currentScope = getCurrentScope(), captu
29808
29811
  setLogAttribute(processedLogAttributes, "sentry.trace.parent_span_id", span?.spanContext().spanId);
29809
29812
  const processedLog = { ...beforeLog, attributes: processedLogAttributes };
29810
29813
  client.emit("beforeCaptureLog", processedLog);
29811
- const log3 = beforeSendLog ? consoleSandbox(() => beforeSendLog(processedLog)) : processedLog;
29812
- if (!log3) {
29814
+ const log4 = beforeSendLog ? consoleSandbox(() => beforeSendLog(processedLog)) : processedLog;
29815
+ if (!log4) {
29813
29816
  client.recordDroppedEvent("before_send", "log_item", 1);
29814
29817
  DEBUG_BUILD && debug.warn("beforeSendLog returned null, log will not be captured.");
29815
29818
  return;
29816
29819
  }
29817
- const { level, message, attributes: logAttributes = {}, severityNumber } = log3;
29820
+ const { level, message, attributes: logAttributes = {}, severityNumber } = log4;
29818
29821
  const timestamp = timestampInSeconds();
29819
29822
  const sequenceAttr = getSequenceAttribute(timestamp);
29820
29823
  const serializedLog = {
@@ -29830,7 +29833,7 @@ function _INTERNAL_captureLog(beforeLog, currentScope = getCurrentScope(), captu
29830
29833
  })
29831
29834
  };
29832
29835
  captureSerializedLog(client, serializedLog);
29833
- client.emit("afterCaptureLog", log3);
29836
+ client.emit("afterCaptureLog", log4);
29834
29837
  }
29835
29838
  function _INTERNAL_flushLogsBuffer(client, maybeLogBuffer) {
29836
29839
  const logBuffer = maybeLogBuffer ?? _INTERNAL_getLogBuffer(client) ?? [];
@@ -30595,12 +30598,12 @@ function estimateMetricSizeInBytes(metric) {
30595
30598
  weight += 8;
30596
30599
  return weight + estimateAttributesSizeInBytes(metric.attributes);
30597
30600
  }
30598
- function estimateLogSizeInBytes(log3) {
30601
+ function estimateLogSizeInBytes(log4) {
30599
30602
  let weight = 0;
30600
- if (log3.message) {
30601
- weight += log3.message.length * 2;
30603
+ if (log4.message) {
30604
+ weight += log4.message.length * 2;
30602
30605
  }
30603
- return weight + estimateAttributesSizeInBytes(log3.attributes);
30606
+ return weight + estimateAttributesSizeInBytes(log4.attributes);
30604
30607
  }
30605
30608
  function estimateAttributesSizeInBytes(attributes) {
30606
30609
  if (!attributes) {
@@ -32477,13 +32480,13 @@ function instrumentConsole() {
32477
32480
  originalConsoleMethods[level] = originalConsoleMethod;
32478
32481
  return function(...args) {
32479
32482
  const firstArg = args[0];
32480
- const log3 = originalConsoleMethods[level];
32483
+ const log4 = originalConsoleMethods[level];
32481
32484
  const isFiltered = _filter.size && typeof firstArg === "string" && stringMatchesSomePattern(firstArg, _filter);
32482
32485
  if (!isFiltered) {
32483
32486
  triggerHandlers("console", { args, level });
32484
32487
  }
32485
32488
  if (!isFiltered || DEBUG_BUILD && debug.isEnabled()) {
32486
- log3?.apply(GLOBAL_OBJ.console, args);
32489
+ log4?.apply(GLOBAL_OBJ.console, args);
32487
32490
  }
32488
32491
  };
32489
32492
  });
@@ -41527,7 +41530,7 @@ var require_node = __commonJS({
41527
41530
  var tty = __require("tty");
41528
41531
  var util2 = __require("util");
41529
41532
  exports.init = init3;
41530
- exports.log = log3;
41533
+ exports.log = log4;
41531
41534
  exports.formatArgs = formatArgs;
41532
41535
  exports.save = save;
41533
41536
  exports.load = load;
@@ -41662,7 +41665,7 @@ var require_node = __commonJS({
41662
41665
  }
41663
41666
  return (/* @__PURE__ */ new Date()).toISOString() + " ";
41664
41667
  }
41665
- function log3(...args) {
41668
+ function log4(...args) {
41666
41669
  return process.stderr.write(util2.formatWithOptions(exports.inspectOpts, ...args) + "\n");
41667
41670
  }
41668
41671
  function save(namespaces) {
@@ -51685,12 +51688,12 @@ var init_local_variables_sync = __esm({
51685
51688
  for (const prop of props) {
51686
51689
  if (prop.value?.objectId && prop.value.className === "Array") {
51687
51690
  const id = prop.value.objectId;
51688
- add((vars) => this._unrollArray(id, prop.name, vars, next));
51691
+ add((vars2) => this._unrollArray(id, prop.name, vars2, next));
51689
51692
  } else if (prop.value?.objectId && prop.value.className === "Object") {
51690
51693
  const id = prop.value.objectId;
51691
- add((vars) => this._unrollObject(id, prop.name, vars, next));
51694
+ add((vars2) => this._unrollObject(id, prop.name, vars2, next));
51692
51695
  } else if (prop.value) {
51693
- add((vars) => this._unrollOther(prop, vars, next));
51696
+ add((vars2) => this._unrollOther(prop, vars2, next));
51694
51697
  }
51695
51698
  }
51696
51699
  next({});
@@ -51718,42 +51721,42 @@ var init_local_variables_sync = __esm({
51718
51721
  /**
51719
51722
  * Unrolls an array property
51720
51723
  */
51721
- _unrollArray(objectId, name, vars, next) {
51724
+ _unrollArray(objectId, name, vars2, next) {
51722
51725
  this._getProperties(objectId, (props) => {
51723
- vars[name] = props.filter((v2) => v2.name !== "length" && !isNaN(parseInt(v2.name, 10))).sort((a, b) => parseInt(a.name, 10) - parseInt(b.name, 10)).map((v2) => v2.value?.value);
51724
- next(vars);
51726
+ vars2[name] = props.filter((v2) => v2.name !== "length" && !isNaN(parseInt(v2.name, 10))).sort((a, b) => parseInt(a.name, 10) - parseInt(b.name, 10)).map((v2) => v2.value?.value);
51727
+ next(vars2);
51725
51728
  });
51726
51729
  }
51727
51730
  /**
51728
51731
  * Unrolls an object property
51729
51732
  */
51730
- _unrollObject(objectId, name, vars, next) {
51733
+ _unrollObject(objectId, name, vars2, next) {
51731
51734
  this._getProperties(objectId, (props) => {
51732
- vars[name] = props.map((v2) => [v2.name, v2.value?.value]).reduce((obj, [key, val]) => {
51735
+ vars2[name] = props.map((v2) => [v2.name, v2.value?.value]).reduce((obj, [key, val]) => {
51733
51736
  obj[key] = val;
51734
51737
  return obj;
51735
51738
  }, {});
51736
- next(vars);
51739
+ next(vars2);
51737
51740
  });
51738
51741
  }
51739
51742
  /**
51740
51743
  * Unrolls other properties
51741
51744
  */
51742
- _unrollOther(prop, vars, next) {
51745
+ _unrollOther(prop, vars2, next) {
51743
51746
  if (prop.value) {
51744
51747
  if ("value" in prop.value) {
51745
51748
  if (prop.value.value === void 0 || prop.value.value === null) {
51746
- vars[prop.name] = `<${prop.value.value}>`;
51749
+ vars2[prop.name] = `<${prop.value.value}>`;
51747
51750
  } else {
51748
- vars[prop.name] = prop.value.value;
51751
+ vars2[prop.name] = prop.value.value;
51749
51752
  }
51750
51753
  } else if ("description" in prop.value && prop.value.type !== "function") {
51751
- vars[prop.name] = `<${prop.value.description}>`;
51754
+ vars2[prop.name] = `<${prop.value.description}>`;
51752
51755
  } else if (prop.value.type === "undefined") {
51753
- vars[prop.name] = "<undefined>";
51756
+ vars2[prop.name] = "<undefined>";
51754
51757
  }
51755
51758
  }
51756
- next(vars);
51759
+ next(vars2);
51757
51760
  }
51758
51761
  };
51759
51762
  INTEGRATION_NAME15 = "LocalVariables";
@@ -51840,8 +51843,8 @@ var init_local_variables_sync = __esm({
51840
51843
  } else {
51841
51844
  const id = localScope.object.objectId;
51842
51845
  add(
51843
- (frames) => session.getLocalVariables(id, (vars) => {
51844
- frames[i] = { function: fn, vars };
51846
+ (frames) => session.getLocalVariables(id, (vars2) => {
51847
+ frames[i] = { function: fn, vars: vars2 };
51845
51848
  next(frames);
51846
51849
  })
51847
51850
  );
@@ -53039,9 +53042,9 @@ var init_client2 = __esm({
53039
53042
  _INTERNAL_flushLogsBuffer(this);
53040
53043
  };
53041
53044
  if (serverName) {
53042
- this.on("beforeCaptureLog", (log3) => {
53043
- log3.attributes = {
53044
- ...log3.attributes,
53045
+ this.on("beforeCaptureLog", (log4) => {
53046
+ log4.attributes = {
53047
+ ...log4.attributes,
53045
53048
  "server.address": serverName
53046
53049
  };
53047
53050
  });
@@ -64830,9 +64833,9 @@ var init_sentry = __esm({
64830
64833
  uncaughtExceptionMonitorInstalled = false;
64831
64834
  currentDevboxSentryUser = null;
64832
64835
  readBuildMetadata = () => {
64833
- const rawPackageVersion = "1.0.1115";
64834
- const rawGitSha = "44b7c199b316cc264c5da5d10ed4ce3c902d24dd";
64835
- const rawSentryRelease = "boxes-dev-dvb@1.0.1115+44b7c199b316cc264c5da5d10ed4ce3c902d24dd";
64836
+ const rawPackageVersion = "1.0.1117";
64837
+ const rawGitSha = "5bc562be7ab3ff9894b62798adcf85aa7c664978";
64838
+ const rawSentryRelease = "boxes-dev-dvb@1.0.1117+5bc562be7ab3ff9894b62798adcf85aa7c664978";
64836
64839
  const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
64837
64840
  const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
64838
64841
  const sentryRelease = typeof rawSentryRelease === "string" ? rawSentryRelease : void 0;
@@ -67261,7 +67264,7 @@ var init_desktopInitContracts = __esm({
67261
67264
  });
67262
67265
 
67263
67266
  // ../../../../shared/devboxCore/dist/desktopObjectTransfers.js
67264
- var DESKTOP_OBJECT_TRANSFER_MAX_FILE_BYTES, DESKTOP_OBJECT_TRANSFER_MAX_BATCH_BYTES, DESKTOP_OBJECT_TRANSFER_IMPORT_TIMEOUT_MS, DESKTOP_OBJECT_TRANSFER_MULTIPART_THRESHOLD_BYTES, DESKTOP_OBJECT_TRANSFER_MULTIPART_PART_SIZE_BYTES, DESKTOP_OBJECT_TRANSFER_UPLOAD_URL_TTL_SECONDS, DESKTOP_OBJECT_TRANSFER_DOWNLOAD_URL_TTL_SECONDS;
67267
+ var DESKTOP_OBJECT_TRANSFER_MAX_FILE_BYTES, DESKTOP_OBJECT_TRANSFER_MAX_BATCH_BYTES, DESKTOP_OBJECT_TRANSFER_IMPORT_TIMEOUT_MS, DESKTOP_OBJECT_TRANSFER_MULTIPART_THRESHOLD_BYTES, DESKTOP_OBJECT_TRANSFER_MULTIPART_PART_SIZE_BYTES, DESKTOP_OBJECT_TRANSFER_UPLOAD_URL_TTL_SECONDS, DESKTOP_OBJECT_TRANSFER_DOWNLOAD_URL_TTL_SECONDS, DESKTOP_WORKSPACE_DOWNLOAD_UPLOAD_TIMEOUT_MS;
67265
67268
  var init_desktopObjectTransfers = __esm({
67266
67269
  "../../../../shared/devboxCore/dist/desktopObjectTransfers.js"() {
67267
67270
  "use strict";
@@ -67272,6 +67275,7 @@ var init_desktopObjectTransfers = __esm({
67272
67275
  DESKTOP_OBJECT_TRANSFER_MULTIPART_PART_SIZE_BYTES = 64 * 1024 * 1024;
67273
67276
  DESKTOP_OBJECT_TRANSFER_UPLOAD_URL_TTL_SECONDS = 15 * 60;
67274
67277
  DESKTOP_OBJECT_TRANSFER_DOWNLOAD_URL_TTL_SECONDS = 15 * 60;
67278
+ DESKTOP_WORKSPACE_DOWNLOAD_UPLOAD_TIMEOUT_MS = DESKTOP_OBJECT_TRANSFER_UPLOAD_URL_TTL_SECONDS * 1e3 - 6e4;
67275
67279
  }
67276
67280
  });
67277
67281
 
@@ -67383,7 +67387,7 @@ var init_packageVersion = __esm({
67383
67387
  return path8.join(process.cwd(), "dvb");
67384
67388
  };
67385
67389
  readEmbeddedPackageVersion = () => {
67386
- const raw = "1.0.1115";
67390
+ const raw = "1.0.1117";
67387
67391
  return trimVersion(raw);
67388
67392
  };
67389
67393
  readNearestPackageMetadata = (basePath) => {
@@ -67702,7 +67706,7 @@ var version2;
67702
67706
  var init_esm6 = __esm({
67703
67707
  "../../node_modules/convex/dist/esm/index.js"() {
67704
67708
  "use strict";
67705
- version2 = "1.31.6";
67709
+ version2 = "1.48.0";
67706
67710
  }
67707
67711
  });
67708
67712
 
@@ -67997,6 +68001,12 @@ function jsonToConvex(value) {
67997
68001
  }
67998
68002
  return float;
67999
68003
  }
68004
+ if (key === "$commitTs") {
68005
+ if (value.$commitTs !== null) {
68006
+ throw new Error(`Malformed $commitTs field on ${value}`);
68007
+ }
68008
+ return commitTsPlaceholder;
68009
+ }
68000
68010
  if (key === "$set") {
68001
68011
  throw new Error(
68002
68012
  `Received a Set which is no longer supported as a Convex type.`
@@ -68020,6 +68030,12 @@ function stringifyValueForError(value) {
68020
68030
  if (value2 === void 0) {
68021
68031
  return "undefined";
68022
68032
  }
68033
+ if (typeof value2 === "function") {
68034
+ return "[Function]";
68035
+ }
68036
+ if (typeof value2 === "symbol") {
68037
+ return String(value2);
68038
+ }
68023
68039
  if (typeof value2 === "bigint") {
68024
68040
  return `${value2.toString()}n`;
68025
68041
  }
@@ -68074,6 +68090,9 @@ function convexToJsonInternal(value, originalValue, context34, includeTopLevelUn
68074
68090
  if (value instanceof ArrayBuffer) {
68075
68091
  return { $bytes: fromByteArray(new Uint8Array(value)) };
68076
68092
  }
68093
+ if (value instanceof CommitTsPlaceholder) {
68094
+ return { $commitTs: null };
68095
+ }
68077
68096
  if (Array.isArray(value)) {
68078
68097
  return value.map(
68079
68098
  (value2, i) => convexToJsonInternal(value2, originalValue, context34 + `[${i}]`, false)
@@ -68144,7 +68163,7 @@ function convexOrUndefinedToJsonInternal(value, originalValue, context34) {
68144
68163
  function convexToJson(value) {
68145
68164
  return convexToJsonInternal(value, value, "", false);
68146
68165
  }
68147
- var LITTLE_ENDIAN, MIN_INT64, MAX_INT64, ZERO, EIGHT, TWOFIFTYSIX, bigIntToBase64, base64ToBigInt, MAX_IDENTIFIER_LEN, MAX_VALUE_FOR_ERROR_LEN;
68166
+ var LITTLE_ENDIAN, MIN_INT64, MAX_INT64, ZERO, EIGHT, TWOFIFTYSIX, COMMIT_TS_UNRESOLVED, CommitTsPlaceholder, commitTsPlaceholder, bigIntToBase64, base64ToBigInt, MAX_IDENTIFIER_LEN, MAX_VALUE_FOR_ERROR_LEN;
68148
68167
  var init_value = __esm({
68149
68168
  "../../node_modules/convex/dist/esm/values/value.js"() {
68150
68169
  "use strict";
@@ -68156,6 +68175,25 @@ var init_value = __esm({
68156
68175
  ZERO = BigInt("0");
68157
68176
  EIGHT = BigInt("8");
68158
68177
  TWOFIFTYSIX = BigInt("256");
68178
+ COMMIT_TS_UNRESOLVED = "This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.";
68179
+ CommitTsPlaceholder = class {
68180
+ [Symbol.toPrimitive](hint) {
68181
+ if (hint === "string") {
68182
+ return this.toString();
68183
+ }
68184
+ throw new Error(COMMIT_TS_UNRESOLVED);
68185
+ }
68186
+ valueOf() {
68187
+ throw new Error(COMMIT_TS_UNRESOLVED);
68188
+ }
68189
+ toJSON() {
68190
+ throw new Error(COMMIT_TS_UNRESOLVED);
68191
+ }
68192
+ toString() {
68193
+ return "[unresolved commit timestamp]";
68194
+ }
68195
+ };
68196
+ commitTsPlaceholder = new CommitTsPlaceholder();
68159
68197
  bigIntToBase64 = DataView.prototype.setBigInt64 ? modernBigIntToBase64 : slowBigIntToBase64;
68160
68198
  base64ToBigInt = DataView.prototype.getBigInt64 ? modernBase64ToBigInt : slowBase64ToBigInt;
68161
68199
  MAX_IDENTIFIER_LEN = 1024;
@@ -68170,7 +68208,7 @@ function throwUndefinedValidatorError(context34, fieldName) {
68170
68208
  `A validator is undefined${fieldInfo} in ${context34}. This is often caused by circular imports. See ${UNDEFINED_VALIDATOR_ERROR_URL} for details.`
68171
68209
  );
68172
68210
  }
68173
- var __defProp3, __defNormalProp, __publicField, UNDEFINED_VALIDATOR_ERROR_URL, BaseValidator, VId, VFloat64, VInt64, VBoolean, VBytes, VString, VNull, VAny, VObject, VLiteral, VArray, VRecord, VUnion;
68211
+ var __defProp3, __defNormalProp, __publicField, UNDEFINED_VALIDATOR_ERROR_URL, BaseValidator, VId, VFloat64, VInt64, VCommitTs, VBoolean, VBytes, VString, VNull, VAny, VObject, VLiteral, VArray, VRecord, VUnion;
68174
68212
  var init_validators = __esm({
68175
68213
  "../../node_modules/convex/dist/esm/values/validators.js"() {
68176
68214
  "use strict";
@@ -68209,13 +68247,17 @@ var init_validators = __esm({
68209
68247
  get json() {
68210
68248
  return { type: "id", tableName: this.tableName };
68211
68249
  }
68212
- /** @internal */
68213
- asOptional() {
68250
+ /** Allow this field to be validated as absent. */
68251
+ optional() {
68214
68252
  return new _VId({
68215
68253
  isOptional: "optional",
68216
68254
  tableName: this.tableName
68217
68255
  });
68218
68256
  }
68257
+ /** @internal */
68258
+ asOptional() {
68259
+ return this.optional();
68260
+ }
68219
68261
  };
68220
68262
  VFloat64 = class _VFloat64 extends BaseValidator {
68221
68263
  constructor() {
@@ -68226,12 +68268,16 @@ var init_validators = __esm({
68226
68268
  get json() {
68227
68269
  return { type: "number" };
68228
68270
  }
68229
- /** @internal */
68230
- asOptional() {
68271
+ /** Allow this field to be validated as absent. */
68272
+ optional() {
68231
68273
  return new _VFloat64({
68232
68274
  isOptional: "optional"
68233
68275
  });
68234
68276
  }
68277
+ /** @internal */
68278
+ asOptional() {
68279
+ return this.optional();
68280
+ }
68235
68281
  };
68236
68282
  VInt64 = class _VInt64 extends BaseValidator {
68237
68283
  constructor() {
@@ -68242,26 +68288,54 @@ var init_validators = __esm({
68242
68288
  get json() {
68243
68289
  return { type: "bigint" };
68244
68290
  }
68291
+ /** Allow this validated field to be absent. */
68292
+ optional() {
68293
+ return new _VInt64({ isOptional: "optional" });
68294
+ }
68245
68295
  /** @internal */
68246
68296
  asOptional() {
68247
- return new _VInt64({ isOptional: "optional" });
68297
+ return this.optional();
68248
68298
  }
68249
68299
  };
68250
- VBoolean = class _VBoolean extends BaseValidator {
68300
+ VCommitTs = class _VCommitTs extends BaseValidator {
68251
68301
  constructor() {
68252
68302
  super(...arguments);
68253
- __publicField(this, "kind", "boolean");
68303
+ __publicField(this, "kind", "commitTs");
68254
68304
  }
68255
68305
  /** @internal */
68256
68306
  get json() {
68257
68307
  return { type: this.kind };
68258
68308
  }
68309
+ /** Allow this validated field to be absent. */
68310
+ optional() {
68311
+ return new _VCommitTs({
68312
+ isOptional: "optional"
68313
+ });
68314
+ }
68259
68315
  /** @internal */
68260
68316
  asOptional() {
68317
+ return this.optional();
68318
+ }
68319
+ };
68320
+ VBoolean = class _VBoolean extends BaseValidator {
68321
+ constructor() {
68322
+ super(...arguments);
68323
+ __publicField(this, "kind", "boolean");
68324
+ }
68325
+ /** @internal */
68326
+ get json() {
68327
+ return { type: this.kind };
68328
+ }
68329
+ /** Allow this validated field to be absent. */
68330
+ optional() {
68261
68331
  return new _VBoolean({
68262
68332
  isOptional: "optional"
68263
68333
  });
68264
68334
  }
68335
+ /** @internal */
68336
+ asOptional() {
68337
+ return this.optional();
68338
+ }
68265
68339
  };
68266
68340
  VBytes = class _VBytes extends BaseValidator {
68267
68341
  constructor() {
@@ -68272,9 +68346,13 @@ var init_validators = __esm({
68272
68346
  get json() {
68273
68347
  return { type: this.kind };
68274
68348
  }
68349
+ /** Allow this validated field to be absent. */
68350
+ optional() {
68351
+ return new _VBytes({ isOptional: "optional" });
68352
+ }
68275
68353
  /** @internal */
68276
68354
  asOptional() {
68277
- return new _VBytes({ isOptional: "optional" });
68355
+ return this.optional();
68278
68356
  }
68279
68357
  };
68280
68358
  VString = class _VString extends BaseValidator {
@@ -68286,12 +68364,16 @@ var init_validators = __esm({
68286
68364
  get json() {
68287
68365
  return { type: this.kind };
68288
68366
  }
68289
- /** @internal */
68290
- asOptional() {
68367
+ /** Allow this validated field to be absent. */
68368
+ optional() {
68291
68369
  return new _VString({
68292
68370
  isOptional: "optional"
68293
68371
  });
68294
68372
  }
68373
+ /** @internal */
68374
+ asOptional() {
68375
+ return this.optional();
68376
+ }
68295
68377
  };
68296
68378
  VNull = class _VNull extends BaseValidator {
68297
68379
  constructor() {
@@ -68302,9 +68384,13 @@ var init_validators = __esm({
68302
68384
  get json() {
68303
68385
  return { type: this.kind };
68304
68386
  }
68387
+ /** Allow this validated field to be absent. */
68388
+ optional() {
68389
+ return new _VNull({ isOptional: "optional" });
68390
+ }
68305
68391
  /** @internal */
68306
68392
  asOptional() {
68307
- return new _VNull({ isOptional: "optional" });
68393
+ return this.optional();
68308
68394
  }
68309
68395
  };
68310
68396
  VAny = class _VAny extends BaseValidator {
@@ -68318,12 +68404,16 @@ var init_validators = __esm({
68318
68404
  type: this.kind
68319
68405
  };
68320
68406
  }
68321
- /** @internal */
68322
- asOptional() {
68407
+ /** Allow this validated field to be absent. */
68408
+ optional() {
68323
68409
  return new _VAny({
68324
68410
  isOptional: "optional"
68325
68411
  });
68326
68412
  }
68413
+ /** @internal */
68414
+ asOptional() {
68415
+ return this.optional();
68416
+ }
68327
68417
  };
68328
68418
  VObject = class _VObject extends BaseValidator {
68329
68419
  /**
@@ -68361,13 +68451,17 @@ var init_validators = __esm({
68361
68451
  )
68362
68452
  };
68363
68453
  }
68364
- /** @internal */
68365
- asOptional() {
68454
+ /** Allow this validated field to be absent. */
68455
+ optional() {
68366
68456
  return new _VObject({
68367
68457
  isOptional: "optional",
68368
68458
  fields: this.fields
68369
68459
  });
68370
68460
  }
68461
+ /** @internal */
68462
+ asOptional() {
68463
+ return this.optional();
68464
+ }
68371
68465
  /**
68372
68466
  * Create a new VObject with the specified fields omitted.
68373
68467
  * @param fields The field names to omit from this VObject.
@@ -68440,13 +68534,17 @@ var init_validators = __esm({
68440
68534
  value: convexToJson(this.value)
68441
68535
  };
68442
68536
  }
68443
- /** @internal */
68444
- asOptional() {
68537
+ /** Allow this validated field to be absent. */
68538
+ optional() {
68445
68539
  return new _VLiteral({
68446
68540
  isOptional: "optional",
68447
68541
  value: this.value
68448
68542
  });
68449
68543
  }
68544
+ /** @internal */
68545
+ asOptional() {
68546
+ return this.optional();
68547
+ }
68450
68548
  };
68451
68549
  VArray = class _VArray extends BaseValidator {
68452
68550
  /**
@@ -68471,13 +68569,17 @@ var init_validators = __esm({
68471
68569
  value: this.element.json
68472
68570
  };
68473
68571
  }
68474
- /** @internal */
68475
- asOptional() {
68572
+ /** Allow this validated field to be absent. */
68573
+ optional() {
68476
68574
  return new _VArray({
68477
68575
  isOptional: "optional",
68478
68576
  element: this.element
68479
68577
  });
68480
68578
  }
68579
+ /** @internal */
68580
+ asOptional() {
68581
+ return this.optional();
68582
+ }
68481
68583
  };
68482
68584
  VRecord = class _VRecord extends BaseValidator {
68483
68585
  /**
@@ -68505,7 +68607,7 @@ var init_validators = __esm({
68505
68607
  throw new Error("Record validator cannot have optional values");
68506
68608
  }
68507
68609
  if (!key.isConvexValidator || !value.isConvexValidator) {
68508
- throw new Error("Key and value of v.record() but be validators");
68610
+ throw new Error("Key and value of v.record() must be validators");
68509
68611
  }
68510
68612
  this.key = key;
68511
68613
  this.value = value;
@@ -68522,14 +68624,18 @@ var init_validators = __esm({
68522
68624
  }
68523
68625
  };
68524
68626
  }
68525
- /** @internal */
68526
- asOptional() {
68627
+ /** Allow this validated field to be absent. */
68628
+ optional() {
68527
68629
  return new _VRecord({
68528
68630
  isOptional: "optional",
68529
68631
  key: this.key,
68530
68632
  value: this.value
68531
68633
  });
68532
68634
  }
68635
+ /** @internal */
68636
+ asOptional() {
68637
+ return this.optional();
68638
+ }
68533
68639
  };
68534
68640
  VUnion = class _VUnion extends BaseValidator {
68535
68641
  /**
@@ -68556,20 +68662,24 @@ var init_validators = __esm({
68556
68662
  value: this.members.map((v2) => v2.json)
68557
68663
  };
68558
68664
  }
68559
- /** @internal */
68560
- asOptional() {
68665
+ /** Allow this validated field to be absent. */
68666
+ optional() {
68561
68667
  return new _VUnion({
68562
68668
  isOptional: "optional",
68563
68669
  members: this.members
68564
68670
  });
68565
68671
  }
68672
+ /** @internal */
68673
+ asOptional() {
68674
+ return this.optional();
68675
+ }
68566
68676
  };
68567
68677
  }
68568
68678
  });
68569
68679
 
68570
68680
  // ../../node_modules/convex/dist/esm/values/validator.js
68571
68681
  function isValidator(v2) {
68572
- return !!v2.isConvexValidator;
68682
+ return v2?.isConvexValidator === true;
68573
68683
  }
68574
68684
  var v;
68575
68685
  var init_validator = __esm({
@@ -68578,7 +68688,16 @@ var init_validator = __esm({
68578
68688
  init_validators();
68579
68689
  v = {
68580
68690
  /**
68581
- * Validates that the value corresponds to an ID of a document in given table.
68691
+ * Validates that the value is a document ID for the given table.
68692
+ *
68693
+ * IDs are strings at runtime but are typed as `Id<"tableName">` in
68694
+ * TypeScript for type safety.
68695
+ *
68696
+ * @example
68697
+ * ```typescript
68698
+ * args: { userId: v.id("users") }
68699
+ * ```
68700
+ *
68582
68701
  * @param tableName The name of the table.
68583
68702
  */
68584
68703
  id: (tableName) => {
@@ -68588,79 +68707,165 @@ var init_validator = __esm({
68588
68707
  });
68589
68708
  },
68590
68709
  /**
68591
- * Validates that the value is of type Null.
68710
+ * Validates that the value is `null`.
68711
+ *
68712
+ * Use `returns: v.null()` for functions that don't return a meaningful value.
68713
+ * JavaScript `undefined` is not a valid Convex value, it is automatically
68714
+ * converted to `null`.
68592
68715
  */
68593
68716
  null: () => {
68594
68717
  return new VNull({ isOptional: "required" });
68595
68718
  },
68596
68719
  /**
68597
- * Validates that the value is of Convex type Float64 (Number in JS).
68720
+ * Validates that the value is a JavaScript `number` (Convex Float64).
68721
+ *
68722
+ * Supports all IEEE-754 double-precision floating point numbers including
68723
+ * NaN and Infinity.
68598
68724
  *
68599
- * Alias for `v.float64()`
68725
+ * Alias for `v.float64()`.
68600
68726
  */
68601
68727
  number: () => {
68602
68728
  return new VFloat64({ isOptional: "required" });
68603
68729
  },
68604
68730
  /**
68605
- * Validates that the value is of Convex type Float64 (Number in JS).
68731
+ * Validates that the value is a JavaScript `number` (Convex Float64).
68732
+ *
68733
+ * Supports all IEEE-754 double-precision floating point numbers.
68606
68734
  */
68607
68735
  float64: () => {
68608
68736
  return new VFloat64({ isOptional: "required" });
68609
68737
  },
68610
68738
  /**
68611
- * @deprecated Use `v.int64()` instead
68739
+ * @deprecated Use `v.int64()` instead.
68612
68740
  */
68613
68741
  bigint: () => {
68614
68742
  return new VInt64({ isOptional: "required" });
68615
68743
  },
68616
68744
  /**
68617
- * Validates that the value is of Convex type Int64 (BigInt in JS).
68745
+ * Validates that the value is a JavaScript `bigint` (Convex Int64).
68746
+ *
68747
+ * Supports BigInts between -2^63 and 2^63-1.
68748
+ *
68749
+ * @example
68750
+ * ```typescript
68751
+ * args: { timestamp: v.int64() }
68752
+ * // Usage: createDoc({ timestamp: 1234567890n })
68753
+ * ```
68618
68754
  */
68619
68755
  int64: () => {
68620
68756
  return new VInt64({ isOptional: "required" });
68621
68757
  },
68622
68758
  /**
68623
- * Validates that the value is of type Boolean.
68759
+ * Validates that the value is a commit timestamp: an int64 (`bigint`)
68760
+ * assigned from the transaction's commit timestamp.
68761
+ *
68762
+ * An index on a field with this validator orders documents by commit order.
68763
+ * Accepts any int64 value; write `db.vars.commitTs` to have the field
68764
+ * resolve to the commit timestamp when the mutation commits.
68765
+ */
68766
+ commitTs: () => {
68767
+ return new VCommitTs({ isOptional: "required" });
68768
+ },
68769
+ /**
68770
+ * Validates that the value is a `boolean`.
68624
68771
  */
68625
68772
  boolean: () => {
68626
68773
  return new VBoolean({ isOptional: "required" });
68627
68774
  },
68628
68775
  /**
68629
- * Validates that the value is of type String.
68776
+ * Validates that the value is a `string`.
68777
+ *
68778
+ * Strings are stored as UTF-8 and their storage size is calculated as their
68779
+ * UTF-8 encoded size.
68630
68780
  */
68631
68781
  string: () => {
68632
68782
  return new VString({ isOptional: "required" });
68633
68783
  },
68634
68784
  /**
68635
- * Validates that the value is of Convex type Bytes (constructed in JS via `ArrayBuffer`).
68785
+ * Validates that the value is an `ArrayBuffer` (Convex Bytes).
68786
+ *
68787
+ * Use for binary data.
68636
68788
  */
68637
68789
  bytes: () => {
68638
68790
  return new VBytes({ isOptional: "required" });
68639
68791
  },
68640
68792
  /**
68641
- * Validates that the value is equal to the given literal value.
68793
+ * Validates that the value is exactly equal to the given literal.
68794
+ *
68795
+ * Useful for discriminated unions and enum-like patterns.
68796
+ *
68797
+ * @example
68798
+ * ```typescript
68799
+ * // Discriminated union pattern:
68800
+ * v.union(
68801
+ * v.object({ kind: v.literal("error"), message: v.string() }),
68802
+ * v.object({ kind: v.literal("success"), value: v.number() }),
68803
+ * )
68804
+ * ```
68805
+ *
68642
68806
  * @param literal The literal value to compare against.
68643
68807
  */
68644
68808
  literal: (literal2) => {
68645
68809
  return new VLiteral({ isOptional: "required", value: literal2 });
68646
68810
  },
68647
68811
  /**
68648
- * Validates that the value is an Array of the given element type.
68812
+ * Validates that the value is an `Array` where every element matches the
68813
+ * given validator.
68814
+ *
68815
+ * Arrays can have at most 8192 elements.
68816
+ *
68817
+ * @example
68818
+ * ```typescript
68819
+ * args: { tags: v.array(v.string()) }
68820
+ * args: { coordinates: v.array(v.number()) }
68821
+ * args: { items: v.array(v.object({ name: v.string(), qty: v.number() })) }
68822
+ * ```
68823
+ *
68649
68824
  * @param element The validator for the elements of the array.
68650
68825
  */
68651
68826
  array: (element) => {
68652
68827
  return new VArray({ isOptional: "required", element });
68653
68828
  },
68654
68829
  /**
68655
- * Validates that the value is an Object with the given properties.
68656
- * @param fields An object specifying the validator for each property.
68830
+ * Validates that the value is an `Object` with the specified properties.
68831
+ *
68832
+ * Objects can have at most 1024 entries. Field names must be non-empty and
68833
+ * must not start with `"$"` or `"_"` (`_` is reserved for system fields
68834
+ * like `_id` and `_creationTime`; `$` is reserved for Convex internal use).
68835
+ *
68836
+ * @example
68837
+ * ```typescript
68838
+ * args: {
68839
+ * user: v.object({
68840
+ * name: v.string(),
68841
+ * email: v.string(),
68842
+ * age: v.optional(v.number()),
68843
+ * })
68844
+ * }
68845
+ * ```
68846
+ *
68847
+ * @param fields An object mapping property names to their validators.
68657
68848
  */
68658
68849
  object: (fields) => {
68659
68850
  return new VObject({ isOptional: "required", fields });
68660
68851
  },
68661
68852
  /**
68662
- * Validates that the value is a Record with keys and values that match the given types.
68663
- * @param keys The validator for the keys of the record. This cannot contain string literals.
68853
+ * Validates that the value is a `Record` (object with dynamic keys).
68854
+ *
68855
+ * Records are objects at runtime but allow dynamic keys, unlike `v.object()`
68856
+ * which requires known property names. Keys must be ASCII characters only,
68857
+ * non-empty, and not start with `"$"` or `"_"`.
68858
+ *
68859
+ * @example
68860
+ * ```typescript
68861
+ * // Map of user IDs to scores:
68862
+ * args: { scores: v.record(v.id("users"), v.number()) }
68863
+ *
68864
+ * // Map of string keys to string values:
68865
+ * args: { metadata: v.record(v.string(), v.string()) }
68866
+ * ```
68867
+ *
68868
+ * @param keys The validator for the keys of the record.
68664
68869
  * @param values The validator for the values of the record.
68665
68870
  */
68666
68871
  record: (keys, values) => {
@@ -68671,7 +68876,23 @@ var init_validator = __esm({
68671
68876
  });
68672
68877
  },
68673
68878
  /**
68674
- * Validates that the value matches one of the given validators.
68879
+ * Validates that the value matches at least one of the given validators.
68880
+ *
68881
+ * @example
68882
+ * ```typescript
68883
+ * // Allow string or number:
68884
+ * args: { value: v.union(v.string(), v.number()) }
68885
+ *
68886
+ * // Discriminated union (recommended pattern):
68887
+ * v.union(
68888
+ * v.object({ kind: v.literal("text"), body: v.string() }),
68889
+ * v.object({ kind: v.literal("image"), url: v.string() }),
68890
+ * )
68891
+ *
68892
+ * // Nullable value:
68893
+ * returns: v.union(v.object({ ... }), v.null())
68894
+ * ```
68895
+ *
68675
68896
  * @param members The validators to match against.
68676
68897
  */
68677
68898
  union: (...members) => {
@@ -68681,27 +68902,55 @@ var init_validator = __esm({
68681
68902
  });
68682
68903
  },
68683
68904
  /**
68684
- * Does not validate the value.
68905
+ * A validator that accepts any Convex value without validation.
68906
+ *
68907
+ * Prefer using specific validators when possible for better type safety
68908
+ * and runtime validation.
68685
68909
  */
68686
68910
  any: () => {
68687
68911
  return new VAny({ isOptional: "required" });
68688
68912
  },
68689
68913
  /**
68690
- * Allows not specifying a value for a property in an Object.
68691
- * @param value The property value validator to make optional.
68914
+ * Makes a property optional in an object validator.
68692
68915
  *
68916
+ * An optional property can be omitted entirely when creating a document or
68917
+ * calling a function. This is different from `v.nullable()` which requires
68918
+ * the property to be present but allows `null`.
68919
+ *
68920
+ * @example
68693
68921
  * ```typescript
68694
- * const objectWithOptionalFields = v.object({
68695
- * requiredField: v.string(),
68696
- * optionalField: v.optional(v.string()),
68697
- * });
68922
+ * v.object({
68923
+ * name: v.string(), // required
68924
+ * nickname: v.optional(v.string()), // can be omitted
68925
+ * })
68926
+ *
68927
+ * // Valid: { name: "Alice" }
68928
+ * // Valid: { name: "Alice", nickname: "Ali" }
68929
+ * // Invalid: { name: "Alice", nickname: null } - use v.nullable() for this
68698
68930
  * ```
68931
+ *
68932
+ * @param value The property value validator to make optional.
68699
68933
  */
68700
68934
  optional: (value) => {
68701
68935
  return value.asOptional();
68702
68936
  },
68703
68937
  /**
68704
- * Allows specifying a value or null.
68938
+ * Allows a value to be either the given type or `null`.
68939
+ *
68940
+ * This is shorthand for `v.union(value, v.null())`. Unlike `v.optional()`,
68941
+ * the property must still be present, but may be `null`.
68942
+ *
68943
+ * @example
68944
+ * ```typescript
68945
+ * v.object({
68946
+ * name: v.string(),
68947
+ * deletedAt: v.nullable(v.number()), // must be present, can be null
68948
+ * })
68949
+ *
68950
+ * // Valid: { name: "Alice", deletedAt: null }
68951
+ * // Valid: { name: "Alice", deletedAt: 1234567890 }
68952
+ * // Invalid: { name: "Alice" } - deletedAt is required
68953
+ * ```
68705
68954
  */
68706
68955
  nullable: (value) => {
68707
68956
  return v.union(value, v.null());
@@ -68747,10 +68996,20 @@ var init_compare_utf8 = __esm({
68747
68996
  var init_compare = __esm({
68748
68997
  "../../node_modules/convex/dist/esm/values/compare.js"() {
68749
68998
  "use strict";
68999
+ init_value();
68750
69000
  init_compare_utf8();
68751
69001
  }
68752
69002
  });
68753
69003
 
69004
+ // ../../node_modules/convex/dist/esm/values/size.js
69005
+ var init_size = __esm({
69006
+ "../../node_modules/convex/dist/esm/values/size.js"() {
69007
+ "use strict";
69008
+ init_value();
69009
+ init_common2();
69010
+ }
69011
+ });
69012
+
68754
69013
  // ../../node_modules/convex/dist/esm/values/index.js
68755
69014
  var init_values = __esm({
68756
69015
  "../../node_modules/convex/dist/esm/values/index.js"() {
@@ -68760,6 +69019,7 @@ var init_values = __esm({
68760
69019
  init_base64();
68761
69020
  init_errors3();
68762
69021
  init_compare();
69022
+ init_size();
68763
69023
  }
68764
69024
  });
68765
69025
 
@@ -69135,7 +69395,7 @@ var init_local_state = __esm({
69135
69395
  queryJournal(queryToken) {
69136
69396
  return this.querySet.get(queryToken)?.journal;
69137
69397
  }
69138
- restart(oldRemoteQueryResults) {
69398
+ restart() {
69139
69399
  this.unpause();
69140
69400
  this.outstandingQueriesOlderThanRestart.clear();
69141
69401
  const modifications = [];
@@ -69149,9 +69409,7 @@ var init_local_state = __esm({
69149
69409
  componentPath: localQuery.componentPath
69150
69410
  };
69151
69411
  modifications.push(add);
69152
- if (!oldRemoteQueryResults.has(localQuery.id)) {
69153
- this.outstandingQueriesOlderThanRestart.add(localQuery.id);
69154
- }
69412
+ this.outstandingQueriesOlderThanRestart.add(localQuery.id);
69155
69413
  }
69156
69414
  this.querySetVersion = 1;
69157
69415
  const querySet = {
@@ -70534,6 +70792,7 @@ var init_web_socket_manager = __esm({
70534
70792
  case "ready":
70535
70793
  if (this.socket.paused === "uninitialized") {
70536
70794
  this.socket = { ...this.socket, paused: "no" };
70795
+ this._hasEverConnected = true;
70537
70796
  this.onOpen({
70538
70797
  connectionCount: this.connectionCount,
70539
70798
  lastCloseReason: this.lastCloseReason,
@@ -70723,6 +70982,8 @@ var init_authentication_manager = __esm({
70723
70982
  __publicField10(this, "clearAuth");
70724
70983
  __publicField10(this, "logger");
70725
70984
  __publicField10(this, "refreshTokenLeewaySeconds");
70985
+ __publicField10(this, "initialAuthTokenReuse");
70986
+ __publicField10(this, "lastRefreshChange");
70726
70987
  __publicField10(this, "tokenConfirmationAttempts", 0);
70727
70988
  this.syncState = syncState;
70728
70989
  this.authenticate = callbacks.authenticate;
@@ -70733,8 +70994,16 @@ var init_authentication_manager = __esm({
70733
70994
  this.clearAuth = callbacks.clearAuth;
70734
70995
  this.logger = config4.logger;
70735
70996
  this.refreshTokenLeewaySeconds = config4.refreshTokenLeewaySeconds;
70997
+ this.initialAuthTokenReuse = config4.initialAuthTokenReuse;
70998
+ this.lastRefreshChange = false;
70736
70999
  }
70737
- async setConfig(fetchToken, onChange) {
71000
+ notifyRefreshChange(isRefreshing) {
71001
+ if (this.authState.state !== "noAuth" && this.authState.state !== "initialRefetch" && this.authState.config.onRefreshChange && this.lastRefreshChange !== isRefreshing) {
71002
+ this.lastRefreshChange = isRefreshing;
71003
+ this.authState.config.onRefreshChange(isRefreshing);
71004
+ }
71005
+ }
71006
+ async setConfig(fetchToken, onChange, onRefreshChange) {
70738
71007
  this.resetAuthState();
70739
71008
  this._logVerbose("pausing WS for auth token fetch");
70740
71009
  this.pauseSocket();
@@ -70744,17 +71013,22 @@ var init_authentication_manager = __esm({
70744
71013
  if (token.isFromOutdatedConfig) {
70745
71014
  return;
70746
71015
  }
71016
+ const config4 = {
71017
+ fetchToken,
71018
+ onAuthChange: onChange,
71019
+ onRefreshChange
71020
+ };
70747
71021
  if (token.value) {
70748
71022
  this.setAuthState({
70749
71023
  state: "waitingForServerConfirmationOfCachedToken",
70750
- config: { fetchToken, onAuthChange: onChange },
71024
+ config: config4,
70751
71025
  hasRetried: false
70752
71026
  });
70753
71027
  this.authenticate(token.value);
70754
71028
  } else {
70755
71029
  this.setAuthState({
70756
71030
  state: "initialRefetch",
70757
- config: { fetchToken, onAuthChange: onChange }
71031
+ config: config4
70758
71032
  });
70759
71033
  await this.refetchToken();
70760
71034
  }
@@ -70770,14 +71044,24 @@ var init_authentication_manager = __esm({
70770
71044
  if (serverMessage.endVersion.identity <= serverMessage.startVersion.identity) {
70771
71045
  return;
70772
71046
  }
71047
+ this._logVerbose(
71048
+ `auth state is ${this.authState.state} when handling transition`
71049
+ );
71050
+ this.syncState.markAuthCompletion();
70773
71051
  if (this.authState.state === "waitingForServerConfirmationOfCachedToken") {
70774
71052
  this._logVerbose("server confirmed auth token is valid");
70775
- void this.refetchToken();
71053
+ const cachedToken = this.syncState.getAuth()?.value;
71054
+ if (this.initialAuthTokenReuse && cachedToken) {
71055
+ this.scheduleTokenRefetch(cachedToken, serverMessage.clientClockSkew);
71056
+ } else {
71057
+ void this.refetchToken();
71058
+ }
70776
71059
  this.authState.config.onAuthChange(true);
70777
71060
  return;
70778
71061
  }
70779
71062
  if (this.authState.state === "waitingForServerConfirmationOfFreshToken") {
70780
71063
  this._logVerbose("server confirmed new auth token is valid");
71064
+ this.notifyRefreshChange(false);
70781
71065
  this.scheduleTokenRefetch(this.authState.token);
70782
71066
  this.tokenConfirmationAttempts = 0;
70783
71067
  if (!this.authState.hadAuth) {
@@ -70827,7 +71111,11 @@ var init_authentication_manager = __esm({
70827
71111
  `retrying reauthentication, ${MAX_TOKEN_CONFIRMATION_ATTEMPTS - this.tokenConfirmationAttempts} attempts remaining`
70828
71112
  );
70829
71113
  }
71114
+ this.notifyRefreshChange(true);
70830
71115
  await this.stopSocket();
71116
+ if (this.authState.state === "noAuth") {
71117
+ return;
71118
+ }
70831
71119
  const token = await this.fetchTokenAndGuardAgainstRace(
70832
71120
  this.authState.config.fetchToken,
70833
71121
  {
@@ -70898,7 +71186,7 @@ var init_authentication_manager = __esm({
70898
71186
  );
70899
71187
  this.tryRestartSocket();
70900
71188
  }
70901
- scheduleTokenRefetch(token) {
71189
+ scheduleTokenRefetch(token, clientClockSkewMs) {
70902
71190
  if (this.authState.state === "noAuth") {
70903
71191
  return;
70904
71192
  }
@@ -70916,13 +71204,23 @@ var init_authentication_manager = __esm({
70916
71204
  );
70917
71205
  return;
70918
71206
  }
70919
- const tokenValiditySeconds = exp - iat;
70920
- if (tokenValiditySeconds <= 2) {
71207
+ const fullLifetimeSeconds = exp - iat;
71208
+ if (fullLifetimeSeconds <= 2) {
70921
71209
  this.logger.error(
70922
71210
  "Auth token does not live long enough, cannot refetch the token"
70923
71211
  );
70924
71212
  return;
70925
71213
  }
71214
+ let tokenValiditySeconds;
71215
+ if (clientClockSkewMs !== void 0) {
71216
+ const estimatedServerNowSeconds = (Date.now() - clientClockSkewMs) / 1e3;
71217
+ tokenValiditySeconds = exp - estimatedServerNowSeconds;
71218
+ if (tokenValiditySeconds <= 0) {
71219
+ tokenValiditySeconds = 0;
71220
+ }
71221
+ } else {
71222
+ tokenValiditySeconds = fullLifetimeSeconds;
71223
+ }
70926
71224
  let delay2 = Math.min(
70927
71225
  MAXIMUM_REFRESH_DELAY,
70928
71226
  (tokenValiditySeconds - this.refreshTokenLeewaySeconds) * 1e3
@@ -70971,7 +71269,11 @@ var init_authentication_manager = __esm({
70971
71269
  onAuthChange(false);
70972
71270
  this.resetAuthState();
70973
71271
  }
71272
+ // The sole path to `state === "noAuth"`; consumers rely on this firing
71273
+ // `notifyRefreshChange(false)` to pair any in-flight `(true)`. May run
71274
+ // when refresh state is already false.
70974
71275
  resetAuthState() {
71276
+ this.notifyRefreshChange(false);
70975
71277
  this.setAuthState({ state: "noAuth" });
70976
71278
  }
70977
71279
  setAuthState(newAuth) {
@@ -70999,7 +71301,6 @@ var init_authentication_manager = __esm({
70999
71301
  }
71000
71302
  if (this.authState.state === "waitingForScheduledRefetch") {
71001
71303
  clearTimeout(this.authState.refetchTokenTimeoutId);
71002
- this.syncState.markAuthCompletion();
71003
71304
  }
71004
71305
  this.authState = newAuth;
71005
71306
  }
@@ -71133,7 +71434,7 @@ var init_client3 = __esm({
71133
71434
  validateDeploymentUrl(address);
71134
71435
  }
71135
71436
  options = { ...options };
71136
- const authRefreshTokenLeewaySeconds = options.authRefreshTokenLeewaySeconds ?? 2;
71437
+ const authRefreshTokenLeewaySeconds = options.authRefreshTokenLeewaySeconds ?? 10;
71137
71438
  let webSocketConstructor = options.webSocketConstructor;
71138
71439
  if (!webSocketConstructor && typeof WebSocket === "undefined") {
71139
71440
  throw new Error(
@@ -71190,7 +71491,8 @@ var init_client3 = __esm({
71190
71491
  },
71191
71492
  {
71192
71493
  logger: this.logger,
71193
- refreshTokenLeewaySeconds: authRefreshTokenLeewaySeconds
71494
+ refreshTokenLeewaySeconds: authRefreshTokenLeewaySeconds,
71495
+ initialAuthTokenReuse: options.initialAuthTokenReuse ?? false
71194
71496
  }
71195
71497
  );
71196
71498
  this.optimisticQueryResults = new OptimisticQueryResults();
@@ -71227,16 +71529,11 @@ var init_client3 = __esm({
71227
71529
  sessionId: this._sessionId,
71228
71530
  maxObservedTimestamp: this.maxObservedTimestamp
71229
71531
  });
71230
- const oldRemoteQueryResults = new Set(
71231
- this.remoteQuerySet.remoteQueryResults().keys()
71232
- );
71233
71532
  this.remoteQuerySet = new RemoteQuerySet(
71234
71533
  (queryId) => this.state.queryPath(queryId),
71235
71534
  this.logger
71236
71535
  );
71237
- const [querySetModification, authModification] = this.state.restart(
71238
- oldRemoteQueryResults
71239
- );
71536
+ const [querySetModification, authModification] = this.state.restart();
71240
71537
  if (authModification) {
71241
71538
  this.webSocketManager.sendMessage(authModification);
71242
71539
  }
@@ -71331,7 +71628,7 @@ var init_client3 = __esm({
71331
71628
  * potentially led to the restart. Use this to influence when to reset backoff after a failure.
71332
71629
  */
71333
71630
  hasSyncedPastLastReconnect() {
71334
- const hasSyncedPastLastReconnect = this.requestManager.hasSyncedPastLastReconnect() || this.state.hasSyncedPastLastReconnect();
71631
+ const hasSyncedPastLastReconnect = this.requestManager.hasSyncedPastLastReconnect() && this.state.hasSyncedPastLastReconnect();
71335
71632
  return hasSyncedPastLastReconnect;
71336
71633
  }
71337
71634
  observedTimestamp(observedTs) {
@@ -71431,9 +71728,14 @@ var init_client3 = __esm({
71431
71728
  * when the user's rights were permanently revoked.
71432
71729
  * @param fetchToken - an async function returning the JWT-encoded OpenID Connect Identity Token
71433
71730
  * @param onChange - a callback that will be called when the authentication status changes
71731
+ * @param onRefreshChange - a callback called with `true` when the socket is paused to fetch a replacement token after a server rejection, and `false` when refresh completes
71434
71732
  */
71435
- setAuth(fetchToken, onChange) {
71436
- void this.authenticationManager.setConfig(fetchToken, onChange);
71733
+ setAuth(fetchToken, onChange, onRefreshChange) {
71734
+ void this.authenticationManager.setConfig(
71735
+ fetchToken,
71736
+ onChange,
71737
+ onRefreshChange
71738
+ );
71437
71739
  }
71438
71740
  hasAuth() {
71439
71741
  return this.state.hasAuth();
@@ -71787,28 +72089,6 @@ var init_client3 = __esm({
71787
72089
  }
71788
72090
  });
71789
72091
 
71790
- // ../../node_modules/convex/dist/esm/browser/http_client.js
71791
- var init_http_client = __esm({
71792
- "../../node_modules/convex/dist/esm/browser/http_client.js"() {
71793
- "use strict";
71794
- init_api4();
71795
- init_common2();
71796
- init_esm6();
71797
- init_values();
71798
- init_logging();
71799
- }
71800
- });
71801
-
71802
- // ../../node_modules/convex/dist/esm/browser/index.js
71803
- var init_browser = __esm({
71804
- "../../node_modules/convex/dist/esm/browser/index.js"() {
71805
- "use strict";
71806
- init_client3();
71807
- init_simple_client();
71808
- init_http_client();
71809
- }
71810
- });
71811
-
71812
72092
  // ../../node_modules/convex/dist/esm/browser/sync/pagination.js
71813
72093
  function asPaginationResult(value) {
71814
72094
  if (typeof value !== "object" || value === null || !Array.isArray(value.page) || typeof value.isDone !== "boolean" || typeof value.continueCursor !== "string") {
@@ -72057,8 +72337,11 @@ var init_paginated_query_client = __esm({
72057
72337
  if (ongoingSplits.has(pageKey)) {
72058
72338
  continue;
72059
72339
  }
72060
- const pageToken = pageKeyToQuery.get(pageKey).queryToken;
72061
- const pageResult = getResult(pageToken);
72340
+ const pageEntry = pageKeyToQuery.get(pageKey);
72341
+ if (!pageEntry) {
72342
+ throw new Error(`No page query for active pageKey ${pageKey}`);
72343
+ }
72344
+ const pageResult = getResult(pageEntry.queryToken);
72062
72345
  if (!pageResult) {
72063
72346
  continue;
72064
72347
  }
@@ -72069,6 +72352,7 @@ var init_paginated_query_client = __esm({
72069
72352
  this.splitPaginatedQueryPage(
72070
72353
  paginatedQuery,
72071
72354
  pageKey,
72355
+ pageEntry.cursor,
72072
72356
  result.splitCursor,
72073
72357
  // we just checked
72074
72358
  result.continueCursor
@@ -72077,11 +72361,10 @@ var init_paginated_query_client = __esm({
72077
72361
  }
72078
72362
  }
72079
72363
  }
72080
- splitPaginatedQueryPage(paginatedQuery, pageKey, splitCursor, continueCursor) {
72364
+ splitPaginatedQueryPage(paginatedQuery, pageKey, startCursor, splitCursor, continueCursor) {
72081
72365
  const splitKey1 = paginatedQuery.nextPageKey++;
72082
72366
  const splitKey2 = paginatedQuery.nextPageKey++;
72083
72367
  const paginationOpts = {
72084
- cursor: continueCursor,
72085
72368
  numItems: paginatedQuery.options.initialNumItems,
72086
72369
  id: paginatedQuery.id
72087
72370
  };
@@ -72091,13 +72374,15 @@ var init_paginated_query_client = __esm({
72091
72374
  ...paginatedQuery.args,
72092
72375
  paginationOpts: {
72093
72376
  ...paginationOpts,
72094
- cursor: null,
72095
- // Start from beginning for first split
72377
+ cursor: startCursor,
72096
72378
  endCursor: splitCursor
72097
72379
  }
72098
72380
  }
72099
72381
  );
72100
- paginatedQuery.pageKeyToQuery.set(splitKey1, firstSubscription);
72382
+ paginatedQuery.pageKeyToQuery.set(splitKey1, {
72383
+ ...firstSubscription,
72384
+ cursor: startCursor
72385
+ });
72101
72386
  const secondSubscription = this.client.subscribe(
72102
72387
  paginatedQuery.canonicalizedUdfPath,
72103
72388
  {
@@ -72109,7 +72394,10 @@ var init_paginated_query_client = __esm({
72109
72394
  }
72110
72395
  }
72111
72396
  );
72112
- paginatedQuery.pageKeyToQuery.set(splitKey2, secondSubscription);
72397
+ paginatedQuery.pageKeyToQuery.set(splitKey2, {
72398
+ ...secondSubscription,
72399
+ cursor: splitCursor
72400
+ });
72113
72401
  paginatedQuery.ongoingSplits.set(pageKey, [splitKey1, splitKey2]);
72114
72402
  }
72115
72403
  /**
@@ -72132,7 +72420,10 @@ var init_paginated_query_client = __esm({
72132
72420
  pageArgs
72133
72421
  );
72134
72422
  paginatedQuery.pageKeys.push(pageKey);
72135
- paginatedQuery.pageKeyToQuery.set(pageKey, subscription);
72423
+ paginatedQuery.pageKeyToQuery.set(pageKey, {
72424
+ ...subscription,
72425
+ cursor: continueCursor
72426
+ });
72136
72427
  return subscription;
72137
72428
  }
72138
72429
  removePaginatedQuerySubscriber(token) {
@@ -72196,8 +72487,8 @@ var init_simple_client = __esm({
72196
72487
  "../../node_modules/convex/dist/esm/browser/simple_client.js"() {
72197
72488
  "use strict";
72198
72489
  init_common2();
72199
- init_browser();
72200
72490
  init_api4();
72491
+ init_client3();
72201
72492
  init_paginated_query_client();
72202
72493
  init_udf_path_utils();
72203
72494
  __defProp15 = Object.defineProperty;
@@ -72593,7 +72884,7 @@ var init_simple_client = __esm({
72593
72884
  // ../../node_modules/convex/dist/esm/browser/simple_client-node.js
72594
72885
  import { createRequire } from "module";
72595
72886
  import { resolve as nodePathResolve } from "path";
72596
- var require2, __create3, __defProp16, __getOwnPropDesc3, __getOwnPropNames3, __getProtoOf3, __hasOwnProp3, __require2, __commonJS2, __copyProps3, __toESM3, require_stream2, require_constants3, require_node_gyp_build, require_node_gyp_build2, require_fallback, require_bufferutil, require_buffer_util2, require_limiter2, require_permessage_deflate2, require_validation3, require_receiver2, require_sender2, require_event_target2, require_extension2, require_websocket2, require_subprotocol2, require_websocket_server2, import_stream2, import_receiver2, import_sender2, import_websocket2, import_websocket_server2, wrapper_default2, nodeWebSocket;
72887
+ var require2, __create3, __defProp16, __getOwnPropDesc3, __getOwnPropNames3, __getProtoOf3, __hasOwnProp3, __require2, __commonJS2, __copyProps3, __toESM3, require_constants3, require_node_gyp_build, require_node_gyp_build2, require_fallback, require_bufferutil, require_buffer_util2, require_limiter2, require_permessage_deflate2, require_validation3, require_receiver2, require_sender2, require_event_target2, require_extension2, require_websocket2, require_stream2, require_subprotocol2, require_websocket_server2, import_stream2, import_extension2, import_permessage_deflate2, import_receiver2, import_sender2, import_subprotocol2, import_websocket2, import_websocket_server2, wrapper_default2, nodeWebSocket;
72597
72888
  var init_simple_client_node = __esm({
72598
72889
  "../../node_modules/convex/dist/esm/browser/simple_client-node.js"() {
72599
72890
  init_simple_client();
@@ -72629,109 +72920,15 @@ var init_simple_client_node = __esm({
72629
72920
  isNodeMode || !mod || !mod.__esModule ? __defProp16(target, "default", { value: mod, enumerable: true }) : target,
72630
72921
  mod
72631
72922
  ));
72632
- require_stream2 = __commonJS2({
72633
- "../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/stream.js"(exports, module2) {
72634
- "use strict";
72635
- var { Duplex } = __require2("stream");
72636
- function emitClose(stream) {
72637
- stream.emit("close");
72638
- }
72639
- function duplexOnEnd() {
72640
- if (!this.destroyed && this._writableState.finished) {
72641
- this.destroy();
72642
- }
72643
- }
72644
- function duplexOnError(err) {
72645
- this.removeListener("error", duplexOnError);
72646
- this.destroy();
72647
- if (this.listenerCount("error") === 0) {
72648
- this.emit("error", err);
72649
- }
72650
- }
72651
- function createWebSocketStream22(ws, options) {
72652
- let terminateOnDestroy = true;
72653
- const duplex = new Duplex({
72654
- ...options,
72655
- autoDestroy: false,
72656
- emitClose: false,
72657
- objectMode: false,
72658
- writableObjectMode: false
72659
- });
72660
- ws.on("message", function message(msg, isBinary) {
72661
- const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
72662
- if (!duplex.push(data)) ws.pause();
72663
- });
72664
- ws.once("error", function error4(err) {
72665
- if (duplex.destroyed) return;
72666
- terminateOnDestroy = false;
72667
- duplex.destroy(err);
72668
- });
72669
- ws.once("close", function close2() {
72670
- if (duplex.destroyed) return;
72671
- duplex.push(null);
72672
- });
72673
- duplex._destroy = function(err, callback) {
72674
- if (ws.readyState === ws.CLOSED) {
72675
- callback(err);
72676
- process.nextTick(emitClose, duplex);
72677
- return;
72678
- }
72679
- let called = false;
72680
- ws.once("error", function error4(err2) {
72681
- called = true;
72682
- callback(err2);
72683
- });
72684
- ws.once("close", function close2() {
72685
- if (!called) callback(err);
72686
- process.nextTick(emitClose, duplex);
72687
- });
72688
- if (terminateOnDestroy) ws.terminate();
72689
- };
72690
- duplex._final = function(callback) {
72691
- if (ws.readyState === ws.CONNECTING) {
72692
- ws.once("open", function open() {
72693
- duplex._final(callback);
72694
- });
72695
- return;
72696
- }
72697
- if (ws._socket === null) return;
72698
- if (ws._socket._writableState.finished) {
72699
- callback();
72700
- if (duplex._readableState.endEmitted) duplex.destroy();
72701
- } else {
72702
- ws._socket.once("finish", function finish() {
72703
- callback();
72704
- });
72705
- ws.close();
72706
- }
72707
- };
72708
- duplex._read = function() {
72709
- if (ws.isPaused) ws.resume();
72710
- };
72711
- duplex._write = function(chunk, encoding, callback) {
72712
- if (ws.readyState === ws.CONNECTING) {
72713
- ws.once("open", function open() {
72714
- duplex._write(chunk, encoding, callback);
72715
- });
72716
- return;
72717
- }
72718
- ws.send(chunk, callback);
72719
- };
72720
- duplex.on("end", duplexOnEnd);
72721
- duplex.on("error", duplexOnError);
72722
- return duplex;
72723
- }
72724
- module2.exports = createWebSocketStream22;
72725
- }
72726
- });
72727
72923
  require_constants3 = __commonJS2({
72728
- "../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/constants.js"(exports, module2) {
72924
+ "../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/constants.js"(exports, module2) {
72729
72925
  "use strict";
72730
72926
  var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
72731
72927
  var hasBlob = typeof Blob !== "undefined";
72732
72928
  if (hasBlob) BINARY_TYPES.push("blob");
72733
72929
  module2.exports = {
72734
72930
  BINARY_TYPES,
72931
+ CLOSE_TIMEOUT: 3e4,
72735
72932
  EMPTY_BUFFER: Buffer.alloc(0),
72736
72933
  GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
72737
72934
  hasBlob,
@@ -72745,19 +72942,19 @@ var init_simple_client_node = __esm({
72745
72942
  }
72746
72943
  });
72747
72944
  require_node_gyp_build = __commonJS2({
72748
- "../common/temp/node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/node-gyp-build.js"(exports, module2) {
72945
+ "../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/node-gyp-build.js"(exports, module2) {
72749
72946
  var fs8 = __require2("fs");
72750
72947
  var path11 = __require2("path");
72751
72948
  var os6 = __require2("os");
72752
72949
  var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require2;
72753
- var vars = process.config && process.config.variables || {};
72950
+ var vars2 = process.config && process.config.variables || {};
72754
72951
  var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
72755
72952
  var abi = process.versions.modules;
72756
72953
  var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
72757
72954
  var arch2 = process.env.npm_config_arch || os6.arch();
72758
72955
  var platform2 = process.env.npm_config_platform || os6.platform();
72759
72956
  var libc = process.env.LIBC || (isAlpine(platform2) ? "musl" : "glibc");
72760
- var armv = process.env.ARM_VERSION || (arch2 === "arm64" ? "8" : vars.arm_version) || "";
72957
+ var armv = process.env.ARM_VERSION || (arch2 === "arm64" ? "8" : vars2.arm_version) || "";
72761
72958
  var uv = (process.versions.uv || "").split(".")[0];
72762
72959
  module2.exports = load;
72763
72960
  function load(dir) {
@@ -72841,9 +73038,9 @@ var init_simple_client_node = __esm({
72841
73038
  }
72842
73039
  function parseTags(file2) {
72843
73040
  var arr2 = file2.split(".");
72844
- var extension3 = arr2.pop();
73041
+ var extension22 = arr2.pop();
72845
73042
  var tags = { file: file2, specificity: 0 };
72846
- if (extension3 !== "node") return;
73043
+ if (extension22 !== "node") return;
72847
73044
  for (var i = 0; i < arr2.length; i++) {
72848
73045
  var tag = arr2[i];
72849
73046
  if (tag === "node" || tag === "electron" || tag === "node-webkit") {
@@ -72912,7 +73109,7 @@ var init_simple_client_node = __esm({
72912
73109
  }
72913
73110
  });
72914
73111
  require_node_gyp_build2 = __commonJS2({
72915
- "../common/temp/node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/index.js"(exports, module2) {
73112
+ "../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/index.js"(exports, module2) {
72916
73113
  var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require2;
72917
73114
  if (typeof runtimeRequire.addon === "function") {
72918
73115
  module2.exports = runtimeRequire.addon.bind(runtimeRequire);
@@ -72922,7 +73119,7 @@ var init_simple_client_node = __esm({
72922
73119
  }
72923
73120
  });
72924
73121
  require_fallback = __commonJS2({
72925
- "../common/temp/node_modules/.pnpm/bufferutil@4.0.9/node_modules/bufferutil/fallback.js"(exports, module2) {
73122
+ "../node_modules/.pnpm/bufferutil@4.0.9/node_modules/bufferutil/fallback.js"(exports, module2) {
72926
73123
  "use strict";
72927
73124
  var mask = (source, mask2, output, offset, length) => {
72928
73125
  for (var i = 0; i < length; i++) {
@@ -72939,7 +73136,7 @@ var init_simple_client_node = __esm({
72939
73136
  }
72940
73137
  });
72941
73138
  require_bufferutil = __commonJS2({
72942
- "../common/temp/node_modules/.pnpm/bufferutil@4.0.9/node_modules/bufferutil/index.js"(exports, module2) {
73139
+ "../node_modules/.pnpm/bufferutil@4.0.9/node_modules/bufferutil/index.js"(exports, module2) {
72943
73140
  "use strict";
72944
73141
  try {
72945
73142
  module2.exports = require_node_gyp_build2()(__dirname);
@@ -72949,7 +73146,7 @@ var init_simple_client_node = __esm({
72949
73146
  }
72950
73147
  });
72951
73148
  require_buffer_util2 = __commonJS2({
72952
- "../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/buffer-util.js"(exports, module2) {
73149
+ "../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/buffer-util.js"(exports, module2) {
72953
73150
  "use strict";
72954
73151
  var { EMPTY_BUFFER } = require_constants3();
72955
73152
  var FastBuffer = Buffer[Symbol.species];
@@ -73022,7 +73219,7 @@ var init_simple_client_node = __esm({
73022
73219
  }
73023
73220
  });
73024
73221
  require_limiter2 = __commonJS2({
73025
- "../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/limiter.js"(exports, module2) {
73222
+ "../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/limiter.js"(exports, module2) {
73026
73223
  "use strict";
73027
73224
  var kDone = /* @__PURE__ */ Symbol("kDone");
73028
73225
  var kRun = /* @__PURE__ */ Symbol("kRun");
@@ -73070,7 +73267,7 @@ var init_simple_client_node = __esm({
73070
73267
  }
73071
73268
  });
73072
73269
  require_permessage_deflate2 = __commonJS2({
73073
- "../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/permessage-deflate.js"(exports, module2) {
73270
+ "../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/permessage-deflate.js"(exports, module2) {
73074
73271
  "use strict";
73075
73272
  var zlib = __require2("zlib");
73076
73273
  var bufferUtil = require_buffer_util2();
@@ -73084,7 +73281,7 @@ var init_simple_client_node = __esm({
73084
73281
  var kBuffers = /* @__PURE__ */ Symbol("buffers");
73085
73282
  var kError = /* @__PURE__ */ Symbol("error");
73086
73283
  var zlibLimiter;
73087
- var PerMessageDeflate3 = class {
73284
+ var PerMessageDeflate22 = class {
73088
73285
  /**
73089
73286
  * Creates a PerMessageDeflate instance.
73090
73287
  *
@@ -73095,6 +73292,9 @@ var init_simple_client_node = __esm({
73095
73292
  * acknowledge disabling of client context takeover
73096
73293
  * @param {Number} [options.concurrencyLimit=10] The number of concurrent
73097
73294
  * calls to zlib
73295
+ * @param {Boolean} [options.isServer=false] Create the instance in either
73296
+ * server or client mode
73297
+ * @param {Number} [options.maxPayload=0] The maximum allowed message length
73098
73298
  * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
73099
73299
  * use of a custom server window size
73100
73300
  * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
@@ -73105,15 +73305,12 @@ var init_simple_client_node = __esm({
73105
73305
  * deflate
73106
73306
  * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
73107
73307
  * inflate
73108
- * @param {Boolean} [isServer=false] Create the instance in either server or
73109
- * client mode
73110
- * @param {Number} [maxPayload=0] The maximum allowed message length
73111
73308
  */
73112
- constructor(options, isServer, maxPayload) {
73113
- this._maxPayload = maxPayload | 0;
73309
+ constructor(options) {
73114
73310
  this._options = options || {};
73115
73311
  this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024;
73116
- this._isServer = !!isServer;
73312
+ this._maxPayload = this._options.maxPayload | 0;
73313
+ this._isServer = !!this._options.isServer;
73117
73314
  this._deflate = null;
73118
73315
  this._inflate = null;
73119
73316
  this.params = null;
@@ -73422,7 +73619,7 @@ var init_simple_client_node = __esm({
73422
73619
  });
73423
73620
  }
73424
73621
  };
73425
- module2.exports = PerMessageDeflate3;
73622
+ module2.exports = PerMessageDeflate22;
73426
73623
  function deflateOnData(chunk) {
73427
73624
  this[kBuffers].push(chunk);
73428
73625
  this[kTotalLength] += chunk.length;
@@ -73441,13 +73638,17 @@ var init_simple_client_node = __esm({
73441
73638
  }
73442
73639
  function inflateOnError(err) {
73443
73640
  this[kPerMessageDeflate]._inflate = null;
73641
+ if (this[kError]) {
73642
+ this[kCallback](this[kError]);
73643
+ return;
73644
+ }
73444
73645
  err[kStatusCode] = 1007;
73445
73646
  this[kCallback](err);
73446
73647
  }
73447
73648
  }
73448
73649
  });
73449
73650
  require_validation3 = __commonJS2({
73450
- "../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/validation.js"(exports, module2) {
73651
+ "../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/validation.js"(exports, module2) {
73451
73652
  "use strict";
73452
73653
  var { isUtf8 } = __require2("buffer");
73453
73654
  var { hasBlob } = require_constants3();
@@ -73646,10 +73847,10 @@ var init_simple_client_node = __esm({
73646
73847
  }
73647
73848
  });
73648
73849
  require_receiver2 = __commonJS2({
73649
- "../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/receiver.js"(exports, module2) {
73850
+ "../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/receiver.js"(exports, module2) {
73650
73851
  "use strict";
73651
73852
  var { Writable } = __require2("stream");
73652
- var PerMessageDeflate3 = require_permessage_deflate2();
73853
+ var PerMessageDeflate22 = require_permessage_deflate2();
73653
73854
  var {
73654
73855
  BINARY_TYPES,
73655
73856
  EMPTY_BUFFER,
@@ -73679,6 +73880,10 @@ var init_simple_client_node = __esm({
73679
73880
  * extensions
73680
73881
  * @param {Boolean} [options.isServer=false] Specifies whether to operate in
73681
73882
  * client or server mode
73883
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
73884
+ * buffered data chunks
73885
+ * @param {Number} [options.maxFragments=0] The maximum number of message
73886
+ * fragments
73682
73887
  * @param {Number} [options.maxPayload=0] The maximum allowed message length
73683
73888
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
73684
73889
  * not to skip UTF-8 validation for text and close messages
@@ -73689,6 +73894,8 @@ var init_simple_client_node = __esm({
73689
73894
  this._binaryType = options.binaryType || BINARY_TYPES[0];
73690
73895
  this._extensions = options.extensions || {};
73691
73896
  this._isServer = !!options.isServer;
73897
+ this._maxBufferedChunks = options.maxBufferedChunks | 0;
73898
+ this._maxFragments = options.maxFragments | 0;
73692
73899
  this._maxPayload = options.maxPayload | 0;
73693
73900
  this._skipUTF8Validation = !!options.skipUTF8Validation;
73694
73901
  this[kWebSocket] = void 0;
@@ -73718,6 +73925,18 @@ var init_simple_client_node = __esm({
73718
73925
  */
73719
73926
  _write(chunk, encoding, cb) {
73720
73927
  if (this._opcode === 8 && this._state == GET_INFO) return cb();
73928
+ if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
73929
+ cb(
73930
+ this.createError(
73931
+ RangeError,
73932
+ "Too many buffered chunks",
73933
+ false,
73934
+ 1008,
73935
+ "WS_ERR_TOO_MANY_BUFFERED_PARTS"
73936
+ )
73937
+ );
73938
+ return;
73939
+ }
73721
73940
  this._bufferedBytes += chunk.length;
73722
73941
  this._buffers.push(chunk);
73723
73942
  this.startLoop(cb);
@@ -73816,7 +74035,7 @@ var init_simple_client_node = __esm({
73816
74035
  return;
73817
74036
  }
73818
74037
  const compressed = (buf[0] & 64) === 64;
73819
- if (compressed && !this._extensions[PerMessageDeflate3.extensionName]) {
74038
+ if (compressed && !this._extensions[PerMessageDeflate22.extensionName]) {
73820
74039
  const error4 = this.createError(
73821
74040
  RangeError,
73822
74041
  "RSV1 must be clear",
@@ -74047,6 +74266,17 @@ var init_simple_client_node = __esm({
74047
74266
  return;
74048
74267
  }
74049
74268
  if (data.length) {
74269
+ if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
74270
+ const error4 = this.createError(
74271
+ RangeError,
74272
+ "Too many message fragments",
74273
+ false,
74274
+ 1008,
74275
+ "WS_ERR_TOO_MANY_BUFFERED_PARTS"
74276
+ );
74277
+ cb(error4);
74278
+ return;
74279
+ }
74050
74280
  this._messageLength = this._totalPayloadLength;
74051
74281
  this._fragments.push(data);
74052
74282
  }
@@ -74060,7 +74290,7 @@ var init_simple_client_node = __esm({
74060
74290
  * @private
74061
74291
  */
74062
74292
  decompress(data, cb) {
74063
- const perMessageDeflate = this._extensions[PerMessageDeflate3.extensionName];
74293
+ const perMessageDeflate = this._extensions[PerMessageDeflate22.extensionName];
74064
74294
  perMessageDeflate.decompress(data, this._fin, (err, buf) => {
74065
74295
  if (err) return cb(err);
74066
74296
  if (buf.length) {
@@ -74076,6 +74306,17 @@ var init_simple_client_node = __esm({
74076
74306
  cb(error4);
74077
74307
  return;
74078
74308
  }
74309
+ if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
74310
+ const error4 = this.createError(
74311
+ RangeError,
74312
+ "Too many message fragments",
74313
+ false,
74314
+ 1008,
74315
+ "WS_ERR_TOO_MANY_BUFFERED_PARTS"
74316
+ );
74317
+ cb(error4);
74318
+ return;
74319
+ }
74079
74320
  this._fragments.push(buf);
74080
74321
  }
74081
74322
  this.dataMessage(cb);
@@ -74236,11 +74477,14 @@ var init_simple_client_node = __esm({
74236
74477
  }
74237
74478
  });
74238
74479
  require_sender2 = __commonJS2({
74239
- "../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/sender.js"(exports, module2) {
74480
+ "../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/sender.js"(exports, module2) {
74240
74481
  "use strict";
74241
74482
  var { Duplex } = __require2("stream");
74242
74483
  var { randomFillSync } = __require2("crypto");
74243
- var PerMessageDeflate3 = require_permessage_deflate2();
74484
+ var {
74485
+ types: { isUint8Array }
74486
+ } = __require2("util");
74487
+ var PerMessageDeflate22 = require_permessage_deflate2();
74244
74488
  var { EMPTY_BUFFER, kWebSocket, NOOP: NOOP2 } = require_constants3();
74245
74489
  var { isBlob, isValidStatusCode } = require_validation3();
74246
74490
  var { mask: applyMask, toBuffer } = require_buffer_util2();
@@ -74393,8 +74637,10 @@ var init_simple_client_node = __esm({
74393
74637
  buf.writeUInt16BE(code2, 0);
74394
74638
  if (typeof data === "string") {
74395
74639
  buf.write(data, 2);
74396
- } else {
74640
+ } else if (isUint8Array(data)) {
74397
74641
  buf.set(data, 2);
74642
+ } else {
74643
+ throw new TypeError("Second argument must be a string or a Uint8Array");
74398
74644
  }
74399
74645
  }
74400
74646
  const options = {
@@ -74524,7 +74770,7 @@ var init_simple_client_node = __esm({
74524
74770
  * @public
74525
74771
  */
74526
74772
  send(data, options, cb) {
74527
- const perMessageDeflate = this._extensions[PerMessageDeflate3.extensionName];
74773
+ const perMessageDeflate = this._extensions[PerMessageDeflate22.extensionName];
74528
74774
  let opcode = options.binary ? 2 : 1;
74529
74775
  let rsv1 = options.compress;
74530
74776
  let byteLength2;
@@ -74648,7 +74894,7 @@ var init_simple_client_node = __esm({
74648
74894
  this.sendFrame(_Sender.frame(data, options), cb);
74649
74895
  return;
74650
74896
  }
74651
- const perMessageDeflate = this._extensions[PerMessageDeflate3.extensionName];
74897
+ const perMessageDeflate = this._extensions[PerMessageDeflate22.extensionName];
74652
74898
  this._bufferedBytes += options[kByteLength];
74653
74899
  this._state = DEFLATING;
74654
74900
  perMessageDeflate.compress(data, options.fin, (_, buf) => {
@@ -74691,7 +74937,7 @@ var init_simple_client_node = __esm({
74691
74937
  /**
74692
74938
  * Sends a frame.
74693
74939
  *
74694
- * @param {Buffer[]} list The frame to send
74940
+ * @param {(Buffer | String)[]} list The frame to send
74695
74941
  * @param {Function} [cb] Callback
74696
74942
  * @private
74697
74943
  */
@@ -74722,7 +74968,7 @@ var init_simple_client_node = __esm({
74722
74968
  }
74723
74969
  });
74724
74970
  require_event_target2 = __commonJS2({
74725
- "../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/event-target.js"(exports, module2) {
74971
+ "../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/event-target.js"(exports, module2) {
74726
74972
  "use strict";
74727
74973
  var { kForOnEventAttribute, kListener } = require_constants3();
74728
74974
  var kCode = /* @__PURE__ */ Symbol("kCode");
@@ -74949,7 +75195,7 @@ var init_simple_client_node = __esm({
74949
75195
  }
74950
75196
  });
74951
75197
  require_extension2 = __commonJS2({
74952
- "../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/extension.js"(exports, module2) {
75198
+ "../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/extension.js"(exports, module2) {
74953
75199
  "use strict";
74954
75200
  var { tokenChars } = require_validation3();
74955
75201
  function push(dest, name, elem) {
@@ -75082,11 +75328,11 @@ var init_simple_client_node = __esm({
75082
75328
  return offers;
75083
75329
  }
75084
75330
  function format2(extensions) {
75085
- return Object.keys(extensions).map((extension3) => {
75086
- let configurations = extensions[extension3];
75331
+ return Object.keys(extensions).map((extension22) => {
75332
+ let configurations = extensions[extension22];
75087
75333
  if (!Array.isArray(configurations)) configurations = [configurations];
75088
75334
  return configurations.map((params) => {
75089
- return [extension3].concat(
75335
+ return [extension22].concat(
75090
75336
  Object.keys(params).map((k) => {
75091
75337
  let values = params[k];
75092
75338
  if (!Array.isArray(values)) values = [values];
@@ -75100,7 +75346,7 @@ var init_simple_client_node = __esm({
75100
75346
  }
75101
75347
  });
75102
75348
  require_websocket2 = __commonJS2({
75103
- "../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/websocket.js"(exports, module2) {
75349
+ "../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/websocket.js"(exports, module2) {
75104
75350
  "use strict";
75105
75351
  var EventEmitter3 = __require2("events");
75106
75352
  var https3 = __require2("https");
@@ -75110,12 +75356,13 @@ var init_simple_client_node = __esm({
75110
75356
  var { randomBytes, createHash: createHash3 } = __require2("crypto");
75111
75357
  var { Duplex, Readable: Readable2 } = __require2("stream");
75112
75358
  var { URL: URL3 } = __require2("url");
75113
- var PerMessageDeflate3 = require_permessage_deflate2();
75359
+ var PerMessageDeflate22 = require_permessage_deflate2();
75114
75360
  var Receiver22 = require_receiver2();
75115
75361
  var Sender22 = require_sender2();
75116
75362
  var { isBlob } = require_validation3();
75117
75363
  var {
75118
75364
  BINARY_TYPES,
75365
+ CLOSE_TIMEOUT,
75119
75366
  EMPTY_BUFFER,
75120
75367
  GUID,
75121
75368
  kForOnEventAttribute,
@@ -75129,7 +75376,6 @@ var init_simple_client_node = __esm({
75129
75376
  } = require_event_target2();
75130
75377
  var { format: format2, parse: parse5 } = require_extension2();
75131
75378
  var { toBuffer } = require_buffer_util2();
75132
- var closeTimeout = 30 * 1e3;
75133
75379
  var kAborted = /* @__PURE__ */ Symbol("kAborted");
75134
75380
  var protocolVersions = [8, 13];
75135
75381
  var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
@@ -75175,6 +75421,7 @@ var init_simple_client_node = __esm({
75175
75421
  initAsClient(this, address, protocols, options);
75176
75422
  } else {
75177
75423
  this._autoPong = options.autoPong;
75424
+ this._closeTimeout = options.closeTimeout;
75178
75425
  this._isServer = true;
75179
75426
  }
75180
75427
  }
@@ -75268,6 +75515,10 @@ var init_simple_client_node = __esm({
75268
75515
  * multiple times in the same tick
75269
75516
  * @param {Function} [options.generateMask] The function used to generate the
75270
75517
  * masking key
75518
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
75519
+ * buffered data chunks
75520
+ * @param {Number} [options.maxFragments=0] The maximum number of message
75521
+ * fragments
75271
75522
  * @param {Number} [options.maxPayload=0] The maximum allowed message size
75272
75523
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
75273
75524
  * not to skip UTF-8 validation for text and close messages
@@ -75279,6 +75530,8 @@ var init_simple_client_node = __esm({
75279
75530
  binaryType: this.binaryType,
75280
75531
  extensions: this._extensions,
75281
75532
  isServer: this._isServer,
75533
+ maxBufferedChunks: options.maxBufferedChunks,
75534
+ maxFragments: options.maxFragments,
75282
75535
  maxPayload: options.maxPayload,
75283
75536
  skipUTF8Validation: options.skipUTF8Validation
75284
75537
  });
@@ -75317,8 +75570,8 @@ var init_simple_client_node = __esm({
75317
75570
  this.emit("close", this._closeCode, this._closeMessage);
75318
75571
  return;
75319
75572
  }
75320
- if (this._extensions[PerMessageDeflate3.extensionName]) {
75321
- this._extensions[PerMessageDeflate3.extensionName].cleanup();
75573
+ if (this._extensions[PerMessageDeflate22.extensionName]) {
75574
+ this._extensions[PerMessageDeflate22.extensionName].cleanup();
75322
75575
  }
75323
75576
  this._receiver.removeAllListeners();
75324
75577
  this._readyState = _WebSocket.CLOSED;
@@ -75480,7 +75733,7 @@ var init_simple_client_node = __esm({
75480
75733
  fin: true,
75481
75734
  ...options
75482
75735
  };
75483
- if (!this._extensions[PerMessageDeflate3.extensionName]) {
75736
+ if (!this._extensions[PerMessageDeflate22.extensionName]) {
75484
75737
  opts.compress = false;
75485
75738
  }
75486
75739
  this._sender.send(data || EMPTY_BUFFER, opts, cb);
@@ -75576,7 +75829,10 @@ var init_simple_client_node = __esm({
75576
75829
  const opts = {
75577
75830
  allowSynchronousEvents: true,
75578
75831
  autoPong: true,
75832
+ closeTimeout: CLOSE_TIMEOUT,
75579
75833
  protocolVersion: protocolVersions[1],
75834
+ maxBufferedChunks: 1024 * 1024,
75835
+ maxFragments: 128 * 1024,
75580
75836
  maxPayload: 100 * 1024 * 1024,
75581
75837
  skipUTF8Validation: false,
75582
75838
  perMessageDeflate: true,
@@ -75593,6 +75849,7 @@ var init_simple_client_node = __esm({
75593
75849
  port: void 0
75594
75850
  };
75595
75851
  websocket._autoPong = opts.autoPong;
75852
+ websocket._closeTimeout = opts.closeTimeout;
75596
75853
  if (!protocolVersions.includes(opts.protocolVersion)) {
75597
75854
  throw new RangeError(
75598
75855
  `Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`
@@ -75604,7 +75861,7 @@ var init_simple_client_node = __esm({
75604
75861
  } else {
75605
75862
  try {
75606
75863
  parsedUrl = new URL3(address);
75607
- } catch (e) {
75864
+ } catch {
75608
75865
  throw new SyntaxError(`Invalid URL: ${address}`);
75609
75866
  }
75610
75867
  }
@@ -75618,7 +75875,7 @@ var init_simple_client_node = __esm({
75618
75875
  const isIpcUrl = parsedUrl.protocol === "ws+unix:";
75619
75876
  let invalidUrlMessage;
75620
75877
  if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) {
75621
- invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`;
75878
+ invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;
75622
75879
  } else if (isIpcUrl && !parsedUrl.pathname) {
75623
75880
  invalidUrlMessage = "The URL's pathname is empty";
75624
75881
  } else if (parsedUrl.hash) {
@@ -75652,13 +75909,13 @@ var init_simple_client_node = __esm({
75652
75909
  opts.path = parsedUrl.pathname + parsedUrl.search;
75653
75910
  opts.timeout = opts.handshakeTimeout;
75654
75911
  if (opts.perMessageDeflate) {
75655
- perMessageDeflate = new PerMessageDeflate3(
75656
- opts.perMessageDeflate !== true ? opts.perMessageDeflate : {},
75657
- false,
75658
- opts.maxPayload
75659
- );
75912
+ perMessageDeflate = new PerMessageDeflate22({
75913
+ ...opts.perMessageDeflate,
75914
+ isServer: false,
75915
+ maxPayload: opts.maxPayload
75916
+ });
75660
75917
  opts.headers["Sec-WebSocket-Extensions"] = format2({
75661
- [PerMessageDeflate3.extensionName]: perMessageDeflate.offer()
75918
+ [PerMessageDeflate22.extensionName]: perMessageDeflate.offer()
75662
75919
  });
75663
75920
  }
75664
75921
  if (protocols.length) {
@@ -75801,23 +76058,25 @@ var init_simple_client_node = __esm({
75801
76058
  return;
75802
76059
  }
75803
76060
  const extensionNames = Object.keys(extensions);
75804
- if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate3.extensionName) {
76061
+ if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate22.extensionName) {
75805
76062
  const message = "Server indicated an extension that was not requested";
75806
76063
  abortHandshake(websocket, socket, message);
75807
76064
  return;
75808
76065
  }
75809
76066
  try {
75810
- perMessageDeflate.accept(extensions[PerMessageDeflate3.extensionName]);
76067
+ perMessageDeflate.accept(extensions[PerMessageDeflate22.extensionName]);
75811
76068
  } catch (err) {
75812
76069
  const message = "Invalid Sec-WebSocket-Extensions header";
75813
76070
  abortHandshake(websocket, socket, message);
75814
76071
  return;
75815
76072
  }
75816
- websocket._extensions[PerMessageDeflate3.extensionName] = perMessageDeflate;
76073
+ websocket._extensions[PerMessageDeflate22.extensionName] = perMessageDeflate;
75817
76074
  }
75818
76075
  websocket.setSocket(socket, head, {
75819
76076
  allowSynchronousEvents: opts.allowSynchronousEvents,
75820
76077
  generateMask: opts.generateMask,
76078
+ maxBufferedChunks: opts.maxBufferedChunks,
76079
+ maxFragments: opts.maxFragments,
75821
76080
  maxPayload: opts.maxPayload,
75822
76081
  skipUTF8Validation: opts.skipUTF8Validation
75823
76082
  });
@@ -75935,7 +76194,7 @@ var init_simple_client_node = __esm({
75935
76194
  function setCloseTimer(websocket) {
75936
76195
  websocket._closeTimer = setTimeout(
75937
76196
  websocket._socket.destroy.bind(websocket._socket),
75938
- closeTimeout
76197
+ websocket._closeTimeout
75939
76198
  );
75940
76199
  }
75941
76200
  function socketOnClose() {
@@ -75944,8 +76203,8 @@ var init_simple_client_node = __esm({
75944
76203
  this.removeListener("data", socketOnData);
75945
76204
  this.removeListener("end", socketOnEnd);
75946
76205
  websocket._readyState = WebSocket22.CLOSING;
75947
- let chunk;
75948
- if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && (chunk = websocket._socket.read()) !== null) {
76206
+ if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
76207
+ const chunk = this.read(this._readableState.length);
75949
76208
  websocket._receiver.write(chunk);
75950
76209
  }
75951
76210
  websocket._receiver.end();
@@ -75980,8 +76239,104 @@ var init_simple_client_node = __esm({
75980
76239
  }
75981
76240
  }
75982
76241
  });
76242
+ require_stream2 = __commonJS2({
76243
+ "../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/stream.js"(exports, module2) {
76244
+ "use strict";
76245
+ var WebSocket22 = require_websocket2();
76246
+ var { Duplex } = __require2("stream");
76247
+ function emitClose(stream) {
76248
+ stream.emit("close");
76249
+ }
76250
+ function duplexOnEnd() {
76251
+ if (!this.destroyed && this._writableState.finished) {
76252
+ this.destroy();
76253
+ }
76254
+ }
76255
+ function duplexOnError(err) {
76256
+ this.removeListener("error", duplexOnError);
76257
+ this.destroy();
76258
+ if (this.listenerCount("error") === 0) {
76259
+ this.emit("error", err);
76260
+ }
76261
+ }
76262
+ function createWebSocketStream22(ws, options) {
76263
+ let terminateOnDestroy = true;
76264
+ const duplex = new Duplex({
76265
+ ...options,
76266
+ autoDestroy: false,
76267
+ emitClose: false,
76268
+ objectMode: false,
76269
+ writableObjectMode: false
76270
+ });
76271
+ ws.on("message", function message(msg, isBinary) {
76272
+ const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
76273
+ if (!duplex.push(data)) ws.pause();
76274
+ });
76275
+ ws.once("error", function error4(err) {
76276
+ if (duplex.destroyed) return;
76277
+ terminateOnDestroy = false;
76278
+ duplex.destroy(err);
76279
+ });
76280
+ ws.once("close", function close2() {
76281
+ if (duplex.destroyed) return;
76282
+ duplex.push(null);
76283
+ });
76284
+ duplex._destroy = function(err, callback) {
76285
+ if (ws.readyState === ws.CLOSED) {
76286
+ callback(err);
76287
+ process.nextTick(emitClose, duplex);
76288
+ return;
76289
+ }
76290
+ let called = false;
76291
+ ws.once("error", function error4(err2) {
76292
+ called = true;
76293
+ callback(err2);
76294
+ });
76295
+ ws.once("close", function close2() {
76296
+ if (!called) callback(err);
76297
+ process.nextTick(emitClose, duplex);
76298
+ });
76299
+ if (terminateOnDestroy) ws.terminate();
76300
+ };
76301
+ duplex._final = function(callback) {
76302
+ if (ws.readyState === ws.CONNECTING) {
76303
+ ws.once("open", function open() {
76304
+ duplex._final(callback);
76305
+ });
76306
+ return;
76307
+ }
76308
+ if (ws._socket === null) return;
76309
+ if (ws._socket._writableState.finished) {
76310
+ callback();
76311
+ if (duplex._readableState.endEmitted) duplex.destroy();
76312
+ } else {
76313
+ ws._socket.once("finish", function finish() {
76314
+ callback();
76315
+ });
76316
+ ws.close();
76317
+ }
76318
+ };
76319
+ duplex._read = function() {
76320
+ if (ws.isPaused) ws.resume();
76321
+ };
76322
+ duplex._write = function(chunk, encoding, callback) {
76323
+ if (ws.readyState === ws.CONNECTING) {
76324
+ ws.once("open", function open() {
76325
+ duplex._write(chunk, encoding, callback);
76326
+ });
76327
+ return;
76328
+ }
76329
+ ws.send(chunk, callback);
76330
+ };
76331
+ duplex.on("end", duplexOnEnd);
76332
+ duplex.on("error", duplexOnError);
76333
+ return duplex;
76334
+ }
76335
+ module2.exports = createWebSocketStream22;
76336
+ }
76337
+ });
75983
76338
  require_subprotocol2 = __commonJS2({
75984
- "../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/subprotocol.js"(exports, module2) {
76339
+ "../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/subprotocol.js"(exports, module2) {
75985
76340
  "use strict";
75986
76341
  var { tokenChars } = require_validation3();
75987
76342
  function parse5(header) {
@@ -76024,17 +76379,17 @@ var init_simple_client_node = __esm({
76024
76379
  }
76025
76380
  });
76026
76381
  require_websocket_server2 = __commonJS2({
76027
- "../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/websocket-server.js"(exports, module2) {
76382
+ "../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/websocket-server.js"(exports, module2) {
76028
76383
  "use strict";
76029
76384
  var EventEmitter3 = __require2("events");
76030
76385
  var http5 = __require2("http");
76031
76386
  var { Duplex } = __require2("stream");
76032
76387
  var { createHash: createHash3 } = __require2("crypto");
76033
- var extension3 = require_extension2();
76034
- var PerMessageDeflate3 = require_permessage_deflate2();
76035
- var subprotocol3 = require_subprotocol2();
76388
+ var extension22 = require_extension2();
76389
+ var PerMessageDeflate22 = require_permessage_deflate2();
76390
+ var subprotocol22 = require_subprotocol2();
76036
76391
  var WebSocket22 = require_websocket2();
76037
- var { GUID, kWebSocket } = require_constants3();
76392
+ var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants3();
76038
76393
  var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
76039
76394
  var RUNNING = 0;
76040
76395
  var CLOSING = 1;
@@ -76053,8 +76408,15 @@ var init_simple_client_node = __esm({
76053
76408
  * pending connections
76054
76409
  * @param {Boolean} [options.clientTracking=true] Specifies whether or not to
76055
76410
  * track clients
76411
+ * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to
76412
+ * wait for the closing handshake to finish after `websocket.close()` is
76413
+ * called
76056
76414
  * @param {Function} [options.handleProtocols] A hook to handle protocols
76057
76415
  * @param {String} [options.host] The hostname where to bind the server
76416
+ * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
76417
+ * buffered data chunks
76418
+ * @param {Number} [options.maxFragments=131072] The maximum number of message
76419
+ * fragments
76058
76420
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
76059
76421
  * size
76060
76422
  * @param {Boolean} [options.noServer=false] Enable no server mode
@@ -76076,11 +76438,14 @@ var init_simple_client_node = __esm({
76076
76438
  options = {
76077
76439
  allowSynchronousEvents: true,
76078
76440
  autoPong: true,
76441
+ maxBufferedChunks: 1024 * 1024,
76442
+ maxFragments: 128 * 1024,
76079
76443
  maxPayload: 100 * 1024 * 1024,
76080
76444
  skipUTF8Validation: false,
76081
76445
  perMessageDeflate: false,
76082
76446
  handleProtocols: null,
76083
76447
  clientTracking: true,
76448
+ closeTimeout: CLOSE_TIMEOUT,
76084
76449
  verifyClient: null,
76085
76450
  noServer: false,
76086
76451
  backlog: null,
@@ -76236,9 +76601,11 @@ var init_simple_client_node = __esm({
76236
76601
  abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
76237
76602
  return;
76238
76603
  }
76239
- if (version3 !== 8 && version3 !== 13) {
76604
+ if (version3 !== 13 && version3 !== 8) {
76240
76605
  const message = "Missing or invalid Sec-WebSocket-Version header";
76241
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
76606
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
76607
+ "Sec-WebSocket-Version": "13, 8"
76608
+ });
76242
76609
  return;
76243
76610
  }
76244
76611
  if (!this.shouldHandle(req)) {
@@ -76249,7 +76616,7 @@ var init_simple_client_node = __esm({
76249
76616
  let protocols = /* @__PURE__ */ new Set();
76250
76617
  if (secWebSocketProtocol !== void 0) {
76251
76618
  try {
76252
- protocols = subprotocol3.parse(secWebSocketProtocol);
76619
+ protocols = subprotocol22.parse(secWebSocketProtocol);
76253
76620
  } catch (err) {
76254
76621
  const message = "Invalid Sec-WebSocket-Protocol header";
76255
76622
  abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
@@ -76259,16 +76626,16 @@ var init_simple_client_node = __esm({
76259
76626
  const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
76260
76627
  const extensions = {};
76261
76628
  if (this.options.perMessageDeflate && secWebSocketExtensions !== void 0) {
76262
- const perMessageDeflate = new PerMessageDeflate3(
76263
- this.options.perMessageDeflate,
76264
- true,
76265
- this.options.maxPayload
76266
- );
76629
+ const perMessageDeflate = new PerMessageDeflate22({
76630
+ ...this.options.perMessageDeflate,
76631
+ isServer: true,
76632
+ maxPayload: this.options.maxPayload
76633
+ });
76267
76634
  try {
76268
- const offers = extension3.parse(secWebSocketExtensions);
76269
- if (offers[PerMessageDeflate3.extensionName]) {
76270
- perMessageDeflate.accept(offers[PerMessageDeflate3.extensionName]);
76271
- extensions[PerMessageDeflate3.extensionName] = perMessageDeflate;
76635
+ const offers = extension22.parse(secWebSocketExtensions);
76636
+ if (offers[PerMessageDeflate22.extensionName]) {
76637
+ perMessageDeflate.accept(offers[PerMessageDeflate22.extensionName]);
76638
+ extensions[PerMessageDeflate22.extensionName] = perMessageDeflate;
76272
76639
  }
76273
76640
  } catch (err) {
76274
76641
  const message = "Invalid or unacceptable Sec-WebSocket-Extensions header";
@@ -76339,10 +76706,10 @@ var init_simple_client_node = __esm({
76339
76706
  ws._protocol = protocol;
76340
76707
  }
76341
76708
  }
76342
- if (extensions[PerMessageDeflate3.extensionName]) {
76343
- const params = extensions[PerMessageDeflate3.extensionName].params;
76344
- const value = extension3.format({
76345
- [PerMessageDeflate3.extensionName]: [params]
76709
+ if (extensions[PerMessageDeflate22.extensionName]) {
76710
+ const params = extensions[PerMessageDeflate22.extensionName].params;
76711
+ const value = extension22.format({
76712
+ [PerMessageDeflate22.extensionName]: [params]
76346
76713
  });
76347
76714
  headers.push(`Sec-WebSocket-Extensions: ${value}`);
76348
76715
  ws._extensions = extensions;
@@ -76352,6 +76719,8 @@ var init_simple_client_node = __esm({
76352
76719
  socket.removeListener("error", socketOnError);
76353
76720
  ws.setSocket(socket, head, {
76354
76721
  allowSynchronousEvents: this.options.allowSynchronousEvents,
76722
+ maxBufferedChunks: this.options.maxBufferedChunks,
76723
+ maxFragments: this.options.maxFragments,
76355
76724
  maxPayload: this.options.maxPayload,
76356
76725
  skipUTF8Validation: this.options.skipUTF8Validation
76357
76726
  });
@@ -76397,20 +76766,23 @@ var init_simple_client_node = __esm({
76397
76766
  ` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message
76398
76767
  );
76399
76768
  }
76400
- function abortHandshakeOrEmitwsClientError(server, req, socket, code2, message) {
76769
+ function abortHandshakeOrEmitwsClientError(server, req, socket, code2, message, headers) {
76401
76770
  if (server.listenerCount("wsClientError")) {
76402
76771
  const err = new Error(message);
76403
76772
  Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
76404
76773
  server.emit("wsClientError", err, socket, req);
76405
76774
  } else {
76406
- abortHandshake(socket, code2, message);
76775
+ abortHandshake(socket, code2, message, headers);
76407
76776
  }
76408
76777
  }
76409
76778
  }
76410
76779
  });
76411
76780
  import_stream2 = __toESM3(require_stream2(), 1);
76781
+ import_extension2 = __toESM3(require_extension2(), 1);
76782
+ import_permessage_deflate2 = __toESM3(require_permessage_deflate2(), 1);
76412
76783
  import_receiver2 = __toESM3(require_receiver2(), 1);
76413
76784
  import_sender2 = __toESM3(require_sender2(), 1);
76785
+ import_subprotocol2 = __toESM3(require_subprotocol2(), 1);
76414
76786
  import_websocket2 = __toESM3(require_websocket2(), 1);
76415
76787
  import_websocket_server2 = __toESM3(require_websocket_server2(), 1);
76416
76788
  wrapper_default2 = import_websocket2.default;
@@ -76419,6 +76791,25 @@ var init_simple_client_node = __esm({
76419
76791
  }
76420
76792
  });
76421
76793
 
76794
+ // ../../node_modules/convex/dist/esm/browser/http_client.js
76795
+ var init_http_client = __esm({
76796
+ "../../node_modules/convex/dist/esm/browser/http_client.js"() {
76797
+ "use strict";
76798
+ init_api4();
76799
+ init_common2();
76800
+ init_esm6();
76801
+ init_values();
76802
+ init_logging();
76803
+ }
76804
+ });
76805
+
76806
+ // ../../node_modules/convex/dist/esm/browser/query_options.js
76807
+ var init_query_options = __esm({
76808
+ "../../node_modules/convex/dist/esm/browser/query_options.js"() {
76809
+ "use strict";
76810
+ }
76811
+ });
76812
+
76422
76813
  // ../../node_modules/convex/dist/esm/browser/index-node.js
76423
76814
  var init_index_node2 = __esm({
76424
76815
  "../../node_modules/convex/dist/esm/browser/index-node.js"() {
@@ -76426,6 +76817,7 @@ var init_index_node2 = __esm({
76426
76817
  init_client3();
76427
76818
  init_simple_client_node();
76428
76819
  init_http_client();
76820
+ init_query_options();
76429
76821
  }
76430
76822
  });
76431
76823
 
@@ -76445,6 +76837,13 @@ var init_syscall = __esm({
76445
76837
  }
76446
76838
  });
76447
76839
 
76840
+ // ../../node_modules/convex/dist/esm/server/impl/validate.js
76841
+ var init_validate = __esm({
76842
+ "../../node_modules/convex/dist/esm/server/impl/validate.js"() {
76843
+ "use strict";
76844
+ }
76845
+ });
76846
+
76448
76847
  // ../../node_modules/convex/dist/esm/server/impl/actions_impl.js
76449
76848
  var init_actions_impl = __esm({
76450
76849
  "../../node_modules/convex/dist/esm/server/impl/actions_impl.js"() {
@@ -76454,6 +76853,7 @@ var init_actions_impl = __esm({
76454
76853
  init_syscall();
76455
76854
  init_common2();
76456
76855
  init_paths2();
76856
+ init_validate();
76457
76857
  }
76458
76858
  });
76459
76859
 
@@ -76464,13 +76864,6 @@ var init_vector_search = __esm({
76464
76864
  }
76465
76865
  });
76466
76866
 
76467
- // ../../node_modules/convex/dist/esm/server/impl/validate.js
76468
- var init_validate = __esm({
76469
- "../../node_modules/convex/dist/esm/server/impl/validate.js"() {
76470
- "use strict";
76471
- }
76472
- });
76473
-
76474
76867
  // ../../node_modules/convex/dist/esm/server/impl/vector_search_impl.js
76475
76868
  var init_vector_search_impl = __esm({
76476
76869
  "../../node_modules/convex/dist/esm/server/impl/vector_search_impl.js"() {
@@ -76487,6 +76880,7 @@ var init_vector_search_impl = __esm({
76487
76880
  var init_authentication_impl = __esm({
76488
76881
  "../../node_modules/convex/dist/esm/server/impl/authentication_impl.js"() {
76489
76882
  "use strict";
76883
+ init_esm6();
76490
76884
  init_syscall();
76491
76885
  }
76492
76886
  });
@@ -76585,11 +76979,21 @@ var init_storage_impl = __esm({
76585
76979
  "../../node_modules/convex/dist/esm/server/impl/storage_impl.js"() {
76586
76980
  "use strict";
76587
76981
  init_esm6();
76982
+ init_base64();
76588
76983
  init_syscall();
76589
76984
  init_validate();
76590
76985
  }
76591
76986
  });
76592
76987
 
76988
+ // ../../node_modules/convex/dist/esm/server/impl/meta_impl.js
76989
+ var init_meta_impl = __esm({
76990
+ "../../node_modules/convex/dist/esm/server/impl/meta_impl.js"() {
76991
+ "use strict";
76992
+ init_values();
76993
+ init_syscall();
76994
+ }
76995
+ });
76996
+
76593
76997
  // ../../node_modules/convex/dist/esm/server/impl/registration_impl.js
76594
76998
  var init_registration_impl = __esm({
76595
76999
  "../../node_modules/convex/dist/esm/server/impl/registration_impl.js"() {
@@ -76606,6 +77010,7 @@ var init_registration_impl = __esm({
76606
77010
  init_syscall();
76607
77011
  init_validator();
76608
77012
  init_paths2();
77013
+ init_meta_impl();
76609
77014
  }
76610
77015
  });
76611
77016
 
@@ -76640,6 +77045,7 @@ var init_cron = __esm({
76640
77045
  init_api4();
76641
77046
  init_common2();
76642
77047
  init_values();
77048
+ init_paths2();
76643
77049
  }
76644
77050
  });
76645
77051
 
@@ -76655,14 +77061,53 @@ var init_router = __esm({
76655
77061
  var init_components = __esm({
76656
77062
  "../../node_modules/convex/dist/esm/server/components/index.js"() {
76657
77063
  "use strict";
76658
- init_values();
76659
77064
  init_esm6();
76660
77065
  init_syscall();
76661
77066
  init_paths2();
77067
+ init_validator();
76662
77068
  init_paths2();
76663
77069
  }
76664
77070
  });
76665
77071
 
77072
+ // ../../node_modules/convex/dist/esm/server/logVars.js
77073
+ var REQUEST_ID, IP, USER_AGENT, NOW, CONVEX_ACTOR, varNames;
77074
+ var init_logVars = __esm({
77075
+ "../../node_modules/convex/dist/esm/server/logVars.js"() {
77076
+ "use strict";
77077
+ REQUEST_ID = /* @__PURE__ */ Symbol("var.requestId");
77078
+ IP = /* @__PURE__ */ Symbol("var.ip");
77079
+ USER_AGENT = /* @__PURE__ */ Symbol("var.userAgent");
77080
+ NOW = /* @__PURE__ */ Symbol("var.now");
77081
+ CONVEX_ACTOR = /* @__PURE__ */ Symbol("var.convexActor");
77082
+ varNames = {
77083
+ [REQUEST_ID]: "requestId",
77084
+ [IP]: "ip",
77085
+ [USER_AGENT]: "userAgent",
77086
+ [NOW]: "now",
77087
+ [CONVEX_ACTOR]: "convexActor"
77088
+ };
77089
+ }
77090
+ });
77091
+
77092
+ // ../../node_modules/convex/dist/esm/server/audit_logging.js
77093
+ var init_audit_logging = __esm({
77094
+ "../../node_modules/convex/dist/esm/server/audit_logging.js"() {
77095
+ "use strict";
77096
+ init_esm6();
77097
+ init_syscall();
77098
+ init_logVars();
77099
+ }
77100
+ });
77101
+
77102
+ // ../../node_modules/convex/dist/esm/server/log.js
77103
+ var init_log = __esm({
77104
+ "../../node_modules/convex/dist/esm/server/log.js"() {
77105
+ "use strict";
77106
+ init_audit_logging();
77107
+ init_logVars();
77108
+ }
77109
+ });
77110
+
76666
77111
  // ../../node_modules/convex/dist/esm/server/schema.js
76667
77112
  function defineTable(documentSchema) {
76668
77113
  if (isValidator(documentSchema)) {
@@ -76671,6 +77116,42 @@ function defineTable(documentSchema) {
76671
77116
  return new TableDefinition(v.object(documentSchema));
76672
77117
  }
76673
77118
  }
77119
+ function addSystemFields(tableName, validator) {
77120
+ switch (validator.kind) {
77121
+ case "object":
77122
+ return validator.extend({
77123
+ _id: v.id(tableName),
77124
+ _creationTime: v.number()
77125
+ });
77126
+ case "union":
77127
+ return v.union(
77128
+ ...validator.members.map(
77129
+ (member) => addSystemFields(tableName, member)
77130
+ )
77131
+ );
77132
+ // `v.any()` already permits the system fields.
77133
+ case "any":
77134
+ return validator;
77135
+ default:
77136
+ throw new Error(
77137
+ `Invalid validator for table "${tableName}": a table's documents must be objects, or a union of objects (see https://docs.convex.dev/database/schemas)`
77138
+ );
77139
+ }
77140
+ }
77141
+ function docValidator(tableName, table) {
77142
+ return addSystemFields(tableName, table.validator);
77143
+ }
77144
+ function tableInSchema(schema, tableName) {
77145
+ const table = schema.tables[tableName];
77146
+ if (table === void 0) {
77147
+ throw new Error(
77148
+ `Table "${tableName}" is not in this schema. Tables in this schema: ${Object.keys(
77149
+ schema.tables
77150
+ ).join(", ")}`
77151
+ );
77152
+ }
77153
+ return table;
77154
+ }
76674
77155
  function defineSchema(schema, options) {
76675
77156
  return new SchemaDefinition(schema, options);
76676
77157
  }
@@ -76694,6 +77175,7 @@ var init_schema = __esm({
76694
77175
  __publicField14(this, "vectorIndexes");
76695
77176
  __publicField14(this, "stagedVectorIndexes");
76696
77177
  __publicField14(this, "validator");
77178
+ __publicField14(this, "stagedValidator");
76697
77179
  this.indexes = [];
76698
77180
  this.stagedDbIndexes = [];
76699
77181
  this.searchIndexes = [];
@@ -76707,8 +77189,6 @@ var init_schema = __esm({
76707
77189
  *
76708
77190
  * Returns indexes defined on this table.
76709
77191
  * Intended for the advanced use cases of dynamically deciding which index to use for a query.
76710
- * If you think you need this, please chime in on ths issue in the Convex JS GitHub repo.
76711
- * https://github.com/get-convex/convex-js/issues/49
76712
77192
  */
76713
77193
  " indexes"() {
76714
77194
  return this.indexes;
@@ -76766,6 +77246,60 @@ var init_schema = __esm({
76766
77246
  }
76767
77247
  return this;
76768
77248
  }
77249
+ /**
77250
+ * Stage changes to this table's document validator.
77251
+ *
77252
+ * Convex validates the staged validator against the table's existing
77253
+ * documents in the background, while the validator passed to
77254
+ * {@link defineTable} remains the one enforced on writes. Once
77255
+ * the background validation succeeds, apply the staged changes
77256
+ * and remove `.staged()`.
77257
+ *
77258
+ * For an object validator, pass only the fields to add or replace. Fields
77259
+ * omitted from the changes keep their enforced validators.
77260
+ * Set a field to `undefined` to remove it from the staged validator.
77261
+ * For nested objects, you must specify the full object validator.
77262
+ *
77263
+ * ```ts
77264
+ * defineTable({
77265
+ * apple: v.string(),
77266
+ * banana: v.number(),
77267
+ * legacy: v.optional(v.string()),
77268
+ * }).staged({
77269
+ * banana: v.union(v.string(), v.number()),
77270
+ * legacy: undefined,
77271
+ * })
77272
+ * ```
77273
+ *
77274
+ * See [Staged validators](https://docs.convex.dev/database/schemas#staged-validators).
77275
+ *
77276
+ * @param documentSchema - Field changes for a table defined as an object or
77277
+ * `v.any()`, or a full schema validator specifying the proposed next document
77278
+ * type. Use a full schema validator for a table defined as a union.
77279
+ * @returns A {@link TableDefinition} with the staged validator attached.
77280
+ */
77281
+ staged(documentSchema) {
77282
+ if (this.stagedValidator !== void 0) {
77283
+ throw new Error("Table cannot have more than one staged validator.");
77284
+ }
77285
+ if (isValidator(documentSchema)) {
77286
+ this.stagedValidator = documentSchema;
77287
+ } else {
77288
+ if (this.validator.kind !== "object" && this.validator.kind !== "any") {
77289
+ throw new Error(
77290
+ "Specifying top-level field changes is only supported for simple table definitions. For a table defined with a union or record validator, you must stage a fully defined object or union validator."
77291
+ );
77292
+ }
77293
+ const enforcedFields = this.validator.kind === "object" ? this.validator.fields : {};
77294
+ const fields = Object.fromEntries(
77295
+ Object.entries({ ...enforcedFields, ...documentSchema }).filter(
77296
+ (entry) => entry[1] !== void 0
77297
+ )
77298
+ );
77299
+ this.stagedValidator = v.object(fields);
77300
+ }
77301
+ return this.self();
77302
+ }
76769
77303
  /**
76770
77304
  * Work around for https://github.com/microsoft/TypeScript/issues/57035
76771
77305
  */
@@ -76785,6 +77319,15 @@ var init_schema = __esm({
76785
77319
  "Invalid validator: please make sure that the parameter of `defineTable` is valid (see https://docs.convex.dev/database/schemas)"
76786
77320
  );
76787
77321
  }
77322
+ let stagedDocumentType = void 0;
77323
+ if (this.stagedValidator !== void 0) {
77324
+ stagedDocumentType = this.stagedValidator.json;
77325
+ if (typeof stagedDocumentType !== "object") {
77326
+ throw new Error(
77327
+ "Invalid staged validator: please make sure that the parameter of `.staged()` is valid (see https://docs.convex.dev/database/schemas)"
77328
+ );
77329
+ }
77330
+ }
76788
77331
  return {
76789
77332
  indexes: this.indexes,
76790
77333
  stagedDbIndexes: this.stagedDbIndexes,
@@ -76792,7 +77335,8 @@ var init_schema = __esm({
76792
77335
  stagedSearchIndexes: this.stagedSearchIndexes,
76793
77336
  vectorIndexes: this.vectorIndexes,
76794
77337
  stagedVectorIndexes: this.stagedVectorIndexes,
76795
- documentType
77338
+ documentType,
77339
+ stagedDocumentType
76796
77340
  };
76797
77341
  }
76798
77342
  };
@@ -76807,6 +77351,37 @@ var init_schema = __esm({
76807
77351
  this.tables = tables;
76808
77352
  this.schemaValidation = options?.schemaValidation === void 0 ? true : options.schemaValidation;
76809
77353
  }
77354
+ /**
77355
+ * The validator for whole documents of a table in this schema: the table's
77356
+ * own validator with the `_id` and `_creationTime` system fields added.
77357
+ *
77358
+ * @example
77359
+ * ```ts
77360
+ * export const get = query({
77361
+ * args: { id: schema.id("messages") },
77362
+ * returns: v.union(schema.doc("messages"), v.null()),
77363
+ * handler: (ctx, args) => ctx.db.get(args.id),
77364
+ * });
77365
+ * ```
77366
+ *
77367
+ * @param tableName - The name of a table in this schema.
77368
+ * @returns A validator matching documents of that table.
77369
+ */
77370
+ doc(tableName) {
77371
+ return docValidator(tableName, tableInSchema(this, tableName));
77372
+ }
77373
+ /**
77374
+ * The validator for IDs of a table in this schema.
77375
+ *
77376
+ * Same as `v.id(tableName)`, but only accepts tables in this schema.
77377
+ *
77378
+ * @param tableName - The name of a table in this schema.
77379
+ * @returns A validator matching IDs of that table.
77380
+ */
77381
+ id(tableName) {
77382
+ tableInSchema(this, tableName);
77383
+ return v.id(tableName);
77384
+ }
76810
77385
  /**
76811
77386
  * Export the contents of this definition.
76812
77387
  *
@@ -76823,7 +77398,8 @@ var init_schema = __esm({
76823
77398
  stagedSearchIndexes,
76824
77399
  vectorIndexes,
76825
77400
  stagedVectorIndexes,
76826
- documentType
77401
+ documentType,
77402
+ stagedDocumentType
76827
77403
  } = definition.export();
76828
77404
  return {
76829
77405
  tableName,
@@ -76833,7 +77409,8 @@ var init_schema = __esm({
76833
77409
  stagedSearchIndexes,
76834
77410
  vectorIndexes,
76835
77411
  stagedVectorIndexes,
76836
- documentType
77412
+ documentType,
77413
+ stagedDocumentType
76837
77414
  };
76838
77415
  }),
76839
77416
  schemaValidation: this.schemaValidation
@@ -76869,6 +77446,7 @@ var init_server = __esm({
76869
77446
  "use strict";
76870
77447
  init_database();
76871
77448
  init_registration_impl();
77449
+ init_actions_impl();
76872
77450
  init_pagination2();
76873
77451
  init_search_filter_builder();
76874
77452
  init_storage();
@@ -76878,6 +77456,7 @@ var init_server = __esm({
76878
77456
  init_components();
76879
77457
  init_components();
76880
77458
  init_components();
77459
+ init_log();
76881
77460
  init_schema();
76882
77461
  }
76883
77462
  });
@@ -80562,15 +81141,15 @@ var require_websocket_server3 = __commonJS({
80562
81141
  });
80563
81142
 
80564
81143
  // ../../node_modules/ws/wrapper.mjs
80565
- var import_stream3, import_extension2, import_permessage_deflate2, import_receiver3, import_sender3, import_subprotocol2, import_websocket3, import_websocket_server3, wrapper_default3;
81144
+ var import_stream3, import_extension3, import_permessage_deflate3, import_receiver3, import_sender3, import_subprotocol3, import_websocket3, import_websocket_server3, wrapper_default3;
80566
81145
  var init_wrapper2 = __esm({
80567
81146
  "../../node_modules/ws/wrapper.mjs"() {
80568
81147
  import_stream3 = __toESM(require_stream3(), 1);
80569
- import_extension2 = __toESM(require_extension3(), 1);
80570
- import_permessage_deflate2 = __toESM(require_permessage_deflate3(), 1);
81148
+ import_extension3 = __toESM(require_extension3(), 1);
81149
+ import_permessage_deflate3 = __toESM(require_permessage_deflate3(), 1);
80571
81150
  import_receiver3 = __toESM(require_receiver3(), 1);
80572
81151
  import_sender3 = __toESM(require_sender3(), 1);
80573
- import_subprotocol2 = __toESM(require_subprotocol3(), 1);
81152
+ import_subprotocol3 = __toESM(require_subprotocol3(), 1);
80574
81153
  import_websocket3 = __toESM(require_websocket3(), 1);
80575
81154
  import_websocket_server3 = __toESM(require_websocket_server3(), 1);
80576
81155
  wrapper_default3 = import_websocket3.default;
@@ -84340,4 +84919,4 @@ smol-toml/dist/index.js:
84340
84919
  *)
84341
84920
  */
84342
84921
 
84343
- //# debugId=49e43ad2-daea-5188-8687-f5d818219194
84922
+ //# debugId=f5bd4e15-77b6-5881-a922-54cf15b6400e