@hexclave/dashboard-ui-components 1.0.76 → 1.0.77
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.
|
@@ -3981,236 +3981,6 @@ var DashboardUI = (() => {
|
|
|
3981
3981
|
// ../shared/dist/esm/utils/react.js
|
|
3982
3982
|
var import_react7 = __toESM(require_react(), 1);
|
|
3983
3983
|
|
|
3984
|
-
// ../shared/dist/esm/utils/arrays.js
|
|
3985
|
-
function findLastIndex(arr, predicate) {
|
|
3986
|
-
for (let i = arr.length - 1; i >= 0; i--) if (predicate(arr[i])) return i;
|
|
3987
|
-
return -1;
|
|
3988
|
-
}
|
|
3989
|
-
function unique(arr) {
|
|
3990
|
-
return [...new Set(arr)];
|
|
3991
|
-
}
|
|
3992
|
-
|
|
3993
|
-
// ../shared/dist/esm/utils/strings.js
|
|
3994
|
-
function stringCompare(a26, b) {
|
|
3995
|
-
if (typeof a26 !== "string" || typeof b !== "string") throw new HexclaveAssertionError(`Expected two strings for stringCompare, found ${typeof a26} and ${typeof b}`, {
|
|
3996
|
-
a: a26,
|
|
3997
|
-
b
|
|
3998
|
-
});
|
|
3999
|
-
const cmp = (a27, b2) => a27 < b2 ? -1 : a27 > b2 ? 1 : 0;
|
|
4000
|
-
return cmp(a26.toUpperCase(), b.toUpperCase()) || cmp(b, a26);
|
|
4001
|
-
}
|
|
4002
|
-
function getWhitespacePrefix(s8) {
|
|
4003
|
-
return s8.substring(0, s8.length - s8.trimStart().length);
|
|
4004
|
-
}
|
|
4005
|
-
function trimEmptyLinesStart(s8) {
|
|
4006
|
-
const lines = s8.split("\n");
|
|
4007
|
-
const firstNonEmptyLineIndex = lines.findIndex((line) => line.trim() !== "");
|
|
4008
|
-
if (firstNonEmptyLineIndex === -1) return "";
|
|
4009
|
-
return lines.slice(firstNonEmptyLineIndex).join("\n");
|
|
4010
|
-
}
|
|
4011
|
-
function trimEmptyLinesEnd(s8) {
|
|
4012
|
-
const lines = s8.split("\n");
|
|
4013
|
-
const lastNonEmptyLineIndex = findLastIndex(lines, (line) => line.trim() !== "");
|
|
4014
|
-
return lines.slice(0, lastNonEmptyLineIndex + 1).join("\n");
|
|
4015
|
-
}
|
|
4016
|
-
function templateIdentity(strings, ...values) {
|
|
4017
|
-
if (values.length !== strings.length - 1) throw new HexclaveAssertionError("Invalid number of values; must be one less than strings", {
|
|
4018
|
-
strings,
|
|
4019
|
-
values
|
|
4020
|
-
});
|
|
4021
|
-
return strings.reduce((result, str, i) => result + str + (values[i] ?? ""), "");
|
|
4022
|
-
}
|
|
4023
|
-
function deindent(strings, ...values) {
|
|
4024
|
-
if (typeof strings === "string") return deindent([strings]);
|
|
4025
|
-
return templateIdentity(...deindentTemplate(strings, ...values));
|
|
4026
|
-
}
|
|
4027
|
-
function deindentTemplate(strings, ...values) {
|
|
4028
|
-
if (values.length !== strings.length - 1) throw new HexclaveAssertionError("Invalid number of values; must be one less than strings", {
|
|
4029
|
-
strings,
|
|
4030
|
-
values
|
|
4031
|
-
});
|
|
4032
|
-
const trimmedStrings = [...strings];
|
|
4033
|
-
trimmedStrings[0] = trimEmptyLinesStart(trimmedStrings[0] + "+").slice(0, -1);
|
|
4034
|
-
trimmedStrings[trimmedStrings.length - 1] = trimEmptyLinesEnd("+" + trimmedStrings[trimmedStrings.length - 1]).slice(1);
|
|
4035
|
-
const indentation = trimmedStrings.join("${SOME_VALUE}").split("\n").filter((line) => line.trim() !== "").map((line) => getWhitespacePrefix(line).length).reduce((min4, current) => Math.min(min4, current), Infinity);
|
|
4036
|
-
const deindentedStrings = trimmedStrings.map((string2, stringIndex) => {
|
|
4037
|
-
return string2.split("\n").map((line, lineIndex) => stringIndex !== 0 && lineIndex === 0 ? line : line.substring(indentation)).join("\n");
|
|
4038
|
-
});
|
|
4039
|
-
return [deindentedStrings, ...values.map((value, i) => {
|
|
4040
|
-
const firstLineIndentation = getWhitespacePrefix(deindentedStrings[i].split("\n").at(-1));
|
|
4041
|
-
return `${value}`.replaceAll("\n", `
|
|
4042
|
-
${firstLineIndentation}`);
|
|
4043
|
-
})];
|
|
4044
|
-
}
|
|
4045
|
-
function escapeTemplateLiteral(s8) {
|
|
4046
|
-
return s8.replaceAll("\\", "\\\\").replaceAll("`", "\\`").replaceAll("${", "\\${");
|
|
4047
|
-
}
|
|
4048
|
-
var nicifiableClassNameOverrides = new Map(Object.entries({ Headers }).map(([k3, v]) => [v, k3]));
|
|
4049
|
-
function nicify(value, options = {}) {
|
|
4050
|
-
const fullOptions = {
|
|
4051
|
-
maxDepth: 5,
|
|
4052
|
-
currentIndent: "",
|
|
4053
|
-
lineIndent: " ",
|
|
4054
|
-
multiline: true,
|
|
4055
|
-
refs: /* @__PURE__ */ new Map(),
|
|
4056
|
-
path: "value",
|
|
4057
|
-
parent: null,
|
|
4058
|
-
overrides: () => null,
|
|
4059
|
-
keyInParent: null,
|
|
4060
|
-
hideFields: [],
|
|
4061
|
-
...filterUndefined(options)
|
|
4062
|
-
};
|
|
4063
|
-
const { maxDepth, currentIndent, lineIndent, multiline, refs, path, overrides, hideFields } = fullOptions;
|
|
4064
|
-
const nl = `
|
|
4065
|
-
${currentIndent}`;
|
|
4066
|
-
const overrideResult = overrides(value, options);
|
|
4067
|
-
if (overrideResult !== null) return overrideResult;
|
|
4068
|
-
if ([
|
|
4069
|
-
"function",
|
|
4070
|
-
"object",
|
|
4071
|
-
"symbol"
|
|
4072
|
-
].includes(typeof value) && value !== null) {
|
|
4073
|
-
if (refs.has(value)) return `Ref<${refs.get(value)}>`;
|
|
4074
|
-
refs.set(value, path);
|
|
4075
|
-
}
|
|
4076
|
-
const newOptions = {
|
|
4077
|
-
maxDepth: maxDepth - 1,
|
|
4078
|
-
currentIndent,
|
|
4079
|
-
lineIndent,
|
|
4080
|
-
multiline,
|
|
4081
|
-
refs,
|
|
4082
|
-
path: path + "->[unknown property]",
|
|
4083
|
-
overrides,
|
|
4084
|
-
parent: {
|
|
4085
|
-
value,
|
|
4086
|
-
options: fullOptions
|
|
4087
|
-
},
|
|
4088
|
-
keyInParent: null,
|
|
4089
|
-
hideFields: []
|
|
4090
|
-
};
|
|
4091
|
-
const nestedNicify = (newValue, newPath, keyInParent, options2 = {}) => {
|
|
4092
|
-
return nicify(newValue, {
|
|
4093
|
-
...newOptions,
|
|
4094
|
-
path: newPath,
|
|
4095
|
-
currentIndent: currentIndent + lineIndent,
|
|
4096
|
-
keyInParent,
|
|
4097
|
-
...options2
|
|
4098
|
-
});
|
|
4099
|
-
};
|
|
4100
|
-
switch (typeof value) {
|
|
4101
|
-
case "boolean":
|
|
4102
|
-
case "number":
|
|
4103
|
-
return JSON.stringify(value);
|
|
4104
|
-
case "string": {
|
|
4105
|
-
const isDeindentable = (v) => deindent(v) === v && v.includes("\n");
|
|
4106
|
-
const wrapInDeindent = (v) => deindent`
|
|
4107
|
-
deindent\`
|
|
4108
|
-
${currentIndent + lineIndent}${escapeTemplateLiteral(v).replaceAll("\n", nl + lineIndent)}
|
|
4109
|
-
${currentIndent}\`
|
|
4110
|
-
`;
|
|
4111
|
-
if (isDeindentable(value)) return wrapInDeindent(value);
|
|
4112
|
-
else if (value.endsWith("\n") && isDeindentable(value.slice(0, -1))) return wrapInDeindent(value.slice(0, -1)) + ' + "\\n"';
|
|
4113
|
-
else return JSON.stringify(value);
|
|
4114
|
-
}
|
|
4115
|
-
case "undefined":
|
|
4116
|
-
return "undefined";
|
|
4117
|
-
case "symbol":
|
|
4118
|
-
return value.toString();
|
|
4119
|
-
case "bigint":
|
|
4120
|
-
return `${value}n`;
|
|
4121
|
-
case "function":
|
|
4122
|
-
if (value.name) return `function ${value.name}(...) { ... }`;
|
|
4123
|
-
return `(...) => { ... }`;
|
|
4124
|
-
case "object": {
|
|
4125
|
-
if (value === null) return "null";
|
|
4126
|
-
if (Array.isArray(value)) {
|
|
4127
|
-
const extraLines2 = getNicifiedObjectExtraLines(value);
|
|
4128
|
-
const resValueLength2 = value.length + extraLines2.length;
|
|
4129
|
-
if (resValueLength2 === 0) return "[]";
|
|
4130
|
-
if (maxDepth <= 0) return `[...]`;
|
|
4131
|
-
const resValues2 = value.map((v, i) => nestedNicify(v, `${path}[${i}]`, i));
|
|
4132
|
-
resValues2.push(...extraLines2);
|
|
4133
|
-
if (resValues2.length !== resValueLength2) throw new HexclaveAssertionError("nicify of object: resValues.length !== resValueLength", {
|
|
4134
|
-
value,
|
|
4135
|
-
resValues: resValues2,
|
|
4136
|
-
resValueLength: resValueLength2
|
|
4137
|
-
});
|
|
4138
|
-
if (resValues2.length > 4 || resValues2.some((x) => resValues2.length > 1 && x.length > 4 || x.includes("\n"))) return `[${nl}${resValues2.map((x) => `${lineIndent}${x},${nl}`).join("")}]`;
|
|
4139
|
-
else return `[${resValues2.join(", ")}]`;
|
|
4140
|
-
}
|
|
4141
|
-
if (value instanceof Date) return `Date(${nestedNicify(value.toISOString(), `${path}.toISOString()`, null)})`;
|
|
4142
|
-
if (value instanceof URL) return `URL(${nestedNicify(value.toString(), `${path}.toString()`, null)})`;
|
|
4143
|
-
if (ArrayBuffer.isView(value)) return `${value.constructor.name}([${value.toString()}])`;
|
|
4144
|
-
if (value instanceof ArrayBuffer) return `ArrayBuffer [${new Uint8Array(value).toString()}]`;
|
|
4145
|
-
if (value instanceof Error) {
|
|
4146
|
-
let stack = value.stack ?? "";
|
|
4147
|
-
const toString3 = value.toString();
|
|
4148
|
-
if (!stack.startsWith(toString3)) stack = `${toString3}
|
|
4149
|
-
${stack}`;
|
|
4150
|
-
stack = stack.trimEnd();
|
|
4151
|
-
stack = stack.replace(/\n\s+/g, `
|
|
4152
|
-
${lineIndent}${lineIndent}`);
|
|
4153
|
-
stack = stack.replace("\n", `
|
|
4154
|
-
${lineIndent}Stack:
|
|
4155
|
-
`);
|
|
4156
|
-
if (Object.keys(value).length > 0) stack += `
|
|
4157
|
-
${lineIndent}Extra properties: ${nestedNicify(Object.fromEntries(Object.entries(value)), path, null)}`;
|
|
4158
|
-
if (value.cause) stack += `
|
|
4159
|
-
${lineIndent}Cause:
|
|
4160
|
-
${lineIndent}${lineIndent}${nestedNicify(value.cause, path, null, { currentIndent: currentIndent + lineIndent + lineIndent })}`;
|
|
4161
|
-
stack = stack.replaceAll("\n", `
|
|
4162
|
-
${currentIndent}`);
|
|
4163
|
-
return stack;
|
|
4164
|
-
}
|
|
4165
|
-
const constructorName = [null, Object.prototype].includes(Object.getPrototypeOf(value)) ? null : nicifiableClassNameOverrides.get(value.constructor) ?? value.constructor.name;
|
|
4166
|
-
const constructorString = constructorName ? `${constructorName} ` : "";
|
|
4167
|
-
const entries = getNicifiableEntries(value).filter(([k3]) => !hideFields.includes(k3));
|
|
4168
|
-
const extraLines = [...getNicifiedObjectExtraLines(value), ...hideFields.length > 0 ? [`<some fields may have been hidden>`] : []];
|
|
4169
|
-
const resValueLength = entries.length + extraLines.length;
|
|
4170
|
-
if (resValueLength === 0) return `${constructorString}{}`;
|
|
4171
|
-
if (maxDepth <= 0) return `${constructorString}{ ... }`;
|
|
4172
|
-
const resValues = entries.map(([k3, v], keyIndex) => {
|
|
4173
|
-
const keyNicified = nestedNicify(k3, `Object.keys(${path})[${keyIndex}]`, null);
|
|
4174
|
-
const keyInObjectLiteral = typeof k3 === "string" ? nicifyPropertyString(k3) : `[${keyNicified}]`;
|
|
4175
|
-
if (typeof v === "function" && v.name === k3) return `${keyInObjectLiteral}(...): { ... }`;
|
|
4176
|
-
else return `${keyInObjectLiteral}: ${nestedNicify(v, `${path}[${keyNicified}]`, k3)}`;
|
|
4177
|
-
});
|
|
4178
|
-
resValues.push(...extraLines);
|
|
4179
|
-
if (resValues.length !== resValueLength) throw new HexclaveAssertionError("nicify of object: resValues.length !== resValueLength", {
|
|
4180
|
-
value,
|
|
4181
|
-
resValues,
|
|
4182
|
-
resValueLength
|
|
4183
|
-
});
|
|
4184
|
-
const shouldIndent = resValues.length > 1 || resValues.some((x) => x.includes("\n"));
|
|
4185
|
-
if (resValues.length === 0) return `${constructorString}{}`;
|
|
4186
|
-
if (shouldIndent) return `${constructorString}{${nl}${resValues.map((x) => `${lineIndent}${x},${nl}`).join("")}}`;
|
|
4187
|
-
else return `${constructorString}{ ${resValues.join(", ")} }`;
|
|
4188
|
-
}
|
|
4189
|
-
default:
|
|
4190
|
-
return `${typeof value}<${value}>`;
|
|
4191
|
-
}
|
|
4192
|
-
}
|
|
4193
|
-
function nicifyPropertyString(str) {
|
|
4194
|
-
return JSON.stringify(str);
|
|
4195
|
-
}
|
|
4196
|
-
function getNicifiableKeys(value) {
|
|
4197
|
-
const overridden = ("getNicifiableKeys" in value ? value.getNicifiableKeys?.bind(value) : null)?.();
|
|
4198
|
-
if (overridden != null) return overridden;
|
|
4199
|
-
if (value instanceof Response) return ["status", "headers"];
|
|
4200
|
-
return unique(Object.keys(value).sort());
|
|
4201
|
-
}
|
|
4202
|
-
function getNicifiableEntries(value) {
|
|
4203
|
-
const recordLikes = [Headers];
|
|
4204
|
-
function isRecordLike(value2) {
|
|
4205
|
-
return recordLikes.some((x) => value2 instanceof x);
|
|
4206
|
-
}
|
|
4207
|
-
if (isRecordLike(value)) return [...value.entries()].sort(([a26], [b]) => stringCompare(`${a26}`, `${b}`));
|
|
4208
|
-
return getNicifiableKeys(value).map((k3) => [k3, value[k3]]);
|
|
4209
|
-
}
|
|
4210
|
-
function getNicifiedObjectExtraLines(value) {
|
|
4211
|
-
return ("getNicifiedObjectExtraLines" in value ? value.getNicifiedObjectExtraLines : null)?.() ?? [];
|
|
4212
|
-
}
|
|
4213
|
-
|
|
4214
3984
|
// ../shared/dist/esm/utils/functions.js
|
|
4215
3985
|
function identityArgs(...args) {
|
|
4216
3986
|
return args;
|
|
@@ -4431,148 +4201,357 @@ This is likely an error in Hexclave. Please make sure you are running the newest
|
|
|
4431
4201
|
headers: this.getHeaders()
|
|
4432
4202
|
};
|
|
4433
4203
|
}
|
|
4434
|
-
}, _a.BadRequest = {
|
|
4435
|
-
statusCode: 400,
|
|
4436
|
-
message: "Bad Request"
|
|
4437
|
-
}, _a.Unauthorized = {
|
|
4438
|
-
statusCode: 401,
|
|
4439
|
-
message: "Unauthorized"
|
|
4440
|
-
}, _a.PaymentRequired = {
|
|
4441
|
-
statusCode: 402,
|
|
4442
|
-
message: "Payment Required"
|
|
4443
|
-
}, _a.Forbidden = {
|
|
4444
|
-
statusCode: 403,
|
|
4445
|
-
message: "Forbidden"
|
|
4446
|
-
}, _a.NotFound = {
|
|
4447
|
-
statusCode: 404,
|
|
4448
|
-
message: "Not Found"
|
|
4449
|
-
}, _a.MethodNotAllowed = {
|
|
4450
|
-
statusCode: 405,
|
|
4451
|
-
message: "Method Not Allowed"
|
|
4452
|
-
}, _a.NotAcceptable = {
|
|
4453
|
-
statusCode: 406,
|
|
4454
|
-
message: "Not Acceptable"
|
|
4455
|
-
}, _a.ProxyAuthenticationRequired = {
|
|
4456
|
-
statusCode: 407,
|
|
4457
|
-
message: "Proxy Authentication Required"
|
|
4458
|
-
}, _a.RequestTimeout = {
|
|
4459
|
-
statusCode: 408,
|
|
4460
|
-
message: "Request Timeout"
|
|
4461
|
-
}, _a.Conflict = {
|
|
4462
|
-
statusCode: 409,
|
|
4463
|
-
message: "Conflict"
|
|
4464
|
-
}, _a.Gone = {
|
|
4465
|
-
statusCode: 410,
|
|
4466
|
-
message: "Gone"
|
|
4467
|
-
}, _a.LengthRequired = {
|
|
4468
|
-
statusCode: 411,
|
|
4469
|
-
message: "Length Required"
|
|
4470
|
-
}, _a.PreconditionFailed = {
|
|
4471
|
-
statusCode: 412,
|
|
4472
|
-
message: "Precondition Failed"
|
|
4473
|
-
}, _a.PayloadTooLarge = {
|
|
4474
|
-
statusCode: 413,
|
|
4475
|
-
message: "Payload Too Large"
|
|
4476
|
-
}, _a.URITooLong = {
|
|
4477
|
-
statusCode: 414,
|
|
4478
|
-
message: "URI Too Long"
|
|
4479
|
-
}, _a.UnsupportedMediaType = {
|
|
4480
|
-
statusCode: 415,
|
|
4481
|
-
message: "Unsupported Media Type"
|
|
4482
|
-
}, _a.RangeNotSatisfiable = {
|
|
4483
|
-
statusCode: 416,
|
|
4484
|
-
message: "Range Not Satisfiable"
|
|
4485
|
-
}, _a.ExpectationFailed = {
|
|
4486
|
-
statusCode: 417,
|
|
4487
|
-
message: "Expectation Failed"
|
|
4488
|
-
}, _a.ImATeapot = {
|
|
4489
|
-
statusCode: 418,
|
|
4490
|
-
message: "I'm a teapot"
|
|
4491
|
-
}, _a.MisdirectedRequest = {
|
|
4492
|
-
statusCode: 421,
|
|
4493
|
-
message: "Misdirected Request"
|
|
4494
|
-
}, _a.UnprocessableEntity = {
|
|
4495
|
-
statusCode: 422,
|
|
4496
|
-
message: "Unprocessable Entity"
|
|
4497
|
-
}, _a.Locked = {
|
|
4498
|
-
statusCode: 423,
|
|
4499
|
-
message: "Locked"
|
|
4500
|
-
}, _a.FailedDependency = {
|
|
4501
|
-
statusCode: 424,
|
|
4502
|
-
message: "Failed Dependency"
|
|
4503
|
-
}, _a.TooEarly = {
|
|
4504
|
-
statusCode: 425,
|
|
4505
|
-
message: "Too Early"
|
|
4506
|
-
}, _a.UpgradeRequired = {
|
|
4507
|
-
statusCode: 426,
|
|
4508
|
-
message: "Upgrade Required"
|
|
4509
|
-
}, _a.PreconditionRequired = {
|
|
4510
|
-
statusCode: 428,
|
|
4511
|
-
message: "Precondition Required"
|
|
4512
|
-
}, _a.TooManyRequests = {
|
|
4513
|
-
statusCode: 429,
|
|
4514
|
-
message: "Too Many Requests"
|
|
4515
|
-
}, _a.RequestHeaderFieldsTooLarge = {
|
|
4516
|
-
statusCode: 431,
|
|
4517
|
-
message: "Request Header Fields Too Large"
|
|
4518
|
-
}, _a.UnavailableForLegalReasons = {
|
|
4519
|
-
statusCode: 451,
|
|
4520
|
-
message: "Unavailable For Legal Reasons"
|
|
4521
|
-
}, _a.InternalServerError = {
|
|
4522
|
-
statusCode: 500,
|
|
4523
|
-
message: "Internal Server Error"
|
|
4524
|
-
}, _a.NotImplemented = {
|
|
4525
|
-
statusCode: 501,
|
|
4526
|
-
message: "Not Implemented"
|
|
4527
|
-
}, _a.BadGateway = {
|
|
4528
|
-
statusCode: 502,
|
|
4529
|
-
message: "Bad Gateway"
|
|
4530
|
-
}, _a.ServiceUnavailable = {
|
|
4531
|
-
statusCode: 503,
|
|
4532
|
-
message: "Service Unavailable"
|
|
4533
|
-
}, _a.GatewayTimeout = {
|
|
4534
|
-
statusCode: 504,
|
|
4535
|
-
message: "Gateway Timeout"
|
|
4536
|
-
}, _a.HTTPVersionNotSupported = {
|
|
4537
|
-
statusCode: 505,
|
|
4538
|
-
message: "HTTP Version Not Supported"
|
|
4539
|
-
}, _a.VariantAlsoNegotiates = {
|
|
4540
|
-
statusCode: 506,
|
|
4541
|
-
message: "Variant Also Negotiates"
|
|
4542
|
-
}, _a.InsufficientStorage = {
|
|
4543
|
-
statusCode: 507,
|
|
4544
|
-
message: "Insufficient Storage"
|
|
4545
|
-
}, _a.LoopDetected = {
|
|
4546
|
-
statusCode: 508,
|
|
4547
|
-
message: "Loop Detected"
|
|
4548
|
-
}, _a.NotExtended = {
|
|
4549
|
-
statusCode: 510,
|
|
4550
|
-
message: "Not Extended"
|
|
4551
|
-
}, _a.NetworkAuthenticationRequired = {
|
|
4552
|
-
statusCode: 511,
|
|
4553
|
-
message: "Network Authentication Required"
|
|
4554
|
-
}, _a);
|
|
4555
|
-
StatusError.prototype.name = "StatusError";
|
|
4556
|
-
|
|
4557
|
-
// ../shared/dist/esm/utils/
|
|
4558
|
-
function
|
|
4559
|
-
|
|
4560
|
-
return
|
|
4204
|
+
}, _a.BadRequest = {
|
|
4205
|
+
statusCode: 400,
|
|
4206
|
+
message: "Bad Request"
|
|
4207
|
+
}, _a.Unauthorized = {
|
|
4208
|
+
statusCode: 401,
|
|
4209
|
+
message: "Unauthorized"
|
|
4210
|
+
}, _a.PaymentRequired = {
|
|
4211
|
+
statusCode: 402,
|
|
4212
|
+
message: "Payment Required"
|
|
4213
|
+
}, _a.Forbidden = {
|
|
4214
|
+
statusCode: 403,
|
|
4215
|
+
message: "Forbidden"
|
|
4216
|
+
}, _a.NotFound = {
|
|
4217
|
+
statusCode: 404,
|
|
4218
|
+
message: "Not Found"
|
|
4219
|
+
}, _a.MethodNotAllowed = {
|
|
4220
|
+
statusCode: 405,
|
|
4221
|
+
message: "Method Not Allowed"
|
|
4222
|
+
}, _a.NotAcceptable = {
|
|
4223
|
+
statusCode: 406,
|
|
4224
|
+
message: "Not Acceptable"
|
|
4225
|
+
}, _a.ProxyAuthenticationRequired = {
|
|
4226
|
+
statusCode: 407,
|
|
4227
|
+
message: "Proxy Authentication Required"
|
|
4228
|
+
}, _a.RequestTimeout = {
|
|
4229
|
+
statusCode: 408,
|
|
4230
|
+
message: "Request Timeout"
|
|
4231
|
+
}, _a.Conflict = {
|
|
4232
|
+
statusCode: 409,
|
|
4233
|
+
message: "Conflict"
|
|
4234
|
+
}, _a.Gone = {
|
|
4235
|
+
statusCode: 410,
|
|
4236
|
+
message: "Gone"
|
|
4237
|
+
}, _a.LengthRequired = {
|
|
4238
|
+
statusCode: 411,
|
|
4239
|
+
message: "Length Required"
|
|
4240
|
+
}, _a.PreconditionFailed = {
|
|
4241
|
+
statusCode: 412,
|
|
4242
|
+
message: "Precondition Failed"
|
|
4243
|
+
}, _a.PayloadTooLarge = {
|
|
4244
|
+
statusCode: 413,
|
|
4245
|
+
message: "Payload Too Large"
|
|
4246
|
+
}, _a.URITooLong = {
|
|
4247
|
+
statusCode: 414,
|
|
4248
|
+
message: "URI Too Long"
|
|
4249
|
+
}, _a.UnsupportedMediaType = {
|
|
4250
|
+
statusCode: 415,
|
|
4251
|
+
message: "Unsupported Media Type"
|
|
4252
|
+
}, _a.RangeNotSatisfiable = {
|
|
4253
|
+
statusCode: 416,
|
|
4254
|
+
message: "Range Not Satisfiable"
|
|
4255
|
+
}, _a.ExpectationFailed = {
|
|
4256
|
+
statusCode: 417,
|
|
4257
|
+
message: "Expectation Failed"
|
|
4258
|
+
}, _a.ImATeapot = {
|
|
4259
|
+
statusCode: 418,
|
|
4260
|
+
message: "I'm a teapot"
|
|
4261
|
+
}, _a.MisdirectedRequest = {
|
|
4262
|
+
statusCode: 421,
|
|
4263
|
+
message: "Misdirected Request"
|
|
4264
|
+
}, _a.UnprocessableEntity = {
|
|
4265
|
+
statusCode: 422,
|
|
4266
|
+
message: "Unprocessable Entity"
|
|
4267
|
+
}, _a.Locked = {
|
|
4268
|
+
statusCode: 423,
|
|
4269
|
+
message: "Locked"
|
|
4270
|
+
}, _a.FailedDependency = {
|
|
4271
|
+
statusCode: 424,
|
|
4272
|
+
message: "Failed Dependency"
|
|
4273
|
+
}, _a.TooEarly = {
|
|
4274
|
+
statusCode: 425,
|
|
4275
|
+
message: "Too Early"
|
|
4276
|
+
}, _a.UpgradeRequired = {
|
|
4277
|
+
statusCode: 426,
|
|
4278
|
+
message: "Upgrade Required"
|
|
4279
|
+
}, _a.PreconditionRequired = {
|
|
4280
|
+
statusCode: 428,
|
|
4281
|
+
message: "Precondition Required"
|
|
4282
|
+
}, _a.TooManyRequests = {
|
|
4283
|
+
statusCode: 429,
|
|
4284
|
+
message: "Too Many Requests"
|
|
4285
|
+
}, _a.RequestHeaderFieldsTooLarge = {
|
|
4286
|
+
statusCode: 431,
|
|
4287
|
+
message: "Request Header Fields Too Large"
|
|
4288
|
+
}, _a.UnavailableForLegalReasons = {
|
|
4289
|
+
statusCode: 451,
|
|
4290
|
+
message: "Unavailable For Legal Reasons"
|
|
4291
|
+
}, _a.InternalServerError = {
|
|
4292
|
+
statusCode: 500,
|
|
4293
|
+
message: "Internal Server Error"
|
|
4294
|
+
}, _a.NotImplemented = {
|
|
4295
|
+
statusCode: 501,
|
|
4296
|
+
message: "Not Implemented"
|
|
4297
|
+
}, _a.BadGateway = {
|
|
4298
|
+
statusCode: 502,
|
|
4299
|
+
message: "Bad Gateway"
|
|
4300
|
+
}, _a.ServiceUnavailable = {
|
|
4301
|
+
statusCode: 503,
|
|
4302
|
+
message: "Service Unavailable"
|
|
4303
|
+
}, _a.GatewayTimeout = {
|
|
4304
|
+
statusCode: 504,
|
|
4305
|
+
message: "Gateway Timeout"
|
|
4306
|
+
}, _a.HTTPVersionNotSupported = {
|
|
4307
|
+
statusCode: 505,
|
|
4308
|
+
message: "HTTP Version Not Supported"
|
|
4309
|
+
}, _a.VariantAlsoNegotiates = {
|
|
4310
|
+
statusCode: 506,
|
|
4311
|
+
message: "Variant Also Negotiates"
|
|
4312
|
+
}, _a.InsufficientStorage = {
|
|
4313
|
+
statusCode: 507,
|
|
4314
|
+
message: "Insufficient Storage"
|
|
4315
|
+
}, _a.LoopDetected = {
|
|
4316
|
+
statusCode: 508,
|
|
4317
|
+
message: "Loop Detected"
|
|
4318
|
+
}, _a.NotExtended = {
|
|
4319
|
+
statusCode: 510,
|
|
4320
|
+
message: "Not Extended"
|
|
4321
|
+
}, _a.NetworkAuthenticationRequired = {
|
|
4322
|
+
statusCode: 511,
|
|
4323
|
+
message: "Network Authentication Required"
|
|
4324
|
+
}, _a);
|
|
4325
|
+
StatusError.prototype.name = "StatusError";
|
|
4326
|
+
|
|
4327
|
+
// ../shared/dist/esm/utils/arrays.js
|
|
4328
|
+
function findLastIndex(arr, predicate) {
|
|
4329
|
+
for (let i = arr.length - 1; i >= 0; i--) if (predicate(arr[i])) return i;
|
|
4330
|
+
return -1;
|
|
4331
|
+
}
|
|
4332
|
+
function unique(arr) {
|
|
4333
|
+
return [...new Set(arr)];
|
|
4334
|
+
}
|
|
4335
|
+
|
|
4336
|
+
// ../shared/dist/esm/utils/strings.js
|
|
4337
|
+
function stringCompare(a26, b) {
|
|
4338
|
+
if (typeof a26 !== "string" || typeof b !== "string") throw new HexclaveAssertionError(`Expected two strings for stringCompare, found ${typeof a26} and ${typeof b}`, {
|
|
4339
|
+
a: a26,
|
|
4340
|
+
b
|
|
4341
|
+
});
|
|
4342
|
+
const cmp = (a27, b2) => a27 < b2 ? -1 : a27 > b2 ? 1 : 0;
|
|
4343
|
+
return cmp(a26.toUpperCase(), b.toUpperCase()) || cmp(b, a26);
|
|
4344
|
+
}
|
|
4345
|
+
function getWhitespacePrefix(s8) {
|
|
4346
|
+
return s8.substring(0, s8.length - s8.trimStart().length);
|
|
4347
|
+
}
|
|
4348
|
+
function trimEmptyLinesStart(s8) {
|
|
4349
|
+
const lines = s8.split("\n");
|
|
4350
|
+
const firstNonEmptyLineIndex = lines.findIndex((line) => line.trim() !== "");
|
|
4351
|
+
if (firstNonEmptyLineIndex === -1) return "";
|
|
4352
|
+
return lines.slice(firstNonEmptyLineIndex).join("\n");
|
|
4353
|
+
}
|
|
4354
|
+
function trimEmptyLinesEnd(s8) {
|
|
4355
|
+
const lines = s8.split("\n");
|
|
4356
|
+
const lastNonEmptyLineIndex = findLastIndex(lines, (line) => line.trim() !== "");
|
|
4357
|
+
return lines.slice(0, lastNonEmptyLineIndex + 1).join("\n");
|
|
4358
|
+
}
|
|
4359
|
+
function templateIdentity(strings, ...values) {
|
|
4360
|
+
if (values.length !== strings.length - 1) throw new HexclaveAssertionError("Invalid number of values; must be one less than strings", {
|
|
4361
|
+
strings,
|
|
4362
|
+
values
|
|
4363
|
+
});
|
|
4364
|
+
return strings.reduce((result, str, i) => result + str + (values[i] ?? ""), "");
|
|
4365
|
+
}
|
|
4366
|
+
function deindent(strings, ...values) {
|
|
4367
|
+
if (typeof strings === "string") return deindent([strings]);
|
|
4368
|
+
return templateIdentity(...deindentTemplate(strings, ...values));
|
|
4369
|
+
}
|
|
4370
|
+
function deindentTemplate(strings, ...values) {
|
|
4371
|
+
if (values.length !== strings.length - 1) throw new HexclaveAssertionError("Invalid number of values; must be one less than strings", {
|
|
4372
|
+
strings,
|
|
4373
|
+
values
|
|
4374
|
+
});
|
|
4375
|
+
const trimmedStrings = [...strings];
|
|
4376
|
+
trimmedStrings[0] = trimEmptyLinesStart(trimmedStrings[0] + "+").slice(0, -1);
|
|
4377
|
+
trimmedStrings[trimmedStrings.length - 1] = trimEmptyLinesEnd("+" + trimmedStrings[trimmedStrings.length - 1]).slice(1);
|
|
4378
|
+
const indentation = trimmedStrings.join("${SOME_VALUE}").split("\n").filter((line) => line.trim() !== "").map((line) => getWhitespacePrefix(line).length).reduce((min4, current) => Math.min(min4, current), Infinity);
|
|
4379
|
+
const deindentedStrings = trimmedStrings.map((string2, stringIndex) => {
|
|
4380
|
+
return string2.split("\n").map((line, lineIndex) => stringIndex !== 0 && lineIndex === 0 ? line : line.substring(indentation)).join("\n");
|
|
4381
|
+
});
|
|
4382
|
+
return [deindentedStrings, ...values.map((value, i) => {
|
|
4383
|
+
const firstLineIndentation = getWhitespacePrefix(deindentedStrings[i].split("\n").at(-1));
|
|
4384
|
+
return `${value}`.replaceAll("\n", `
|
|
4385
|
+
${firstLineIndentation}`);
|
|
4386
|
+
})];
|
|
4387
|
+
}
|
|
4388
|
+
function escapeTemplateLiteral(s8) {
|
|
4389
|
+
return s8.replaceAll("\\", "\\\\").replaceAll("`", "\\`").replaceAll("${", "\\${");
|
|
4390
|
+
}
|
|
4391
|
+
var nicifiableClassNameOverrides = new Map(Object.entries({ Headers }).map(([k3, v]) => [v, k3]));
|
|
4392
|
+
function nicify(value, options = {}) {
|
|
4393
|
+
const fullOptions = {
|
|
4394
|
+
maxDepth: 5,
|
|
4395
|
+
currentIndent: "",
|
|
4396
|
+
lineIndent: " ",
|
|
4397
|
+
multiline: true,
|
|
4398
|
+
refs: /* @__PURE__ */ new Map(),
|
|
4399
|
+
path: "value",
|
|
4400
|
+
parent: null,
|
|
4401
|
+
overrides: () => null,
|
|
4402
|
+
keyInParent: null,
|
|
4403
|
+
hideFields: [],
|
|
4404
|
+
...filterUndefined(options)
|
|
4405
|
+
};
|
|
4406
|
+
const { maxDepth, currentIndent, lineIndent, multiline, refs, path, overrides, hideFields } = fullOptions;
|
|
4407
|
+
const nl = `
|
|
4408
|
+
${currentIndent}`;
|
|
4409
|
+
const overrideResult = overrides(value, options);
|
|
4410
|
+
if (overrideResult !== null) return overrideResult;
|
|
4411
|
+
if ([
|
|
4412
|
+
"function",
|
|
4413
|
+
"object",
|
|
4414
|
+
"symbol"
|
|
4415
|
+
].includes(typeof value) && value !== null) {
|
|
4416
|
+
if (refs.has(value)) return `Ref<${refs.get(value)}>`;
|
|
4417
|
+
refs.set(value, path);
|
|
4418
|
+
}
|
|
4419
|
+
const newOptions = {
|
|
4420
|
+
maxDepth: maxDepth - 1,
|
|
4421
|
+
currentIndent,
|
|
4422
|
+
lineIndent,
|
|
4423
|
+
multiline,
|
|
4424
|
+
refs,
|
|
4425
|
+
path: path + "->[unknown property]",
|
|
4426
|
+
overrides,
|
|
4427
|
+
parent: {
|
|
4428
|
+
value,
|
|
4429
|
+
options: fullOptions
|
|
4430
|
+
},
|
|
4431
|
+
keyInParent: null,
|
|
4432
|
+
hideFields: []
|
|
4433
|
+
};
|
|
4434
|
+
const nestedNicify = (newValue, newPath, keyInParent, options2 = {}) => {
|
|
4435
|
+
return nicify(newValue, {
|
|
4436
|
+
...newOptions,
|
|
4437
|
+
path: newPath,
|
|
4438
|
+
currentIndent: currentIndent + lineIndent,
|
|
4439
|
+
keyInParent,
|
|
4440
|
+
...options2
|
|
4441
|
+
});
|
|
4442
|
+
};
|
|
4443
|
+
switch (typeof value) {
|
|
4444
|
+
case "boolean":
|
|
4445
|
+
case "number":
|
|
4446
|
+
return JSON.stringify(value);
|
|
4447
|
+
case "string": {
|
|
4448
|
+
const isDeindentable = (v) => deindent(v) === v && v.includes("\n");
|
|
4449
|
+
const wrapInDeindent = (v) => deindent`
|
|
4450
|
+
deindent\`
|
|
4451
|
+
${currentIndent + lineIndent}${escapeTemplateLiteral(v).replaceAll("\n", nl + lineIndent)}
|
|
4452
|
+
${currentIndent}\`
|
|
4453
|
+
`;
|
|
4454
|
+
if (isDeindentable(value)) return wrapInDeindent(value);
|
|
4455
|
+
else if (value.endsWith("\n") && isDeindentable(value.slice(0, -1))) return wrapInDeindent(value.slice(0, -1)) + ' + "\\n"';
|
|
4456
|
+
else return JSON.stringify(value);
|
|
4457
|
+
}
|
|
4458
|
+
case "undefined":
|
|
4459
|
+
return "undefined";
|
|
4460
|
+
case "symbol":
|
|
4461
|
+
return value.toString();
|
|
4462
|
+
case "bigint":
|
|
4463
|
+
return `${value}n`;
|
|
4464
|
+
case "function":
|
|
4465
|
+
if (value.name) return `function ${value.name}(...) { ... }`;
|
|
4466
|
+
return `(...) => { ... }`;
|
|
4467
|
+
case "object": {
|
|
4468
|
+
if (value === null) return "null";
|
|
4469
|
+
if (Array.isArray(value)) {
|
|
4470
|
+
const extraLines2 = getNicifiedObjectExtraLines(value);
|
|
4471
|
+
const resValueLength2 = value.length + extraLines2.length;
|
|
4472
|
+
if (resValueLength2 === 0) return "[]";
|
|
4473
|
+
if (maxDepth <= 0) return `[...]`;
|
|
4474
|
+
const resValues2 = value.map((v, i) => nestedNicify(v, `${path}[${i}]`, i));
|
|
4475
|
+
resValues2.push(...extraLines2);
|
|
4476
|
+
if (resValues2.length !== resValueLength2) throw new HexclaveAssertionError("nicify of object: resValues.length !== resValueLength", {
|
|
4477
|
+
value,
|
|
4478
|
+
resValues: resValues2,
|
|
4479
|
+
resValueLength: resValueLength2
|
|
4480
|
+
});
|
|
4481
|
+
if (resValues2.length > 4 || resValues2.some((x) => resValues2.length > 1 && x.length > 4 || x.includes("\n"))) return `[${nl}${resValues2.map((x) => `${lineIndent}${x},${nl}`).join("")}]`;
|
|
4482
|
+
else return `[${resValues2.join(", ")}]`;
|
|
4483
|
+
}
|
|
4484
|
+
if (value instanceof Date) return `Date(${nestedNicify(value.toISOString(), `${path}.toISOString()`, null)})`;
|
|
4485
|
+
if (value instanceof URL) return `URL(${nestedNicify(value.toString(), `${path}.toString()`, null)})`;
|
|
4486
|
+
if (ArrayBuffer.isView(value)) return `${value.constructor.name}([${value.toString()}])`;
|
|
4487
|
+
if (value instanceof ArrayBuffer) return `ArrayBuffer [${new Uint8Array(value).toString()}]`;
|
|
4488
|
+
if (value instanceof Error) {
|
|
4489
|
+
let stack = value.stack ?? "";
|
|
4490
|
+
const toString3 = value.toString();
|
|
4491
|
+
if (!stack.startsWith(toString3)) stack = `${toString3}
|
|
4492
|
+
${stack}`;
|
|
4493
|
+
stack = stack.trimEnd();
|
|
4494
|
+
stack = stack.replace(/\n\s+/g, `
|
|
4495
|
+
${lineIndent}${lineIndent}`);
|
|
4496
|
+
stack = stack.replace("\n", `
|
|
4497
|
+
${lineIndent}Stack:
|
|
4498
|
+
`);
|
|
4499
|
+
if (Object.keys(value).length > 0) stack += `
|
|
4500
|
+
${lineIndent}Extra properties: ${nestedNicify(Object.fromEntries(Object.entries(value)), path, null)}`;
|
|
4501
|
+
if (value.cause) stack += `
|
|
4502
|
+
${lineIndent}Cause:
|
|
4503
|
+
${lineIndent}${lineIndent}${nestedNicify(value.cause, path, null, { currentIndent: currentIndent + lineIndent + lineIndent })}`;
|
|
4504
|
+
stack = stack.replaceAll("\n", `
|
|
4505
|
+
${currentIndent}`);
|
|
4506
|
+
return stack;
|
|
4507
|
+
}
|
|
4508
|
+
const constructorName = [null, Object.prototype].includes(Object.getPrototypeOf(value)) ? null : nicifiableClassNameOverrides.get(value.constructor) ?? value.constructor.name;
|
|
4509
|
+
const constructorString = constructorName ? `${constructorName} ` : "";
|
|
4510
|
+
const entries = getNicifiableEntries(value).filter(([k3]) => !hideFields.includes(k3));
|
|
4511
|
+
const extraLines = [...getNicifiedObjectExtraLines(value), ...hideFields.length > 0 ? [`<some fields may have been hidden>`] : []];
|
|
4512
|
+
const resValueLength = entries.length + extraLines.length;
|
|
4513
|
+
if (resValueLength === 0) return `${constructorString}{}`;
|
|
4514
|
+
if (maxDepth <= 0) return `${constructorString}{ ... }`;
|
|
4515
|
+
const resValues = entries.map(([k3, v], keyIndex) => {
|
|
4516
|
+
const keyNicified = nestedNicify(k3, `Object.keys(${path})[${keyIndex}]`, null);
|
|
4517
|
+
const keyInObjectLiteral = typeof k3 === "string" ? nicifyPropertyString(k3) : `[${keyNicified}]`;
|
|
4518
|
+
if (typeof v === "function" && v.name === k3) return `${keyInObjectLiteral}(...): { ... }`;
|
|
4519
|
+
else return `${keyInObjectLiteral}: ${nestedNicify(v, `${path}[${keyNicified}]`, k3)}`;
|
|
4520
|
+
});
|
|
4521
|
+
resValues.push(...extraLines);
|
|
4522
|
+
if (resValues.length !== resValueLength) throw new HexclaveAssertionError("nicify of object: resValues.length !== resValueLength", {
|
|
4523
|
+
value,
|
|
4524
|
+
resValues,
|
|
4525
|
+
resValueLength
|
|
4526
|
+
});
|
|
4527
|
+
const shouldIndent = resValues.length > 1 || resValues.some((x) => x.includes("\n"));
|
|
4528
|
+
if (resValues.length === 0) return `${constructorString}{}`;
|
|
4529
|
+
if (shouldIndent) return `${constructorString}{${nl}${resValues.map((x) => `${lineIndent}${x},${nl}`).join("")}}`;
|
|
4530
|
+
else return `${constructorString}{ ${resValues.join(", ")} }`;
|
|
4531
|
+
}
|
|
4532
|
+
default:
|
|
4533
|
+
return `${typeof value}<${value}>`;
|
|
4534
|
+
}
|
|
4561
4535
|
}
|
|
4562
|
-
function
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
if (
|
|
4568
|
-
|
|
4569
|
-
|
|
4536
|
+
function nicifyPropertyString(str) {
|
|
4537
|
+
return JSON.stringify(str);
|
|
4538
|
+
}
|
|
4539
|
+
function getNicifiableKeys(value) {
|
|
4540
|
+
const overridden = ("getNicifiableKeys" in value ? value.getNicifiableKeys?.bind(value) : null)?.();
|
|
4541
|
+
if (overridden != null) return overridden;
|
|
4542
|
+
if (value instanceof Response) return ["status", "headers"];
|
|
4543
|
+
return unique(Object.keys(value).sort());
|
|
4544
|
+
}
|
|
4545
|
+
function getNicifiableEntries(value) {
|
|
4546
|
+
const recordLikes = [Headers];
|
|
4547
|
+
function isRecordLike(value2) {
|
|
4548
|
+
return recordLikes.some((x) => value2 instanceof x);
|
|
4570
4549
|
}
|
|
4571
|
-
return
|
|
4550
|
+
if (isRecordLike(value)) return [...value.entries()].sort(([a26], [b]) => stringCompare(`${a26}`, `${b}`));
|
|
4551
|
+
return getNicifiableKeys(value).map((k3) => [k3, value[k3]]);
|
|
4572
4552
|
}
|
|
4573
|
-
function
|
|
4574
|
-
|
|
4575
|
-
return getEnvVarWithHexclaveFallback(name);
|
|
4553
|
+
function getNicifiedObjectExtraLines(value) {
|
|
4554
|
+
return ("getNicifiedObjectExtraLines" in value ? value.getNicifiedObjectExtraLines : null)?.() ?? [];
|
|
4576
4555
|
}
|
|
4577
4556
|
|
|
4578
4557
|
// ../shared/dist/esm/utils/results.js
|
|
@@ -7849,6 +7828,27 @@ attempted value: ${formattedValue}
|
|
|
7849
7828
|
}
|
|
7850
7829
|
];
|
|
7851
7830
|
|
|
7831
|
+
// ../shared/dist/esm/utils/env.js
|
|
7832
|
+
function resolveHexclaveStackEnvVarValue(hexclaveName, stackName, hexclaveValue, stackValue) {
|
|
7833
|
+
if (hexclaveValue && stackValue && hexclaveValue !== stackValue) throw new Error(`Environment variables ${hexclaveName} and ${stackName} are both set to different values. Remove one of them or set them to the same value.`);
|
|
7834
|
+
return hexclaveValue || stackValue || void 0;
|
|
7835
|
+
}
|
|
7836
|
+
function getEnvVarWithHexclaveFallback(name) {
|
|
7837
|
+
if (name.includes("STACK_")) {
|
|
7838
|
+
const hexclaveName = name.replace("STACK_", "HEXCLAVE_");
|
|
7839
|
+
return resolveHexclaveStackEnvVarValue(hexclaveName, name, process.env[hexclaveName], process.env[name]);
|
|
7840
|
+
}
|
|
7841
|
+
if (name.includes("HEXCLAVE_")) {
|
|
7842
|
+
const stackName = name.replace("HEXCLAVE_", "STACK_");
|
|
7843
|
+
return resolveHexclaveStackEnvVarValue(name, stackName, process.env[name], process.env[stackName]);
|
|
7844
|
+
}
|
|
7845
|
+
return process.env[name];
|
|
7846
|
+
}
|
|
7847
|
+
function getProcessEnv(name) {
|
|
7848
|
+
if (typeof process === "undefined" || typeof process.env === "undefined") return;
|
|
7849
|
+
return getEnvVarWithHexclaveFallback(name);
|
|
7850
|
+
}
|
|
7851
|
+
|
|
7852
7852
|
// ../shared/dist/esm/utils/http.js
|
|
7853
7853
|
function decodeBasicAuthorizationHeader(value) {
|
|
7854
7854
|
const [type, encoded, ...rest] = value.split(" ");
|
|
@@ -8806,210 +8806,6 @@ attempted value: ${formattedValue}
|
|
|
8806
8806
|
diff: yupString().optional()
|
|
8807
8807
|
});
|
|
8808
8808
|
|
|
8809
|
-
// ../../node_modules/.pnpm/async-mutex@0.5.0/node_modules/async-mutex/index.mjs
|
|
8810
|
-
var E_TIMEOUT = new Error("timeout while waiting for mutex to become available");
|
|
8811
|
-
var E_ALREADY_LOCKED = new Error("mutex already locked");
|
|
8812
|
-
var E_CANCELED = new Error("request for lock canceled");
|
|
8813
|
-
var __awaiter$2 = function(thisArg, _arguments, P2, generator) {
|
|
8814
|
-
function adopt(value) {
|
|
8815
|
-
return value instanceof P2 ? value : new P2(function(resolve) {
|
|
8816
|
-
resolve(value);
|
|
8817
|
-
});
|
|
8818
|
-
}
|
|
8819
|
-
return new (P2 || (P2 = Promise))(function(resolve, reject) {
|
|
8820
|
-
function fulfilled(value) {
|
|
8821
|
-
try {
|
|
8822
|
-
step(generator.next(value));
|
|
8823
|
-
} catch (e40) {
|
|
8824
|
-
reject(e40);
|
|
8825
|
-
}
|
|
8826
|
-
}
|
|
8827
|
-
function rejected2(value) {
|
|
8828
|
-
try {
|
|
8829
|
-
step(generator["throw"](value));
|
|
8830
|
-
} catch (e40) {
|
|
8831
|
-
reject(e40);
|
|
8832
|
-
}
|
|
8833
|
-
}
|
|
8834
|
-
function step(result) {
|
|
8835
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected2);
|
|
8836
|
-
}
|
|
8837
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8838
|
-
});
|
|
8839
|
-
};
|
|
8840
|
-
var Semaphore = class {
|
|
8841
|
-
constructor(_value, _cancelError = E_CANCELED) {
|
|
8842
|
-
this._value = _value;
|
|
8843
|
-
this._cancelError = _cancelError;
|
|
8844
|
-
this._queue = [];
|
|
8845
|
-
this._weightedWaiters = [];
|
|
8846
|
-
}
|
|
8847
|
-
acquire(weight = 1, priority = 0) {
|
|
8848
|
-
if (weight <= 0)
|
|
8849
|
-
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
8850
|
-
return new Promise((resolve, reject) => {
|
|
8851
|
-
const task = { resolve, reject, weight, priority };
|
|
8852
|
-
const i = findIndexFromEnd(this._queue, (other) => priority <= other.priority);
|
|
8853
|
-
if (i === -1 && weight <= this._value) {
|
|
8854
|
-
this._dispatchItem(task);
|
|
8855
|
-
} else {
|
|
8856
|
-
this._queue.splice(i + 1, 0, task);
|
|
8857
|
-
}
|
|
8858
|
-
});
|
|
8859
|
-
}
|
|
8860
|
-
runExclusive(callback_1) {
|
|
8861
|
-
return __awaiter$2(this, arguments, void 0, function* (callback, weight = 1, priority = 0) {
|
|
8862
|
-
const [value, release] = yield this.acquire(weight, priority);
|
|
8863
|
-
try {
|
|
8864
|
-
return yield callback(value);
|
|
8865
|
-
} finally {
|
|
8866
|
-
release();
|
|
8867
|
-
}
|
|
8868
|
-
});
|
|
8869
|
-
}
|
|
8870
|
-
waitForUnlock(weight = 1, priority = 0) {
|
|
8871
|
-
if (weight <= 0)
|
|
8872
|
-
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
8873
|
-
if (this._couldLockImmediately(weight, priority)) {
|
|
8874
|
-
return Promise.resolve();
|
|
8875
|
-
} else {
|
|
8876
|
-
return new Promise((resolve) => {
|
|
8877
|
-
if (!this._weightedWaiters[weight - 1])
|
|
8878
|
-
this._weightedWaiters[weight - 1] = [];
|
|
8879
|
-
insertSorted(this._weightedWaiters[weight - 1], { resolve, priority });
|
|
8880
|
-
});
|
|
8881
|
-
}
|
|
8882
|
-
}
|
|
8883
|
-
isLocked() {
|
|
8884
|
-
return this._value <= 0;
|
|
8885
|
-
}
|
|
8886
|
-
getValue() {
|
|
8887
|
-
return this._value;
|
|
8888
|
-
}
|
|
8889
|
-
setValue(value) {
|
|
8890
|
-
this._value = value;
|
|
8891
|
-
this._dispatchQueue();
|
|
8892
|
-
}
|
|
8893
|
-
release(weight = 1) {
|
|
8894
|
-
if (weight <= 0)
|
|
8895
|
-
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
8896
|
-
this._value += weight;
|
|
8897
|
-
this._dispatchQueue();
|
|
8898
|
-
}
|
|
8899
|
-
cancel() {
|
|
8900
|
-
this._queue.forEach((entry) => entry.reject(this._cancelError));
|
|
8901
|
-
this._queue = [];
|
|
8902
|
-
}
|
|
8903
|
-
_dispatchQueue() {
|
|
8904
|
-
this._drainUnlockWaiters();
|
|
8905
|
-
while (this._queue.length > 0 && this._queue[0].weight <= this._value) {
|
|
8906
|
-
this._dispatchItem(this._queue.shift());
|
|
8907
|
-
this._drainUnlockWaiters();
|
|
8908
|
-
}
|
|
8909
|
-
}
|
|
8910
|
-
_dispatchItem(item) {
|
|
8911
|
-
const previousValue = this._value;
|
|
8912
|
-
this._value -= item.weight;
|
|
8913
|
-
item.resolve([previousValue, this._newReleaser(item.weight)]);
|
|
8914
|
-
}
|
|
8915
|
-
_newReleaser(weight) {
|
|
8916
|
-
let called = false;
|
|
8917
|
-
return () => {
|
|
8918
|
-
if (called)
|
|
8919
|
-
return;
|
|
8920
|
-
called = true;
|
|
8921
|
-
this.release(weight);
|
|
8922
|
-
};
|
|
8923
|
-
}
|
|
8924
|
-
_drainUnlockWaiters() {
|
|
8925
|
-
if (this._queue.length === 0) {
|
|
8926
|
-
for (let weight = this._value; weight > 0; weight--) {
|
|
8927
|
-
const waiters = this._weightedWaiters[weight - 1];
|
|
8928
|
-
if (!waiters)
|
|
8929
|
-
continue;
|
|
8930
|
-
waiters.forEach((waiter) => waiter.resolve());
|
|
8931
|
-
this._weightedWaiters[weight - 1] = [];
|
|
8932
|
-
}
|
|
8933
|
-
} else {
|
|
8934
|
-
const queuedPriority = this._queue[0].priority;
|
|
8935
|
-
for (let weight = this._value; weight > 0; weight--) {
|
|
8936
|
-
const waiters = this._weightedWaiters[weight - 1];
|
|
8937
|
-
if (!waiters)
|
|
8938
|
-
continue;
|
|
8939
|
-
const i = waiters.findIndex((waiter) => waiter.priority <= queuedPriority);
|
|
8940
|
-
(i === -1 ? waiters : waiters.splice(0, i)).forEach((waiter) => waiter.resolve());
|
|
8941
|
-
}
|
|
8942
|
-
}
|
|
8943
|
-
}
|
|
8944
|
-
_couldLockImmediately(weight, priority) {
|
|
8945
|
-
return (this._queue.length === 0 || this._queue[0].priority < priority) && weight <= this._value;
|
|
8946
|
-
}
|
|
8947
|
-
};
|
|
8948
|
-
function insertSorted(a26, v) {
|
|
8949
|
-
const i = findIndexFromEnd(a26, (other) => v.priority <= other.priority);
|
|
8950
|
-
a26.splice(i + 1, 0, v);
|
|
8951
|
-
}
|
|
8952
|
-
function findIndexFromEnd(a26, predicate) {
|
|
8953
|
-
for (let i = a26.length - 1; i >= 0; i--) {
|
|
8954
|
-
if (predicate(a26[i])) {
|
|
8955
|
-
return i;
|
|
8956
|
-
}
|
|
8957
|
-
}
|
|
8958
|
-
return -1;
|
|
8959
|
-
}
|
|
8960
|
-
|
|
8961
|
-
// ../shared/dist/esm/utils/locks.js
|
|
8962
|
-
var ReadWriteLock = class {
|
|
8963
|
-
constructor() {
|
|
8964
|
-
this.semaphore = new Semaphore(1);
|
|
8965
|
-
this.readers = 0;
|
|
8966
|
-
this.readersMutex = new Semaphore(1);
|
|
8967
|
-
}
|
|
8968
|
-
async withReadLock(callback) {
|
|
8969
|
-
await this._acquireReadLock();
|
|
8970
|
-
try {
|
|
8971
|
-
return await callback();
|
|
8972
|
-
} finally {
|
|
8973
|
-
await this._releaseReadLock();
|
|
8974
|
-
}
|
|
8975
|
-
}
|
|
8976
|
-
async withWriteLock(callback) {
|
|
8977
|
-
await this._acquireWriteLock();
|
|
8978
|
-
try {
|
|
8979
|
-
return await callback();
|
|
8980
|
-
} finally {
|
|
8981
|
-
await this._releaseWriteLock();
|
|
8982
|
-
}
|
|
8983
|
-
}
|
|
8984
|
-
async _acquireReadLock() {
|
|
8985
|
-
await this.readersMutex.acquire();
|
|
8986
|
-
try {
|
|
8987
|
-
this.readers += 1;
|
|
8988
|
-
if (this.readers === 1) await this.semaphore.acquire();
|
|
8989
|
-
} finally {
|
|
8990
|
-
this.readersMutex.release();
|
|
8991
|
-
}
|
|
8992
|
-
}
|
|
8993
|
-
async _releaseReadLock() {
|
|
8994
|
-
await this.readersMutex.acquire();
|
|
8995
|
-
try {
|
|
8996
|
-
this.readers -= 1;
|
|
8997
|
-
if (this.readers === 0) this.semaphore.release();
|
|
8998
|
-
} finally {
|
|
8999
|
-
this.readersMutex.release();
|
|
9000
|
-
}
|
|
9001
|
-
}
|
|
9002
|
-
async _acquireWriteLock() {
|
|
9003
|
-
await this.semaphore.acquire();
|
|
9004
|
-
}
|
|
9005
|
-
async _releaseWriteLock() {
|
|
9006
|
-
this.semaphore.release();
|
|
9007
|
-
}
|
|
9008
|
-
};
|
|
9009
|
-
|
|
9010
|
-
// ../shared/dist/esm/utils/stores.js
|
|
9011
|
-
var storeLock = new ReadWriteLock();
|
|
9012
|
-
|
|
9013
8809
|
// ../shared/dist/esm/interface/client-interface.js
|
|
9014
8810
|
var USER_AGENT;
|
|
9015
8811
|
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) USER_AGENT = `oauth4webapi/v3.8.5`;
|