@boxes-dev/dvb-runtime 1.0.1115 → 1.0.1116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/dvb.mjs +1525 -902
- package/dist/bin/dvbd.mjs +923 -347
- package/dist/product-docs/references/desktop-workbench.md +10 -0
- package/dist/product-docs/references/files-git-and-review.md +8 -3
- package/dist/product-docs/references/fork-workflows.md +5 -0
- package/dist/product-docs/references/onbox-agent-tools.md +95 -10
- package/dist/product-docs/references/slack.md +3 -1
- package/dist/product-docs/references/team-template.md +4 -1
- package/dist/product-docs/references/threads-and-agents.md +15 -3
- package/package.json +3 -3
package/dist/bin/dvbd.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
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]="ca23bafa-20c4-5334-b483-09d7c9e9b34e")}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";
|
|
@@ -20459,10 +20459,10 @@ var init_ajvProvider_97rDpkRx = __esm({
|
|
|
20459
20459
|
Ajv2.ValidationError = validation_error_1.default;
|
|
20460
20460
|
Ajv2.MissingRefError = ref_error_1.default;
|
|
20461
20461
|
exports.default = Ajv2;
|
|
20462
|
-
function checkOptions(checkOpts, options, msg,
|
|
20462
|
+
function checkOptions(checkOpts, options, msg, log4 = "error") {
|
|
20463
20463
|
for (const key in checkOpts) {
|
|
20464
20464
|
const opt = key;
|
|
20465
|
-
if (opt in options) this.logger[
|
|
20465
|
+
if (opt in options) this.logger[log4](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
20466
20466
|
}
|
|
20467
20467
|
}
|
|
20468
20468
|
function getSchEnv(keyRef) {
|
|
@@ -24283,7 +24283,7 @@ var init_logger = __esm({
|
|
|
24283
24283
|
shouldLog = (minLevel, level) => levelOrder[level] >= levelOrder[minLevel];
|
|
24284
24284
|
createLogger = (component) => {
|
|
24285
24285
|
const minLevel = normalizeLevel(process.env.DEVBOX_LOG_LEVEL);
|
|
24286
|
-
const
|
|
24286
|
+
const log4 = (level, message, fields) => {
|
|
24287
24287
|
if (!shouldLog(minLevel, level))
|
|
24288
24288
|
return;
|
|
24289
24289
|
const payload = {
|
|
@@ -24296,10 +24296,10 @@ var init_logger = __esm({
|
|
|
24296
24296
|
console.error(JSON.stringify(payload));
|
|
24297
24297
|
};
|
|
24298
24298
|
return {
|
|
24299
|
-
debug: (message, fields) =>
|
|
24300
|
-
info: (message, fields) =>
|
|
24301
|
-
warn: (message, fields) =>
|
|
24302
|
-
error: (message, fields) =>
|
|
24299
|
+
debug: (message, fields) => log4("debug", message, fields),
|
|
24300
|
+
info: (message, fields) => log4("info", message, fields),
|
|
24301
|
+
warn: (message, fields) => log4("warn", message, fields),
|
|
24302
|
+
error: (message, fields) => log4("error", message, fields)
|
|
24303
24303
|
};
|
|
24304
24304
|
};
|
|
24305
24305
|
}
|
|
@@ -29808,13 +29808,13 @@ function _INTERNAL_captureLog(beforeLog, currentScope = getCurrentScope(), captu
|
|
|
29808
29808
|
setLogAttribute(processedLogAttributes, "sentry.trace.parent_span_id", span?.spanContext().spanId);
|
|
29809
29809
|
const processedLog = { ...beforeLog, attributes: processedLogAttributes };
|
|
29810
29810
|
client.emit("beforeCaptureLog", processedLog);
|
|
29811
|
-
const
|
|
29812
|
-
if (!
|
|
29811
|
+
const log4 = beforeSendLog ? consoleSandbox(() => beforeSendLog(processedLog)) : processedLog;
|
|
29812
|
+
if (!log4) {
|
|
29813
29813
|
client.recordDroppedEvent("before_send", "log_item", 1);
|
|
29814
29814
|
DEBUG_BUILD && debug.warn("beforeSendLog returned null, log will not be captured.");
|
|
29815
29815
|
return;
|
|
29816
29816
|
}
|
|
29817
|
-
const { level, message, attributes: logAttributes = {}, severityNumber } =
|
|
29817
|
+
const { level, message, attributes: logAttributes = {}, severityNumber } = log4;
|
|
29818
29818
|
const timestamp = timestampInSeconds();
|
|
29819
29819
|
const sequenceAttr = getSequenceAttribute(timestamp);
|
|
29820
29820
|
const serializedLog = {
|
|
@@ -29830,7 +29830,7 @@ function _INTERNAL_captureLog(beforeLog, currentScope = getCurrentScope(), captu
|
|
|
29830
29830
|
})
|
|
29831
29831
|
};
|
|
29832
29832
|
captureSerializedLog(client, serializedLog);
|
|
29833
|
-
client.emit("afterCaptureLog",
|
|
29833
|
+
client.emit("afterCaptureLog", log4);
|
|
29834
29834
|
}
|
|
29835
29835
|
function _INTERNAL_flushLogsBuffer(client, maybeLogBuffer) {
|
|
29836
29836
|
const logBuffer = maybeLogBuffer ?? _INTERNAL_getLogBuffer(client) ?? [];
|
|
@@ -30595,12 +30595,12 @@ function estimateMetricSizeInBytes(metric) {
|
|
|
30595
30595
|
weight += 8;
|
|
30596
30596
|
return weight + estimateAttributesSizeInBytes(metric.attributes);
|
|
30597
30597
|
}
|
|
30598
|
-
function estimateLogSizeInBytes(
|
|
30598
|
+
function estimateLogSizeInBytes(log4) {
|
|
30599
30599
|
let weight = 0;
|
|
30600
|
-
if (
|
|
30601
|
-
weight +=
|
|
30600
|
+
if (log4.message) {
|
|
30601
|
+
weight += log4.message.length * 2;
|
|
30602
30602
|
}
|
|
30603
|
-
return weight + estimateAttributesSizeInBytes(
|
|
30603
|
+
return weight + estimateAttributesSizeInBytes(log4.attributes);
|
|
30604
30604
|
}
|
|
30605
30605
|
function estimateAttributesSizeInBytes(attributes) {
|
|
30606
30606
|
if (!attributes) {
|
|
@@ -32477,13 +32477,13 @@ function instrumentConsole() {
|
|
|
32477
32477
|
originalConsoleMethods[level] = originalConsoleMethod;
|
|
32478
32478
|
return function(...args) {
|
|
32479
32479
|
const firstArg = args[0];
|
|
32480
|
-
const
|
|
32480
|
+
const log4 = originalConsoleMethods[level];
|
|
32481
32481
|
const isFiltered = _filter.size && typeof firstArg === "string" && stringMatchesSomePattern(firstArg, _filter);
|
|
32482
32482
|
if (!isFiltered) {
|
|
32483
32483
|
triggerHandlers("console", { args, level });
|
|
32484
32484
|
}
|
|
32485
32485
|
if (!isFiltered || DEBUG_BUILD && debug.isEnabled()) {
|
|
32486
|
-
|
|
32486
|
+
log4?.apply(GLOBAL_OBJ.console, args);
|
|
32487
32487
|
}
|
|
32488
32488
|
};
|
|
32489
32489
|
});
|
|
@@ -41527,7 +41527,7 @@ var require_node = __commonJS({
|
|
|
41527
41527
|
var tty = __require("tty");
|
|
41528
41528
|
var util2 = __require("util");
|
|
41529
41529
|
exports.init = init3;
|
|
41530
|
-
exports.log =
|
|
41530
|
+
exports.log = log4;
|
|
41531
41531
|
exports.formatArgs = formatArgs;
|
|
41532
41532
|
exports.save = save;
|
|
41533
41533
|
exports.load = load;
|
|
@@ -41662,7 +41662,7 @@ var require_node = __commonJS({
|
|
|
41662
41662
|
}
|
|
41663
41663
|
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
41664
41664
|
}
|
|
41665
|
-
function
|
|
41665
|
+
function log4(...args) {
|
|
41666
41666
|
return process.stderr.write(util2.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
41667
41667
|
}
|
|
41668
41668
|
function save(namespaces) {
|
|
@@ -51685,12 +51685,12 @@ var init_local_variables_sync = __esm({
|
|
|
51685
51685
|
for (const prop of props) {
|
|
51686
51686
|
if (prop.value?.objectId && prop.value.className === "Array") {
|
|
51687
51687
|
const id = prop.value.objectId;
|
|
51688
|
-
add((
|
|
51688
|
+
add((vars2) => this._unrollArray(id, prop.name, vars2, next));
|
|
51689
51689
|
} else if (prop.value?.objectId && prop.value.className === "Object") {
|
|
51690
51690
|
const id = prop.value.objectId;
|
|
51691
|
-
add((
|
|
51691
|
+
add((vars2) => this._unrollObject(id, prop.name, vars2, next));
|
|
51692
51692
|
} else if (prop.value) {
|
|
51693
|
-
add((
|
|
51693
|
+
add((vars2) => this._unrollOther(prop, vars2, next));
|
|
51694
51694
|
}
|
|
51695
51695
|
}
|
|
51696
51696
|
next({});
|
|
@@ -51718,42 +51718,42 @@ var init_local_variables_sync = __esm({
|
|
|
51718
51718
|
/**
|
|
51719
51719
|
* Unrolls an array property
|
|
51720
51720
|
*/
|
|
51721
|
-
_unrollArray(objectId, name,
|
|
51721
|
+
_unrollArray(objectId, name, vars2, next) {
|
|
51722
51722
|
this._getProperties(objectId, (props) => {
|
|
51723
|
-
|
|
51724
|
-
next(
|
|
51723
|
+
vars2[name] = props.filter((v2) => v2.name !== "length" && !isNaN(parseInt(v2.name, 10))).sort((a, b) => parseInt(a.name, 10) - parseInt(b.name, 10)).map((v2) => v2.value?.value);
|
|
51724
|
+
next(vars2);
|
|
51725
51725
|
});
|
|
51726
51726
|
}
|
|
51727
51727
|
/**
|
|
51728
51728
|
* Unrolls an object property
|
|
51729
51729
|
*/
|
|
51730
|
-
_unrollObject(objectId, name,
|
|
51730
|
+
_unrollObject(objectId, name, vars2, next) {
|
|
51731
51731
|
this._getProperties(objectId, (props) => {
|
|
51732
|
-
|
|
51732
|
+
vars2[name] = props.map((v2) => [v2.name, v2.value?.value]).reduce((obj, [key, val]) => {
|
|
51733
51733
|
obj[key] = val;
|
|
51734
51734
|
return obj;
|
|
51735
51735
|
}, {});
|
|
51736
|
-
next(
|
|
51736
|
+
next(vars2);
|
|
51737
51737
|
});
|
|
51738
51738
|
}
|
|
51739
51739
|
/**
|
|
51740
51740
|
* Unrolls other properties
|
|
51741
51741
|
*/
|
|
51742
|
-
_unrollOther(prop,
|
|
51742
|
+
_unrollOther(prop, vars2, next) {
|
|
51743
51743
|
if (prop.value) {
|
|
51744
51744
|
if ("value" in prop.value) {
|
|
51745
51745
|
if (prop.value.value === void 0 || prop.value.value === null) {
|
|
51746
|
-
|
|
51746
|
+
vars2[prop.name] = `<${prop.value.value}>`;
|
|
51747
51747
|
} else {
|
|
51748
|
-
|
|
51748
|
+
vars2[prop.name] = prop.value.value;
|
|
51749
51749
|
}
|
|
51750
51750
|
} else if ("description" in prop.value && prop.value.type !== "function") {
|
|
51751
|
-
|
|
51751
|
+
vars2[prop.name] = `<${prop.value.description}>`;
|
|
51752
51752
|
} else if (prop.value.type === "undefined") {
|
|
51753
|
-
|
|
51753
|
+
vars2[prop.name] = "<undefined>";
|
|
51754
51754
|
}
|
|
51755
51755
|
}
|
|
51756
|
-
next(
|
|
51756
|
+
next(vars2);
|
|
51757
51757
|
}
|
|
51758
51758
|
};
|
|
51759
51759
|
INTEGRATION_NAME15 = "LocalVariables";
|
|
@@ -51840,8 +51840,8 @@ var init_local_variables_sync = __esm({
|
|
|
51840
51840
|
} else {
|
|
51841
51841
|
const id = localScope.object.objectId;
|
|
51842
51842
|
add(
|
|
51843
|
-
(frames) => session.getLocalVariables(id, (
|
|
51844
|
-
frames[i] = { function: fn, vars };
|
|
51843
|
+
(frames) => session.getLocalVariables(id, (vars2) => {
|
|
51844
|
+
frames[i] = { function: fn, vars: vars2 };
|
|
51845
51845
|
next(frames);
|
|
51846
51846
|
})
|
|
51847
51847
|
);
|
|
@@ -53039,9 +53039,9 @@ var init_client2 = __esm({
|
|
|
53039
53039
|
_INTERNAL_flushLogsBuffer(this);
|
|
53040
53040
|
};
|
|
53041
53041
|
if (serverName) {
|
|
53042
|
-
this.on("beforeCaptureLog", (
|
|
53043
|
-
|
|
53044
|
-
...
|
|
53042
|
+
this.on("beforeCaptureLog", (log4) => {
|
|
53043
|
+
log4.attributes = {
|
|
53044
|
+
...log4.attributes,
|
|
53045
53045
|
"server.address": serverName
|
|
53046
53046
|
};
|
|
53047
53047
|
});
|
|
@@ -64830,9 +64830,9 @@ var init_sentry = __esm({
|
|
|
64830
64830
|
uncaughtExceptionMonitorInstalled = false;
|
|
64831
64831
|
currentDevboxSentryUser = null;
|
|
64832
64832
|
readBuildMetadata = () => {
|
|
64833
|
-
const rawPackageVersion = "1.0.
|
|
64834
|
-
const rawGitSha = "
|
|
64835
|
-
const rawSentryRelease = "boxes-dev-dvb@1.0.
|
|
64833
|
+
const rawPackageVersion = "1.0.1116";
|
|
64834
|
+
const rawGitSha = "d955b3df0b12f1206e0fffeef958599e70b3c409";
|
|
64835
|
+
const rawSentryRelease = "boxes-dev-dvb@1.0.1116+d955b3df0b12f1206e0fffeef958599e70b3c409";
|
|
64836
64836
|
const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
|
|
64837
64837
|
const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
|
|
64838
64838
|
const sentryRelease = typeof rawSentryRelease === "string" ? rawSentryRelease : void 0;
|
|
@@ -67261,7 +67261,7 @@ var init_desktopInitContracts = __esm({
|
|
|
67261
67261
|
});
|
|
67262
67262
|
|
|
67263
67263
|
// ../../../../shared/devboxCore/dist/desktopObjectTransfers.js
|
|
67264
|
-
var DESKTOP_OBJECT_TRANSFER_MAX_FILE_BYTES, DESKTOP_OBJECT_TRANSFER_MAX_BATCH_BYTES, DESKTOP_OBJECT_TRANSFER_IMPORT_TIMEOUT_MS, DESKTOP_OBJECT_TRANSFER_MULTIPART_THRESHOLD_BYTES, DESKTOP_OBJECT_TRANSFER_MULTIPART_PART_SIZE_BYTES, DESKTOP_OBJECT_TRANSFER_UPLOAD_URL_TTL_SECONDS, DESKTOP_OBJECT_TRANSFER_DOWNLOAD_URL_TTL_SECONDS;
|
|
67264
|
+
var DESKTOP_OBJECT_TRANSFER_MAX_FILE_BYTES, DESKTOP_OBJECT_TRANSFER_MAX_BATCH_BYTES, DESKTOP_OBJECT_TRANSFER_IMPORT_TIMEOUT_MS, DESKTOP_OBJECT_TRANSFER_MULTIPART_THRESHOLD_BYTES, DESKTOP_OBJECT_TRANSFER_MULTIPART_PART_SIZE_BYTES, DESKTOP_OBJECT_TRANSFER_UPLOAD_URL_TTL_SECONDS, DESKTOP_OBJECT_TRANSFER_DOWNLOAD_URL_TTL_SECONDS, DESKTOP_WORKSPACE_DOWNLOAD_UPLOAD_TIMEOUT_MS;
|
|
67265
67265
|
var init_desktopObjectTransfers = __esm({
|
|
67266
67266
|
"../../../../shared/devboxCore/dist/desktopObjectTransfers.js"() {
|
|
67267
67267
|
"use strict";
|
|
@@ -67272,6 +67272,7 @@ var init_desktopObjectTransfers = __esm({
|
|
|
67272
67272
|
DESKTOP_OBJECT_TRANSFER_MULTIPART_PART_SIZE_BYTES = 64 * 1024 * 1024;
|
|
67273
67273
|
DESKTOP_OBJECT_TRANSFER_UPLOAD_URL_TTL_SECONDS = 15 * 60;
|
|
67274
67274
|
DESKTOP_OBJECT_TRANSFER_DOWNLOAD_URL_TTL_SECONDS = 15 * 60;
|
|
67275
|
+
DESKTOP_WORKSPACE_DOWNLOAD_UPLOAD_TIMEOUT_MS = DESKTOP_OBJECT_TRANSFER_UPLOAD_URL_TTL_SECONDS * 1e3 - 6e4;
|
|
67275
67276
|
}
|
|
67276
67277
|
});
|
|
67277
67278
|
|
|
@@ -67383,7 +67384,7 @@ var init_packageVersion = __esm({
|
|
|
67383
67384
|
return path8.join(process.cwd(), "dvb");
|
|
67384
67385
|
};
|
|
67385
67386
|
readEmbeddedPackageVersion = () => {
|
|
67386
|
-
const raw = "1.0.
|
|
67387
|
+
const raw = "1.0.1116";
|
|
67387
67388
|
return trimVersion(raw);
|
|
67388
67389
|
};
|
|
67389
67390
|
readNearestPackageMetadata = (basePath) => {
|
|
@@ -67702,7 +67703,7 @@ var version2;
|
|
|
67702
67703
|
var init_esm6 = __esm({
|
|
67703
67704
|
"../../node_modules/convex/dist/esm/index.js"() {
|
|
67704
67705
|
"use strict";
|
|
67705
|
-
version2 = "1.
|
|
67706
|
+
version2 = "1.48.0";
|
|
67706
67707
|
}
|
|
67707
67708
|
});
|
|
67708
67709
|
|
|
@@ -67997,6 +67998,12 @@ function jsonToConvex(value) {
|
|
|
67997
67998
|
}
|
|
67998
67999
|
return float;
|
|
67999
68000
|
}
|
|
68001
|
+
if (key === "$commitTs") {
|
|
68002
|
+
if (value.$commitTs !== null) {
|
|
68003
|
+
throw new Error(`Malformed $commitTs field on ${value}`);
|
|
68004
|
+
}
|
|
68005
|
+
return commitTsPlaceholder;
|
|
68006
|
+
}
|
|
68000
68007
|
if (key === "$set") {
|
|
68001
68008
|
throw new Error(
|
|
68002
68009
|
`Received a Set which is no longer supported as a Convex type.`
|
|
@@ -68020,6 +68027,12 @@ function stringifyValueForError(value) {
|
|
|
68020
68027
|
if (value2 === void 0) {
|
|
68021
68028
|
return "undefined";
|
|
68022
68029
|
}
|
|
68030
|
+
if (typeof value2 === "function") {
|
|
68031
|
+
return "[Function]";
|
|
68032
|
+
}
|
|
68033
|
+
if (typeof value2 === "symbol") {
|
|
68034
|
+
return String(value2);
|
|
68035
|
+
}
|
|
68023
68036
|
if (typeof value2 === "bigint") {
|
|
68024
68037
|
return `${value2.toString()}n`;
|
|
68025
68038
|
}
|
|
@@ -68074,6 +68087,9 @@ function convexToJsonInternal(value, originalValue, context34, includeTopLevelUn
|
|
|
68074
68087
|
if (value instanceof ArrayBuffer) {
|
|
68075
68088
|
return { $bytes: fromByteArray(new Uint8Array(value)) };
|
|
68076
68089
|
}
|
|
68090
|
+
if (value instanceof CommitTsPlaceholder) {
|
|
68091
|
+
return { $commitTs: null };
|
|
68092
|
+
}
|
|
68077
68093
|
if (Array.isArray(value)) {
|
|
68078
68094
|
return value.map(
|
|
68079
68095
|
(value2, i) => convexToJsonInternal(value2, originalValue, context34 + `[${i}]`, false)
|
|
@@ -68144,7 +68160,7 @@ function convexOrUndefinedToJsonInternal(value, originalValue, context34) {
|
|
|
68144
68160
|
function convexToJson(value) {
|
|
68145
68161
|
return convexToJsonInternal(value, value, "", false);
|
|
68146
68162
|
}
|
|
68147
|
-
var LITTLE_ENDIAN, MIN_INT64, MAX_INT64, ZERO, EIGHT, TWOFIFTYSIX, bigIntToBase64, base64ToBigInt, MAX_IDENTIFIER_LEN, MAX_VALUE_FOR_ERROR_LEN;
|
|
68163
|
+
var LITTLE_ENDIAN, MIN_INT64, MAX_INT64, ZERO, EIGHT, TWOFIFTYSIX, COMMIT_TS_UNRESOLVED, CommitTsPlaceholder, commitTsPlaceholder, bigIntToBase64, base64ToBigInt, MAX_IDENTIFIER_LEN, MAX_VALUE_FOR_ERROR_LEN;
|
|
68148
68164
|
var init_value = __esm({
|
|
68149
68165
|
"../../node_modules/convex/dist/esm/values/value.js"() {
|
|
68150
68166
|
"use strict";
|
|
@@ -68156,6 +68172,25 @@ var init_value = __esm({
|
|
|
68156
68172
|
ZERO = BigInt("0");
|
|
68157
68173
|
EIGHT = BigInt("8");
|
|
68158
68174
|
TWOFIFTYSIX = BigInt("256");
|
|
68175
|
+
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.";
|
|
68176
|
+
CommitTsPlaceholder = class {
|
|
68177
|
+
[Symbol.toPrimitive](hint) {
|
|
68178
|
+
if (hint === "string") {
|
|
68179
|
+
return this.toString();
|
|
68180
|
+
}
|
|
68181
|
+
throw new Error(COMMIT_TS_UNRESOLVED);
|
|
68182
|
+
}
|
|
68183
|
+
valueOf() {
|
|
68184
|
+
throw new Error(COMMIT_TS_UNRESOLVED);
|
|
68185
|
+
}
|
|
68186
|
+
toJSON() {
|
|
68187
|
+
throw new Error(COMMIT_TS_UNRESOLVED);
|
|
68188
|
+
}
|
|
68189
|
+
toString() {
|
|
68190
|
+
return "[unresolved commit timestamp]";
|
|
68191
|
+
}
|
|
68192
|
+
};
|
|
68193
|
+
commitTsPlaceholder = new CommitTsPlaceholder();
|
|
68159
68194
|
bigIntToBase64 = DataView.prototype.setBigInt64 ? modernBigIntToBase64 : slowBigIntToBase64;
|
|
68160
68195
|
base64ToBigInt = DataView.prototype.getBigInt64 ? modernBase64ToBigInt : slowBase64ToBigInt;
|
|
68161
68196
|
MAX_IDENTIFIER_LEN = 1024;
|
|
@@ -68170,7 +68205,7 @@ function throwUndefinedValidatorError(context34, fieldName) {
|
|
|
68170
68205
|
`A validator is undefined${fieldInfo} in ${context34}. This is often caused by circular imports. See ${UNDEFINED_VALIDATOR_ERROR_URL} for details.`
|
|
68171
68206
|
);
|
|
68172
68207
|
}
|
|
68173
|
-
var __defProp3, __defNormalProp, __publicField, UNDEFINED_VALIDATOR_ERROR_URL, BaseValidator, VId, VFloat64, VInt64, VBoolean, VBytes, VString, VNull, VAny, VObject, VLiteral, VArray, VRecord, VUnion;
|
|
68208
|
+
var __defProp3, __defNormalProp, __publicField, UNDEFINED_VALIDATOR_ERROR_URL, BaseValidator, VId, VFloat64, VInt64, VCommitTs, VBoolean, VBytes, VString, VNull, VAny, VObject, VLiteral, VArray, VRecord, VUnion;
|
|
68174
68209
|
var init_validators = __esm({
|
|
68175
68210
|
"../../node_modules/convex/dist/esm/values/validators.js"() {
|
|
68176
68211
|
"use strict";
|
|
@@ -68209,13 +68244,17 @@ var init_validators = __esm({
|
|
|
68209
68244
|
get json() {
|
|
68210
68245
|
return { type: "id", tableName: this.tableName };
|
|
68211
68246
|
}
|
|
68212
|
-
/**
|
|
68213
|
-
|
|
68247
|
+
/** Allow this field to be validated as absent. */
|
|
68248
|
+
optional() {
|
|
68214
68249
|
return new _VId({
|
|
68215
68250
|
isOptional: "optional",
|
|
68216
68251
|
tableName: this.tableName
|
|
68217
68252
|
});
|
|
68218
68253
|
}
|
|
68254
|
+
/** @internal */
|
|
68255
|
+
asOptional() {
|
|
68256
|
+
return this.optional();
|
|
68257
|
+
}
|
|
68219
68258
|
};
|
|
68220
68259
|
VFloat64 = class _VFloat64 extends BaseValidator {
|
|
68221
68260
|
constructor() {
|
|
@@ -68226,12 +68265,16 @@ var init_validators = __esm({
|
|
|
68226
68265
|
get json() {
|
|
68227
68266
|
return { type: "number" };
|
|
68228
68267
|
}
|
|
68229
|
-
/**
|
|
68230
|
-
|
|
68268
|
+
/** Allow this field to be validated as absent. */
|
|
68269
|
+
optional() {
|
|
68231
68270
|
return new _VFloat64({
|
|
68232
68271
|
isOptional: "optional"
|
|
68233
68272
|
});
|
|
68234
68273
|
}
|
|
68274
|
+
/** @internal */
|
|
68275
|
+
asOptional() {
|
|
68276
|
+
return this.optional();
|
|
68277
|
+
}
|
|
68235
68278
|
};
|
|
68236
68279
|
VInt64 = class _VInt64 extends BaseValidator {
|
|
68237
68280
|
constructor() {
|
|
@@ -68242,26 +68285,54 @@ var init_validators = __esm({
|
|
|
68242
68285
|
get json() {
|
|
68243
68286
|
return { type: "bigint" };
|
|
68244
68287
|
}
|
|
68288
|
+
/** Allow this validated field to be absent. */
|
|
68289
|
+
optional() {
|
|
68290
|
+
return new _VInt64({ isOptional: "optional" });
|
|
68291
|
+
}
|
|
68245
68292
|
/** @internal */
|
|
68246
68293
|
asOptional() {
|
|
68247
|
-
return
|
|
68294
|
+
return this.optional();
|
|
68248
68295
|
}
|
|
68249
68296
|
};
|
|
68250
|
-
|
|
68297
|
+
VCommitTs = class _VCommitTs extends BaseValidator {
|
|
68251
68298
|
constructor() {
|
|
68252
68299
|
super(...arguments);
|
|
68253
|
-
__publicField(this, "kind", "
|
|
68300
|
+
__publicField(this, "kind", "commitTs");
|
|
68254
68301
|
}
|
|
68255
68302
|
/** @internal */
|
|
68256
68303
|
get json() {
|
|
68257
68304
|
return { type: this.kind };
|
|
68258
68305
|
}
|
|
68306
|
+
/** Allow this validated field to be absent. */
|
|
68307
|
+
optional() {
|
|
68308
|
+
return new _VCommitTs({
|
|
68309
|
+
isOptional: "optional"
|
|
68310
|
+
});
|
|
68311
|
+
}
|
|
68259
68312
|
/** @internal */
|
|
68260
68313
|
asOptional() {
|
|
68314
|
+
return this.optional();
|
|
68315
|
+
}
|
|
68316
|
+
};
|
|
68317
|
+
VBoolean = class _VBoolean extends BaseValidator {
|
|
68318
|
+
constructor() {
|
|
68319
|
+
super(...arguments);
|
|
68320
|
+
__publicField(this, "kind", "boolean");
|
|
68321
|
+
}
|
|
68322
|
+
/** @internal */
|
|
68323
|
+
get json() {
|
|
68324
|
+
return { type: this.kind };
|
|
68325
|
+
}
|
|
68326
|
+
/** Allow this validated field to be absent. */
|
|
68327
|
+
optional() {
|
|
68261
68328
|
return new _VBoolean({
|
|
68262
68329
|
isOptional: "optional"
|
|
68263
68330
|
});
|
|
68264
68331
|
}
|
|
68332
|
+
/** @internal */
|
|
68333
|
+
asOptional() {
|
|
68334
|
+
return this.optional();
|
|
68335
|
+
}
|
|
68265
68336
|
};
|
|
68266
68337
|
VBytes = class _VBytes extends BaseValidator {
|
|
68267
68338
|
constructor() {
|
|
@@ -68272,9 +68343,13 @@ var init_validators = __esm({
|
|
|
68272
68343
|
get json() {
|
|
68273
68344
|
return { type: this.kind };
|
|
68274
68345
|
}
|
|
68346
|
+
/** Allow this validated field to be absent. */
|
|
68347
|
+
optional() {
|
|
68348
|
+
return new _VBytes({ isOptional: "optional" });
|
|
68349
|
+
}
|
|
68275
68350
|
/** @internal */
|
|
68276
68351
|
asOptional() {
|
|
68277
|
-
return
|
|
68352
|
+
return this.optional();
|
|
68278
68353
|
}
|
|
68279
68354
|
};
|
|
68280
68355
|
VString = class _VString extends BaseValidator {
|
|
@@ -68286,12 +68361,16 @@ var init_validators = __esm({
|
|
|
68286
68361
|
get json() {
|
|
68287
68362
|
return { type: this.kind };
|
|
68288
68363
|
}
|
|
68289
|
-
/**
|
|
68290
|
-
|
|
68364
|
+
/** Allow this validated field to be absent. */
|
|
68365
|
+
optional() {
|
|
68291
68366
|
return new _VString({
|
|
68292
68367
|
isOptional: "optional"
|
|
68293
68368
|
});
|
|
68294
68369
|
}
|
|
68370
|
+
/** @internal */
|
|
68371
|
+
asOptional() {
|
|
68372
|
+
return this.optional();
|
|
68373
|
+
}
|
|
68295
68374
|
};
|
|
68296
68375
|
VNull = class _VNull extends BaseValidator {
|
|
68297
68376
|
constructor() {
|
|
@@ -68302,9 +68381,13 @@ var init_validators = __esm({
|
|
|
68302
68381
|
get json() {
|
|
68303
68382
|
return { type: this.kind };
|
|
68304
68383
|
}
|
|
68384
|
+
/** Allow this validated field to be absent. */
|
|
68385
|
+
optional() {
|
|
68386
|
+
return new _VNull({ isOptional: "optional" });
|
|
68387
|
+
}
|
|
68305
68388
|
/** @internal */
|
|
68306
68389
|
asOptional() {
|
|
68307
|
-
return
|
|
68390
|
+
return this.optional();
|
|
68308
68391
|
}
|
|
68309
68392
|
};
|
|
68310
68393
|
VAny = class _VAny extends BaseValidator {
|
|
@@ -68318,12 +68401,16 @@ var init_validators = __esm({
|
|
|
68318
68401
|
type: this.kind
|
|
68319
68402
|
};
|
|
68320
68403
|
}
|
|
68321
|
-
/**
|
|
68322
|
-
|
|
68404
|
+
/** Allow this validated field to be absent. */
|
|
68405
|
+
optional() {
|
|
68323
68406
|
return new _VAny({
|
|
68324
68407
|
isOptional: "optional"
|
|
68325
68408
|
});
|
|
68326
68409
|
}
|
|
68410
|
+
/** @internal */
|
|
68411
|
+
asOptional() {
|
|
68412
|
+
return this.optional();
|
|
68413
|
+
}
|
|
68327
68414
|
};
|
|
68328
68415
|
VObject = class _VObject extends BaseValidator {
|
|
68329
68416
|
/**
|
|
@@ -68361,13 +68448,17 @@ var init_validators = __esm({
|
|
|
68361
68448
|
)
|
|
68362
68449
|
};
|
|
68363
68450
|
}
|
|
68364
|
-
/**
|
|
68365
|
-
|
|
68451
|
+
/** Allow this validated field to be absent. */
|
|
68452
|
+
optional() {
|
|
68366
68453
|
return new _VObject({
|
|
68367
68454
|
isOptional: "optional",
|
|
68368
68455
|
fields: this.fields
|
|
68369
68456
|
});
|
|
68370
68457
|
}
|
|
68458
|
+
/** @internal */
|
|
68459
|
+
asOptional() {
|
|
68460
|
+
return this.optional();
|
|
68461
|
+
}
|
|
68371
68462
|
/**
|
|
68372
68463
|
* Create a new VObject with the specified fields omitted.
|
|
68373
68464
|
* @param fields The field names to omit from this VObject.
|
|
@@ -68440,13 +68531,17 @@ var init_validators = __esm({
|
|
|
68440
68531
|
value: convexToJson(this.value)
|
|
68441
68532
|
};
|
|
68442
68533
|
}
|
|
68443
|
-
/**
|
|
68444
|
-
|
|
68534
|
+
/** Allow this validated field to be absent. */
|
|
68535
|
+
optional() {
|
|
68445
68536
|
return new _VLiteral({
|
|
68446
68537
|
isOptional: "optional",
|
|
68447
68538
|
value: this.value
|
|
68448
68539
|
});
|
|
68449
68540
|
}
|
|
68541
|
+
/** @internal */
|
|
68542
|
+
asOptional() {
|
|
68543
|
+
return this.optional();
|
|
68544
|
+
}
|
|
68450
68545
|
};
|
|
68451
68546
|
VArray = class _VArray extends BaseValidator {
|
|
68452
68547
|
/**
|
|
@@ -68471,13 +68566,17 @@ var init_validators = __esm({
|
|
|
68471
68566
|
value: this.element.json
|
|
68472
68567
|
};
|
|
68473
68568
|
}
|
|
68474
|
-
/**
|
|
68475
|
-
|
|
68569
|
+
/** Allow this validated field to be absent. */
|
|
68570
|
+
optional() {
|
|
68476
68571
|
return new _VArray({
|
|
68477
68572
|
isOptional: "optional",
|
|
68478
68573
|
element: this.element
|
|
68479
68574
|
});
|
|
68480
68575
|
}
|
|
68576
|
+
/** @internal */
|
|
68577
|
+
asOptional() {
|
|
68578
|
+
return this.optional();
|
|
68579
|
+
}
|
|
68481
68580
|
};
|
|
68482
68581
|
VRecord = class _VRecord extends BaseValidator {
|
|
68483
68582
|
/**
|
|
@@ -68505,7 +68604,7 @@ var init_validators = __esm({
|
|
|
68505
68604
|
throw new Error("Record validator cannot have optional values");
|
|
68506
68605
|
}
|
|
68507
68606
|
if (!key.isConvexValidator || !value.isConvexValidator) {
|
|
68508
|
-
throw new Error("Key and value of v.record()
|
|
68607
|
+
throw new Error("Key and value of v.record() must be validators");
|
|
68509
68608
|
}
|
|
68510
68609
|
this.key = key;
|
|
68511
68610
|
this.value = value;
|
|
@@ -68522,14 +68621,18 @@ var init_validators = __esm({
|
|
|
68522
68621
|
}
|
|
68523
68622
|
};
|
|
68524
68623
|
}
|
|
68525
|
-
/**
|
|
68526
|
-
|
|
68624
|
+
/** Allow this validated field to be absent. */
|
|
68625
|
+
optional() {
|
|
68527
68626
|
return new _VRecord({
|
|
68528
68627
|
isOptional: "optional",
|
|
68529
68628
|
key: this.key,
|
|
68530
68629
|
value: this.value
|
|
68531
68630
|
});
|
|
68532
68631
|
}
|
|
68632
|
+
/** @internal */
|
|
68633
|
+
asOptional() {
|
|
68634
|
+
return this.optional();
|
|
68635
|
+
}
|
|
68533
68636
|
};
|
|
68534
68637
|
VUnion = class _VUnion extends BaseValidator {
|
|
68535
68638
|
/**
|
|
@@ -68556,20 +68659,24 @@ var init_validators = __esm({
|
|
|
68556
68659
|
value: this.members.map((v2) => v2.json)
|
|
68557
68660
|
};
|
|
68558
68661
|
}
|
|
68559
|
-
/**
|
|
68560
|
-
|
|
68662
|
+
/** Allow this validated field to be absent. */
|
|
68663
|
+
optional() {
|
|
68561
68664
|
return new _VUnion({
|
|
68562
68665
|
isOptional: "optional",
|
|
68563
68666
|
members: this.members
|
|
68564
68667
|
});
|
|
68565
68668
|
}
|
|
68669
|
+
/** @internal */
|
|
68670
|
+
asOptional() {
|
|
68671
|
+
return this.optional();
|
|
68672
|
+
}
|
|
68566
68673
|
};
|
|
68567
68674
|
}
|
|
68568
68675
|
});
|
|
68569
68676
|
|
|
68570
68677
|
// ../../node_modules/convex/dist/esm/values/validator.js
|
|
68571
68678
|
function isValidator(v2) {
|
|
68572
|
-
return
|
|
68679
|
+
return v2?.isConvexValidator === true;
|
|
68573
68680
|
}
|
|
68574
68681
|
var v;
|
|
68575
68682
|
var init_validator = __esm({
|
|
@@ -68578,7 +68685,16 @@ var init_validator = __esm({
|
|
|
68578
68685
|
init_validators();
|
|
68579
68686
|
v = {
|
|
68580
68687
|
/**
|
|
68581
|
-
* Validates that the value
|
|
68688
|
+
* Validates that the value is a document ID for the given table.
|
|
68689
|
+
*
|
|
68690
|
+
* IDs are strings at runtime but are typed as `Id<"tableName">` in
|
|
68691
|
+
* TypeScript for type safety.
|
|
68692
|
+
*
|
|
68693
|
+
* @example
|
|
68694
|
+
* ```typescript
|
|
68695
|
+
* args: { userId: v.id("users") }
|
|
68696
|
+
* ```
|
|
68697
|
+
*
|
|
68582
68698
|
* @param tableName The name of the table.
|
|
68583
68699
|
*/
|
|
68584
68700
|
id: (tableName) => {
|
|
@@ -68588,79 +68704,165 @@ var init_validator = __esm({
|
|
|
68588
68704
|
});
|
|
68589
68705
|
},
|
|
68590
68706
|
/**
|
|
68591
|
-
* Validates that the value is
|
|
68707
|
+
* Validates that the value is `null`.
|
|
68708
|
+
*
|
|
68709
|
+
* Use `returns: v.null()` for functions that don't return a meaningful value.
|
|
68710
|
+
* JavaScript `undefined` is not a valid Convex value, it is automatically
|
|
68711
|
+
* converted to `null`.
|
|
68592
68712
|
*/
|
|
68593
68713
|
null: () => {
|
|
68594
68714
|
return new VNull({ isOptional: "required" });
|
|
68595
68715
|
},
|
|
68596
68716
|
/**
|
|
68597
|
-
* Validates that the value is
|
|
68717
|
+
* Validates that the value is a JavaScript `number` (Convex Float64).
|
|
68718
|
+
*
|
|
68719
|
+
* Supports all IEEE-754 double-precision floating point numbers including
|
|
68720
|
+
* NaN and Infinity.
|
|
68598
68721
|
*
|
|
68599
|
-
* Alias for `v.float64()
|
|
68722
|
+
* Alias for `v.float64()`.
|
|
68600
68723
|
*/
|
|
68601
68724
|
number: () => {
|
|
68602
68725
|
return new VFloat64({ isOptional: "required" });
|
|
68603
68726
|
},
|
|
68604
68727
|
/**
|
|
68605
|
-
* Validates that the value is
|
|
68728
|
+
* Validates that the value is a JavaScript `number` (Convex Float64).
|
|
68729
|
+
*
|
|
68730
|
+
* Supports all IEEE-754 double-precision floating point numbers.
|
|
68606
68731
|
*/
|
|
68607
68732
|
float64: () => {
|
|
68608
68733
|
return new VFloat64({ isOptional: "required" });
|
|
68609
68734
|
},
|
|
68610
68735
|
/**
|
|
68611
|
-
* @deprecated Use `v.int64()` instead
|
|
68736
|
+
* @deprecated Use `v.int64()` instead.
|
|
68612
68737
|
*/
|
|
68613
68738
|
bigint: () => {
|
|
68614
68739
|
return new VInt64({ isOptional: "required" });
|
|
68615
68740
|
},
|
|
68616
68741
|
/**
|
|
68617
|
-
* Validates that the value is
|
|
68742
|
+
* Validates that the value is a JavaScript `bigint` (Convex Int64).
|
|
68743
|
+
*
|
|
68744
|
+
* Supports BigInts between -2^63 and 2^63-1.
|
|
68745
|
+
*
|
|
68746
|
+
* @example
|
|
68747
|
+
* ```typescript
|
|
68748
|
+
* args: { timestamp: v.int64() }
|
|
68749
|
+
* // Usage: createDoc({ timestamp: 1234567890n })
|
|
68750
|
+
* ```
|
|
68618
68751
|
*/
|
|
68619
68752
|
int64: () => {
|
|
68620
68753
|
return new VInt64({ isOptional: "required" });
|
|
68621
68754
|
},
|
|
68622
68755
|
/**
|
|
68623
|
-
* Validates that the value is
|
|
68756
|
+
* Validates that the value is a commit timestamp: an int64 (`bigint`)
|
|
68757
|
+
* assigned from the transaction's commit timestamp.
|
|
68758
|
+
*
|
|
68759
|
+
* An index on a field with this validator orders documents by commit order.
|
|
68760
|
+
* Accepts any int64 value; write `db.vars.commitTs` to have the field
|
|
68761
|
+
* resolve to the commit timestamp when the mutation commits.
|
|
68762
|
+
*/
|
|
68763
|
+
commitTs: () => {
|
|
68764
|
+
return new VCommitTs({ isOptional: "required" });
|
|
68765
|
+
},
|
|
68766
|
+
/**
|
|
68767
|
+
* Validates that the value is a `boolean`.
|
|
68624
68768
|
*/
|
|
68625
68769
|
boolean: () => {
|
|
68626
68770
|
return new VBoolean({ isOptional: "required" });
|
|
68627
68771
|
},
|
|
68628
68772
|
/**
|
|
68629
|
-
* Validates that the value is
|
|
68773
|
+
* Validates that the value is a `string`.
|
|
68774
|
+
*
|
|
68775
|
+
* Strings are stored as UTF-8 and their storage size is calculated as their
|
|
68776
|
+
* UTF-8 encoded size.
|
|
68630
68777
|
*/
|
|
68631
68778
|
string: () => {
|
|
68632
68779
|
return new VString({ isOptional: "required" });
|
|
68633
68780
|
},
|
|
68634
68781
|
/**
|
|
68635
|
-
* Validates that the value is
|
|
68782
|
+
* Validates that the value is an `ArrayBuffer` (Convex Bytes).
|
|
68783
|
+
*
|
|
68784
|
+
* Use for binary data.
|
|
68636
68785
|
*/
|
|
68637
68786
|
bytes: () => {
|
|
68638
68787
|
return new VBytes({ isOptional: "required" });
|
|
68639
68788
|
},
|
|
68640
68789
|
/**
|
|
68641
|
-
* Validates that the value is equal to the given literal
|
|
68790
|
+
* Validates that the value is exactly equal to the given literal.
|
|
68791
|
+
*
|
|
68792
|
+
* Useful for discriminated unions and enum-like patterns.
|
|
68793
|
+
*
|
|
68794
|
+
* @example
|
|
68795
|
+
* ```typescript
|
|
68796
|
+
* // Discriminated union pattern:
|
|
68797
|
+
* v.union(
|
|
68798
|
+
* v.object({ kind: v.literal("error"), message: v.string() }),
|
|
68799
|
+
* v.object({ kind: v.literal("success"), value: v.number() }),
|
|
68800
|
+
* )
|
|
68801
|
+
* ```
|
|
68802
|
+
*
|
|
68642
68803
|
* @param literal The literal value to compare against.
|
|
68643
68804
|
*/
|
|
68644
68805
|
literal: (literal2) => {
|
|
68645
68806
|
return new VLiteral({ isOptional: "required", value: literal2 });
|
|
68646
68807
|
},
|
|
68647
68808
|
/**
|
|
68648
|
-
* Validates that the value is an Array
|
|
68809
|
+
* Validates that the value is an `Array` where every element matches the
|
|
68810
|
+
* given validator.
|
|
68811
|
+
*
|
|
68812
|
+
* Arrays can have at most 8192 elements.
|
|
68813
|
+
*
|
|
68814
|
+
* @example
|
|
68815
|
+
* ```typescript
|
|
68816
|
+
* args: { tags: v.array(v.string()) }
|
|
68817
|
+
* args: { coordinates: v.array(v.number()) }
|
|
68818
|
+
* args: { items: v.array(v.object({ name: v.string(), qty: v.number() })) }
|
|
68819
|
+
* ```
|
|
68820
|
+
*
|
|
68649
68821
|
* @param element The validator for the elements of the array.
|
|
68650
68822
|
*/
|
|
68651
68823
|
array: (element) => {
|
|
68652
68824
|
return new VArray({ isOptional: "required", element });
|
|
68653
68825
|
},
|
|
68654
68826
|
/**
|
|
68655
|
-
* Validates that the value is an Object with the
|
|
68656
|
-
*
|
|
68827
|
+
* Validates that the value is an `Object` with the specified properties.
|
|
68828
|
+
*
|
|
68829
|
+
* Objects can have at most 1024 entries. Field names must be non-empty and
|
|
68830
|
+
* must not start with `"$"` or `"_"` (`_` is reserved for system fields
|
|
68831
|
+
* like `_id` and `_creationTime`; `$` is reserved for Convex internal use).
|
|
68832
|
+
*
|
|
68833
|
+
* @example
|
|
68834
|
+
* ```typescript
|
|
68835
|
+
* args: {
|
|
68836
|
+
* user: v.object({
|
|
68837
|
+
* name: v.string(),
|
|
68838
|
+
* email: v.string(),
|
|
68839
|
+
* age: v.optional(v.number()),
|
|
68840
|
+
* })
|
|
68841
|
+
* }
|
|
68842
|
+
* ```
|
|
68843
|
+
*
|
|
68844
|
+
* @param fields An object mapping property names to their validators.
|
|
68657
68845
|
*/
|
|
68658
68846
|
object: (fields) => {
|
|
68659
68847
|
return new VObject({ isOptional: "required", fields });
|
|
68660
68848
|
},
|
|
68661
68849
|
/**
|
|
68662
|
-
* Validates that the value is a Record with keys
|
|
68663
|
-
*
|
|
68850
|
+
* Validates that the value is a `Record` (object with dynamic keys).
|
|
68851
|
+
*
|
|
68852
|
+
* Records are objects at runtime but allow dynamic keys, unlike `v.object()`
|
|
68853
|
+
* which requires known property names. Keys must be ASCII characters only,
|
|
68854
|
+
* non-empty, and not start with `"$"` or `"_"`.
|
|
68855
|
+
*
|
|
68856
|
+
* @example
|
|
68857
|
+
* ```typescript
|
|
68858
|
+
* // Map of user IDs to scores:
|
|
68859
|
+
* args: { scores: v.record(v.id("users"), v.number()) }
|
|
68860
|
+
*
|
|
68861
|
+
* // Map of string keys to string values:
|
|
68862
|
+
* args: { metadata: v.record(v.string(), v.string()) }
|
|
68863
|
+
* ```
|
|
68864
|
+
*
|
|
68865
|
+
* @param keys The validator for the keys of the record.
|
|
68664
68866
|
* @param values The validator for the values of the record.
|
|
68665
68867
|
*/
|
|
68666
68868
|
record: (keys, values) => {
|
|
@@ -68671,7 +68873,23 @@ var init_validator = __esm({
|
|
|
68671
68873
|
});
|
|
68672
68874
|
},
|
|
68673
68875
|
/**
|
|
68674
|
-
* Validates that the value matches one of the given validators.
|
|
68876
|
+
* Validates that the value matches at least one of the given validators.
|
|
68877
|
+
*
|
|
68878
|
+
* @example
|
|
68879
|
+
* ```typescript
|
|
68880
|
+
* // Allow string or number:
|
|
68881
|
+
* args: { value: v.union(v.string(), v.number()) }
|
|
68882
|
+
*
|
|
68883
|
+
* // Discriminated union (recommended pattern):
|
|
68884
|
+
* v.union(
|
|
68885
|
+
* v.object({ kind: v.literal("text"), body: v.string() }),
|
|
68886
|
+
* v.object({ kind: v.literal("image"), url: v.string() }),
|
|
68887
|
+
* )
|
|
68888
|
+
*
|
|
68889
|
+
* // Nullable value:
|
|
68890
|
+
* returns: v.union(v.object({ ... }), v.null())
|
|
68891
|
+
* ```
|
|
68892
|
+
*
|
|
68675
68893
|
* @param members The validators to match against.
|
|
68676
68894
|
*/
|
|
68677
68895
|
union: (...members) => {
|
|
@@ -68681,27 +68899,55 @@ var init_validator = __esm({
|
|
|
68681
68899
|
});
|
|
68682
68900
|
},
|
|
68683
68901
|
/**
|
|
68684
|
-
*
|
|
68902
|
+
* A validator that accepts any Convex value without validation.
|
|
68903
|
+
*
|
|
68904
|
+
* Prefer using specific validators when possible for better type safety
|
|
68905
|
+
* and runtime validation.
|
|
68685
68906
|
*/
|
|
68686
68907
|
any: () => {
|
|
68687
68908
|
return new VAny({ isOptional: "required" });
|
|
68688
68909
|
},
|
|
68689
68910
|
/**
|
|
68690
|
-
*
|
|
68691
|
-
* @param value The property value validator to make optional.
|
|
68911
|
+
* Makes a property optional in an object validator.
|
|
68692
68912
|
*
|
|
68913
|
+
* An optional property can be omitted entirely when creating a document or
|
|
68914
|
+
* calling a function. This is different from `v.nullable()` which requires
|
|
68915
|
+
* the property to be present but allows `null`.
|
|
68916
|
+
*
|
|
68917
|
+
* @example
|
|
68693
68918
|
* ```typescript
|
|
68694
|
-
*
|
|
68695
|
-
*
|
|
68696
|
-
*
|
|
68697
|
-
* })
|
|
68919
|
+
* v.object({
|
|
68920
|
+
* name: v.string(), // required
|
|
68921
|
+
* nickname: v.optional(v.string()), // can be omitted
|
|
68922
|
+
* })
|
|
68923
|
+
*
|
|
68924
|
+
* // Valid: { name: "Alice" }
|
|
68925
|
+
* // Valid: { name: "Alice", nickname: "Ali" }
|
|
68926
|
+
* // Invalid: { name: "Alice", nickname: null } - use v.nullable() for this
|
|
68698
68927
|
* ```
|
|
68928
|
+
*
|
|
68929
|
+
* @param value The property value validator to make optional.
|
|
68699
68930
|
*/
|
|
68700
68931
|
optional: (value) => {
|
|
68701
68932
|
return value.asOptional();
|
|
68702
68933
|
},
|
|
68703
68934
|
/**
|
|
68704
|
-
* Allows
|
|
68935
|
+
* Allows a value to be either the given type or `null`.
|
|
68936
|
+
*
|
|
68937
|
+
* This is shorthand for `v.union(value, v.null())`. Unlike `v.optional()`,
|
|
68938
|
+
* the property must still be present, but may be `null`.
|
|
68939
|
+
*
|
|
68940
|
+
* @example
|
|
68941
|
+
* ```typescript
|
|
68942
|
+
* v.object({
|
|
68943
|
+
* name: v.string(),
|
|
68944
|
+
* deletedAt: v.nullable(v.number()), // must be present, can be null
|
|
68945
|
+
* })
|
|
68946
|
+
*
|
|
68947
|
+
* // Valid: { name: "Alice", deletedAt: null }
|
|
68948
|
+
* // Valid: { name: "Alice", deletedAt: 1234567890 }
|
|
68949
|
+
* // Invalid: { name: "Alice" } - deletedAt is required
|
|
68950
|
+
* ```
|
|
68705
68951
|
*/
|
|
68706
68952
|
nullable: (value) => {
|
|
68707
68953
|
return v.union(value, v.null());
|
|
@@ -68747,10 +68993,20 @@ var init_compare_utf8 = __esm({
|
|
|
68747
68993
|
var init_compare = __esm({
|
|
68748
68994
|
"../../node_modules/convex/dist/esm/values/compare.js"() {
|
|
68749
68995
|
"use strict";
|
|
68996
|
+
init_value();
|
|
68750
68997
|
init_compare_utf8();
|
|
68751
68998
|
}
|
|
68752
68999
|
});
|
|
68753
69000
|
|
|
69001
|
+
// ../../node_modules/convex/dist/esm/values/size.js
|
|
69002
|
+
var init_size = __esm({
|
|
69003
|
+
"../../node_modules/convex/dist/esm/values/size.js"() {
|
|
69004
|
+
"use strict";
|
|
69005
|
+
init_value();
|
|
69006
|
+
init_common2();
|
|
69007
|
+
}
|
|
69008
|
+
});
|
|
69009
|
+
|
|
68754
69010
|
// ../../node_modules/convex/dist/esm/values/index.js
|
|
68755
69011
|
var init_values = __esm({
|
|
68756
69012
|
"../../node_modules/convex/dist/esm/values/index.js"() {
|
|
@@ -68760,6 +69016,7 @@ var init_values = __esm({
|
|
|
68760
69016
|
init_base64();
|
|
68761
69017
|
init_errors3();
|
|
68762
69018
|
init_compare();
|
|
69019
|
+
init_size();
|
|
68763
69020
|
}
|
|
68764
69021
|
});
|
|
68765
69022
|
|
|
@@ -69135,7 +69392,7 @@ var init_local_state = __esm({
|
|
|
69135
69392
|
queryJournal(queryToken) {
|
|
69136
69393
|
return this.querySet.get(queryToken)?.journal;
|
|
69137
69394
|
}
|
|
69138
|
-
restart(
|
|
69395
|
+
restart() {
|
|
69139
69396
|
this.unpause();
|
|
69140
69397
|
this.outstandingQueriesOlderThanRestart.clear();
|
|
69141
69398
|
const modifications = [];
|
|
@@ -69149,9 +69406,7 @@ var init_local_state = __esm({
|
|
|
69149
69406
|
componentPath: localQuery.componentPath
|
|
69150
69407
|
};
|
|
69151
69408
|
modifications.push(add);
|
|
69152
|
-
|
|
69153
|
-
this.outstandingQueriesOlderThanRestart.add(localQuery.id);
|
|
69154
|
-
}
|
|
69409
|
+
this.outstandingQueriesOlderThanRestart.add(localQuery.id);
|
|
69155
69410
|
}
|
|
69156
69411
|
this.querySetVersion = 1;
|
|
69157
69412
|
const querySet = {
|
|
@@ -70534,6 +70789,7 @@ var init_web_socket_manager = __esm({
|
|
|
70534
70789
|
case "ready":
|
|
70535
70790
|
if (this.socket.paused === "uninitialized") {
|
|
70536
70791
|
this.socket = { ...this.socket, paused: "no" };
|
|
70792
|
+
this._hasEverConnected = true;
|
|
70537
70793
|
this.onOpen({
|
|
70538
70794
|
connectionCount: this.connectionCount,
|
|
70539
70795
|
lastCloseReason: this.lastCloseReason,
|
|
@@ -70723,6 +70979,8 @@ var init_authentication_manager = __esm({
|
|
|
70723
70979
|
__publicField10(this, "clearAuth");
|
|
70724
70980
|
__publicField10(this, "logger");
|
|
70725
70981
|
__publicField10(this, "refreshTokenLeewaySeconds");
|
|
70982
|
+
__publicField10(this, "initialAuthTokenReuse");
|
|
70983
|
+
__publicField10(this, "lastRefreshChange");
|
|
70726
70984
|
__publicField10(this, "tokenConfirmationAttempts", 0);
|
|
70727
70985
|
this.syncState = syncState;
|
|
70728
70986
|
this.authenticate = callbacks.authenticate;
|
|
@@ -70733,8 +70991,16 @@ var init_authentication_manager = __esm({
|
|
|
70733
70991
|
this.clearAuth = callbacks.clearAuth;
|
|
70734
70992
|
this.logger = config4.logger;
|
|
70735
70993
|
this.refreshTokenLeewaySeconds = config4.refreshTokenLeewaySeconds;
|
|
70994
|
+
this.initialAuthTokenReuse = config4.initialAuthTokenReuse;
|
|
70995
|
+
this.lastRefreshChange = false;
|
|
70736
70996
|
}
|
|
70737
|
-
|
|
70997
|
+
notifyRefreshChange(isRefreshing) {
|
|
70998
|
+
if (this.authState.state !== "noAuth" && this.authState.state !== "initialRefetch" && this.authState.config.onRefreshChange && this.lastRefreshChange !== isRefreshing) {
|
|
70999
|
+
this.lastRefreshChange = isRefreshing;
|
|
71000
|
+
this.authState.config.onRefreshChange(isRefreshing);
|
|
71001
|
+
}
|
|
71002
|
+
}
|
|
71003
|
+
async setConfig(fetchToken, onChange, onRefreshChange) {
|
|
70738
71004
|
this.resetAuthState();
|
|
70739
71005
|
this._logVerbose("pausing WS for auth token fetch");
|
|
70740
71006
|
this.pauseSocket();
|
|
@@ -70744,17 +71010,22 @@ var init_authentication_manager = __esm({
|
|
|
70744
71010
|
if (token.isFromOutdatedConfig) {
|
|
70745
71011
|
return;
|
|
70746
71012
|
}
|
|
71013
|
+
const config4 = {
|
|
71014
|
+
fetchToken,
|
|
71015
|
+
onAuthChange: onChange,
|
|
71016
|
+
onRefreshChange
|
|
71017
|
+
};
|
|
70747
71018
|
if (token.value) {
|
|
70748
71019
|
this.setAuthState({
|
|
70749
71020
|
state: "waitingForServerConfirmationOfCachedToken",
|
|
70750
|
-
config:
|
|
71021
|
+
config: config4,
|
|
70751
71022
|
hasRetried: false
|
|
70752
71023
|
});
|
|
70753
71024
|
this.authenticate(token.value);
|
|
70754
71025
|
} else {
|
|
70755
71026
|
this.setAuthState({
|
|
70756
71027
|
state: "initialRefetch",
|
|
70757
|
-
config:
|
|
71028
|
+
config: config4
|
|
70758
71029
|
});
|
|
70759
71030
|
await this.refetchToken();
|
|
70760
71031
|
}
|
|
@@ -70770,14 +71041,24 @@ var init_authentication_manager = __esm({
|
|
|
70770
71041
|
if (serverMessage.endVersion.identity <= serverMessage.startVersion.identity) {
|
|
70771
71042
|
return;
|
|
70772
71043
|
}
|
|
71044
|
+
this._logVerbose(
|
|
71045
|
+
`auth state is ${this.authState.state} when handling transition`
|
|
71046
|
+
);
|
|
71047
|
+
this.syncState.markAuthCompletion();
|
|
70773
71048
|
if (this.authState.state === "waitingForServerConfirmationOfCachedToken") {
|
|
70774
71049
|
this._logVerbose("server confirmed auth token is valid");
|
|
70775
|
-
|
|
71050
|
+
const cachedToken = this.syncState.getAuth()?.value;
|
|
71051
|
+
if (this.initialAuthTokenReuse && cachedToken) {
|
|
71052
|
+
this.scheduleTokenRefetch(cachedToken, serverMessage.clientClockSkew);
|
|
71053
|
+
} else {
|
|
71054
|
+
void this.refetchToken();
|
|
71055
|
+
}
|
|
70776
71056
|
this.authState.config.onAuthChange(true);
|
|
70777
71057
|
return;
|
|
70778
71058
|
}
|
|
70779
71059
|
if (this.authState.state === "waitingForServerConfirmationOfFreshToken") {
|
|
70780
71060
|
this._logVerbose("server confirmed new auth token is valid");
|
|
71061
|
+
this.notifyRefreshChange(false);
|
|
70781
71062
|
this.scheduleTokenRefetch(this.authState.token);
|
|
70782
71063
|
this.tokenConfirmationAttempts = 0;
|
|
70783
71064
|
if (!this.authState.hadAuth) {
|
|
@@ -70827,7 +71108,11 @@ var init_authentication_manager = __esm({
|
|
|
70827
71108
|
`retrying reauthentication, ${MAX_TOKEN_CONFIRMATION_ATTEMPTS - this.tokenConfirmationAttempts} attempts remaining`
|
|
70828
71109
|
);
|
|
70829
71110
|
}
|
|
71111
|
+
this.notifyRefreshChange(true);
|
|
70830
71112
|
await this.stopSocket();
|
|
71113
|
+
if (this.authState.state === "noAuth") {
|
|
71114
|
+
return;
|
|
71115
|
+
}
|
|
70831
71116
|
const token = await this.fetchTokenAndGuardAgainstRace(
|
|
70832
71117
|
this.authState.config.fetchToken,
|
|
70833
71118
|
{
|
|
@@ -70898,7 +71183,7 @@ var init_authentication_manager = __esm({
|
|
|
70898
71183
|
);
|
|
70899
71184
|
this.tryRestartSocket();
|
|
70900
71185
|
}
|
|
70901
|
-
scheduleTokenRefetch(token) {
|
|
71186
|
+
scheduleTokenRefetch(token, clientClockSkewMs) {
|
|
70902
71187
|
if (this.authState.state === "noAuth") {
|
|
70903
71188
|
return;
|
|
70904
71189
|
}
|
|
@@ -70916,13 +71201,23 @@ var init_authentication_manager = __esm({
|
|
|
70916
71201
|
);
|
|
70917
71202
|
return;
|
|
70918
71203
|
}
|
|
70919
|
-
const
|
|
70920
|
-
if (
|
|
71204
|
+
const fullLifetimeSeconds = exp - iat;
|
|
71205
|
+
if (fullLifetimeSeconds <= 2) {
|
|
70921
71206
|
this.logger.error(
|
|
70922
71207
|
"Auth token does not live long enough, cannot refetch the token"
|
|
70923
71208
|
);
|
|
70924
71209
|
return;
|
|
70925
71210
|
}
|
|
71211
|
+
let tokenValiditySeconds;
|
|
71212
|
+
if (clientClockSkewMs !== void 0) {
|
|
71213
|
+
const estimatedServerNowSeconds = (Date.now() - clientClockSkewMs) / 1e3;
|
|
71214
|
+
tokenValiditySeconds = exp - estimatedServerNowSeconds;
|
|
71215
|
+
if (tokenValiditySeconds <= 0) {
|
|
71216
|
+
tokenValiditySeconds = 0;
|
|
71217
|
+
}
|
|
71218
|
+
} else {
|
|
71219
|
+
tokenValiditySeconds = fullLifetimeSeconds;
|
|
71220
|
+
}
|
|
70926
71221
|
let delay2 = Math.min(
|
|
70927
71222
|
MAXIMUM_REFRESH_DELAY,
|
|
70928
71223
|
(tokenValiditySeconds - this.refreshTokenLeewaySeconds) * 1e3
|
|
@@ -70971,7 +71266,11 @@ var init_authentication_manager = __esm({
|
|
|
70971
71266
|
onAuthChange(false);
|
|
70972
71267
|
this.resetAuthState();
|
|
70973
71268
|
}
|
|
71269
|
+
// The sole path to `state === "noAuth"`; consumers rely on this firing
|
|
71270
|
+
// `notifyRefreshChange(false)` to pair any in-flight `(true)`. May run
|
|
71271
|
+
// when refresh state is already false.
|
|
70974
71272
|
resetAuthState() {
|
|
71273
|
+
this.notifyRefreshChange(false);
|
|
70975
71274
|
this.setAuthState({ state: "noAuth" });
|
|
70976
71275
|
}
|
|
70977
71276
|
setAuthState(newAuth) {
|
|
@@ -70999,7 +71298,6 @@ var init_authentication_manager = __esm({
|
|
|
70999
71298
|
}
|
|
71000
71299
|
if (this.authState.state === "waitingForScheduledRefetch") {
|
|
71001
71300
|
clearTimeout(this.authState.refetchTokenTimeoutId);
|
|
71002
|
-
this.syncState.markAuthCompletion();
|
|
71003
71301
|
}
|
|
71004
71302
|
this.authState = newAuth;
|
|
71005
71303
|
}
|
|
@@ -71133,7 +71431,7 @@ var init_client3 = __esm({
|
|
|
71133
71431
|
validateDeploymentUrl(address);
|
|
71134
71432
|
}
|
|
71135
71433
|
options = { ...options };
|
|
71136
|
-
const authRefreshTokenLeewaySeconds = options.authRefreshTokenLeewaySeconds ??
|
|
71434
|
+
const authRefreshTokenLeewaySeconds = options.authRefreshTokenLeewaySeconds ?? 10;
|
|
71137
71435
|
let webSocketConstructor = options.webSocketConstructor;
|
|
71138
71436
|
if (!webSocketConstructor && typeof WebSocket === "undefined") {
|
|
71139
71437
|
throw new Error(
|
|
@@ -71190,7 +71488,8 @@ var init_client3 = __esm({
|
|
|
71190
71488
|
},
|
|
71191
71489
|
{
|
|
71192
71490
|
logger: this.logger,
|
|
71193
|
-
refreshTokenLeewaySeconds: authRefreshTokenLeewaySeconds
|
|
71491
|
+
refreshTokenLeewaySeconds: authRefreshTokenLeewaySeconds,
|
|
71492
|
+
initialAuthTokenReuse: options.initialAuthTokenReuse ?? false
|
|
71194
71493
|
}
|
|
71195
71494
|
);
|
|
71196
71495
|
this.optimisticQueryResults = new OptimisticQueryResults();
|
|
@@ -71227,16 +71526,11 @@ var init_client3 = __esm({
|
|
|
71227
71526
|
sessionId: this._sessionId,
|
|
71228
71527
|
maxObservedTimestamp: this.maxObservedTimestamp
|
|
71229
71528
|
});
|
|
71230
|
-
const oldRemoteQueryResults = new Set(
|
|
71231
|
-
this.remoteQuerySet.remoteQueryResults().keys()
|
|
71232
|
-
);
|
|
71233
71529
|
this.remoteQuerySet = new RemoteQuerySet(
|
|
71234
71530
|
(queryId) => this.state.queryPath(queryId),
|
|
71235
71531
|
this.logger
|
|
71236
71532
|
);
|
|
71237
|
-
const [querySetModification, authModification] = this.state.restart(
|
|
71238
|
-
oldRemoteQueryResults
|
|
71239
|
-
);
|
|
71533
|
+
const [querySetModification, authModification] = this.state.restart();
|
|
71240
71534
|
if (authModification) {
|
|
71241
71535
|
this.webSocketManager.sendMessage(authModification);
|
|
71242
71536
|
}
|
|
@@ -71331,7 +71625,7 @@ var init_client3 = __esm({
|
|
|
71331
71625
|
* potentially led to the restart. Use this to influence when to reset backoff after a failure.
|
|
71332
71626
|
*/
|
|
71333
71627
|
hasSyncedPastLastReconnect() {
|
|
71334
|
-
const hasSyncedPastLastReconnect = this.requestManager.hasSyncedPastLastReconnect()
|
|
71628
|
+
const hasSyncedPastLastReconnect = this.requestManager.hasSyncedPastLastReconnect() && this.state.hasSyncedPastLastReconnect();
|
|
71335
71629
|
return hasSyncedPastLastReconnect;
|
|
71336
71630
|
}
|
|
71337
71631
|
observedTimestamp(observedTs) {
|
|
@@ -71431,9 +71725,14 @@ var init_client3 = __esm({
|
|
|
71431
71725
|
* when the user's rights were permanently revoked.
|
|
71432
71726
|
* @param fetchToken - an async function returning the JWT-encoded OpenID Connect Identity Token
|
|
71433
71727
|
* @param onChange - a callback that will be called when the authentication status changes
|
|
71728
|
+
* @param onRefreshChange - a callback called with `true` when the socket is paused to fetch a replacement token after a server rejection, and `false` when refresh completes
|
|
71434
71729
|
*/
|
|
71435
|
-
setAuth(fetchToken, onChange) {
|
|
71436
|
-
void this.authenticationManager.setConfig(
|
|
71730
|
+
setAuth(fetchToken, onChange, onRefreshChange) {
|
|
71731
|
+
void this.authenticationManager.setConfig(
|
|
71732
|
+
fetchToken,
|
|
71733
|
+
onChange,
|
|
71734
|
+
onRefreshChange
|
|
71735
|
+
);
|
|
71437
71736
|
}
|
|
71438
71737
|
hasAuth() {
|
|
71439
71738
|
return this.state.hasAuth();
|
|
@@ -71787,28 +72086,6 @@ var init_client3 = __esm({
|
|
|
71787
72086
|
}
|
|
71788
72087
|
});
|
|
71789
72088
|
|
|
71790
|
-
// ../../node_modules/convex/dist/esm/browser/http_client.js
|
|
71791
|
-
var init_http_client = __esm({
|
|
71792
|
-
"../../node_modules/convex/dist/esm/browser/http_client.js"() {
|
|
71793
|
-
"use strict";
|
|
71794
|
-
init_api4();
|
|
71795
|
-
init_common2();
|
|
71796
|
-
init_esm6();
|
|
71797
|
-
init_values();
|
|
71798
|
-
init_logging();
|
|
71799
|
-
}
|
|
71800
|
-
});
|
|
71801
|
-
|
|
71802
|
-
// ../../node_modules/convex/dist/esm/browser/index.js
|
|
71803
|
-
var init_browser = __esm({
|
|
71804
|
-
"../../node_modules/convex/dist/esm/browser/index.js"() {
|
|
71805
|
-
"use strict";
|
|
71806
|
-
init_client3();
|
|
71807
|
-
init_simple_client();
|
|
71808
|
-
init_http_client();
|
|
71809
|
-
}
|
|
71810
|
-
});
|
|
71811
|
-
|
|
71812
72089
|
// ../../node_modules/convex/dist/esm/browser/sync/pagination.js
|
|
71813
72090
|
function asPaginationResult(value) {
|
|
71814
72091
|
if (typeof value !== "object" || value === null || !Array.isArray(value.page) || typeof value.isDone !== "boolean" || typeof value.continueCursor !== "string") {
|
|
@@ -72057,8 +72334,11 @@ var init_paginated_query_client = __esm({
|
|
|
72057
72334
|
if (ongoingSplits.has(pageKey)) {
|
|
72058
72335
|
continue;
|
|
72059
72336
|
}
|
|
72060
|
-
const
|
|
72061
|
-
|
|
72337
|
+
const pageEntry = pageKeyToQuery.get(pageKey);
|
|
72338
|
+
if (!pageEntry) {
|
|
72339
|
+
throw new Error(`No page query for active pageKey ${pageKey}`);
|
|
72340
|
+
}
|
|
72341
|
+
const pageResult = getResult(pageEntry.queryToken);
|
|
72062
72342
|
if (!pageResult) {
|
|
72063
72343
|
continue;
|
|
72064
72344
|
}
|
|
@@ -72069,6 +72349,7 @@ var init_paginated_query_client = __esm({
|
|
|
72069
72349
|
this.splitPaginatedQueryPage(
|
|
72070
72350
|
paginatedQuery,
|
|
72071
72351
|
pageKey,
|
|
72352
|
+
pageEntry.cursor,
|
|
72072
72353
|
result.splitCursor,
|
|
72073
72354
|
// we just checked
|
|
72074
72355
|
result.continueCursor
|
|
@@ -72077,11 +72358,10 @@ var init_paginated_query_client = __esm({
|
|
|
72077
72358
|
}
|
|
72078
72359
|
}
|
|
72079
72360
|
}
|
|
72080
|
-
splitPaginatedQueryPage(paginatedQuery, pageKey, splitCursor, continueCursor) {
|
|
72361
|
+
splitPaginatedQueryPage(paginatedQuery, pageKey, startCursor, splitCursor, continueCursor) {
|
|
72081
72362
|
const splitKey1 = paginatedQuery.nextPageKey++;
|
|
72082
72363
|
const splitKey2 = paginatedQuery.nextPageKey++;
|
|
72083
72364
|
const paginationOpts = {
|
|
72084
|
-
cursor: continueCursor,
|
|
72085
72365
|
numItems: paginatedQuery.options.initialNumItems,
|
|
72086
72366
|
id: paginatedQuery.id
|
|
72087
72367
|
};
|
|
@@ -72091,13 +72371,15 @@ var init_paginated_query_client = __esm({
|
|
|
72091
72371
|
...paginatedQuery.args,
|
|
72092
72372
|
paginationOpts: {
|
|
72093
72373
|
...paginationOpts,
|
|
72094
|
-
cursor:
|
|
72095
|
-
// Start from beginning for first split
|
|
72374
|
+
cursor: startCursor,
|
|
72096
72375
|
endCursor: splitCursor
|
|
72097
72376
|
}
|
|
72098
72377
|
}
|
|
72099
72378
|
);
|
|
72100
|
-
paginatedQuery.pageKeyToQuery.set(splitKey1,
|
|
72379
|
+
paginatedQuery.pageKeyToQuery.set(splitKey1, {
|
|
72380
|
+
...firstSubscription,
|
|
72381
|
+
cursor: startCursor
|
|
72382
|
+
});
|
|
72101
72383
|
const secondSubscription = this.client.subscribe(
|
|
72102
72384
|
paginatedQuery.canonicalizedUdfPath,
|
|
72103
72385
|
{
|
|
@@ -72109,7 +72391,10 @@ var init_paginated_query_client = __esm({
|
|
|
72109
72391
|
}
|
|
72110
72392
|
}
|
|
72111
72393
|
);
|
|
72112
|
-
paginatedQuery.pageKeyToQuery.set(splitKey2,
|
|
72394
|
+
paginatedQuery.pageKeyToQuery.set(splitKey2, {
|
|
72395
|
+
...secondSubscription,
|
|
72396
|
+
cursor: splitCursor
|
|
72397
|
+
});
|
|
72113
72398
|
paginatedQuery.ongoingSplits.set(pageKey, [splitKey1, splitKey2]);
|
|
72114
72399
|
}
|
|
72115
72400
|
/**
|
|
@@ -72132,7 +72417,10 @@ var init_paginated_query_client = __esm({
|
|
|
72132
72417
|
pageArgs
|
|
72133
72418
|
);
|
|
72134
72419
|
paginatedQuery.pageKeys.push(pageKey);
|
|
72135
|
-
paginatedQuery.pageKeyToQuery.set(pageKey,
|
|
72420
|
+
paginatedQuery.pageKeyToQuery.set(pageKey, {
|
|
72421
|
+
...subscription,
|
|
72422
|
+
cursor: continueCursor
|
|
72423
|
+
});
|
|
72136
72424
|
return subscription;
|
|
72137
72425
|
}
|
|
72138
72426
|
removePaginatedQuerySubscriber(token) {
|
|
@@ -72196,8 +72484,8 @@ var init_simple_client = __esm({
|
|
|
72196
72484
|
"../../node_modules/convex/dist/esm/browser/simple_client.js"() {
|
|
72197
72485
|
"use strict";
|
|
72198
72486
|
init_common2();
|
|
72199
|
-
init_browser();
|
|
72200
72487
|
init_api4();
|
|
72488
|
+
init_client3();
|
|
72201
72489
|
init_paginated_query_client();
|
|
72202
72490
|
init_udf_path_utils();
|
|
72203
72491
|
__defProp15 = Object.defineProperty;
|
|
@@ -72593,7 +72881,7 @@ var init_simple_client = __esm({
|
|
|
72593
72881
|
// ../../node_modules/convex/dist/esm/browser/simple_client-node.js
|
|
72594
72882
|
import { createRequire } from "module";
|
|
72595
72883
|
import { resolve as nodePathResolve } from "path";
|
|
72596
|
-
var require2, __create3, __defProp16, __getOwnPropDesc3, __getOwnPropNames3, __getProtoOf3, __hasOwnProp3, __require2, __commonJS2, __copyProps3, __toESM3,
|
|
72884
|
+
var require2, __create3, __defProp16, __getOwnPropDesc3, __getOwnPropNames3, __getProtoOf3, __hasOwnProp3, __require2, __commonJS2, __copyProps3, __toESM3, require_constants3, require_node_gyp_build, require_node_gyp_build2, require_fallback, require_bufferutil, require_buffer_util2, require_limiter2, require_permessage_deflate2, require_validation3, require_receiver2, require_sender2, require_event_target2, require_extension2, require_websocket2, require_stream2, require_subprotocol2, require_websocket_server2, import_stream2, import_extension2, import_permessage_deflate2, import_receiver2, import_sender2, import_subprotocol2, import_websocket2, import_websocket_server2, wrapper_default2, nodeWebSocket;
|
|
72597
72885
|
var init_simple_client_node = __esm({
|
|
72598
72886
|
"../../node_modules/convex/dist/esm/browser/simple_client-node.js"() {
|
|
72599
72887
|
init_simple_client();
|
|
@@ -72629,109 +72917,15 @@ var init_simple_client_node = __esm({
|
|
|
72629
72917
|
isNodeMode || !mod || !mod.__esModule ? __defProp16(target, "default", { value: mod, enumerable: true }) : target,
|
|
72630
72918
|
mod
|
|
72631
72919
|
));
|
|
72632
|
-
require_stream2 = __commonJS2({
|
|
72633
|
-
"../common/temp/node_modules/.pnpm/ws@8.18.0_bufferutil@4.0.9/node_modules/ws/lib/stream.js"(exports, module2) {
|
|
72634
|
-
"use strict";
|
|
72635
|
-
var { Duplex } = __require2("stream");
|
|
72636
|
-
function emitClose(stream) {
|
|
72637
|
-
stream.emit("close");
|
|
72638
|
-
}
|
|
72639
|
-
function duplexOnEnd() {
|
|
72640
|
-
if (!this.destroyed && this._writableState.finished) {
|
|
72641
|
-
this.destroy();
|
|
72642
|
-
}
|
|
72643
|
-
}
|
|
72644
|
-
function duplexOnError(err) {
|
|
72645
|
-
this.removeListener("error", duplexOnError);
|
|
72646
|
-
this.destroy();
|
|
72647
|
-
if (this.listenerCount("error") === 0) {
|
|
72648
|
-
this.emit("error", err);
|
|
72649
|
-
}
|
|
72650
|
-
}
|
|
72651
|
-
function createWebSocketStream22(ws, options) {
|
|
72652
|
-
let terminateOnDestroy = true;
|
|
72653
|
-
const duplex = new Duplex({
|
|
72654
|
-
...options,
|
|
72655
|
-
autoDestroy: false,
|
|
72656
|
-
emitClose: false,
|
|
72657
|
-
objectMode: false,
|
|
72658
|
-
writableObjectMode: false
|
|
72659
|
-
});
|
|
72660
|
-
ws.on("message", function message(msg, isBinary) {
|
|
72661
|
-
const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
72662
|
-
if (!duplex.push(data)) ws.pause();
|
|
72663
|
-
});
|
|
72664
|
-
ws.once("error", function error4(err) {
|
|
72665
|
-
if (duplex.destroyed) return;
|
|
72666
|
-
terminateOnDestroy = false;
|
|
72667
|
-
duplex.destroy(err);
|
|
72668
|
-
});
|
|
72669
|
-
ws.once("close", function close2() {
|
|
72670
|
-
if (duplex.destroyed) return;
|
|
72671
|
-
duplex.push(null);
|
|
72672
|
-
});
|
|
72673
|
-
duplex._destroy = function(err, callback) {
|
|
72674
|
-
if (ws.readyState === ws.CLOSED) {
|
|
72675
|
-
callback(err);
|
|
72676
|
-
process.nextTick(emitClose, duplex);
|
|
72677
|
-
return;
|
|
72678
|
-
}
|
|
72679
|
-
let called = false;
|
|
72680
|
-
ws.once("error", function error4(err2) {
|
|
72681
|
-
called = true;
|
|
72682
|
-
callback(err2);
|
|
72683
|
-
});
|
|
72684
|
-
ws.once("close", function close2() {
|
|
72685
|
-
if (!called) callback(err);
|
|
72686
|
-
process.nextTick(emitClose, duplex);
|
|
72687
|
-
});
|
|
72688
|
-
if (terminateOnDestroy) ws.terminate();
|
|
72689
|
-
};
|
|
72690
|
-
duplex._final = function(callback) {
|
|
72691
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
72692
|
-
ws.once("open", function open() {
|
|
72693
|
-
duplex._final(callback);
|
|
72694
|
-
});
|
|
72695
|
-
return;
|
|
72696
|
-
}
|
|
72697
|
-
if (ws._socket === null) return;
|
|
72698
|
-
if (ws._socket._writableState.finished) {
|
|
72699
|
-
callback();
|
|
72700
|
-
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
72701
|
-
} else {
|
|
72702
|
-
ws._socket.once("finish", function finish() {
|
|
72703
|
-
callback();
|
|
72704
|
-
});
|
|
72705
|
-
ws.close();
|
|
72706
|
-
}
|
|
72707
|
-
};
|
|
72708
|
-
duplex._read = function() {
|
|
72709
|
-
if (ws.isPaused) ws.resume();
|
|
72710
|
-
};
|
|
72711
|
-
duplex._write = function(chunk, encoding, callback) {
|
|
72712
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
72713
|
-
ws.once("open", function open() {
|
|
72714
|
-
duplex._write(chunk, encoding, callback);
|
|
72715
|
-
});
|
|
72716
|
-
return;
|
|
72717
|
-
}
|
|
72718
|
-
ws.send(chunk, callback);
|
|
72719
|
-
};
|
|
72720
|
-
duplex.on("end", duplexOnEnd);
|
|
72721
|
-
duplex.on("error", duplexOnError);
|
|
72722
|
-
return duplex;
|
|
72723
|
-
}
|
|
72724
|
-
module2.exports = createWebSocketStream22;
|
|
72725
|
-
}
|
|
72726
|
-
});
|
|
72727
72920
|
require_constants3 = __commonJS2({
|
|
72728
|
-
"../
|
|
72921
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/constants.js"(exports, module2) {
|
|
72729
72922
|
"use strict";
|
|
72730
72923
|
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
72731
72924
|
var hasBlob = typeof Blob !== "undefined";
|
|
72732
72925
|
if (hasBlob) BINARY_TYPES.push("blob");
|
|
72733
72926
|
module2.exports = {
|
|
72734
72927
|
BINARY_TYPES,
|
|
72928
|
+
CLOSE_TIMEOUT: 3e4,
|
|
72735
72929
|
EMPTY_BUFFER: Buffer.alloc(0),
|
|
72736
72930
|
GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
|
|
72737
72931
|
hasBlob,
|
|
@@ -72745,19 +72939,19 @@ var init_simple_client_node = __esm({
|
|
|
72745
72939
|
}
|
|
72746
72940
|
});
|
|
72747
72941
|
require_node_gyp_build = __commonJS2({
|
|
72748
|
-
"../
|
|
72942
|
+
"../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/node-gyp-build.js"(exports, module2) {
|
|
72749
72943
|
var fs8 = __require2("fs");
|
|
72750
72944
|
var path11 = __require2("path");
|
|
72751
72945
|
var os6 = __require2("os");
|
|
72752
72946
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require2;
|
|
72753
|
-
var
|
|
72947
|
+
var vars2 = process.config && process.config.variables || {};
|
|
72754
72948
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
72755
72949
|
var abi = process.versions.modules;
|
|
72756
72950
|
var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
72757
72951
|
var arch2 = process.env.npm_config_arch || os6.arch();
|
|
72758
72952
|
var platform2 = process.env.npm_config_platform || os6.platform();
|
|
72759
72953
|
var libc = process.env.LIBC || (isAlpine(platform2) ? "musl" : "glibc");
|
|
72760
|
-
var armv = process.env.ARM_VERSION || (arch2 === "arm64" ? "8" :
|
|
72954
|
+
var armv = process.env.ARM_VERSION || (arch2 === "arm64" ? "8" : vars2.arm_version) || "";
|
|
72761
72955
|
var uv = (process.versions.uv || "").split(".")[0];
|
|
72762
72956
|
module2.exports = load;
|
|
72763
72957
|
function load(dir) {
|
|
@@ -72841,9 +73035,9 @@ var init_simple_client_node = __esm({
|
|
|
72841
73035
|
}
|
|
72842
73036
|
function parseTags(file2) {
|
|
72843
73037
|
var arr2 = file2.split(".");
|
|
72844
|
-
var
|
|
73038
|
+
var extension22 = arr2.pop();
|
|
72845
73039
|
var tags = { file: file2, specificity: 0 };
|
|
72846
|
-
if (
|
|
73040
|
+
if (extension22 !== "node") return;
|
|
72847
73041
|
for (var i = 0; i < arr2.length; i++) {
|
|
72848
73042
|
var tag = arr2[i];
|
|
72849
73043
|
if (tag === "node" || tag === "electron" || tag === "node-webkit") {
|
|
@@ -72912,7 +73106,7 @@ var init_simple_client_node = __esm({
|
|
|
72912
73106
|
}
|
|
72913
73107
|
});
|
|
72914
73108
|
require_node_gyp_build2 = __commonJS2({
|
|
72915
|
-
"../
|
|
73109
|
+
"../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/index.js"(exports, module2) {
|
|
72916
73110
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require2;
|
|
72917
73111
|
if (typeof runtimeRequire.addon === "function") {
|
|
72918
73112
|
module2.exports = runtimeRequire.addon.bind(runtimeRequire);
|
|
@@ -72922,7 +73116,7 @@ var init_simple_client_node = __esm({
|
|
|
72922
73116
|
}
|
|
72923
73117
|
});
|
|
72924
73118
|
require_fallback = __commonJS2({
|
|
72925
|
-
"../
|
|
73119
|
+
"../node_modules/.pnpm/bufferutil@4.0.9/node_modules/bufferutil/fallback.js"(exports, module2) {
|
|
72926
73120
|
"use strict";
|
|
72927
73121
|
var mask = (source, mask2, output, offset, length) => {
|
|
72928
73122
|
for (var i = 0; i < length; i++) {
|
|
@@ -72939,7 +73133,7 @@ var init_simple_client_node = __esm({
|
|
|
72939
73133
|
}
|
|
72940
73134
|
});
|
|
72941
73135
|
require_bufferutil = __commonJS2({
|
|
72942
|
-
"../
|
|
73136
|
+
"../node_modules/.pnpm/bufferutil@4.0.9/node_modules/bufferutil/index.js"(exports, module2) {
|
|
72943
73137
|
"use strict";
|
|
72944
73138
|
try {
|
|
72945
73139
|
module2.exports = require_node_gyp_build2()(__dirname);
|
|
@@ -72949,7 +73143,7 @@ var init_simple_client_node = __esm({
|
|
|
72949
73143
|
}
|
|
72950
73144
|
});
|
|
72951
73145
|
require_buffer_util2 = __commonJS2({
|
|
72952
|
-
"../
|
|
73146
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/buffer-util.js"(exports, module2) {
|
|
72953
73147
|
"use strict";
|
|
72954
73148
|
var { EMPTY_BUFFER } = require_constants3();
|
|
72955
73149
|
var FastBuffer = Buffer[Symbol.species];
|
|
@@ -73022,7 +73216,7 @@ var init_simple_client_node = __esm({
|
|
|
73022
73216
|
}
|
|
73023
73217
|
});
|
|
73024
73218
|
require_limiter2 = __commonJS2({
|
|
73025
|
-
"../
|
|
73219
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/limiter.js"(exports, module2) {
|
|
73026
73220
|
"use strict";
|
|
73027
73221
|
var kDone = /* @__PURE__ */ Symbol("kDone");
|
|
73028
73222
|
var kRun = /* @__PURE__ */ Symbol("kRun");
|
|
@@ -73070,7 +73264,7 @@ var init_simple_client_node = __esm({
|
|
|
73070
73264
|
}
|
|
73071
73265
|
});
|
|
73072
73266
|
require_permessage_deflate2 = __commonJS2({
|
|
73073
|
-
"../
|
|
73267
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/permessage-deflate.js"(exports, module2) {
|
|
73074
73268
|
"use strict";
|
|
73075
73269
|
var zlib = __require2("zlib");
|
|
73076
73270
|
var bufferUtil = require_buffer_util2();
|
|
@@ -73084,7 +73278,7 @@ var init_simple_client_node = __esm({
|
|
|
73084
73278
|
var kBuffers = /* @__PURE__ */ Symbol("buffers");
|
|
73085
73279
|
var kError = /* @__PURE__ */ Symbol("error");
|
|
73086
73280
|
var zlibLimiter;
|
|
73087
|
-
var
|
|
73281
|
+
var PerMessageDeflate22 = class {
|
|
73088
73282
|
/**
|
|
73089
73283
|
* Creates a PerMessageDeflate instance.
|
|
73090
73284
|
*
|
|
@@ -73095,6 +73289,9 @@ var init_simple_client_node = __esm({
|
|
|
73095
73289
|
* acknowledge disabling of client context takeover
|
|
73096
73290
|
* @param {Number} [options.concurrencyLimit=10] The number of concurrent
|
|
73097
73291
|
* calls to zlib
|
|
73292
|
+
* @param {Boolean} [options.isServer=false] Create the instance in either
|
|
73293
|
+
* server or client mode
|
|
73294
|
+
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
|
73098
73295
|
* @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
|
|
73099
73296
|
* use of a custom server window size
|
|
73100
73297
|
* @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
|
|
@@ -73105,15 +73302,12 @@ var init_simple_client_node = __esm({
|
|
|
73105
73302
|
* deflate
|
|
73106
73303
|
* @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
|
|
73107
73304
|
* inflate
|
|
73108
|
-
* @param {Boolean} [isServer=false] Create the instance in either server or
|
|
73109
|
-
* client mode
|
|
73110
|
-
* @param {Number} [maxPayload=0] The maximum allowed message length
|
|
73111
73305
|
*/
|
|
73112
|
-
constructor(options
|
|
73113
|
-
this._maxPayload = maxPayload | 0;
|
|
73306
|
+
constructor(options) {
|
|
73114
73307
|
this._options = options || {};
|
|
73115
73308
|
this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024;
|
|
73116
|
-
this.
|
|
73309
|
+
this._maxPayload = this._options.maxPayload | 0;
|
|
73310
|
+
this._isServer = !!this._options.isServer;
|
|
73117
73311
|
this._deflate = null;
|
|
73118
73312
|
this._inflate = null;
|
|
73119
73313
|
this.params = null;
|
|
@@ -73422,7 +73616,7 @@ var init_simple_client_node = __esm({
|
|
|
73422
73616
|
});
|
|
73423
73617
|
}
|
|
73424
73618
|
};
|
|
73425
|
-
module2.exports =
|
|
73619
|
+
module2.exports = PerMessageDeflate22;
|
|
73426
73620
|
function deflateOnData(chunk) {
|
|
73427
73621
|
this[kBuffers].push(chunk);
|
|
73428
73622
|
this[kTotalLength] += chunk.length;
|
|
@@ -73441,13 +73635,17 @@ var init_simple_client_node = __esm({
|
|
|
73441
73635
|
}
|
|
73442
73636
|
function inflateOnError(err) {
|
|
73443
73637
|
this[kPerMessageDeflate]._inflate = null;
|
|
73638
|
+
if (this[kError]) {
|
|
73639
|
+
this[kCallback](this[kError]);
|
|
73640
|
+
return;
|
|
73641
|
+
}
|
|
73444
73642
|
err[kStatusCode] = 1007;
|
|
73445
73643
|
this[kCallback](err);
|
|
73446
73644
|
}
|
|
73447
73645
|
}
|
|
73448
73646
|
});
|
|
73449
73647
|
require_validation3 = __commonJS2({
|
|
73450
|
-
"../
|
|
73648
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/validation.js"(exports, module2) {
|
|
73451
73649
|
"use strict";
|
|
73452
73650
|
var { isUtf8 } = __require2("buffer");
|
|
73453
73651
|
var { hasBlob } = require_constants3();
|
|
@@ -73646,10 +73844,10 @@ var init_simple_client_node = __esm({
|
|
|
73646
73844
|
}
|
|
73647
73845
|
});
|
|
73648
73846
|
require_receiver2 = __commonJS2({
|
|
73649
|
-
"../
|
|
73847
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/receiver.js"(exports, module2) {
|
|
73650
73848
|
"use strict";
|
|
73651
73849
|
var { Writable } = __require2("stream");
|
|
73652
|
-
var
|
|
73850
|
+
var PerMessageDeflate22 = require_permessage_deflate2();
|
|
73653
73851
|
var {
|
|
73654
73852
|
BINARY_TYPES,
|
|
73655
73853
|
EMPTY_BUFFER,
|
|
@@ -73679,6 +73877,10 @@ var init_simple_client_node = __esm({
|
|
|
73679
73877
|
* extensions
|
|
73680
73878
|
* @param {Boolean} [options.isServer=false] Specifies whether to operate in
|
|
73681
73879
|
* client or server mode
|
|
73880
|
+
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
73881
|
+
* buffered data chunks
|
|
73882
|
+
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
73883
|
+
* fragments
|
|
73682
73884
|
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
|
73683
73885
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
73684
73886
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -73689,6 +73891,8 @@ var init_simple_client_node = __esm({
|
|
|
73689
73891
|
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
|
73690
73892
|
this._extensions = options.extensions || {};
|
|
73691
73893
|
this._isServer = !!options.isServer;
|
|
73894
|
+
this._maxBufferedChunks = options.maxBufferedChunks | 0;
|
|
73895
|
+
this._maxFragments = options.maxFragments | 0;
|
|
73692
73896
|
this._maxPayload = options.maxPayload | 0;
|
|
73693
73897
|
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
|
73694
73898
|
this[kWebSocket] = void 0;
|
|
@@ -73718,6 +73922,18 @@ var init_simple_client_node = __esm({
|
|
|
73718
73922
|
*/
|
|
73719
73923
|
_write(chunk, encoding, cb) {
|
|
73720
73924
|
if (this._opcode === 8 && this._state == GET_INFO) return cb();
|
|
73925
|
+
if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
|
|
73926
|
+
cb(
|
|
73927
|
+
this.createError(
|
|
73928
|
+
RangeError,
|
|
73929
|
+
"Too many buffered chunks",
|
|
73930
|
+
false,
|
|
73931
|
+
1008,
|
|
73932
|
+
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
73933
|
+
)
|
|
73934
|
+
);
|
|
73935
|
+
return;
|
|
73936
|
+
}
|
|
73721
73937
|
this._bufferedBytes += chunk.length;
|
|
73722
73938
|
this._buffers.push(chunk);
|
|
73723
73939
|
this.startLoop(cb);
|
|
@@ -73816,7 +74032,7 @@ var init_simple_client_node = __esm({
|
|
|
73816
74032
|
return;
|
|
73817
74033
|
}
|
|
73818
74034
|
const compressed = (buf[0] & 64) === 64;
|
|
73819
|
-
if (compressed && !this._extensions[
|
|
74035
|
+
if (compressed && !this._extensions[PerMessageDeflate22.extensionName]) {
|
|
73820
74036
|
const error4 = this.createError(
|
|
73821
74037
|
RangeError,
|
|
73822
74038
|
"RSV1 must be clear",
|
|
@@ -74047,6 +74263,17 @@ var init_simple_client_node = __esm({
|
|
|
74047
74263
|
return;
|
|
74048
74264
|
}
|
|
74049
74265
|
if (data.length) {
|
|
74266
|
+
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
|
|
74267
|
+
const error4 = this.createError(
|
|
74268
|
+
RangeError,
|
|
74269
|
+
"Too many message fragments",
|
|
74270
|
+
false,
|
|
74271
|
+
1008,
|
|
74272
|
+
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
74273
|
+
);
|
|
74274
|
+
cb(error4);
|
|
74275
|
+
return;
|
|
74276
|
+
}
|
|
74050
74277
|
this._messageLength = this._totalPayloadLength;
|
|
74051
74278
|
this._fragments.push(data);
|
|
74052
74279
|
}
|
|
@@ -74060,7 +74287,7 @@ var init_simple_client_node = __esm({
|
|
|
74060
74287
|
* @private
|
|
74061
74288
|
*/
|
|
74062
74289
|
decompress(data, cb) {
|
|
74063
|
-
const perMessageDeflate = this._extensions[
|
|
74290
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate22.extensionName];
|
|
74064
74291
|
perMessageDeflate.decompress(data, this._fin, (err, buf) => {
|
|
74065
74292
|
if (err) return cb(err);
|
|
74066
74293
|
if (buf.length) {
|
|
@@ -74076,6 +74303,17 @@ var init_simple_client_node = __esm({
|
|
|
74076
74303
|
cb(error4);
|
|
74077
74304
|
return;
|
|
74078
74305
|
}
|
|
74306
|
+
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
|
|
74307
|
+
const error4 = this.createError(
|
|
74308
|
+
RangeError,
|
|
74309
|
+
"Too many message fragments",
|
|
74310
|
+
false,
|
|
74311
|
+
1008,
|
|
74312
|
+
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
74313
|
+
);
|
|
74314
|
+
cb(error4);
|
|
74315
|
+
return;
|
|
74316
|
+
}
|
|
74079
74317
|
this._fragments.push(buf);
|
|
74080
74318
|
}
|
|
74081
74319
|
this.dataMessage(cb);
|
|
@@ -74236,11 +74474,14 @@ var init_simple_client_node = __esm({
|
|
|
74236
74474
|
}
|
|
74237
74475
|
});
|
|
74238
74476
|
require_sender2 = __commonJS2({
|
|
74239
|
-
"../
|
|
74477
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/sender.js"(exports, module2) {
|
|
74240
74478
|
"use strict";
|
|
74241
74479
|
var { Duplex } = __require2("stream");
|
|
74242
74480
|
var { randomFillSync } = __require2("crypto");
|
|
74243
|
-
var
|
|
74481
|
+
var {
|
|
74482
|
+
types: { isUint8Array }
|
|
74483
|
+
} = __require2("util");
|
|
74484
|
+
var PerMessageDeflate22 = require_permessage_deflate2();
|
|
74244
74485
|
var { EMPTY_BUFFER, kWebSocket, NOOP: NOOP2 } = require_constants3();
|
|
74245
74486
|
var { isBlob, isValidStatusCode } = require_validation3();
|
|
74246
74487
|
var { mask: applyMask, toBuffer } = require_buffer_util2();
|
|
@@ -74393,8 +74634,10 @@ var init_simple_client_node = __esm({
|
|
|
74393
74634
|
buf.writeUInt16BE(code2, 0);
|
|
74394
74635
|
if (typeof data === "string") {
|
|
74395
74636
|
buf.write(data, 2);
|
|
74396
|
-
} else {
|
|
74637
|
+
} else if (isUint8Array(data)) {
|
|
74397
74638
|
buf.set(data, 2);
|
|
74639
|
+
} else {
|
|
74640
|
+
throw new TypeError("Second argument must be a string or a Uint8Array");
|
|
74398
74641
|
}
|
|
74399
74642
|
}
|
|
74400
74643
|
const options = {
|
|
@@ -74524,7 +74767,7 @@ var init_simple_client_node = __esm({
|
|
|
74524
74767
|
* @public
|
|
74525
74768
|
*/
|
|
74526
74769
|
send(data, options, cb) {
|
|
74527
|
-
const perMessageDeflate = this._extensions[
|
|
74770
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate22.extensionName];
|
|
74528
74771
|
let opcode = options.binary ? 2 : 1;
|
|
74529
74772
|
let rsv1 = options.compress;
|
|
74530
74773
|
let byteLength2;
|
|
@@ -74648,7 +74891,7 @@ var init_simple_client_node = __esm({
|
|
|
74648
74891
|
this.sendFrame(_Sender.frame(data, options), cb);
|
|
74649
74892
|
return;
|
|
74650
74893
|
}
|
|
74651
|
-
const perMessageDeflate = this._extensions[
|
|
74894
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate22.extensionName];
|
|
74652
74895
|
this._bufferedBytes += options[kByteLength];
|
|
74653
74896
|
this._state = DEFLATING;
|
|
74654
74897
|
perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
@@ -74691,7 +74934,7 @@ var init_simple_client_node = __esm({
|
|
|
74691
74934
|
/**
|
|
74692
74935
|
* Sends a frame.
|
|
74693
74936
|
*
|
|
74694
|
-
* @param {Buffer[]} list The frame to send
|
|
74937
|
+
* @param {(Buffer | String)[]} list The frame to send
|
|
74695
74938
|
* @param {Function} [cb] Callback
|
|
74696
74939
|
* @private
|
|
74697
74940
|
*/
|
|
@@ -74722,7 +74965,7 @@ var init_simple_client_node = __esm({
|
|
|
74722
74965
|
}
|
|
74723
74966
|
});
|
|
74724
74967
|
require_event_target2 = __commonJS2({
|
|
74725
|
-
"../
|
|
74968
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/event-target.js"(exports, module2) {
|
|
74726
74969
|
"use strict";
|
|
74727
74970
|
var { kForOnEventAttribute, kListener } = require_constants3();
|
|
74728
74971
|
var kCode = /* @__PURE__ */ Symbol("kCode");
|
|
@@ -74949,7 +75192,7 @@ var init_simple_client_node = __esm({
|
|
|
74949
75192
|
}
|
|
74950
75193
|
});
|
|
74951
75194
|
require_extension2 = __commonJS2({
|
|
74952
|
-
"../
|
|
75195
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/extension.js"(exports, module2) {
|
|
74953
75196
|
"use strict";
|
|
74954
75197
|
var { tokenChars } = require_validation3();
|
|
74955
75198
|
function push(dest, name, elem) {
|
|
@@ -75082,11 +75325,11 @@ var init_simple_client_node = __esm({
|
|
|
75082
75325
|
return offers;
|
|
75083
75326
|
}
|
|
75084
75327
|
function format2(extensions) {
|
|
75085
|
-
return Object.keys(extensions).map((
|
|
75086
|
-
let configurations = extensions[
|
|
75328
|
+
return Object.keys(extensions).map((extension22) => {
|
|
75329
|
+
let configurations = extensions[extension22];
|
|
75087
75330
|
if (!Array.isArray(configurations)) configurations = [configurations];
|
|
75088
75331
|
return configurations.map((params) => {
|
|
75089
|
-
return [
|
|
75332
|
+
return [extension22].concat(
|
|
75090
75333
|
Object.keys(params).map((k) => {
|
|
75091
75334
|
let values = params[k];
|
|
75092
75335
|
if (!Array.isArray(values)) values = [values];
|
|
@@ -75100,7 +75343,7 @@ var init_simple_client_node = __esm({
|
|
|
75100
75343
|
}
|
|
75101
75344
|
});
|
|
75102
75345
|
require_websocket2 = __commonJS2({
|
|
75103
|
-
"../
|
|
75346
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/websocket.js"(exports, module2) {
|
|
75104
75347
|
"use strict";
|
|
75105
75348
|
var EventEmitter3 = __require2("events");
|
|
75106
75349
|
var https3 = __require2("https");
|
|
@@ -75110,12 +75353,13 @@ var init_simple_client_node = __esm({
|
|
|
75110
75353
|
var { randomBytes, createHash: createHash3 } = __require2("crypto");
|
|
75111
75354
|
var { Duplex, Readable: Readable2 } = __require2("stream");
|
|
75112
75355
|
var { URL: URL3 } = __require2("url");
|
|
75113
|
-
var
|
|
75356
|
+
var PerMessageDeflate22 = require_permessage_deflate2();
|
|
75114
75357
|
var Receiver22 = require_receiver2();
|
|
75115
75358
|
var Sender22 = require_sender2();
|
|
75116
75359
|
var { isBlob } = require_validation3();
|
|
75117
75360
|
var {
|
|
75118
75361
|
BINARY_TYPES,
|
|
75362
|
+
CLOSE_TIMEOUT,
|
|
75119
75363
|
EMPTY_BUFFER,
|
|
75120
75364
|
GUID,
|
|
75121
75365
|
kForOnEventAttribute,
|
|
@@ -75129,7 +75373,6 @@ var init_simple_client_node = __esm({
|
|
|
75129
75373
|
} = require_event_target2();
|
|
75130
75374
|
var { format: format2, parse: parse5 } = require_extension2();
|
|
75131
75375
|
var { toBuffer } = require_buffer_util2();
|
|
75132
|
-
var closeTimeout = 30 * 1e3;
|
|
75133
75376
|
var kAborted = /* @__PURE__ */ Symbol("kAborted");
|
|
75134
75377
|
var protocolVersions = [8, 13];
|
|
75135
75378
|
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
@@ -75175,6 +75418,7 @@ var init_simple_client_node = __esm({
|
|
|
75175
75418
|
initAsClient(this, address, protocols, options);
|
|
75176
75419
|
} else {
|
|
75177
75420
|
this._autoPong = options.autoPong;
|
|
75421
|
+
this._closeTimeout = options.closeTimeout;
|
|
75178
75422
|
this._isServer = true;
|
|
75179
75423
|
}
|
|
75180
75424
|
}
|
|
@@ -75268,6 +75512,10 @@ var init_simple_client_node = __esm({
|
|
|
75268
75512
|
* multiple times in the same tick
|
|
75269
75513
|
* @param {Function} [options.generateMask] The function used to generate the
|
|
75270
75514
|
* masking key
|
|
75515
|
+
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
75516
|
+
* buffered data chunks
|
|
75517
|
+
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
75518
|
+
* fragments
|
|
75271
75519
|
* @param {Number} [options.maxPayload=0] The maximum allowed message size
|
|
75272
75520
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
75273
75521
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -75279,6 +75527,8 @@ var init_simple_client_node = __esm({
|
|
|
75279
75527
|
binaryType: this.binaryType,
|
|
75280
75528
|
extensions: this._extensions,
|
|
75281
75529
|
isServer: this._isServer,
|
|
75530
|
+
maxBufferedChunks: options.maxBufferedChunks,
|
|
75531
|
+
maxFragments: options.maxFragments,
|
|
75282
75532
|
maxPayload: options.maxPayload,
|
|
75283
75533
|
skipUTF8Validation: options.skipUTF8Validation
|
|
75284
75534
|
});
|
|
@@ -75317,8 +75567,8 @@ var init_simple_client_node = __esm({
|
|
|
75317
75567
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
75318
75568
|
return;
|
|
75319
75569
|
}
|
|
75320
|
-
if (this._extensions[
|
|
75321
|
-
this._extensions[
|
|
75570
|
+
if (this._extensions[PerMessageDeflate22.extensionName]) {
|
|
75571
|
+
this._extensions[PerMessageDeflate22.extensionName].cleanup();
|
|
75322
75572
|
}
|
|
75323
75573
|
this._receiver.removeAllListeners();
|
|
75324
75574
|
this._readyState = _WebSocket.CLOSED;
|
|
@@ -75480,7 +75730,7 @@ var init_simple_client_node = __esm({
|
|
|
75480
75730
|
fin: true,
|
|
75481
75731
|
...options
|
|
75482
75732
|
};
|
|
75483
|
-
if (!this._extensions[
|
|
75733
|
+
if (!this._extensions[PerMessageDeflate22.extensionName]) {
|
|
75484
75734
|
opts.compress = false;
|
|
75485
75735
|
}
|
|
75486
75736
|
this._sender.send(data || EMPTY_BUFFER, opts, cb);
|
|
@@ -75576,7 +75826,10 @@ var init_simple_client_node = __esm({
|
|
|
75576
75826
|
const opts = {
|
|
75577
75827
|
allowSynchronousEvents: true,
|
|
75578
75828
|
autoPong: true,
|
|
75829
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
75579
75830
|
protocolVersion: protocolVersions[1],
|
|
75831
|
+
maxBufferedChunks: 1024 * 1024,
|
|
75832
|
+
maxFragments: 128 * 1024,
|
|
75580
75833
|
maxPayload: 100 * 1024 * 1024,
|
|
75581
75834
|
skipUTF8Validation: false,
|
|
75582
75835
|
perMessageDeflate: true,
|
|
@@ -75593,6 +75846,7 @@ var init_simple_client_node = __esm({
|
|
|
75593
75846
|
port: void 0
|
|
75594
75847
|
};
|
|
75595
75848
|
websocket._autoPong = opts.autoPong;
|
|
75849
|
+
websocket._closeTimeout = opts.closeTimeout;
|
|
75596
75850
|
if (!protocolVersions.includes(opts.protocolVersion)) {
|
|
75597
75851
|
throw new RangeError(
|
|
75598
75852
|
`Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`
|
|
@@ -75604,7 +75858,7 @@ var init_simple_client_node = __esm({
|
|
|
75604
75858
|
} else {
|
|
75605
75859
|
try {
|
|
75606
75860
|
parsedUrl = new URL3(address);
|
|
75607
|
-
} catch
|
|
75861
|
+
} catch {
|
|
75608
75862
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
75609
75863
|
}
|
|
75610
75864
|
}
|
|
@@ -75618,7 +75872,7 @@ var init_simple_client_node = __esm({
|
|
|
75618
75872
|
const isIpcUrl = parsedUrl.protocol === "ws+unix:";
|
|
75619
75873
|
let invalidUrlMessage;
|
|
75620
75874
|
if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) {
|
|
75621
|
-
invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`;
|
|
75875
|
+
invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;
|
|
75622
75876
|
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
75623
75877
|
invalidUrlMessage = "The URL's pathname is empty";
|
|
75624
75878
|
} else if (parsedUrl.hash) {
|
|
@@ -75652,13 +75906,13 @@ var init_simple_client_node = __esm({
|
|
|
75652
75906
|
opts.path = parsedUrl.pathname + parsedUrl.search;
|
|
75653
75907
|
opts.timeout = opts.handshakeTimeout;
|
|
75654
75908
|
if (opts.perMessageDeflate) {
|
|
75655
|
-
perMessageDeflate = new
|
|
75656
|
-
opts.perMessageDeflate
|
|
75657
|
-
false,
|
|
75658
|
-
opts.maxPayload
|
|
75659
|
-
);
|
|
75909
|
+
perMessageDeflate = new PerMessageDeflate22({
|
|
75910
|
+
...opts.perMessageDeflate,
|
|
75911
|
+
isServer: false,
|
|
75912
|
+
maxPayload: opts.maxPayload
|
|
75913
|
+
});
|
|
75660
75914
|
opts.headers["Sec-WebSocket-Extensions"] = format2({
|
|
75661
|
-
[
|
|
75915
|
+
[PerMessageDeflate22.extensionName]: perMessageDeflate.offer()
|
|
75662
75916
|
});
|
|
75663
75917
|
}
|
|
75664
75918
|
if (protocols.length) {
|
|
@@ -75801,23 +76055,25 @@ var init_simple_client_node = __esm({
|
|
|
75801
76055
|
return;
|
|
75802
76056
|
}
|
|
75803
76057
|
const extensionNames = Object.keys(extensions);
|
|
75804
|
-
if (extensionNames.length !== 1 || extensionNames[0] !==
|
|
76058
|
+
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate22.extensionName) {
|
|
75805
76059
|
const message = "Server indicated an extension that was not requested";
|
|
75806
76060
|
abortHandshake(websocket, socket, message);
|
|
75807
76061
|
return;
|
|
75808
76062
|
}
|
|
75809
76063
|
try {
|
|
75810
|
-
perMessageDeflate.accept(extensions[
|
|
76064
|
+
perMessageDeflate.accept(extensions[PerMessageDeflate22.extensionName]);
|
|
75811
76065
|
} catch (err) {
|
|
75812
76066
|
const message = "Invalid Sec-WebSocket-Extensions header";
|
|
75813
76067
|
abortHandshake(websocket, socket, message);
|
|
75814
76068
|
return;
|
|
75815
76069
|
}
|
|
75816
|
-
websocket._extensions[
|
|
76070
|
+
websocket._extensions[PerMessageDeflate22.extensionName] = perMessageDeflate;
|
|
75817
76071
|
}
|
|
75818
76072
|
websocket.setSocket(socket, head, {
|
|
75819
76073
|
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
75820
76074
|
generateMask: opts.generateMask,
|
|
76075
|
+
maxBufferedChunks: opts.maxBufferedChunks,
|
|
76076
|
+
maxFragments: opts.maxFragments,
|
|
75821
76077
|
maxPayload: opts.maxPayload,
|
|
75822
76078
|
skipUTF8Validation: opts.skipUTF8Validation
|
|
75823
76079
|
});
|
|
@@ -75935,7 +76191,7 @@ var init_simple_client_node = __esm({
|
|
|
75935
76191
|
function setCloseTimer(websocket) {
|
|
75936
76192
|
websocket._closeTimer = setTimeout(
|
|
75937
76193
|
websocket._socket.destroy.bind(websocket._socket),
|
|
75938
|
-
|
|
76194
|
+
websocket._closeTimeout
|
|
75939
76195
|
);
|
|
75940
76196
|
}
|
|
75941
76197
|
function socketOnClose() {
|
|
@@ -75944,8 +76200,8 @@ var init_simple_client_node = __esm({
|
|
|
75944
76200
|
this.removeListener("data", socketOnData);
|
|
75945
76201
|
this.removeListener("end", socketOnEnd);
|
|
75946
76202
|
websocket._readyState = WebSocket22.CLOSING;
|
|
75947
|
-
|
|
75948
|
-
|
|
76203
|
+
if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
|
|
76204
|
+
const chunk = this.read(this._readableState.length);
|
|
75949
76205
|
websocket._receiver.write(chunk);
|
|
75950
76206
|
}
|
|
75951
76207
|
websocket._receiver.end();
|
|
@@ -75980,8 +76236,104 @@ var init_simple_client_node = __esm({
|
|
|
75980
76236
|
}
|
|
75981
76237
|
}
|
|
75982
76238
|
});
|
|
76239
|
+
require_stream2 = __commonJS2({
|
|
76240
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/stream.js"(exports, module2) {
|
|
76241
|
+
"use strict";
|
|
76242
|
+
var WebSocket22 = require_websocket2();
|
|
76243
|
+
var { Duplex } = __require2("stream");
|
|
76244
|
+
function emitClose(stream) {
|
|
76245
|
+
stream.emit("close");
|
|
76246
|
+
}
|
|
76247
|
+
function duplexOnEnd() {
|
|
76248
|
+
if (!this.destroyed && this._writableState.finished) {
|
|
76249
|
+
this.destroy();
|
|
76250
|
+
}
|
|
76251
|
+
}
|
|
76252
|
+
function duplexOnError(err) {
|
|
76253
|
+
this.removeListener("error", duplexOnError);
|
|
76254
|
+
this.destroy();
|
|
76255
|
+
if (this.listenerCount("error") === 0) {
|
|
76256
|
+
this.emit("error", err);
|
|
76257
|
+
}
|
|
76258
|
+
}
|
|
76259
|
+
function createWebSocketStream22(ws, options) {
|
|
76260
|
+
let terminateOnDestroy = true;
|
|
76261
|
+
const duplex = new Duplex({
|
|
76262
|
+
...options,
|
|
76263
|
+
autoDestroy: false,
|
|
76264
|
+
emitClose: false,
|
|
76265
|
+
objectMode: false,
|
|
76266
|
+
writableObjectMode: false
|
|
76267
|
+
});
|
|
76268
|
+
ws.on("message", function message(msg, isBinary) {
|
|
76269
|
+
const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
76270
|
+
if (!duplex.push(data)) ws.pause();
|
|
76271
|
+
});
|
|
76272
|
+
ws.once("error", function error4(err) {
|
|
76273
|
+
if (duplex.destroyed) return;
|
|
76274
|
+
terminateOnDestroy = false;
|
|
76275
|
+
duplex.destroy(err);
|
|
76276
|
+
});
|
|
76277
|
+
ws.once("close", function close2() {
|
|
76278
|
+
if (duplex.destroyed) return;
|
|
76279
|
+
duplex.push(null);
|
|
76280
|
+
});
|
|
76281
|
+
duplex._destroy = function(err, callback) {
|
|
76282
|
+
if (ws.readyState === ws.CLOSED) {
|
|
76283
|
+
callback(err);
|
|
76284
|
+
process.nextTick(emitClose, duplex);
|
|
76285
|
+
return;
|
|
76286
|
+
}
|
|
76287
|
+
let called = false;
|
|
76288
|
+
ws.once("error", function error4(err2) {
|
|
76289
|
+
called = true;
|
|
76290
|
+
callback(err2);
|
|
76291
|
+
});
|
|
76292
|
+
ws.once("close", function close2() {
|
|
76293
|
+
if (!called) callback(err);
|
|
76294
|
+
process.nextTick(emitClose, duplex);
|
|
76295
|
+
});
|
|
76296
|
+
if (terminateOnDestroy) ws.terminate();
|
|
76297
|
+
};
|
|
76298
|
+
duplex._final = function(callback) {
|
|
76299
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
76300
|
+
ws.once("open", function open() {
|
|
76301
|
+
duplex._final(callback);
|
|
76302
|
+
});
|
|
76303
|
+
return;
|
|
76304
|
+
}
|
|
76305
|
+
if (ws._socket === null) return;
|
|
76306
|
+
if (ws._socket._writableState.finished) {
|
|
76307
|
+
callback();
|
|
76308
|
+
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
76309
|
+
} else {
|
|
76310
|
+
ws._socket.once("finish", function finish() {
|
|
76311
|
+
callback();
|
|
76312
|
+
});
|
|
76313
|
+
ws.close();
|
|
76314
|
+
}
|
|
76315
|
+
};
|
|
76316
|
+
duplex._read = function() {
|
|
76317
|
+
if (ws.isPaused) ws.resume();
|
|
76318
|
+
};
|
|
76319
|
+
duplex._write = function(chunk, encoding, callback) {
|
|
76320
|
+
if (ws.readyState === ws.CONNECTING) {
|
|
76321
|
+
ws.once("open", function open() {
|
|
76322
|
+
duplex._write(chunk, encoding, callback);
|
|
76323
|
+
});
|
|
76324
|
+
return;
|
|
76325
|
+
}
|
|
76326
|
+
ws.send(chunk, callback);
|
|
76327
|
+
};
|
|
76328
|
+
duplex.on("end", duplexOnEnd);
|
|
76329
|
+
duplex.on("error", duplexOnError);
|
|
76330
|
+
return duplex;
|
|
76331
|
+
}
|
|
76332
|
+
module2.exports = createWebSocketStream22;
|
|
76333
|
+
}
|
|
76334
|
+
});
|
|
75983
76335
|
require_subprotocol2 = __commonJS2({
|
|
75984
|
-
"../
|
|
76336
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/subprotocol.js"(exports, module2) {
|
|
75985
76337
|
"use strict";
|
|
75986
76338
|
var { tokenChars } = require_validation3();
|
|
75987
76339
|
function parse5(header) {
|
|
@@ -76024,17 +76376,17 @@ var init_simple_client_node = __esm({
|
|
|
76024
76376
|
}
|
|
76025
76377
|
});
|
|
76026
76378
|
require_websocket_server2 = __commonJS2({
|
|
76027
|
-
"../
|
|
76379
|
+
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/websocket-server.js"(exports, module2) {
|
|
76028
76380
|
"use strict";
|
|
76029
76381
|
var EventEmitter3 = __require2("events");
|
|
76030
76382
|
var http5 = __require2("http");
|
|
76031
76383
|
var { Duplex } = __require2("stream");
|
|
76032
76384
|
var { createHash: createHash3 } = __require2("crypto");
|
|
76033
|
-
var
|
|
76034
|
-
var
|
|
76035
|
-
var
|
|
76385
|
+
var extension22 = require_extension2();
|
|
76386
|
+
var PerMessageDeflate22 = require_permessage_deflate2();
|
|
76387
|
+
var subprotocol22 = require_subprotocol2();
|
|
76036
76388
|
var WebSocket22 = require_websocket2();
|
|
76037
|
-
var { GUID, kWebSocket } = require_constants3();
|
|
76389
|
+
var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants3();
|
|
76038
76390
|
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
76039
76391
|
var RUNNING = 0;
|
|
76040
76392
|
var CLOSING = 1;
|
|
@@ -76053,8 +76405,15 @@ var init_simple_client_node = __esm({
|
|
|
76053
76405
|
* pending connections
|
|
76054
76406
|
* @param {Boolean} [options.clientTracking=true] Specifies whether or not to
|
|
76055
76407
|
* track clients
|
|
76408
|
+
* @param {Number} [options.closeTimeout=30000] Duration in milliseconds to
|
|
76409
|
+
* wait for the closing handshake to finish after `websocket.close()` is
|
|
76410
|
+
* called
|
|
76056
76411
|
* @param {Function} [options.handleProtocols] A hook to handle protocols
|
|
76057
76412
|
* @param {String} [options.host] The hostname where to bind the server
|
|
76413
|
+
* @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
|
|
76414
|
+
* buffered data chunks
|
|
76415
|
+
* @param {Number} [options.maxFragments=131072] The maximum number of message
|
|
76416
|
+
* fragments
|
|
76058
76417
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
76059
76418
|
* size
|
|
76060
76419
|
* @param {Boolean} [options.noServer=false] Enable no server mode
|
|
@@ -76076,11 +76435,14 @@ var init_simple_client_node = __esm({
|
|
|
76076
76435
|
options = {
|
|
76077
76436
|
allowSynchronousEvents: true,
|
|
76078
76437
|
autoPong: true,
|
|
76438
|
+
maxBufferedChunks: 1024 * 1024,
|
|
76439
|
+
maxFragments: 128 * 1024,
|
|
76079
76440
|
maxPayload: 100 * 1024 * 1024,
|
|
76080
76441
|
skipUTF8Validation: false,
|
|
76081
76442
|
perMessageDeflate: false,
|
|
76082
76443
|
handleProtocols: null,
|
|
76083
76444
|
clientTracking: true,
|
|
76445
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
76084
76446
|
verifyClient: null,
|
|
76085
76447
|
noServer: false,
|
|
76086
76448
|
backlog: null,
|
|
@@ -76236,9 +76598,11 @@ var init_simple_client_node = __esm({
|
|
|
76236
76598
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
76237
76599
|
return;
|
|
76238
76600
|
}
|
|
76239
|
-
if (version3 !==
|
|
76601
|
+
if (version3 !== 13 && version3 !== 8) {
|
|
76240
76602
|
const message = "Missing or invalid Sec-WebSocket-Version header";
|
|
76241
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message
|
|
76603
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
|
|
76604
|
+
"Sec-WebSocket-Version": "13, 8"
|
|
76605
|
+
});
|
|
76242
76606
|
return;
|
|
76243
76607
|
}
|
|
76244
76608
|
if (!this.shouldHandle(req)) {
|
|
@@ -76249,7 +76613,7 @@ var init_simple_client_node = __esm({
|
|
|
76249
76613
|
let protocols = /* @__PURE__ */ new Set();
|
|
76250
76614
|
if (secWebSocketProtocol !== void 0) {
|
|
76251
76615
|
try {
|
|
76252
|
-
protocols =
|
|
76616
|
+
protocols = subprotocol22.parse(secWebSocketProtocol);
|
|
76253
76617
|
} catch (err) {
|
|
76254
76618
|
const message = "Invalid Sec-WebSocket-Protocol header";
|
|
76255
76619
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
@@ -76259,16 +76623,16 @@ var init_simple_client_node = __esm({
|
|
|
76259
76623
|
const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
|
|
76260
76624
|
const extensions = {};
|
|
76261
76625
|
if (this.options.perMessageDeflate && secWebSocketExtensions !== void 0) {
|
|
76262
|
-
const perMessageDeflate = new
|
|
76263
|
-
this.options.perMessageDeflate,
|
|
76264
|
-
true,
|
|
76265
|
-
this.options.maxPayload
|
|
76266
|
-
);
|
|
76626
|
+
const perMessageDeflate = new PerMessageDeflate22({
|
|
76627
|
+
...this.options.perMessageDeflate,
|
|
76628
|
+
isServer: true,
|
|
76629
|
+
maxPayload: this.options.maxPayload
|
|
76630
|
+
});
|
|
76267
76631
|
try {
|
|
76268
|
-
const offers =
|
|
76269
|
-
if (offers[
|
|
76270
|
-
perMessageDeflate.accept(offers[
|
|
76271
|
-
extensions[
|
|
76632
|
+
const offers = extension22.parse(secWebSocketExtensions);
|
|
76633
|
+
if (offers[PerMessageDeflate22.extensionName]) {
|
|
76634
|
+
perMessageDeflate.accept(offers[PerMessageDeflate22.extensionName]);
|
|
76635
|
+
extensions[PerMessageDeflate22.extensionName] = perMessageDeflate;
|
|
76272
76636
|
}
|
|
76273
76637
|
} catch (err) {
|
|
76274
76638
|
const message = "Invalid or unacceptable Sec-WebSocket-Extensions header";
|
|
@@ -76339,10 +76703,10 @@ var init_simple_client_node = __esm({
|
|
|
76339
76703
|
ws._protocol = protocol;
|
|
76340
76704
|
}
|
|
76341
76705
|
}
|
|
76342
|
-
if (extensions[
|
|
76343
|
-
const params = extensions[
|
|
76344
|
-
const value =
|
|
76345
|
-
[
|
|
76706
|
+
if (extensions[PerMessageDeflate22.extensionName]) {
|
|
76707
|
+
const params = extensions[PerMessageDeflate22.extensionName].params;
|
|
76708
|
+
const value = extension22.format({
|
|
76709
|
+
[PerMessageDeflate22.extensionName]: [params]
|
|
76346
76710
|
});
|
|
76347
76711
|
headers.push(`Sec-WebSocket-Extensions: ${value}`);
|
|
76348
76712
|
ws._extensions = extensions;
|
|
@@ -76352,6 +76716,8 @@ var init_simple_client_node = __esm({
|
|
|
76352
76716
|
socket.removeListener("error", socketOnError);
|
|
76353
76717
|
ws.setSocket(socket, head, {
|
|
76354
76718
|
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
76719
|
+
maxBufferedChunks: this.options.maxBufferedChunks,
|
|
76720
|
+
maxFragments: this.options.maxFragments,
|
|
76355
76721
|
maxPayload: this.options.maxPayload,
|
|
76356
76722
|
skipUTF8Validation: this.options.skipUTF8Validation
|
|
76357
76723
|
});
|
|
@@ -76397,20 +76763,23 @@ var init_simple_client_node = __esm({
|
|
|
76397
76763
|
` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message
|
|
76398
76764
|
);
|
|
76399
76765
|
}
|
|
76400
|
-
function abortHandshakeOrEmitwsClientError(server, req, socket, code2, message) {
|
|
76766
|
+
function abortHandshakeOrEmitwsClientError(server, req, socket, code2, message, headers) {
|
|
76401
76767
|
if (server.listenerCount("wsClientError")) {
|
|
76402
76768
|
const err = new Error(message);
|
|
76403
76769
|
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
76404
76770
|
server.emit("wsClientError", err, socket, req);
|
|
76405
76771
|
} else {
|
|
76406
|
-
abortHandshake(socket, code2, message);
|
|
76772
|
+
abortHandshake(socket, code2, message, headers);
|
|
76407
76773
|
}
|
|
76408
76774
|
}
|
|
76409
76775
|
}
|
|
76410
76776
|
});
|
|
76411
76777
|
import_stream2 = __toESM3(require_stream2(), 1);
|
|
76778
|
+
import_extension2 = __toESM3(require_extension2(), 1);
|
|
76779
|
+
import_permessage_deflate2 = __toESM3(require_permessage_deflate2(), 1);
|
|
76412
76780
|
import_receiver2 = __toESM3(require_receiver2(), 1);
|
|
76413
76781
|
import_sender2 = __toESM3(require_sender2(), 1);
|
|
76782
|
+
import_subprotocol2 = __toESM3(require_subprotocol2(), 1);
|
|
76414
76783
|
import_websocket2 = __toESM3(require_websocket2(), 1);
|
|
76415
76784
|
import_websocket_server2 = __toESM3(require_websocket_server2(), 1);
|
|
76416
76785
|
wrapper_default2 = import_websocket2.default;
|
|
@@ -76419,6 +76788,25 @@ var init_simple_client_node = __esm({
|
|
|
76419
76788
|
}
|
|
76420
76789
|
});
|
|
76421
76790
|
|
|
76791
|
+
// ../../node_modules/convex/dist/esm/browser/http_client.js
|
|
76792
|
+
var init_http_client = __esm({
|
|
76793
|
+
"../../node_modules/convex/dist/esm/browser/http_client.js"() {
|
|
76794
|
+
"use strict";
|
|
76795
|
+
init_api4();
|
|
76796
|
+
init_common2();
|
|
76797
|
+
init_esm6();
|
|
76798
|
+
init_values();
|
|
76799
|
+
init_logging();
|
|
76800
|
+
}
|
|
76801
|
+
});
|
|
76802
|
+
|
|
76803
|
+
// ../../node_modules/convex/dist/esm/browser/query_options.js
|
|
76804
|
+
var init_query_options = __esm({
|
|
76805
|
+
"../../node_modules/convex/dist/esm/browser/query_options.js"() {
|
|
76806
|
+
"use strict";
|
|
76807
|
+
}
|
|
76808
|
+
});
|
|
76809
|
+
|
|
76422
76810
|
// ../../node_modules/convex/dist/esm/browser/index-node.js
|
|
76423
76811
|
var init_index_node2 = __esm({
|
|
76424
76812
|
"../../node_modules/convex/dist/esm/browser/index-node.js"() {
|
|
@@ -76426,6 +76814,7 @@ var init_index_node2 = __esm({
|
|
|
76426
76814
|
init_client3();
|
|
76427
76815
|
init_simple_client_node();
|
|
76428
76816
|
init_http_client();
|
|
76817
|
+
init_query_options();
|
|
76429
76818
|
}
|
|
76430
76819
|
});
|
|
76431
76820
|
|
|
@@ -76445,6 +76834,13 @@ var init_syscall = __esm({
|
|
|
76445
76834
|
}
|
|
76446
76835
|
});
|
|
76447
76836
|
|
|
76837
|
+
// ../../node_modules/convex/dist/esm/server/impl/validate.js
|
|
76838
|
+
var init_validate = __esm({
|
|
76839
|
+
"../../node_modules/convex/dist/esm/server/impl/validate.js"() {
|
|
76840
|
+
"use strict";
|
|
76841
|
+
}
|
|
76842
|
+
});
|
|
76843
|
+
|
|
76448
76844
|
// ../../node_modules/convex/dist/esm/server/impl/actions_impl.js
|
|
76449
76845
|
var init_actions_impl = __esm({
|
|
76450
76846
|
"../../node_modules/convex/dist/esm/server/impl/actions_impl.js"() {
|
|
@@ -76454,6 +76850,7 @@ var init_actions_impl = __esm({
|
|
|
76454
76850
|
init_syscall();
|
|
76455
76851
|
init_common2();
|
|
76456
76852
|
init_paths2();
|
|
76853
|
+
init_validate();
|
|
76457
76854
|
}
|
|
76458
76855
|
});
|
|
76459
76856
|
|
|
@@ -76464,13 +76861,6 @@ var init_vector_search = __esm({
|
|
|
76464
76861
|
}
|
|
76465
76862
|
});
|
|
76466
76863
|
|
|
76467
|
-
// ../../node_modules/convex/dist/esm/server/impl/validate.js
|
|
76468
|
-
var init_validate = __esm({
|
|
76469
|
-
"../../node_modules/convex/dist/esm/server/impl/validate.js"() {
|
|
76470
|
-
"use strict";
|
|
76471
|
-
}
|
|
76472
|
-
});
|
|
76473
|
-
|
|
76474
76864
|
// ../../node_modules/convex/dist/esm/server/impl/vector_search_impl.js
|
|
76475
76865
|
var init_vector_search_impl = __esm({
|
|
76476
76866
|
"../../node_modules/convex/dist/esm/server/impl/vector_search_impl.js"() {
|
|
@@ -76487,6 +76877,7 @@ var init_vector_search_impl = __esm({
|
|
|
76487
76877
|
var init_authentication_impl = __esm({
|
|
76488
76878
|
"../../node_modules/convex/dist/esm/server/impl/authentication_impl.js"() {
|
|
76489
76879
|
"use strict";
|
|
76880
|
+
init_esm6();
|
|
76490
76881
|
init_syscall();
|
|
76491
76882
|
}
|
|
76492
76883
|
});
|
|
@@ -76585,11 +76976,21 @@ var init_storage_impl = __esm({
|
|
|
76585
76976
|
"../../node_modules/convex/dist/esm/server/impl/storage_impl.js"() {
|
|
76586
76977
|
"use strict";
|
|
76587
76978
|
init_esm6();
|
|
76979
|
+
init_base64();
|
|
76588
76980
|
init_syscall();
|
|
76589
76981
|
init_validate();
|
|
76590
76982
|
}
|
|
76591
76983
|
});
|
|
76592
76984
|
|
|
76985
|
+
// ../../node_modules/convex/dist/esm/server/impl/meta_impl.js
|
|
76986
|
+
var init_meta_impl = __esm({
|
|
76987
|
+
"../../node_modules/convex/dist/esm/server/impl/meta_impl.js"() {
|
|
76988
|
+
"use strict";
|
|
76989
|
+
init_values();
|
|
76990
|
+
init_syscall();
|
|
76991
|
+
}
|
|
76992
|
+
});
|
|
76993
|
+
|
|
76593
76994
|
// ../../node_modules/convex/dist/esm/server/impl/registration_impl.js
|
|
76594
76995
|
var init_registration_impl = __esm({
|
|
76595
76996
|
"../../node_modules/convex/dist/esm/server/impl/registration_impl.js"() {
|
|
@@ -76606,6 +77007,7 @@ var init_registration_impl = __esm({
|
|
|
76606
77007
|
init_syscall();
|
|
76607
77008
|
init_validator();
|
|
76608
77009
|
init_paths2();
|
|
77010
|
+
init_meta_impl();
|
|
76609
77011
|
}
|
|
76610
77012
|
});
|
|
76611
77013
|
|
|
@@ -76640,6 +77042,7 @@ var init_cron = __esm({
|
|
|
76640
77042
|
init_api4();
|
|
76641
77043
|
init_common2();
|
|
76642
77044
|
init_values();
|
|
77045
|
+
init_paths2();
|
|
76643
77046
|
}
|
|
76644
77047
|
});
|
|
76645
77048
|
|
|
@@ -76655,14 +77058,53 @@ var init_router = __esm({
|
|
|
76655
77058
|
var init_components = __esm({
|
|
76656
77059
|
"../../node_modules/convex/dist/esm/server/components/index.js"() {
|
|
76657
77060
|
"use strict";
|
|
76658
|
-
init_values();
|
|
76659
77061
|
init_esm6();
|
|
76660
77062
|
init_syscall();
|
|
76661
77063
|
init_paths2();
|
|
77064
|
+
init_validator();
|
|
76662
77065
|
init_paths2();
|
|
76663
77066
|
}
|
|
76664
77067
|
});
|
|
76665
77068
|
|
|
77069
|
+
// ../../node_modules/convex/dist/esm/server/logVars.js
|
|
77070
|
+
var REQUEST_ID, IP, USER_AGENT, NOW, CONVEX_ACTOR, varNames;
|
|
77071
|
+
var init_logVars = __esm({
|
|
77072
|
+
"../../node_modules/convex/dist/esm/server/logVars.js"() {
|
|
77073
|
+
"use strict";
|
|
77074
|
+
REQUEST_ID = /* @__PURE__ */ Symbol("var.requestId");
|
|
77075
|
+
IP = /* @__PURE__ */ Symbol("var.ip");
|
|
77076
|
+
USER_AGENT = /* @__PURE__ */ Symbol("var.userAgent");
|
|
77077
|
+
NOW = /* @__PURE__ */ Symbol("var.now");
|
|
77078
|
+
CONVEX_ACTOR = /* @__PURE__ */ Symbol("var.convexActor");
|
|
77079
|
+
varNames = {
|
|
77080
|
+
[REQUEST_ID]: "requestId",
|
|
77081
|
+
[IP]: "ip",
|
|
77082
|
+
[USER_AGENT]: "userAgent",
|
|
77083
|
+
[NOW]: "now",
|
|
77084
|
+
[CONVEX_ACTOR]: "convexActor"
|
|
77085
|
+
};
|
|
77086
|
+
}
|
|
77087
|
+
});
|
|
77088
|
+
|
|
77089
|
+
// ../../node_modules/convex/dist/esm/server/audit_logging.js
|
|
77090
|
+
var init_audit_logging = __esm({
|
|
77091
|
+
"../../node_modules/convex/dist/esm/server/audit_logging.js"() {
|
|
77092
|
+
"use strict";
|
|
77093
|
+
init_esm6();
|
|
77094
|
+
init_syscall();
|
|
77095
|
+
init_logVars();
|
|
77096
|
+
}
|
|
77097
|
+
});
|
|
77098
|
+
|
|
77099
|
+
// ../../node_modules/convex/dist/esm/server/log.js
|
|
77100
|
+
var init_log = __esm({
|
|
77101
|
+
"../../node_modules/convex/dist/esm/server/log.js"() {
|
|
77102
|
+
"use strict";
|
|
77103
|
+
init_audit_logging();
|
|
77104
|
+
init_logVars();
|
|
77105
|
+
}
|
|
77106
|
+
});
|
|
77107
|
+
|
|
76666
77108
|
// ../../node_modules/convex/dist/esm/server/schema.js
|
|
76667
77109
|
function defineTable(documentSchema) {
|
|
76668
77110
|
if (isValidator(documentSchema)) {
|
|
@@ -76671,6 +77113,42 @@ function defineTable(documentSchema) {
|
|
|
76671
77113
|
return new TableDefinition(v.object(documentSchema));
|
|
76672
77114
|
}
|
|
76673
77115
|
}
|
|
77116
|
+
function addSystemFields(tableName, validator) {
|
|
77117
|
+
switch (validator.kind) {
|
|
77118
|
+
case "object":
|
|
77119
|
+
return validator.extend({
|
|
77120
|
+
_id: v.id(tableName),
|
|
77121
|
+
_creationTime: v.number()
|
|
77122
|
+
});
|
|
77123
|
+
case "union":
|
|
77124
|
+
return v.union(
|
|
77125
|
+
...validator.members.map(
|
|
77126
|
+
(member) => addSystemFields(tableName, member)
|
|
77127
|
+
)
|
|
77128
|
+
);
|
|
77129
|
+
// `v.any()` already permits the system fields.
|
|
77130
|
+
case "any":
|
|
77131
|
+
return validator;
|
|
77132
|
+
default:
|
|
77133
|
+
throw new Error(
|
|
77134
|
+
`Invalid validator for table "${tableName}": a table's documents must be objects, or a union of objects (see https://docs.convex.dev/database/schemas)`
|
|
77135
|
+
);
|
|
77136
|
+
}
|
|
77137
|
+
}
|
|
77138
|
+
function docValidator(tableName, table) {
|
|
77139
|
+
return addSystemFields(tableName, table.validator);
|
|
77140
|
+
}
|
|
77141
|
+
function tableInSchema(schema, tableName) {
|
|
77142
|
+
const table = schema.tables[tableName];
|
|
77143
|
+
if (table === void 0) {
|
|
77144
|
+
throw new Error(
|
|
77145
|
+
`Table "${tableName}" is not in this schema. Tables in this schema: ${Object.keys(
|
|
77146
|
+
schema.tables
|
|
77147
|
+
).join(", ")}`
|
|
77148
|
+
);
|
|
77149
|
+
}
|
|
77150
|
+
return table;
|
|
77151
|
+
}
|
|
76674
77152
|
function defineSchema(schema, options) {
|
|
76675
77153
|
return new SchemaDefinition(schema, options);
|
|
76676
77154
|
}
|
|
@@ -76694,6 +77172,7 @@ var init_schema = __esm({
|
|
|
76694
77172
|
__publicField14(this, "vectorIndexes");
|
|
76695
77173
|
__publicField14(this, "stagedVectorIndexes");
|
|
76696
77174
|
__publicField14(this, "validator");
|
|
77175
|
+
__publicField14(this, "stagedValidator");
|
|
76697
77176
|
this.indexes = [];
|
|
76698
77177
|
this.stagedDbIndexes = [];
|
|
76699
77178
|
this.searchIndexes = [];
|
|
@@ -76707,8 +77186,6 @@ var init_schema = __esm({
|
|
|
76707
77186
|
*
|
|
76708
77187
|
* Returns indexes defined on this table.
|
|
76709
77188
|
* Intended for the advanced use cases of dynamically deciding which index to use for a query.
|
|
76710
|
-
* If you think you need this, please chime in on ths issue in the Convex JS GitHub repo.
|
|
76711
|
-
* https://github.com/get-convex/convex-js/issues/49
|
|
76712
77189
|
*/
|
|
76713
77190
|
" indexes"() {
|
|
76714
77191
|
return this.indexes;
|
|
@@ -76766,6 +77243,60 @@ var init_schema = __esm({
|
|
|
76766
77243
|
}
|
|
76767
77244
|
return this;
|
|
76768
77245
|
}
|
|
77246
|
+
/**
|
|
77247
|
+
* Stage changes to this table's document validator.
|
|
77248
|
+
*
|
|
77249
|
+
* Convex validates the staged validator against the table's existing
|
|
77250
|
+
* documents in the background, while the validator passed to
|
|
77251
|
+
* {@link defineTable} remains the one enforced on writes. Once
|
|
77252
|
+
* the background validation succeeds, apply the staged changes
|
|
77253
|
+
* and remove `.staged()`.
|
|
77254
|
+
*
|
|
77255
|
+
* For an object validator, pass only the fields to add or replace. Fields
|
|
77256
|
+
* omitted from the changes keep their enforced validators.
|
|
77257
|
+
* Set a field to `undefined` to remove it from the staged validator.
|
|
77258
|
+
* For nested objects, you must specify the full object validator.
|
|
77259
|
+
*
|
|
77260
|
+
* ```ts
|
|
77261
|
+
* defineTable({
|
|
77262
|
+
* apple: v.string(),
|
|
77263
|
+
* banana: v.number(),
|
|
77264
|
+
* legacy: v.optional(v.string()),
|
|
77265
|
+
* }).staged({
|
|
77266
|
+
* banana: v.union(v.string(), v.number()),
|
|
77267
|
+
* legacy: undefined,
|
|
77268
|
+
* })
|
|
77269
|
+
* ```
|
|
77270
|
+
*
|
|
77271
|
+
* See [Staged validators](https://docs.convex.dev/database/schemas#staged-validators).
|
|
77272
|
+
*
|
|
77273
|
+
* @param documentSchema - Field changes for a table defined as an object or
|
|
77274
|
+
* `v.any()`, or a full schema validator specifying the proposed next document
|
|
77275
|
+
* type. Use a full schema validator for a table defined as a union.
|
|
77276
|
+
* @returns A {@link TableDefinition} with the staged validator attached.
|
|
77277
|
+
*/
|
|
77278
|
+
staged(documentSchema) {
|
|
77279
|
+
if (this.stagedValidator !== void 0) {
|
|
77280
|
+
throw new Error("Table cannot have more than one staged validator.");
|
|
77281
|
+
}
|
|
77282
|
+
if (isValidator(documentSchema)) {
|
|
77283
|
+
this.stagedValidator = documentSchema;
|
|
77284
|
+
} else {
|
|
77285
|
+
if (this.validator.kind !== "object" && this.validator.kind !== "any") {
|
|
77286
|
+
throw new Error(
|
|
77287
|
+
"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."
|
|
77288
|
+
);
|
|
77289
|
+
}
|
|
77290
|
+
const enforcedFields = this.validator.kind === "object" ? this.validator.fields : {};
|
|
77291
|
+
const fields = Object.fromEntries(
|
|
77292
|
+
Object.entries({ ...enforcedFields, ...documentSchema }).filter(
|
|
77293
|
+
(entry) => entry[1] !== void 0
|
|
77294
|
+
)
|
|
77295
|
+
);
|
|
77296
|
+
this.stagedValidator = v.object(fields);
|
|
77297
|
+
}
|
|
77298
|
+
return this.self();
|
|
77299
|
+
}
|
|
76769
77300
|
/**
|
|
76770
77301
|
* Work around for https://github.com/microsoft/TypeScript/issues/57035
|
|
76771
77302
|
*/
|
|
@@ -76785,6 +77316,15 @@ var init_schema = __esm({
|
|
|
76785
77316
|
"Invalid validator: please make sure that the parameter of `defineTable` is valid (see https://docs.convex.dev/database/schemas)"
|
|
76786
77317
|
);
|
|
76787
77318
|
}
|
|
77319
|
+
let stagedDocumentType = void 0;
|
|
77320
|
+
if (this.stagedValidator !== void 0) {
|
|
77321
|
+
stagedDocumentType = this.stagedValidator.json;
|
|
77322
|
+
if (typeof stagedDocumentType !== "object") {
|
|
77323
|
+
throw new Error(
|
|
77324
|
+
"Invalid staged validator: please make sure that the parameter of `.staged()` is valid (see https://docs.convex.dev/database/schemas)"
|
|
77325
|
+
);
|
|
77326
|
+
}
|
|
77327
|
+
}
|
|
76788
77328
|
return {
|
|
76789
77329
|
indexes: this.indexes,
|
|
76790
77330
|
stagedDbIndexes: this.stagedDbIndexes,
|
|
@@ -76792,7 +77332,8 @@ var init_schema = __esm({
|
|
|
76792
77332
|
stagedSearchIndexes: this.stagedSearchIndexes,
|
|
76793
77333
|
vectorIndexes: this.vectorIndexes,
|
|
76794
77334
|
stagedVectorIndexes: this.stagedVectorIndexes,
|
|
76795
|
-
documentType
|
|
77335
|
+
documentType,
|
|
77336
|
+
stagedDocumentType
|
|
76796
77337
|
};
|
|
76797
77338
|
}
|
|
76798
77339
|
};
|
|
@@ -76807,6 +77348,37 @@ var init_schema = __esm({
|
|
|
76807
77348
|
this.tables = tables;
|
|
76808
77349
|
this.schemaValidation = options?.schemaValidation === void 0 ? true : options.schemaValidation;
|
|
76809
77350
|
}
|
|
77351
|
+
/**
|
|
77352
|
+
* The validator for whole documents of a table in this schema: the table's
|
|
77353
|
+
* own validator with the `_id` and `_creationTime` system fields added.
|
|
77354
|
+
*
|
|
77355
|
+
* @example
|
|
77356
|
+
* ```ts
|
|
77357
|
+
* export const get = query({
|
|
77358
|
+
* args: { id: schema.id("messages") },
|
|
77359
|
+
* returns: v.union(schema.doc("messages"), v.null()),
|
|
77360
|
+
* handler: (ctx, args) => ctx.db.get(args.id),
|
|
77361
|
+
* });
|
|
77362
|
+
* ```
|
|
77363
|
+
*
|
|
77364
|
+
* @param tableName - The name of a table in this schema.
|
|
77365
|
+
* @returns A validator matching documents of that table.
|
|
77366
|
+
*/
|
|
77367
|
+
doc(tableName) {
|
|
77368
|
+
return docValidator(tableName, tableInSchema(this, tableName));
|
|
77369
|
+
}
|
|
77370
|
+
/**
|
|
77371
|
+
* The validator for IDs of a table in this schema.
|
|
77372
|
+
*
|
|
77373
|
+
* Same as `v.id(tableName)`, but only accepts tables in this schema.
|
|
77374
|
+
*
|
|
77375
|
+
* @param tableName - The name of a table in this schema.
|
|
77376
|
+
* @returns A validator matching IDs of that table.
|
|
77377
|
+
*/
|
|
77378
|
+
id(tableName) {
|
|
77379
|
+
tableInSchema(this, tableName);
|
|
77380
|
+
return v.id(tableName);
|
|
77381
|
+
}
|
|
76810
77382
|
/**
|
|
76811
77383
|
* Export the contents of this definition.
|
|
76812
77384
|
*
|
|
@@ -76823,7 +77395,8 @@ var init_schema = __esm({
|
|
|
76823
77395
|
stagedSearchIndexes,
|
|
76824
77396
|
vectorIndexes,
|
|
76825
77397
|
stagedVectorIndexes,
|
|
76826
|
-
documentType
|
|
77398
|
+
documentType,
|
|
77399
|
+
stagedDocumentType
|
|
76827
77400
|
} = definition.export();
|
|
76828
77401
|
return {
|
|
76829
77402
|
tableName,
|
|
@@ -76833,7 +77406,8 @@ var init_schema = __esm({
|
|
|
76833
77406
|
stagedSearchIndexes,
|
|
76834
77407
|
vectorIndexes,
|
|
76835
77408
|
stagedVectorIndexes,
|
|
76836
|
-
documentType
|
|
77409
|
+
documentType,
|
|
77410
|
+
stagedDocumentType
|
|
76837
77411
|
};
|
|
76838
77412
|
}),
|
|
76839
77413
|
schemaValidation: this.schemaValidation
|
|
@@ -76869,6 +77443,7 @@ var init_server = __esm({
|
|
|
76869
77443
|
"use strict";
|
|
76870
77444
|
init_database();
|
|
76871
77445
|
init_registration_impl();
|
|
77446
|
+
init_actions_impl();
|
|
76872
77447
|
init_pagination2();
|
|
76873
77448
|
init_search_filter_builder();
|
|
76874
77449
|
init_storage();
|
|
@@ -76878,6 +77453,7 @@ var init_server = __esm({
|
|
|
76878
77453
|
init_components();
|
|
76879
77454
|
init_components();
|
|
76880
77455
|
init_components();
|
|
77456
|
+
init_log();
|
|
76881
77457
|
init_schema();
|
|
76882
77458
|
}
|
|
76883
77459
|
});
|
|
@@ -80562,15 +81138,15 @@ var require_websocket_server3 = __commonJS({
|
|
|
80562
81138
|
});
|
|
80563
81139
|
|
|
80564
81140
|
// ../../node_modules/ws/wrapper.mjs
|
|
80565
|
-
var import_stream3,
|
|
81141
|
+
var import_stream3, import_extension3, import_permessage_deflate3, import_receiver3, import_sender3, import_subprotocol3, import_websocket3, import_websocket_server3, wrapper_default3;
|
|
80566
81142
|
var init_wrapper2 = __esm({
|
|
80567
81143
|
"../../node_modules/ws/wrapper.mjs"() {
|
|
80568
81144
|
import_stream3 = __toESM(require_stream3(), 1);
|
|
80569
|
-
|
|
80570
|
-
|
|
81145
|
+
import_extension3 = __toESM(require_extension3(), 1);
|
|
81146
|
+
import_permessage_deflate3 = __toESM(require_permessage_deflate3(), 1);
|
|
80571
81147
|
import_receiver3 = __toESM(require_receiver3(), 1);
|
|
80572
81148
|
import_sender3 = __toESM(require_sender3(), 1);
|
|
80573
|
-
|
|
81149
|
+
import_subprotocol3 = __toESM(require_subprotocol3(), 1);
|
|
80574
81150
|
import_websocket3 = __toESM(require_websocket3(), 1);
|
|
80575
81151
|
import_websocket_server3 = __toESM(require_websocket_server3(), 1);
|
|
80576
81152
|
wrapper_default3 = import_websocket3.default;
|
|
@@ -84340,4 +84916,4 @@ smol-toml/dist/index.js:
|
|
|
84340
84916
|
*)
|
|
84341
84917
|
*/
|
|
84342
84918
|
|
|
84343
|
-
//# debugId=
|
|
84919
|
+
//# debugId=ca23bafa-20c4-5334-b483-09d7c9e9b34e
|