@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/agent-init-guides/flow.md +7 -6
- package/dist/agent-init-guides/git-signing.md +1 -1
- package/dist/agent-init-guides/recovery.md +1 -1
- package/dist/agent-init-guides/running.md +6 -4
- package/dist/bin/dvb.mjs +1548 -915
- package/dist/bin/dvbd.mjs +926 -347
- package/dist/product-docs/references/billing-and-limits.md +5 -4
- package/dist/product-docs/references/desktop-workbench.md +38 -13
- package/dist/product-docs/references/files-git-and-review.md +17 -6
- package/dist/product-docs/references/fork-workflows.md +9 -0
- package/dist/product-docs/references/onbox-agent-tools.md +121 -10
- package/dist/product-docs/references/slack.md +11 -8
- package/dist/product-docs/references/team-template.md +9 -1
- package/dist/product-docs/references/threads-and-agents.md +103 -6
- package/dist/product-docs/references/troubleshooting.md +3 -3
- package/package.json +3 -3
package/dist/bin/dvb.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]="
|
|
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]="d1495133-92a8-5a9b-ad94-6837cfa5aec7")}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";
|
|
@@ -6177,8 +6177,8 @@ var BOXES_LOGO_LIGHT_BG_SVG, BOXES_LOGO_DARK_BG_SVG;
|
|
|
6177
6177
|
var init_boxesLogoSvg = __esm({
|
|
6178
6178
|
"../../../../shared/devboxCore/dist/boxesLogoSvg.js"() {
|
|
6179
6179
|
"use strict";
|
|
6180
|
-
BOXES_LOGO_LIGHT_BG_SVG = '<svg class="logo-light-bg"
|
|
6181
|
-
BOXES_LOGO_DARK_BG_SVG = '
|
|
6180
|
+
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>';
|
|
6181
|
+
BOXES_LOGO_DARK_BG_SVG = BOXES_LOGO_LIGHT_BG_SVG.replace('class="logo-light-bg"', 'class="logo-dark-bg"');
|
|
6182
6182
|
}
|
|
6183
6183
|
});
|
|
6184
6184
|
|
|
@@ -22756,10 +22756,10 @@ var init_ajvProvider_97rDpkRx = __esm({
|
|
|
22756
22756
|
Ajv2.ValidationError = validation_error_1.default;
|
|
22757
22757
|
Ajv2.MissingRefError = ref_error_1.default;
|
|
22758
22758
|
exports.default = Ajv2;
|
|
22759
|
-
function checkOptions(checkOpts, options, msg,
|
|
22759
|
+
function checkOptions(checkOpts, options, msg, log4 = "error") {
|
|
22760
22760
|
for (const key in checkOpts) {
|
|
22761
22761
|
const opt = key;
|
|
22762
|
-
if (opt in options) this.logger[
|
|
22762
|
+
if (opt in options) this.logger[log4](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
22763
22763
|
}
|
|
22764
22764
|
}
|
|
22765
22765
|
function getSchEnv(keyRef) {
|
|
@@ -27127,7 +27127,7 @@ var init_companion = __esm({
|
|
|
27127
27127
|
const profile = resolveMcpOAuthProfile(options.agent);
|
|
27128
27128
|
const fetchFn = options.fetchFn ?? fetch;
|
|
27129
27129
|
const serverOrigin = new URL(serverUrl).origin;
|
|
27130
|
-
const
|
|
27130
|
+
const log4 = (event) => options.log?.(event);
|
|
27131
27131
|
const baseEvent = {
|
|
27132
27132
|
agent: options.agent,
|
|
27133
27133
|
profileVersion: profile.profileVersion,
|
|
@@ -27146,7 +27146,7 @@ var init_companion = __esm({
|
|
|
27146
27146
|
signal: options.signal,
|
|
27147
27147
|
timeoutMs: options.timeoutMs ?? DEFAULT_CALLBACK_TIMEOUT_MS
|
|
27148
27148
|
});
|
|
27149
|
-
|
|
27149
|
+
log4({
|
|
27150
27150
|
...baseEvent,
|
|
27151
27151
|
event: "callback_listening",
|
|
27152
27152
|
errorCode: null
|
|
@@ -27162,13 +27162,13 @@ var init_companion = __esm({
|
|
|
27162
27162
|
}, sdkAuth);
|
|
27163
27163
|
throwIfCanceled(options.signal);
|
|
27164
27164
|
await options.openAuthorizationUrl(prepared.authorizationUrl);
|
|
27165
|
-
|
|
27165
|
+
log4({
|
|
27166
27166
|
...baseEvent,
|
|
27167
27167
|
event: "authorization_opened",
|
|
27168
27168
|
errorCode: null
|
|
27169
27169
|
});
|
|
27170
27170
|
const callback = await callbackListener.waitForCallback;
|
|
27171
|
-
|
|
27171
|
+
log4({
|
|
27172
27172
|
...baseEvent,
|
|
27173
27173
|
event: "callback_received",
|
|
27174
27174
|
errorCode: null
|
|
@@ -27186,7 +27186,7 @@ var init_companion = __esm({
|
|
|
27186
27186
|
} catch {
|
|
27187
27187
|
throw new McpOAuthCompanionError("upload_failed", "boxes.dev could not save the completed MCP authorization.");
|
|
27188
27188
|
}
|
|
27189
|
-
|
|
27189
|
+
log4({
|
|
27190
27190
|
...baseEvent,
|
|
27191
27191
|
event: "grant_uploaded",
|
|
27192
27192
|
errorCode: null
|
|
@@ -27201,7 +27201,7 @@ var init_companion = __esm({
|
|
|
27201
27201
|
};
|
|
27202
27202
|
} catch (error55) {
|
|
27203
27203
|
const safeError = toSafeMcpOAuthError(error55);
|
|
27204
|
-
|
|
27204
|
+
log4({
|
|
27205
27205
|
...baseEvent,
|
|
27206
27206
|
event: safeError.code === "canceled" ? "authorization_canceled" : "authorization_failed",
|
|
27207
27207
|
errorCode: safeError.code
|
|
@@ -29960,7 +29960,7 @@ var init_logger = __esm({
|
|
|
29960
29960
|
shouldLog = (minLevel, level) => levelOrder[level] >= levelOrder[minLevel];
|
|
29961
29961
|
createLogger = (component) => {
|
|
29962
29962
|
const minLevel = normalizeLevel(process.env.DEVBOX_LOG_LEVEL);
|
|
29963
|
-
const
|
|
29963
|
+
const log4 = (level, message, fields) => {
|
|
29964
29964
|
if (!shouldLog(minLevel, level))
|
|
29965
29965
|
return;
|
|
29966
29966
|
const payload = {
|
|
@@ -29973,10 +29973,10 @@ var init_logger = __esm({
|
|
|
29973
29973
|
console.error(JSON.stringify(payload));
|
|
29974
29974
|
};
|
|
29975
29975
|
return {
|
|
29976
|
-
debug: (message, fields) =>
|
|
29977
|
-
info: (message, fields) =>
|
|
29978
|
-
warn: (message, fields) =>
|
|
29979
|
-
error: (message, fields) =>
|
|
29976
|
+
debug: (message, fields) => log4("debug", message, fields),
|
|
29977
|
+
info: (message, fields) => log4("info", message, fields),
|
|
29978
|
+
warn: (message, fields) => log4("warn", message, fields),
|
|
29979
|
+
error: (message, fields) => log4("error", message, fields)
|
|
29980
29980
|
};
|
|
29981
29981
|
};
|
|
29982
29982
|
}
|
|
@@ -35504,13 +35504,13 @@ function _INTERNAL_captureLog(beforeLog, currentScope = getCurrentScope(), captu
|
|
|
35504
35504
|
setLogAttribute(processedLogAttributes, "sentry.trace.parent_span_id", span?.spanContext().spanId);
|
|
35505
35505
|
const processedLog = { ...beforeLog, attributes: processedLogAttributes };
|
|
35506
35506
|
client.emit("beforeCaptureLog", processedLog);
|
|
35507
|
-
const
|
|
35508
|
-
if (!
|
|
35507
|
+
const log4 = beforeSendLog ? consoleSandbox(() => beforeSendLog(processedLog)) : processedLog;
|
|
35508
|
+
if (!log4) {
|
|
35509
35509
|
client.recordDroppedEvent("before_send", "log_item", 1);
|
|
35510
35510
|
DEBUG_BUILD && debug.warn("beforeSendLog returned null, log will not be captured.");
|
|
35511
35511
|
return;
|
|
35512
35512
|
}
|
|
35513
|
-
const { level, message, attributes: logAttributes = {}, severityNumber } =
|
|
35513
|
+
const { level, message, attributes: logAttributes = {}, severityNumber } = log4;
|
|
35514
35514
|
const timestamp2 = timestampInSeconds();
|
|
35515
35515
|
const sequenceAttr = getSequenceAttribute(timestamp2);
|
|
35516
35516
|
const serializedLog = {
|
|
@@ -35526,7 +35526,7 @@ function _INTERNAL_captureLog(beforeLog, currentScope = getCurrentScope(), captu
|
|
|
35526
35526
|
})
|
|
35527
35527
|
};
|
|
35528
35528
|
captureSerializedLog(client, serializedLog);
|
|
35529
|
-
client.emit("afterCaptureLog",
|
|
35529
|
+
client.emit("afterCaptureLog", log4);
|
|
35530
35530
|
}
|
|
35531
35531
|
function _INTERNAL_flushLogsBuffer(client, maybeLogBuffer) {
|
|
35532
35532
|
const logBuffer = maybeLogBuffer ?? _INTERNAL_getLogBuffer(client) ?? [];
|
|
@@ -36291,12 +36291,12 @@ function estimateMetricSizeInBytes(metric) {
|
|
|
36291
36291
|
weight += 8;
|
|
36292
36292
|
return weight + estimateAttributesSizeInBytes(metric.attributes);
|
|
36293
36293
|
}
|
|
36294
|
-
function estimateLogSizeInBytes(
|
|
36294
|
+
function estimateLogSizeInBytes(log4) {
|
|
36295
36295
|
let weight = 0;
|
|
36296
|
-
if (
|
|
36297
|
-
weight +=
|
|
36296
|
+
if (log4.message) {
|
|
36297
|
+
weight += log4.message.length * 2;
|
|
36298
36298
|
}
|
|
36299
|
-
return weight + estimateAttributesSizeInBytes(
|
|
36299
|
+
return weight + estimateAttributesSizeInBytes(log4.attributes);
|
|
36300
36300
|
}
|
|
36301
36301
|
function estimateAttributesSizeInBytes(attributes) {
|
|
36302
36302
|
if (!attributes) {
|
|
@@ -38173,13 +38173,13 @@ function instrumentConsole() {
|
|
|
38173
38173
|
originalConsoleMethods[level] = originalConsoleMethod;
|
|
38174
38174
|
return function(...args) {
|
|
38175
38175
|
const firstArg = args[0];
|
|
38176
|
-
const
|
|
38176
|
+
const log4 = originalConsoleMethods[level];
|
|
38177
38177
|
const isFiltered = _filter.size && typeof firstArg === "string" && stringMatchesSomePattern(firstArg, _filter);
|
|
38178
38178
|
if (!isFiltered) {
|
|
38179
38179
|
triggerHandlers("console", { args, level });
|
|
38180
38180
|
}
|
|
38181
38181
|
if (!isFiltered || DEBUG_BUILD && debug.isEnabled()) {
|
|
38182
|
-
|
|
38182
|
+
log4?.apply(GLOBAL_OBJ.console, args);
|
|
38183
38183
|
}
|
|
38184
38184
|
};
|
|
38185
38185
|
});
|
|
@@ -47256,7 +47256,7 @@ var require_node = __commonJS({
|
|
|
47256
47256
|
var tty3 = __require("tty");
|
|
47257
47257
|
var util2 = __require("util");
|
|
47258
47258
|
exports.init = init3;
|
|
47259
|
-
exports.log =
|
|
47259
|
+
exports.log = log4;
|
|
47260
47260
|
exports.formatArgs = formatArgs;
|
|
47261
47261
|
exports.save = save;
|
|
47262
47262
|
exports.load = load2;
|
|
@@ -47391,7 +47391,7 @@ var require_node = __commonJS({
|
|
|
47391
47391
|
}
|
|
47392
47392
|
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
47393
47393
|
}
|
|
47394
|
-
function
|
|
47394
|
+
function log4(...args) {
|
|
47395
47395
|
return process.stderr.write(util2.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
47396
47396
|
}
|
|
47397
47397
|
function save(namespaces) {
|
|
@@ -57414,12 +57414,12 @@ var init_local_variables_sync = __esm({
|
|
|
57414
57414
|
for (const prop of props) {
|
|
57415
57415
|
if (prop.value?.objectId && prop.value.className === "Array") {
|
|
57416
57416
|
const id2 = prop.value.objectId;
|
|
57417
|
-
add((
|
|
57417
|
+
add((vars2) => this._unrollArray(id2, prop.name, vars2, next));
|
|
57418
57418
|
} else if (prop.value?.objectId && prop.value.className === "Object") {
|
|
57419
57419
|
const id2 = prop.value.objectId;
|
|
57420
|
-
add((
|
|
57420
|
+
add((vars2) => this._unrollObject(id2, prop.name, vars2, next));
|
|
57421
57421
|
} else if (prop.value) {
|
|
57422
|
-
add((
|
|
57422
|
+
add((vars2) => this._unrollOther(prop, vars2, next));
|
|
57423
57423
|
}
|
|
57424
57424
|
}
|
|
57425
57425
|
next({});
|
|
@@ -57447,42 +57447,42 @@ var init_local_variables_sync = __esm({
|
|
|
57447
57447
|
/**
|
|
57448
57448
|
* Unrolls an array property
|
|
57449
57449
|
*/
|
|
57450
|
-
_unrollArray(objectId, name,
|
|
57450
|
+
_unrollArray(objectId, name, vars2, next) {
|
|
57451
57451
|
this._getProperties(objectId, (props) => {
|
|
57452
|
-
|
|
57453
|
-
next(
|
|
57452
|
+
vars2[name] = props.filter((v2) => v2.name !== "length" && !isNaN(parseInt(v2.name, 10))).sort((a2, b2) => parseInt(a2.name, 10) - parseInt(b2.name, 10)).map((v2) => v2.value?.value);
|
|
57453
|
+
next(vars2);
|
|
57454
57454
|
});
|
|
57455
57455
|
}
|
|
57456
57456
|
/**
|
|
57457
57457
|
* Unrolls an object property
|
|
57458
57458
|
*/
|
|
57459
|
-
_unrollObject(objectId, name,
|
|
57459
|
+
_unrollObject(objectId, name, vars2, next) {
|
|
57460
57460
|
this._getProperties(objectId, (props) => {
|
|
57461
|
-
|
|
57461
|
+
vars2[name] = props.map((v2) => [v2.name, v2.value?.value]).reduce((obj, [key, val]) => {
|
|
57462
57462
|
obj[key] = val;
|
|
57463
57463
|
return obj;
|
|
57464
57464
|
}, {});
|
|
57465
|
-
next(
|
|
57465
|
+
next(vars2);
|
|
57466
57466
|
});
|
|
57467
57467
|
}
|
|
57468
57468
|
/**
|
|
57469
57469
|
* Unrolls other properties
|
|
57470
57470
|
*/
|
|
57471
|
-
_unrollOther(prop,
|
|
57471
|
+
_unrollOther(prop, vars2, next) {
|
|
57472
57472
|
if (prop.value) {
|
|
57473
57473
|
if ("value" in prop.value) {
|
|
57474
57474
|
if (prop.value.value === void 0 || prop.value.value === null) {
|
|
57475
|
-
|
|
57475
|
+
vars2[prop.name] = `<${prop.value.value}>`;
|
|
57476
57476
|
} else {
|
|
57477
|
-
|
|
57477
|
+
vars2[prop.name] = prop.value.value;
|
|
57478
57478
|
}
|
|
57479
57479
|
} else if ("description" in prop.value && prop.value.type !== "function") {
|
|
57480
|
-
|
|
57480
|
+
vars2[prop.name] = `<${prop.value.description}>`;
|
|
57481
57481
|
} else if (prop.value.type === "undefined") {
|
|
57482
|
-
|
|
57482
|
+
vars2[prop.name] = "<undefined>";
|
|
57483
57483
|
}
|
|
57484
57484
|
}
|
|
57485
|
-
next(
|
|
57485
|
+
next(vars2);
|
|
57486
57486
|
}
|
|
57487
57487
|
};
|
|
57488
57488
|
INTEGRATION_NAME15 = "LocalVariables";
|
|
@@ -57569,8 +57569,8 @@ var init_local_variables_sync = __esm({
|
|
|
57569
57569
|
} else {
|
|
57570
57570
|
const id2 = localScope.object.objectId;
|
|
57571
57571
|
add(
|
|
57572
|
-
(frames) => session.getLocalVariables(id2, (
|
|
57573
|
-
frames[i2] = { function: fn, vars };
|
|
57572
|
+
(frames) => session.getLocalVariables(id2, (vars2) => {
|
|
57573
|
+
frames[i2] = { function: fn, vars: vars2 };
|
|
57574
57574
|
next(frames);
|
|
57575
57575
|
})
|
|
57576
57576
|
);
|
|
@@ -58768,9 +58768,9 @@ var init_client2 = __esm({
|
|
|
58768
58768
|
_INTERNAL_flushLogsBuffer(this);
|
|
58769
58769
|
};
|
|
58770
58770
|
if (serverName) {
|
|
58771
|
-
this.on("beforeCaptureLog", (
|
|
58772
|
-
|
|
58773
|
-
...
|
|
58771
|
+
this.on("beforeCaptureLog", (log4) => {
|
|
58772
|
+
log4.attributes = {
|
|
58773
|
+
...log4.attributes,
|
|
58774
58774
|
"server.address": serverName
|
|
58775
58775
|
};
|
|
58776
58776
|
});
|
|
@@ -70565,9 +70565,9 @@ var init_sentry = __esm({
|
|
|
70565
70565
|
uncaughtExceptionMonitorInstalled = false;
|
|
70566
70566
|
currentDevboxSentryUser = null;
|
|
70567
70567
|
readBuildMetadata = () => {
|
|
70568
|
-
const rawPackageVersion = "1.0.
|
|
70569
|
-
const rawGitSha = "
|
|
70570
|
-
const rawSentryRelease = "boxes-dev-dvb@1.0.
|
|
70568
|
+
const rawPackageVersion = "1.0.1117";
|
|
70569
|
+
const rawGitSha = "5bc562be7ab3ff9894b62798adcf85aa7c664978";
|
|
70570
|
+
const rawSentryRelease = "boxes-dev-dvb@1.0.1117+5bc562be7ab3ff9894b62798adcf85aa7c664978";
|
|
70571
70571
|
const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
|
|
70572
70572
|
const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
|
|
70573
70573
|
const sentryRelease = typeof rawSentryRelease === "string" ? rawSentryRelease : void 0;
|
|
@@ -75172,7 +75172,7 @@ var init_desktopInitContracts = __esm({
|
|
|
75172
75172
|
});
|
|
75173
75173
|
|
|
75174
75174
|
// ../../../../shared/devboxCore/dist/desktopObjectTransfers.js
|
|
75175
|
-
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;
|
|
75175
|
+
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;
|
|
75176
75176
|
var init_desktopObjectTransfers = __esm({
|
|
75177
75177
|
"../../../../shared/devboxCore/dist/desktopObjectTransfers.js"() {
|
|
75178
75178
|
"use strict";
|
|
@@ -75183,6 +75183,7 @@ var init_desktopObjectTransfers = __esm({
|
|
|
75183
75183
|
DESKTOP_OBJECT_TRANSFER_MULTIPART_PART_SIZE_BYTES = 64 * 1024 * 1024;
|
|
75184
75184
|
DESKTOP_OBJECT_TRANSFER_UPLOAD_URL_TTL_SECONDS = 15 * 60;
|
|
75185
75185
|
DESKTOP_OBJECT_TRANSFER_DOWNLOAD_URL_TTL_SECONDS = 15 * 60;
|
|
75186
|
+
DESKTOP_WORKSPACE_DOWNLOAD_UPLOAD_TIMEOUT_MS = DESKTOP_OBJECT_TRANSFER_UPLOAD_URL_TTL_SECONDS * 1e3 - 6e4;
|
|
75186
75187
|
}
|
|
75187
75188
|
});
|
|
75188
75189
|
|
|
@@ -76240,7 +76241,7 @@ var init_packageVersion = __esm({
|
|
|
76240
76241
|
return path18.join(process.cwd(), "dvb");
|
|
76241
76242
|
};
|
|
76242
76243
|
readEmbeddedPackageVersion = () => {
|
|
76243
|
-
const raw = "1.0.
|
|
76244
|
+
const raw = "1.0.1117";
|
|
76244
76245
|
return trimVersion(raw);
|
|
76245
76246
|
};
|
|
76246
76247
|
readNearestPackageMetadata = (basePath) => {
|
|
@@ -78161,6 +78162,12 @@ function jsonToConvex(value) {
|
|
|
78161
78162
|
}
|
|
78162
78163
|
return float;
|
|
78163
78164
|
}
|
|
78165
|
+
if (key === "$commitTs") {
|
|
78166
|
+
if (value.$commitTs !== null) {
|
|
78167
|
+
throw new Error(`Malformed $commitTs field on ${value}`);
|
|
78168
|
+
}
|
|
78169
|
+
return commitTsPlaceholder;
|
|
78170
|
+
}
|
|
78164
78171
|
if (key === "$set") {
|
|
78165
78172
|
throw new Error(
|
|
78166
78173
|
`Received a Set which is no longer supported as a Convex type.`
|
|
@@ -78184,6 +78191,12 @@ function stringifyValueForError(value) {
|
|
|
78184
78191
|
if (value2 === void 0) {
|
|
78185
78192
|
return "undefined";
|
|
78186
78193
|
}
|
|
78194
|
+
if (typeof value2 === "function") {
|
|
78195
|
+
return "[Function]";
|
|
78196
|
+
}
|
|
78197
|
+
if (typeof value2 === "symbol") {
|
|
78198
|
+
return String(value2);
|
|
78199
|
+
}
|
|
78187
78200
|
if (typeof value2 === "bigint") {
|
|
78188
78201
|
return `${value2.toString()}n`;
|
|
78189
78202
|
}
|
|
@@ -78238,6 +78251,9 @@ function convexToJsonInternal(value, originalValue, context34, includeTopLevelUn
|
|
|
78238
78251
|
if (value instanceof ArrayBuffer) {
|
|
78239
78252
|
return { $bytes: fromByteArray(new Uint8Array(value)) };
|
|
78240
78253
|
}
|
|
78254
|
+
if (value instanceof CommitTsPlaceholder) {
|
|
78255
|
+
return { $commitTs: null };
|
|
78256
|
+
}
|
|
78241
78257
|
if (Array.isArray(value)) {
|
|
78242
78258
|
return value.map(
|
|
78243
78259
|
(value2, i2) => convexToJsonInternal(value2, originalValue, context34 + `[${i2}]`, false)
|
|
@@ -78308,7 +78324,7 @@ function convexOrUndefinedToJsonInternal(value, originalValue, context34) {
|
|
|
78308
78324
|
function convexToJson(value) {
|
|
78309
78325
|
return convexToJsonInternal(value, value, "", false);
|
|
78310
78326
|
}
|
|
78311
|
-
var LITTLE_ENDIAN, MIN_INT64, MAX_INT64, ZERO, EIGHT, TWOFIFTYSIX, bigIntToBase64, base64ToBigInt, MAX_IDENTIFIER_LEN, MAX_VALUE_FOR_ERROR_LEN;
|
|
78327
|
+
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;
|
|
78312
78328
|
var init_value = __esm({
|
|
78313
78329
|
"../../node_modules/convex/dist/esm/values/value.js"() {
|
|
78314
78330
|
"use strict";
|
|
@@ -78320,6 +78336,25 @@ var init_value = __esm({
|
|
|
78320
78336
|
ZERO = BigInt("0");
|
|
78321
78337
|
EIGHT = BigInt("8");
|
|
78322
78338
|
TWOFIFTYSIX = BigInt("256");
|
|
78339
|
+
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.";
|
|
78340
|
+
CommitTsPlaceholder = class {
|
|
78341
|
+
[Symbol.toPrimitive](hint) {
|
|
78342
|
+
if (hint === "string") {
|
|
78343
|
+
return this.toString();
|
|
78344
|
+
}
|
|
78345
|
+
throw new Error(COMMIT_TS_UNRESOLVED);
|
|
78346
|
+
}
|
|
78347
|
+
valueOf() {
|
|
78348
|
+
throw new Error(COMMIT_TS_UNRESOLVED);
|
|
78349
|
+
}
|
|
78350
|
+
toJSON() {
|
|
78351
|
+
throw new Error(COMMIT_TS_UNRESOLVED);
|
|
78352
|
+
}
|
|
78353
|
+
toString() {
|
|
78354
|
+
return "[unresolved commit timestamp]";
|
|
78355
|
+
}
|
|
78356
|
+
};
|
|
78357
|
+
commitTsPlaceholder = new CommitTsPlaceholder();
|
|
78323
78358
|
bigIntToBase64 = DataView.prototype.setBigInt64 ? modernBigIntToBase64 : slowBigIntToBase64;
|
|
78324
78359
|
base64ToBigInt = DataView.prototype.getBigInt64 ? modernBase64ToBigInt : slowBase64ToBigInt;
|
|
78325
78360
|
MAX_IDENTIFIER_LEN = 1024;
|
|
@@ -78334,7 +78369,7 @@ function throwUndefinedValidatorError(context34, fieldName) {
|
|
|
78334
78369
|
`A validator is undefined${fieldInfo} in ${context34}. This is often caused by circular imports. See ${UNDEFINED_VALIDATOR_ERROR_URL} for details.`
|
|
78335
78370
|
);
|
|
78336
78371
|
}
|
|
78337
|
-
var __defProp3, __defNormalProp, __publicField, UNDEFINED_VALIDATOR_ERROR_URL, BaseValidator, VId, VFloat64, VInt64, VBoolean, VBytes, VString, VNull, VAny, VObject, VLiteral, VArray, VRecord, VUnion;
|
|
78372
|
+
var __defProp3, __defNormalProp, __publicField, UNDEFINED_VALIDATOR_ERROR_URL, BaseValidator, VId, VFloat64, VInt64, VCommitTs, VBoolean, VBytes, VString, VNull, VAny, VObject, VLiteral, VArray, VRecord, VUnion;
|
|
78338
78373
|
var init_validators = __esm({
|
|
78339
78374
|
"../../node_modules/convex/dist/esm/values/validators.js"() {
|
|
78340
78375
|
"use strict";
|
|
@@ -78373,13 +78408,17 @@ var init_validators = __esm({
|
|
|
78373
78408
|
get json() {
|
|
78374
78409
|
return { type: "id", tableName: this.tableName };
|
|
78375
78410
|
}
|
|
78376
|
-
/**
|
|
78377
|
-
|
|
78411
|
+
/** Allow this field to be validated as absent. */
|
|
78412
|
+
optional() {
|
|
78378
78413
|
return new _VId({
|
|
78379
78414
|
isOptional: "optional",
|
|
78380
78415
|
tableName: this.tableName
|
|
78381
78416
|
});
|
|
78382
78417
|
}
|
|
78418
|
+
/** @internal */
|
|
78419
|
+
asOptional() {
|
|
78420
|
+
return this.optional();
|
|
78421
|
+
}
|
|
78383
78422
|
};
|
|
78384
78423
|
VFloat64 = class _VFloat64 extends BaseValidator {
|
|
78385
78424
|
constructor() {
|
|
@@ -78390,12 +78429,16 @@ var init_validators = __esm({
|
|
|
78390
78429
|
get json() {
|
|
78391
78430
|
return { type: "number" };
|
|
78392
78431
|
}
|
|
78393
|
-
/**
|
|
78394
|
-
|
|
78432
|
+
/** Allow this field to be validated as absent. */
|
|
78433
|
+
optional() {
|
|
78395
78434
|
return new _VFloat64({
|
|
78396
78435
|
isOptional: "optional"
|
|
78397
78436
|
});
|
|
78398
78437
|
}
|
|
78438
|
+
/** @internal */
|
|
78439
|
+
asOptional() {
|
|
78440
|
+
return this.optional();
|
|
78441
|
+
}
|
|
78399
78442
|
};
|
|
78400
78443
|
VInt64 = class _VInt64 extends BaseValidator {
|
|
78401
78444
|
constructor() {
|
|
@@ -78406,26 +78449,54 @@ var init_validators = __esm({
|
|
|
78406
78449
|
get json() {
|
|
78407
78450
|
return { type: "bigint" };
|
|
78408
78451
|
}
|
|
78452
|
+
/** Allow this validated field to be absent. */
|
|
78453
|
+
optional() {
|
|
78454
|
+
return new _VInt64({ isOptional: "optional" });
|
|
78455
|
+
}
|
|
78409
78456
|
/** @internal */
|
|
78410
78457
|
asOptional() {
|
|
78411
|
-
return
|
|
78458
|
+
return this.optional();
|
|
78412
78459
|
}
|
|
78413
78460
|
};
|
|
78414
|
-
|
|
78461
|
+
VCommitTs = class _VCommitTs extends BaseValidator {
|
|
78415
78462
|
constructor() {
|
|
78416
78463
|
super(...arguments);
|
|
78417
|
-
__publicField(this, "kind", "
|
|
78464
|
+
__publicField(this, "kind", "commitTs");
|
|
78418
78465
|
}
|
|
78419
78466
|
/** @internal */
|
|
78420
78467
|
get json() {
|
|
78421
78468
|
return { type: this.kind };
|
|
78422
78469
|
}
|
|
78470
|
+
/** Allow this validated field to be absent. */
|
|
78471
|
+
optional() {
|
|
78472
|
+
return new _VCommitTs({
|
|
78473
|
+
isOptional: "optional"
|
|
78474
|
+
});
|
|
78475
|
+
}
|
|
78423
78476
|
/** @internal */
|
|
78424
78477
|
asOptional() {
|
|
78478
|
+
return this.optional();
|
|
78479
|
+
}
|
|
78480
|
+
};
|
|
78481
|
+
VBoolean = class _VBoolean extends BaseValidator {
|
|
78482
|
+
constructor() {
|
|
78483
|
+
super(...arguments);
|
|
78484
|
+
__publicField(this, "kind", "boolean");
|
|
78485
|
+
}
|
|
78486
|
+
/** @internal */
|
|
78487
|
+
get json() {
|
|
78488
|
+
return { type: this.kind };
|
|
78489
|
+
}
|
|
78490
|
+
/** Allow this validated field to be absent. */
|
|
78491
|
+
optional() {
|
|
78425
78492
|
return new _VBoolean({
|
|
78426
78493
|
isOptional: "optional"
|
|
78427
78494
|
});
|
|
78428
78495
|
}
|
|
78496
|
+
/** @internal */
|
|
78497
|
+
asOptional() {
|
|
78498
|
+
return this.optional();
|
|
78499
|
+
}
|
|
78429
78500
|
};
|
|
78430
78501
|
VBytes = class _VBytes extends BaseValidator {
|
|
78431
78502
|
constructor() {
|
|
@@ -78436,9 +78507,13 @@ var init_validators = __esm({
|
|
|
78436
78507
|
get json() {
|
|
78437
78508
|
return { type: this.kind };
|
|
78438
78509
|
}
|
|
78510
|
+
/** Allow this validated field to be absent. */
|
|
78511
|
+
optional() {
|
|
78512
|
+
return new _VBytes({ isOptional: "optional" });
|
|
78513
|
+
}
|
|
78439
78514
|
/** @internal */
|
|
78440
78515
|
asOptional() {
|
|
78441
|
-
return
|
|
78516
|
+
return this.optional();
|
|
78442
78517
|
}
|
|
78443
78518
|
};
|
|
78444
78519
|
VString = class _VString extends BaseValidator {
|
|
@@ -78450,12 +78525,16 @@ var init_validators = __esm({
|
|
|
78450
78525
|
get json() {
|
|
78451
78526
|
return { type: this.kind };
|
|
78452
78527
|
}
|
|
78453
|
-
/**
|
|
78454
|
-
|
|
78528
|
+
/** Allow this validated field to be absent. */
|
|
78529
|
+
optional() {
|
|
78455
78530
|
return new _VString({
|
|
78456
78531
|
isOptional: "optional"
|
|
78457
78532
|
});
|
|
78458
78533
|
}
|
|
78534
|
+
/** @internal */
|
|
78535
|
+
asOptional() {
|
|
78536
|
+
return this.optional();
|
|
78537
|
+
}
|
|
78459
78538
|
};
|
|
78460
78539
|
VNull = class _VNull extends BaseValidator {
|
|
78461
78540
|
constructor() {
|
|
@@ -78466,9 +78545,13 @@ var init_validators = __esm({
|
|
|
78466
78545
|
get json() {
|
|
78467
78546
|
return { type: this.kind };
|
|
78468
78547
|
}
|
|
78548
|
+
/** Allow this validated field to be absent. */
|
|
78549
|
+
optional() {
|
|
78550
|
+
return new _VNull({ isOptional: "optional" });
|
|
78551
|
+
}
|
|
78469
78552
|
/** @internal */
|
|
78470
78553
|
asOptional() {
|
|
78471
|
-
return
|
|
78554
|
+
return this.optional();
|
|
78472
78555
|
}
|
|
78473
78556
|
};
|
|
78474
78557
|
VAny = class _VAny extends BaseValidator {
|
|
@@ -78482,12 +78565,16 @@ var init_validators = __esm({
|
|
|
78482
78565
|
type: this.kind
|
|
78483
78566
|
};
|
|
78484
78567
|
}
|
|
78485
|
-
/**
|
|
78486
|
-
|
|
78568
|
+
/** Allow this validated field to be absent. */
|
|
78569
|
+
optional() {
|
|
78487
78570
|
return new _VAny({
|
|
78488
78571
|
isOptional: "optional"
|
|
78489
78572
|
});
|
|
78490
78573
|
}
|
|
78574
|
+
/** @internal */
|
|
78575
|
+
asOptional() {
|
|
78576
|
+
return this.optional();
|
|
78577
|
+
}
|
|
78491
78578
|
};
|
|
78492
78579
|
VObject = class _VObject extends BaseValidator {
|
|
78493
78580
|
/**
|
|
@@ -78525,13 +78612,17 @@ var init_validators = __esm({
|
|
|
78525
78612
|
)
|
|
78526
78613
|
};
|
|
78527
78614
|
}
|
|
78528
|
-
/**
|
|
78529
|
-
|
|
78615
|
+
/** Allow this validated field to be absent. */
|
|
78616
|
+
optional() {
|
|
78530
78617
|
return new _VObject({
|
|
78531
78618
|
isOptional: "optional",
|
|
78532
78619
|
fields: this.fields
|
|
78533
78620
|
});
|
|
78534
78621
|
}
|
|
78622
|
+
/** @internal */
|
|
78623
|
+
asOptional() {
|
|
78624
|
+
return this.optional();
|
|
78625
|
+
}
|
|
78535
78626
|
/**
|
|
78536
78627
|
* Create a new VObject with the specified fields omitted.
|
|
78537
78628
|
* @param fields The field names to omit from this VObject.
|
|
@@ -78604,13 +78695,17 @@ var init_validators = __esm({
|
|
|
78604
78695
|
value: convexToJson(this.value)
|
|
78605
78696
|
};
|
|
78606
78697
|
}
|
|
78607
|
-
/**
|
|
78608
|
-
|
|
78698
|
+
/** Allow this validated field to be absent. */
|
|
78699
|
+
optional() {
|
|
78609
78700
|
return new _VLiteral({
|
|
78610
78701
|
isOptional: "optional",
|
|
78611
78702
|
value: this.value
|
|
78612
78703
|
});
|
|
78613
78704
|
}
|
|
78705
|
+
/** @internal */
|
|
78706
|
+
asOptional() {
|
|
78707
|
+
return this.optional();
|
|
78708
|
+
}
|
|
78614
78709
|
};
|
|
78615
78710
|
VArray = class _VArray extends BaseValidator {
|
|
78616
78711
|
/**
|
|
@@ -78635,13 +78730,17 @@ var init_validators = __esm({
|
|
|
78635
78730
|
value: this.element.json
|
|
78636
78731
|
};
|
|
78637
78732
|
}
|
|
78638
|
-
/**
|
|
78639
|
-
|
|
78733
|
+
/** Allow this validated field to be absent. */
|
|
78734
|
+
optional() {
|
|
78640
78735
|
return new _VArray({
|
|
78641
78736
|
isOptional: "optional",
|
|
78642
78737
|
element: this.element
|
|
78643
78738
|
});
|
|
78644
78739
|
}
|
|
78740
|
+
/** @internal */
|
|
78741
|
+
asOptional() {
|
|
78742
|
+
return this.optional();
|
|
78743
|
+
}
|
|
78645
78744
|
};
|
|
78646
78745
|
VRecord = class _VRecord extends BaseValidator {
|
|
78647
78746
|
/**
|
|
@@ -78669,7 +78768,7 @@ var init_validators = __esm({
|
|
|
78669
78768
|
throw new Error("Record validator cannot have optional values");
|
|
78670
78769
|
}
|
|
78671
78770
|
if (!key.isConvexValidator || !value.isConvexValidator) {
|
|
78672
|
-
throw new Error("Key and value of v.record()
|
|
78771
|
+
throw new Error("Key and value of v.record() must be validators");
|
|
78673
78772
|
}
|
|
78674
78773
|
this.key = key;
|
|
78675
78774
|
this.value = value;
|
|
@@ -78686,14 +78785,18 @@ var init_validators = __esm({
|
|
|
78686
78785
|
}
|
|
78687
78786
|
};
|
|
78688
78787
|
}
|
|
78689
|
-
/**
|
|
78690
|
-
|
|
78788
|
+
/** Allow this validated field to be absent. */
|
|
78789
|
+
optional() {
|
|
78691
78790
|
return new _VRecord({
|
|
78692
78791
|
isOptional: "optional",
|
|
78693
78792
|
key: this.key,
|
|
78694
78793
|
value: this.value
|
|
78695
78794
|
});
|
|
78696
78795
|
}
|
|
78796
|
+
/** @internal */
|
|
78797
|
+
asOptional() {
|
|
78798
|
+
return this.optional();
|
|
78799
|
+
}
|
|
78697
78800
|
};
|
|
78698
78801
|
VUnion = class _VUnion extends BaseValidator {
|
|
78699
78802
|
/**
|
|
@@ -78720,20 +78823,24 @@ var init_validators = __esm({
|
|
|
78720
78823
|
value: this.members.map((v2) => v2.json)
|
|
78721
78824
|
};
|
|
78722
78825
|
}
|
|
78723
|
-
/**
|
|
78724
|
-
|
|
78826
|
+
/** Allow this validated field to be absent. */
|
|
78827
|
+
optional() {
|
|
78725
78828
|
return new _VUnion({
|
|
78726
78829
|
isOptional: "optional",
|
|
78727
78830
|
members: this.members
|
|
78728
78831
|
});
|
|
78729
78832
|
}
|
|
78833
|
+
/** @internal */
|
|
78834
|
+
asOptional() {
|
|
78835
|
+
return this.optional();
|
|
78836
|
+
}
|
|
78730
78837
|
};
|
|
78731
78838
|
}
|
|
78732
78839
|
});
|
|
78733
78840
|
|
|
78734
78841
|
// ../../node_modules/convex/dist/esm/values/validator.js
|
|
78735
78842
|
function isValidator(v2) {
|
|
78736
|
-
return
|
|
78843
|
+
return v2?.isConvexValidator === true;
|
|
78737
78844
|
}
|
|
78738
78845
|
var v;
|
|
78739
78846
|
var init_validator = __esm({
|
|
@@ -78742,7 +78849,16 @@ var init_validator = __esm({
|
|
|
78742
78849
|
init_validators();
|
|
78743
78850
|
v = {
|
|
78744
78851
|
/**
|
|
78745
|
-
* Validates that the value
|
|
78852
|
+
* Validates that the value is a document ID for the given table.
|
|
78853
|
+
*
|
|
78854
|
+
* IDs are strings at runtime but are typed as `Id<"tableName">` in
|
|
78855
|
+
* TypeScript for type safety.
|
|
78856
|
+
*
|
|
78857
|
+
* @example
|
|
78858
|
+
* ```typescript
|
|
78859
|
+
* args: { userId: v.id("users") }
|
|
78860
|
+
* ```
|
|
78861
|
+
*
|
|
78746
78862
|
* @param tableName The name of the table.
|
|
78747
78863
|
*/
|
|
78748
78864
|
id: (tableName) => {
|
|
@@ -78752,79 +78868,165 @@ var init_validator = __esm({
|
|
|
78752
78868
|
});
|
|
78753
78869
|
},
|
|
78754
78870
|
/**
|
|
78755
|
-
* Validates that the value is
|
|
78871
|
+
* Validates that the value is `null`.
|
|
78872
|
+
*
|
|
78873
|
+
* Use `returns: v.null()` for functions that don't return a meaningful value.
|
|
78874
|
+
* JavaScript `undefined` is not a valid Convex value, it is automatically
|
|
78875
|
+
* converted to `null`.
|
|
78756
78876
|
*/
|
|
78757
78877
|
null: () => {
|
|
78758
78878
|
return new VNull({ isOptional: "required" });
|
|
78759
78879
|
},
|
|
78760
78880
|
/**
|
|
78761
|
-
* Validates that the value is
|
|
78881
|
+
* Validates that the value is a JavaScript `number` (Convex Float64).
|
|
78882
|
+
*
|
|
78883
|
+
* Supports all IEEE-754 double-precision floating point numbers including
|
|
78884
|
+
* NaN and Infinity.
|
|
78762
78885
|
*
|
|
78763
|
-
* Alias for `v.float64()
|
|
78886
|
+
* Alias for `v.float64()`.
|
|
78764
78887
|
*/
|
|
78765
78888
|
number: () => {
|
|
78766
78889
|
return new VFloat64({ isOptional: "required" });
|
|
78767
78890
|
},
|
|
78768
78891
|
/**
|
|
78769
|
-
* Validates that the value is
|
|
78892
|
+
* Validates that the value is a JavaScript `number` (Convex Float64).
|
|
78893
|
+
*
|
|
78894
|
+
* Supports all IEEE-754 double-precision floating point numbers.
|
|
78770
78895
|
*/
|
|
78771
78896
|
float64: () => {
|
|
78772
78897
|
return new VFloat64({ isOptional: "required" });
|
|
78773
78898
|
},
|
|
78774
78899
|
/**
|
|
78775
|
-
* @deprecated Use `v.int64()` instead
|
|
78900
|
+
* @deprecated Use `v.int64()` instead.
|
|
78776
78901
|
*/
|
|
78777
78902
|
bigint: () => {
|
|
78778
78903
|
return new VInt64({ isOptional: "required" });
|
|
78779
78904
|
},
|
|
78780
78905
|
/**
|
|
78781
|
-
* Validates that the value is
|
|
78906
|
+
* Validates that the value is a JavaScript `bigint` (Convex Int64).
|
|
78907
|
+
*
|
|
78908
|
+
* Supports BigInts between -2^63 and 2^63-1.
|
|
78909
|
+
*
|
|
78910
|
+
* @example
|
|
78911
|
+
* ```typescript
|
|
78912
|
+
* args: { timestamp: v.int64() }
|
|
78913
|
+
* // Usage: createDoc({ timestamp: 1234567890n })
|
|
78914
|
+
* ```
|
|
78782
78915
|
*/
|
|
78783
78916
|
int64: () => {
|
|
78784
78917
|
return new VInt64({ isOptional: "required" });
|
|
78785
78918
|
},
|
|
78786
78919
|
/**
|
|
78787
|
-
* Validates that the value is
|
|
78920
|
+
* Validates that the value is a commit timestamp: an int64 (`bigint`)
|
|
78921
|
+
* assigned from the transaction's commit timestamp.
|
|
78922
|
+
*
|
|
78923
|
+
* An index on a field with this validator orders documents by commit order.
|
|
78924
|
+
* Accepts any int64 value; write `db.vars.commitTs` to have the field
|
|
78925
|
+
* resolve to the commit timestamp when the mutation commits.
|
|
78926
|
+
*/
|
|
78927
|
+
commitTs: () => {
|
|
78928
|
+
return new VCommitTs({ isOptional: "required" });
|
|
78929
|
+
},
|
|
78930
|
+
/**
|
|
78931
|
+
* Validates that the value is a `boolean`.
|
|
78788
78932
|
*/
|
|
78789
78933
|
boolean: () => {
|
|
78790
78934
|
return new VBoolean({ isOptional: "required" });
|
|
78791
78935
|
},
|
|
78792
78936
|
/**
|
|
78793
|
-
* Validates that the value is
|
|
78937
|
+
* Validates that the value is a `string`.
|
|
78938
|
+
*
|
|
78939
|
+
* Strings are stored as UTF-8 and their storage size is calculated as their
|
|
78940
|
+
* UTF-8 encoded size.
|
|
78794
78941
|
*/
|
|
78795
78942
|
string: () => {
|
|
78796
78943
|
return new VString({ isOptional: "required" });
|
|
78797
78944
|
},
|
|
78798
78945
|
/**
|
|
78799
|
-
* Validates that the value is
|
|
78946
|
+
* Validates that the value is an `ArrayBuffer` (Convex Bytes).
|
|
78947
|
+
*
|
|
78948
|
+
* Use for binary data.
|
|
78800
78949
|
*/
|
|
78801
78950
|
bytes: () => {
|
|
78802
78951
|
return new VBytes({ isOptional: "required" });
|
|
78803
78952
|
},
|
|
78804
78953
|
/**
|
|
78805
|
-
* Validates that the value is equal to the given literal
|
|
78954
|
+
* Validates that the value is exactly equal to the given literal.
|
|
78955
|
+
*
|
|
78956
|
+
* Useful for discriminated unions and enum-like patterns.
|
|
78957
|
+
*
|
|
78958
|
+
* @example
|
|
78959
|
+
* ```typescript
|
|
78960
|
+
* // Discriminated union pattern:
|
|
78961
|
+
* v.union(
|
|
78962
|
+
* v.object({ kind: v.literal("error"), message: v.string() }),
|
|
78963
|
+
* v.object({ kind: v.literal("success"), value: v.number() }),
|
|
78964
|
+
* )
|
|
78965
|
+
* ```
|
|
78966
|
+
*
|
|
78806
78967
|
* @param literal The literal value to compare against.
|
|
78807
78968
|
*/
|
|
78808
78969
|
literal: (literal3) => {
|
|
78809
78970
|
return new VLiteral({ isOptional: "required", value: literal3 });
|
|
78810
78971
|
},
|
|
78811
78972
|
/**
|
|
78812
|
-
* Validates that the value is an Array
|
|
78973
|
+
* Validates that the value is an `Array` where every element matches the
|
|
78974
|
+
* given validator.
|
|
78975
|
+
*
|
|
78976
|
+
* Arrays can have at most 8192 elements.
|
|
78977
|
+
*
|
|
78978
|
+
* @example
|
|
78979
|
+
* ```typescript
|
|
78980
|
+
* args: { tags: v.array(v.string()) }
|
|
78981
|
+
* args: { coordinates: v.array(v.number()) }
|
|
78982
|
+
* args: { items: v.array(v.object({ name: v.string(), qty: v.number() })) }
|
|
78983
|
+
* ```
|
|
78984
|
+
*
|
|
78813
78985
|
* @param element The validator for the elements of the array.
|
|
78814
78986
|
*/
|
|
78815
78987
|
array: (element) => {
|
|
78816
78988
|
return new VArray({ isOptional: "required", element });
|
|
78817
78989
|
},
|
|
78818
78990
|
/**
|
|
78819
|
-
* Validates that the value is an Object with the
|
|
78820
|
-
*
|
|
78991
|
+
* Validates that the value is an `Object` with the specified properties.
|
|
78992
|
+
*
|
|
78993
|
+
* Objects can have at most 1024 entries. Field names must be non-empty and
|
|
78994
|
+
* must not start with `"$"` or `"_"` (`_` is reserved for system fields
|
|
78995
|
+
* like `_id` and `_creationTime`; `$` is reserved for Convex internal use).
|
|
78996
|
+
*
|
|
78997
|
+
* @example
|
|
78998
|
+
* ```typescript
|
|
78999
|
+
* args: {
|
|
79000
|
+
* user: v.object({
|
|
79001
|
+
* name: v.string(),
|
|
79002
|
+
* email: v.string(),
|
|
79003
|
+
* age: v.optional(v.number()),
|
|
79004
|
+
* })
|
|
79005
|
+
* }
|
|
79006
|
+
* ```
|
|
79007
|
+
*
|
|
79008
|
+
* @param fields An object mapping property names to their validators.
|
|
78821
79009
|
*/
|
|
78822
79010
|
object: (fields) => {
|
|
78823
79011
|
return new VObject({ isOptional: "required", fields });
|
|
78824
79012
|
},
|
|
78825
79013
|
/**
|
|
78826
|
-
* Validates that the value is a Record with keys
|
|
78827
|
-
*
|
|
79014
|
+
* Validates that the value is a `Record` (object with dynamic keys).
|
|
79015
|
+
*
|
|
79016
|
+
* Records are objects at runtime but allow dynamic keys, unlike `v.object()`
|
|
79017
|
+
* which requires known property names. Keys must be ASCII characters only,
|
|
79018
|
+
* non-empty, and not start with `"$"` or `"_"`.
|
|
79019
|
+
*
|
|
79020
|
+
* @example
|
|
79021
|
+
* ```typescript
|
|
79022
|
+
* // Map of user IDs to scores:
|
|
79023
|
+
* args: { scores: v.record(v.id("users"), v.number()) }
|
|
79024
|
+
*
|
|
79025
|
+
* // Map of string keys to string values:
|
|
79026
|
+
* args: { metadata: v.record(v.string(), v.string()) }
|
|
79027
|
+
* ```
|
|
79028
|
+
*
|
|
79029
|
+
* @param keys The validator for the keys of the record.
|
|
78828
79030
|
* @param values The validator for the values of the record.
|
|
78829
79031
|
*/
|
|
78830
79032
|
record: (keys, values) => {
|
|
@@ -78835,7 +79037,23 @@ var init_validator = __esm({
|
|
|
78835
79037
|
});
|
|
78836
79038
|
},
|
|
78837
79039
|
/**
|
|
78838
|
-
* Validates that the value matches one of the given validators.
|
|
79040
|
+
* Validates that the value matches at least one of the given validators.
|
|
79041
|
+
*
|
|
79042
|
+
* @example
|
|
79043
|
+
* ```typescript
|
|
79044
|
+
* // Allow string or number:
|
|
79045
|
+
* args: { value: v.union(v.string(), v.number()) }
|
|
79046
|
+
*
|
|
79047
|
+
* // Discriminated union (recommended pattern):
|
|
79048
|
+
* v.union(
|
|
79049
|
+
* v.object({ kind: v.literal("text"), body: v.string() }),
|
|
79050
|
+
* v.object({ kind: v.literal("image"), url: v.string() }),
|
|
79051
|
+
* )
|
|
79052
|
+
*
|
|
79053
|
+
* // Nullable value:
|
|
79054
|
+
* returns: v.union(v.object({ ... }), v.null())
|
|
79055
|
+
* ```
|
|
79056
|
+
*
|
|
78839
79057
|
* @param members The validators to match against.
|
|
78840
79058
|
*/
|
|
78841
79059
|
union: (...members) => {
|
|
@@ -78845,27 +79063,55 @@ var init_validator = __esm({
|
|
|
78845
79063
|
});
|
|
78846
79064
|
},
|
|
78847
79065
|
/**
|
|
78848
|
-
*
|
|
79066
|
+
* A validator that accepts any Convex value without validation.
|
|
79067
|
+
*
|
|
79068
|
+
* Prefer using specific validators when possible for better type safety
|
|
79069
|
+
* and runtime validation.
|
|
78849
79070
|
*/
|
|
78850
79071
|
any: () => {
|
|
78851
79072
|
return new VAny({ isOptional: "required" });
|
|
78852
79073
|
},
|
|
78853
79074
|
/**
|
|
78854
|
-
*
|
|
78855
|
-
* @param value The property value validator to make optional.
|
|
79075
|
+
* Makes a property optional in an object validator.
|
|
78856
79076
|
*
|
|
79077
|
+
* An optional property can be omitted entirely when creating a document or
|
|
79078
|
+
* calling a function. This is different from `v.nullable()` which requires
|
|
79079
|
+
* the property to be present but allows `null`.
|
|
79080
|
+
*
|
|
79081
|
+
* @example
|
|
78857
79082
|
* ```typescript
|
|
78858
|
-
*
|
|
78859
|
-
*
|
|
78860
|
-
*
|
|
78861
|
-
* })
|
|
79083
|
+
* v.object({
|
|
79084
|
+
* name: v.string(), // required
|
|
79085
|
+
* nickname: v.optional(v.string()), // can be omitted
|
|
79086
|
+
* })
|
|
79087
|
+
*
|
|
79088
|
+
* // Valid: { name: "Alice" }
|
|
79089
|
+
* // Valid: { name: "Alice", nickname: "Ali" }
|
|
79090
|
+
* // Invalid: { name: "Alice", nickname: null } - use v.nullable() for this
|
|
78862
79091
|
* ```
|
|
79092
|
+
*
|
|
79093
|
+
* @param value The property value validator to make optional.
|
|
78863
79094
|
*/
|
|
78864
79095
|
optional: (value) => {
|
|
78865
79096
|
return value.asOptional();
|
|
78866
79097
|
},
|
|
78867
79098
|
/**
|
|
78868
|
-
* Allows
|
|
79099
|
+
* Allows a value to be either the given type or `null`.
|
|
79100
|
+
*
|
|
79101
|
+
* This is shorthand for `v.union(value, v.null())`. Unlike `v.optional()`,
|
|
79102
|
+
* the property must still be present, but may be `null`.
|
|
79103
|
+
*
|
|
79104
|
+
* @example
|
|
79105
|
+
* ```typescript
|
|
79106
|
+
* v.object({
|
|
79107
|
+
* name: v.string(),
|
|
79108
|
+
* deletedAt: v.nullable(v.number()), // must be present, can be null
|
|
79109
|
+
* })
|
|
79110
|
+
*
|
|
79111
|
+
* // Valid: { name: "Alice", deletedAt: null }
|
|
79112
|
+
* // Valid: { name: "Alice", deletedAt: 1234567890 }
|
|
79113
|
+
* // Invalid: { name: "Alice" } - deletedAt is required
|
|
79114
|
+
* ```
|
|
78869
79115
|
*/
|
|
78870
79116
|
nullable: (value) => {
|
|
78871
79117
|
return v.union(value, v.null());
|
|
@@ -78911,10 +79157,20 @@ var init_compare_utf8 = __esm({
|
|
|
78911
79157
|
var init_compare = __esm({
|
|
78912
79158
|
"../../node_modules/convex/dist/esm/values/compare.js"() {
|
|
78913
79159
|
"use strict";
|
|
79160
|
+
init_value();
|
|
78914
79161
|
init_compare_utf8();
|
|
78915
79162
|
}
|
|
78916
79163
|
});
|
|
78917
79164
|
|
|
79165
|
+
// ../../node_modules/convex/dist/esm/values/size.js
|
|
79166
|
+
var init_size = __esm({
|
|
79167
|
+
"../../node_modules/convex/dist/esm/values/size.js"() {
|
|
79168
|
+
"use strict";
|
|
79169
|
+
init_value();
|
|
79170
|
+
init_common2();
|
|
79171
|
+
}
|
|
79172
|
+
});
|
|
79173
|
+
|
|
78918
79174
|
// ../../node_modules/convex/dist/esm/values/index.js
|
|
78919
79175
|
var init_values = __esm({
|
|
78920
79176
|
"../../node_modules/convex/dist/esm/values/index.js"() {
|
|
@@ -78924,6 +79180,7 @@ var init_values = __esm({
|
|
|
78924
79180
|
init_base64();
|
|
78925
79181
|
init_errors3();
|
|
78926
79182
|
init_compare();
|
|
79183
|
+
init_size();
|
|
78927
79184
|
}
|
|
78928
79185
|
});
|
|
78929
79186
|
|
|
@@ -78932,7 +79189,7 @@ var version2;
|
|
|
78932
79189
|
var init_esm6 = __esm({
|
|
78933
79190
|
"../../node_modules/convex/dist/esm/index.js"() {
|
|
78934
79191
|
"use strict";
|
|
78935
|
-
version2 = "1.
|
|
79192
|
+
version2 = "1.48.0";
|
|
78936
79193
|
}
|
|
78937
79194
|
});
|
|
78938
79195
|
|
|
@@ -78989,6 +79246,13 @@ var init_paths2 = __esm({
|
|
|
78989
79246
|
}
|
|
78990
79247
|
});
|
|
78991
79248
|
|
|
79249
|
+
// ../../node_modules/convex/dist/esm/server/impl/validate.js
|
|
79250
|
+
var init_validate = __esm({
|
|
79251
|
+
"../../node_modules/convex/dist/esm/server/impl/validate.js"() {
|
|
79252
|
+
"use strict";
|
|
79253
|
+
}
|
|
79254
|
+
});
|
|
79255
|
+
|
|
78992
79256
|
// ../../node_modules/convex/dist/esm/server/impl/actions_impl.js
|
|
78993
79257
|
var init_actions_impl = __esm({
|
|
78994
79258
|
"../../node_modules/convex/dist/esm/server/impl/actions_impl.js"() {
|
|
@@ -78998,6 +79262,7 @@ var init_actions_impl = __esm({
|
|
|
78998
79262
|
init_syscall();
|
|
78999
79263
|
init_common2();
|
|
79000
79264
|
init_paths2();
|
|
79265
|
+
init_validate();
|
|
79001
79266
|
}
|
|
79002
79267
|
});
|
|
79003
79268
|
|
|
@@ -79008,13 +79273,6 @@ var init_vector_search = __esm({
|
|
|
79008
79273
|
}
|
|
79009
79274
|
});
|
|
79010
79275
|
|
|
79011
|
-
// ../../node_modules/convex/dist/esm/server/impl/validate.js
|
|
79012
|
-
var init_validate = __esm({
|
|
79013
|
-
"../../node_modules/convex/dist/esm/server/impl/validate.js"() {
|
|
79014
|
-
"use strict";
|
|
79015
|
-
}
|
|
79016
|
-
});
|
|
79017
|
-
|
|
79018
79276
|
// ../../node_modules/convex/dist/esm/server/impl/vector_search_impl.js
|
|
79019
79277
|
var init_vector_search_impl = __esm({
|
|
79020
79278
|
"../../node_modules/convex/dist/esm/server/impl/vector_search_impl.js"() {
|
|
@@ -79031,6 +79289,7 @@ var init_vector_search_impl = __esm({
|
|
|
79031
79289
|
var init_authentication_impl = __esm({
|
|
79032
79290
|
"../../node_modules/convex/dist/esm/server/impl/authentication_impl.js"() {
|
|
79033
79291
|
"use strict";
|
|
79292
|
+
init_esm6();
|
|
79034
79293
|
init_syscall();
|
|
79035
79294
|
}
|
|
79036
79295
|
});
|
|
@@ -79129,11 +79388,21 @@ var init_storage_impl = __esm({
|
|
|
79129
79388
|
"../../node_modules/convex/dist/esm/server/impl/storage_impl.js"() {
|
|
79130
79389
|
"use strict";
|
|
79131
79390
|
init_esm6();
|
|
79391
|
+
init_base64();
|
|
79132
79392
|
init_syscall();
|
|
79133
79393
|
init_validate();
|
|
79134
79394
|
}
|
|
79135
79395
|
});
|
|
79136
79396
|
|
|
79397
|
+
// ../../node_modules/convex/dist/esm/server/impl/meta_impl.js
|
|
79398
|
+
var init_meta_impl = __esm({
|
|
79399
|
+
"../../node_modules/convex/dist/esm/server/impl/meta_impl.js"() {
|
|
79400
|
+
"use strict";
|
|
79401
|
+
init_values();
|
|
79402
|
+
init_syscall();
|
|
79403
|
+
}
|
|
79404
|
+
});
|
|
79405
|
+
|
|
79137
79406
|
// ../../node_modules/convex/dist/esm/server/impl/registration_impl.js
|
|
79138
79407
|
var init_registration_impl = __esm({
|
|
79139
79408
|
"../../node_modules/convex/dist/esm/server/impl/registration_impl.js"() {
|
|
@@ -79150,6 +79419,7 @@ var init_registration_impl = __esm({
|
|
|
79150
79419
|
init_syscall();
|
|
79151
79420
|
init_validator();
|
|
79152
79421
|
init_paths2();
|
|
79422
|
+
init_meta_impl();
|
|
79153
79423
|
}
|
|
79154
79424
|
});
|
|
79155
79425
|
|
|
@@ -79250,6 +79520,7 @@ var init_cron = __esm({
|
|
|
79250
79520
|
init_api4();
|
|
79251
79521
|
init_common2();
|
|
79252
79522
|
init_values();
|
|
79523
|
+
init_paths2();
|
|
79253
79524
|
}
|
|
79254
79525
|
});
|
|
79255
79526
|
|
|
@@ -79265,14 +79536,53 @@ var init_router = __esm({
|
|
|
79265
79536
|
var init_components = __esm({
|
|
79266
79537
|
"../../node_modules/convex/dist/esm/server/components/index.js"() {
|
|
79267
79538
|
"use strict";
|
|
79268
|
-
init_values();
|
|
79269
79539
|
init_esm6();
|
|
79270
79540
|
init_syscall();
|
|
79271
79541
|
init_paths2();
|
|
79542
|
+
init_validator();
|
|
79272
79543
|
init_paths2();
|
|
79273
79544
|
}
|
|
79274
79545
|
});
|
|
79275
79546
|
|
|
79547
|
+
// ../../node_modules/convex/dist/esm/server/logVars.js
|
|
79548
|
+
var REQUEST_ID, IP, USER_AGENT, NOW, CONVEX_ACTOR, varNames;
|
|
79549
|
+
var init_logVars = __esm({
|
|
79550
|
+
"../../node_modules/convex/dist/esm/server/logVars.js"() {
|
|
79551
|
+
"use strict";
|
|
79552
|
+
REQUEST_ID = /* @__PURE__ */ Symbol("var.requestId");
|
|
79553
|
+
IP = /* @__PURE__ */ Symbol("var.ip");
|
|
79554
|
+
USER_AGENT = /* @__PURE__ */ Symbol("var.userAgent");
|
|
79555
|
+
NOW = /* @__PURE__ */ Symbol("var.now");
|
|
79556
|
+
CONVEX_ACTOR = /* @__PURE__ */ Symbol("var.convexActor");
|
|
79557
|
+
varNames = {
|
|
79558
|
+
[REQUEST_ID]: "requestId",
|
|
79559
|
+
[IP]: "ip",
|
|
79560
|
+
[USER_AGENT]: "userAgent",
|
|
79561
|
+
[NOW]: "now",
|
|
79562
|
+
[CONVEX_ACTOR]: "convexActor"
|
|
79563
|
+
};
|
|
79564
|
+
}
|
|
79565
|
+
});
|
|
79566
|
+
|
|
79567
|
+
// ../../node_modules/convex/dist/esm/server/audit_logging.js
|
|
79568
|
+
var init_audit_logging = __esm({
|
|
79569
|
+
"../../node_modules/convex/dist/esm/server/audit_logging.js"() {
|
|
79570
|
+
"use strict";
|
|
79571
|
+
init_esm6();
|
|
79572
|
+
init_syscall();
|
|
79573
|
+
init_logVars();
|
|
79574
|
+
}
|
|
79575
|
+
});
|
|
79576
|
+
|
|
79577
|
+
// ../../node_modules/convex/dist/esm/server/log.js
|
|
79578
|
+
var init_log = __esm({
|
|
79579
|
+
"../../node_modules/convex/dist/esm/server/log.js"() {
|
|
79580
|
+
"use strict";
|
|
79581
|
+
init_audit_logging();
|
|
79582
|
+
init_logVars();
|
|
79583
|
+
}
|
|
79584
|
+
});
|
|
79585
|
+
|
|
79276
79586
|
// ../../node_modules/convex/dist/esm/server/schema.js
|
|
79277
79587
|
function defineTable(documentSchema) {
|
|
79278
79588
|
if (isValidator(documentSchema)) {
|
|
@@ -79281,6 +79591,42 @@ function defineTable(documentSchema) {
|
|
|
79281
79591
|
return new TableDefinition(v.object(documentSchema));
|
|
79282
79592
|
}
|
|
79283
79593
|
}
|
|
79594
|
+
function addSystemFields(tableName, validator) {
|
|
79595
|
+
switch (validator.kind) {
|
|
79596
|
+
case "object":
|
|
79597
|
+
return validator.extend({
|
|
79598
|
+
_id: v.id(tableName),
|
|
79599
|
+
_creationTime: v.number()
|
|
79600
|
+
});
|
|
79601
|
+
case "union":
|
|
79602
|
+
return v.union(
|
|
79603
|
+
...validator.members.map(
|
|
79604
|
+
(member) => addSystemFields(tableName, member)
|
|
79605
|
+
)
|
|
79606
|
+
);
|
|
79607
|
+
// `v.any()` already permits the system fields.
|
|
79608
|
+
case "any":
|
|
79609
|
+
return validator;
|
|
79610
|
+
default:
|
|
79611
|
+
throw new Error(
|
|
79612
|
+
`Invalid validator for table "${tableName}": a table's documents must be objects, or a union of objects (see https://docs.convex.dev/database/schemas)`
|
|
79613
|
+
);
|
|
79614
|
+
}
|
|
79615
|
+
}
|
|
79616
|
+
function docValidator(tableName, table) {
|
|
79617
|
+
return addSystemFields(tableName, table.validator);
|
|
79618
|
+
}
|
|
79619
|
+
function tableInSchema(schema, tableName) {
|
|
79620
|
+
const table = schema.tables[tableName];
|
|
79621
|
+
if (table === void 0) {
|
|
79622
|
+
throw new Error(
|
|
79623
|
+
`Table "${tableName}" is not in this schema. Tables in this schema: ${Object.keys(
|
|
79624
|
+
schema.tables
|
|
79625
|
+
).join(", ")}`
|
|
79626
|
+
);
|
|
79627
|
+
}
|
|
79628
|
+
return table;
|
|
79629
|
+
}
|
|
79284
79630
|
function defineSchema(schema, options) {
|
|
79285
79631
|
return new SchemaDefinition(schema, options);
|
|
79286
79632
|
}
|
|
@@ -79304,6 +79650,7 @@ var init_schema = __esm({
|
|
|
79304
79650
|
__publicField3(this, "vectorIndexes");
|
|
79305
79651
|
__publicField3(this, "stagedVectorIndexes");
|
|
79306
79652
|
__publicField3(this, "validator");
|
|
79653
|
+
__publicField3(this, "stagedValidator");
|
|
79307
79654
|
this.indexes = [];
|
|
79308
79655
|
this.stagedDbIndexes = [];
|
|
79309
79656
|
this.searchIndexes = [];
|
|
@@ -79317,8 +79664,6 @@ var init_schema = __esm({
|
|
|
79317
79664
|
*
|
|
79318
79665
|
* Returns indexes defined on this table.
|
|
79319
79666
|
* Intended for the advanced use cases of dynamically deciding which index to use for a query.
|
|
79320
|
-
* If you think you need this, please chime in on ths issue in the Convex JS GitHub repo.
|
|
79321
|
-
* https://github.com/get-convex/convex-js/issues/49
|
|
79322
79667
|
*/
|
|
79323
79668
|
" indexes"() {
|
|
79324
79669
|
return this.indexes;
|
|
@@ -79376,6 +79721,60 @@ var init_schema = __esm({
|
|
|
79376
79721
|
}
|
|
79377
79722
|
return this;
|
|
79378
79723
|
}
|
|
79724
|
+
/**
|
|
79725
|
+
* Stage changes to this table's document validator.
|
|
79726
|
+
*
|
|
79727
|
+
* Convex validates the staged validator against the table's existing
|
|
79728
|
+
* documents in the background, while the validator passed to
|
|
79729
|
+
* {@link defineTable} remains the one enforced on writes. Once
|
|
79730
|
+
* the background validation succeeds, apply the staged changes
|
|
79731
|
+
* and remove `.staged()`.
|
|
79732
|
+
*
|
|
79733
|
+
* For an object validator, pass only the fields to add or replace. Fields
|
|
79734
|
+
* omitted from the changes keep their enforced validators.
|
|
79735
|
+
* Set a field to `undefined` to remove it from the staged validator.
|
|
79736
|
+
* For nested objects, you must specify the full object validator.
|
|
79737
|
+
*
|
|
79738
|
+
* ```ts
|
|
79739
|
+
* defineTable({
|
|
79740
|
+
* apple: v.string(),
|
|
79741
|
+
* banana: v.number(),
|
|
79742
|
+
* legacy: v.optional(v.string()),
|
|
79743
|
+
* }).staged({
|
|
79744
|
+
* banana: v.union(v.string(), v.number()),
|
|
79745
|
+
* legacy: undefined,
|
|
79746
|
+
* })
|
|
79747
|
+
* ```
|
|
79748
|
+
*
|
|
79749
|
+
* See [Staged validators](https://docs.convex.dev/database/schemas#staged-validators).
|
|
79750
|
+
*
|
|
79751
|
+
* @param documentSchema - Field changes for a table defined as an object or
|
|
79752
|
+
* `v.any()`, or a full schema validator specifying the proposed next document
|
|
79753
|
+
* type. Use a full schema validator for a table defined as a union.
|
|
79754
|
+
* @returns A {@link TableDefinition} with the staged validator attached.
|
|
79755
|
+
*/
|
|
79756
|
+
staged(documentSchema) {
|
|
79757
|
+
if (this.stagedValidator !== void 0) {
|
|
79758
|
+
throw new Error("Table cannot have more than one staged validator.");
|
|
79759
|
+
}
|
|
79760
|
+
if (isValidator(documentSchema)) {
|
|
79761
|
+
this.stagedValidator = documentSchema;
|
|
79762
|
+
} else {
|
|
79763
|
+
if (this.validator.kind !== "object" && this.validator.kind !== "any") {
|
|
79764
|
+
throw new Error(
|
|
79765
|
+
"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."
|
|
79766
|
+
);
|
|
79767
|
+
}
|
|
79768
|
+
const enforcedFields = this.validator.kind === "object" ? this.validator.fields : {};
|
|
79769
|
+
const fields = Object.fromEntries(
|
|
79770
|
+
Object.entries({ ...enforcedFields, ...documentSchema }).filter(
|
|
79771
|
+
(entry) => entry[1] !== void 0
|
|
79772
|
+
)
|
|
79773
|
+
);
|
|
79774
|
+
this.stagedValidator = v.object(fields);
|
|
79775
|
+
}
|
|
79776
|
+
return this.self();
|
|
79777
|
+
}
|
|
79379
79778
|
/**
|
|
79380
79779
|
* Work around for https://github.com/microsoft/TypeScript/issues/57035
|
|
79381
79780
|
*/
|
|
@@ -79395,6 +79794,15 @@ var init_schema = __esm({
|
|
|
79395
79794
|
"Invalid validator: please make sure that the parameter of `defineTable` is valid (see https://docs.convex.dev/database/schemas)"
|
|
79396
79795
|
);
|
|
79397
79796
|
}
|
|
79797
|
+
let stagedDocumentType = void 0;
|
|
79798
|
+
if (this.stagedValidator !== void 0) {
|
|
79799
|
+
stagedDocumentType = this.stagedValidator.json;
|
|
79800
|
+
if (typeof stagedDocumentType !== "object") {
|
|
79801
|
+
throw new Error(
|
|
79802
|
+
"Invalid staged validator: please make sure that the parameter of `.staged()` is valid (see https://docs.convex.dev/database/schemas)"
|
|
79803
|
+
);
|
|
79804
|
+
}
|
|
79805
|
+
}
|
|
79398
79806
|
return {
|
|
79399
79807
|
indexes: this.indexes,
|
|
79400
79808
|
stagedDbIndexes: this.stagedDbIndexes,
|
|
@@ -79402,7 +79810,8 @@ var init_schema = __esm({
|
|
|
79402
79810
|
stagedSearchIndexes: this.stagedSearchIndexes,
|
|
79403
79811
|
vectorIndexes: this.vectorIndexes,
|
|
79404
79812
|
stagedVectorIndexes: this.stagedVectorIndexes,
|
|
79405
|
-
documentType
|
|
79813
|
+
documentType,
|
|
79814
|
+
stagedDocumentType
|
|
79406
79815
|
};
|
|
79407
79816
|
}
|
|
79408
79817
|
};
|
|
@@ -79417,6 +79826,37 @@ var init_schema = __esm({
|
|
|
79417
79826
|
this.tables = tables;
|
|
79418
79827
|
this.schemaValidation = options?.schemaValidation === void 0 ? true : options.schemaValidation;
|
|
79419
79828
|
}
|
|
79829
|
+
/**
|
|
79830
|
+
* The validator for whole documents of a table in this schema: the table's
|
|
79831
|
+
* own validator with the `_id` and `_creationTime` system fields added.
|
|
79832
|
+
*
|
|
79833
|
+
* @example
|
|
79834
|
+
* ```ts
|
|
79835
|
+
* export const get = query({
|
|
79836
|
+
* args: { id: schema.id("messages") },
|
|
79837
|
+
* returns: v.union(schema.doc("messages"), v.null()),
|
|
79838
|
+
* handler: (ctx, args) => ctx.db.get(args.id),
|
|
79839
|
+
* });
|
|
79840
|
+
* ```
|
|
79841
|
+
*
|
|
79842
|
+
* @param tableName - The name of a table in this schema.
|
|
79843
|
+
* @returns A validator matching documents of that table.
|
|
79844
|
+
*/
|
|
79845
|
+
doc(tableName) {
|
|
79846
|
+
return docValidator(tableName, tableInSchema(this, tableName));
|
|
79847
|
+
}
|
|
79848
|
+
/**
|
|
79849
|
+
* The validator for IDs of a table in this schema.
|
|
79850
|
+
*
|
|
79851
|
+
* Same as `v.id(tableName)`, but only accepts tables in this schema.
|
|
79852
|
+
*
|
|
79853
|
+
* @param tableName - The name of a table in this schema.
|
|
79854
|
+
* @returns A validator matching IDs of that table.
|
|
79855
|
+
*/
|
|
79856
|
+
id(tableName) {
|
|
79857
|
+
tableInSchema(this, tableName);
|
|
79858
|
+
return v.id(tableName);
|
|
79859
|
+
}
|
|
79420
79860
|
/**
|
|
79421
79861
|
* Export the contents of this definition.
|
|
79422
79862
|
*
|
|
@@ -79433,7 +79873,8 @@ var init_schema = __esm({
|
|
|
79433
79873
|
stagedSearchIndexes,
|
|
79434
79874
|
vectorIndexes,
|
|
79435
79875
|
stagedVectorIndexes,
|
|
79436
|
-
documentType
|
|
79876
|
+
documentType,
|
|
79877
|
+
stagedDocumentType
|
|
79437
79878
|
} = definition.export();
|
|
79438
79879
|
return {
|
|
79439
79880
|
tableName,
|
|
@@ -79443,7 +79884,8 @@ var init_schema = __esm({
|
|
|
79443
79884
|
stagedSearchIndexes,
|
|
79444
79885
|
vectorIndexes,
|
|
79445
79886
|
stagedVectorIndexes,
|
|
79446
|
-
documentType
|
|
79887
|
+
documentType,
|
|
79888
|
+
stagedDocumentType
|
|
79447
79889
|
};
|
|
79448
79890
|
}),
|
|
79449
79891
|
schemaValidation: this.schemaValidation
|
|
@@ -79479,6 +79921,7 @@ var init_server = __esm({
|
|
|
79479
79921
|
"use strict";
|
|
79480
79922
|
init_database();
|
|
79481
79923
|
init_registration_impl();
|
|
79924
|
+
init_actions_impl();
|
|
79482
79925
|
init_pagination();
|
|
79483
79926
|
init_search_filter_builder();
|
|
79484
79927
|
init_storage();
|
|
@@ -79488,6 +79931,7 @@ var init_server = __esm({
|
|
|
79488
79931
|
init_components();
|
|
79489
79932
|
init_components();
|
|
79490
79933
|
init_components();
|
|
79934
|
+
init_log();
|
|
79491
79935
|
init_schema();
|
|
79492
79936
|
}
|
|
79493
79937
|
});
|
|
@@ -83687,7 +84131,7 @@ var init_local_state = __esm({
|
|
|
83687
84131
|
queryJournal(queryToken) {
|
|
83688
84132
|
return this.querySet.get(queryToken)?.journal;
|
|
83689
84133
|
}
|
|
83690
|
-
restart(
|
|
84134
|
+
restart() {
|
|
83691
84135
|
this.unpause();
|
|
83692
84136
|
this.outstandingQueriesOlderThanRestart.clear();
|
|
83693
84137
|
const modifications = [];
|
|
@@ -83701,9 +84145,7 @@ var init_local_state = __esm({
|
|
|
83701
84145
|
componentPath: localQuery.componentPath
|
|
83702
84146
|
};
|
|
83703
84147
|
modifications.push(add);
|
|
83704
|
-
|
|
83705
|
-
this.outstandingQueriesOlderThanRestart.add(localQuery.id);
|
|
83706
|
-
}
|
|
84148
|
+
this.outstandingQueriesOlderThanRestart.add(localQuery.id);
|
|
83707
84149
|
}
|
|
83708
84150
|
this.querySetVersion = 1;
|
|
83709
84151
|
const querySet = {
|
|
@@ -84976,6 +85418,7 @@ var init_web_socket_manager = __esm({
|
|
|
84976
85418
|
case "ready":
|
|
84977
85419
|
if (this.socket.paused === "uninitialized") {
|
|
84978
85420
|
this.socket = { ...this.socket, paused: "no" };
|
|
85421
|
+
this._hasEverConnected = true;
|
|
84979
85422
|
this.onOpen({
|
|
84980
85423
|
connectionCount: this.connectionCount,
|
|
84981
85424
|
lastCloseReason: this.lastCloseReason,
|
|
@@ -85165,6 +85608,8 @@ var init_authentication_manager = __esm({
|
|
|
85165
85608
|
__publicField11(this, "clearAuth");
|
|
85166
85609
|
__publicField11(this, "logger");
|
|
85167
85610
|
__publicField11(this, "refreshTokenLeewaySeconds");
|
|
85611
|
+
__publicField11(this, "initialAuthTokenReuse");
|
|
85612
|
+
__publicField11(this, "lastRefreshChange");
|
|
85168
85613
|
__publicField11(this, "tokenConfirmationAttempts", 0);
|
|
85169
85614
|
this.syncState = syncState;
|
|
85170
85615
|
this.authenticate = callbacks.authenticate;
|
|
@@ -85175,8 +85620,16 @@ var init_authentication_manager = __esm({
|
|
|
85175
85620
|
this.clearAuth = callbacks.clearAuth;
|
|
85176
85621
|
this.logger = config5.logger;
|
|
85177
85622
|
this.refreshTokenLeewaySeconds = config5.refreshTokenLeewaySeconds;
|
|
85623
|
+
this.initialAuthTokenReuse = config5.initialAuthTokenReuse;
|
|
85624
|
+
this.lastRefreshChange = false;
|
|
85625
|
+
}
|
|
85626
|
+
notifyRefreshChange(isRefreshing) {
|
|
85627
|
+
if (this.authState.state !== "noAuth" && this.authState.state !== "initialRefetch" && this.authState.config.onRefreshChange && this.lastRefreshChange !== isRefreshing) {
|
|
85628
|
+
this.lastRefreshChange = isRefreshing;
|
|
85629
|
+
this.authState.config.onRefreshChange(isRefreshing);
|
|
85630
|
+
}
|
|
85178
85631
|
}
|
|
85179
|
-
async setConfig(fetchToken2, onChange) {
|
|
85632
|
+
async setConfig(fetchToken2, onChange, onRefreshChange) {
|
|
85180
85633
|
this.resetAuthState();
|
|
85181
85634
|
this._logVerbose("pausing WS for auth token fetch");
|
|
85182
85635
|
this.pauseSocket();
|
|
@@ -85186,17 +85639,22 @@ var init_authentication_manager = __esm({
|
|
|
85186
85639
|
if (token.isFromOutdatedConfig) {
|
|
85187
85640
|
return;
|
|
85188
85641
|
}
|
|
85642
|
+
const config5 = {
|
|
85643
|
+
fetchToken: fetchToken2,
|
|
85644
|
+
onAuthChange: onChange,
|
|
85645
|
+
onRefreshChange
|
|
85646
|
+
};
|
|
85189
85647
|
if (token.value) {
|
|
85190
85648
|
this.setAuthState({
|
|
85191
85649
|
state: "waitingForServerConfirmationOfCachedToken",
|
|
85192
|
-
config:
|
|
85650
|
+
config: config5,
|
|
85193
85651
|
hasRetried: false
|
|
85194
85652
|
});
|
|
85195
85653
|
this.authenticate(token.value);
|
|
85196
85654
|
} else {
|
|
85197
85655
|
this.setAuthState({
|
|
85198
85656
|
state: "initialRefetch",
|
|
85199
|
-
config:
|
|
85657
|
+
config: config5
|
|
85200
85658
|
});
|
|
85201
85659
|
await this.refetchToken();
|
|
85202
85660
|
}
|
|
@@ -85212,14 +85670,24 @@ var init_authentication_manager = __esm({
|
|
|
85212
85670
|
if (serverMessage.endVersion.identity <= serverMessage.startVersion.identity) {
|
|
85213
85671
|
return;
|
|
85214
85672
|
}
|
|
85673
|
+
this._logVerbose(
|
|
85674
|
+
`auth state is ${this.authState.state} when handling transition`
|
|
85675
|
+
);
|
|
85676
|
+
this.syncState.markAuthCompletion();
|
|
85215
85677
|
if (this.authState.state === "waitingForServerConfirmationOfCachedToken") {
|
|
85216
85678
|
this._logVerbose("server confirmed auth token is valid");
|
|
85217
|
-
|
|
85679
|
+
const cachedToken = this.syncState.getAuth()?.value;
|
|
85680
|
+
if (this.initialAuthTokenReuse && cachedToken) {
|
|
85681
|
+
this.scheduleTokenRefetch(cachedToken, serverMessage.clientClockSkew);
|
|
85682
|
+
} else {
|
|
85683
|
+
void this.refetchToken();
|
|
85684
|
+
}
|
|
85218
85685
|
this.authState.config.onAuthChange(true);
|
|
85219
85686
|
return;
|
|
85220
85687
|
}
|
|
85221
85688
|
if (this.authState.state === "waitingForServerConfirmationOfFreshToken") {
|
|
85222
85689
|
this._logVerbose("server confirmed new auth token is valid");
|
|
85690
|
+
this.notifyRefreshChange(false);
|
|
85223
85691
|
this.scheduleTokenRefetch(this.authState.token);
|
|
85224
85692
|
this.tokenConfirmationAttempts = 0;
|
|
85225
85693
|
if (!this.authState.hadAuth) {
|
|
@@ -85269,7 +85737,11 @@ var init_authentication_manager = __esm({
|
|
|
85269
85737
|
`retrying reauthentication, ${MAX_TOKEN_CONFIRMATION_ATTEMPTS - this.tokenConfirmationAttempts} attempts remaining`
|
|
85270
85738
|
);
|
|
85271
85739
|
}
|
|
85740
|
+
this.notifyRefreshChange(true);
|
|
85272
85741
|
await this.stopSocket();
|
|
85742
|
+
if (this.authState.state === "noAuth") {
|
|
85743
|
+
return;
|
|
85744
|
+
}
|
|
85273
85745
|
const token = await this.fetchTokenAndGuardAgainstRace(
|
|
85274
85746
|
this.authState.config.fetchToken,
|
|
85275
85747
|
{
|
|
@@ -85340,7 +85812,7 @@ var init_authentication_manager = __esm({
|
|
|
85340
85812
|
);
|
|
85341
85813
|
this.tryRestartSocket();
|
|
85342
85814
|
}
|
|
85343
|
-
scheduleTokenRefetch(token) {
|
|
85815
|
+
scheduleTokenRefetch(token, clientClockSkewMs) {
|
|
85344
85816
|
if (this.authState.state === "noAuth") {
|
|
85345
85817
|
return;
|
|
85346
85818
|
}
|
|
@@ -85358,13 +85830,23 @@ var init_authentication_manager = __esm({
|
|
|
85358
85830
|
);
|
|
85359
85831
|
return;
|
|
85360
85832
|
}
|
|
85361
|
-
const
|
|
85362
|
-
if (
|
|
85833
|
+
const fullLifetimeSeconds = exp - iat;
|
|
85834
|
+
if (fullLifetimeSeconds <= 2) {
|
|
85363
85835
|
this.logger.error(
|
|
85364
85836
|
"Auth token does not live long enough, cannot refetch the token"
|
|
85365
85837
|
);
|
|
85366
85838
|
return;
|
|
85367
85839
|
}
|
|
85840
|
+
let tokenValiditySeconds;
|
|
85841
|
+
if (clientClockSkewMs !== void 0) {
|
|
85842
|
+
const estimatedServerNowSeconds = (Date.now() - clientClockSkewMs) / 1e3;
|
|
85843
|
+
tokenValiditySeconds = exp - estimatedServerNowSeconds;
|
|
85844
|
+
if (tokenValiditySeconds <= 0) {
|
|
85845
|
+
tokenValiditySeconds = 0;
|
|
85846
|
+
}
|
|
85847
|
+
} else {
|
|
85848
|
+
tokenValiditySeconds = fullLifetimeSeconds;
|
|
85849
|
+
}
|
|
85368
85850
|
let delay7 = Math.min(
|
|
85369
85851
|
MAXIMUM_REFRESH_DELAY,
|
|
85370
85852
|
(tokenValiditySeconds - this.refreshTokenLeewaySeconds) * 1e3
|
|
@@ -85413,7 +85895,11 @@ var init_authentication_manager = __esm({
|
|
|
85413
85895
|
onAuthChange(false);
|
|
85414
85896
|
this.resetAuthState();
|
|
85415
85897
|
}
|
|
85898
|
+
// The sole path to `state === "noAuth"`; consumers rely on this firing
|
|
85899
|
+
// `notifyRefreshChange(false)` to pair any in-flight `(true)`. May run
|
|
85900
|
+
// when refresh state is already false.
|
|
85416
85901
|
resetAuthState() {
|
|
85902
|
+
this.notifyRefreshChange(false);
|
|
85417
85903
|
this.setAuthState({ state: "noAuth" });
|
|
85418
85904
|
}
|
|
85419
85905
|
setAuthState(newAuth) {
|
|
@@ -85441,7 +85927,6 @@ var init_authentication_manager = __esm({
|
|
|
85441
85927
|
}
|
|
85442
85928
|
if (this.authState.state === "waitingForScheduledRefetch") {
|
|
85443
85929
|
clearTimeout(this.authState.refetchTokenTimeoutId);
|
|
85444
|
-
this.syncState.markAuthCompletion();
|
|
85445
85930
|
}
|
|
85446
85931
|
this.authState = newAuth;
|
|
85447
85932
|
}
|
|
@@ -85575,7 +86060,7 @@ var init_client3 = __esm({
|
|
|
85575
86060
|
validateDeploymentUrl(address);
|
|
85576
86061
|
}
|
|
85577
86062
|
options = { ...options };
|
|
85578
|
-
const authRefreshTokenLeewaySeconds = options.authRefreshTokenLeewaySeconds ??
|
|
86063
|
+
const authRefreshTokenLeewaySeconds = options.authRefreshTokenLeewaySeconds ?? 10;
|
|
85579
86064
|
let webSocketConstructor = options.webSocketConstructor;
|
|
85580
86065
|
if (!webSocketConstructor && typeof WebSocket === "undefined") {
|
|
85581
86066
|
throw new Error(
|
|
@@ -85632,7 +86117,8 @@ var init_client3 = __esm({
|
|
|
85632
86117
|
},
|
|
85633
86118
|
{
|
|
85634
86119
|
logger: this.logger,
|
|
85635
|
-
refreshTokenLeewaySeconds: authRefreshTokenLeewaySeconds
|
|
86120
|
+
refreshTokenLeewaySeconds: authRefreshTokenLeewaySeconds,
|
|
86121
|
+
initialAuthTokenReuse: options.initialAuthTokenReuse ?? false
|
|
85636
86122
|
}
|
|
85637
86123
|
);
|
|
85638
86124
|
this.optimisticQueryResults = new OptimisticQueryResults();
|
|
@@ -85669,16 +86155,11 @@ var init_client3 = __esm({
|
|
|
85669
86155
|
sessionId: this._sessionId,
|
|
85670
86156
|
maxObservedTimestamp: this.maxObservedTimestamp
|
|
85671
86157
|
});
|
|
85672
|
-
const oldRemoteQueryResults = new Set(
|
|
85673
|
-
this.remoteQuerySet.remoteQueryResults().keys()
|
|
85674
|
-
);
|
|
85675
86158
|
this.remoteQuerySet = new RemoteQuerySet(
|
|
85676
86159
|
(queryId) => this.state.queryPath(queryId),
|
|
85677
86160
|
this.logger
|
|
85678
86161
|
);
|
|
85679
|
-
const [querySetModification, authModification] = this.state.restart(
|
|
85680
|
-
oldRemoteQueryResults
|
|
85681
|
-
);
|
|
86162
|
+
const [querySetModification, authModification] = this.state.restart();
|
|
85682
86163
|
if (authModification) {
|
|
85683
86164
|
this.webSocketManager.sendMessage(authModification);
|
|
85684
86165
|
}
|
|
@@ -85773,7 +86254,7 @@ var init_client3 = __esm({
|
|
|
85773
86254
|
* potentially led to the restart. Use this to influence when to reset backoff after a failure.
|
|
85774
86255
|
*/
|
|
85775
86256
|
hasSyncedPastLastReconnect() {
|
|
85776
|
-
const hasSyncedPastLastReconnect = this.requestManager.hasSyncedPastLastReconnect()
|
|
86257
|
+
const hasSyncedPastLastReconnect = this.requestManager.hasSyncedPastLastReconnect() && this.state.hasSyncedPastLastReconnect();
|
|
85777
86258
|
return hasSyncedPastLastReconnect;
|
|
85778
86259
|
}
|
|
85779
86260
|
observedTimestamp(observedTs) {
|
|
@@ -85873,9 +86354,14 @@ var init_client3 = __esm({
|
|
|
85873
86354
|
* when the user's rights were permanently revoked.
|
|
85874
86355
|
* @param fetchToken - an async function returning the JWT-encoded OpenID Connect Identity Token
|
|
85875
86356
|
* @param onChange - a callback that will be called when the authentication status changes
|
|
86357
|
+
* @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
|
|
85876
86358
|
*/
|
|
85877
|
-
setAuth(fetchToken2, onChange) {
|
|
85878
|
-
void this.authenticationManager.setConfig(
|
|
86359
|
+
setAuth(fetchToken2, onChange, onRefreshChange) {
|
|
86360
|
+
void this.authenticationManager.setConfig(
|
|
86361
|
+
fetchToken2,
|
|
86362
|
+
onChange,
|
|
86363
|
+
onRefreshChange
|
|
86364
|
+
);
|
|
85879
86365
|
}
|
|
85880
86366
|
hasAuth() {
|
|
85881
86367
|
return this.state.hasAuth();
|
|
@@ -86229,470 +86715,6 @@ var init_client3 = __esm({
|
|
|
86229
86715
|
}
|
|
86230
86716
|
});
|
|
86231
86717
|
|
|
86232
|
-
// ../../node_modules/convex/dist/esm/browser/http_client.js
|
|
86233
|
-
function forwardErrorData(errorData, error55) {
|
|
86234
|
-
error55.data = jsonToConvex(errorData);
|
|
86235
|
-
return error55;
|
|
86236
|
-
}
|
|
86237
|
-
var __defProp15, __defNormalProp13, __publicField13, STATUS_CODE_UDF_FAILED, specifiedFetch, ConvexHttpClient;
|
|
86238
|
-
var init_http_client = __esm({
|
|
86239
|
-
"../../node_modules/convex/dist/esm/browser/http_client.js"() {
|
|
86240
|
-
"use strict";
|
|
86241
|
-
init_api4();
|
|
86242
|
-
init_common2();
|
|
86243
|
-
init_esm6();
|
|
86244
|
-
init_values();
|
|
86245
|
-
init_logging();
|
|
86246
|
-
__defProp15 = Object.defineProperty;
|
|
86247
|
-
__defNormalProp13 = (obj, key, value) => key in obj ? __defProp15(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
86248
|
-
__publicField13 = (obj, key, value) => __defNormalProp13(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
86249
|
-
STATUS_CODE_UDF_FAILED = 560;
|
|
86250
|
-
specifiedFetch = void 0;
|
|
86251
|
-
ConvexHttpClient = class {
|
|
86252
|
-
/**
|
|
86253
|
-
* Create a new {@link ConvexHttpClient}.
|
|
86254
|
-
*
|
|
86255
|
-
* @param address - The url of your Convex deployment, often provided
|
|
86256
|
-
* by an environment variable. E.g. `https://small-mouse-123.convex.cloud`.
|
|
86257
|
-
* @param options - An object of options.
|
|
86258
|
-
* - `skipConvexDeploymentUrlCheck` - Skip validating that the Convex deployment URL looks like
|
|
86259
|
-
* `https://happy-animal-123.convex.cloud` or localhost. This can be useful if running a self-hosted
|
|
86260
|
-
* Convex backend that uses a different URL.
|
|
86261
|
-
* - `logger` - A logger or a boolean. If not provided, logs to the console.
|
|
86262
|
-
* You can construct your own logger to customize logging to log elsewhere
|
|
86263
|
-
* or not log at all, or use `false` as a shorthand for a no-op logger.
|
|
86264
|
-
* A logger is an object with 4 methods: log(), warn(), error(), and logVerbose().
|
|
86265
|
-
* These methods can receive multiple arguments of any types, like console.log().
|
|
86266
|
-
* - `auth` - A JWT containing identity claims accessible in Convex functions.
|
|
86267
|
-
* This identity may expire so it may be necessary to call `setAuth()` later,
|
|
86268
|
-
* but for short-lived clients it's convenient to specify this value here.
|
|
86269
|
-
* - `fetch` - A custom fetch implementation to use for all HTTP requests made by this client.
|
|
86270
|
-
*/
|
|
86271
|
-
constructor(address, options) {
|
|
86272
|
-
__publicField13(this, "address");
|
|
86273
|
-
__publicField13(this, "auth");
|
|
86274
|
-
__publicField13(this, "adminAuth");
|
|
86275
|
-
__publicField13(this, "encodedTsPromise");
|
|
86276
|
-
__publicField13(this, "debug");
|
|
86277
|
-
__publicField13(this, "fetchOptions");
|
|
86278
|
-
__publicField13(this, "fetch");
|
|
86279
|
-
__publicField13(this, "logger");
|
|
86280
|
-
__publicField13(this, "mutationQueue", []);
|
|
86281
|
-
__publicField13(this, "isProcessingQueue", false);
|
|
86282
|
-
if (typeof options === "boolean") {
|
|
86283
|
-
throw new Error(
|
|
86284
|
-
"skipConvexDeploymentUrlCheck as the second argument is no longer supported. Please pass an options object, `{ skipConvexDeploymentUrlCheck: true }`."
|
|
86285
|
-
);
|
|
86286
|
-
}
|
|
86287
|
-
const opts = options ?? {};
|
|
86288
|
-
if (opts.skipConvexDeploymentUrlCheck !== true) {
|
|
86289
|
-
validateDeploymentUrl(address);
|
|
86290
|
-
}
|
|
86291
|
-
this.logger = options?.logger === false ? instantiateNoopLogger({ verbose: false }) : options?.logger !== true && options?.logger ? options.logger : instantiateDefaultLogger({ verbose: false });
|
|
86292
|
-
this.address = address;
|
|
86293
|
-
this.debug = true;
|
|
86294
|
-
this.auth = void 0;
|
|
86295
|
-
this.adminAuth = void 0;
|
|
86296
|
-
this.fetch = options?.fetch;
|
|
86297
|
-
if (options?.auth) {
|
|
86298
|
-
this.setAuth(options.auth);
|
|
86299
|
-
}
|
|
86300
|
-
}
|
|
86301
|
-
/**
|
|
86302
|
-
* Obtain the {@link ConvexHttpClient}'s URL to its backend.
|
|
86303
|
-
* @deprecated Use url, which returns the url without /api at the end.
|
|
86304
|
-
*
|
|
86305
|
-
* @returns The URL to the Convex backend, including the client's API version.
|
|
86306
|
-
*/
|
|
86307
|
-
backendUrl() {
|
|
86308
|
-
return `${this.address}/api`;
|
|
86309
|
-
}
|
|
86310
|
-
/**
|
|
86311
|
-
* Return the address for this client, useful for creating a new client.
|
|
86312
|
-
*
|
|
86313
|
-
* Not guaranteed to match the address with which this client was constructed:
|
|
86314
|
-
* it may be canonicalized.
|
|
86315
|
-
*/
|
|
86316
|
-
get url() {
|
|
86317
|
-
return this.address;
|
|
86318
|
-
}
|
|
86319
|
-
/**
|
|
86320
|
-
* Set the authentication token to be used for subsequent queries and mutations.
|
|
86321
|
-
*
|
|
86322
|
-
* Should be called whenever the token changes (i.e. due to expiration and refresh).
|
|
86323
|
-
*
|
|
86324
|
-
* @param value - JWT-encoded OpenID Connect identity token.
|
|
86325
|
-
*/
|
|
86326
|
-
setAuth(value) {
|
|
86327
|
-
this.clearAuth();
|
|
86328
|
-
this.auth = value;
|
|
86329
|
-
}
|
|
86330
|
-
/**
|
|
86331
|
-
* Set admin auth token to allow calling internal queries, mutations, and actions
|
|
86332
|
-
* and acting as an identity.
|
|
86333
|
-
*
|
|
86334
|
-
* @internal
|
|
86335
|
-
*/
|
|
86336
|
-
setAdminAuth(token, actingAsIdentity) {
|
|
86337
|
-
this.clearAuth();
|
|
86338
|
-
if (actingAsIdentity !== void 0) {
|
|
86339
|
-
const bytes = new TextEncoder().encode(JSON.stringify(actingAsIdentity));
|
|
86340
|
-
const actingAsIdentityEncoded = btoa(String.fromCodePoint(...bytes));
|
|
86341
|
-
this.adminAuth = `${token}:${actingAsIdentityEncoded}`;
|
|
86342
|
-
} else {
|
|
86343
|
-
this.adminAuth = token;
|
|
86344
|
-
}
|
|
86345
|
-
}
|
|
86346
|
-
/**
|
|
86347
|
-
* Clear the current authentication token if set.
|
|
86348
|
-
*/
|
|
86349
|
-
clearAuth() {
|
|
86350
|
-
this.auth = void 0;
|
|
86351
|
-
this.adminAuth = void 0;
|
|
86352
|
-
}
|
|
86353
|
-
/**
|
|
86354
|
-
* Sets whether the result log lines should be printed on the console or not.
|
|
86355
|
-
*
|
|
86356
|
-
* @internal
|
|
86357
|
-
*/
|
|
86358
|
-
setDebug(debug4) {
|
|
86359
|
-
this.debug = debug4;
|
|
86360
|
-
}
|
|
86361
|
-
/**
|
|
86362
|
-
* Used to customize the fetch behavior in some runtimes.
|
|
86363
|
-
*
|
|
86364
|
-
* @internal
|
|
86365
|
-
*/
|
|
86366
|
-
setFetchOptions(fetchOptions) {
|
|
86367
|
-
this.fetchOptions = fetchOptions;
|
|
86368
|
-
}
|
|
86369
|
-
/**
|
|
86370
|
-
* This API is experimental: it may change or disappear.
|
|
86371
|
-
*
|
|
86372
|
-
* Execute a Convex query function at the same timestamp as every other
|
|
86373
|
-
* consistent query execution run by this HTTP client.
|
|
86374
|
-
*
|
|
86375
|
-
* This doesn't make sense for long-lived ConvexHttpClients as Convex
|
|
86376
|
-
* backends can read a limited amount into the past: beyond 30 seconds
|
|
86377
|
-
* in the past may not be available.
|
|
86378
|
-
*
|
|
86379
|
-
* Create a new client to use a consistent time.
|
|
86380
|
-
*
|
|
86381
|
-
* @param name - The name of the query.
|
|
86382
|
-
* @param args - The arguments object for the query. If this is omitted,
|
|
86383
|
-
* the arguments will be `{}`.
|
|
86384
|
-
* @returns A promise of the query's result.
|
|
86385
|
-
*
|
|
86386
|
-
* @deprecated This API is experimental: it may change or disappear.
|
|
86387
|
-
*/
|
|
86388
|
-
async consistentQuery(query2, ...args) {
|
|
86389
|
-
const queryArgs = parseArgs(args[0]);
|
|
86390
|
-
const timestampPromise = this.getTimestamp();
|
|
86391
|
-
return await this.queryInner(query2, queryArgs, { timestampPromise });
|
|
86392
|
-
}
|
|
86393
|
-
async getTimestamp() {
|
|
86394
|
-
if (this.encodedTsPromise) {
|
|
86395
|
-
return this.encodedTsPromise;
|
|
86396
|
-
}
|
|
86397
|
-
return this.encodedTsPromise = this.getTimestampInner();
|
|
86398
|
-
}
|
|
86399
|
-
async getTimestampInner() {
|
|
86400
|
-
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
86401
|
-
const headers = {
|
|
86402
|
-
"Content-Type": "application/json",
|
|
86403
|
-
"Convex-Client": `npm-${version2}`
|
|
86404
|
-
};
|
|
86405
|
-
const response = await localFetch(`${this.address}/api/query_ts`, {
|
|
86406
|
-
...this.fetchOptions,
|
|
86407
|
-
method: "POST",
|
|
86408
|
-
headers
|
|
86409
|
-
});
|
|
86410
|
-
if (!response.ok) {
|
|
86411
|
-
throw new Error(await response.text());
|
|
86412
|
-
}
|
|
86413
|
-
const { ts } = await response.json();
|
|
86414
|
-
return ts;
|
|
86415
|
-
}
|
|
86416
|
-
/**
|
|
86417
|
-
* Execute a Convex query function.
|
|
86418
|
-
*
|
|
86419
|
-
* @param name - The name of the query.
|
|
86420
|
-
* @param args - The arguments object for the query. If this is omitted,
|
|
86421
|
-
* the arguments will be `{}`.
|
|
86422
|
-
* @returns A promise of the query's result.
|
|
86423
|
-
*/
|
|
86424
|
-
async query(query2, ...args) {
|
|
86425
|
-
const queryArgs = parseArgs(args[0]);
|
|
86426
|
-
return await this.queryInner(query2, queryArgs, {});
|
|
86427
|
-
}
|
|
86428
|
-
async queryInner(query2, queryArgs, options) {
|
|
86429
|
-
const name = getFunctionName2(query2);
|
|
86430
|
-
const args = [convexToJson(queryArgs)];
|
|
86431
|
-
const headers = {
|
|
86432
|
-
"Content-Type": "application/json",
|
|
86433
|
-
"Convex-Client": `npm-${version2}`
|
|
86434
|
-
};
|
|
86435
|
-
if (this.adminAuth) {
|
|
86436
|
-
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
86437
|
-
} else if (this.auth) {
|
|
86438
|
-
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
86439
|
-
}
|
|
86440
|
-
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
86441
|
-
const timestamp2 = options.timestampPromise ? await options.timestampPromise : void 0;
|
|
86442
|
-
const body = JSON.stringify({
|
|
86443
|
-
path: name,
|
|
86444
|
-
format: "convex_encoded_json",
|
|
86445
|
-
args,
|
|
86446
|
-
...timestamp2 ? { ts: timestamp2 } : {}
|
|
86447
|
-
});
|
|
86448
|
-
const endpoint = timestamp2 ? `${this.address}/api/query_at_ts` : `${this.address}/api/query`;
|
|
86449
|
-
const response = await localFetch(endpoint, {
|
|
86450
|
-
...this.fetchOptions,
|
|
86451
|
-
body,
|
|
86452
|
-
method: "POST",
|
|
86453
|
-
headers
|
|
86454
|
-
});
|
|
86455
|
-
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
86456
|
-
throw new Error(await response.text());
|
|
86457
|
-
}
|
|
86458
|
-
const respJSON = await response.json();
|
|
86459
|
-
if (this.debug) {
|
|
86460
|
-
for (const line of respJSON.logLines ?? []) {
|
|
86461
|
-
logForFunction(this.logger, "info", "query", name, line);
|
|
86462
|
-
}
|
|
86463
|
-
}
|
|
86464
|
-
switch (respJSON.status) {
|
|
86465
|
-
case "success":
|
|
86466
|
-
return jsonToConvex(respJSON.value);
|
|
86467
|
-
case "error":
|
|
86468
|
-
if (respJSON.errorData !== void 0) {
|
|
86469
|
-
throw forwardErrorData(
|
|
86470
|
-
respJSON.errorData,
|
|
86471
|
-
new ConvexError(respJSON.errorMessage)
|
|
86472
|
-
);
|
|
86473
|
-
}
|
|
86474
|
-
throw new Error(respJSON.errorMessage);
|
|
86475
|
-
default:
|
|
86476
|
-
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
86477
|
-
}
|
|
86478
|
-
}
|
|
86479
|
-
async mutationInner(mutation2, mutationArgs) {
|
|
86480
|
-
const name = getFunctionName2(mutation2);
|
|
86481
|
-
const body = JSON.stringify({
|
|
86482
|
-
path: name,
|
|
86483
|
-
format: "convex_encoded_json",
|
|
86484
|
-
args: [convexToJson(mutationArgs)]
|
|
86485
|
-
});
|
|
86486
|
-
const headers = {
|
|
86487
|
-
"Content-Type": "application/json",
|
|
86488
|
-
"Convex-Client": `npm-${version2}`
|
|
86489
|
-
};
|
|
86490
|
-
if (this.adminAuth) {
|
|
86491
|
-
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
86492
|
-
} else if (this.auth) {
|
|
86493
|
-
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
86494
|
-
}
|
|
86495
|
-
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
86496
|
-
const response = await localFetch(`${this.address}/api/mutation`, {
|
|
86497
|
-
...this.fetchOptions,
|
|
86498
|
-
body,
|
|
86499
|
-
method: "POST",
|
|
86500
|
-
headers
|
|
86501
|
-
});
|
|
86502
|
-
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
86503
|
-
throw new Error(await response.text());
|
|
86504
|
-
}
|
|
86505
|
-
const respJSON = await response.json();
|
|
86506
|
-
if (this.debug) {
|
|
86507
|
-
for (const line of respJSON.logLines ?? []) {
|
|
86508
|
-
logForFunction(this.logger, "info", "mutation", name, line);
|
|
86509
|
-
}
|
|
86510
|
-
}
|
|
86511
|
-
switch (respJSON.status) {
|
|
86512
|
-
case "success":
|
|
86513
|
-
return jsonToConvex(respJSON.value);
|
|
86514
|
-
case "error":
|
|
86515
|
-
if (respJSON.errorData !== void 0) {
|
|
86516
|
-
throw forwardErrorData(
|
|
86517
|
-
respJSON.errorData,
|
|
86518
|
-
new ConvexError(respJSON.errorMessage)
|
|
86519
|
-
);
|
|
86520
|
-
}
|
|
86521
|
-
throw new Error(respJSON.errorMessage);
|
|
86522
|
-
default:
|
|
86523
|
-
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
86524
|
-
}
|
|
86525
|
-
}
|
|
86526
|
-
async processMutationQueue() {
|
|
86527
|
-
if (this.isProcessingQueue) {
|
|
86528
|
-
return;
|
|
86529
|
-
}
|
|
86530
|
-
this.isProcessingQueue = true;
|
|
86531
|
-
while (this.mutationQueue.length > 0) {
|
|
86532
|
-
const { mutation: mutation2, args, resolve: resolve3, reject } = this.mutationQueue.shift();
|
|
86533
|
-
try {
|
|
86534
|
-
const result = await this.mutationInner(mutation2, args);
|
|
86535
|
-
resolve3(result);
|
|
86536
|
-
} catch (error55) {
|
|
86537
|
-
reject(error55);
|
|
86538
|
-
}
|
|
86539
|
-
}
|
|
86540
|
-
this.isProcessingQueue = false;
|
|
86541
|
-
}
|
|
86542
|
-
enqueueMutation(mutation2, args) {
|
|
86543
|
-
return new Promise((resolve3, reject) => {
|
|
86544
|
-
this.mutationQueue.push({ mutation: mutation2, args, resolve: resolve3, reject });
|
|
86545
|
-
void this.processMutationQueue();
|
|
86546
|
-
});
|
|
86547
|
-
}
|
|
86548
|
-
/**
|
|
86549
|
-
* Execute a Convex mutation function. Mutations are queued by default.
|
|
86550
|
-
*
|
|
86551
|
-
* @param name - The name of the mutation.
|
|
86552
|
-
* @param args - The arguments object for the mutation. If this is omitted,
|
|
86553
|
-
* the arguments will be `{}`.
|
|
86554
|
-
* @param options - An optional object containing
|
|
86555
|
-
* @returns A promise of the mutation's result.
|
|
86556
|
-
*/
|
|
86557
|
-
async mutation(mutation2, ...args) {
|
|
86558
|
-
const [fnArgs, options] = args;
|
|
86559
|
-
const mutationArgs = parseArgs(fnArgs);
|
|
86560
|
-
const queued = !options?.skipQueue;
|
|
86561
|
-
if (queued) {
|
|
86562
|
-
return await this.enqueueMutation(mutation2, mutationArgs);
|
|
86563
|
-
} else {
|
|
86564
|
-
return await this.mutationInner(mutation2, mutationArgs);
|
|
86565
|
-
}
|
|
86566
|
-
}
|
|
86567
|
-
/**
|
|
86568
|
-
* Execute a Convex action function. Actions are not queued.
|
|
86569
|
-
*
|
|
86570
|
-
* @param name - The name of the action.
|
|
86571
|
-
* @param args - The arguments object for the action. If this is omitted,
|
|
86572
|
-
* the arguments will be `{}`.
|
|
86573
|
-
* @returns A promise of the action's result.
|
|
86574
|
-
*/
|
|
86575
|
-
async action(action, ...args) {
|
|
86576
|
-
const actionArgs = parseArgs(args[0]);
|
|
86577
|
-
const name = getFunctionName2(action);
|
|
86578
|
-
const body = JSON.stringify({
|
|
86579
|
-
path: name,
|
|
86580
|
-
format: "convex_encoded_json",
|
|
86581
|
-
args: [convexToJson(actionArgs)]
|
|
86582
|
-
});
|
|
86583
|
-
const headers = {
|
|
86584
|
-
"Content-Type": "application/json",
|
|
86585
|
-
"Convex-Client": `npm-${version2}`
|
|
86586
|
-
};
|
|
86587
|
-
if (this.adminAuth) {
|
|
86588
|
-
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
86589
|
-
} else if (this.auth) {
|
|
86590
|
-
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
86591
|
-
}
|
|
86592
|
-
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
86593
|
-
const response = await localFetch(`${this.address}/api/action`, {
|
|
86594
|
-
...this.fetchOptions,
|
|
86595
|
-
body,
|
|
86596
|
-
method: "POST",
|
|
86597
|
-
headers
|
|
86598
|
-
});
|
|
86599
|
-
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
86600
|
-
throw new Error(await response.text());
|
|
86601
|
-
}
|
|
86602
|
-
const respJSON = await response.json();
|
|
86603
|
-
if (this.debug) {
|
|
86604
|
-
for (const line of respJSON.logLines ?? []) {
|
|
86605
|
-
logForFunction(this.logger, "info", "action", name, line);
|
|
86606
|
-
}
|
|
86607
|
-
}
|
|
86608
|
-
switch (respJSON.status) {
|
|
86609
|
-
case "success":
|
|
86610
|
-
return jsonToConvex(respJSON.value);
|
|
86611
|
-
case "error":
|
|
86612
|
-
if (respJSON.errorData !== void 0) {
|
|
86613
|
-
throw forwardErrorData(
|
|
86614
|
-
respJSON.errorData,
|
|
86615
|
-
new ConvexError(respJSON.errorMessage)
|
|
86616
|
-
);
|
|
86617
|
-
}
|
|
86618
|
-
throw new Error(respJSON.errorMessage);
|
|
86619
|
-
default:
|
|
86620
|
-
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
86621
|
-
}
|
|
86622
|
-
}
|
|
86623
|
-
/**
|
|
86624
|
-
* Execute a Convex function of an unknown type. These function calls are not queued.
|
|
86625
|
-
*
|
|
86626
|
-
* @param name - The name of the function.
|
|
86627
|
-
* @param args - The arguments object for the function. If this is omitted,
|
|
86628
|
-
* the arguments will be `{}`.
|
|
86629
|
-
* @returns A promise of the function's result.
|
|
86630
|
-
*
|
|
86631
|
-
* @internal
|
|
86632
|
-
*/
|
|
86633
|
-
async function(anyFunction, componentPath, ...args) {
|
|
86634
|
-
const functionArgs = parseArgs(args[0]);
|
|
86635
|
-
const name = typeof anyFunction === "string" ? anyFunction : getFunctionName2(anyFunction);
|
|
86636
|
-
const body = JSON.stringify({
|
|
86637
|
-
componentPath,
|
|
86638
|
-
path: name,
|
|
86639
|
-
format: "convex_encoded_json",
|
|
86640
|
-
args: convexToJson(functionArgs)
|
|
86641
|
-
});
|
|
86642
|
-
const headers = {
|
|
86643
|
-
"Content-Type": "application/json",
|
|
86644
|
-
"Convex-Client": `npm-${version2}`
|
|
86645
|
-
};
|
|
86646
|
-
if (this.adminAuth) {
|
|
86647
|
-
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
86648
|
-
} else if (this.auth) {
|
|
86649
|
-
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
86650
|
-
}
|
|
86651
|
-
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
86652
|
-
const response = await localFetch(`${this.address}/api/function`, {
|
|
86653
|
-
...this.fetchOptions,
|
|
86654
|
-
body,
|
|
86655
|
-
method: "POST",
|
|
86656
|
-
headers
|
|
86657
|
-
});
|
|
86658
|
-
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
86659
|
-
throw new Error(await response.text());
|
|
86660
|
-
}
|
|
86661
|
-
const respJSON = await response.json();
|
|
86662
|
-
if (this.debug) {
|
|
86663
|
-
for (const line of respJSON.logLines ?? []) {
|
|
86664
|
-
logForFunction(this.logger, "info", "any", name, line);
|
|
86665
|
-
}
|
|
86666
|
-
}
|
|
86667
|
-
switch (respJSON.status) {
|
|
86668
|
-
case "success":
|
|
86669
|
-
return jsonToConvex(respJSON.value);
|
|
86670
|
-
case "error":
|
|
86671
|
-
if (respJSON.errorData !== void 0) {
|
|
86672
|
-
throw forwardErrorData(
|
|
86673
|
-
respJSON.errorData,
|
|
86674
|
-
new ConvexError(respJSON.errorMessage)
|
|
86675
|
-
);
|
|
86676
|
-
}
|
|
86677
|
-
throw new Error(respJSON.errorMessage);
|
|
86678
|
-
default:
|
|
86679
|
-
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
86680
|
-
}
|
|
86681
|
-
}
|
|
86682
|
-
};
|
|
86683
|
-
}
|
|
86684
|
-
});
|
|
86685
|
-
|
|
86686
|
-
// ../../node_modules/convex/dist/esm/browser/index.js
|
|
86687
|
-
var init_browser2 = __esm({
|
|
86688
|
-
"../../node_modules/convex/dist/esm/browser/index.js"() {
|
|
86689
|
-
"use strict";
|
|
86690
|
-
init_client3();
|
|
86691
|
-
init_simple_client();
|
|
86692
|
-
init_http_client();
|
|
86693
|
-
}
|
|
86694
|
-
});
|
|
86695
|
-
|
|
86696
86718
|
// ../../node_modules/convex/dist/esm/browser/sync/pagination.js
|
|
86697
86719
|
function asPaginationResult(value) {
|
|
86698
86720
|
if (typeof value !== "object" || value === null || !Array.isArray(value.page) || typeof value.isDone !== "boolean" || typeof value.continueCursor !== "string") {
|
|
@@ -86707,22 +86729,22 @@ var init_pagination2 = __esm({
|
|
|
86707
86729
|
});
|
|
86708
86730
|
|
|
86709
86731
|
// ../../node_modules/convex/dist/esm/browser/sync/paginated_query_client.js
|
|
86710
|
-
var
|
|
86732
|
+
var __defProp15, __defNormalProp13, __publicField13, PaginatedQueryClient;
|
|
86711
86733
|
var init_paginated_query_client = __esm({
|
|
86712
86734
|
"../../node_modules/convex/dist/esm/browser/sync/paginated_query_client.js"() {
|
|
86713
86735
|
"use strict";
|
|
86714
86736
|
init_udf_path_utils();
|
|
86715
86737
|
init_pagination2();
|
|
86716
86738
|
init_long();
|
|
86717
|
-
|
|
86718
|
-
|
|
86719
|
-
|
|
86739
|
+
__defProp15 = Object.defineProperty;
|
|
86740
|
+
__defNormalProp13 = (obj, key, value) => key in obj ? __defProp15(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
86741
|
+
__publicField13 = (obj, key, value) => __defNormalProp13(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
86720
86742
|
PaginatedQueryClient = class {
|
|
86721
86743
|
constructor(client, onTransition) {
|
|
86722
86744
|
this.client = client;
|
|
86723
86745
|
this.onTransition = onTransition;
|
|
86724
|
-
|
|
86725
|
-
|
|
86746
|
+
__publicField13(this, "paginatedQuerySet", /* @__PURE__ */ new Map());
|
|
86747
|
+
__publicField13(this, "lastTransitionTs");
|
|
86726
86748
|
this.lastTransitionTs = Long.fromNumber(0);
|
|
86727
86749
|
this.client.addOnTransitionHandler(
|
|
86728
86750
|
(transition) => this.onBaseTransition(transition)
|
|
@@ -86941,8 +86963,11 @@ var init_paginated_query_client = __esm({
|
|
|
86941
86963
|
if (ongoingSplits.has(pageKey)) {
|
|
86942
86964
|
continue;
|
|
86943
86965
|
}
|
|
86944
|
-
const
|
|
86945
|
-
|
|
86966
|
+
const pageEntry = pageKeyToQuery.get(pageKey);
|
|
86967
|
+
if (!pageEntry) {
|
|
86968
|
+
throw new Error(`No page query for active pageKey ${pageKey}`);
|
|
86969
|
+
}
|
|
86970
|
+
const pageResult = getResult(pageEntry.queryToken);
|
|
86946
86971
|
if (!pageResult) {
|
|
86947
86972
|
continue;
|
|
86948
86973
|
}
|
|
@@ -86953,6 +86978,7 @@ var init_paginated_query_client = __esm({
|
|
|
86953
86978
|
this.splitPaginatedQueryPage(
|
|
86954
86979
|
paginatedQuery,
|
|
86955
86980
|
pageKey,
|
|
86981
|
+
pageEntry.cursor,
|
|
86956
86982
|
result.splitCursor,
|
|
86957
86983
|
// we just checked
|
|
86958
86984
|
result.continueCursor
|
|
@@ -86961,11 +86987,10 @@ var init_paginated_query_client = __esm({
|
|
|
86961
86987
|
}
|
|
86962
86988
|
}
|
|
86963
86989
|
}
|
|
86964
|
-
splitPaginatedQueryPage(paginatedQuery, pageKey, splitCursor, continueCursor) {
|
|
86990
|
+
splitPaginatedQueryPage(paginatedQuery, pageKey, startCursor, splitCursor, continueCursor) {
|
|
86965
86991
|
const splitKey1 = paginatedQuery.nextPageKey++;
|
|
86966
86992
|
const splitKey2 = paginatedQuery.nextPageKey++;
|
|
86967
86993
|
const paginationOpts = {
|
|
86968
|
-
cursor: continueCursor,
|
|
86969
86994
|
numItems: paginatedQuery.options.initialNumItems,
|
|
86970
86995
|
id: paginatedQuery.id
|
|
86971
86996
|
};
|
|
@@ -86975,13 +87000,15 @@ var init_paginated_query_client = __esm({
|
|
|
86975
87000
|
...paginatedQuery.args,
|
|
86976
87001
|
paginationOpts: {
|
|
86977
87002
|
...paginationOpts,
|
|
86978
|
-
cursor:
|
|
86979
|
-
// Start from beginning for first split
|
|
87003
|
+
cursor: startCursor,
|
|
86980
87004
|
endCursor: splitCursor
|
|
86981
87005
|
}
|
|
86982
87006
|
}
|
|
86983
87007
|
);
|
|
86984
|
-
paginatedQuery.pageKeyToQuery.set(splitKey1,
|
|
87008
|
+
paginatedQuery.pageKeyToQuery.set(splitKey1, {
|
|
87009
|
+
...firstSubscription,
|
|
87010
|
+
cursor: startCursor
|
|
87011
|
+
});
|
|
86985
87012
|
const secondSubscription = this.client.subscribe(
|
|
86986
87013
|
paginatedQuery.canonicalizedUdfPath,
|
|
86987
87014
|
{
|
|
@@ -86993,7 +87020,10 @@ var init_paginated_query_client = __esm({
|
|
|
86993
87020
|
}
|
|
86994
87021
|
}
|
|
86995
87022
|
);
|
|
86996
|
-
paginatedQuery.pageKeyToQuery.set(splitKey2,
|
|
87023
|
+
paginatedQuery.pageKeyToQuery.set(splitKey2, {
|
|
87024
|
+
...secondSubscription,
|
|
87025
|
+
cursor: splitCursor
|
|
87026
|
+
});
|
|
86997
87027
|
paginatedQuery.ongoingSplits.set(pageKey, [splitKey1, splitKey2]);
|
|
86998
87028
|
}
|
|
86999
87029
|
/**
|
|
@@ -87016,7 +87046,10 @@ var init_paginated_query_client = __esm({
|
|
|
87016
87046
|
pageArgs
|
|
87017
87047
|
);
|
|
87018
87048
|
paginatedQuery.pageKeys.push(pageKey);
|
|
87019
|
-
paginatedQuery.pageKeyToQuery.set(pageKey,
|
|
87049
|
+
paginatedQuery.pageKeyToQuery.set(pageKey, {
|
|
87050
|
+
...subscription,
|
|
87051
|
+
cursor: continueCursor
|
|
87052
|
+
});
|
|
87020
87053
|
return subscription;
|
|
87021
87054
|
}
|
|
87022
87055
|
removePaginatedQuerySubscriber(token) {
|
|
@@ -87075,18 +87108,18 @@ var init_paginated_query_client = __esm({
|
|
|
87075
87108
|
function setDefaultWebSocketConstructor(ws) {
|
|
87076
87109
|
defaultWebSocketConstructor = ws;
|
|
87077
87110
|
}
|
|
87078
|
-
var
|
|
87111
|
+
var __defProp16, __defNormalProp14, __publicField14, defaultWebSocketConstructor, ConvexClient;
|
|
87079
87112
|
var init_simple_client = __esm({
|
|
87080
87113
|
"../../node_modules/convex/dist/esm/browser/simple_client.js"() {
|
|
87081
87114
|
"use strict";
|
|
87082
87115
|
init_common2();
|
|
87083
|
-
init_browser2();
|
|
87084
87116
|
init_api4();
|
|
87117
|
+
init_client3();
|
|
87085
87118
|
init_paginated_query_client();
|
|
87086
87119
|
init_udf_path_utils();
|
|
87087
|
-
|
|
87088
|
-
|
|
87089
|
-
|
|
87120
|
+
__defProp16 = Object.defineProperty;
|
|
87121
|
+
__defNormalProp14 = (obj, key, value) => key in obj ? __defProp16(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
87122
|
+
__publicField14 = (obj, key, value) => __defNormalProp14(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
87090
87123
|
ConvexClient = class {
|
|
87091
87124
|
/**
|
|
87092
87125
|
* Construct a client and immediately initiate a WebSocket connection to the passed address.
|
|
@@ -87094,12 +87127,12 @@ var init_simple_client = __esm({
|
|
|
87094
87127
|
* @public
|
|
87095
87128
|
*/
|
|
87096
87129
|
constructor(address, options = {}) {
|
|
87097
|
-
|
|
87098
|
-
|
|
87099
|
-
|
|
87100
|
-
|
|
87101
|
-
|
|
87102
|
-
|
|
87130
|
+
__publicField14(this, "listeners");
|
|
87131
|
+
__publicField14(this, "_client");
|
|
87132
|
+
__publicField14(this, "_paginatedClient");
|
|
87133
|
+
__publicField14(this, "callNewListenersWithCurrentValuesTimer");
|
|
87134
|
+
__publicField14(this, "_closed");
|
|
87135
|
+
__publicField14(this, "_disabled");
|
|
87103
87136
|
if (options.skipConvexDeploymentUrlCheck !== true) {
|
|
87104
87137
|
validateDeploymentUrl(address);
|
|
87105
87138
|
}
|
|
@@ -87477,13 +87510,13 @@ var init_simple_client = __esm({
|
|
|
87477
87510
|
// ../../node_modules/convex/dist/esm/browser/simple_client-node.js
|
|
87478
87511
|
import { createRequire } from "module";
|
|
87479
87512
|
import { resolve as nodePathResolve } from "path";
|
|
87480
|
-
var require2, __create3,
|
|
87513
|
+
var require2, __create3, __defProp17, __getOwnPropDesc3, __getOwnPropNames3, __getProtoOf3, __hasOwnProp3, __require2, __commonJS2, __copyProps3, __toESM3, require_constants4, require_node_gyp_build, require_node_gyp_build2, require_fallback, require_bufferutil, require_buffer_util3, require_limiter3, require_permessage_deflate3, require_validation4, require_receiver3, require_sender3, require_event_target3, require_extension3, require_websocket3, require_stream3, require_subprotocol3, require_websocket_server3, import_stream3, import_extension3, import_permessage_deflate3, import_receiver3, import_sender3, import_subprotocol3, import_websocket3, import_websocket_server3, wrapper_default3, nodeWebSocket;
|
|
87481
87514
|
var init_simple_client_node = __esm({
|
|
87482
87515
|
"../../node_modules/convex/dist/esm/browser/simple_client-node.js"() {
|
|
87483
87516
|
init_simple_client();
|
|
87484
87517
|
require2 = createRequire(nodePathResolve("."));
|
|
87485
87518
|
__create3 = Object.create;
|
|
87486
|
-
|
|
87519
|
+
__defProp17 = Object.defineProperty;
|
|
87487
87520
|
__getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
|
|
87488
87521
|
__getOwnPropNames3 = Object.getOwnPropertyNames;
|
|
87489
87522
|
__getProtoOf3 = Object.getPrototypeOf;
|
|
@@ -87501,7 +87534,7 @@ var init_simple_client_node = __esm({
|
|
|
87501
87534
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
87502
87535
|
for (let key of __getOwnPropNames3(from))
|
|
87503
87536
|
if (!__hasOwnProp3.call(to, key) && key !== except)
|
|
87504
|
-
|
|
87537
|
+
__defProp17(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc3(from, key)) || desc.enumerable });
|
|
87505
87538
|
}
|
|
87506
87539
|
return to;
|
|
87507
87540
|
};
|
|
@@ -87510,112 +87543,18 @@ var init_simple_client_node = __esm({
|
|
|
87510
87543
|
// file that has been converted to a CommonJS file using a Babel-
|
|
87511
87544
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
87512
87545
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
87513
|
-
isNodeMode || !mod || !mod.__esModule ?
|
|
87546
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp17(target, "default", { value: mod, enumerable: true }) : target,
|
|
87514
87547
|
mod
|
|
87515
87548
|
));
|
|
87516
|
-
require_stream3 = __commonJS2({
|
|
87517
|
-
"../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/stream.js"(exports, module2) {
|
|
87518
|
-
"use strict";
|
|
87519
|
-
var { Duplex } = __require2("stream");
|
|
87520
|
-
function emitClose(stream) {
|
|
87521
|
-
stream.emit("close");
|
|
87522
|
-
}
|
|
87523
|
-
function duplexOnEnd() {
|
|
87524
|
-
if (!this.destroyed && this._writableState.finished) {
|
|
87525
|
-
this.destroy();
|
|
87526
|
-
}
|
|
87527
|
-
}
|
|
87528
|
-
function duplexOnError(err) {
|
|
87529
|
-
this.removeListener("error", duplexOnError);
|
|
87530
|
-
this.destroy();
|
|
87531
|
-
if (this.listenerCount("error") === 0) {
|
|
87532
|
-
this.emit("error", err);
|
|
87533
|
-
}
|
|
87534
|
-
}
|
|
87535
|
-
function createWebSocketStream22(ws, options) {
|
|
87536
|
-
let terminateOnDestroy = true;
|
|
87537
|
-
const duplex = new Duplex({
|
|
87538
|
-
...options,
|
|
87539
|
-
autoDestroy: false,
|
|
87540
|
-
emitClose: false,
|
|
87541
|
-
objectMode: false,
|
|
87542
|
-
writableObjectMode: false
|
|
87543
|
-
});
|
|
87544
|
-
ws.on("message", function message(msg, isBinary) {
|
|
87545
|
-
const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
87546
|
-
if (!duplex.push(data)) ws.pause();
|
|
87547
|
-
});
|
|
87548
|
-
ws.once("error", function error55(err) {
|
|
87549
|
-
if (duplex.destroyed) return;
|
|
87550
|
-
terminateOnDestroy = false;
|
|
87551
|
-
duplex.destroy(err);
|
|
87552
|
-
});
|
|
87553
|
-
ws.once("close", function close2() {
|
|
87554
|
-
if (duplex.destroyed) return;
|
|
87555
|
-
duplex.push(null);
|
|
87556
|
-
});
|
|
87557
|
-
duplex._destroy = function(err, callback) {
|
|
87558
|
-
if (ws.readyState === ws.CLOSED) {
|
|
87559
|
-
callback(err);
|
|
87560
|
-
process.nextTick(emitClose, duplex);
|
|
87561
|
-
return;
|
|
87562
|
-
}
|
|
87563
|
-
let called = false;
|
|
87564
|
-
ws.once("error", function error55(err2) {
|
|
87565
|
-
called = true;
|
|
87566
|
-
callback(err2);
|
|
87567
|
-
});
|
|
87568
|
-
ws.once("close", function close2() {
|
|
87569
|
-
if (!called) callback(err);
|
|
87570
|
-
process.nextTick(emitClose, duplex);
|
|
87571
|
-
});
|
|
87572
|
-
if (terminateOnDestroy) ws.terminate();
|
|
87573
|
-
};
|
|
87574
|
-
duplex._final = function(callback) {
|
|
87575
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
87576
|
-
ws.once("open", function open3() {
|
|
87577
|
-
duplex._final(callback);
|
|
87578
|
-
});
|
|
87579
|
-
return;
|
|
87580
|
-
}
|
|
87581
|
-
if (ws._socket === null) return;
|
|
87582
|
-
if (ws._socket._writableState.finished) {
|
|
87583
|
-
callback();
|
|
87584
|
-
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
87585
|
-
} else {
|
|
87586
|
-
ws._socket.once("finish", function finish() {
|
|
87587
|
-
callback();
|
|
87588
|
-
});
|
|
87589
|
-
ws.close();
|
|
87590
|
-
}
|
|
87591
|
-
};
|
|
87592
|
-
duplex._read = function() {
|
|
87593
|
-
if (ws.isPaused) ws.resume();
|
|
87594
|
-
};
|
|
87595
|
-
duplex._write = function(chunk2, encoding, callback) {
|
|
87596
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
87597
|
-
ws.once("open", function open3() {
|
|
87598
|
-
duplex._write(chunk2, encoding, callback);
|
|
87599
|
-
});
|
|
87600
|
-
return;
|
|
87601
|
-
}
|
|
87602
|
-
ws.send(chunk2, callback);
|
|
87603
|
-
};
|
|
87604
|
-
duplex.on("end", duplexOnEnd);
|
|
87605
|
-
duplex.on("error", duplexOnError);
|
|
87606
|
-
return duplex;
|
|
87607
|
-
}
|
|
87608
|
-
module2.exports = createWebSocketStream22;
|
|
87609
|
-
}
|
|
87610
|
-
});
|
|
87611
87549
|
require_constants4 = __commonJS2({
|
|
87612
|
-
"../
|
|
87550
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/constants.js"(exports, module2) {
|
|
87613
87551
|
"use strict";
|
|
87614
87552
|
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
87615
87553
|
var hasBlob = typeof Blob !== "undefined";
|
|
87616
87554
|
if (hasBlob) BINARY_TYPES.push("blob");
|
|
87617
87555
|
module2.exports = {
|
|
87618
87556
|
BINARY_TYPES,
|
|
87557
|
+
CLOSE_TIMEOUT: 3e4,
|
|
87619
87558
|
EMPTY_BUFFER: Buffer.alloc(0),
|
|
87620
87559
|
GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
|
|
87621
87560
|
hasBlob,
|
|
@@ -87629,19 +87568,19 @@ var init_simple_client_node = __esm({
|
|
|
87629
87568
|
}
|
|
87630
87569
|
});
|
|
87631
87570
|
require_node_gyp_build = __commonJS2({
|
|
87632
|
-
"../
|
|
87571
|
+
"../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/node-gyp-build.js"(exports, module2) {
|
|
87633
87572
|
var fs84 = __require2("fs");
|
|
87634
87573
|
var path108 = __require2("path");
|
|
87635
87574
|
var os45 = __require2("os");
|
|
87636
87575
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require2;
|
|
87637
|
-
var
|
|
87576
|
+
var vars2 = process.config && process.config.variables || {};
|
|
87638
87577
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
87639
87578
|
var abi = process.versions.modules;
|
|
87640
87579
|
var runtime = isElectron2() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
87641
87580
|
var arch2 = process.env.npm_config_arch || os45.arch();
|
|
87642
87581
|
var platform3 = process.env.npm_config_platform || os45.platform();
|
|
87643
87582
|
var libc = process.env.LIBC || (isAlpine(platform3) ? "musl" : "glibc");
|
|
87644
|
-
var armv = process.env.ARM_VERSION || (arch2 === "arm64" ? "8" :
|
|
87583
|
+
var armv = process.env.ARM_VERSION || (arch2 === "arm64" ? "8" : vars2.arm_version) || "";
|
|
87645
87584
|
var uv = (process.versions.uv || "").split(".")[0];
|
|
87646
87585
|
module2.exports = load2;
|
|
87647
87586
|
function load2(dir) {
|
|
@@ -87725,9 +87664,9 @@ var init_simple_client_node = __esm({
|
|
|
87725
87664
|
}
|
|
87726
87665
|
function parseTags(file3) {
|
|
87727
87666
|
var arr2 = file3.split(".");
|
|
87728
|
-
var
|
|
87667
|
+
var extension22 = arr2.pop();
|
|
87729
87668
|
var tags = { file: file3, specificity: 0 };
|
|
87730
|
-
if (
|
|
87669
|
+
if (extension22 !== "node") return;
|
|
87731
87670
|
for (var i2 = 0; i2 < arr2.length; i2++) {
|
|
87732
87671
|
var tag = arr2[i2];
|
|
87733
87672
|
if (tag === "node" || tag === "electron" || tag === "node-webkit") {
|
|
@@ -87796,7 +87735,7 @@ var init_simple_client_node = __esm({
|
|
|
87796
87735
|
}
|
|
87797
87736
|
});
|
|
87798
87737
|
require_node_gyp_build2 = __commonJS2({
|
|
87799
|
-
"../
|
|
87738
|
+
"../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/index.js"(exports, module2) {
|
|
87800
87739
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require2;
|
|
87801
87740
|
if (typeof runtimeRequire.addon === "function") {
|
|
87802
87741
|
module2.exports = runtimeRequire.addon.bind(runtimeRequire);
|
|
@@ -87806,7 +87745,7 @@ var init_simple_client_node = __esm({
|
|
|
87806
87745
|
}
|
|
87807
87746
|
});
|
|
87808
87747
|
require_fallback = __commonJS2({
|
|
87809
|
-
"../
|
|
87748
|
+
"../node_modules/.pnpm/bufferutil@4.0.9/node_modules/bufferutil/fallback.js"(exports, module2) {
|
|
87810
87749
|
"use strict";
|
|
87811
87750
|
var mask = (source, mask2, output, offset, length) => {
|
|
87812
87751
|
for (var i2 = 0; i2 < length; i2++) {
|
|
@@ -87823,7 +87762,7 @@ var init_simple_client_node = __esm({
|
|
|
87823
87762
|
}
|
|
87824
87763
|
});
|
|
87825
87764
|
require_bufferutil = __commonJS2({
|
|
87826
|
-
"../
|
|
87765
|
+
"../node_modules/.pnpm/bufferutil@4.0.9/node_modules/bufferutil/index.js"(exports, module2) {
|
|
87827
87766
|
"use strict";
|
|
87828
87767
|
try {
|
|
87829
87768
|
module2.exports = require_node_gyp_build2()(__dirname);
|
|
@@ -87833,7 +87772,7 @@ var init_simple_client_node = __esm({
|
|
|
87833
87772
|
}
|
|
87834
87773
|
});
|
|
87835
87774
|
require_buffer_util3 = __commonJS2({
|
|
87836
|
-
"../
|
|
87775
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/buffer-util.js"(exports, module2) {
|
|
87837
87776
|
"use strict";
|
|
87838
87777
|
var { EMPTY_BUFFER } = require_constants4();
|
|
87839
87778
|
var FastBuffer = Buffer[Symbol.species];
|
|
@@ -87906,7 +87845,7 @@ var init_simple_client_node = __esm({
|
|
|
87906
87845
|
}
|
|
87907
87846
|
});
|
|
87908
87847
|
require_limiter3 = __commonJS2({
|
|
87909
|
-
"../
|
|
87848
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/limiter.js"(exports, module2) {
|
|
87910
87849
|
"use strict";
|
|
87911
87850
|
var kDone = /* @__PURE__ */ Symbol("kDone");
|
|
87912
87851
|
var kRun = /* @__PURE__ */ Symbol("kRun");
|
|
@@ -87954,7 +87893,7 @@ var init_simple_client_node = __esm({
|
|
|
87954
87893
|
}
|
|
87955
87894
|
});
|
|
87956
87895
|
require_permessage_deflate3 = __commonJS2({
|
|
87957
|
-
"../
|
|
87896
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/permessage-deflate.js"(exports, module2) {
|
|
87958
87897
|
"use strict";
|
|
87959
87898
|
var zlib = __require2("zlib");
|
|
87960
87899
|
var bufferUtil = require_buffer_util3();
|
|
@@ -87968,7 +87907,7 @@ var init_simple_client_node = __esm({
|
|
|
87968
87907
|
var kBuffers = /* @__PURE__ */ Symbol("buffers");
|
|
87969
87908
|
var kError = /* @__PURE__ */ Symbol("error");
|
|
87970
87909
|
var zlibLimiter;
|
|
87971
|
-
var
|
|
87910
|
+
var PerMessageDeflate22 = class {
|
|
87972
87911
|
/**
|
|
87973
87912
|
* Creates a PerMessageDeflate instance.
|
|
87974
87913
|
*
|
|
@@ -87979,6 +87918,9 @@ var init_simple_client_node = __esm({
|
|
|
87979
87918
|
* acknowledge disabling of client context takeover
|
|
87980
87919
|
* @param {Number} [options.concurrencyLimit=10] The number of concurrent
|
|
87981
87920
|
* calls to zlib
|
|
87921
|
+
* @param {Boolean} [options.isServer=false] Create the instance in either
|
|
87922
|
+
* server or client mode
|
|
87923
|
+
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
|
87982
87924
|
* @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
|
|
87983
87925
|
* use of a custom server window size
|
|
87984
87926
|
* @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
|
|
@@ -87989,15 +87931,12 @@ var init_simple_client_node = __esm({
|
|
|
87989
87931
|
* deflate
|
|
87990
87932
|
* @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
|
|
87991
87933
|
* inflate
|
|
87992
|
-
* @param {Boolean} [isServer=false] Create the instance in either server or
|
|
87993
|
-
* client mode
|
|
87994
|
-
* @param {Number} [maxPayload=0] The maximum allowed message length
|
|
87995
87934
|
*/
|
|
87996
|
-
constructor(options
|
|
87997
|
-
this._maxPayload = maxPayload | 0;
|
|
87935
|
+
constructor(options) {
|
|
87998
87936
|
this._options = options || {};
|
|
87999
87937
|
this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024;
|
|
88000
|
-
this.
|
|
87938
|
+
this._maxPayload = this._options.maxPayload | 0;
|
|
87939
|
+
this._isServer = !!this._options.isServer;
|
|
88001
87940
|
this._deflate = null;
|
|
88002
87941
|
this._inflate = null;
|
|
88003
87942
|
this.params = null;
|
|
@@ -88306,7 +88245,7 @@ var init_simple_client_node = __esm({
|
|
|
88306
88245
|
});
|
|
88307
88246
|
}
|
|
88308
88247
|
};
|
|
88309
|
-
module2.exports =
|
|
88248
|
+
module2.exports = PerMessageDeflate22;
|
|
88310
88249
|
function deflateOnData(chunk2) {
|
|
88311
88250
|
this[kBuffers].push(chunk2);
|
|
88312
88251
|
this[kTotalLength] += chunk2.length;
|
|
@@ -88325,13 +88264,17 @@ var init_simple_client_node = __esm({
|
|
|
88325
88264
|
}
|
|
88326
88265
|
function inflateOnError(err) {
|
|
88327
88266
|
this[kPerMessageDeflate]._inflate = null;
|
|
88267
|
+
if (this[kError]) {
|
|
88268
|
+
this[kCallback](this[kError]);
|
|
88269
|
+
return;
|
|
88270
|
+
}
|
|
88328
88271
|
err[kStatusCode] = 1007;
|
|
88329
88272
|
this[kCallback](err);
|
|
88330
88273
|
}
|
|
88331
88274
|
}
|
|
88332
88275
|
});
|
|
88333
88276
|
require_validation4 = __commonJS2({
|
|
88334
|
-
"../
|
|
88277
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/validation.js"(exports, module2) {
|
|
88335
88278
|
"use strict";
|
|
88336
88279
|
var { isUtf8 } = __require2("buffer");
|
|
88337
88280
|
var { hasBlob } = require_constants4();
|
|
@@ -88530,10 +88473,10 @@ var init_simple_client_node = __esm({
|
|
|
88530
88473
|
}
|
|
88531
88474
|
});
|
|
88532
88475
|
require_receiver3 = __commonJS2({
|
|
88533
|
-
"../
|
|
88476
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/receiver.js"(exports, module2) {
|
|
88534
88477
|
"use strict";
|
|
88535
88478
|
var { Writable } = __require2("stream");
|
|
88536
|
-
var
|
|
88479
|
+
var PerMessageDeflate22 = require_permessage_deflate3();
|
|
88537
88480
|
var {
|
|
88538
88481
|
BINARY_TYPES,
|
|
88539
88482
|
EMPTY_BUFFER,
|
|
@@ -88563,6 +88506,10 @@ var init_simple_client_node = __esm({
|
|
|
88563
88506
|
* extensions
|
|
88564
88507
|
* @param {Boolean} [options.isServer=false] Specifies whether to operate in
|
|
88565
88508
|
* client or server mode
|
|
88509
|
+
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
88510
|
+
* buffered data chunks
|
|
88511
|
+
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
88512
|
+
* fragments
|
|
88566
88513
|
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
|
88567
88514
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
88568
88515
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -88573,6 +88520,8 @@ var init_simple_client_node = __esm({
|
|
|
88573
88520
|
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
|
88574
88521
|
this._extensions = options.extensions || {};
|
|
88575
88522
|
this._isServer = !!options.isServer;
|
|
88523
|
+
this._maxBufferedChunks = options.maxBufferedChunks | 0;
|
|
88524
|
+
this._maxFragments = options.maxFragments | 0;
|
|
88576
88525
|
this._maxPayload = options.maxPayload | 0;
|
|
88577
88526
|
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
|
88578
88527
|
this[kWebSocket] = void 0;
|
|
@@ -88602,6 +88551,18 @@ var init_simple_client_node = __esm({
|
|
|
88602
88551
|
*/
|
|
88603
88552
|
_write(chunk2, encoding, cb) {
|
|
88604
88553
|
if (this._opcode === 8 && this._state == GET_INFO) return cb();
|
|
88554
|
+
if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
|
|
88555
|
+
cb(
|
|
88556
|
+
this.createError(
|
|
88557
|
+
RangeError,
|
|
88558
|
+
"Too many buffered chunks",
|
|
88559
|
+
false,
|
|
88560
|
+
1008,
|
|
88561
|
+
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
88562
|
+
)
|
|
88563
|
+
);
|
|
88564
|
+
return;
|
|
88565
|
+
}
|
|
88605
88566
|
this._bufferedBytes += chunk2.length;
|
|
88606
88567
|
this._buffers.push(chunk2);
|
|
88607
88568
|
this.startLoop(cb);
|
|
@@ -88700,7 +88661,7 @@ var init_simple_client_node = __esm({
|
|
|
88700
88661
|
return;
|
|
88701
88662
|
}
|
|
88702
88663
|
const compressed = (buf[0] & 64) === 64;
|
|
88703
|
-
if (compressed && !this._extensions[
|
|
88664
|
+
if (compressed && !this._extensions[PerMessageDeflate22.extensionName]) {
|
|
88704
88665
|
const error55 = this.createError(
|
|
88705
88666
|
RangeError,
|
|
88706
88667
|
"RSV1 must be clear",
|
|
@@ -88931,6 +88892,17 @@ var init_simple_client_node = __esm({
|
|
|
88931
88892
|
return;
|
|
88932
88893
|
}
|
|
88933
88894
|
if (data.length) {
|
|
88895
|
+
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
|
|
88896
|
+
const error55 = this.createError(
|
|
88897
|
+
RangeError,
|
|
88898
|
+
"Too many message fragments",
|
|
88899
|
+
false,
|
|
88900
|
+
1008,
|
|
88901
|
+
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
88902
|
+
);
|
|
88903
|
+
cb(error55);
|
|
88904
|
+
return;
|
|
88905
|
+
}
|
|
88934
88906
|
this._messageLength = this._totalPayloadLength;
|
|
88935
88907
|
this._fragments.push(data);
|
|
88936
88908
|
}
|
|
@@ -88944,7 +88916,7 @@ var init_simple_client_node = __esm({
|
|
|
88944
88916
|
* @private
|
|
88945
88917
|
*/
|
|
88946
88918
|
decompress(data, cb) {
|
|
88947
|
-
const perMessageDeflate = this._extensions[
|
|
88919
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate22.extensionName];
|
|
88948
88920
|
perMessageDeflate.decompress(data, this._fin, (err, buf) => {
|
|
88949
88921
|
if (err) return cb(err);
|
|
88950
88922
|
if (buf.length) {
|
|
@@ -88960,6 +88932,17 @@ var init_simple_client_node = __esm({
|
|
|
88960
88932
|
cb(error55);
|
|
88961
88933
|
return;
|
|
88962
88934
|
}
|
|
88935
|
+
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
|
|
88936
|
+
const error55 = this.createError(
|
|
88937
|
+
RangeError,
|
|
88938
|
+
"Too many message fragments",
|
|
88939
|
+
false,
|
|
88940
|
+
1008,
|
|
88941
|
+
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
88942
|
+
);
|
|
88943
|
+
cb(error55);
|
|
88944
|
+
return;
|
|
88945
|
+
}
|
|
88963
88946
|
this._fragments.push(buf);
|
|
88964
88947
|
}
|
|
88965
88948
|
this.dataMessage(cb);
|
|
@@ -89120,11 +89103,14 @@ var init_simple_client_node = __esm({
|
|
|
89120
89103
|
}
|
|
89121
89104
|
});
|
|
89122
89105
|
require_sender3 = __commonJS2({
|
|
89123
|
-
"../
|
|
89106
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/sender.js"(exports, module2) {
|
|
89124
89107
|
"use strict";
|
|
89125
89108
|
var { Duplex } = __require2("stream");
|
|
89126
89109
|
var { randomFillSync } = __require2("crypto");
|
|
89127
|
-
var
|
|
89110
|
+
var {
|
|
89111
|
+
types: { isUint8Array: isUint8Array2 }
|
|
89112
|
+
} = __require2("util");
|
|
89113
|
+
var PerMessageDeflate22 = require_permessage_deflate3();
|
|
89128
89114
|
var { EMPTY_BUFFER, kWebSocket, NOOP: NOOP2 } = require_constants4();
|
|
89129
89115
|
var { isBlob, isValidStatusCode } = require_validation4();
|
|
89130
89116
|
var { mask: applyMask, toBuffer } = require_buffer_util3();
|
|
@@ -89277,8 +89263,10 @@ var init_simple_client_node = __esm({
|
|
|
89277
89263
|
buf.writeUInt16BE(code2, 0);
|
|
89278
89264
|
if (typeof data === "string") {
|
|
89279
89265
|
buf.write(data, 2);
|
|
89280
|
-
} else {
|
|
89266
|
+
} else if (isUint8Array2(data)) {
|
|
89281
89267
|
buf.set(data, 2);
|
|
89268
|
+
} else {
|
|
89269
|
+
throw new TypeError("Second argument must be a string or a Uint8Array");
|
|
89282
89270
|
}
|
|
89283
89271
|
}
|
|
89284
89272
|
const options = {
|
|
@@ -89408,7 +89396,7 @@ var init_simple_client_node = __esm({
|
|
|
89408
89396
|
* @public
|
|
89409
89397
|
*/
|
|
89410
89398
|
send(data, options, cb) {
|
|
89411
|
-
const perMessageDeflate = this._extensions[
|
|
89399
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate22.extensionName];
|
|
89412
89400
|
let opcode = options.binary ? 2 : 1;
|
|
89413
89401
|
let rsv1 = options.compress;
|
|
89414
89402
|
let byteLength2;
|
|
@@ -89532,7 +89520,7 @@ var init_simple_client_node = __esm({
|
|
|
89532
89520
|
this.sendFrame(_Sender.frame(data, options), cb);
|
|
89533
89521
|
return;
|
|
89534
89522
|
}
|
|
89535
|
-
const perMessageDeflate = this._extensions[
|
|
89523
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate22.extensionName];
|
|
89536
89524
|
this._bufferedBytes += options[kByteLength];
|
|
89537
89525
|
this._state = DEFLATING;
|
|
89538
89526
|
perMessageDeflate.compress(data, options.fin, (_2, buf) => {
|
|
@@ -89575,7 +89563,7 @@ var init_simple_client_node = __esm({
|
|
|
89575
89563
|
/**
|
|
89576
89564
|
* Sends a frame.
|
|
89577
89565
|
*
|
|
89578
|
-
* @param {Buffer[]} list The frame to send
|
|
89566
|
+
* @param {(Buffer | String)[]} list The frame to send
|
|
89579
89567
|
* @param {Function} [cb] Callback
|
|
89580
89568
|
* @private
|
|
89581
89569
|
*/
|
|
@@ -89606,7 +89594,7 @@ var init_simple_client_node = __esm({
|
|
|
89606
89594
|
}
|
|
89607
89595
|
});
|
|
89608
89596
|
require_event_target3 = __commonJS2({
|
|
89609
|
-
"../
|
|
89597
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/event-target.js"(exports, module2) {
|
|
89610
89598
|
"use strict";
|
|
89611
89599
|
var { kForOnEventAttribute, kListener } = require_constants4();
|
|
89612
89600
|
var kCode = /* @__PURE__ */ Symbol("kCode");
|
|
@@ -89833,7 +89821,7 @@ var init_simple_client_node = __esm({
|
|
|
89833
89821
|
}
|
|
89834
89822
|
});
|
|
89835
89823
|
require_extension3 = __commonJS2({
|
|
89836
|
-
"../
|
|
89824
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/extension.js"(exports, module2) {
|
|
89837
89825
|
"use strict";
|
|
89838
89826
|
var { tokenChars } = require_validation4();
|
|
89839
89827
|
function push(dest, name, elem) {
|
|
@@ -89966,11 +89954,11 @@ var init_simple_client_node = __esm({
|
|
|
89966
89954
|
return offers;
|
|
89967
89955
|
}
|
|
89968
89956
|
function format2(extensions2) {
|
|
89969
|
-
return Object.keys(extensions2).map((
|
|
89970
|
-
let configurations = extensions2[
|
|
89957
|
+
return Object.keys(extensions2).map((extension22) => {
|
|
89958
|
+
let configurations = extensions2[extension22];
|
|
89971
89959
|
if (!Array.isArray(configurations)) configurations = [configurations];
|
|
89972
89960
|
return configurations.map((params) => {
|
|
89973
|
-
return [
|
|
89961
|
+
return [extension22].concat(
|
|
89974
89962
|
Object.keys(params).map((k3) => {
|
|
89975
89963
|
let values = params[k3];
|
|
89976
89964
|
if (!Array.isArray(values)) values = [values];
|
|
@@ -89984,7 +89972,7 @@ var init_simple_client_node = __esm({
|
|
|
89984
89972
|
}
|
|
89985
89973
|
});
|
|
89986
89974
|
require_websocket3 = __commonJS2({
|
|
89987
|
-
"../
|
|
89975
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/websocket.js"(exports, module2) {
|
|
89988
89976
|
"use strict";
|
|
89989
89977
|
var EventEmitter6 = __require2("events");
|
|
89990
89978
|
var https4 = __require2("https");
|
|
@@ -89994,12 +89982,13 @@ var init_simple_client_node = __esm({
|
|
|
89994
89982
|
var { randomBytes: randomBytes15, createHash: createHash29 } = __require2("crypto");
|
|
89995
89983
|
var { Duplex, Readable: Readable3 } = __require2("stream");
|
|
89996
89984
|
var { URL: URL3 } = __require2("url");
|
|
89997
|
-
var
|
|
89985
|
+
var PerMessageDeflate22 = require_permessage_deflate3();
|
|
89998
89986
|
var Receiver22 = require_receiver3();
|
|
89999
89987
|
var Sender22 = require_sender3();
|
|
90000
89988
|
var { isBlob } = require_validation4();
|
|
90001
89989
|
var {
|
|
90002
89990
|
BINARY_TYPES,
|
|
89991
|
+
CLOSE_TIMEOUT,
|
|
90003
89992
|
EMPTY_BUFFER,
|
|
90004
89993
|
GUID,
|
|
90005
89994
|
kForOnEventAttribute,
|
|
@@ -90013,7 +90002,6 @@ var init_simple_client_node = __esm({
|
|
|
90013
90002
|
} = require_event_target3();
|
|
90014
90003
|
var { format: format2, parse: parse8 } = require_extension3();
|
|
90015
90004
|
var { toBuffer } = require_buffer_util3();
|
|
90016
|
-
var closeTimeout = 30 * 1e3;
|
|
90017
90005
|
var kAborted = /* @__PURE__ */ Symbol("kAborted");
|
|
90018
90006
|
var protocolVersions = [8, 13];
|
|
90019
90007
|
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
@@ -90059,6 +90047,7 @@ var init_simple_client_node = __esm({
|
|
|
90059
90047
|
initAsClient(this, address, protocols, options);
|
|
90060
90048
|
} else {
|
|
90061
90049
|
this._autoPong = options.autoPong;
|
|
90050
|
+
this._closeTimeout = options.closeTimeout;
|
|
90062
90051
|
this._isServer = true;
|
|
90063
90052
|
}
|
|
90064
90053
|
}
|
|
@@ -90152,6 +90141,10 @@ var init_simple_client_node = __esm({
|
|
|
90152
90141
|
* multiple times in the same tick
|
|
90153
90142
|
* @param {Function} [options.generateMask] The function used to generate the
|
|
90154
90143
|
* masking key
|
|
90144
|
+
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
90145
|
+
* buffered data chunks
|
|
90146
|
+
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
90147
|
+
* fragments
|
|
90155
90148
|
* @param {Number} [options.maxPayload=0] The maximum allowed message size
|
|
90156
90149
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
90157
90150
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -90163,6 +90156,8 @@ var init_simple_client_node = __esm({
|
|
|
90163
90156
|
binaryType: this.binaryType,
|
|
90164
90157
|
extensions: this._extensions,
|
|
90165
90158
|
isServer: this._isServer,
|
|
90159
|
+
maxBufferedChunks: options.maxBufferedChunks,
|
|
90160
|
+
maxFragments: options.maxFragments,
|
|
90166
90161
|
maxPayload: options.maxPayload,
|
|
90167
90162
|
skipUTF8Validation: options.skipUTF8Validation
|
|
90168
90163
|
});
|
|
@@ -90201,8 +90196,8 @@ var init_simple_client_node = __esm({
|
|
|
90201
90196
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
90202
90197
|
return;
|
|
90203
90198
|
}
|
|
90204
|
-
if (this._extensions[
|
|
90205
|
-
this._extensions[
|
|
90199
|
+
if (this._extensions[PerMessageDeflate22.extensionName]) {
|
|
90200
|
+
this._extensions[PerMessageDeflate22.extensionName].cleanup();
|
|
90206
90201
|
}
|
|
90207
90202
|
this._receiver.removeAllListeners();
|
|
90208
90203
|
this._readyState = _WebSocket.CLOSED;
|
|
@@ -90364,7 +90359,7 @@ var init_simple_client_node = __esm({
|
|
|
90364
90359
|
fin: true,
|
|
90365
90360
|
...options
|
|
90366
90361
|
};
|
|
90367
|
-
if (!this._extensions[
|
|
90362
|
+
if (!this._extensions[PerMessageDeflate22.extensionName]) {
|
|
90368
90363
|
opts.compress = false;
|
|
90369
90364
|
}
|
|
90370
90365
|
this._sender.send(data || EMPTY_BUFFER, opts, cb);
|
|
@@ -90460,7 +90455,10 @@ var init_simple_client_node = __esm({
|
|
|
90460
90455
|
const opts = {
|
|
90461
90456
|
allowSynchronousEvents: true,
|
|
90462
90457
|
autoPong: true,
|
|
90458
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
90463
90459
|
protocolVersion: protocolVersions[1],
|
|
90460
|
+
maxBufferedChunks: 1024 * 1024,
|
|
90461
|
+
maxFragments: 128 * 1024,
|
|
90464
90462
|
maxPayload: 100 * 1024 * 1024,
|
|
90465
90463
|
skipUTF8Validation: false,
|
|
90466
90464
|
perMessageDeflate: true,
|
|
@@ -90477,6 +90475,7 @@ var init_simple_client_node = __esm({
|
|
|
90477
90475
|
port: void 0
|
|
90478
90476
|
};
|
|
90479
90477
|
websocket._autoPong = opts.autoPong;
|
|
90478
|
+
websocket._closeTimeout = opts.closeTimeout;
|
|
90480
90479
|
if (!protocolVersions.includes(opts.protocolVersion)) {
|
|
90481
90480
|
throw new RangeError(
|
|
90482
90481
|
`Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`
|
|
@@ -90488,7 +90487,7 @@ var init_simple_client_node = __esm({
|
|
|
90488
90487
|
} else {
|
|
90489
90488
|
try {
|
|
90490
90489
|
parsedUrl = new URL3(address);
|
|
90491
|
-
} catch
|
|
90490
|
+
} catch {
|
|
90492
90491
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
90493
90492
|
}
|
|
90494
90493
|
}
|
|
@@ -90502,7 +90501,7 @@ var init_simple_client_node = __esm({
|
|
|
90502
90501
|
const isIpcUrl = parsedUrl.protocol === "ws+unix:";
|
|
90503
90502
|
let invalidUrlMessage;
|
|
90504
90503
|
if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) {
|
|
90505
|
-
invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`;
|
|
90504
|
+
invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;
|
|
90506
90505
|
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
90507
90506
|
invalidUrlMessage = "The URL's pathname is empty";
|
|
90508
90507
|
} else if (parsedUrl.hash) {
|
|
@@ -90536,13 +90535,13 @@ var init_simple_client_node = __esm({
|
|
|
90536
90535
|
opts.path = parsedUrl.pathname + parsedUrl.search;
|
|
90537
90536
|
opts.timeout = opts.handshakeTimeout;
|
|
90538
90537
|
if (opts.perMessageDeflate) {
|
|
90539
|
-
perMessageDeflate = new
|
|
90540
|
-
opts.perMessageDeflate
|
|
90541
|
-
false,
|
|
90542
|
-
opts.maxPayload
|
|
90543
|
-
);
|
|
90538
|
+
perMessageDeflate = new PerMessageDeflate22({
|
|
90539
|
+
...opts.perMessageDeflate,
|
|
90540
|
+
isServer: false,
|
|
90541
|
+
maxPayload: opts.maxPayload
|
|
90542
|
+
});
|
|
90544
90543
|
opts.headers["Sec-WebSocket-Extensions"] = format2({
|
|
90545
|
-
[
|
|
90544
|
+
[PerMessageDeflate22.extensionName]: perMessageDeflate.offer()
|
|
90546
90545
|
});
|
|
90547
90546
|
}
|
|
90548
90547
|
if (protocols.length) {
|
|
@@ -90685,23 +90684,25 @@ var init_simple_client_node = __esm({
|
|
|
90685
90684
|
return;
|
|
90686
90685
|
}
|
|
90687
90686
|
const extensionNames = Object.keys(extensions2);
|
|
90688
|
-
if (extensionNames.length !== 1 || extensionNames[0] !==
|
|
90687
|
+
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate22.extensionName) {
|
|
90689
90688
|
const message = "Server indicated an extension that was not requested";
|
|
90690
90689
|
abortHandshake(websocket, socket, message);
|
|
90691
90690
|
return;
|
|
90692
90691
|
}
|
|
90693
90692
|
try {
|
|
90694
|
-
perMessageDeflate.accept(extensions2[
|
|
90693
|
+
perMessageDeflate.accept(extensions2[PerMessageDeflate22.extensionName]);
|
|
90695
90694
|
} catch (err) {
|
|
90696
90695
|
const message = "Invalid Sec-WebSocket-Extensions header";
|
|
90697
90696
|
abortHandshake(websocket, socket, message);
|
|
90698
90697
|
return;
|
|
90699
90698
|
}
|
|
90700
|
-
websocket._extensions[
|
|
90699
|
+
websocket._extensions[PerMessageDeflate22.extensionName] = perMessageDeflate;
|
|
90701
90700
|
}
|
|
90702
90701
|
websocket.setSocket(socket, head, {
|
|
90703
90702
|
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
90704
90703
|
generateMask: opts.generateMask,
|
|
90704
|
+
maxBufferedChunks: opts.maxBufferedChunks,
|
|
90705
|
+
maxFragments: opts.maxFragments,
|
|
90705
90706
|
maxPayload: opts.maxPayload,
|
|
90706
90707
|
skipUTF8Validation: opts.skipUTF8Validation
|
|
90707
90708
|
});
|
|
@@ -90819,7 +90820,7 @@ var init_simple_client_node = __esm({
|
|
|
90819
90820
|
function setCloseTimer(websocket) {
|
|
90820
90821
|
websocket._closeTimer = setTimeout(
|
|
90821
90822
|
websocket._socket.destroy.bind(websocket._socket),
|
|
90822
|
-
|
|
90823
|
+
websocket._closeTimeout
|
|
90823
90824
|
);
|
|
90824
90825
|
}
|
|
90825
90826
|
function socketOnClose() {
|
|
@@ -90828,8 +90829,8 @@ var init_simple_client_node = __esm({
|
|
|
90828
90829
|
this.removeListener("data", socketOnData);
|
|
90829
90830
|
this.removeListener("end", socketOnEnd);
|
|
90830
90831
|
websocket._readyState = WebSocket22.CLOSING;
|
|
90831
|
-
|
|
90832
|
-
|
|
90832
|
+
if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
|
|
90833
|
+
const chunk2 = this.read(this._readableState.length);
|
|
90833
90834
|
websocket._receiver.write(chunk2);
|
|
90834
90835
|
}
|
|
90835
90836
|
websocket._receiver.end();
|
|
@@ -90864,8 +90865,104 @@ var init_simple_client_node = __esm({
|
|
|
90864
90865
|
}
|
|
90865
90866
|
}
|
|
90866
90867
|
});
|
|
90868
|
+
require_stream3 = __commonJS2({
|
|
90869
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/stream.js"(exports, module2) {
|
|
90870
|
+
"use strict";
|
|
90871
|
+
var WebSocket22 = require_websocket3();
|
|
90872
|
+
var { Duplex } = __require2("stream");
|
|
90873
|
+
function emitClose(stream) {
|
|
90874
|
+
stream.emit("close");
|
|
90875
|
+
}
|
|
90876
|
+
function duplexOnEnd() {
|
|
90877
|
+
if (!this.destroyed && this._writableState.finished) {
|
|
90878
|
+
this.destroy();
|
|
90879
|
+
}
|
|
90880
|
+
}
|
|
90881
|
+
function duplexOnError(err) {
|
|
90882
|
+
this.removeListener("error", duplexOnError);
|
|
90883
|
+
this.destroy();
|
|
90884
|
+
if (this.listenerCount("error") === 0) {
|
|
90885
|
+
this.emit("error", err);
|
|
90886
|
+
}
|
|
90887
|
+
}
|
|
90888
|
+
function createWebSocketStream22(ws, options) {
|
|
90889
|
+
let terminateOnDestroy = true;
|
|
90890
|
+
const duplex = new Duplex({
|
|
90891
|
+
...options,
|
|
90892
|
+
autoDestroy: false,
|
|
90893
|
+
emitClose: false,
|
|
90894
|
+
objectMode: false,
|
|
90895
|
+
writableObjectMode: false
|
|
90896
|
+
});
|
|
90897
|
+
ws.on("message", function message(msg, isBinary) {
|
|
90898
|
+
const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
90899
|
+
if (!duplex.push(data)) ws.pause();
|
|
90900
|
+
});
|
|
90901
|
+
ws.once("error", function error55(err) {
|
|
90902
|
+
if (duplex.destroyed) return;
|
|
90903
|
+
terminateOnDestroy = false;
|
|
90904
|
+
duplex.destroy(err);
|
|
90905
|
+
});
|
|
90906
|
+
ws.once("close", function close2() {
|
|
90907
|
+
if (duplex.destroyed) return;
|
|
90908
|
+
duplex.push(null);
|
|
90909
|
+
});
|
|
90910
|
+
duplex._destroy = function(err, callback) {
|
|
90911
|
+
if (ws.readyState === ws.CLOSED) {
|
|
90912
|
+
callback(err);
|
|
90913
|
+
process.nextTick(emitClose, duplex);
|
|
90914
|
+
return;
|
|
90915
|
+
}
|
|
90916
|
+
let called = false;
|
|
90917
|
+
ws.once("error", function error55(err2) {
|
|
90918
|
+
called = true;
|
|
90919
|
+
callback(err2);
|
|
90920
|
+
});
|
|
90921
|
+
ws.once("close", function close2() {
|
|
90922
|
+
if (!called) callback(err);
|
|
90923
|
+
process.nextTick(emitClose, duplex);
|
|
90924
|
+
});
|
|
90925
|
+
if (terminateOnDestroy) ws.terminate();
|
|
90926
|
+
};
|
|
90927
|
+
duplex._final = function(callback) {
|
|
90928
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
90929
|
+
ws.once("open", function open3() {
|
|
90930
|
+
duplex._final(callback);
|
|
90931
|
+
});
|
|
90932
|
+
return;
|
|
90933
|
+
}
|
|
90934
|
+
if (ws._socket === null) return;
|
|
90935
|
+
if (ws._socket._writableState.finished) {
|
|
90936
|
+
callback();
|
|
90937
|
+
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
90938
|
+
} else {
|
|
90939
|
+
ws._socket.once("finish", function finish() {
|
|
90940
|
+
callback();
|
|
90941
|
+
});
|
|
90942
|
+
ws.close();
|
|
90943
|
+
}
|
|
90944
|
+
};
|
|
90945
|
+
duplex._read = function() {
|
|
90946
|
+
if (ws.isPaused) ws.resume();
|
|
90947
|
+
};
|
|
90948
|
+
duplex._write = function(chunk2, encoding, callback) {
|
|
90949
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
90950
|
+
ws.once("open", function open3() {
|
|
90951
|
+
duplex._write(chunk2, encoding, callback);
|
|
90952
|
+
});
|
|
90953
|
+
return;
|
|
90954
|
+
}
|
|
90955
|
+
ws.send(chunk2, callback);
|
|
90956
|
+
};
|
|
90957
|
+
duplex.on("end", duplexOnEnd);
|
|
90958
|
+
duplex.on("error", duplexOnError);
|
|
90959
|
+
return duplex;
|
|
90960
|
+
}
|
|
90961
|
+
module2.exports = createWebSocketStream22;
|
|
90962
|
+
}
|
|
90963
|
+
});
|
|
90867
90964
|
require_subprotocol3 = __commonJS2({
|
|
90868
|
-
"../
|
|
90965
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/subprotocol.js"(exports, module2) {
|
|
90869
90966
|
"use strict";
|
|
90870
90967
|
var { tokenChars } = require_validation4();
|
|
90871
90968
|
function parse8(header) {
|
|
@@ -90908,17 +91005,17 @@ var init_simple_client_node = __esm({
|
|
|
90908
91005
|
}
|
|
90909
91006
|
});
|
|
90910
91007
|
require_websocket_server3 = __commonJS2({
|
|
90911
|
-
"../
|
|
91008
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/websocket-server.js"(exports, module2) {
|
|
90912
91009
|
"use strict";
|
|
90913
91010
|
var EventEmitter6 = __require2("events");
|
|
90914
91011
|
var http11 = __require2("http");
|
|
90915
91012
|
var { Duplex } = __require2("stream");
|
|
90916
91013
|
var { createHash: createHash29 } = __require2("crypto");
|
|
90917
|
-
var
|
|
90918
|
-
var
|
|
90919
|
-
var
|
|
91014
|
+
var extension22 = require_extension3();
|
|
91015
|
+
var PerMessageDeflate22 = require_permessage_deflate3();
|
|
91016
|
+
var subprotocol22 = require_subprotocol3();
|
|
90920
91017
|
var WebSocket22 = require_websocket3();
|
|
90921
|
-
var { GUID, kWebSocket } = require_constants4();
|
|
91018
|
+
var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants4();
|
|
90922
91019
|
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
90923
91020
|
var RUNNING = 0;
|
|
90924
91021
|
var CLOSING = 1;
|
|
@@ -90937,8 +91034,15 @@ var init_simple_client_node = __esm({
|
|
|
90937
91034
|
* pending connections
|
|
90938
91035
|
* @param {Boolean} [options.clientTracking=true] Specifies whether or not to
|
|
90939
91036
|
* track clients
|
|
91037
|
+
* @param {Number} [options.closeTimeout=30000] Duration in milliseconds to
|
|
91038
|
+
* wait for the closing handshake to finish after `websocket.close()` is
|
|
91039
|
+
* called
|
|
90940
91040
|
* @param {Function} [options.handleProtocols] A hook to handle protocols
|
|
90941
91041
|
* @param {String} [options.host] The hostname where to bind the server
|
|
91042
|
+
* @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
|
|
91043
|
+
* buffered data chunks
|
|
91044
|
+
* @param {Number} [options.maxFragments=131072] The maximum number of message
|
|
91045
|
+
* fragments
|
|
90942
91046
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
90943
91047
|
* size
|
|
90944
91048
|
* @param {Boolean} [options.noServer=false] Enable no server mode
|
|
@@ -90960,11 +91064,14 @@ var init_simple_client_node = __esm({
|
|
|
90960
91064
|
options = {
|
|
90961
91065
|
allowSynchronousEvents: true,
|
|
90962
91066
|
autoPong: true,
|
|
91067
|
+
maxBufferedChunks: 1024 * 1024,
|
|
91068
|
+
maxFragments: 128 * 1024,
|
|
90963
91069
|
maxPayload: 100 * 1024 * 1024,
|
|
90964
91070
|
skipUTF8Validation: false,
|
|
90965
91071
|
perMessageDeflate: false,
|
|
90966
91072
|
handleProtocols: null,
|
|
90967
91073
|
clientTracking: true,
|
|
91074
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
90968
91075
|
verifyClient: null,
|
|
90969
91076
|
noServer: false,
|
|
90970
91077
|
backlog: null,
|
|
@@ -91120,9 +91227,11 @@ var init_simple_client_node = __esm({
|
|
|
91120
91227
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
91121
91228
|
return;
|
|
91122
91229
|
}
|
|
91123
|
-
if (version4 !==
|
|
91230
|
+
if (version4 !== 13 && version4 !== 8) {
|
|
91124
91231
|
const message = "Missing or invalid Sec-WebSocket-Version header";
|
|
91125
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message
|
|
91232
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
|
|
91233
|
+
"Sec-WebSocket-Version": "13, 8"
|
|
91234
|
+
});
|
|
91126
91235
|
return;
|
|
91127
91236
|
}
|
|
91128
91237
|
if (!this.shouldHandle(req)) {
|
|
@@ -91133,7 +91242,7 @@ var init_simple_client_node = __esm({
|
|
|
91133
91242
|
let protocols = /* @__PURE__ */ new Set();
|
|
91134
91243
|
if (secWebSocketProtocol !== void 0) {
|
|
91135
91244
|
try {
|
|
91136
|
-
protocols =
|
|
91245
|
+
protocols = subprotocol22.parse(secWebSocketProtocol);
|
|
91137
91246
|
} catch (err) {
|
|
91138
91247
|
const message = "Invalid Sec-WebSocket-Protocol header";
|
|
91139
91248
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
@@ -91143,16 +91252,16 @@ var init_simple_client_node = __esm({
|
|
|
91143
91252
|
const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
|
|
91144
91253
|
const extensions2 = {};
|
|
91145
91254
|
if (this.options.perMessageDeflate && secWebSocketExtensions !== void 0) {
|
|
91146
|
-
const perMessageDeflate = new
|
|
91147
|
-
this.options.perMessageDeflate,
|
|
91148
|
-
true,
|
|
91149
|
-
this.options.maxPayload
|
|
91150
|
-
);
|
|
91255
|
+
const perMessageDeflate = new PerMessageDeflate22({
|
|
91256
|
+
...this.options.perMessageDeflate,
|
|
91257
|
+
isServer: true,
|
|
91258
|
+
maxPayload: this.options.maxPayload
|
|
91259
|
+
});
|
|
91151
91260
|
try {
|
|
91152
|
-
const offers =
|
|
91153
|
-
if (offers[
|
|
91154
|
-
perMessageDeflate.accept(offers[
|
|
91155
|
-
extensions2[
|
|
91261
|
+
const offers = extension22.parse(secWebSocketExtensions);
|
|
91262
|
+
if (offers[PerMessageDeflate22.extensionName]) {
|
|
91263
|
+
perMessageDeflate.accept(offers[PerMessageDeflate22.extensionName]);
|
|
91264
|
+
extensions2[PerMessageDeflate22.extensionName] = perMessageDeflate;
|
|
91156
91265
|
}
|
|
91157
91266
|
} catch (err) {
|
|
91158
91267
|
const message = "Invalid or unacceptable Sec-WebSocket-Extensions header";
|
|
@@ -91223,10 +91332,10 @@ var init_simple_client_node = __esm({
|
|
|
91223
91332
|
ws._protocol = protocol;
|
|
91224
91333
|
}
|
|
91225
91334
|
}
|
|
91226
|
-
if (extensions2[
|
|
91227
|
-
const params = extensions2[
|
|
91228
|
-
const value =
|
|
91229
|
-
[
|
|
91335
|
+
if (extensions2[PerMessageDeflate22.extensionName]) {
|
|
91336
|
+
const params = extensions2[PerMessageDeflate22.extensionName].params;
|
|
91337
|
+
const value = extension22.format({
|
|
91338
|
+
[PerMessageDeflate22.extensionName]: [params]
|
|
91230
91339
|
});
|
|
91231
91340
|
headers.push(`Sec-WebSocket-Extensions: ${value}`);
|
|
91232
91341
|
ws._extensions = extensions2;
|
|
@@ -91236,6 +91345,8 @@ var init_simple_client_node = __esm({
|
|
|
91236
91345
|
socket.removeListener("error", socketOnError);
|
|
91237
91346
|
ws.setSocket(socket, head, {
|
|
91238
91347
|
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
91348
|
+
maxBufferedChunks: this.options.maxBufferedChunks,
|
|
91349
|
+
maxFragments: this.options.maxFragments,
|
|
91239
91350
|
maxPayload: this.options.maxPayload,
|
|
91240
91351
|
skipUTF8Validation: this.options.skipUTF8Validation
|
|
91241
91352
|
});
|
|
@@ -91281,20 +91392,23 @@ var init_simple_client_node = __esm({
|
|
|
91281
91392
|
` + Object.keys(headers).map((h3) => `${h3}: ${headers[h3]}`).join("\r\n") + "\r\n\r\n" + message
|
|
91282
91393
|
);
|
|
91283
91394
|
}
|
|
91284
|
-
function abortHandshakeOrEmitwsClientError(server, req, socket, code2, message) {
|
|
91395
|
+
function abortHandshakeOrEmitwsClientError(server, req, socket, code2, message, headers) {
|
|
91285
91396
|
if (server.listenerCount("wsClientError")) {
|
|
91286
91397
|
const err = new Error(message);
|
|
91287
91398
|
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
91288
91399
|
server.emit("wsClientError", err, socket, req);
|
|
91289
91400
|
} else {
|
|
91290
|
-
abortHandshake(socket, code2, message);
|
|
91401
|
+
abortHandshake(socket, code2, message, headers);
|
|
91291
91402
|
}
|
|
91292
91403
|
}
|
|
91293
91404
|
}
|
|
91294
91405
|
});
|
|
91295
91406
|
import_stream3 = __toESM3(require_stream3(), 1);
|
|
91407
|
+
import_extension3 = __toESM3(require_extension3(), 1);
|
|
91408
|
+
import_permessage_deflate3 = __toESM3(require_permessage_deflate3(), 1);
|
|
91296
91409
|
import_receiver3 = __toESM3(require_receiver3(), 1);
|
|
91297
91410
|
import_sender3 = __toESM3(require_sender3(), 1);
|
|
91411
|
+
import_subprotocol3 = __toESM3(require_subprotocol3(), 1);
|
|
91298
91412
|
import_websocket3 = __toESM3(require_websocket3(), 1);
|
|
91299
91413
|
import_websocket_server3 = __toESM3(require_websocket_server3(), 1);
|
|
91300
91414
|
wrapper_default3 = import_websocket3.default;
|
|
@@ -91303,12 +91417,477 @@ var init_simple_client_node = __esm({
|
|
|
91303
91417
|
}
|
|
91304
91418
|
});
|
|
91305
91419
|
|
|
91420
|
+
// ../../node_modules/convex/dist/esm/browser/http_client.js
|
|
91421
|
+
function forwardErrorData(errorData, error55) {
|
|
91422
|
+
error55.data = jsonToConvex(errorData);
|
|
91423
|
+
return error55;
|
|
91424
|
+
}
|
|
91425
|
+
var __defProp18, __defNormalProp15, __publicField15, STATUS_CODE_UDF_FAILED, specifiedFetch, ConvexHttpClient;
|
|
91426
|
+
var init_http_client = __esm({
|
|
91427
|
+
"../../node_modules/convex/dist/esm/browser/http_client.js"() {
|
|
91428
|
+
"use strict";
|
|
91429
|
+
init_api4();
|
|
91430
|
+
init_common2();
|
|
91431
|
+
init_esm6();
|
|
91432
|
+
init_values();
|
|
91433
|
+
init_logging();
|
|
91434
|
+
__defProp18 = Object.defineProperty;
|
|
91435
|
+
__defNormalProp15 = (obj, key, value) => key in obj ? __defProp18(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
91436
|
+
__publicField15 = (obj, key, value) => __defNormalProp15(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
91437
|
+
STATUS_CODE_UDF_FAILED = 560;
|
|
91438
|
+
specifiedFetch = void 0;
|
|
91439
|
+
ConvexHttpClient = class {
|
|
91440
|
+
/**
|
|
91441
|
+
* Create a new {@link ConvexHttpClient}.
|
|
91442
|
+
*
|
|
91443
|
+
* @param address - The url of your Convex deployment, often provided
|
|
91444
|
+
* by an environment variable. E.g. `https://small-mouse-123.convex.cloud`.
|
|
91445
|
+
* @param options - An object of options.
|
|
91446
|
+
* - `skipConvexDeploymentUrlCheck` - Skip validating that the Convex deployment URL looks like
|
|
91447
|
+
* `https://happy-animal-123.convex.cloud` or localhost. This can be useful if running a self-hosted
|
|
91448
|
+
* Convex backend that uses a different URL.
|
|
91449
|
+
* - `logger` - A logger or a boolean. If not provided, logs to the console.
|
|
91450
|
+
* You can construct your own logger to customize logging to log elsewhere
|
|
91451
|
+
* or not log at all, or use `false` as a shorthand for a no-op logger.
|
|
91452
|
+
* A logger is an object with 4 methods: log(), warn(), error(), and logVerbose().
|
|
91453
|
+
* These methods can receive multiple arguments of any types, like console.log().
|
|
91454
|
+
* - `auth` - A JWT containing identity claims accessible in Convex functions.
|
|
91455
|
+
* This identity may expire so it may be necessary to call `setAuth()` later,
|
|
91456
|
+
* but for short-lived clients it's convenient to specify this value here.
|
|
91457
|
+
* - `fetch` - A custom fetch implementation to use for all HTTP requests made by this client.
|
|
91458
|
+
*/
|
|
91459
|
+
constructor(address, options) {
|
|
91460
|
+
__publicField15(this, "address");
|
|
91461
|
+
__publicField15(this, "auth");
|
|
91462
|
+
__publicField15(this, "adminAuth");
|
|
91463
|
+
__publicField15(this, "encodedTsPromise");
|
|
91464
|
+
__publicField15(this, "debug");
|
|
91465
|
+
__publicField15(this, "fetchOptions");
|
|
91466
|
+
__publicField15(this, "fetch");
|
|
91467
|
+
__publicField15(this, "logger");
|
|
91468
|
+
__publicField15(this, "mutationQueue", []);
|
|
91469
|
+
__publicField15(this, "isProcessingQueue", false);
|
|
91470
|
+
if (typeof options === "boolean") {
|
|
91471
|
+
throw new Error(
|
|
91472
|
+
"skipConvexDeploymentUrlCheck as the second argument is no longer supported. Please pass an options object, `{ skipConvexDeploymentUrlCheck: true }`."
|
|
91473
|
+
);
|
|
91474
|
+
}
|
|
91475
|
+
const opts = options ?? {};
|
|
91476
|
+
if (opts.skipConvexDeploymentUrlCheck !== true) {
|
|
91477
|
+
validateDeploymentUrl(address);
|
|
91478
|
+
}
|
|
91479
|
+
this.logger = options?.logger === false ? instantiateNoopLogger({ verbose: false }) : options?.logger !== true && options?.logger ? options.logger : instantiateDefaultLogger({ verbose: false });
|
|
91480
|
+
this.address = address;
|
|
91481
|
+
this.debug = true;
|
|
91482
|
+
this.auth = void 0;
|
|
91483
|
+
this.adminAuth = void 0;
|
|
91484
|
+
this.fetch = options?.fetch;
|
|
91485
|
+
if (options?.auth) {
|
|
91486
|
+
this.setAuth(options.auth);
|
|
91487
|
+
}
|
|
91488
|
+
}
|
|
91489
|
+
/**
|
|
91490
|
+
* Obtain the {@link ConvexHttpClient}'s URL to its backend.
|
|
91491
|
+
* @deprecated Use url, which returns the url without /api at the end.
|
|
91492
|
+
*
|
|
91493
|
+
* @returns The URL to the Convex backend, including the client's API version.
|
|
91494
|
+
*/
|
|
91495
|
+
backendUrl() {
|
|
91496
|
+
return `${this.address}/api`;
|
|
91497
|
+
}
|
|
91498
|
+
/**
|
|
91499
|
+
* Return the address for this client, useful for creating a new client.
|
|
91500
|
+
*
|
|
91501
|
+
* Not guaranteed to match the address with which this client was constructed:
|
|
91502
|
+
* it may be canonicalized.
|
|
91503
|
+
*/
|
|
91504
|
+
get url() {
|
|
91505
|
+
return this.address;
|
|
91506
|
+
}
|
|
91507
|
+
/**
|
|
91508
|
+
* Set the authentication token to be used for subsequent queries and mutations.
|
|
91509
|
+
*
|
|
91510
|
+
* Should be called whenever the token changes (i.e. due to expiration and refresh).
|
|
91511
|
+
*
|
|
91512
|
+
* @param value - JWT-encoded OpenID Connect identity token.
|
|
91513
|
+
*/
|
|
91514
|
+
setAuth(value) {
|
|
91515
|
+
this.clearAuth();
|
|
91516
|
+
this.auth = value;
|
|
91517
|
+
}
|
|
91518
|
+
/**
|
|
91519
|
+
* Set admin auth token to allow calling internal queries, mutations, and actions
|
|
91520
|
+
* and acting as an identity.
|
|
91521
|
+
*
|
|
91522
|
+
* @internal
|
|
91523
|
+
*/
|
|
91524
|
+
setAdminAuth(token, actingAsIdentity) {
|
|
91525
|
+
this.clearAuth();
|
|
91526
|
+
if (actingAsIdentity !== void 0) {
|
|
91527
|
+
const bytes = new TextEncoder().encode(JSON.stringify(actingAsIdentity));
|
|
91528
|
+
const actingAsIdentityEncoded = btoa(String.fromCodePoint(...bytes));
|
|
91529
|
+
this.adminAuth = `${token}:${actingAsIdentityEncoded}`;
|
|
91530
|
+
} else {
|
|
91531
|
+
this.adminAuth = token;
|
|
91532
|
+
}
|
|
91533
|
+
}
|
|
91534
|
+
/**
|
|
91535
|
+
* Clear the current authentication token if set.
|
|
91536
|
+
*/
|
|
91537
|
+
clearAuth() {
|
|
91538
|
+
this.auth = void 0;
|
|
91539
|
+
this.adminAuth = void 0;
|
|
91540
|
+
}
|
|
91541
|
+
/**
|
|
91542
|
+
* Sets whether the result log lines should be printed on the console or not.
|
|
91543
|
+
*
|
|
91544
|
+
* @internal
|
|
91545
|
+
*/
|
|
91546
|
+
setDebug(debug4) {
|
|
91547
|
+
this.debug = debug4;
|
|
91548
|
+
}
|
|
91549
|
+
/**
|
|
91550
|
+
* Used to customize the fetch behavior in some runtimes.
|
|
91551
|
+
*
|
|
91552
|
+
* @internal
|
|
91553
|
+
*/
|
|
91554
|
+
setFetchOptions(fetchOptions) {
|
|
91555
|
+
this.fetchOptions = fetchOptions;
|
|
91556
|
+
}
|
|
91557
|
+
/**
|
|
91558
|
+
* This API is experimental: it may change or disappear.
|
|
91559
|
+
*
|
|
91560
|
+
* Execute a Convex query function at the same timestamp as every other
|
|
91561
|
+
* consistent query execution run by this HTTP client.
|
|
91562
|
+
*
|
|
91563
|
+
* This doesn't make sense for long-lived ConvexHttpClients as Convex
|
|
91564
|
+
* backends can read a limited amount into the past: beyond 30 seconds
|
|
91565
|
+
* in the past may not be available.
|
|
91566
|
+
*
|
|
91567
|
+
* Create a new client to use a consistent time.
|
|
91568
|
+
*
|
|
91569
|
+
* @param name - The name of the query.
|
|
91570
|
+
* @param args - The arguments object for the query. If this is omitted,
|
|
91571
|
+
* the arguments will be `{}`.
|
|
91572
|
+
* @returns A promise of the query's result.
|
|
91573
|
+
*
|
|
91574
|
+
* @deprecated This API is experimental: it may change or disappear.
|
|
91575
|
+
*/
|
|
91576
|
+
async consistentQuery(query2, ...args) {
|
|
91577
|
+
const queryArgs = parseArgs(args[0]);
|
|
91578
|
+
const timestampPromise = this.getTimestamp();
|
|
91579
|
+
return await this.queryInner(query2, queryArgs, { timestampPromise });
|
|
91580
|
+
}
|
|
91581
|
+
async getTimestamp() {
|
|
91582
|
+
if (this.encodedTsPromise) {
|
|
91583
|
+
return this.encodedTsPromise;
|
|
91584
|
+
}
|
|
91585
|
+
return this.encodedTsPromise = this.getTimestampInner();
|
|
91586
|
+
}
|
|
91587
|
+
async getTimestampInner() {
|
|
91588
|
+
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
91589
|
+
const headers = {
|
|
91590
|
+
"Content-Type": "application/json",
|
|
91591
|
+
"Convex-Client": `npm-${version2}`
|
|
91592
|
+
};
|
|
91593
|
+
const response = await localFetch(`${this.address}/api/query_ts`, {
|
|
91594
|
+
...this.fetchOptions,
|
|
91595
|
+
method: "POST",
|
|
91596
|
+
headers
|
|
91597
|
+
});
|
|
91598
|
+
if (!response.ok) {
|
|
91599
|
+
throw new Error(await response.text());
|
|
91600
|
+
}
|
|
91601
|
+
const { ts } = await response.json();
|
|
91602
|
+
return ts;
|
|
91603
|
+
}
|
|
91604
|
+
/**
|
|
91605
|
+
* Execute a Convex query function.
|
|
91606
|
+
*
|
|
91607
|
+
* @param name - The name of the query.
|
|
91608
|
+
* @param args - The arguments object for the query. If this is omitted,
|
|
91609
|
+
* the arguments will be `{}`.
|
|
91610
|
+
* @returns A promise of the query's result.
|
|
91611
|
+
*/
|
|
91612
|
+
async query(query2, ...args) {
|
|
91613
|
+
const queryArgs = parseArgs(args[0]);
|
|
91614
|
+
return await this.queryInner(query2, queryArgs, {});
|
|
91615
|
+
}
|
|
91616
|
+
async queryInner(query2, queryArgs, options) {
|
|
91617
|
+
const name = getFunctionName2(query2);
|
|
91618
|
+
const args = [convexToJson(queryArgs)];
|
|
91619
|
+
const headers = {
|
|
91620
|
+
"Content-Type": "application/json",
|
|
91621
|
+
"Convex-Client": `npm-${version2}`
|
|
91622
|
+
};
|
|
91623
|
+
if (this.adminAuth) {
|
|
91624
|
+
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
91625
|
+
} else if (this.auth) {
|
|
91626
|
+
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
91627
|
+
}
|
|
91628
|
+
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
91629
|
+
const timestamp2 = options.timestampPromise ? await options.timestampPromise : void 0;
|
|
91630
|
+
const body = JSON.stringify({
|
|
91631
|
+
path: name,
|
|
91632
|
+
format: "convex_encoded_json",
|
|
91633
|
+
args,
|
|
91634
|
+
...timestamp2 ? { ts: timestamp2 } : {}
|
|
91635
|
+
});
|
|
91636
|
+
const endpoint = timestamp2 ? `${this.address}/api/query_at_ts` : `${this.address}/api/query`;
|
|
91637
|
+
const response = await localFetch(endpoint, {
|
|
91638
|
+
...this.fetchOptions,
|
|
91639
|
+
body,
|
|
91640
|
+
method: "POST",
|
|
91641
|
+
headers
|
|
91642
|
+
});
|
|
91643
|
+
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
91644
|
+
throw new Error(await response.text());
|
|
91645
|
+
}
|
|
91646
|
+
const respJSON = await response.json();
|
|
91647
|
+
if (this.debug) {
|
|
91648
|
+
for (const line of respJSON.logLines ?? []) {
|
|
91649
|
+
logForFunction(this.logger, "info", "query", name, line);
|
|
91650
|
+
}
|
|
91651
|
+
}
|
|
91652
|
+
switch (respJSON.status) {
|
|
91653
|
+
case "success":
|
|
91654
|
+
return jsonToConvex(respJSON.value);
|
|
91655
|
+
case "error":
|
|
91656
|
+
if (respJSON.errorData !== void 0) {
|
|
91657
|
+
throw forwardErrorData(
|
|
91658
|
+
respJSON.errorData,
|
|
91659
|
+
new ConvexError(respJSON.errorMessage)
|
|
91660
|
+
);
|
|
91661
|
+
}
|
|
91662
|
+
throw new Error(respJSON.errorMessage);
|
|
91663
|
+
default:
|
|
91664
|
+
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
91665
|
+
}
|
|
91666
|
+
}
|
|
91667
|
+
async mutationInner(mutation2, mutationArgs) {
|
|
91668
|
+
const name = getFunctionName2(mutation2);
|
|
91669
|
+
const body = JSON.stringify({
|
|
91670
|
+
path: name,
|
|
91671
|
+
format: "convex_encoded_json",
|
|
91672
|
+
args: [convexToJson(mutationArgs)]
|
|
91673
|
+
});
|
|
91674
|
+
const headers = {
|
|
91675
|
+
"Content-Type": "application/json",
|
|
91676
|
+
"Convex-Client": `npm-${version2}`
|
|
91677
|
+
};
|
|
91678
|
+
if (this.adminAuth) {
|
|
91679
|
+
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
91680
|
+
} else if (this.auth) {
|
|
91681
|
+
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
91682
|
+
}
|
|
91683
|
+
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
91684
|
+
const response = await localFetch(`${this.address}/api/mutation`, {
|
|
91685
|
+
...this.fetchOptions,
|
|
91686
|
+
body,
|
|
91687
|
+
method: "POST",
|
|
91688
|
+
headers
|
|
91689
|
+
});
|
|
91690
|
+
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
91691
|
+
throw new Error(await response.text());
|
|
91692
|
+
}
|
|
91693
|
+
const respJSON = await response.json();
|
|
91694
|
+
if (this.debug) {
|
|
91695
|
+
for (const line of respJSON.logLines ?? []) {
|
|
91696
|
+
logForFunction(this.logger, "info", "mutation", name, line);
|
|
91697
|
+
}
|
|
91698
|
+
}
|
|
91699
|
+
switch (respJSON.status) {
|
|
91700
|
+
case "success":
|
|
91701
|
+
return jsonToConvex(respJSON.value);
|
|
91702
|
+
case "error":
|
|
91703
|
+
if (respJSON.errorData !== void 0) {
|
|
91704
|
+
throw forwardErrorData(
|
|
91705
|
+
respJSON.errorData,
|
|
91706
|
+
new ConvexError(respJSON.errorMessage)
|
|
91707
|
+
);
|
|
91708
|
+
}
|
|
91709
|
+
throw new Error(respJSON.errorMessage);
|
|
91710
|
+
default:
|
|
91711
|
+
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
91712
|
+
}
|
|
91713
|
+
}
|
|
91714
|
+
async processMutationQueue() {
|
|
91715
|
+
if (this.isProcessingQueue) {
|
|
91716
|
+
return;
|
|
91717
|
+
}
|
|
91718
|
+
this.isProcessingQueue = true;
|
|
91719
|
+
while (this.mutationQueue.length > 0) {
|
|
91720
|
+
const { mutation: mutation2, args, resolve: resolve3, reject } = this.mutationQueue.shift();
|
|
91721
|
+
try {
|
|
91722
|
+
const result = await this.mutationInner(mutation2, args);
|
|
91723
|
+
resolve3(result);
|
|
91724
|
+
} catch (error55) {
|
|
91725
|
+
reject(error55);
|
|
91726
|
+
}
|
|
91727
|
+
}
|
|
91728
|
+
this.isProcessingQueue = false;
|
|
91729
|
+
}
|
|
91730
|
+
enqueueMutation(mutation2, args) {
|
|
91731
|
+
return new Promise((resolve3, reject) => {
|
|
91732
|
+
this.mutationQueue.push({ mutation: mutation2, args, resolve: resolve3, reject });
|
|
91733
|
+
void this.processMutationQueue();
|
|
91734
|
+
});
|
|
91735
|
+
}
|
|
91736
|
+
/**
|
|
91737
|
+
* Execute a Convex mutation function. Mutations are queued by default.
|
|
91738
|
+
*
|
|
91739
|
+
* @param name - The name of the mutation.
|
|
91740
|
+
* @param args - The arguments object for the mutation. If this is omitted,
|
|
91741
|
+
* the arguments will be `{}`.
|
|
91742
|
+
* @param options - An optional object containing
|
|
91743
|
+
* @returns A promise of the mutation's result.
|
|
91744
|
+
*/
|
|
91745
|
+
async mutation(mutation2, ...args) {
|
|
91746
|
+
const [fnArgs, options] = args;
|
|
91747
|
+
const mutationArgs = parseArgs(fnArgs);
|
|
91748
|
+
const queued = !options?.skipQueue;
|
|
91749
|
+
if (queued) {
|
|
91750
|
+
return await this.enqueueMutation(mutation2, mutationArgs);
|
|
91751
|
+
} else {
|
|
91752
|
+
return await this.mutationInner(mutation2, mutationArgs);
|
|
91753
|
+
}
|
|
91754
|
+
}
|
|
91755
|
+
/**
|
|
91756
|
+
* Execute a Convex action function. Actions are not queued.
|
|
91757
|
+
*
|
|
91758
|
+
* @param name - The name of the action.
|
|
91759
|
+
* @param args - The arguments object for the action. If this is omitted,
|
|
91760
|
+
* the arguments will be `{}`.
|
|
91761
|
+
* @returns A promise of the action's result.
|
|
91762
|
+
*/
|
|
91763
|
+
async action(action, ...args) {
|
|
91764
|
+
const actionArgs = parseArgs(args[0]);
|
|
91765
|
+
const name = getFunctionName2(action);
|
|
91766
|
+
const body = JSON.stringify({
|
|
91767
|
+
path: name,
|
|
91768
|
+
format: "convex_encoded_json",
|
|
91769
|
+
args: [convexToJson(actionArgs)]
|
|
91770
|
+
});
|
|
91771
|
+
const headers = {
|
|
91772
|
+
"Content-Type": "application/json",
|
|
91773
|
+
"Convex-Client": `npm-${version2}`
|
|
91774
|
+
};
|
|
91775
|
+
if (this.adminAuth) {
|
|
91776
|
+
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
91777
|
+
} else if (this.auth) {
|
|
91778
|
+
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
91779
|
+
}
|
|
91780
|
+
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
91781
|
+
const response = await localFetch(`${this.address}/api/action`, {
|
|
91782
|
+
...this.fetchOptions,
|
|
91783
|
+
body,
|
|
91784
|
+
method: "POST",
|
|
91785
|
+
headers
|
|
91786
|
+
});
|
|
91787
|
+
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
91788
|
+
throw new Error(await response.text());
|
|
91789
|
+
}
|
|
91790
|
+
const respJSON = await response.json();
|
|
91791
|
+
if (this.debug) {
|
|
91792
|
+
for (const line of respJSON.logLines ?? []) {
|
|
91793
|
+
logForFunction(this.logger, "info", "action", name, line);
|
|
91794
|
+
}
|
|
91795
|
+
}
|
|
91796
|
+
switch (respJSON.status) {
|
|
91797
|
+
case "success":
|
|
91798
|
+
return jsonToConvex(respJSON.value);
|
|
91799
|
+
case "error":
|
|
91800
|
+
if (respJSON.errorData !== void 0) {
|
|
91801
|
+
throw forwardErrorData(
|
|
91802
|
+
respJSON.errorData,
|
|
91803
|
+
new ConvexError(respJSON.errorMessage)
|
|
91804
|
+
);
|
|
91805
|
+
}
|
|
91806
|
+
throw new Error(respJSON.errorMessage);
|
|
91807
|
+
default:
|
|
91808
|
+
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
91809
|
+
}
|
|
91810
|
+
}
|
|
91811
|
+
/**
|
|
91812
|
+
* Execute a Convex function of an unknown type. These function calls are not queued.
|
|
91813
|
+
*
|
|
91814
|
+
* @param name - The name of the function.
|
|
91815
|
+
* @param args - The arguments object for the function. If this is omitted,
|
|
91816
|
+
* the arguments will be `{}`.
|
|
91817
|
+
* @returns A promise of the function's result.
|
|
91818
|
+
*
|
|
91819
|
+
* @internal
|
|
91820
|
+
*/
|
|
91821
|
+
async function(anyFunction, componentPath, ...args) {
|
|
91822
|
+
const functionArgs = parseArgs(args[0]);
|
|
91823
|
+
const name = typeof anyFunction === "string" ? anyFunction : getFunctionName2(anyFunction);
|
|
91824
|
+
const body = JSON.stringify({
|
|
91825
|
+
componentPath,
|
|
91826
|
+
path: name,
|
|
91827
|
+
format: "convex_encoded_json",
|
|
91828
|
+
args: convexToJson(functionArgs)
|
|
91829
|
+
});
|
|
91830
|
+
const headers = {
|
|
91831
|
+
"Content-Type": "application/json",
|
|
91832
|
+
"Convex-Client": `npm-${version2}`
|
|
91833
|
+
};
|
|
91834
|
+
if (this.adminAuth) {
|
|
91835
|
+
headers["Authorization"] = `Convex ${this.adminAuth}`;
|
|
91836
|
+
} else if (this.auth) {
|
|
91837
|
+
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
91838
|
+
}
|
|
91839
|
+
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
91840
|
+
const response = await localFetch(`${this.address}/api/function`, {
|
|
91841
|
+
...this.fetchOptions,
|
|
91842
|
+
body,
|
|
91843
|
+
method: "POST",
|
|
91844
|
+
headers
|
|
91845
|
+
});
|
|
91846
|
+
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
91847
|
+
throw new Error(await response.text());
|
|
91848
|
+
}
|
|
91849
|
+
const respJSON = await response.json();
|
|
91850
|
+
if (this.debug) {
|
|
91851
|
+
for (const line of respJSON.logLines ?? []) {
|
|
91852
|
+
logForFunction(this.logger, "info", "any", name, line);
|
|
91853
|
+
}
|
|
91854
|
+
}
|
|
91855
|
+
switch (respJSON.status) {
|
|
91856
|
+
case "success":
|
|
91857
|
+
return jsonToConvex(respJSON.value);
|
|
91858
|
+
case "error":
|
|
91859
|
+
if (respJSON.errorData !== void 0) {
|
|
91860
|
+
throw forwardErrorData(
|
|
91861
|
+
respJSON.errorData,
|
|
91862
|
+
new ConvexError(respJSON.errorMessage)
|
|
91863
|
+
);
|
|
91864
|
+
}
|
|
91865
|
+
throw new Error(respJSON.errorMessage);
|
|
91866
|
+
default:
|
|
91867
|
+
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
91868
|
+
}
|
|
91869
|
+
}
|
|
91870
|
+
};
|
|
91871
|
+
}
|
|
91872
|
+
});
|
|
91873
|
+
|
|
91874
|
+
// ../../node_modules/convex/dist/esm/browser/query_options.js
|
|
91875
|
+
function convexQueryOptions(options) {
|
|
91876
|
+
return options;
|
|
91877
|
+
}
|
|
91878
|
+
var init_query_options = __esm({
|
|
91879
|
+
"../../node_modules/convex/dist/esm/browser/query_options.js"() {
|
|
91880
|
+
"use strict";
|
|
91881
|
+
}
|
|
91882
|
+
});
|
|
91883
|
+
|
|
91306
91884
|
// ../../node_modules/convex/dist/esm/browser/index-node.js
|
|
91307
91885
|
var index_node_exports = {};
|
|
91308
91886
|
__export(index_node_exports, {
|
|
91309
91887
|
BaseConvexClient: () => BaseConvexClient,
|
|
91310
91888
|
ConvexClient: () => ConvexClient,
|
|
91311
|
-
ConvexHttpClient: () => ConvexHttpClient
|
|
91889
|
+
ConvexHttpClient: () => ConvexHttpClient,
|
|
91890
|
+
convexQueryOptions: () => convexQueryOptions
|
|
91312
91891
|
});
|
|
91313
91892
|
var init_index_node2 = __esm({
|
|
91314
91893
|
"../../node_modules/convex/dist/esm/browser/index-node.js"() {
|
|
@@ -91316,6 +91895,7 @@ var init_index_node2 = __esm({
|
|
|
91316
91895
|
init_client3();
|
|
91317
91896
|
init_simple_client_node();
|
|
91318
91897
|
init_http_client();
|
|
91898
|
+
init_query_options();
|
|
91319
91899
|
}
|
|
91320
91900
|
});
|
|
91321
91901
|
|
|
@@ -102526,10 +103106,10 @@ var require_eventemitter3 = __commonJS({
|
|
|
102526
103106
|
});
|
|
102527
103107
|
|
|
102528
103108
|
// ../../node_modules/eventemitter3/index.mjs
|
|
102529
|
-
var
|
|
103109
|
+
var import_index;
|
|
102530
103110
|
var init_eventemitter3 = __esm({
|
|
102531
103111
|
"../../node_modules/eventemitter3/index.mjs"() {
|
|
102532
|
-
|
|
103112
|
+
import_index = __toESM(require_eventemitter3(), 1);
|
|
102533
103113
|
}
|
|
102534
103114
|
});
|
|
102535
103115
|
|
|
@@ -102731,7 +103311,7 @@ var init_dist7 = __esm({
|
|
|
102731
103311
|
init_eventemitter3();
|
|
102732
103312
|
init_p_timeout();
|
|
102733
103313
|
init_priority_queue();
|
|
102734
|
-
PQueue = class extends
|
|
103314
|
+
PQueue = class extends import_index.default {
|
|
102735
103315
|
#carryoverIntervalCount;
|
|
102736
103316
|
#isIntervalIgnored;
|
|
102737
103317
|
#intervalCount = 0;
|
|
@@ -128923,8 +129503,8 @@ var require_dist3 = __commonJS({
|
|
|
128923
129503
|
this.name = "VolumeError";
|
|
128924
129504
|
}
|
|
128925
129505
|
};
|
|
128926
|
-
function formatLog(
|
|
128927
|
-
return JSON.parse(JSON.stringify(
|
|
129506
|
+
function formatLog(log4) {
|
|
129507
|
+
return JSON.parse(JSON.stringify(log4));
|
|
128928
129508
|
}
|
|
128929
129509
|
function createRpcLogger(logger13) {
|
|
128930
129510
|
function logEach(stream) {
|
|
@@ -141851,6 +142431,7 @@ var init_threadInventoryBuilder = __esm({
|
|
|
141851
142431
|
forkOperationId: null,
|
|
141852
142432
|
isFork: false,
|
|
141853
142433
|
forkState: null,
|
|
142434
|
+
forkCreationKind: null,
|
|
141854
142435
|
forkPlacementArchived: false,
|
|
141855
142436
|
forkProgressStage: null,
|
|
141856
142437
|
forkSlowStartReason: null,
|
|
@@ -141987,6 +142568,7 @@ var init_threadInventoryBuilder = __esm({
|
|
|
141987
142568
|
row.forkOperationId = placement.operationId;
|
|
141988
142569
|
row.isFork = true;
|
|
141989
142570
|
row.forkState = placement.state;
|
|
142571
|
+
row.forkCreationKind = placement.creationKind ?? null;
|
|
141990
142572
|
row.forkPlacementArchived = placement.archivedAt !== null;
|
|
141991
142573
|
row.forkProgressStage = placement.progressStage;
|
|
141992
142574
|
row.forkSlowStartReason = placement.slowStartReason;
|
|
@@ -143456,11 +144038,12 @@ var init_threadListWindowData = __esm({
|
|
|
143456
144038
|
});
|
|
143457
144039
|
|
|
143458
144040
|
// ../../../../shared/threadRuntime/agentGuidance.ts
|
|
143459
|
-
var MAX_AGENT_GUIDANCE_UTF8_BYTES, PROJECT_AGENT_GUIDANCE_START_MARKER, PROJECT_AGENT_GUIDANCE_END_MARKER, MANAGED_SAFETY_START_MARKER, MANAGED_SAFETY_END_MARKER, AGENT_GUIDANCE_RESERVED_MARKER_LINES, reservedMarkerLines;
|
|
144041
|
+
var MAX_AGENT_GUIDANCE_UTF8_BYTES, MAX_COMPOSED_AGENT_GUIDANCE_UTF8_BYTES, PROJECT_AGENT_GUIDANCE_START_MARKER, PROJECT_AGENT_GUIDANCE_END_MARKER, MANAGED_SAFETY_START_MARKER, MANAGED_SAFETY_END_MARKER, AGENT_GUIDANCE_RESERVED_MARKER_LINES, reservedMarkerLines;
|
|
143460
144042
|
var init_agentGuidance = __esm({
|
|
143461
144043
|
"../../../../shared/threadRuntime/agentGuidance.ts"() {
|
|
143462
144044
|
"use strict";
|
|
143463
144045
|
MAX_AGENT_GUIDANCE_UTF8_BYTES = 16 * 1024;
|
|
144046
|
+
MAX_COMPOSED_AGENT_GUIDANCE_UTF8_BYTES = 2 * MAX_AGENT_GUIDANCE_UTF8_BYTES + 2;
|
|
143464
144047
|
PROJECT_AGENT_GUIDANCE_START_MARKER = "<!-- BOXES_PROJECT_AGENT_GUIDANCE_START -->";
|
|
143465
144048
|
PROJECT_AGENT_GUIDANCE_END_MARKER = "<!-- BOXES_PROJECT_AGENT_GUIDANCE_END -->";
|
|
143466
144049
|
MANAGED_SAFETY_START_MARKER = "<!-- DEVBOX_MANAGED_SAFETY_START -->";
|
|
@@ -143770,58 +144353,63 @@ var init_onboxAgentPermissionRequestProtocol = __esm({
|
|
|
143770
144353
|
});
|
|
143771
144354
|
|
|
143772
144355
|
// ../../../../shared/onboxAgentPermissionRequestPresentation.ts
|
|
143773
|
-
var
|
|
144356
|
+
var permissionActions, coordinatorPermissionActions, permissionQuestion, threadGrantScope, describeAwsAccess, teamRoleLabel, presentTeamMembershipChange, presentAction, boxPermissionScope, coordinatorBoxPermissionScope, buildOnboxAgentPermissionRequestPresentation;
|
|
143774
144357
|
var init_onboxAgentPermissionRequestPresentation = __esm({
|
|
143775
144358
|
"../../../../shared/onboxAgentPermissionRequestPresentation.ts"() {
|
|
143776
144359
|
"use strict";
|
|
143777
144360
|
init_onboxAgentPermissionRequestProtocol();
|
|
143778
|
-
|
|
143779
|
-
"read-project-threads": "
|
|
143780
|
-
"read-user-threads": "
|
|
143781
|
-
"read-shared-threads": "
|
|
143782
|
-
"read-team-threads": "
|
|
143783
|
-
"control-created-threads": "
|
|
143784
|
-
"control-project-threads": "
|
|
143785
|
-
"control-user-threads": "
|
|
143786
|
-
"message-agents": "
|
|
143787
|
-
"message-teammates-agents": "
|
|
143788
|
-
"destroy-devbox": "
|
|
143789
|
-
"destroy-created-devboxes": "
|
|
143790
|
-
"destroy-project-devboxes": "
|
|
143791
|
-
"create-devboxes-and-threads": "
|
|
143792
|
-
"create-team-templates": "
|
|
143793
|
-
"edit-devbox-lifecycle": "
|
|
143794
|
-
"edit-template-maintenance": "
|
|
143795
|
-
"update-thread-titles": "
|
|
143796
|
-
"move-devboxes-to-folders": "
|
|
143797
|
-
"create-devbox-folders": "
|
|
143798
|
-
"edit-template-box": "
|
|
143799
|
-
"edit-project-settings": "
|
|
143800
|
-
"edit-team-template": "
|
|
143801
|
-
"edit-personal-environment": "
|
|
143802
|
-
"edit-automations": "
|
|
143803
|
-
"edit-tailscale-integration": "
|
|
143804
|
-
"edit-google-cloud-integration": "
|
|
143805
|
-
"change-aws-profile": "
|
|
143806
|
-
"enable-tailscale-integration": "
|
|
143807
|
-
"change-team-membership": "
|
|
143808
|
-
};
|
|
143809
|
-
|
|
144361
|
+
permissionActions = {
|
|
144362
|
+
"read-project-threads": "read other threads in this project?",
|
|
144363
|
+
"read-user-threads": "read threads in all your projects?",
|
|
144364
|
+
"read-shared-threads": "read your threads and threads shared with you?",
|
|
144365
|
+
"read-team-threads": "read your threads and teammates\u2019 threads you can access?",
|
|
144366
|
+
"control-created-threads": "pause and resume agents started from this box?",
|
|
144367
|
+
"control-project-threads": "pause and resume your agents in this project?",
|
|
144368
|
+
"control-user-threads": "pause and resume your agents in all your projects?",
|
|
144369
|
+
"message-agents": "message other agents in this project?",
|
|
144370
|
+
"message-teammates-agents": "message your teammates\u2019 agents?",
|
|
144371
|
+
"destroy-devbox": "destroy and archive this devbox?",
|
|
144372
|
+
"destroy-created-devboxes": "destroy and archive devboxes they create?",
|
|
144373
|
+
"destroy-project-devboxes": "destroy and archive your devboxes in this project?",
|
|
144374
|
+
"create-devboxes-and-threads": "create devboxes and threads?",
|
|
144375
|
+
"create-team-templates": "create Team Templates?",
|
|
144376
|
+
"edit-devbox-lifecycle": "edit devbox lifecycle?",
|
|
144377
|
+
"edit-template-maintenance": "edit template maintenance?",
|
|
144378
|
+
"update-thread-titles": "rename threads and devboxes?",
|
|
144379
|
+
"move-devboxes-to-folders": "move devboxes to folders?",
|
|
144380
|
+
"create-devbox-folders": "create and manage devbox folders?",
|
|
144381
|
+
"edit-template-box": "edit the Template box?",
|
|
144382
|
+
"edit-project-settings": "edit settings?",
|
|
144383
|
+
"edit-team-template": "edit team settings?",
|
|
144384
|
+
"edit-personal-environment": "edit your environment variables?",
|
|
144385
|
+
"edit-automations": "edit your automations?",
|
|
144386
|
+
"edit-tailscale-integration": "change Tailscale auto-connect?",
|
|
144387
|
+
"edit-google-cloud-integration": "choose the Google Cloud project?",
|
|
144388
|
+
"change-aws-profile": "change an AWS profile?",
|
|
144389
|
+
"enable-tailscale-integration": "enable Tailscale?",
|
|
144390
|
+
"change-team-membership": "change your team's members?"
|
|
144391
|
+
};
|
|
144392
|
+
coordinatorPermissionActions = {
|
|
144393
|
+
"destroy-created-devboxes": "destroy and archive devboxes it started?",
|
|
144394
|
+
"control-created-threads": "pause and resume agents it started?"
|
|
144395
|
+
};
|
|
144396
|
+
permissionQuestion = (permission, sourceBoxKind) => sourceBoxKind === "coordinator" ? `Allow the coordinator to ${coordinatorPermissionActions[permission] ?? permissionActions[permission]}` : `Allow ${isOnboxAgentThreadGrantPermission(permission) || isOnboxAgentExactActionPermission(permission) ? "this thread" : "agents"} to ${permissionActions[permission]}`;
|
|
144397
|
+
threadGrantScope = (permission, teamTemplateName, subject) => {
|
|
143810
144398
|
switch (permission) {
|
|
143811
144399
|
case "edit-template-box":
|
|
143812
|
-
return
|
|
144400
|
+
return `For the next 3 hours, ${subject} will be able to run commands on this project's Template box, change project settings and environment variables, change your account preferences, and take snapshots that future devboxes will use. Agent permission defaults remain user-only.`;
|
|
143813
144401
|
case "edit-project-settings":
|
|
143814
|
-
return
|
|
144402
|
+
return `For the next 3 hours, ${subject} will be able to change this project's settings, Project URLs, and your environment and member-file values in it, and share this thread with your team. It will also be able to change your account preferences, such as notifications, idle sleep, Git identity, and agent replies. Agent permission defaults remain user-only.`;
|
|
143815
144403
|
case "edit-personal-environment":
|
|
143816
|
-
return
|
|
144404
|
+
return `For the next 3 hours, ${subject} will be able to add, change, and remove your own environment variables in this project. Changes will reach all your devboxes in this project.`;
|
|
143817
144405
|
case "edit-tailscale-integration":
|
|
143818
|
-
return
|
|
144406
|
+
return `For the next 3 hours, ${subject} will be able to choose whether new devboxes in this project connect to Tailscale automatically. Saved changes will stay in place after this permission expires.`;
|
|
143819
144407
|
case "edit-google-cloud-integration":
|
|
143820
|
-
return
|
|
144408
|
+
return `For the next 3 hours, ${subject} will be able to choose the Google Cloud project this project uses by default and for quota. Your Google account's access won't change. Saved changes will stay in place after this permission expires.`;
|
|
143821
144409
|
case "edit-automations":
|
|
143822
|
-
return
|
|
144410
|
+
return `For the next 3 hours, ${subject} will be able to create, change, pause, run, and delete your automations in this project. Each run will either start a new agent thread on a new devbox, without this conversation, or send the prompt to an existing thread, such as this one. Runs will use box-hours.`;
|
|
143823
144411
|
case "edit-team-template":
|
|
143824
|
-
return teamTemplateName === null ?
|
|
144412
|
+
return teamTemplateName === null ? `For the next 3 hours, ${subject} will be able to change your team's settings, such as its name, teammate thread access, idle sleep default, allowed domains, and static egress destinations, and change settings in any of your team's projects and your account preferences. Membership changes will still need your approval each time. Agent permission defaults remain user-only.` : `For the next 3 hours, ${subject} will be able to change your team's settings and edit the "${teamTemplateName}" Team Template, including its settings and environment variables, change settings in any of your team's projects and your account preferences, and save new versions for your team. Membership changes will still need your approval each time. Agent permission defaults remain user-only.`;
|
|
143825
144413
|
}
|
|
143826
144414
|
};
|
|
143827
144415
|
describeAwsAccess = (choice) => `${choice.roleName} in ${choice.accountName} (${choice.accountId})`;
|
|
@@ -143919,6 +144507,37 @@ var init_onboxAgentPermissionRequestPresentation = __esm({
|
|
|
143919
144507
|
allowLabel: "Enable Tailscale"
|
|
143920
144508
|
};
|
|
143921
144509
|
};
|
|
144510
|
+
boxPermissionScope = ({
|
|
144511
|
+
permission,
|
|
144512
|
+
box,
|
|
144513
|
+
projectScopeAvailable
|
|
144514
|
+
}) => {
|
|
144515
|
+
const projectApproval = projectScopeAvailable ? " Project approval will also apply to your existing and future devboxes, except those you've configured separately." : "";
|
|
144516
|
+
switch (permission) {
|
|
144517
|
+
case "destroy-devbox":
|
|
144518
|
+
return `This will allow every agent on this devbox to request its deletion after all agents finish. Files will be permanently deleted and thread history archived. You can turn this off in Agent permissions.${projectScopeAvailable ? " Project approval will extend this permission to your existing and future devboxes, except those you've configured separately. Agents will only be able to destroy their own devbox." : ""}`;
|
|
144519
|
+
case "destroy-created-devboxes":
|
|
144520
|
+
case "destroy-project-devboxes":
|
|
144521
|
+
return `This will allow agents on this ${box} to request deletion of ${permission === "destroy-created-devboxes" ? "devboxes they created" : "your other devboxes in this project"}. Each devbox will be deleted after all of its agents finish. Its files will be permanently deleted, and its thread history will be archived.${box === "devbox" ? " Agents will also be able to archive threads created by agents on this devbox." : ""} You can turn this off in Agent permissions.${projectApproval}`;
|
|
144522
|
+
case "message-agents":
|
|
144523
|
+
return `Allow will let agents on this ${box} message your other agents in this project and receive their messages until you turn it off. A message will start an idle agent and wake its devbox if it's asleep.${projectApproval}`;
|
|
144524
|
+
case "message-teammates-agents":
|
|
144525
|
+
return `Allow will let agents on this ${box} message your teammates\u2019 agents until you turn it off. Your teammates\u2019 agents will also be able to message agents here once you allow their messages. An allowed message will start an idle agent and wake this ${box} if it's asleep.${projectApproval}`;
|
|
144526
|
+
default:
|
|
144527
|
+
return `Allow will enable this permission on this ${box} until you turn it off.${projectApproval}`;
|
|
144528
|
+
}
|
|
144529
|
+
};
|
|
144530
|
+
coordinatorBoxPermissionScope = (permission) => {
|
|
144531
|
+
switch (permission) {
|
|
144532
|
+
case "destroy-created-devboxes":
|
|
144533
|
+
case "destroy-project-devboxes":
|
|
144534
|
+
return `This will allow the coordinator to request deletion of ${permission === "destroy-created-devboxes" ? "devboxes it started" : "your devboxes in this project"}. Each devbox will be deleted after all of its agents finish. Its files will be permanently deleted, and its thread history will be archived. You can turn this off in the coordinator's Agent permissions.`;
|
|
144535
|
+
case "message-teammates-agents":
|
|
144536
|
+
return "Allow will let the coordinator message your teammates\u2019 agents until you turn it off. Your teammates\u2019 agents will also be able to message the coordinator once you allow their messages.";
|
|
144537
|
+
default:
|
|
144538
|
+
return "Allow will turn this permission on for the coordinator until you turn it off.";
|
|
144539
|
+
}
|
|
144540
|
+
};
|
|
143922
144541
|
buildOnboxAgentPermissionRequestPresentation = ({
|
|
143923
144542
|
permission,
|
|
143924
144543
|
sourceBoxKind,
|
|
@@ -143929,7 +144548,7 @@ var init_onboxAgentPermissionRequestPresentation = __esm({
|
|
|
143929
144548
|
if (action) return presentAction(action);
|
|
143930
144549
|
if (isOnboxAgentExactActionPermission(permission))
|
|
143931
144550
|
return {
|
|
143932
|
-
question:
|
|
144551
|
+
question: permissionQuestion(permission, sourceBoxKind),
|
|
143933
144552
|
scope: "Update boxes.dev to see this change.",
|
|
143934
144553
|
automationsSectionSentence: null,
|
|
143935
144554
|
details: [],
|
|
@@ -143938,11 +144557,17 @@ var init_onboxAgentPermissionRequestPresentation = __esm({
|
|
|
143938
144557
|
declineLabel: "Deny",
|
|
143939
144558
|
projectAllowLabel: "Always allow for project"
|
|
143940
144559
|
};
|
|
143941
|
-
const box = sourceBoxKind === "template_box" ? "Template box" : "devbox";
|
|
143942
|
-
const boxScope = permission === "message-agents" ? `Allow will let agents on this ${box} message your other agents in this project and receive their messages until you turn it off. A message will start an idle agent and wake its devbox if it's asleep.` : permission === "message-teammates-agents" ? `Allow will let agents on this ${box} message your teammates\u2019 agents until you turn it off. Your teammates\u2019 agents will also be able to message agents here once you allow their messages. An allowed message will start an idle agent and wake this ${box} if it's asleep.` : `Allow will enable this permission on this ${box} until you turn it off.`;
|
|
143943
144560
|
return {
|
|
143944
|
-
question:
|
|
143945
|
-
scope: isOnboxAgentThreadGrantPermission(permission) ? threadGrantScope(
|
|
144561
|
+
question: permissionQuestion(permission, sourceBoxKind),
|
|
144562
|
+
scope: isOnboxAgentThreadGrantPermission(permission) ? threadGrantScope(
|
|
144563
|
+
permission,
|
|
144564
|
+
teamTemplateName,
|
|
144565
|
+
sourceBoxKind === "coordinator" ? "the coordinator" : "the agent in this thread"
|
|
144566
|
+
) : sourceBoxKind === "coordinator" ? coordinatorBoxPermissionScope(permission) : boxPermissionScope({
|
|
144567
|
+
permission,
|
|
144568
|
+
box: sourceBoxKind === "template_box" ? "Template box" : "devbox",
|
|
144569
|
+
projectScopeAvailable
|
|
144570
|
+
}),
|
|
143946
144571
|
automationsSectionSentence: permission === "edit-automations" ? {
|
|
143947
144572
|
before: "Manage these in the ",
|
|
143948
144573
|
linkText: "automations",
|
|
@@ -146989,7 +147614,7 @@ var require_node6 = __commonJS({
|
|
|
146989
147614
|
var tty3 = __require("tty");
|
|
146990
147615
|
var util2 = __require("util");
|
|
146991
147616
|
exports.init = init3;
|
|
146992
|
-
exports.log =
|
|
147617
|
+
exports.log = log4;
|
|
146993
147618
|
exports.formatArgs = formatArgs;
|
|
146994
147619
|
exports.save = save;
|
|
146995
147620
|
exports.load = load2;
|
|
@@ -147124,7 +147749,7 @@ var require_node6 = __commonJS({
|
|
|
147124
147749
|
}
|
|
147125
147750
|
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
147126
147751
|
}
|
|
147127
|
-
function
|
|
147752
|
+
function log4(...args) {
|
|
147128
147753
|
return process.stderr.write(util2.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
147129
147754
|
}
|
|
147130
147755
|
function save(namespaces) {
|
|
@@ -175955,7 +176580,7 @@ var require_react_reconciler_production = __commonJS({
|
|
|
175955
176580
|
return 2 < lanes ? 8 < lanes ? 0 !== (lanes & 134217727) ? 32 : 268435456 : 8 : 2;
|
|
175956
176581
|
}
|
|
175957
176582
|
function setIsStrictModeForDevtools(newIsStrictMode) {
|
|
175958
|
-
"function" === typeof
|
|
176583
|
+
"function" === typeof log4 && unstable_setDisableYieldValue(newIsStrictMode);
|
|
175959
176584
|
if (injectedHook && "function" === typeof injectedHook.setStrictMode)
|
|
175960
176585
|
try {
|
|
175961
176586
|
injectedHook.setStrictMode(rendererID, newIsStrictMode);
|
|
@@ -183005,7 +183630,7 @@ var require_react_reconciler_production = __commonJS({
|
|
|
183005
183630
|
$$$config.diffHydratedPropsForDevWarnings;
|
|
183006
183631
|
$$$config.diffHydratedTextForDevWarnings;
|
|
183007
183632
|
$$$config.describeHydratableInstanceForDevWarnings;
|
|
183008
|
-
var validateHydratableInstance = $$$config.validateHydratableInstance, validateHydratableTextInstance = $$$config.validateHydratableTextInstance, supportsResources = $$$config.supportsResources, isHostHoistableType = $$$config.isHostHoistableType, getHoistableRoot = $$$config.getHoistableRoot, getResource = $$$config.getResource, acquireResource = $$$config.acquireResource, releaseResource = $$$config.releaseResource, hydrateHoistable = $$$config.hydrateHoistable, mountHoistable = $$$config.mountHoistable, unmountHoistable = $$$config.unmountHoistable, createHoistableInstance = $$$config.createHoistableInstance, prepareToCommitHoistables = $$$config.prepareToCommitHoistables, mayResourceSuspendCommit = $$$config.mayResourceSuspendCommit, preloadResource = $$$config.preloadResource, suspendResource = $$$config.suspendResource, supportsSingletons = $$$config.supportsSingletons, resolveSingletonInstance = $$$config.resolveSingletonInstance, acquireSingletonInstance = $$$config.acquireSingletonInstance, releaseSingletonInstance = $$$config.releaseSingletonInstance, isHostSingletonType = $$$config.isHostSingletonType, isSingletonScope = $$$config.isSingletonScope, valueStack = [], index$jscomp$0 = -1, emptyContextObject = {}, clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, log$1 = Math.log, LN2 = Math.LN2, nextTransitionUpdateLane = 256, nextTransitionDeferredLane = 262144, nextRetryLane = 4194304, scheduleCallback$3 = Scheduler2.unstable_scheduleCallback, cancelCallback$1 = Scheduler2.unstable_cancelCallback, shouldYield = Scheduler2.unstable_shouldYield, requestPaint = Scheduler2.unstable_requestPaint, now = Scheduler2.unstable_now, ImmediatePriority = Scheduler2.unstable_ImmediatePriority, UserBlockingPriority = Scheduler2.unstable_UserBlockingPriority, NormalPriority$1 = Scheduler2.unstable_NormalPriority, IdlePriority = Scheduler2.unstable_IdlePriority,
|
|
183633
|
+
var validateHydratableInstance = $$$config.validateHydratableInstance, validateHydratableTextInstance = $$$config.validateHydratableTextInstance, supportsResources = $$$config.supportsResources, isHostHoistableType = $$$config.isHostHoistableType, getHoistableRoot = $$$config.getHoistableRoot, getResource = $$$config.getResource, acquireResource = $$$config.acquireResource, releaseResource = $$$config.releaseResource, hydrateHoistable = $$$config.hydrateHoistable, mountHoistable = $$$config.mountHoistable, unmountHoistable = $$$config.unmountHoistable, createHoistableInstance = $$$config.createHoistableInstance, prepareToCommitHoistables = $$$config.prepareToCommitHoistables, mayResourceSuspendCommit = $$$config.mayResourceSuspendCommit, preloadResource = $$$config.preloadResource, suspendResource = $$$config.suspendResource, supportsSingletons = $$$config.supportsSingletons, resolveSingletonInstance = $$$config.resolveSingletonInstance, acquireSingletonInstance = $$$config.acquireSingletonInstance, releaseSingletonInstance = $$$config.releaseSingletonInstance, isHostSingletonType = $$$config.isHostSingletonType, isSingletonScope = $$$config.isSingletonScope, valueStack = [], index$jscomp$0 = -1, emptyContextObject = {}, clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, log$1 = Math.log, LN2 = Math.LN2, nextTransitionUpdateLane = 256, nextTransitionDeferredLane = 262144, nextRetryLane = 4194304, scheduleCallback$3 = Scheduler2.unstable_scheduleCallback, cancelCallback$1 = Scheduler2.unstable_cancelCallback, shouldYield = Scheduler2.unstable_shouldYield, requestPaint = Scheduler2.unstable_requestPaint, now = Scheduler2.unstable_now, ImmediatePriority = Scheduler2.unstable_ImmediatePriority, UserBlockingPriority = Scheduler2.unstable_UserBlockingPriority, NormalPriority$1 = Scheduler2.unstable_NormalPriority, IdlePriority = Scheduler2.unstable_IdlePriority, log4 = Scheduler2.log, unstable_setDisableYieldValue = Scheduler2.unstable_setDisableYieldValue, rendererID = null, injectedHook = null, objectIs = "function" === typeof Object.is ? Object.is : is, reportGlobalError = "function" === typeof reportError ? reportError : function(error55) {
|
|
183009
183634
|
if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
|
|
183010
183635
|
var event = new window.ErrorEvent("error", {
|
|
183011
183636
|
bubbles: true,
|
|
@@ -184328,7 +184953,7 @@ var require_react_reconciler_development = __commonJS({
|
|
|
184328
184953
|
return hook.checkDCE ? true : false;
|
|
184329
184954
|
}
|
|
184330
184955
|
function setIsStrictModeForDevtools(newIsStrictMode) {
|
|
184331
|
-
"function" === typeof
|
|
184956
|
+
"function" === typeof log4 && unstable_setDisableYieldValue(newIsStrictMode);
|
|
184332
184957
|
if (injectedHook && "function" === typeof injectedHook.setStrictMode)
|
|
184333
184958
|
try {
|
|
184334
184959
|
injectedHook.setStrictMode(rendererID, newIsStrictMode);
|
|
@@ -195597,7 +196222,7 @@ var require_react_reconciler_development = __commonJS({
|
|
|
195597
196222
|
var fiberStack = [];
|
|
195598
196223
|
var index$jscomp$0 = -1, emptyContextObject = {};
|
|
195599
196224
|
Object.freeze(emptyContextObject);
|
|
195600
|
-
var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, log$1 = Math.log, LN2 = Math.LN2, nextTransitionUpdateLane = 256, nextTransitionDeferredLane = 262144, nextRetryLane = 4194304, scheduleCallback$3 = Scheduler2.unstable_scheduleCallback, cancelCallback$1 = Scheduler2.unstable_cancelCallback, shouldYield = Scheduler2.unstable_shouldYield, requestPaint = Scheduler2.unstable_requestPaint, now$1 = Scheduler2.unstable_now, ImmediatePriority = Scheduler2.unstable_ImmediatePriority, UserBlockingPriority = Scheduler2.unstable_UserBlockingPriority, NormalPriority$1 = Scheduler2.unstable_NormalPriority, IdlePriority = Scheduler2.unstable_IdlePriority,
|
|
196225
|
+
var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, log$1 = Math.log, LN2 = Math.LN2, nextTransitionUpdateLane = 256, nextTransitionDeferredLane = 262144, nextRetryLane = 4194304, scheduleCallback$3 = Scheduler2.unstable_scheduleCallback, cancelCallback$1 = Scheduler2.unstable_cancelCallback, shouldYield = Scheduler2.unstable_shouldYield, requestPaint = Scheduler2.unstable_requestPaint, now$1 = Scheduler2.unstable_now, ImmediatePriority = Scheduler2.unstable_ImmediatePriority, UserBlockingPriority = Scheduler2.unstable_UserBlockingPriority, NormalPriority$1 = Scheduler2.unstable_NormalPriority, IdlePriority = Scheduler2.unstable_IdlePriority, log4 = Scheduler2.log, unstable_setDisableYieldValue = Scheduler2.unstable_setDisableYieldValue, rendererID = null, injectedHook = null, hasLoggedError = false, isDevToolsPresent = "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__, lastResetTime = 0;
|
|
195601
196226
|
if ("object" === typeof performance && "function" === typeof performance.now) {
|
|
195602
196227
|
var localPerformance = performance;
|
|
195603
196228
|
var getCurrentTime = function() {
|
|
@@ -235659,6 +236284,7 @@ async function* walkAgentConfigFiles({
|
|
|
235659
236284
|
}
|
|
235660
236285
|
const ancestors = new Set(current.ancestors).add(resolvedPath);
|
|
235661
236286
|
for (const name of await fs33.readdir(resolvedPath)) {
|
|
236287
|
+
if (current.relativePath === "" && name === ".trash") continue;
|
|
235662
236288
|
stack.push({
|
|
235663
236289
|
sourcePath: path42.join(resolvedPath, name),
|
|
235664
236290
|
relativePath: path42.join(current.relativePath, name),
|
|
@@ -236192,7 +236818,7 @@ var init_agentConfigScan = __esm({
|
|
|
236192
236818
|
env: env3 = process.env,
|
|
236193
236819
|
homeDir: homeDir2 = os20.homedir(),
|
|
236194
236820
|
localRepoRoot = null,
|
|
236195
|
-
log:
|
|
236821
|
+
log: log4 = console.info,
|
|
236196
236822
|
individualSkills = false
|
|
236197
236823
|
} = {}) => {
|
|
236198
236824
|
const scannedAt = nowIso3();
|
|
@@ -236215,7 +236841,7 @@ var init_agentConfigScan = __esm({
|
|
|
236215
236841
|
for (const item of items) {
|
|
236216
236842
|
countsByCategory[item.category] = (countsByCategory[item.category] ?? 0) + 1;
|
|
236217
236843
|
}
|
|
236218
|
-
|
|
236844
|
+
log4("[desktop-agent-config-scan]", {
|
|
236219
236845
|
itemCount: items.length,
|
|
236220
236846
|
credentialFileCount,
|
|
236221
236847
|
countsByCategory,
|
|
@@ -255943,7 +256569,7 @@ var require_merge3 = __commonJS({
|
|
|
255943
256569
|
var require_addPairToJSMap = __commonJS({
|
|
255944
256570
|
"../../node_modules/yaml/dist/nodes/addPairToJSMap.js"(exports) {
|
|
255945
256571
|
"use strict";
|
|
255946
|
-
var
|
|
256572
|
+
var log4 = require_log();
|
|
255947
256573
|
var merge4 = require_merge3();
|
|
255948
256574
|
var stringify3 = require_stringify();
|
|
255949
256575
|
var identity = require_identity();
|
|
@@ -255992,7 +256618,7 @@ var require_addPairToJSMap = __commonJS({
|
|
|
255992
256618
|
let jsonStr = JSON.stringify(strKey);
|
|
255993
256619
|
if (jsonStr.length > 40)
|
|
255994
256620
|
jsonStr = jsonStr.substring(0, 36) + '..."';
|
|
255995
|
-
|
|
256621
|
+
log4.warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);
|
|
255996
256622
|
ctx.mapKeyWarned = true;
|
|
255997
256623
|
}
|
|
255998
256624
|
return strKey;
|
|
@@ -261408,7 +262034,7 @@ var require_public_api = __commonJS({
|
|
|
261408
262034
|
var composer = require_composer();
|
|
261409
262035
|
var Document = require_Document();
|
|
261410
262036
|
var errors = require_errors2();
|
|
261411
|
-
var
|
|
262037
|
+
var log4 = require_log();
|
|
261412
262038
|
var identity = require_identity();
|
|
261413
262039
|
var lineCounter = require_line_counter();
|
|
261414
262040
|
var parser = require_parser2();
|
|
@@ -261460,7 +262086,7 @@ var require_public_api = __commonJS({
|
|
|
261460
262086
|
const doc = parseDocument(src, options);
|
|
261461
262087
|
if (!doc)
|
|
261462
262088
|
return null;
|
|
261463
|
-
doc.warnings.forEach((warning3) =>
|
|
262089
|
+
doc.warnings.forEach((warning3) => log4.warn(doc.options.logLevel, warning3));
|
|
261464
262090
|
if (doc.errors.length > 0) {
|
|
261465
262091
|
if (doc.options.logLevel !== "silent")
|
|
261466
262092
|
throw doc.errors[0];
|
|
@@ -261768,7 +262394,7 @@ var init_parse6 = __esm({
|
|
|
261768
262394
|
if (!filePath) {
|
|
261769
262395
|
return;
|
|
261770
262396
|
}
|
|
261771
|
-
const
|
|
262397
|
+
const vars2 = [];
|
|
261772
262398
|
if (record3.vars !== void 0 && record3.vars !== null) {
|
|
261773
262399
|
const varsArray = readArray(
|
|
261774
262400
|
sink,
|
|
@@ -261801,7 +262427,7 @@ var init_parse6 = __esm({
|
|
|
261801
262427
|
"Set `secret` to true when the value is sensitive."
|
|
261802
262428
|
);
|
|
261803
262429
|
if (name !== null && secret !== null) {
|
|
261804
|
-
|
|
262430
|
+
vars2.push({ name, secret });
|
|
261805
262431
|
}
|
|
261806
262432
|
});
|
|
261807
262433
|
}
|
|
@@ -261809,7 +262435,7 @@ var init_parse6 = __esm({
|
|
|
261809
262435
|
path: filePath,
|
|
261810
262436
|
note: readOptionalString(sink, `${location}.note`, record3.note),
|
|
261811
262437
|
from: readOptionalString(sink, `${location}.from`, record3.from),
|
|
261812
|
-
vars
|
|
262438
|
+
vars: vars2
|
|
261813
262439
|
});
|
|
261814
262440
|
});
|
|
261815
262441
|
return out;
|
|
@@ -263807,7 +264433,7 @@ var init_instanceType = __esm({
|
|
|
263807
264433
|
});
|
|
263808
264434
|
|
|
263809
264435
|
// src/devbox/agentInit/githubAccess.ts
|
|
263810
|
-
var resolveAgentInitGithubAccessPage, isRecord9, explainAgentInitGithubRenames, describeRenames, shellArgument, agentInitGithubRenamedOriginIssue, agentInitGithubRenamedDependencyIssue, githubIssue, githubInventoryFailureIssue, agentInitGithubInventoryRetry, readAgentInitProjectLayoutRepos, manifestGithubAccess, buildAgentInitGithubManifestIssues, normalizeInventoryRepository, normalizeInventoryInstallation, matchAgentInitGithubRepositories, agentInitGithubBlockedIssue, resolveAgentInitGithubAccessDefault, resolveAgentInitManagedGithubAccess, configureAgentInitGithubAccess, resolveAgentInitGithubDependencies;
|
|
264436
|
+
var resolveAgentInitGithubAccessPage, isRecord9, explainAgentInitGithubRenames, describeRenames, shellArgument, agentInitGithubRenamedOriginIssue, agentInitGithubRenamedDependencyIssue, withAgentInitGithubOrigin, githubIssue, githubInventoryFailureIssue, agentInitGithubInventoryRetry, readAgentInitProjectLayoutRepos, manifestGithubAccess, buildAgentInitGithubManifestIssues, normalizeInventoryRepository, normalizeInventoryInstallation, matchAgentInitGithubRepositories, agentInitGithubBlockedIssue, resolveAgentInitGithubAccessDefault, resolveAgentInitManagedGithubAccess, configureAgentInitGithubAccess, resolveAgentInitGithubDependencies;
|
|
263811
264437
|
var init_githubAccess = __esm({
|
|
263812
264438
|
"src/devbox/agentInit/githubAccess.ts"() {
|
|
263813
264439
|
"use strict";
|
|
@@ -263884,6 +264510,11 @@ var init_githubAccess = __esm({
|
|
|
263884
264510
|
),
|
|
263885
264511
|
location: "githubDependencies"
|
|
263886
264512
|
});
|
|
264513
|
+
withAgentInitGithubOrigin = (url3) => {
|
|
264514
|
+
const link2 = new URL(url3);
|
|
264515
|
+
link2.searchParams.set("state", "agent_init");
|
|
264516
|
+
return link2.href;
|
|
264517
|
+
};
|
|
263887
264518
|
githubIssue = (message, fix) => ({
|
|
263888
264519
|
level: "error",
|
|
263889
264520
|
location: "githubAccess",
|
|
@@ -263914,7 +264545,7 @@ var init_githubAccess = __esm({
|
|
|
263914
264545
|
case "github_access_denied":
|
|
263915
264546
|
return githubIssue(
|
|
263916
264547
|
"GitHub denied access to the installed repositories.",
|
|
263917
|
-
appInstallationUrl ? `Review boxes.dev repository access at ${appInstallationUrl}, then re-run check.` : "Review the boxes.dev GitHub App repository access, then re-run check."
|
|
264548
|
+
appInstallationUrl ? `Review boxes.dev repository access at ${withAgentInitGithubOrigin(appInstallationUrl)}, then re-run check.` : "Review the boxes.dev GitHub App repository access, then re-run check."
|
|
263918
264549
|
);
|
|
263919
264550
|
case "github_access_changed":
|
|
263920
264551
|
return githubIssue(
|
|
@@ -264744,7 +265375,7 @@ var init_check2 = __esm({
|
|
|
264744
265375
|
manifest.project.instanceType
|
|
264745
265376
|
);
|
|
264746
265377
|
if (!instanceType) {
|
|
264747
|
-
throw new Error("
|
|
265378
|
+
throw new Error("Setup summary instance type is not supported.");
|
|
264748
265379
|
}
|
|
264749
265380
|
lines.push(`Instance type: ${instanceType.label}`);
|
|
264750
265381
|
lines.push(
|
|
@@ -265108,16 +265739,18 @@ var init_check2 = __esm({
|
|
|
265108
265739
|
for (const issue3 of result.issues) {
|
|
265109
265740
|
console.log(`WARNING at ${issue3.location}: ${issue3.message}`);
|
|
265110
265741
|
}
|
|
265111
|
-
console.log("Manifest check passed.
|
|
265742
|
+
console.log("Manifest check passed. Setup summary:");
|
|
265112
265743
|
console.log("");
|
|
265113
265744
|
for (const line of summary ?? []) {
|
|
265114
265745
|
console.log(` ${line}`);
|
|
265115
265746
|
}
|
|
265116
265747
|
console.log("");
|
|
265117
265748
|
console.log(
|
|
265118
|
-
"Present this summary to the user and
|
|
265749
|
+
"Present this summary to the user and ask whether to upload these files and"
|
|
265750
|
+
);
|
|
265751
|
+
console.log(
|
|
265752
|
+
"create the Template box on boxes.dev. Once they approve, run `dvb agent-init run`."
|
|
265119
265753
|
);
|
|
265120
|
-
console.log("then launch with `dvb agent-init run`.");
|
|
265121
265754
|
};
|
|
265122
265755
|
}
|
|
265123
265756
|
});
|
|
@@ -266116,7 +266749,7 @@ var init_githubConnect = __esm({
|
|
|
266116
266749
|
step: "repository_access",
|
|
266117
266750
|
ownerLogin,
|
|
266118
266751
|
repositories: repositoryFullNames,
|
|
266119
|
-
url: url4,
|
|
266752
|
+
url: url4 === null ? null : withAgentInitGithubOrigin(url4),
|
|
266120
266753
|
sshAlternative
|
|
266121
266754
|
});
|
|
266122
266755
|
if (page.kind === "installation_settings") {
|
|
@@ -267262,7 +267895,7 @@ var init_run = __esm({
|
|
|
267262
267895
|
const currentHash = hashManifestText(manifestText);
|
|
267263
267896
|
if (!checkState || !checkState.ok || checkState.manifestHash !== currentHash) {
|
|
267264
267897
|
throw new Error(
|
|
267265
|
-
checkState && checkState.manifestHash !== currentHash ? "The manifest changed since the last successful `dvb agent-init check`. Re-run check, show the user the updated
|
|
267898
|
+
checkState && checkState.manifestHash !== currentHash ? "The manifest changed since the last successful `dvb agent-init check`. Re-run check, show the user the updated setup summary, and get their approval before running." : "Run `dvb agent-init check` (and get the user's approval of the setup summary) before `dvb agent-init run`."
|
|
267266
267899
|
);
|
|
267267
267900
|
}
|
|
267268
267901
|
const checkResult = await checkAgentInitManifest({
|
|
@@ -268157,10 +268790,10 @@ var init_status = __esm({
|
|
|
268157
268790
|
nextAction = `The manifest still has ${manifestTodoCount} TODO(agent) marker(s). Investigate each section (see \`dvb agent-init guide\`), then run \`dvb agent-init check\`.`;
|
|
268158
268791
|
} else if (!checkPassed || checkCurrent === false) {
|
|
268159
268792
|
phase = "ready_for_check";
|
|
268160
|
-
nextAction = checkCurrent === false ? "The manifest changed since the last check. Re-run `dvb agent-init check` and get the user's approval again." : "Run `dvb agent-init check`, show the user the
|
|
268793
|
+
nextAction = checkCurrent === false ? "The manifest changed since the last check. Re-run `dvb agent-init check` and get the user's approval again." : "Run `dvb agent-init check`, show the user the setup summary, and get their approval.";
|
|
268161
268794
|
} else {
|
|
268162
268795
|
phase = "ready_to_run";
|
|
268163
|
-
nextAction = "Check passed.
|
|
268796
|
+
nextAction = "Check passed. Ask the user whether to upload the files and create the Template box on boxes.dev. Once they approve, run `dvb agent-init run`.";
|
|
268164
268797
|
}
|
|
268165
268798
|
if (phase === "ready_to_run" && isRecord19(localPrep) && localPrep["phase"] === "packaging_bundle") {
|
|
268166
268799
|
phase = "packaging_bundle";
|
|
@@ -268284,7 +268917,7 @@ var init_agentInit = __esm({
|
|
|
268284
268917
|
" guide Workflow and per-section guides (table of contents)",
|
|
268285
268918
|
" start Validate the project and seed the setup manifest",
|
|
268286
268919
|
" detect Re-run a deterministic detector (agent-config, agent-threads, untracked)",
|
|
268287
|
-
" check Validate the manifest and print the
|
|
268920
|
+
" check Validate the manifest and print the setup summary",
|
|
268288
268921
|
" github Connect GitHub for automatic push/pull access",
|
|
268289
268922
|
" git-ssh Set up / verify Git SSH access for the Template box",
|
|
268290
268923
|
" run Execute the approved manifest end to end",
|
|
@@ -272419,9 +273052,9 @@ var renderTemplate2;
|
|
|
272419
273052
|
var init_template = __esm({
|
|
272420
273053
|
"src/devbox/commands/init/codex/template.ts"() {
|
|
272421
273054
|
"use strict";
|
|
272422
|
-
renderTemplate2 = (template,
|
|
273055
|
+
renderTemplate2 = (template, vars2) => template.replace(
|
|
272423
273056
|
/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,
|
|
272424
|
-
(match, key) =>
|
|
273057
|
+
(match, key) => vars2[key] ?? match
|
|
272425
273058
|
);
|
|
272426
273059
|
}
|
|
272427
273060
|
});
|
|
@@ -272455,7 +273088,7 @@ var init_prompts = __esm({
|
|
|
272455
273088
|
const raw = await fsPromises4.readFile(promptPath, "utf8");
|
|
272456
273089
|
return raw;
|
|
272457
273090
|
};
|
|
272458
|
-
loadPrompt = async (name,
|
|
273091
|
+
loadPrompt = async (name, vars2 = {}) => renderTemplate2(await readPromptTemplate(name), vars2).trim();
|
|
272459
273092
|
loadLocalEnvSecretsScanPrompt = async () => loadPrompt("local-scan-env-secrets.md");
|
|
272460
273093
|
loadLocalExternalScanPrompt = async () => loadPrompt("local-scan-external.md");
|
|
272461
273094
|
loadLocalExtraArtifactsScanPrompt = async () => loadPrompt("local-scan-extra-artifacts.md");
|
|
@@ -274322,7 +274955,7 @@ ${stdout}`;
|
|
|
274322
274955
|
const relative2 = path79.relative(repoRoot, resolved) || filePath;
|
|
274323
274956
|
return toPosixPath(relative2);
|
|
274324
274957
|
};
|
|
274325
|
-
countSecretVars = (
|
|
274958
|
+
countSecretVars = (vars2) => vars2.reduce((count, entry) => count + (entry.isSecret ? 1 : 0), 0);
|
|
274326
274959
|
buildEnvFileHint = (entry) => {
|
|
274327
274960
|
const usageText = entry.usage?.trim() || "none";
|
|
274328
274961
|
const secrets = countSecretVars(entry.vars);
|
|
@@ -274722,7 +275355,7 @@ var init_artifacts = __esm({
|
|
|
274722
275355
|
}
|
|
274723
275356
|
return value;
|
|
274724
275357
|
};
|
|
274725
|
-
buildArtifactEntry = (repoRoot, kind, name, artifactPath, homeDir2, description,
|
|
275358
|
+
buildArtifactEntry = (repoRoot, kind, name, artifactPath, homeDir2, description, vars2, usage2) => {
|
|
274726
275359
|
const expanded = expandHomePath2(artifactPath, homeDir2);
|
|
274727
275360
|
const resolved = path80.isAbsolute(expanded) ? expanded : path80.resolve(repoRoot, expanded);
|
|
274728
275361
|
const base = {
|
|
@@ -274734,8 +275367,8 @@ var init_artifacts = __esm({
|
|
|
274734
275367
|
if (description !== void 0) {
|
|
274735
275368
|
base.description = description;
|
|
274736
275369
|
}
|
|
274737
|
-
if (
|
|
274738
|
-
base.vars =
|
|
275370
|
+
if (vars2 !== void 0) {
|
|
275371
|
+
base.vars = vars2;
|
|
274739
275372
|
}
|
|
274740
275373
|
if (usage2 !== void 0) {
|
|
274741
275374
|
base.usage = usage2;
|
|
@@ -279553,17 +280186,17 @@ var init_setupPlanFlow = __esm({
|
|
|
279553
280186
|
}
|
|
279554
280187
|
});
|
|
279555
280188
|
} else {
|
|
279556
|
-
const
|
|
280189
|
+
const log4 = zt({
|
|
279557
280190
|
title: LOCAL_SCAN_TASK_TITLE,
|
|
279558
280191
|
limit: 1,
|
|
279559
280192
|
spacing: 0
|
|
279560
280193
|
});
|
|
279561
280194
|
let active = true;
|
|
279562
|
-
const envSecretsRow =
|
|
279563
|
-
const externalRow =
|
|
279564
|
-
const extraArtifactsRow =
|
|
279565
|
-
const databasesRow =
|
|
279566
|
-
const servicesRow =
|
|
280195
|
+
const envSecretsRow = log4.group("");
|
|
280196
|
+
const externalRow = log4.group("");
|
|
280197
|
+
const extraArtifactsRow = log4.group("");
|
|
280198
|
+
const databasesRow = log4.group("");
|
|
280199
|
+
const servicesRow = log4.group("");
|
|
279567
280200
|
const makeUpdater = (row, label) => {
|
|
279568
280201
|
let state = createInitialScanRowState("starting");
|
|
279569
280202
|
const render2 = () => {
|
|
@@ -279622,10 +280255,10 @@ var init_setupPlanFlow = __esm({
|
|
|
279622
280255
|
updateServices
|
|
279623
280256
|
});
|
|
279624
280257
|
active = false;
|
|
279625
|
-
|
|
280258
|
+
log4.success(LOCAL_SCAN_TASK_TITLE);
|
|
279626
280259
|
} catch (error55) {
|
|
279627
280260
|
active = false;
|
|
279628
|
-
|
|
280261
|
+
log4.error(LOCAL_SCAN_TASK_TITLE);
|
|
279629
280262
|
throw error55;
|
|
279630
280263
|
}
|
|
279631
280264
|
}
|
|
@@ -280301,17 +280934,17 @@ var init_setupPlanFlow = __esm({
|
|
|
280301
280934
|
}
|
|
280302
280935
|
});
|
|
280303
280936
|
} else {
|
|
280304
|
-
const
|
|
280937
|
+
const log4 = zt({
|
|
280305
280938
|
title: "Applying Codex feedback",
|
|
280306
280939
|
limit: 1,
|
|
280307
280940
|
spacing: 0
|
|
280308
280941
|
});
|
|
280309
280942
|
let active = true;
|
|
280310
|
-
const envSecretsRow = envSecretsFeedback ?
|
|
280311
|
-
const externalRow = externalFeedback ?
|
|
280312
|
-
const extraArtifactsRow = extraArtifactsFeedback ?
|
|
280313
|
-
const databasesRow = databasesFeedback ?
|
|
280314
|
-
const servicesRow = servicesFeedback ?
|
|
280943
|
+
const envSecretsRow = envSecretsFeedback ? log4.group("") : null;
|
|
280944
|
+
const externalRow = externalFeedback ? log4.group("") : null;
|
|
280945
|
+
const extraArtifactsRow = extraArtifactsFeedback ? log4.group("") : null;
|
|
280946
|
+
const databasesRow = databasesFeedback ? log4.group("") : null;
|
|
280947
|
+
const servicesRow = servicesFeedback ? log4.group("") : null;
|
|
280315
280948
|
const makeUpdater = (row, label) => {
|
|
280316
280949
|
let state = createInitialScanRowState("starting");
|
|
280317
280950
|
const render2 = () => {
|
|
@@ -280359,10 +280992,10 @@ var init_setupPlanFlow = __esm({
|
|
|
280359
280992
|
updateServices
|
|
280360
280993
|
});
|
|
280361
280994
|
active = false;
|
|
280362
|
-
|
|
280995
|
+
log4.success("Applying Codex feedback");
|
|
280363
280996
|
} catch (error55) {
|
|
280364
280997
|
active = false;
|
|
280365
|
-
|
|
280998
|
+
log4.error("Applying Codex feedback");
|
|
280366
280999
|
throw error55;
|
|
280367
281000
|
}
|
|
280368
281001
|
}
|
|
@@ -295047,7 +295680,7 @@ var init_agentPermissionRequests = __esm({
|
|
|
295047
295680
|
init_resourceOutput();
|
|
295048
295681
|
listPending = makeFunctionReference("onboxAgentPermissionRequestList:listPendingForViewer");
|
|
295049
295682
|
respond = makeFunctionReference("onboxAgentPermissionRequests:respondForViewer");
|
|
295050
|
-
boxLabel = (entry) => `${entry.sourceBoxKind === "template_box" ? "Template box" : "devbox"} ${entry.boxAlias}`;
|
|
295683
|
+
boxLabel = (entry) => entry.sourceBoxKind === "coordinator" ? "the coordinator" : `${entry.sourceBoxKind === "template_box" ? "Template box" : "devbox"} ${entry.boxAlias}`;
|
|
295051
295684
|
describeRequest = (entry) => {
|
|
295052
295685
|
const { permission } = entry.request;
|
|
295053
295686
|
if (!isOnboxAgentPermission(permission)) {
|
|
@@ -295171,7 +295804,7 @@ var init_agentPermissionRequests = __esm({
|
|
|
295171
295804
|
if (isOnboxAgentPermission(permission) && isOnboxAgentThreadGrantPermission(permission)) {
|
|
295172
295805
|
return `Allowed ${permission} for 3 hours in thread "${entry.threadTitle}".`;
|
|
295173
295806
|
}
|
|
295174
|
-
return scope === "project" ? `Allowed ${permission} for the project. It will apply to ${boxLabel(entry)} and to devboxes you haven't configured separately.` : `Allowed ${permission} on ${boxLabel(entry)}.`;
|
|
295807
|
+
return scope === "project" ? `Allowed ${permission} for the project. It will apply to ${boxLabel(entry)} and to devboxes you haven't configured separately.` : `Allowed ${permission} ${entry.sourceBoxKind === "coordinator" ? "for" : "on"} ${boxLabel(entry)}.`;
|
|
295175
295808
|
};
|
|
295176
295809
|
runAnswer = async (decision, args, dependencies) => {
|
|
295177
295810
|
const parsed = parseAnswerArgs(decision, args);
|
|
@@ -301839,4 +302472,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
301839
302472
|
*)
|
|
301840
302473
|
*/
|
|
301841
302474
|
|
|
301842
|
-
//# debugId=
|
|
302475
|
+
//# debugId=d1495133-92a8-5a9b-ad94-6837cfa5aec7
|