@opendatalabs/personal-server-ts-server 1.27.0 → 1.29.0
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/package.json +2 -2
- package/dist/ui/ps-lite-debug.js +721 -250
- package/package.json +5 -5
package/dist/ui/ps-lite-debug.js
CHANGED
|
@@ -45302,7 +45302,7 @@ function FpSqrt(P11) {
|
|
|
45302
45302
|
return sqrt5mod8;
|
|
45303
45303
|
return tonelliShanks(P11);
|
|
45304
45304
|
}
|
|
45305
|
-
function validateField(
|
|
45305
|
+
function validateField(field2) {
|
|
45306
45306
|
const initial = {
|
|
45307
45307
|
ORDER: "bigint",
|
|
45308
45308
|
MASK: "bigint",
|
|
@@ -45313,7 +45313,7 @@ function validateField(field) {
|
|
|
45313
45313
|
map2[val] = "function";
|
|
45314
45314
|
return map2;
|
|
45315
45315
|
}, initial);
|
|
45316
|
-
return validateObject(
|
|
45316
|
+
return validateObject(field2, opts);
|
|
45317
45317
|
}
|
|
45318
45318
|
function FpPow(Fp2, num2, power) {
|
|
45319
45319
|
if (power < _0n3)
|
|
@@ -45518,11 +45518,11 @@ function validateMSMPoints(points, c10) {
|
|
|
45518
45518
|
throw new Error("invalid point at index " + i10);
|
|
45519
45519
|
});
|
|
45520
45520
|
}
|
|
45521
|
-
function validateMSMScalars(scalars,
|
|
45521
|
+
function validateMSMScalars(scalars, field2) {
|
|
45522
45522
|
if (!Array.isArray(scalars))
|
|
45523
45523
|
throw new Error("array of scalars expected");
|
|
45524
45524
|
scalars.forEach((s10, i10) => {
|
|
45525
|
-
if (!
|
|
45525
|
+
if (!field2.isValid(s10))
|
|
45526
45526
|
throw new Error("invalid scalar at index " + i10);
|
|
45527
45527
|
});
|
|
45528
45528
|
}
|
|
@@ -46827,13 +46827,13 @@ function hash_to_field(msg, count, options) {
|
|
|
46827
46827
|
}
|
|
46828
46828
|
return u10;
|
|
46829
46829
|
}
|
|
46830
|
-
function isogenyMap(
|
|
46830
|
+
function isogenyMap(field2, map2) {
|
|
46831
46831
|
const coeff = map2.map((i10) => Array.from(i10).reverse());
|
|
46832
46832
|
return (x10, y10) => {
|
|
46833
|
-
const [xn3, xd2, yn3, yd2] = coeff.map((val) => val.reduce((acc, i10) =>
|
|
46834
|
-
const [xd_inv, yd_inv] = FpInvertBatch(
|
|
46835
|
-
x10 =
|
|
46836
|
-
y10 =
|
|
46833
|
+
const [xn3, xd2, yn3, yd2] = coeff.map((val) => val.reduce((acc, i10) => field2.add(field2.mul(acc, x10), i10)));
|
|
46834
|
+
const [xd_inv, yd_inv] = FpInvertBatch(field2, [xd2, yd2], true);
|
|
46835
|
+
x10 = field2.mul(xn3, xd_inv);
|
|
46836
|
+
y10 = field2.mul(y10, field2.mul(yn3, yd_inv));
|
|
46837
46837
|
return { x: x10, y: y10 };
|
|
46838
46838
|
};
|
|
46839
46839
|
}
|
|
@@ -60009,9 +60009,28 @@ var require_utils = __commonJS({
|
|
|
60009
60009
|
"use strict";
|
|
60010
60010
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
60011
60011
|
var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
60012
|
+
var isPort = RegExp.prototype.test.bind(/^\d*$/u);
|
|
60012
60013
|
var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
60013
60014
|
var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
60014
|
-
var isPathCharacter = RegExp.prototype.test.bind(/^[
|
|
60015
|
+
var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
|
|
60016
|
+
var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
|
|
60017
|
+
var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
|
|
60018
|
+
var BYTE_HEX = new Array(256);
|
|
60019
|
+
{
|
|
60020
|
+
const HEX_DIGITS = "0123456789ABCDEF";
|
|
60021
|
+
for (let i10 = 0; i10 < 256; i10++) {
|
|
60022
|
+
BYTE_HEX[i10] = "%" + HEX_DIGITS[i10 >> 4] + HEX_DIGITS[i10 & 15];
|
|
60023
|
+
}
|
|
60024
|
+
}
|
|
60025
|
+
function percentEncodeNonAscii(cp2) {
|
|
60026
|
+
if (cp2 < 2048) {
|
|
60027
|
+
return BYTE_HEX[192 | cp2 >> 6] + BYTE_HEX[128 | cp2 & 63];
|
|
60028
|
+
}
|
|
60029
|
+
if (cp2 < 65536) {
|
|
60030
|
+
return BYTE_HEX[224 | cp2 >> 12] + BYTE_HEX[128 | cp2 >> 6 & 63] + BYTE_HEX[128 | cp2 & 63];
|
|
60031
|
+
}
|
|
60032
|
+
return BYTE_HEX[240 | cp2 >> 18] + BYTE_HEX[128 | cp2 >> 12 & 63] + BYTE_HEX[128 | cp2 >> 6 & 63] + BYTE_HEX[128 | cp2 & 63];
|
|
60033
|
+
}
|
|
60015
60034
|
function stringArrayToHexStripped(input) {
|
|
60016
60035
|
let acc = "";
|
|
60017
60036
|
let code = 0;
|
|
@@ -60036,91 +60055,105 @@ var require_utils = __commonJS({
|
|
|
60036
60055
|
}
|
|
60037
60056
|
return acc;
|
|
60038
60057
|
}
|
|
60058
|
+
var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
|
|
60059
|
+
var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
|
|
60060
|
+
var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
|
|
60039
60061
|
var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
60040
|
-
function
|
|
60041
|
-
|
|
60042
|
-
|
|
60043
|
-
|
|
60044
|
-
|
|
60045
|
-
|
|
60046
|
-
|
|
60047
|
-
if (hex3 !== "") {
|
|
60048
|
-
address.push(hex3);
|
|
60049
|
-
} else {
|
|
60050
|
-
output.error = true;
|
|
60051
|
-
return false;
|
|
60062
|
+
function isZoneIdentifier(zone) {
|
|
60063
|
+
if (zone.length === 0) return false;
|
|
60064
|
+
for (let i10 = 0; i10 < zone.length; i10++) {
|
|
60065
|
+
if (isZoneCharacter(zone[i10])) continue;
|
|
60066
|
+
if (zone[i10] === "%" && i10 + 2 < zone.length && isHexPair(zone.slice(i10 + 1, i10 + 3))) {
|
|
60067
|
+
i10 += 2;
|
|
60068
|
+
continue;
|
|
60052
60069
|
}
|
|
60053
|
-
|
|
60070
|
+
return false;
|
|
60054
60071
|
}
|
|
60055
60072
|
return true;
|
|
60056
60073
|
}
|
|
60057
|
-
function
|
|
60058
|
-
let
|
|
60059
|
-
|
|
60060
|
-
|
|
60061
|
-
|
|
60062
|
-
let
|
|
60063
|
-
|
|
60064
|
-
|
|
60065
|
-
|
|
60066
|
-
|
|
60067
|
-
|
|
60068
|
-
|
|
60069
|
-
}
|
|
60070
|
-
if (cursor === ":") {
|
|
60071
|
-
if (endipv6Encountered === true) {
|
|
60072
|
-
endIpv6 = true;
|
|
60073
|
-
}
|
|
60074
|
-
if (!consume(buffer, address, output)) {
|
|
60075
|
-
break;
|
|
60076
|
-
}
|
|
60077
|
-
if (++tokenCount > 7) {
|
|
60078
|
-
output.error = true;
|
|
60079
|
-
break;
|
|
60074
|
+
function compressIPv6ZeroRun(hextets) {
|
|
60075
|
+
let bestStart = -1;
|
|
60076
|
+
let bestLength = 0;
|
|
60077
|
+
let runStart = -1;
|
|
60078
|
+
let runLength = 0;
|
|
60079
|
+
for (let i10 = 0; i10 < hextets.length; i10++) {
|
|
60080
|
+
if (hextets[i10] === "0") {
|
|
60081
|
+
if (runStart === -1) runStart = i10;
|
|
60082
|
+
runLength++;
|
|
60083
|
+
if (runLength > bestLength) {
|
|
60084
|
+
bestLength = runLength;
|
|
60085
|
+
bestStart = runStart;
|
|
60080
60086
|
}
|
|
60081
|
-
if (i10 > 0 && input[i10 - 1] === ":") {
|
|
60082
|
-
endipv6Encountered = true;
|
|
60083
|
-
}
|
|
60084
|
-
address.push(":");
|
|
60085
|
-
continue;
|
|
60086
|
-
} else if (cursor === "%") {
|
|
60087
|
-
if (!consume(buffer, address, output)) {
|
|
60088
|
-
break;
|
|
60089
|
-
}
|
|
60090
|
-
consume = consumeIsZone;
|
|
60091
60087
|
} else {
|
|
60092
|
-
|
|
60088
|
+
runStart = -1;
|
|
60089
|
+
runLength = 0;
|
|
60090
|
+
}
|
|
60091
|
+
}
|
|
60092
|
+
if (bestLength < 2) return hextets.join(":");
|
|
60093
|
+
const head = hextets.slice(0, bestStart).join(":");
|
|
60094
|
+
const tail = hextets.slice(bestStart + bestLength).join(":");
|
|
60095
|
+
return head + "::" + tail;
|
|
60096
|
+
}
|
|
60097
|
+
function normalizeIPv6Address(input) {
|
|
60098
|
+
const compression = input.indexOf("::");
|
|
60099
|
+
if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
|
|
60100
|
+
const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
|
|
60101
|
+
const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
|
|
60102
|
+
if (compression !== -1) {
|
|
60103
|
+
if (left.length === 1 && left[0] === "") left.length = 0;
|
|
60104
|
+
if (right.length === 1 && right[0] === "") right.length = 0;
|
|
60105
|
+
}
|
|
60106
|
+
const parts = left.concat(right);
|
|
60107
|
+
let hextetCount = 0;
|
|
60108
|
+
for (let i10 = 0; i10 < parts.length; i10++) {
|
|
60109
|
+
const part = parts[i10];
|
|
60110
|
+
if (part === "") return void 0;
|
|
60111
|
+
if (part.indexOf(".") !== -1) {
|
|
60112
|
+
if (i10 !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
|
|
60113
|
+
hextetCount += 2;
|
|
60093
60114
|
continue;
|
|
60094
60115
|
}
|
|
60116
|
+
if (!isHextet(part)) return void 0;
|
|
60117
|
+
parts[i10] = parseInt(part, 16).toString(16);
|
|
60118
|
+
hextetCount++;
|
|
60095
60119
|
}
|
|
60096
|
-
if (
|
|
60097
|
-
if (
|
|
60098
|
-
|
|
60099
|
-
} else if (endIpv6) {
|
|
60100
|
-
address.push(buffer.join(""));
|
|
60101
|
-
} else {
|
|
60102
|
-
address.push(stringArrayToHexStripped(buffer));
|
|
60103
|
-
}
|
|
60120
|
+
if (compression === -1) {
|
|
60121
|
+
if (hextetCount !== 8) return void 0;
|
|
60122
|
+
return compressIPv6ZeroRun(parts);
|
|
60104
60123
|
}
|
|
60105
|
-
|
|
60106
|
-
|
|
60124
|
+
if (hextetCount >= 8) return void 0;
|
|
60125
|
+
const expanded = parts.slice(0, left.length);
|
|
60126
|
+
for (let i10 = hextetCount; i10 < 8; i10++) expanded.push("0");
|
|
60127
|
+
for (let i10 = left.length; i10 < parts.length; i10++) expanded.push(parts[i10]);
|
|
60128
|
+
return compressIPv6ZeroRun(expanded);
|
|
60107
60129
|
}
|
|
60108
60130
|
function normalizeIPv6(host) {
|
|
60109
|
-
|
|
60110
|
-
|
|
60111
|
-
}
|
|
60112
|
-
|
|
60113
|
-
if (
|
|
60114
|
-
|
|
60115
|
-
|
|
60116
|
-
|
|
60117
|
-
|
|
60118
|
-
|
|
60119
|
-
|
|
60120
|
-
|
|
60121
|
-
|
|
60122
|
-
|
|
60123
|
-
|
|
60131
|
+
const bracketed = host[0] === "[" && host[host.length - 1] === "]";
|
|
60132
|
+
const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
|
|
60133
|
+
if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
|
|
60134
|
+
let input = bracketed ? host.slice(1, -1) : host;
|
|
60135
|
+
if (bracketed && isIPvFuture(input)) {
|
|
60136
|
+
input = input.toLowerCase();
|
|
60137
|
+
return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
|
|
60138
|
+
}
|
|
60139
|
+
if (findToken(input, ":") < 2) {
|
|
60140
|
+
return { host, isIPV6: false, error: bracketed };
|
|
60141
|
+
}
|
|
60142
|
+
let zoneIdentifier = "";
|
|
60143
|
+
const zoneSeparator = input.indexOf("%");
|
|
60144
|
+
if (zoneSeparator !== -1) {
|
|
60145
|
+
const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
|
|
60146
|
+
zoneIdentifier = input.slice(zoneSeparator + separatorLength);
|
|
60147
|
+
if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
|
|
60148
|
+
input = input.slice(0, zoneSeparator);
|
|
60149
|
+
}
|
|
60150
|
+
const address = normalizeIPv6Address(input);
|
|
60151
|
+
if (address === void 0) return { host, isIPV6: false, error: true };
|
|
60152
|
+
return {
|
|
60153
|
+
host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
|
|
60154
|
+
escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
|
|
60155
|
+
isIPV6: true
|
|
60156
|
+
};
|
|
60124
60157
|
}
|
|
60125
60158
|
function findToken(str, token) {
|
|
60126
60159
|
let ind = 0;
|
|
@@ -60239,7 +60272,8 @@ var require_utils = __commonJS({
|
|
|
60239
60272
|
function normalizePathEncoding(input) {
|
|
60240
60273
|
let output = "";
|
|
60241
60274
|
for (let i10 = 0; i10 < input.length; i10++) {
|
|
60242
|
-
|
|
60275
|
+
const ch3 = input[i10];
|
|
60276
|
+
if (ch3 === "%" && i10 + 2 < input.length) {
|
|
60243
60277
|
const hex3 = input.slice(i10 + 1, i10 + 3);
|
|
60244
60278
|
if (isHexPair(hex3)) {
|
|
60245
60279
|
const normalizedHex = hex3.toUpperCase();
|
|
@@ -60253,10 +60287,152 @@ var require_utils = __commonJS({
|
|
|
60253
60287
|
continue;
|
|
60254
60288
|
}
|
|
60255
60289
|
}
|
|
60256
|
-
if (isPathCharacter(
|
|
60257
|
-
output +=
|
|
60290
|
+
if (isPathCharacter(ch3)) {
|
|
60291
|
+
output += ch3;
|
|
60292
|
+
} else {
|
|
60293
|
+
const code = input.charCodeAt(i10);
|
|
60294
|
+
if (code < 128) {
|
|
60295
|
+
output += isEscapeSafe(code) ? ch3 : BYTE_HEX[code];
|
|
60296
|
+
} else if (code < 55296 || code > 57343) {
|
|
60297
|
+
output += percentEncodeNonAscii(code);
|
|
60298
|
+
} else if (code <= 56319 && i10 + 1 < input.length) {
|
|
60299
|
+
const low = input.charCodeAt(i10 + 1);
|
|
60300
|
+
if (low >= 56320 && low <= 57343) {
|
|
60301
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
60302
|
+
i10++;
|
|
60303
|
+
} else {
|
|
60304
|
+
output += percentEncodeNonAscii(65533);
|
|
60305
|
+
}
|
|
60306
|
+
} else {
|
|
60307
|
+
output += percentEncodeNonAscii(65533);
|
|
60308
|
+
}
|
|
60309
|
+
}
|
|
60310
|
+
}
|
|
60311
|
+
return output;
|
|
60312
|
+
}
|
|
60313
|
+
function serializePathEncoding(input, pathNoScheme = false) {
|
|
60314
|
+
let output = "";
|
|
60315
|
+
let firstSegment = pathNoScheme && input[0] !== "/";
|
|
60316
|
+
for (let i10 = 0; i10 < input.length; i10++) {
|
|
60317
|
+
const ch3 = input[i10];
|
|
60318
|
+
if (ch3 === "%" && i10 + 2 < input.length) {
|
|
60319
|
+
const hex3 = input.slice(i10 + 1, i10 + 3);
|
|
60320
|
+
if (isHexPair(hex3)) {
|
|
60321
|
+
output += "%" + hex3.toUpperCase();
|
|
60322
|
+
i10 += 2;
|
|
60323
|
+
continue;
|
|
60324
|
+
}
|
|
60325
|
+
}
|
|
60326
|
+
if (ch3 === "/") {
|
|
60327
|
+
firstSegment = false;
|
|
60328
|
+
}
|
|
60329
|
+
if (isPathCharacter(ch3) && (ch3 !== ":" || !firstSegment)) {
|
|
60330
|
+
output += ch3;
|
|
60331
|
+
} else {
|
|
60332
|
+
const code = input.charCodeAt(i10);
|
|
60333
|
+
if (code < 128) {
|
|
60334
|
+
output += BYTE_HEX[code];
|
|
60335
|
+
} else if (code < 55296 || code > 57343) {
|
|
60336
|
+
output += percentEncodeNonAscii(code);
|
|
60337
|
+
} else if (code <= 56319 && i10 + 1 < input.length) {
|
|
60338
|
+
const low = input.charCodeAt(i10 + 1);
|
|
60339
|
+
if (low >= 56320 && low <= 57343) {
|
|
60340
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
60341
|
+
i10++;
|
|
60342
|
+
} else {
|
|
60343
|
+
output += percentEncodeNonAscii(65533);
|
|
60344
|
+
}
|
|
60345
|
+
} else {
|
|
60346
|
+
output += percentEncodeNonAscii(65533);
|
|
60347
|
+
}
|
|
60348
|
+
}
|
|
60349
|
+
}
|
|
60350
|
+
return output;
|
|
60351
|
+
}
|
|
60352
|
+
function encodeComponent(input, isAllowed) {
|
|
60353
|
+
let output = "";
|
|
60354
|
+
for (let i10 = 0; i10 < input.length; i10++) {
|
|
60355
|
+
const ch3 = input[i10];
|
|
60356
|
+
if (ch3 === "%" && i10 + 2 < input.length) {
|
|
60357
|
+
const hex3 = input.slice(i10 + 1, i10 + 3);
|
|
60358
|
+
if (isHexPair(hex3)) {
|
|
60359
|
+
output += "%" + hex3.toUpperCase();
|
|
60360
|
+
i10 += 2;
|
|
60361
|
+
continue;
|
|
60362
|
+
}
|
|
60363
|
+
}
|
|
60364
|
+
if (isAllowed(ch3)) {
|
|
60365
|
+
output += ch3;
|
|
60258
60366
|
} else {
|
|
60259
|
-
|
|
60367
|
+
const code = input.charCodeAt(i10);
|
|
60368
|
+
if (code < 128) {
|
|
60369
|
+
output += BYTE_HEX[code];
|
|
60370
|
+
} else if (code < 55296 || code > 57343) {
|
|
60371
|
+
output += percentEncodeNonAscii(code);
|
|
60372
|
+
} else if (code <= 56319 && i10 + 1 < input.length) {
|
|
60373
|
+
const low = input.charCodeAt(i10 + 1);
|
|
60374
|
+
if (low >= 56320 && low <= 57343) {
|
|
60375
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
60376
|
+
i10++;
|
|
60377
|
+
} else {
|
|
60378
|
+
output += percentEncodeNonAscii(65533);
|
|
60379
|
+
}
|
|
60380
|
+
} else {
|
|
60381
|
+
output += percentEncodeNonAscii(65533);
|
|
60382
|
+
}
|
|
60383
|
+
}
|
|
60384
|
+
}
|
|
60385
|
+
return output;
|
|
60386
|
+
}
|
|
60387
|
+
function encodeUserinfo(input) {
|
|
60388
|
+
return encodeComponent(input, isUserinfoCharacter);
|
|
60389
|
+
}
|
|
60390
|
+
function encodeQuery(input) {
|
|
60391
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
60392
|
+
}
|
|
60393
|
+
function encodeFragment(input) {
|
|
60394
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
60395
|
+
}
|
|
60396
|
+
function isEscapeSafe(cp2) {
|
|
60397
|
+
return cp2 >= 48 && cp2 <= 57 || cp2 >= 65 && cp2 <= 90 || cp2 >= 97 && cp2 <= 122 || cp2 === 42 || cp2 === 43 || cp2 === 45 || cp2 === 46 || cp2 === 47 || cp2 === 64 || cp2 === 95;
|
|
60398
|
+
}
|
|
60399
|
+
function normalizeQueryFragmentEncoding(input) {
|
|
60400
|
+
let output = "";
|
|
60401
|
+
for (let i10 = 0; i10 < input.length; i10++) {
|
|
60402
|
+
const ch3 = input[i10];
|
|
60403
|
+
if (ch3 === "%" && i10 + 2 < input.length) {
|
|
60404
|
+
const hex3 = input.slice(i10 + 1, i10 + 3);
|
|
60405
|
+
if (isHexPair(hex3)) {
|
|
60406
|
+
const normalizedHex = hex3.toUpperCase();
|
|
60407
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
60408
|
+
if (isUnreserved(decoded)) {
|
|
60409
|
+
output += decoded;
|
|
60410
|
+
} else {
|
|
60411
|
+
output += "%" + normalizedHex;
|
|
60412
|
+
}
|
|
60413
|
+
i10 += 2;
|
|
60414
|
+
continue;
|
|
60415
|
+
}
|
|
60416
|
+
}
|
|
60417
|
+
if (isQueryFragmentCharacter(ch3)) {
|
|
60418
|
+
output += ch3;
|
|
60419
|
+
} else {
|
|
60420
|
+
const code = input.charCodeAt(i10);
|
|
60421
|
+
if (code < 128) {
|
|
60422
|
+
output += isEscapeSafe(code) ? ch3 : BYTE_HEX[code];
|
|
60423
|
+
} else if (code < 55296 || code > 57343) {
|
|
60424
|
+
output += percentEncodeNonAscii(code);
|
|
60425
|
+
} else if (code <= 56319 && i10 + 1 < input.length) {
|
|
60426
|
+
const low = input.charCodeAt(i10 + 1);
|
|
60427
|
+
if (low >= 56320 && low <= 57343) {
|
|
60428
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
60429
|
+
i10++;
|
|
60430
|
+
} else {
|
|
60431
|
+
output += percentEncodeNonAscii(65533);
|
|
60432
|
+
}
|
|
60433
|
+
} else {
|
|
60434
|
+
output += percentEncodeNonAscii(65533);
|
|
60435
|
+
}
|
|
60260
60436
|
}
|
|
60261
60437
|
}
|
|
60262
60438
|
return output;
|
|
@@ -60279,14 +60455,18 @@ var require_utils = __commonJS({
|
|
|
60279
60455
|
function recomposeAuthority(component) {
|
|
60280
60456
|
const uriTokens = [];
|
|
60281
60457
|
if (component.userinfo !== void 0) {
|
|
60282
|
-
uriTokens.push(component.userinfo);
|
|
60458
|
+
uriTokens.push(encodeUserinfo(component.userinfo));
|
|
60283
60459
|
uriTokens.push("@");
|
|
60284
60460
|
}
|
|
60285
60461
|
if (component.host !== void 0) {
|
|
60286
|
-
let host =
|
|
60462
|
+
let host = component.host;
|
|
60287
60463
|
if (!isIPv4(host)) {
|
|
60288
|
-
|
|
60289
|
-
if (ipV6res.isIPV6
|
|
60464
|
+
let ipV6res = normalizeIPv6(host);
|
|
60465
|
+
if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
|
|
60466
|
+
host = normalizePercentEncoding(host, true);
|
|
60467
|
+
ipV6res = normalizeIPv6(host);
|
|
60468
|
+
}
|
|
60469
|
+
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
|
|
60290
60470
|
host = `[${ipV6res.escapedHost}]`;
|
|
60291
60471
|
} else {
|
|
60292
60472
|
host = reescapeHostDelimiters(host, false);
|
|
@@ -60295,8 +60475,12 @@ var require_utils = __commonJS({
|
|
|
60295
60475
|
uriTokens.push(host);
|
|
60296
60476
|
}
|
|
60297
60477
|
if (typeof component.port === "number" || typeof component.port === "string") {
|
|
60478
|
+
const port = String(component.port);
|
|
60479
|
+
if (!isPort(port)) {
|
|
60480
|
+
throw new TypeError("URI port is malformed.");
|
|
60481
|
+
}
|
|
60298
60482
|
uriTokens.push(":");
|
|
60299
|
-
uriTokens.push(
|
|
60483
|
+
uriTokens.push(port);
|
|
60300
60484
|
}
|
|
60301
60485
|
return uriTokens.length ? uriTokens.join("") : void 0;
|
|
60302
60486
|
}
|
|
@@ -60306,6 +60490,11 @@ var require_utils = __commonJS({
|
|
|
60306
60490
|
reescapeHostDelimiters,
|
|
60307
60491
|
normalizePercentEncoding,
|
|
60308
60492
|
normalizePathEncoding,
|
|
60493
|
+
serializePathEncoding,
|
|
60494
|
+
normalizeQueryFragmentEncoding,
|
|
60495
|
+
encodeUserinfo,
|
|
60496
|
+
encodeQuery,
|
|
60497
|
+
encodeFragment,
|
|
60309
60498
|
escapePreservingEscapes,
|
|
60310
60499
|
removeDotSegments,
|
|
60311
60500
|
isIPv4,
|
|
@@ -60321,7 +60510,7 @@ var require_schemes = __commonJS({
|
|
|
60321
60510
|
"../../node_modules/fast-uri/lib/schemes.js"(exports, module2) {
|
|
60322
60511
|
"use strict";
|
|
60323
60512
|
var { isUUID } = require_utils();
|
|
60324
|
-
var URN_REG =
|
|
60513
|
+
var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
|
|
60325
60514
|
var supportedSchemeNames = (
|
|
60326
60515
|
/** @type {const} */
|
|
60327
60516
|
[
|
|
@@ -60382,9 +60571,10 @@ var require_schemes = __commonJS({
|
|
|
60382
60571
|
wsComponent.secure = void 0;
|
|
60383
60572
|
}
|
|
60384
60573
|
if (wsComponent.resourceName) {
|
|
60385
|
-
const
|
|
60574
|
+
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
60575
|
+
const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
60386
60576
|
wsComponent.path = path && path !== "/" ? path : void 0;
|
|
60387
|
-
wsComponent.query =
|
|
60577
|
+
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
60388
60578
|
wsComponent.resourceName = void 0;
|
|
60389
60579
|
}
|
|
60390
60580
|
wsComponent.fragment = void 0;
|
|
@@ -60396,7 +60586,7 @@ var require_schemes = __commonJS({
|
|
|
60396
60586
|
return urnComponent;
|
|
60397
60587
|
}
|
|
60398
60588
|
const matches = urnComponent.path.match(URN_REG);
|
|
60399
|
-
if (matches) {
|
|
60589
|
+
if (matches && matches[0] === urnComponent.path) {
|
|
60400
60590
|
const scheme = options.scheme || urnComponent.scheme || "urn";
|
|
60401
60591
|
urnComponent.nid = matches[1].toLowerCase();
|
|
60402
60592
|
urnComponent.nss = matches[2];
|
|
@@ -60530,8 +60720,17 @@ var require_schemes = __commonJS({
|
|
|
60530
60720
|
var require_fast_uri = __commonJS({
|
|
60531
60721
|
"../../node_modules/fast-uri/index.js"(exports, module2) {
|
|
60532
60722
|
"use strict";
|
|
60533
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding,
|
|
60723
|
+
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
60534
60724
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
60725
|
+
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
60726
|
+
var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
60727
|
+
function decodeValidScheme(scheme) {
|
|
60728
|
+
const decodedScheme = unescape(String(scheme));
|
|
60729
|
+
if (!VALID_SCHEME.test(decodedScheme)) {
|
|
60730
|
+
throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
60731
|
+
}
|
|
60732
|
+
return decodedScheme;
|
|
60733
|
+
}
|
|
60535
60734
|
function normalize(uri, options) {
|
|
60536
60735
|
if (typeof uri === "string") {
|
|
60537
60736
|
uri = /** @type {T} */
|
|
@@ -60544,7 +60743,34 @@ var require_fast_uri = __commonJS({
|
|
|
60544
60743
|
}
|
|
60545
60744
|
function resolve(baseURI, relativeURI, options) {
|
|
60546
60745
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
60547
|
-
const
|
|
60746
|
+
const {
|
|
60747
|
+
parsed: baseParsed,
|
|
60748
|
+
malformedAuthorityOrPort: baseMalformed,
|
|
60749
|
+
malformedPercentEncoding: baseMalformedPercentEncoding,
|
|
60750
|
+
malformedSchemeSpecific: baseMalformedSchemeSpecific,
|
|
60751
|
+
malformedHost: baseMalformedHost,
|
|
60752
|
+
malformedScheme: baseMalformedScheme
|
|
60753
|
+
} = parseWithStatus(baseURI, schemelessOptions);
|
|
60754
|
+
const {
|
|
60755
|
+
parsed: relativeParsed,
|
|
60756
|
+
malformedAuthorityOrPort: relativeMalformed,
|
|
60757
|
+
malformedPercentEncoding: relativeMalformedPercentEncoding,
|
|
60758
|
+
malformedSchemeSpecific: relativeMalformedSchemeSpecific,
|
|
60759
|
+
malformedHost: relativeMalformedHost,
|
|
60760
|
+
malformedScheme: relativeMalformedScheme
|
|
60761
|
+
} = parseWithStatus(relativeURI, schemelessOptions);
|
|
60762
|
+
if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
|
|
60763
|
+
throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
60764
|
+
}
|
|
60765
|
+
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
60766
|
+
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
60767
|
+
const resolvedHost = resolved.host;
|
|
60768
|
+
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
60769
|
+
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
60770
|
+
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
|
|
60771
|
+
if (resolved.error && !encodedASCIIHost) {
|
|
60772
|
+
throw new Error(resolved.error);
|
|
60773
|
+
}
|
|
60548
60774
|
schemelessOptions.skipEscape = true;
|
|
60549
60775
|
return serialize(resolved, schemelessOptions);
|
|
60550
60776
|
}
|
|
@@ -60604,7 +60830,7 @@ var require_fast_uri = __commonJS({
|
|
|
60604
60830
|
function equal(uriA, uriB, options) {
|
|
60605
60831
|
const normalizedA = normalizeComparableURI(uriA, options);
|
|
60606
60832
|
const normalizedB = normalizeComparableURI(uriB, options);
|
|
60607
|
-
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA
|
|
60833
|
+
return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
|
|
60608
60834
|
}
|
|
60609
60835
|
function serialize(cmpts, opts) {
|
|
60610
60836
|
const component = {
|
|
@@ -60625,19 +60851,22 @@ var require_fast_uri = __commonJS({
|
|
|
60625
60851
|
};
|
|
60626
60852
|
const options = Object.assign({}, opts);
|
|
60627
60853
|
const uriTokens = [];
|
|
60854
|
+
if (component.scheme) {
|
|
60855
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
60856
|
+
}
|
|
60628
60857
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
60629
60858
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
|
|
60859
|
+
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
60860
|
+
const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
|
|
60630
60861
|
if (component.path !== void 0) {
|
|
60631
60862
|
if (!options.skipEscape) {
|
|
60632
|
-
component.path =
|
|
60633
|
-
if (component.scheme !== void 0) {
|
|
60634
|
-
component.path = component.path.split("%3A").join(":");
|
|
60635
|
-
}
|
|
60863
|
+
component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
60636
60864
|
} else {
|
|
60637
60865
|
component.path = normalizePercentEncoding(component.path);
|
|
60638
60866
|
}
|
|
60639
60867
|
}
|
|
60640
60868
|
if (options.reference !== "suffix" && component.scheme) {
|
|
60869
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
60641
60870
|
uriTokens.push(component.scheme, ":");
|
|
60642
60871
|
}
|
|
60643
60872
|
const authority = recomposeAuthority(component);
|
|
@@ -60655,20 +60884,25 @@ var require_fast_uri = __commonJS({
|
|
|
60655
60884
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
60656
60885
|
s10 = removeDotSegments(s10);
|
|
60657
60886
|
}
|
|
60887
|
+
if (pathNoScheme) {
|
|
60888
|
+
s10 = serializePathEncoding(s10, true);
|
|
60889
|
+
}
|
|
60658
60890
|
if (authority === void 0 && s10[0] === "/" && s10[1] === "/") {
|
|
60659
60891
|
s10 = "/%2F" + s10.slice(2);
|
|
60660
60892
|
}
|
|
60661
60893
|
uriTokens.push(s10);
|
|
60662
60894
|
}
|
|
60663
60895
|
if (component.query !== void 0) {
|
|
60664
|
-
uriTokens.push("?", component.query);
|
|
60896
|
+
uriTokens.push("?", encodeQuery(component.query));
|
|
60665
60897
|
}
|
|
60666
60898
|
if (component.fragment !== void 0) {
|
|
60667
|
-
uriTokens.push("#", component.fragment);
|
|
60899
|
+
uriTokens.push("#", encodeFragment(component.fragment));
|
|
60668
60900
|
}
|
|
60669
60901
|
return uriTokens.join("");
|
|
60670
60902
|
}
|
|
60671
60903
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
60904
|
+
var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
|
|
60905
|
+
var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
|
|
60672
60906
|
function getParseError(parsed, matches) {
|
|
60673
60907
|
if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
|
|
60674
60908
|
return 'URI path must start with "/" when authority is present.';
|
|
@@ -60678,6 +60912,35 @@ var require_fast_uri = __commonJS({
|
|
|
60678
60912
|
}
|
|
60679
60913
|
return void 0;
|
|
60680
60914
|
}
|
|
60915
|
+
function hasMalformedPercentEncoding(component) {
|
|
60916
|
+
if (component === void 0) return false;
|
|
60917
|
+
let percent = component.indexOf("%");
|
|
60918
|
+
while (percent !== -1) {
|
|
60919
|
+
if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
|
|
60920
|
+
return true;
|
|
60921
|
+
}
|
|
60922
|
+
percent = component.indexOf("%", percent + 3);
|
|
60923
|
+
}
|
|
60924
|
+
return false;
|
|
60925
|
+
}
|
|
60926
|
+
function isIPLiteral(host) {
|
|
60927
|
+
return host[0] === "[" && host[host.length - 1] === "]";
|
|
60928
|
+
}
|
|
60929
|
+
function hasMalformedComponentPercentEncoding(matches) {
|
|
60930
|
+
const host = matches[4];
|
|
60931
|
+
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
60932
|
+
}
|
|
60933
|
+
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
60934
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
60935
|
+
try {
|
|
60936
|
+
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
60937
|
+
} catch (e10) {
|
|
60938
|
+
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e10;
|
|
60939
|
+
return true;
|
|
60940
|
+
}
|
|
60941
|
+
}
|
|
60942
|
+
return false;
|
|
60943
|
+
}
|
|
60681
60944
|
function parseWithStatus(uri, opts) {
|
|
60682
60945
|
const options = Object.assign({}, opts);
|
|
60683
60946
|
const parsed = {
|
|
@@ -60690,6 +60953,11 @@ var require_fast_uri = __commonJS({
|
|
|
60690
60953
|
fragment: void 0
|
|
60691
60954
|
};
|
|
60692
60955
|
let malformedAuthorityOrPort = false;
|
|
60956
|
+
let malformedPercentEncoding = false;
|
|
60957
|
+
let malformedSchemeSpecific = false;
|
|
60958
|
+
let malformedHost = false;
|
|
60959
|
+
let malformedIPLiteral = false;
|
|
60960
|
+
let malformedScheme = false;
|
|
60693
60961
|
let isIP = false;
|
|
60694
60962
|
if (options.reference === "suffix") {
|
|
60695
60963
|
if (options.scheme) {
|
|
@@ -60698,6 +60966,25 @@ var require_fast_uri = __commonJS({
|
|
|
60698
60966
|
uri = "//" + uri;
|
|
60699
60967
|
}
|
|
60700
60968
|
}
|
|
60969
|
+
const authorityMatch = uri.match(AUTHORITY_PREFIX);
|
|
60970
|
+
if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
|
|
60971
|
+
parsed.error = "URI authority must not contain a literal backslash.";
|
|
60972
|
+
malformedAuthorityOrPort = true;
|
|
60973
|
+
}
|
|
60974
|
+
const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
|
|
60975
|
+
if (introducerMatch !== null) {
|
|
60976
|
+
const region = introducerMatch[1];
|
|
60977
|
+
const normalizedRegion = region.replace(/[\t\n\r]/g, "");
|
|
60978
|
+
if (normalizedRegion.length >= 2) {
|
|
60979
|
+
if (normalizedRegion.slice(0, 2) !== "//") {
|
|
60980
|
+
parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
|
|
60981
|
+
malformedAuthorityOrPort = true;
|
|
60982
|
+
} else if (region.length !== normalizedRegion.length) {
|
|
60983
|
+
parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
|
|
60984
|
+
malformedAuthorityOrPort = true;
|
|
60985
|
+
}
|
|
60986
|
+
}
|
|
60987
|
+
}
|
|
60701
60988
|
const matches = uri.match(URI_PARSE);
|
|
60702
60989
|
if (matches) {
|
|
60703
60990
|
parsed.scheme = matches[1];
|
|
@@ -60707,6 +60994,19 @@ var require_fast_uri = __commonJS({
|
|
|
60707
60994
|
parsed.path = matches[6] || "";
|
|
60708
60995
|
parsed.query = matches[7];
|
|
60709
60996
|
parsed.fragment = matches[8];
|
|
60997
|
+
if (parsed.scheme !== void 0) {
|
|
60998
|
+
const decodedScheme = unescape(parsed.scheme);
|
|
60999
|
+
if (VALID_SCHEME.test(decodedScheme)) {
|
|
61000
|
+
parsed.scheme = decodedScheme.toLowerCase();
|
|
61001
|
+
} else {
|
|
61002
|
+
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
|
|
61003
|
+
malformedScheme = true;
|
|
61004
|
+
}
|
|
61005
|
+
}
|
|
61006
|
+
malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
|
|
61007
|
+
if (malformedPercentEncoding) {
|
|
61008
|
+
parsed.error = parsed.error || "URI contains malformed percent-encoding.";
|
|
61009
|
+
}
|
|
60710
61010
|
if (isNaN(parsed.port)) {
|
|
60711
61011
|
parsed.port = matches[5];
|
|
60712
61012
|
}
|
|
@@ -60718,9 +61018,16 @@ var require_fast_uri = __commonJS({
|
|
|
60718
61018
|
if (parsed.host) {
|
|
60719
61019
|
const ipv4result = isIPv4(parsed.host);
|
|
60720
61020
|
if (ipv4result === false) {
|
|
61021
|
+
const bracketedIPLiteral = isIPLiteral(parsed.host);
|
|
61022
|
+
const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
|
|
60721
61023
|
const ipv6result = normalizeIPv6(parsed.host);
|
|
60722
|
-
|
|
60723
|
-
|
|
61024
|
+
isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
|
|
61025
|
+
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
61026
|
+
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
61027
|
+
if (malformedIPLiteral) {
|
|
61028
|
+
parsed.error = parsed.error || "URI host is malformed.";
|
|
61029
|
+
malformedAuthorityOrPort = true;
|
|
61030
|
+
}
|
|
60724
61031
|
} else {
|
|
60725
61032
|
isIP = true;
|
|
60726
61033
|
}
|
|
@@ -60738,42 +61045,37 @@ var require_fast_uri = __commonJS({
|
|
|
60738
61045
|
parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
|
|
60739
61046
|
}
|
|
60740
61047
|
const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
|
|
60741
|
-
if (!
|
|
60742
|
-
|
|
60743
|
-
|
|
60744
|
-
|
|
60745
|
-
|
|
60746
|
-
|
|
60747
|
-
|
|
61048
|
+
if (!malformedIPLiteral) {
|
|
61049
|
+
malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
|
|
61050
|
+
}
|
|
61051
|
+
if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
|
|
61052
|
+
let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
|
|
61053
|
+
if (!isIP) {
|
|
61054
|
+
host = normalizePercentEncoding(host.toLowerCase());
|
|
60748
61055
|
}
|
|
61056
|
+
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
60749
61057
|
}
|
|
60750
61058
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
60751
|
-
if (uri.indexOf("%") !== -1) {
|
|
60752
|
-
if (parsed.scheme !== void 0) {
|
|
60753
|
-
parsed.scheme = unescape(parsed.scheme);
|
|
60754
|
-
}
|
|
60755
|
-
if (parsed.host !== void 0) {
|
|
60756
|
-
parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
|
|
60757
|
-
}
|
|
60758
|
-
}
|
|
60759
61059
|
if (parsed.path) {
|
|
60760
61060
|
parsed.path = normalizePathEncoding(parsed.path);
|
|
60761
61061
|
}
|
|
61062
|
+
if (parsed.query) {
|
|
61063
|
+
parsed.query = normalizeQueryFragmentEncoding(parsed.query);
|
|
61064
|
+
}
|
|
60762
61065
|
if (parsed.fragment) {
|
|
60763
|
-
|
|
60764
|
-
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
|
|
60765
|
-
} catch {
|
|
60766
|
-
parsed.error = parsed.error || "URI malformed";
|
|
60767
|
-
}
|
|
61066
|
+
parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
|
|
60768
61067
|
}
|
|
60769
61068
|
}
|
|
60770
61069
|
if (schemeHandler && schemeHandler.parse) {
|
|
60771
61070
|
schemeHandler.parse(parsed, options);
|
|
61071
|
+
if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) {
|
|
61072
|
+
malformedSchemeSpecific = true;
|
|
61073
|
+
}
|
|
60772
61074
|
}
|
|
60773
61075
|
} else {
|
|
60774
61076
|
parsed.error = parsed.error || "URI can not be parsed.";
|
|
60775
61077
|
}
|
|
60776
|
-
return { parsed, malformedAuthorityOrPort };
|
|
61078
|
+
return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
|
|
60777
61079
|
}
|
|
60778
61080
|
function parse3(uri, opts) {
|
|
60779
61081
|
return parseWithStatus(uri, opts).parsed;
|
|
@@ -60782,20 +61084,28 @@ var require_fast_uri = __commonJS({
|
|
|
60782
61084
|
return normalizeStringWithStatus(uri, opts).normalized;
|
|
60783
61085
|
}
|
|
60784
61086
|
function normalizeStringWithStatus(uri, opts) {
|
|
60785
|
-
const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
61087
|
+
const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
60786
61088
|
return {
|
|
60787
|
-
normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
|
|
60788
|
-
malformedAuthorityOrPort
|
|
61089
|
+
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
|
|
61090
|
+
malformedAuthorityOrPort,
|
|
61091
|
+
malformedPercentEncoding,
|
|
61092
|
+
malformedSchemeSpecific,
|
|
61093
|
+
malformedHost,
|
|
61094
|
+
malformedScheme
|
|
60789
61095
|
};
|
|
60790
61096
|
}
|
|
60791
61097
|
function normalizeComparableURI(uri, opts) {
|
|
60792
|
-
if (typeof uri
|
|
60793
|
-
|
|
60794
|
-
return malformedAuthorityOrPort ? void 0 : normalized;
|
|
61098
|
+
if (typeof uri !== "string" && typeof uri !== "object") {
|
|
61099
|
+
return void 0;
|
|
60795
61100
|
}
|
|
60796
|
-
|
|
60797
|
-
|
|
61101
|
+
let value;
|
|
61102
|
+
try {
|
|
61103
|
+
value = typeof uri === "string" ? uri : serialize(uri, opts);
|
|
61104
|
+
} catch {
|
|
61105
|
+
return void 0;
|
|
60798
61106
|
}
|
|
61107
|
+
const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
|
|
61108
|
+
return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
|
|
60799
61109
|
}
|
|
60800
61110
|
var fastUri = {
|
|
60801
61111
|
SCHEMES,
|
|
@@ -90109,24 +90419,24 @@ var hebNutrition = {
|
|
|
90109
90419
|
if (["high", "medium", "low"].includes(String(n10.confidence))) {
|
|
90110
90420
|
item.confidence = n10.confidence;
|
|
90111
90421
|
}
|
|
90112
|
-
for (const
|
|
90113
|
-
if (n10[
|
|
90114
|
-
item[
|
|
90422
|
+
for (const field2 of hebNutritionFields.slice(4, 19)) {
|
|
90423
|
+
if (n10[field2] === null || typeof n10[field2] === "number") {
|
|
90424
|
+
item[field2] = n10[field2];
|
|
90115
90425
|
}
|
|
90116
90426
|
}
|
|
90117
90427
|
if (n10.serving_size === null || typeof n10.serving_size === "string")
|
|
90118
90428
|
item.servingSize = n10.serving_size;
|
|
90119
90429
|
if (n10.servings_per_container === null || typeof n10.servings_per_container === "string")
|
|
90120
90430
|
item.servingsPerContainer = n10.servings_per_container;
|
|
90121
|
-
for (const
|
|
90431
|
+
for (const field2 of [
|
|
90122
90432
|
"upc",
|
|
90123
90433
|
"ingredients",
|
|
90124
90434
|
"allergens",
|
|
90125
90435
|
"category",
|
|
90126
90436
|
"highlights"
|
|
90127
90437
|
]) {
|
|
90128
|
-
if (n10[
|
|
90129
|
-
item[
|
|
90438
|
+
if (n10[field2] !== void 0)
|
|
90439
|
+
item[field2] = n10[field2];
|
|
90130
90440
|
}
|
|
90131
90441
|
const paddedProductId = n10.product_id.padStart(9, "0");
|
|
90132
90442
|
item.images = {
|
|
@@ -90580,7 +90890,7 @@ var wholefoodsNutrition = {
|
|
|
90580
90890
|
if (["high", "medium", "low"].includes(String(n10.confidence))) {
|
|
90581
90891
|
item.confidence = n10.confidence;
|
|
90582
90892
|
}
|
|
90583
|
-
for (const
|
|
90893
|
+
for (const field2 of [
|
|
90584
90894
|
"calories",
|
|
90585
90895
|
"protein_g",
|
|
90586
90896
|
"carbs_g",
|
|
@@ -90589,8 +90899,8 @@ var wholefoodsNutrition = {
|
|
|
90589
90899
|
"fiber_g",
|
|
90590
90900
|
"sugar_g"
|
|
90591
90901
|
]) {
|
|
90592
|
-
if (n10[
|
|
90593
|
-
item[
|
|
90902
|
+
if (n10[field2] === null || typeof n10[field2] === "number") {
|
|
90903
|
+
item[field2] = n10[field2];
|
|
90594
90904
|
}
|
|
90595
90905
|
}
|
|
90596
90906
|
if (n10.serving_size === null || typeof n10.serving_size === "string")
|
|
@@ -90721,8 +91031,8 @@ var icloudNotes = {
|
|
|
90721
91031
|
const notes = byStream(records, "notes").map((note) => {
|
|
90722
91032
|
if (typeof note.id !== "string" || note.id.length === 0)
|
|
90723
91033
|
return void 0;
|
|
90724
|
-
const optionalString = (
|
|
90725
|
-
const value = note[
|
|
91034
|
+
const optionalString = (field2) => {
|
|
91035
|
+
const value = note[field2];
|
|
90726
91036
|
return value == null || typeof value === "string" ? value ?? null : void 0;
|
|
90727
91037
|
};
|
|
90728
91038
|
const title = optionalString("title");
|
|
@@ -90899,22 +91209,22 @@ function browserBinding(stream) {
|
|
|
90899
91209
|
}
|
|
90900
91210
|
};
|
|
90901
91211
|
}
|
|
90902
|
-
for (const
|
|
90903
|
-
if (snapshot[
|
|
91212
|
+
for (const field2 of requiredByStream[stream]) {
|
|
91213
|
+
if (snapshot[field2] === void 0 || snapshot[field2] === null) {
|
|
90904
91214
|
return {
|
|
90905
91215
|
ok: false,
|
|
90906
91216
|
error: {
|
|
90907
91217
|
kind: "incomplete_scope",
|
|
90908
91218
|
scope,
|
|
90909
|
-
reason: `${stream}.${
|
|
91219
|
+
reason: `${stream}.${field2} is unavailable`
|
|
90910
91220
|
}
|
|
90911
91221
|
};
|
|
90912
91222
|
}
|
|
90913
91223
|
}
|
|
90914
91224
|
const payload = {};
|
|
90915
|
-
for (const
|
|
90916
|
-
if (Object.hasOwn(snapshot,
|
|
90917
|
-
payload[
|
|
91225
|
+
for (const field2 of fields) {
|
|
91226
|
+
if (Object.hasOwn(snapshot, field2))
|
|
91227
|
+
payload[field2] = snapshot[field2];
|
|
90918
91228
|
}
|
|
90919
91229
|
if (stream === "events" && Object.hasOwn(payload, "windowDescription")) {
|
|
90920
91230
|
payload.windowDescription = legacyEventsWindowDescription;
|
|
@@ -91211,7 +91521,7 @@ function inPrimaryKeyOrder(records, primaryKey) {
|
|
|
91211
91521
|
const keyOf = (record2) => {
|
|
91212
91522
|
const data = record2.data;
|
|
91213
91523
|
const fields = primaryKey[record2.stream] ?? [];
|
|
91214
|
-
return JSON.stringify(fields.map((
|
|
91524
|
+
return JSON.stringify(fields.map((field2) => data && typeof data === "object" ? data[field2] ?? null : null));
|
|
91215
91525
|
};
|
|
91216
91526
|
return records.map((record2, index) => ({ record: record2, index, key: keyOf(record2) })).sort((a10, b10) => {
|
|
91217
91527
|
if (a10.record.stream !== b10.record.stream)
|
|
@@ -91788,14 +92098,14 @@ function malformedCursor(message) {
|
|
|
91788
92098
|
}
|
|
91789
92099
|
};
|
|
91790
92100
|
}
|
|
91791
|
-
function assertNonEmptyString(value,
|
|
92101
|
+
function assertNonEmptyString(value, field2) {
|
|
91792
92102
|
if (value.length === 0) {
|
|
91793
|
-
throw new Error(`${
|
|
92103
|
+
throw new Error(`${field2} must be a non-empty string`);
|
|
91794
92104
|
}
|
|
91795
92105
|
}
|
|
91796
|
-
function assertNonNegativeInteger(value,
|
|
92106
|
+
function assertNonNegativeInteger(value, field2) {
|
|
91797
92107
|
if (!isNonNegativeInteger(value)) {
|
|
91798
|
-
throw new Error(`${
|
|
92108
|
+
throw new Error(`${field2} must be a non-negative integer`);
|
|
91799
92109
|
}
|
|
91800
92110
|
}
|
|
91801
92111
|
function isNonNegativeInteger(value) {
|
|
@@ -92257,6 +92567,7 @@ function classifyStoredBody(scope, data) {
|
|
|
92257
92567
|
return isProjectedScope(scope) && !data.records.some(isTaggedRecord) ? "pdpp-projected" : "pdpp-unprojected";
|
|
92258
92568
|
}
|
|
92259
92569
|
var SERVED = /* @__PURE__ */ Symbol.for("personal-server-ts.legacy-projection.served");
|
|
92570
|
+
var PROJECTED_VIEW = /* @__PURE__ */ Symbol.for("personal-server-ts.legacy-projection.projected-view");
|
|
92260
92571
|
var textEncoder5 = new TextEncoder();
|
|
92261
92572
|
var FORM_CACHE_SIZE = 64;
|
|
92262
92573
|
function withLegacyProjection(raw, options = {}) {
|
|
@@ -92361,7 +92672,8 @@ function withLegacyProjection(raw, options = {}) {
|
|
|
92361
92672
|
const envelope = { ...own, data: result.payload };
|
|
92362
92673
|
return {
|
|
92363
92674
|
envelope,
|
|
92364
|
-
bytes: textEncoder5.encode(JSON.stringify(envelope))
|
|
92675
|
+
bytes: textEncoder5.encode(JSON.stringify(envelope)),
|
|
92676
|
+
...result.diagnostics?.length ? { diagnostics: result.diagnostics } : {}
|
|
92365
92677
|
};
|
|
92366
92678
|
}
|
|
92367
92679
|
async function builtBlocks(scope, view) {
|
|
@@ -92375,6 +92687,7 @@ function withLegacyProjection(raw, options = {}) {
|
|
|
92375
92687
|
}
|
|
92376
92688
|
const overrides = {
|
|
92377
92689
|
[SERVED]: true,
|
|
92690
|
+
[PROJECTED_VIEW]: projected,
|
|
92378
92691
|
async readEnvelope(scope, collectedAt) {
|
|
92379
92692
|
const { view, own } = await resolve(scope, collectedAt);
|
|
92380
92693
|
return view?.envelope ?? own ?? raw.readEnvelope(scope, collectedAt);
|
|
@@ -92512,6 +92825,128 @@ function isRecordsBody(data) {
|
|
|
92512
92825
|
const keys = Object.keys(data).filter((key) => !SERVER_STAMP_KEYS.has(key));
|
|
92513
92826
|
return keys.length === 1 && keys[0] === "records" && Array.isArray(data.records);
|
|
92514
92827
|
}
|
|
92828
|
+
async function supersedeLegacyVersions(storage, scope, committedAt) {
|
|
92829
|
+
const refuse = (refused) => ({
|
|
92830
|
+
superseded: [],
|
|
92831
|
+
refused
|
|
92832
|
+
});
|
|
92833
|
+
const readStored = (storage.readStoredEnvelope ?? storage.readEnvelope).bind(storage);
|
|
92834
|
+
const committed = await readStored(scope, committedAt);
|
|
92835
|
+
if (classifyStoredBody(scope, committed.data) !== "pdpp-projected") {
|
|
92836
|
+
return refuse("the new version is not PDPP records of a projected scope");
|
|
92837
|
+
}
|
|
92838
|
+
const projectedView = storage[PROJECTED_VIEW];
|
|
92839
|
+
const view = projectedView ? await projectedView(scope, committedAt) : null;
|
|
92840
|
+
if (!view)
|
|
92841
|
+
return refuse("the new version cannot be projected");
|
|
92842
|
+
if (view.diagnostics?.length) {
|
|
92843
|
+
const kinds = [...new Set(view.diagnostics.map((d10) => d10.kind))];
|
|
92844
|
+
return refuse(`the projection is partial (${kinds.join(", ")})`);
|
|
92845
|
+
}
|
|
92846
|
+
const collection = legacyCollectionKey(scope);
|
|
92847
|
+
const projectedItems = view.envelope.data[collection];
|
|
92848
|
+
const projectedCount = projectedItems.length;
|
|
92849
|
+
const committedMs = Date.parse(committedAt);
|
|
92850
|
+
const older = [];
|
|
92851
|
+
const pageSize = 100;
|
|
92852
|
+
for (let offset = 0; ; offset += pageSize) {
|
|
92853
|
+
const page = storage.listVersions(scope, { limit: pageSize, offset });
|
|
92854
|
+
for (const entry of page) {
|
|
92855
|
+
if (Date.parse(entry.collectedAt) < committedMs) {
|
|
92856
|
+
older.push(entry.collectedAt);
|
|
92857
|
+
}
|
|
92858
|
+
}
|
|
92859
|
+
if (page.length < pageSize)
|
|
92860
|
+
break;
|
|
92861
|
+
}
|
|
92862
|
+
const legacy = [];
|
|
92863
|
+
for (const collectedAt of older) {
|
|
92864
|
+
const envelope = await readStored(scope, collectedAt);
|
|
92865
|
+
if (isBinaryEnvelope(envelope))
|
|
92866
|
+
continue;
|
|
92867
|
+
const items = legacyCollection(scope, envelope.data);
|
|
92868
|
+
if (items === null)
|
|
92869
|
+
continue;
|
|
92870
|
+
legacy.push({
|
|
92871
|
+
collectedAt,
|
|
92872
|
+
count: items.length,
|
|
92873
|
+
ids: items.map(itemId).filter((id2) => id2 !== void 0),
|
|
92874
|
+
items
|
|
92875
|
+
});
|
|
92876
|
+
}
|
|
92877
|
+
const newest = legacy.reduce((best, version4) => !best || Date.parse(version4.collectedAt) > Date.parse(best.collectedAt) ? version4 : best, void 0);
|
|
92878
|
+
if (newest && projectedCount < newest.count) {
|
|
92879
|
+
return refuse(`the projection has ${projectedCount} ${collection}; the newest legacy version has ${newest.count}`);
|
|
92880
|
+
}
|
|
92881
|
+
if (newest) {
|
|
92882
|
+
const projectedIds = new Set(projectedItems.map(itemId).filter((id2) => id2 !== void 0));
|
|
92883
|
+
const missing = newest.ids.filter((id2) => !projectedIds.has(id2));
|
|
92884
|
+
if (missing.length > 0) {
|
|
92885
|
+
return refuse(`the projection lacks ${missing.length} of the ${collection} in the newest legacy version`);
|
|
92886
|
+
}
|
|
92887
|
+
const shortfall = nestedShortfall(scope, newest.items, projectedItems);
|
|
92888
|
+
if (shortfall)
|
|
92889
|
+
return refuse(shortfall);
|
|
92890
|
+
}
|
|
92891
|
+
const superseded = [];
|
|
92892
|
+
for (const { collectedAt } of legacy) {
|
|
92893
|
+
if (await storage.deleteVersion(scope, collectedAt)) {
|
|
92894
|
+
superseded.push(collectedAt);
|
|
92895
|
+
}
|
|
92896
|
+
}
|
|
92897
|
+
return { superseded };
|
|
92898
|
+
}
|
|
92899
|
+
var NESTED_ITEMS = {
|
|
92900
|
+
"claude.conversations": (item) => ({
|
|
92901
|
+
held: arrayLength(field(item, "messages")),
|
|
92902
|
+
selfShort: false
|
|
92903
|
+
}),
|
|
92904
|
+
"claude.projects": (item) => {
|
|
92905
|
+
const detail = field(item, "detail");
|
|
92906
|
+
const rawDocs = field(detail, "raw_docs");
|
|
92907
|
+
const raw = Array.isArray(rawDocs) ? rawDocs : [];
|
|
92908
|
+
const withId = raw.filter((doc) => typeof field(doc, "uuid") === "string");
|
|
92909
|
+
const docs = arrayLength(field(detail, "docs"));
|
|
92910
|
+
return {
|
|
92911
|
+
held: docs + raw.length - withId.length,
|
|
92912
|
+
selfShort: docs < withId.length
|
|
92913
|
+
};
|
|
92914
|
+
}
|
|
92915
|
+
};
|
|
92916
|
+
function field(value, key) {
|
|
92917
|
+
return value !== null && typeof value === "object" ? value[key] : void 0;
|
|
92918
|
+
}
|
|
92919
|
+
function arrayLength(value) {
|
|
92920
|
+
return Array.isArray(value) ? value.length : 0;
|
|
92921
|
+
}
|
|
92922
|
+
function nestedShortfall(scope, legacyItems, projectedItems) {
|
|
92923
|
+
const nested = NESTED_ITEMS[scope];
|
|
92924
|
+
if (!nested)
|
|
92925
|
+
return void 0;
|
|
92926
|
+
const projectedById = new Map(projectedItems.map((item) => [itemId(item), nested(item).held]));
|
|
92927
|
+
const short = legacyItems.filter((item) => (projectedById.get(itemId(item)) ?? 0) < nested(item).held);
|
|
92928
|
+
const incomplete = projectedItems.filter((item) => nested(item).selfShort);
|
|
92929
|
+
const count = short.length + incomplete.length;
|
|
92930
|
+
return count > 0 ? `the projection holds fewer nested rows than the source or the newest legacy version for ${count} of the ${legacyCollectionKey(scope)}` : void 0;
|
|
92931
|
+
}
|
|
92932
|
+
function legacyCollectionKey(scope) {
|
|
92933
|
+
return scope.slice(scope.indexOf(".") + 1);
|
|
92934
|
+
}
|
|
92935
|
+
function legacyCollection(scope, data) {
|
|
92936
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
92937
|
+
return null;
|
|
92938
|
+
}
|
|
92939
|
+
if (isRecordsBody(data) || "$writtenBy" in data)
|
|
92940
|
+
return null;
|
|
92941
|
+
const items = data[legacyCollectionKey(scope)];
|
|
92942
|
+
return Array.isArray(items) ? items : null;
|
|
92943
|
+
}
|
|
92944
|
+
function itemId(item) {
|
|
92945
|
+
if (item === null || typeof item !== "object")
|
|
92946
|
+
return void 0;
|
|
92947
|
+
const { id: id2, uuid: uuid3 } = item;
|
|
92948
|
+
return typeof id2 === "string" ? id2 : typeof uuid3 === "string" ? uuid3 : void 0;
|
|
92949
|
+
}
|
|
92515
92950
|
|
|
92516
92951
|
// ../../node_modules/viem/_esm/index.js
|
|
92517
92952
|
init_exports();
|
|
@@ -93400,12 +93835,12 @@ function hashStruct({ data, primaryType, types }) {
|
|
|
93400
93835
|
function encodeData({ data, primaryType, types }) {
|
|
93401
93836
|
const encodedTypes = [{ type: "bytes32" }];
|
|
93402
93837
|
const encodedValues = [hashType({ primaryType, types })];
|
|
93403
|
-
for (const
|
|
93838
|
+
for (const field2 of types[primaryType]) {
|
|
93404
93839
|
const [type, value] = encodeField({
|
|
93405
93840
|
types,
|
|
93406
|
-
name:
|
|
93407
|
-
type:
|
|
93408
|
-
value: data[
|
|
93841
|
+
name: field2.name,
|
|
93842
|
+
type: field2.type,
|
|
93843
|
+
value: data[field2.name]
|
|
93409
93844
|
});
|
|
93410
93845
|
encodedTypes.push(type);
|
|
93411
93846
|
encodedValues.push(value);
|
|
@@ -93433,8 +93868,8 @@ function findTypeDependencies({ primaryType: primaryType_, types }, results = /*
|
|
|
93433
93868
|
return results;
|
|
93434
93869
|
}
|
|
93435
93870
|
results.add(primaryType);
|
|
93436
|
-
for (const
|
|
93437
|
-
findTypeDependencies({ primaryType:
|
|
93871
|
+
for (const field2 of types[primaryType]) {
|
|
93872
|
+
findTypeDependencies({ primaryType: field2.type, types }, results);
|
|
93438
93873
|
}
|
|
93439
93874
|
return results;
|
|
93440
93875
|
}
|
|
@@ -97185,10 +97620,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
97185
97620
|
const shape = def.shape;
|
|
97186
97621
|
const propValues = {};
|
|
97187
97622
|
for (const key in shape) {
|
|
97188
|
-
const
|
|
97189
|
-
if (
|
|
97623
|
+
const field2 = shape[key]._zod;
|
|
97624
|
+
if (field2.values) {
|
|
97190
97625
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
97191
|
-
for (const v10 of
|
|
97626
|
+
for (const v10 of field2.values)
|
|
97192
97627
|
propValues[key].add(v10);
|
|
97193
97628
|
}
|
|
97194
97629
|
}
|
|
@@ -115112,6 +115547,25 @@ function encodePaymentResponseHeader(body) {
|
|
|
115112
115547
|
function contractResponse(result) {
|
|
115113
115548
|
return jsonResponse(result.body, { status: result.status });
|
|
115114
115549
|
}
|
|
115550
|
+
async function supersedeAfterCommit(deps, scope, committedAt) {
|
|
115551
|
+
try {
|
|
115552
|
+
const result = await supersedeLegacyVersions(deps.storage, scope, committedAt);
|
|
115553
|
+
if (result.superseded.length > 0) {
|
|
115554
|
+
deps.logger?.info?.({ scope, committedAt, superseded: result.superseded }, "Deleted legacy-form versions superseded by a PDPP write");
|
|
115555
|
+
}
|
|
115556
|
+
if (result.refused) {
|
|
115557
|
+
deps.logger?.info?.({ scope, committedAt, refused: result.refused }, "Kept legacy-form versions; superseding was refused");
|
|
115558
|
+
}
|
|
115559
|
+
return result;
|
|
115560
|
+
} catch (err2) {
|
|
115561
|
+
deps.logger?.warn?.({
|
|
115562
|
+
scope,
|
|
115563
|
+
committedAt,
|
|
115564
|
+
error: err2 instanceof Error ? err2.message : String(err2)
|
|
115565
|
+
}, "Superseding legacy-form versions failed; the write is stored");
|
|
115566
|
+
return { superseded: [], refused: "superseding failed" };
|
|
115567
|
+
}
|
|
115568
|
+
}
|
|
115115
115569
|
function contractErrorResponse(err2) {
|
|
115116
115570
|
return jsonResponse(err2.body, { status: err2.status });
|
|
115117
115571
|
}
|
|
@@ -115412,12 +115866,12 @@ function fireReadReport(deps, event, send) {
|
|
|
115412
115866
|
warnReadFulfillmentReporterFailed(deps, event, err2);
|
|
115413
115867
|
}
|
|
115414
115868
|
}
|
|
115415
|
-
async function prepareWriteLineage(deps, scope,
|
|
115416
|
-
if (
|
|
115869
|
+
async function prepareWriteLineage(deps, scope, field2) {
|
|
115870
|
+
if (field2 === void 0 || field2 === null)
|
|
115417
115871
|
return void 0;
|
|
115418
115872
|
return prepareLineage({
|
|
115419
115873
|
scope,
|
|
115420
|
-
field,
|
|
115874
|
+
field: field2,
|
|
115421
115875
|
serverOwner: deps.serverOwner,
|
|
115422
115876
|
storage: deps.storage,
|
|
115423
115877
|
gateway: deps.lineageGateway,
|
|
@@ -115730,6 +116184,15 @@ async function handlePersonalServerDataRequest(request2, deps, options = {}) {
|
|
|
115730
116184
|
} else {
|
|
115731
116185
|
await deps.auth.authorizeOwner(request2);
|
|
115732
116186
|
}
|
|
116187
|
+
const supersede = url2.searchParams.get("supersede");
|
|
116188
|
+
if (supersede !== null && supersede !== "legacy") {
|
|
116189
|
+
await writeAuth?.releaseProof?.();
|
|
116190
|
+
return errorResponse(400, "INVALID_SUPERSEDE", 'supersede must be "legacy" or absent');
|
|
116191
|
+
}
|
|
116192
|
+
if (supersede !== null && writeAuth) {
|
|
116193
|
+
await writeAuth.releaseProof?.();
|
|
116194
|
+
return errorResponse(403, "FORBIDDEN", "Only the owner can supersede stored versions");
|
|
116195
|
+
}
|
|
115733
116196
|
let committed = false;
|
|
115734
116197
|
let releaseStamp;
|
|
115735
116198
|
const failWrite = async (response) => {
|
|
@@ -115769,6 +116232,9 @@ async function handlePersonalServerDataRequest(request2, deps, options = {}) {
|
|
|
115769
116232
|
}
|
|
115770
116233
|
};
|
|
115771
116234
|
if (!isJsonContentType(request2)) {
|
|
116235
|
+
if (supersede !== null) {
|
|
116236
|
+
return failWrite(errorResponse(400, "INVALID_SUPERSEDE", "supersede applies to JSON writes only"));
|
|
116237
|
+
}
|
|
115772
116238
|
const bytes2 = new Uint8Array(await request2.arrayBuffer());
|
|
115773
116239
|
const metadata = parseMetadataHeader(request2.headers.get("x-vana-metadata"));
|
|
115774
116240
|
const lineage2 = await prepareWriteLineage(deps, scopeResult.scope, extractLineageField(metadata));
|
|
@@ -115829,13 +116295,18 @@ async function handlePersonalServerDataRequest(request2, deps, options = {}) {
|
|
|
115829
116295
|
...writeAuth ? { builder: writeAuth.builder } : {}
|
|
115830
116296
|
}, "Data file ingested");
|
|
115831
116297
|
await logBuilderWrite();
|
|
116298
|
+
const supersedeResult = supersede === "legacy" ? await supersedeAfterCommit(deps, scopeResult.scope, collectedAtValue) : void 0;
|
|
115832
116299
|
notifyNewData(deps.syncManager);
|
|
115833
116300
|
notifyDataWritten(deps, {
|
|
115834
116301
|
scope: scopeResult.scope,
|
|
115835
116302
|
collectedAt: collectedAtValue,
|
|
115836
116303
|
lineageSources: lineage?.sources
|
|
115837
116304
|
});
|
|
115838
|
-
return jsonResponse(
|
|
116305
|
+
return jsonResponse(supersedeResult ? {
|
|
116306
|
+
...result.response,
|
|
116307
|
+
superseded: supersedeResult.superseded,
|
|
116308
|
+
...supersedeResult.refused ? { supersedeRefused: supersedeResult.refused } : {}
|
|
116309
|
+
} : result.response, { status: 201 });
|
|
115839
116310
|
} catch (err2) {
|
|
115840
116311
|
if (err2 instanceof IngestPersistedError) {
|
|
115841
116312
|
deps.logger?.error?.({
|
|
@@ -117684,7 +118155,7 @@ function parseField(value, index) {
|
|
|
117684
118155
|
}
|
|
117685
118156
|
required2 = value.required;
|
|
117686
118157
|
}
|
|
117687
|
-
const
|
|
118158
|
+
const field2 = { name, type, required: required2 };
|
|
117688
118159
|
if (type === "string") {
|
|
117689
118160
|
let maxLength = MAX_ANSWER_STRING_CHARS;
|
|
117690
118161
|
if (value.maxLength !== void 0 && value.maxLength !== null) {
|
|
@@ -117693,26 +118164,26 @@ function parseField(value, index) {
|
|
|
117693
118164
|
}
|
|
117694
118165
|
maxLength = value.maxLength;
|
|
117695
118166
|
}
|
|
117696
|
-
|
|
118167
|
+
field2.maxLength = maxLength;
|
|
117697
118168
|
}
|
|
117698
118169
|
if (type === "number" || type === "integer") {
|
|
117699
118170
|
const integer2 = type === "integer";
|
|
117700
118171
|
if (value.min !== void 0 && value.min !== null) {
|
|
117701
|
-
|
|
118172
|
+
field2.min = parseBound(value.min, index, "min", integer2);
|
|
117702
118173
|
}
|
|
117703
118174
|
if (value.max !== void 0 && value.max !== null) {
|
|
117704
|
-
|
|
118175
|
+
field2.max = parseBound(value.max, index, "max", integer2);
|
|
117705
118176
|
}
|
|
117706
|
-
if (
|
|
118177
|
+
if (field2.min !== void 0 && field2.max !== void 0 && field2.min > field2.max) {
|
|
117707
118178
|
invalid(`answerShape.fields[${index}].min is greater than its max`, {
|
|
117708
118179
|
index
|
|
117709
118180
|
});
|
|
117710
118181
|
}
|
|
117711
118182
|
}
|
|
117712
118183
|
if (type === "enum") {
|
|
117713
|
-
|
|
118184
|
+
field2.values = parseEnumValues(value.values, index);
|
|
117714
118185
|
}
|
|
117715
|
-
return
|
|
118186
|
+
return field2;
|
|
117716
118187
|
}
|
|
117717
118188
|
function parseAnswerShapeInput(value) {
|
|
117718
118189
|
if (value === void 0 || value === null)
|
|
@@ -117736,30 +118207,30 @@ function parseAnswerShapeInput(value) {
|
|
|
117736
118207
|
const fields = [];
|
|
117737
118208
|
const names = /* @__PURE__ */ new Set();
|
|
117738
118209
|
value.fields.forEach((entry, index) => {
|
|
117739
|
-
const
|
|
117740
|
-
if (names.has(
|
|
117741
|
-
invalid(`answerShape.fields names "${
|
|
118210
|
+
const field2 = parseField(entry, index);
|
|
118211
|
+
if (names.has(field2.name)) {
|
|
118212
|
+
invalid(`answerShape.fields names "${field2.name}" twice`, { index });
|
|
117742
118213
|
}
|
|
117743
|
-
names.add(
|
|
117744
|
-
fields.push(
|
|
118214
|
+
names.add(field2.name);
|
|
118215
|
+
fields.push(field2);
|
|
117745
118216
|
});
|
|
117746
118217
|
return { fields };
|
|
117747
118218
|
}
|
|
117748
118219
|
function compileAnswerShape(shape) {
|
|
117749
118220
|
const entries = {};
|
|
117750
|
-
for (const
|
|
118221
|
+
for (const field2 of shape.fields) {
|
|
117751
118222
|
let schema;
|
|
117752
|
-
switch (
|
|
118223
|
+
switch (field2.type) {
|
|
117753
118224
|
case "string":
|
|
117754
|
-
schema = external_exports.string().max(
|
|
118225
|
+
schema = external_exports.string().max(field2.maxLength ?? MAX_ANSWER_STRING_CHARS);
|
|
117755
118226
|
break;
|
|
117756
118227
|
case "number":
|
|
117757
118228
|
case "integer": {
|
|
117758
|
-
let numeric =
|
|
117759
|
-
if (
|
|
117760
|
-
numeric = numeric.min(
|
|
117761
|
-
if (
|
|
117762
|
-
numeric = numeric.max(
|
|
118229
|
+
let numeric = field2.type === "integer" ? external_exports.int() : external_exports.number();
|
|
118230
|
+
if (field2.min !== void 0)
|
|
118231
|
+
numeric = numeric.min(field2.min);
|
|
118232
|
+
if (field2.max !== void 0)
|
|
118233
|
+
numeric = numeric.max(field2.max);
|
|
117763
118234
|
schema = numeric;
|
|
117764
118235
|
break;
|
|
117765
118236
|
}
|
|
@@ -117767,10 +118238,10 @@ function compileAnswerShape(shape) {
|
|
|
117767
118238
|
schema = external_exports.boolean();
|
|
117768
118239
|
break;
|
|
117769
118240
|
case "enum":
|
|
117770
|
-
schema = external_exports.enum(
|
|
118241
|
+
schema = external_exports.enum(field2.values ?? []);
|
|
117771
118242
|
break;
|
|
117772
118243
|
}
|
|
117773
|
-
entries[
|
|
118244
|
+
entries[field2.name] = field2.required ? schema : schema.nullish();
|
|
117774
118245
|
}
|
|
117775
118246
|
return external_exports.object(entries);
|
|
117776
118247
|
}
|
|
@@ -117789,44 +118260,44 @@ function validateAnswerShape(shape, compiled, candidate) {
|
|
|
117789
118260
|
};
|
|
117790
118261
|
}
|
|
117791
118262
|
const value = {};
|
|
117792
|
-
for (const
|
|
117793
|
-
const entry = parsed.data[
|
|
118263
|
+
for (const field2 of shape.fields) {
|
|
118264
|
+
const entry = parsed.data[field2.name];
|
|
117794
118265
|
if (entry === void 0 || entry === null)
|
|
117795
118266
|
continue;
|
|
117796
|
-
value[
|
|
118267
|
+
value[field2.name] = entry;
|
|
117797
118268
|
}
|
|
117798
118269
|
return { ok: true, value };
|
|
117799
118270
|
}
|
|
117800
|
-
function describeField(
|
|
117801
|
-
const requirement =
|
|
117802
|
-
switch (
|
|
118271
|
+
function describeField(field2) {
|
|
118272
|
+
const requirement = field2.required ? "required" : "optional";
|
|
118273
|
+
switch (field2.type) {
|
|
117803
118274
|
case "string":
|
|
117804
|
-
return `"${
|
|
118275
|
+
return `"${field2.name}": string, at most ${field2.maxLength ?? MAX_ANSWER_STRING_CHARS} characters (${requirement})`;
|
|
117805
118276
|
case "number":
|
|
117806
118277
|
case "integer": {
|
|
117807
|
-
const kind =
|
|
117808
|
-
const range =
|
|
117809
|
-
return `"${
|
|
118278
|
+
const kind = field2.type === "integer" ? "integer" : "number";
|
|
118279
|
+
const range = field2.min !== void 0 && field2.max !== void 0 ? ` between ${field2.min} and ${field2.max}` : field2.min !== void 0 ? ` of at least ${field2.min}` : field2.max !== void 0 ? ` of at most ${field2.max}` : "";
|
|
118280
|
+
return `"${field2.name}": ${kind}${range} (${requirement})`;
|
|
117810
118281
|
}
|
|
117811
118282
|
case "boolean":
|
|
117812
|
-
return `"${
|
|
118283
|
+
return `"${field2.name}": true or false (${requirement})`;
|
|
117813
118284
|
case "enum":
|
|
117814
|
-
return `"${
|
|
118285
|
+
return `"${field2.name}": exactly one of ${(field2.values ?? []).map((entry) => JSON.stringify(entry)).join(", ")} (${requirement})`;
|
|
117815
118286
|
}
|
|
117816
118287
|
}
|
|
117817
118288
|
function describeAnswerShape(shape) {
|
|
117818
|
-
return shape.fields.map((
|
|
118289
|
+
return shape.fields.map((field2) => ` ${describeField(field2)}`);
|
|
117819
118290
|
}
|
|
117820
118291
|
function renderShapedAnswer(shape, value) {
|
|
117821
|
-
return shape.fields.filter((
|
|
118292
|
+
return shape.fields.filter((field2) => value[field2.name] !== void 0).map((field2) => `${field2.name}: ${String(value[field2.name])}`).join("\n");
|
|
117822
118293
|
}
|
|
117823
118294
|
function cloneAnswerShape(shape) {
|
|
117824
118295
|
if (!shape)
|
|
117825
118296
|
return null;
|
|
117826
118297
|
return {
|
|
117827
|
-
fields: shape.fields.map((
|
|
117828
|
-
...
|
|
117829
|
-
...
|
|
118298
|
+
fields: shape.fields.map((field2) => ({
|
|
118299
|
+
...field2,
|
|
118300
|
+
...field2.values ? { values: [...field2.values] } : {}
|
|
117830
118301
|
}))
|
|
117831
118302
|
};
|
|
117832
118303
|
}
|
|
@@ -117933,15 +118404,15 @@ var MODEL_ID = /^[A-Za-z0-9][A-Za-z0-9._:/-]*$/;
|
|
|
117933
118404
|
function isRecord5(value) {
|
|
117934
118405
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
117935
118406
|
}
|
|
117936
|
-
function parseScope(value,
|
|
118407
|
+
function parseScope(value, field2) {
|
|
117937
118408
|
if (typeof value !== "string") {
|
|
117938
|
-
throw new DerivativeQuestionInvalidError(`${
|
|
117939
|
-
field
|
|
118409
|
+
throw new DerivativeQuestionInvalidError(`${field2} must be a scope string`, {
|
|
118410
|
+
field: field2
|
|
117940
118411
|
});
|
|
117941
118412
|
}
|
|
117942
118413
|
const parsed = parseDataScopeContract(value);
|
|
117943
118414
|
if (!parsed.ok) {
|
|
117944
|
-
throw new DerivativeQuestionInvalidError(`${
|
|
118415
|
+
throw new DerivativeQuestionInvalidError(`${field2} is not a valid scope: ${parsed.body.message}`, { field: field2, scope: value.slice(0, MAX_ECHOED_SCOPE_CHARS) });
|
|
117945
118416
|
}
|
|
117946
118417
|
return parsed.scope;
|
|
117947
118418
|
}
|
|
@@ -118318,14 +118789,14 @@ function readContent(body) {
|
|
|
118318
118789
|
if (!isRecord7(first) || !isRecord7(first.message))
|
|
118319
118790
|
return null;
|
|
118320
118791
|
const index = typeof first.index === "number" ? first.index : 0;
|
|
118321
|
-
const
|
|
118792
|
+
const field2 = `choices.${index}.message.content`;
|
|
118322
118793
|
const id2 = typeof body.id === "string" ? body.id : "";
|
|
118323
118794
|
const content = first.message.content;
|
|
118324
118795
|
if (typeof content === "string")
|
|
118325
|
-
return { content, field, id: id2 };
|
|
118796
|
+
return { content, field: field2, id: id2 };
|
|
118326
118797
|
if (Array.isArray(content)) {
|
|
118327
118798
|
const text = content.map((part) => isRecord7(part) && typeof part.text === "string" ? part.text : "").join("");
|
|
118328
|
-
return { content: text, field, id: id2 };
|
|
118799
|
+
return { content: text, field: field2, id: id2 };
|
|
118329
118800
|
}
|
|
118330
118801
|
return null;
|
|
118331
118802
|
}
|
|
@@ -118558,7 +119029,7 @@ async function produceAnswer(deps, registration, model, messages) {
|
|
|
118558
119029
|
answerShape: shape
|
|
118559
119030
|
});
|
|
118560
119031
|
}
|
|
118561
|
-
throw new ComputeFailure(`answer did not match the declared shape (fields: ${shape.fields.map((
|
|
119032
|
+
throw new ComputeFailure(`answer did not match the declared shape (fields: ${shape.fields.map((field2) => field2.name).join(", ")})`, "internal");
|
|
118562
119033
|
}
|
|
118563
119034
|
function collectedAtStamp(now, isTaken) {
|
|
118564
119035
|
const base = now();
|
|
@@ -119379,23 +119850,23 @@ function canonicalJsonBytes(value) {
|
|
|
119379
119850
|
// ../core/dist/derivatives/e2ee/aad.js
|
|
119380
119851
|
var E2EE_REQUEST_AAD_PURPOSE = "aci.e2ee.request.v2";
|
|
119381
119852
|
var E2EE_RESPONSE_AAD_PURPOSE = "aci.e2ee.response.v2";
|
|
119382
|
-
function requestFieldAad(context,
|
|
119853
|
+
function requestFieldAad(context, field2) {
|
|
119383
119854
|
return canonicalJsonBytes({
|
|
119384
119855
|
purpose: E2EE_REQUEST_AAD_PURPOSE,
|
|
119385
119856
|
algo: context.algo,
|
|
119386
119857
|
model: context.model,
|
|
119387
|
-
field,
|
|
119858
|
+
field: field2,
|
|
119388
119859
|
nonce: context.nonce,
|
|
119389
119860
|
ts: context.ts
|
|
119390
119861
|
});
|
|
119391
119862
|
}
|
|
119392
|
-
function responseFieldAad(context,
|
|
119863
|
+
function responseFieldAad(context, field2, id2) {
|
|
119393
119864
|
return canonicalJsonBytes({
|
|
119394
119865
|
purpose: E2EE_RESPONSE_AAD_PURPOSE,
|
|
119395
119866
|
algo: context.algo,
|
|
119396
119867
|
model: context.model,
|
|
119397
119868
|
id: id2,
|
|
119398
|
-
field,
|
|
119869
|
+
field: field2,
|
|
119399
119870
|
nonce: context.nonce,
|
|
119400
119871
|
ts: context.ts
|
|
119401
119872
|
});
|
|
@@ -119815,7 +120286,7 @@ function createPhalaE2eeEncryption(options) {
|
|
|
119815
120286
|
}
|
|
119816
120287
|
const request2 = {
|
|
119817
120288
|
messages: encrypted,
|
|
119818
|
-
async decryptResponse({ content, field, id: id2, headers: response }) {
|
|
120289
|
+
async decryptResponse({ content, field: field2, id: id2, headers: response }) {
|
|
119819
120290
|
const served = response.get(ACI_HEADER_KEYSET_DIGEST);
|
|
119820
120291
|
if (served && served !== gatewayKey.keysetDigest) {
|
|
119821
120292
|
options.logger?.warn?.({ pinned: gatewayKey.keysetDigest, served }, "E2EE keyset digest changed; refetching the attestation report");
|
|
@@ -119825,11 +120296,11 @@ function createPhalaE2eeEncryption(options) {
|
|
|
119825
120296
|
return await decryptField({
|
|
119826
120297
|
wire: content,
|
|
119827
120298
|
privateKey: client.privateKey,
|
|
119828
|
-
aad: responseFieldAad(context,
|
|
120299
|
+
aad: responseFieldAad(context, field2, id2)
|
|
119829
120300
|
});
|
|
119830
120301
|
} catch (err2) {
|
|
119831
120302
|
const detail = err2 instanceof E2eeCipherError ? err2.message : "unexpected error";
|
|
119832
|
-
throw new InferenceRequestError(`e2ee response decryption failed for ${
|
|
120303
|
+
throw new InferenceRequestError(`e2ee response decryption failed for ${field2} (${detail})`, null, { errorType: "e2ee_decryption_failed", retryable: false });
|
|
119833
120304
|
}
|
|
119834
120305
|
}
|
|
119835
120306
|
};
|
|
@@ -120946,16 +121417,16 @@ var MiniSearch = class _MiniSearch {
|
|
|
120946
121417
|
}
|
|
120947
121418
|
const shortDocumentId = this.addDocumentId(id2);
|
|
120948
121419
|
this.saveStoredFields(shortDocumentId, document2);
|
|
120949
|
-
for (const
|
|
120950
|
-
const fieldValue = extractField(document2,
|
|
121420
|
+
for (const field2 of fields) {
|
|
121421
|
+
const fieldValue = extractField(document2, field2);
|
|
120951
121422
|
if (fieldValue == null)
|
|
120952
121423
|
continue;
|
|
120953
|
-
const tokens = tokenize(stringifyField(fieldValue,
|
|
120954
|
-
const fieldId = this._fieldIds[
|
|
121424
|
+
const tokens = tokenize(stringifyField(fieldValue, field2), field2);
|
|
121425
|
+
const fieldId = this._fieldIds[field2];
|
|
120955
121426
|
const uniqueTerms = new Set(tokens).size;
|
|
120956
121427
|
this.addFieldLength(shortDocumentId, fieldId, this._documentCount - 1, uniqueTerms);
|
|
120957
121428
|
for (const term of tokens) {
|
|
120958
|
-
const processedTerm = processTerm2(term,
|
|
121429
|
+
const processedTerm = processTerm2(term, field2);
|
|
120959
121430
|
if (Array.isArray(processedTerm)) {
|
|
120960
121431
|
for (const t10 of processedTerm) {
|
|
120961
121432
|
this.addTerm(fieldId, shortDocumentId, t10);
|
|
@@ -121026,16 +121497,16 @@ var MiniSearch = class _MiniSearch {
|
|
|
121026
121497
|
if (shortId == null) {
|
|
121027
121498
|
throw new Error(`MiniSearch: cannot remove document with ID ${id2}: it is not in the index`);
|
|
121028
121499
|
}
|
|
121029
|
-
for (const
|
|
121030
|
-
const fieldValue = extractField(document2,
|
|
121500
|
+
for (const field2 of fields) {
|
|
121501
|
+
const fieldValue = extractField(document2, field2);
|
|
121031
121502
|
if (fieldValue == null)
|
|
121032
121503
|
continue;
|
|
121033
|
-
const tokens = tokenize(stringifyField(fieldValue,
|
|
121034
|
-
const fieldId = this._fieldIds[
|
|
121504
|
+
const tokens = tokenize(stringifyField(fieldValue, field2), field2);
|
|
121505
|
+
const fieldId = this._fieldIds[field2];
|
|
121035
121506
|
const uniqueTerms = new Set(tokens).size;
|
|
121036
121507
|
this.removeFieldLength(shortId, fieldId, this._documentCount, uniqueTerms);
|
|
121037
121508
|
for (const term of tokens) {
|
|
121038
|
-
const processedTerm = processTerm2(term,
|
|
121509
|
+
const processedTerm = processTerm2(term, field2);
|
|
121039
121510
|
if (Array.isArray(processedTerm)) {
|
|
121040
121511
|
for (const t10 of processedTerm) {
|
|
121041
121512
|
this.removeTerm(fieldId, shortId, t10);
|
|
@@ -121785,7 +122256,7 @@ var MiniSearch = class _MiniSearch {
|
|
|
121785
122256
|
*/
|
|
121786
122257
|
executeQuerySpec(query, searchOptions) {
|
|
121787
122258
|
const options = { ...this._options.searchOptions, ...searchOptions };
|
|
121788
|
-
const boosts = (options.fields || this._options.fields).reduce((boosts2,
|
|
122259
|
+
const boosts = (options.fields || this._options.fields).reduce((boosts2, field2) => ({ ...boosts2, [field2]: getOwnProperty(options.boost, field2) || 1 }), {});
|
|
121789
122260
|
const { boostDocument, weights, maxFuzzy, bm25: bm25params } = options;
|
|
121790
122261
|
const { fuzzy: fuzzyWeight, prefix: prefixWeight } = { ...defaultSearchOptions.weights, ...weights };
|
|
121791
122262
|
const data = this._index.get(query.term);
|
|
@@ -121906,9 +122377,9 @@ var MiniSearch = class _MiniSearch {
|
|
|
121906
122377
|
termResults(sourceTerm, derivedTerm, termWeight, termBoost, fieldTermData, fieldBoosts, boostDocumentFn, bm25params, results = /* @__PURE__ */ new Map()) {
|
|
121907
122378
|
if (fieldTermData == null)
|
|
121908
122379
|
return results;
|
|
121909
|
-
for (const
|
|
121910
|
-
const fieldBoost = fieldBoosts[
|
|
121911
|
-
const fieldId = this._fieldIds[
|
|
122380
|
+
for (const field2 of Object.keys(fieldBoosts)) {
|
|
122381
|
+
const fieldBoost = fieldBoosts[field2];
|
|
122382
|
+
const fieldId = this._fieldIds[field2];
|
|
121912
122383
|
const fieldTermFreqs = fieldTermData.get(fieldId);
|
|
121913
122384
|
if (fieldTermFreqs == null)
|
|
121914
122385
|
continue;
|
|
@@ -121933,15 +122404,15 @@ var MiniSearch = class _MiniSearch {
|
|
|
121933
122404
|
assignUniqueTerm(result.terms, sourceTerm);
|
|
121934
122405
|
const match = getOwnProperty(result.match, derivedTerm);
|
|
121935
122406
|
if (match) {
|
|
121936
|
-
match.push(
|
|
122407
|
+
match.push(field2);
|
|
121937
122408
|
} else {
|
|
121938
|
-
result.match[derivedTerm] = [
|
|
122409
|
+
result.match[derivedTerm] = [field2];
|
|
121939
122410
|
}
|
|
121940
122411
|
} else {
|
|
121941
122412
|
results.set(docId, {
|
|
121942
122413
|
score: weightedScore,
|
|
121943
122414
|
terms: [sourceTerm],
|
|
121944
|
-
match: { [derivedTerm]: [
|
|
122415
|
+
match: { [derivedTerm]: [field2] }
|
|
121945
122416
|
});
|
|
121946
122417
|
}
|
|
121947
122418
|
}
|
|
@@ -132709,11 +133180,11 @@ var McpServer = class {
|
|
|
132709
133180
|
return EMPTY_COMPLETION_RESULT;
|
|
132710
133181
|
}
|
|
132711
133182
|
const promptShape = getObjectShape(prompt.argsSchema);
|
|
132712
|
-
const
|
|
132713
|
-
if (!isCompletable(
|
|
133183
|
+
const field2 = promptShape?.[request2.params.argument.name];
|
|
133184
|
+
if (!isCompletable(field2)) {
|
|
132714
133185
|
return EMPTY_COMPLETION_RESULT;
|
|
132715
133186
|
}
|
|
132716
|
-
const completer = getCompleter(
|
|
133187
|
+
const completer = getCompleter(field2);
|
|
132717
133188
|
if (!completer) {
|
|
132718
133189
|
return EMPTY_COMPLETION_RESULT;
|
|
132719
133190
|
}
|
|
@@ -132986,8 +133457,8 @@ var McpServer = class {
|
|
|
132986
133457
|
};
|
|
132987
133458
|
this._registeredPrompts[name] = registeredPrompt;
|
|
132988
133459
|
if (argsSchema) {
|
|
132989
|
-
const hasCompletable = Object.values(argsSchema).some((
|
|
132990
|
-
const inner =
|
|
133460
|
+
const hasCompletable = Object.values(argsSchema).some((field2) => {
|
|
133461
|
+
const inner = field2 instanceof ZodOptional ? field2._def?.innerType : field2;
|
|
132991
133462
|
return isCompletable(inner);
|
|
132992
133463
|
});
|
|
132993
133464
|
if (hasCompletable) {
|
|
@@ -133220,9 +133691,9 @@ function promptArgumentsFromSchema(schema) {
|
|
|
133220
133691
|
const shape = getObjectShape(schema);
|
|
133221
133692
|
if (!shape)
|
|
133222
133693
|
return [];
|
|
133223
|
-
return Object.entries(shape).map(([name,
|
|
133224
|
-
const description = getSchemaDescription(
|
|
133225
|
-
const isOptional = isSchemaOptional(
|
|
133694
|
+
return Object.entries(shape).map(([name, field2]) => {
|
|
133695
|
+
const description = getSchemaDescription(field2);
|
|
133696
|
+
const isOptional = isSchemaOptional(field2);
|
|
133226
133697
|
return {
|
|
133227
133698
|
name,
|
|
133228
133699
|
description,
|