claude-threads 1.36.1 → 1.37.1
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/CHANGELOG.md +22 -0
- package/bin/claude-threads-daemon +8 -0
- package/dist/index.js +1800 -2217
- package/dist/mcp/mcp-server.js +717 -543
- package/docs/CONFIGURATION.md +27 -0
- package/docs/systemd/claude-threads.service +3 -0
- package/docs/turn-marker-spec.md +149 -0
- package/package.json +4 -4
package/dist/mcp/mcp-server.js
CHANGED
|
@@ -12676,6 +12676,29 @@ var init_emoji = __esm(() => {
|
|
|
12676
12676
|
ALLOW_ALL_EMOJIS = ["white_check_mark", "heavy_check_mark"];
|
|
12677
12677
|
});
|
|
12678
12678
|
|
|
12679
|
+
// src/config/types.ts
|
|
12680
|
+
var STDIO_KEYS, REMOTE_KEYS;
|
|
12681
|
+
var init_types = __esm(() => {
|
|
12682
|
+
STDIO_KEYS = new Set(["type", "command", "args", "env"]);
|
|
12683
|
+
REMOTE_KEYS = new Set(["type", "url", "headers"]);
|
|
12684
|
+
});
|
|
12685
|
+
|
|
12686
|
+
// src/utils/spawn.ts
|
|
12687
|
+
import { spawn as nodeSpawn, spawnSync as nodeSpawnSync } from "child_process";
|
|
12688
|
+
function addWindowsShell(options) {
|
|
12689
|
+
if (isWindows && options.shell === undefined) {
|
|
12690
|
+
return { ...options, shell: true };
|
|
12691
|
+
}
|
|
12692
|
+
return options;
|
|
12693
|
+
}
|
|
12694
|
+
function crossSpawn(command, args, options) {
|
|
12695
|
+
return nodeSpawn(command, args, addWindowsShell(options ?? {}));
|
|
12696
|
+
}
|
|
12697
|
+
var isWindows;
|
|
12698
|
+
var init_spawn = __esm(() => {
|
|
12699
|
+
isWindows = process.platform === "win32";
|
|
12700
|
+
});
|
|
12701
|
+
|
|
12679
12702
|
// src/utils/logger.ts
|
|
12680
12703
|
function createLogger(component, useStderr = false, sessionId) {
|
|
12681
12704
|
const isDebug = () => process.env.DEBUG === "1";
|
|
@@ -14593,7 +14616,7 @@ var require_semver2 = __commonJS(function(exports, module) {
|
|
|
14593
14616
|
|
|
14594
14617
|
// src/claude/version-check.ts
|
|
14595
14618
|
import { execSync } from "child_process";
|
|
14596
|
-
import { existsSync
|
|
14619
|
+
import { existsSync } from "fs";
|
|
14597
14620
|
import { join } from "path";
|
|
14598
14621
|
function tryClaudeVersion(claudePath) {
|
|
14599
14622
|
try {
|
|
@@ -14646,7 +14669,7 @@ function getClaudePath() {
|
|
|
14646
14669
|
return whichResult;
|
|
14647
14670
|
}
|
|
14648
14671
|
for (const path of COMMON_CLAUDE_PATHS) {
|
|
14649
|
-
if (
|
|
14672
|
+
if (existsSync(path)) {
|
|
14650
14673
|
const result = tryClaudeVersion(path);
|
|
14651
14674
|
if (!result.error) {
|
|
14652
14675
|
discoveredClaudePath = path;
|
|
@@ -14674,29 +14697,6 @@ var init_version_check = __esm(() => {
|
|
|
14674
14697
|
];
|
|
14675
14698
|
});
|
|
14676
14699
|
|
|
14677
|
-
// src/utils/spawn.ts
|
|
14678
|
-
import { spawn as nodeSpawn, spawnSync as nodeSpawnSync } from "child_process";
|
|
14679
|
-
function addWindowsShell(options) {
|
|
14680
|
-
if (isWindows && options.shell === undefined) {
|
|
14681
|
-
return { ...options, shell: true };
|
|
14682
|
-
}
|
|
14683
|
-
return options;
|
|
14684
|
-
}
|
|
14685
|
-
function crossSpawn(command, args, options) {
|
|
14686
|
-
return nodeSpawn(command, args, addWindowsShell(options ?? {}));
|
|
14687
|
-
}
|
|
14688
|
-
var isWindows;
|
|
14689
|
-
var init_spawn = __esm(() => {
|
|
14690
|
-
isWindows = process.platform === "win32";
|
|
14691
|
-
});
|
|
14692
|
-
|
|
14693
|
-
// src/config/types.ts
|
|
14694
|
-
var STDIO_KEYS, REMOTE_KEYS;
|
|
14695
|
-
var init_types = __esm(() => {
|
|
14696
|
-
STDIO_KEYS = new Set(["type", "command", "args", "env"]);
|
|
14697
|
-
REMOTE_KEYS = new Set(["type", "url", "headers"]);
|
|
14698
|
-
});
|
|
14699
|
-
|
|
14700
14700
|
// src/mcp/outbound-env.ts
|
|
14701
14701
|
var OUTBOUND_ENV;
|
|
14702
14702
|
var init_outbound_env = __esm(() => {
|
|
@@ -14759,7 +14759,7 @@ function buildClaudeChildEnv(parentEnv, account, opts) {
|
|
|
14759
14759
|
}
|
|
14760
14760
|
return env;
|
|
14761
14761
|
}
|
|
14762
|
-
var
|
|
14762
|
+
var log, STDERR_AGGREGATE_SOFT_CAP;
|
|
14763
14763
|
var init_cli = __esm(() => {
|
|
14764
14764
|
init_types();
|
|
14765
14765
|
init_spawn();
|
|
@@ -14768,7 +14768,7 @@ var init_cli = __esm(() => {
|
|
|
14768
14768
|
init_outbound_env();
|
|
14769
14769
|
init_agent_features_env();
|
|
14770
14770
|
init_rate_limit_detector();
|
|
14771
|
-
|
|
14771
|
+
log = createLogger("claude");
|
|
14772
14772
|
STDERR_AGGREGATE_SOFT_CAP = 10 * 1024 * 1024;
|
|
14773
14773
|
});
|
|
14774
14774
|
|
|
@@ -15007,7 +15007,7 @@ var init_render = __esm(() => {
|
|
|
15007
15007
|
});
|
|
15008
15008
|
|
|
15009
15009
|
// src/usage/index.ts
|
|
15010
|
-
import { homedir as
|
|
15010
|
+
import { homedir as homedir2 } from "os";
|
|
15011
15011
|
import path4 from "path";
|
|
15012
15012
|
function toLimits(usage) {
|
|
15013
15013
|
const limits = [
|
|
@@ -15057,7 +15057,7 @@ async function collectUsage(options) {
|
|
|
15057
15057
|
}
|
|
15058
15058
|
return results;
|
|
15059
15059
|
}
|
|
15060
|
-
const configDir = process.env.CLAUDE_CONFIG_DIR ?? path4.join(
|
|
15060
|
+
const configDir = process.env.CLAUDE_CONFIG_DIR ?? path4.join(homedir2(), ".claude");
|
|
15061
15061
|
return [await readSeat(profileNameFor(configDir), configDir)];
|
|
15062
15062
|
}
|
|
15063
15063
|
var USAGE_PROBE_TIMEOUT_MS = 1e4;
|
|
@@ -21824,18 +21824,23 @@ function jsonStringifyReplacer(_, value) {
|
|
|
21824
21824
|
return value.toString();
|
|
21825
21825
|
return value;
|
|
21826
21826
|
}
|
|
21827
|
-
|
|
21828
|
-
|
|
21829
|
-
|
|
21830
|
-
|
|
21831
|
-
|
|
21832
|
-
|
|
21833
|
-
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
|
|
21827
|
+
|
|
21828
|
+
class Cached {
|
|
21829
|
+
constructor(getter) {
|
|
21830
|
+
this._getter = getter;
|
|
21831
|
+
this._value = undefined;
|
|
21832
|
+
}
|
|
21833
|
+
get value() {
|
|
21834
|
+
const getter = this._getter;
|
|
21835
|
+
if (getter !== undefined) {
|
|
21836
|
+
this._value = getter();
|
|
21837
|
+
this._getter = undefined;
|
|
21837
21838
|
}
|
|
21838
|
-
|
|
21839
|
+
return this._value;
|
|
21840
|
+
}
|
|
21841
|
+
}
|
|
21842
|
+
function cached(getter) {
|
|
21843
|
+
return new Cached(getter);
|
|
21839
21844
|
}
|
|
21840
21845
|
function nullish(input) {
|
|
21841
21846
|
return input === null || input === undefined;
|
|
@@ -21861,6 +21866,56 @@ function assignProp(target, prop, value) {
|
|
|
21861
21866
|
configurable: true
|
|
21862
21867
|
});
|
|
21863
21868
|
}
|
|
21869
|
+
function rawShape(def) {
|
|
21870
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
21871
|
+
return desc?.get ? desc.get.raw : desc?.value;
|
|
21872
|
+
}
|
|
21873
|
+
function sourceShape(schema) {
|
|
21874
|
+
return rawShape(schema._zod.def) ?? schema._zod.def.shape;
|
|
21875
|
+
}
|
|
21876
|
+
function deferProp(target, key, getter) {
|
|
21877
|
+
Object.defineProperty(target, key, {
|
|
21878
|
+
get() {
|
|
21879
|
+
const value = getter();
|
|
21880
|
+
assignProp(this, key, value);
|
|
21881
|
+
return value;
|
|
21882
|
+
},
|
|
21883
|
+
enumerable: true,
|
|
21884
|
+
configurable: true
|
|
21885
|
+
});
|
|
21886
|
+
}
|
|
21887
|
+
function putProp(target, key, value) {
|
|
21888
|
+
if (key in target)
|
|
21889
|
+
assignProp(target, key, value);
|
|
21890
|
+
else
|
|
21891
|
+
target[key] = value;
|
|
21892
|
+
}
|
|
21893
|
+
function mirrorShape(target, source, keys, wrap) {
|
|
21894
|
+
const raw = sourceShape(source);
|
|
21895
|
+
for (const key of keys) {
|
|
21896
|
+
const desc = Object.getOwnPropertyDescriptor(raw, key);
|
|
21897
|
+
if (!desc.enumerable)
|
|
21898
|
+
continue;
|
|
21899
|
+
if (desc.get) {
|
|
21900
|
+
deferProp(target, key, () => {
|
|
21901
|
+
const value = source._zod.def.shape[key];
|
|
21902
|
+
return wrap ? wrap(value, key) : value;
|
|
21903
|
+
});
|
|
21904
|
+
} else
|
|
21905
|
+
putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
|
|
21906
|
+
}
|
|
21907
|
+
}
|
|
21908
|
+
function mirrorProps(target, source) {
|
|
21909
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
21910
|
+
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
21911
|
+
if (!desc.enumerable)
|
|
21912
|
+
continue;
|
|
21913
|
+
if (desc.get)
|
|
21914
|
+
deferProp(target, key, () => source[key]);
|
|
21915
|
+
else
|
|
21916
|
+
putProp(target, key, desc.value);
|
|
21917
|
+
}
|
|
21918
|
+
}
|
|
21864
21919
|
function mergeDefs(...defs) {
|
|
21865
21920
|
const mergedDescriptors = {};
|
|
21866
21921
|
for (const def of defs) {
|
|
@@ -21966,6 +22021,10 @@ var NUMBER_FORMAT_RANGES = /* @__PURE__ */ (() => ({
|
|
|
21966
22021
|
float32: [-340282346638528860000000000000000000000, 340282346638528860000000000000000000000],
|
|
21967
22022
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
21968
22023
|
}))();
|
|
22024
|
+
var BIGINT_FORMAT_RANGES = {
|
|
22025
|
+
int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
|
|
22026
|
+
uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
|
|
22027
|
+
};
|
|
21969
22028
|
function pick(schema, mask) {
|
|
21970
22029
|
const currDef = schema._zod.def;
|
|
21971
22030
|
const checks = currDef.checks;
|
|
@@ -21973,23 +22032,21 @@ function pick(schema, mask) {
|
|
|
21973
22032
|
if (hasChecks) {
|
|
21974
22033
|
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
21975
22034
|
}
|
|
21976
|
-
const
|
|
21977
|
-
|
|
21978
|
-
|
|
21979
|
-
|
|
21980
|
-
|
|
21981
|
-
|
|
21982
|
-
|
|
21983
|
-
|
|
21984
|
-
|
|
21985
|
-
|
|
21986
|
-
|
|
21987
|
-
|
|
21988
|
-
|
|
21989
|
-
|
|
21990
|
-
|
|
21991
|
-
});
|
|
21992
|
-
return clone(schema, def);
|
|
22035
|
+
const newShape = {};
|
|
22036
|
+
mirrorShape(newShape, schema, maskedKeys(schema, mask));
|
|
22037
|
+
return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
|
|
22038
|
+
}
|
|
22039
|
+
function maskedKeys(schema, mask) {
|
|
22040
|
+
const raw = sourceShape(schema);
|
|
22041
|
+
const keys = [];
|
|
22042
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
22043
|
+
if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
|
|
22044
|
+
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
22045
|
+
}
|
|
22046
|
+
if (mask[key])
|
|
22047
|
+
keys.push(key);
|
|
22048
|
+
}
|
|
22049
|
+
return keys;
|
|
21993
22050
|
}
|
|
21994
22051
|
function omit(schema, mask) {
|
|
21995
22052
|
const currDef = schema._zod.def;
|
|
@@ -21998,23 +22055,10 @@ function omit(schema, mask) {
|
|
|
21998
22055
|
if (hasChecks) {
|
|
21999
22056
|
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
22000
22057
|
}
|
|
22001
|
-
const
|
|
22002
|
-
|
|
22003
|
-
|
|
22004
|
-
|
|
22005
|
-
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
|
|
22006
|
-
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
22007
|
-
}
|
|
22008
|
-
if (!mask[key])
|
|
22009
|
-
continue;
|
|
22010
|
-
delete newShape[key];
|
|
22011
|
-
}
|
|
22012
|
-
assignProp(this, "shape", newShape);
|
|
22013
|
-
return newShape;
|
|
22014
|
-
},
|
|
22015
|
-
checks: []
|
|
22016
|
-
});
|
|
22017
|
-
return clone(schema, def);
|
|
22058
|
+
const omitted = new Set(maskedKeys(schema, mask));
|
|
22059
|
+
const newShape = {};
|
|
22060
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
|
|
22061
|
+
return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
|
|
22018
22062
|
}
|
|
22019
22063
|
function extend(schema, shape) {
|
|
22020
22064
|
if (!isPlainObject(shape)) {
|
|
@@ -22023,34 +22067,26 @@ function extend(schema, shape) {
|
|
|
22023
22067
|
const checks = schema._zod.def.checks;
|
|
22024
22068
|
const hasChecks = checks && checks.length > 0;
|
|
22025
22069
|
if (hasChecks) {
|
|
22026
|
-
const existingShape = schema
|
|
22070
|
+
const existingShape = sourceShape(schema);
|
|
22027
22071
|
for (const key of Reflect.ownKeys(shape)) {
|
|
22028
22072
|
if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
|
|
22029
22073
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
22030
22074
|
}
|
|
22031
22075
|
}
|
|
22032
22076
|
}
|
|
22033
|
-
|
|
22034
|
-
|
|
22035
|
-
|
|
22036
|
-
|
|
22037
|
-
|
|
22038
|
-
|
|
22039
|
-
|
|
22040
|
-
return clone(schema, def);
|
|
22077
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
22078
|
+
}
|
|
22079
|
+
function extended(schema, shape) {
|
|
22080
|
+
const newShape = {};
|
|
22081
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
|
|
22082
|
+
mirrorProps(newShape, shape);
|
|
22083
|
+
return newShape;
|
|
22041
22084
|
}
|
|
22042
22085
|
function safeExtend(schema, shape) {
|
|
22043
22086
|
if (!isPlainObject(shape)) {
|
|
22044
22087
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
22045
22088
|
}
|
|
22046
|
-
|
|
22047
|
-
get shape() {
|
|
22048
|
-
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
22049
|
-
assignProp(this, "shape", _shape);
|
|
22050
|
-
return _shape;
|
|
22051
|
-
}
|
|
22052
|
-
});
|
|
22053
|
-
return clone(schema, def);
|
|
22089
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
22054
22090
|
}
|
|
22055
22091
|
function merge(a, b) {
|
|
22056
22092
|
if (!b?._zod?.def) {
|
|
@@ -22059,12 +22095,11 @@ function merge(a, b) {
|
|
|
22059
22095
|
if (a._zod.def.checks?.length) {
|
|
22060
22096
|
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
22061
22097
|
}
|
|
22098
|
+
const newShape = {};
|
|
22099
|
+
mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
|
|
22100
|
+
mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
|
|
22062
22101
|
const def = mergeDefs(a._zod.def, {
|
|
22063
|
-
|
|
22064
|
-
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
|
22065
|
-
assignProp(this, "shape", _shape);
|
|
22066
|
-
return _shape;
|
|
22067
|
-
},
|
|
22102
|
+
shape: newShape,
|
|
22068
22103
|
get catchall() {
|
|
22069
22104
|
return b._zod.def.catchall;
|
|
22070
22105
|
},
|
|
@@ -22079,67 +22114,16 @@ function partial(Class, schema, mask, name = "partial") {
|
|
|
22079
22114
|
if (hasChecks) {
|
|
22080
22115
|
throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
22081
22116
|
}
|
|
22082
|
-
const
|
|
22083
|
-
|
|
22084
|
-
|
|
22085
|
-
|
|
22086
|
-
if (mask) {
|
|
22087
|
-
for (const key of Reflect.ownKeys(mask)) {
|
|
22088
|
-
if (!Object.prototype.hasOwnProperty.call(oldShape, key)) {
|
|
22089
|
-
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
22090
|
-
}
|
|
22091
|
-
if (!mask[key])
|
|
22092
|
-
continue;
|
|
22093
|
-
shape[key] = Class ? new Class({
|
|
22094
|
-
type: "optional",
|
|
22095
|
-
innerType: oldShape[key]
|
|
22096
|
-
}) : oldShape[key];
|
|
22097
|
-
}
|
|
22098
|
-
} else {
|
|
22099
|
-
for (const key of Reflect.ownKeys(oldShape)) {
|
|
22100
|
-
shape[key] = Class ? new Class({
|
|
22101
|
-
type: "optional",
|
|
22102
|
-
innerType: oldShape[key]
|
|
22103
|
-
}) : oldShape[key];
|
|
22104
|
-
}
|
|
22105
|
-
}
|
|
22106
|
-
assignProp(this, "shape", shape);
|
|
22107
|
-
return shape;
|
|
22108
|
-
},
|
|
22109
|
-
checks: []
|
|
22110
|
-
});
|
|
22111
|
-
return clone(schema, def);
|
|
22117
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
|
|
22118
|
+
const newShape = {};
|
|
22119
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class && ((value, key) => selected && !selected.has(key) ? value : new Class({ type: "optional", innerType: value })));
|
|
22120
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));
|
|
22112
22121
|
}
|
|
22113
22122
|
function required(Class, schema, mask) {
|
|
22114
|
-
const
|
|
22115
|
-
|
|
22116
|
-
|
|
22117
|
-
|
|
22118
|
-
if (mask) {
|
|
22119
|
-
for (const key of Reflect.ownKeys(mask)) {
|
|
22120
|
-
if (!Object.prototype.hasOwnProperty.call(shape, key)) {
|
|
22121
|
-
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
22122
|
-
}
|
|
22123
|
-
if (!mask[key])
|
|
22124
|
-
continue;
|
|
22125
|
-
shape[key] = new Class({
|
|
22126
|
-
type: "nonoptional",
|
|
22127
|
-
innerType: oldShape[key]
|
|
22128
|
-
});
|
|
22129
|
-
}
|
|
22130
|
-
} else {
|
|
22131
|
-
for (const key of Reflect.ownKeys(oldShape)) {
|
|
22132
|
-
shape[key] = new Class({
|
|
22133
|
-
type: "nonoptional",
|
|
22134
|
-
innerType: oldShape[key]
|
|
22135
|
-
});
|
|
22136
|
-
}
|
|
22137
|
-
}
|
|
22138
|
-
assignProp(this, "shape", shape);
|
|
22139
|
-
return shape;
|
|
22140
|
-
}
|
|
22141
|
-
});
|
|
22142
|
-
return clone(schema, def);
|
|
22123
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
|
|
22124
|
+
const newShape = {};
|
|
22125
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => selected && !selected.has(key) ? value : new Class({ type: "nonoptional", innerType: value }));
|
|
22126
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
|
|
22143
22127
|
}
|
|
22144
22128
|
function aborted(x, startIndex = 0) {
|
|
22145
22129
|
if (x.aborted === true)
|
|
@@ -22189,13 +22173,18 @@ function finalizeIssue(iss, ctx, config) {
|
|
|
22189
22173
|
}
|
|
22190
22174
|
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : undefined;
|
|
22191
22175
|
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
22192
|
-
const
|
|
22193
|
-
|
|
22194
|
-
|
|
22176
|
+
const full = {};
|
|
22177
|
+
for (const k of Object.keys(iss)) {
|
|
22178
|
+
if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
|
|
22179
|
+
continue;
|
|
22180
|
+
full[k] = iss[k];
|
|
22181
|
+
}
|
|
22182
|
+
full.path ?? (full.path = []);
|
|
22183
|
+
full.message = message;
|
|
22195
22184
|
if (ctx?.reportInput) {
|
|
22196
|
-
|
|
22185
|
+
full.input = iss.input;
|
|
22197
22186
|
}
|
|
22198
|
-
return
|
|
22187
|
+
return full;
|
|
22199
22188
|
}
|
|
22200
22189
|
var highSurrogate = /[\uD800-\uDBFF]/;
|
|
22201
22190
|
function codePointLength(str) {
|
|
@@ -22267,6 +22256,22 @@ function own(inst, key, value, enumerable = true) {
|
|
|
22267
22256
|
function hide(inst, key, value) {
|
|
22268
22257
|
return own(inst, key, value, false);
|
|
22269
22258
|
}
|
|
22259
|
+
function derived(computes, table) {
|
|
22260
|
+
for (const key in computes) {
|
|
22261
|
+
const compute = computes[key];
|
|
22262
|
+
Object.defineProperty(table, key, {
|
|
22263
|
+
configurable: true,
|
|
22264
|
+
enumerable: true,
|
|
22265
|
+
get() {
|
|
22266
|
+
return own(this, key, compute(this));
|
|
22267
|
+
},
|
|
22268
|
+
set(value) {
|
|
22269
|
+
own(this, key, value);
|
|
22270
|
+
}
|
|
22271
|
+
});
|
|
22272
|
+
}
|
|
22273
|
+
return table;
|
|
22274
|
+
}
|
|
22270
22275
|
function defineBound(proto, key, fn) {
|
|
22271
22276
|
Object.defineProperty(proto, key, {
|
|
22272
22277
|
configurable: true,
|
|
@@ -22390,8 +22395,7 @@ function $constructor(name, initializer, proto, params) {
|
|
|
22390
22395
|
} finally {
|
|
22391
22396
|
_zodDesc.value = undefined;
|
|
22392
22397
|
}
|
|
22393
|
-
}
|
|
22394
|
-
if (inst._zod.traits.has(name)) {
|
|
22398
|
+
} else if (inst._zod.traits.has(name)) {
|
|
22395
22399
|
return;
|
|
22396
22400
|
}
|
|
22397
22401
|
inst._zod.traits.add(name);
|
|
@@ -22482,16 +22486,12 @@ var _messageDesc = {
|
|
|
22482
22486
|
enumerable: true,
|
|
22483
22487
|
configurable: true
|
|
22484
22488
|
};
|
|
22485
|
-
var _zodDesc2 = { value: undefined, enumerable: false };
|
|
22486
22489
|
var _issuesDesc = { value: undefined, enumerable: false };
|
|
22487
22490
|
var _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
22488
22491
|
var initializer = (inst, def) => {
|
|
22489
22492
|
inst.name = "$ZodError";
|
|
22490
|
-
_zodDesc2.value = inst._zod;
|
|
22491
|
-
Object.defineProperty(inst, "_zod", _zodDesc2);
|
|
22492
22493
|
_issuesDesc.value = def;
|
|
22493
22494
|
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
22494
|
-
_zodDesc2.value = undefined;
|
|
22495
22495
|
_issuesDesc.value = undefined;
|
|
22496
22496
|
Object.defineProperty(inst, "message", _messageDesc);
|
|
22497
22497
|
const proto = Object.getPrototypeOf(inst);
|
|
@@ -22629,23 +22629,70 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
22629
22629
|
if (result instanceof Promise) {
|
|
22630
22630
|
throw new $ZodAsyncError;
|
|
22631
22631
|
}
|
|
22632
|
-
return result.issues.length ? {
|
|
22633
|
-
success: false,
|
|
22634
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
22635
|
-
} : { success: true, data: result.value };
|
|
22632
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
|
|
22636
22633
|
};
|
|
22637
22634
|
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
22635
|
+
function failure(Err, issues, ctx) {
|
|
22636
|
+
let error;
|
|
22637
|
+
return {
|
|
22638
|
+
success: false,
|
|
22639
|
+
get error() {
|
|
22640
|
+
if (!error) {
|
|
22641
|
+
error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
22642
|
+
issues = undefined;
|
|
22643
|
+
ctx = undefined;
|
|
22644
|
+
}
|
|
22645
|
+
return error;
|
|
22646
|
+
},
|
|
22647
|
+
set error(e) {
|
|
22648
|
+
error = e;
|
|
22649
|
+
issues = undefined;
|
|
22650
|
+
ctx = undefined;
|
|
22651
|
+
}
|
|
22652
|
+
};
|
|
22653
|
+
}
|
|
22638
22654
|
var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
22639
22655
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
22640
22656
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
22641
22657
|
if (result instanceof Promise)
|
|
22642
22658
|
result = await result;
|
|
22643
|
-
return result.issues.length ? {
|
|
22644
|
-
success: false,
|
|
22645
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
22646
|
-
} : { success: true, data: result.value };
|
|
22659
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
|
|
22647
22660
|
};
|
|
22648
22661
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
22662
|
+
var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
|
|
22663
|
+
var COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
|
|
22664
|
+
var validate = (schema, value, _ctx) => {
|
|
22665
|
+
const validator = schema._zod.bag.validator;
|
|
22666
|
+
if (validator !== undefined) {
|
|
22667
|
+
if (validator(value) !== COMPILE_INVALID)
|
|
22668
|
+
return true;
|
|
22669
|
+
if (validator.definite === true && _ctx === undefined)
|
|
22670
|
+
return false;
|
|
22671
|
+
}
|
|
22672
|
+
return validateFallback(schema, value, _ctx);
|
|
22673
|
+
};
|
|
22674
|
+
function validateFallback(schema, value, _ctx) {
|
|
22675
|
+
const ctx = _ctx ? { ..._ctx, async: false, abortEarly: true } : { async: false, abortEarly: true };
|
|
22676
|
+
const fallbackRun = schema._zod.bag.fallbackRun;
|
|
22677
|
+
let result;
|
|
22678
|
+
if (fallbackRun) {
|
|
22679
|
+
ctx[COMPILE_FALLBACK] = true;
|
|
22680
|
+
result = fallbackRun({ value, issues: [] }, ctx);
|
|
22681
|
+
} else {
|
|
22682
|
+
result = schema._zod.run({ value, issues: [] }, ctx);
|
|
22683
|
+
}
|
|
22684
|
+
if (result instanceof Promise) {
|
|
22685
|
+
throw new $ZodAsyncError;
|
|
22686
|
+
}
|
|
22687
|
+
return result.issues.length === 0;
|
|
22688
|
+
}
|
|
22689
|
+
var validateAsync = async (schema, value, _ctx) => {
|
|
22690
|
+
const ctx = _ctx ? { ..._ctx, async: true, abortEarly: true } : { async: true, abortEarly: true };
|
|
22691
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
22692
|
+
if (result instanceof Promise)
|
|
22693
|
+
result = await result;
|
|
22694
|
+
return result.issues.length === 0;
|
|
22695
|
+
};
|
|
22649
22696
|
var _encode = (_Err) => {
|
|
22650
22697
|
const parse = _parse(_Err);
|
|
22651
22698
|
const fn = (schema, value, _ctx, _params) => {
|
|
@@ -22707,8 +22754,8 @@ var uuid = (version) => {
|
|
|
22707
22754
|
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
22708
22755
|
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
22709
22756
|
};
|
|
22710
|
-
var email = /^(
|
|
22711
|
-
var _emoji = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
22757
|
+
var email = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
22758
|
+
var _emoji = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
22712
22759
|
function emoji() {
|
|
22713
22760
|
return new RegExp(_emoji, "u");
|
|
22714
22761
|
}
|
|
@@ -22717,7 +22764,7 @@ var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|(
|
|
|
22717
22764
|
var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
22718
22765
|
var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
22719
22766
|
var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
22720
|
-
var base64url = /^[A-Za-z0-9_-]
|
|
22767
|
+
var base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
|
|
22721
22768
|
var httpProtocol = /^https?$/;
|
|
22722
22769
|
var e164 = /^\+[1-9]\d{6,14}$/;
|
|
22723
22770
|
var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
@@ -22741,10 +22788,7 @@ function datetime(args) {
|
|
|
22741
22788
|
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
22742
22789
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
22743
22790
|
}
|
|
22744
|
-
var
|
|
22745
|
-
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
22746
|
-
return new RegExp(`^${regex}$`);
|
|
22747
|
-
};
|
|
22791
|
+
var anyString = /^[\s\S]{0,}$/;
|
|
22748
22792
|
var bigint = /^-?\d+n?$/;
|
|
22749
22793
|
var integer = /^-?\d+$/;
|
|
22750
22794
|
var number = /^-?\d+(?:\.\d+)?$/;
|
|
@@ -22772,16 +22816,6 @@ var numericOriginMap = {
|
|
|
22772
22816
|
var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
22773
22817
|
$ZodCheck.init(inst, def);
|
|
22774
22818
|
const origin = numericOriginMap[typeof def.value];
|
|
22775
|
-
inst._zod.onattach.push((inst) => {
|
|
22776
|
-
const bag = inst._zod.bag;
|
|
22777
|
-
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
22778
|
-
if (def.value < curr) {
|
|
22779
|
-
if (def.inclusive)
|
|
22780
|
-
bag.maximum = def.value;
|
|
22781
|
-
else
|
|
22782
|
-
bag.exclusiveMaximum = def.value;
|
|
22783
|
-
}
|
|
22784
|
-
});
|
|
22785
22819
|
inst._zod.check = (payload) => {
|
|
22786
22820
|
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
|
|
22787
22821
|
return;
|
|
@@ -22800,16 +22834,6 @@ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst,
|
|
|
22800
22834
|
var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
22801
22835
|
$ZodCheck.init(inst, def);
|
|
22802
22836
|
const origin = numericOriginMap[typeof def.value];
|
|
22803
|
-
inst._zod.onattach.push((inst) => {
|
|
22804
|
-
const bag = inst._zod.bag;
|
|
22805
|
-
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
22806
|
-
if (def.value > curr) {
|
|
22807
|
-
if (def.inclusive)
|
|
22808
|
-
bag.minimum = def.value;
|
|
22809
|
-
else
|
|
22810
|
-
bag.exclusiveMinimum = def.value;
|
|
22811
|
-
}
|
|
22812
|
-
});
|
|
22813
22837
|
inst._zod.check = (payload) => {
|
|
22814
22838
|
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
|
|
22815
22839
|
return;
|
|
@@ -22827,10 +22851,6 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
22827
22851
|
});
|
|
22828
22852
|
var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
22829
22853
|
$ZodCheck.init(inst, def);
|
|
22830
|
-
inst._zod.onattach.push((inst) => {
|
|
22831
|
-
var _a;
|
|
22832
|
-
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
22833
|
-
});
|
|
22834
22854
|
inst._zod.check = (payload) => {
|
|
22835
22855
|
if (typeof payload.value !== typeof def.value)
|
|
22836
22856
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
@@ -22853,14 +22873,6 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
22853
22873
|
const isInt = def.format?.includes("int");
|
|
22854
22874
|
const origin = isInt ? "int" : "number";
|
|
22855
22875
|
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
22856
|
-
inst._zod.onattach.push((inst) => {
|
|
22857
|
-
const bag = inst._zod.bag;
|
|
22858
|
-
bag.format = def.format;
|
|
22859
|
-
bag.minimum = minimum;
|
|
22860
|
-
bag.maximum = maximum;
|
|
22861
|
-
if (isInt)
|
|
22862
|
-
bag.pattern = integer;
|
|
22863
|
-
});
|
|
22864
22876
|
inst._zod.check = (payload) => {
|
|
22865
22877
|
const input = payload.value;
|
|
22866
22878
|
if (isInt) {
|
|
@@ -22930,11 +22942,6 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
22930
22942
|
var _a;
|
|
22931
22943
|
$ZodCheck.init(inst, def);
|
|
22932
22944
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
22933
|
-
inst._zod.onattach.push((inst) => {
|
|
22934
|
-
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
22935
|
-
if (def.maximum < curr)
|
|
22936
|
-
inst._zod.bag.maximum = def.maximum;
|
|
22937
|
-
});
|
|
22938
22945
|
inst._zod.check = (payload) => {
|
|
22939
22946
|
const input = payload.value;
|
|
22940
22947
|
const units = input.length;
|
|
@@ -22957,11 +22964,6 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
22957
22964
|
var _a;
|
|
22958
22965
|
$ZodCheck.init(inst, def);
|
|
22959
22966
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
22960
|
-
inst._zod.onattach.push((inst) => {
|
|
22961
|
-
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
22962
|
-
if (def.minimum > curr)
|
|
22963
|
-
inst._zod.bag.minimum = def.minimum;
|
|
22964
|
-
});
|
|
22965
22967
|
inst._zod.check = (payload) => {
|
|
22966
22968
|
const input = payload.value;
|
|
22967
22969
|
const units = input.length;
|
|
@@ -22984,12 +22986,6 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
22984
22986
|
var _a;
|
|
22985
22987
|
$ZodCheck.init(inst, def);
|
|
22986
22988
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
22987
|
-
inst._zod.onattach.push((inst) => {
|
|
22988
|
-
const bag = inst._zod.bag;
|
|
22989
|
-
bag.minimum = def.length;
|
|
22990
|
-
bag.maximum = def.length;
|
|
22991
|
-
bag.length = def.length;
|
|
22992
|
-
});
|
|
22993
22989
|
inst._zod.check = (payload) => {
|
|
22994
22990
|
const input = payload.value;
|
|
22995
22991
|
const units = input.length;
|
|
@@ -23012,14 +23008,6 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
23012
23008
|
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
23013
23009
|
var _a, _b;
|
|
23014
23010
|
$ZodCheck.init(inst, def);
|
|
23015
|
-
inst._zod.onattach.push((inst) => {
|
|
23016
|
-
const bag = inst._zod.bag;
|
|
23017
|
-
bag.format = def.format;
|
|
23018
|
-
if (def.pattern) {
|
|
23019
|
-
bag.patterns ?? (bag.patterns = new Set);
|
|
23020
|
-
bag.patterns.add(def.pattern);
|
|
23021
|
-
}
|
|
23022
|
-
});
|
|
23023
23011
|
if (def.pattern)
|
|
23024
23012
|
(_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
23025
23013
|
def.pattern.lastIndex = 0;
|
|
@@ -23068,11 +23056,6 @@ var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst,
|
|
|
23068
23056
|
const escapedRegex = escapeRegex(def.includes);
|
|
23069
23057
|
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
|
|
23070
23058
|
def.pattern = pattern;
|
|
23071
|
-
inst._zod.onattach.push((inst) => {
|
|
23072
|
-
const bag = inst._zod.bag;
|
|
23073
|
-
bag.patterns ?? (bag.patterns = new Set);
|
|
23074
|
-
bag.patterns.add(pattern);
|
|
23075
|
-
});
|
|
23076
23059
|
inst._zod.check = (payload) => {
|
|
23077
23060
|
if (payload.value.includes(def.includes, def.position))
|
|
23078
23061
|
return;
|
|
@@ -23091,11 +23074,6 @@ var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (i
|
|
|
23091
23074
|
$ZodCheck.init(inst, def);
|
|
23092
23075
|
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
23093
23076
|
def.pattern ?? (def.pattern = pattern);
|
|
23094
|
-
inst._zod.onattach.push((inst) => {
|
|
23095
|
-
const bag = inst._zod.bag;
|
|
23096
|
-
bag.patterns ?? (bag.patterns = new Set);
|
|
23097
|
-
bag.patterns.add(pattern);
|
|
23098
|
-
});
|
|
23099
23077
|
inst._zod.check = (payload) => {
|
|
23100
23078
|
if (payload.value.startsWith(def.prefix))
|
|
23101
23079
|
return;
|
|
@@ -23114,11 +23092,6 @@ var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst,
|
|
|
23114
23092
|
$ZodCheck.init(inst, def);
|
|
23115
23093
|
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
23116
23094
|
def.pattern ?? (def.pattern = pattern);
|
|
23117
|
-
inst._zod.onattach.push((inst) => {
|
|
23118
|
-
const bag = inst._zod.bag;
|
|
23119
|
-
bag.patterns ?? (bag.patterns = new Set);
|
|
23120
|
-
bag.patterns.add(pattern);
|
|
23121
|
-
});
|
|
23122
23095
|
inst._zod.check = (payload) => {
|
|
23123
23096
|
if (payload.value.endsWith(def.suffix))
|
|
23124
23097
|
return;
|
|
@@ -23150,8 +23123,11 @@ class Doc {
|
|
|
23150
23123
|
}
|
|
23151
23124
|
indented(fn) {
|
|
23152
23125
|
this.indent += 1;
|
|
23153
|
-
|
|
23154
|
-
|
|
23126
|
+
try {
|
|
23127
|
+
fn(this);
|
|
23128
|
+
} finally {
|
|
23129
|
+
this.indent -= 1;
|
|
23130
|
+
}
|
|
23155
23131
|
}
|
|
23156
23132
|
write(arg) {
|
|
23157
23133
|
if (typeof arg === "function") {
|
|
@@ -23182,8 +23158,8 @@ ${content.join(`
|
|
|
23182
23158
|
// node_modules/zod/v4/core/versions.js
|
|
23183
23159
|
var version = {
|
|
23184
23160
|
major: 4,
|
|
23185
|
-
minor:
|
|
23186
|
-
patch:
|
|
23161
|
+
minor: 6,
|
|
23162
|
+
patch: 5
|
|
23187
23163
|
};
|
|
23188
23164
|
|
|
23189
23165
|
// node_modules/zod/v4/core/schemas.js
|
|
@@ -23295,15 +23271,21 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
23295
23271
|
own(this, "~standard", value);
|
|
23296
23272
|
}
|
|
23297
23273
|
});
|
|
23298
|
-
var toStandardResult = (r) => r.
|
|
23274
|
+
var toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
|
|
23275
|
+
async function validateAsync2(inst, value) {
|
|
23276
|
+
const ctx = { async: true };
|
|
23277
|
+
return toStandardResult(await inst._zod.run({ value, issues: [] }, ctx), ctx);
|
|
23278
|
+
}
|
|
23299
23279
|
function standardProps(inst) {
|
|
23300
23280
|
return {
|
|
23301
23281
|
validate: (value) => {
|
|
23282
|
+
const ctx = { async: false };
|
|
23302
23283
|
try {
|
|
23303
|
-
|
|
23304
|
-
|
|
23305
|
-
|
|
23306
|
-
}
|
|
23284
|
+
const r = inst._zod.run({ value, issues: [] }, ctx);
|
|
23285
|
+
if (!(r instanceof Promise))
|
|
23286
|
+
return toStandardResult(r, ctx);
|
|
23287
|
+
} catch (_) {}
|
|
23288
|
+
return validateAsync2(inst, value);
|
|
23307
23289
|
},
|
|
23308
23290
|
vendor: "zod",
|
|
23309
23291
|
version: 1
|
|
@@ -23311,7 +23293,7 @@ function standardProps(inst) {
|
|
|
23311
23293
|
}
|
|
23312
23294
|
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
23313
23295
|
$ZodType.init(inst, def);
|
|
23314
|
-
inst._zod.pattern =
|
|
23296
|
+
inst._zod.pattern = def.pattern ?? anyString;
|
|
23315
23297
|
inst._zod.parse = (payload, _) => {
|
|
23316
23298
|
if (def.coerce)
|
|
23317
23299
|
try {
|
|
@@ -23362,11 +23344,32 @@ var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
|
23362
23344
|
});
|
|
23363
23345
|
var URL_BAD_FORMAT = 1;
|
|
23364
23346
|
var URL_UNPARSEABLE = 2;
|
|
23347
|
+
function canParseURL(input) {
|
|
23348
|
+
try {
|
|
23349
|
+
if (typeof URL !== "undefined" && typeof URL.canParse === "function")
|
|
23350
|
+
return URL.canParse(input);
|
|
23351
|
+
new URL(input);
|
|
23352
|
+
return true;
|
|
23353
|
+
} catch {
|
|
23354
|
+
return false;
|
|
23355
|
+
}
|
|
23356
|
+
}
|
|
23357
|
+
function validateURL(trimmed, def) {
|
|
23358
|
+
if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
|
|
23359
|
+
return canParseURL(trimmed) || URL_UNPARSEABLE;
|
|
23360
|
+
}
|
|
23361
|
+
return parseURLObject(trimmed, def);
|
|
23362
|
+
}
|
|
23365
23363
|
function parseURLObject(trimmed, def) {
|
|
23366
23364
|
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
|
|
23367
23365
|
return URL_BAD_FORMAT;
|
|
23368
23366
|
}
|
|
23369
23367
|
try {
|
|
23368
|
+
if (typeof URL !== "undefined") {
|
|
23369
|
+
const URLStatic = URL;
|
|
23370
|
+
if (typeof URLStatic.parse === "function")
|
|
23371
|
+
return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;
|
|
23372
|
+
}
|
|
23370
23373
|
return new URL(trimmed);
|
|
23371
23374
|
} catch {
|
|
23372
23375
|
return URL_UNPARSEABLE;
|
|
@@ -23389,7 +23392,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
23389
23392
|
inst._zod.check = (payload) => {
|
|
23390
23393
|
try {
|
|
23391
23394
|
const trimmed = payload.value.trim();
|
|
23392
|
-
const url =
|
|
23395
|
+
const url = validateURL(trimmed, def);
|
|
23393
23396
|
if (url === URL_BAD_FORMAT) {
|
|
23394
23397
|
payload.issues.push({
|
|
23395
23398
|
code: "invalid_format",
|
|
@@ -23411,6 +23414,10 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
23411
23414
|
});
|
|
23412
23415
|
return;
|
|
23413
23416
|
}
|
|
23417
|
+
if (url === true) {
|
|
23418
|
+
payload.value = stripTabAndNewline(trimmed);
|
|
23419
|
+
return;
|
|
23420
|
+
}
|
|
23414
23421
|
if (def.hostname && !urlHostnameOk(url, def.hostname)) {
|
|
23415
23422
|
payload.issues.push({
|
|
23416
23423
|
code: "invalid_format",
|
|
@@ -23479,12 +23486,6 @@ var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
|
|
|
23479
23486
|
var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
|
|
23480
23487
|
def.pattern ?? (def.pattern = datetime(def));
|
|
23481
23488
|
$ZodStringFormat.init(inst, def);
|
|
23482
|
-
if (def.local || def.precision === -1) {
|
|
23483
|
-
inst._zod.bag.laxFormat = true;
|
|
23484
|
-
inst._zod.onattach.push((s) => {
|
|
23485
|
-
s._zod.bag.laxFormat = true;
|
|
23486
|
-
});
|
|
23487
|
-
}
|
|
23488
23489
|
});
|
|
23489
23490
|
var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
23490
23491
|
def.pattern ?? (def.pattern = date);
|
|
@@ -23501,23 +23502,16 @@ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def
|
|
|
23501
23502
|
var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
23502
23503
|
def.pattern ?? (def.pattern = ipv4);
|
|
23503
23504
|
$ZodStringFormat.init(inst, def);
|
|
23504
|
-
inst._zod.bag.format = `ipv4`;
|
|
23505
23505
|
});
|
|
23506
23506
|
var ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
23507
23507
|
function isValidIPv6(value) {
|
|
23508
23508
|
if (!ipv6Alphabet.test(value))
|
|
23509
23509
|
return false;
|
|
23510
|
-
|
|
23511
|
-
new URL(`http://[${value}]`);
|
|
23512
|
-
return true;
|
|
23513
|
-
} catch {
|
|
23514
|
-
return false;
|
|
23515
|
-
}
|
|
23510
|
+
return canParseURL(`http://[${value}]`);
|
|
23516
23511
|
}
|
|
23517
23512
|
var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
23518
23513
|
def.pattern ?? (def.pattern = ipv6);
|
|
23519
23514
|
$ZodStringFormat.init(inst, def);
|
|
23520
|
-
inst._zod.bag.format = `ipv6`;
|
|
23521
23515
|
inst._zod.check = (payload) => {
|
|
23522
23516
|
if (!isValidIPv6(payload.value)) {
|
|
23523
23517
|
payload.issues.push({
|
|
@@ -23577,10 +23571,10 @@ function isValidBase64(data) {
|
|
|
23577
23571
|
return false;
|
|
23578
23572
|
}
|
|
23579
23573
|
}
|
|
23574
|
+
var base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
|
|
23580
23575
|
var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
23581
|
-
def.pattern ?? (def.pattern =
|
|
23576
|
+
def.pattern ?? (def.pattern = base64Charset);
|
|
23582
23577
|
$ZodStringFormat.init(inst, def);
|
|
23583
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
23584
23578
|
inst._zod.check = (payload) => {
|
|
23585
23579
|
if (isValidBase64(payload.value))
|
|
23586
23580
|
return;
|
|
@@ -23593,17 +23587,17 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
23593
23587
|
});
|
|
23594
23588
|
};
|
|
23595
23589
|
});
|
|
23590
|
+
var base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
23596
23591
|
function isValidBase64URL(data) {
|
|
23597
|
-
if (!
|
|
23592
|
+
if (!base64urlCharset.test(data))
|
|
23598
23593
|
return false;
|
|
23599
23594
|
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
23600
23595
|
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
|
23601
23596
|
return isValidBase64(padded);
|
|
23602
23597
|
}
|
|
23603
23598
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
23604
|
-
def.pattern ?? (def.pattern =
|
|
23599
|
+
def.pattern ?? (def.pattern = base64urlCharset);
|
|
23605
23600
|
$ZodStringFormat.init(inst, def);
|
|
23606
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
23607
23601
|
inst._zod.check = (payload) => {
|
|
23608
23602
|
if (isValidBase64URL(payload.value))
|
|
23609
23603
|
return;
|
|
@@ -23656,7 +23650,7 @@ var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
|
23656
23650
|
});
|
|
23657
23651
|
var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
23658
23652
|
$ZodType.init(inst, def);
|
|
23659
|
-
inst._zod.pattern =
|
|
23653
|
+
inst._zod.pattern = number;
|
|
23660
23654
|
inst._zod.parse = (payload, _ctx) => {
|
|
23661
23655
|
if (def.coerce)
|
|
23662
23656
|
try {
|
|
@@ -23799,6 +23793,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
23799
23793
|
}
|
|
23800
23794
|
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
23801
23795
|
const proms = [];
|
|
23796
|
+
const abortEarly = ctx?.abortEarly;
|
|
23802
23797
|
for (let i = 0;i < input.length; i++) {
|
|
23803
23798
|
const item = input[i];
|
|
23804
23799
|
const result = def.element._zod.run({
|
|
@@ -23809,6 +23804,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
23809
23804
|
proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
23810
23805
|
} else {
|
|
23811
23806
|
handleArrayResult(result, payload, i);
|
|
23807
|
+
if (abortEarly && result.issues.length !== 0 && aborted(result))
|
|
23808
|
+
break;
|
|
23812
23809
|
}
|
|
23813
23810
|
}
|
|
23814
23811
|
if (proms.length) {
|
|
@@ -23841,7 +23838,7 @@ function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
|
23841
23838
|
return;
|
|
23842
23839
|
}
|
|
23843
23840
|
if (result.value === undefined) {
|
|
23844
|
-
if (isPresent) {
|
|
23841
|
+
if (isPresent || optin === "defaulted" && !isOptionalOut) {
|
|
23845
23842
|
final.value[key] = undefined;
|
|
23846
23843
|
}
|
|
23847
23844
|
} else {
|
|
@@ -23869,14 +23866,20 @@ function normalizeDef(def) {
|
|
|
23869
23866
|
optionalKeys: new Set(okeys)
|
|
23870
23867
|
};
|
|
23871
23868
|
}
|
|
23872
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
23869
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
23873
23870
|
const unrecognized = [];
|
|
23874
23871
|
const keySet = def.keySet;
|
|
23875
23872
|
const _catchall = def.catchall._zod;
|
|
23876
23873
|
const t = _catchall.def.type;
|
|
23877
23874
|
const optin = _catchall.optin;
|
|
23878
23875
|
const optout = _catchall.optout;
|
|
23876
|
+
let seen = 0;
|
|
23879
23877
|
for (const key in input) {
|
|
23878
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
23879
|
+
if (aborted(payload, seen))
|
|
23880
|
+
break;
|
|
23881
|
+
seen = payload.issues.length;
|
|
23882
|
+
}
|
|
23880
23883
|
if (keySet.has(key))
|
|
23881
23884
|
continue;
|
|
23882
23885
|
if (key === "__proto__") {
|
|
@@ -23910,23 +23913,19 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
23910
23913
|
return payload;
|
|
23911
23914
|
});
|
|
23912
23915
|
}
|
|
23913
|
-
var propShapes = new WeakMap;
|
|
23914
23916
|
var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
23915
23917
|
$ZodType.init(inst, def);
|
|
23916
23918
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
23917
|
-
|
|
23918
|
-
|
|
23919
|
-
|
|
23920
|
-
|
|
23921
|
-
|
|
23922
|
-
|
|
23923
|
-
|
|
23924
|
-
|
|
23925
|
-
|
|
23926
|
-
|
|
23927
|
-
return newSh;
|
|
23928
|
-
}
|
|
23929
|
-
});
|
|
23919
|
+
const sh = desc?.get ? desc.get.raw : def.shape ?? {};
|
|
23920
|
+
if (sh) {
|
|
23921
|
+
const get = () => {
|
|
23922
|
+
const newSh = { ...sh };
|
|
23923
|
+
Object.defineProperty(def, "shape", { value: newSh });
|
|
23924
|
+
get.raw = newSh;
|
|
23925
|
+
return newSh;
|
|
23926
|
+
};
|
|
23927
|
+
get.raw = sh;
|
|
23928
|
+
Object.defineProperty(def, "shape", { get });
|
|
23930
23929
|
}
|
|
23931
23930
|
const _normalized = cached(() => normalizeDef(def));
|
|
23932
23931
|
defineLazyInternal(inst, "propValues", (zod) => {
|
|
@@ -23966,7 +23965,14 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
23966
23965
|
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
23967
23966
|
const proms = [];
|
|
23968
23967
|
const shape = value.shape;
|
|
23968
|
+
const abortEarly = ctx?.abortEarly;
|
|
23969
|
+
let seen = payload.issues.length;
|
|
23969
23970
|
for (const key of value.allKeys) {
|
|
23971
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
23972
|
+
if (aborted(payload, seen))
|
|
23973
|
+
break;
|
|
23974
|
+
seen = payload.issues.length;
|
|
23975
|
+
}
|
|
23970
23976
|
if (key === "__proto__")
|
|
23971
23977
|
continue;
|
|
23972
23978
|
const el = shape[key];
|
|
@@ -23982,7 +23988,7 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
23982
23988
|
if (!catchall) {
|
|
23983
23989
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
23984
23990
|
}
|
|
23985
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
23991
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
23986
23992
|
};
|
|
23987
23993
|
});
|
|
23988
23994
|
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -23996,10 +24002,16 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
23996
24002
|
const doc = new Doc(["payload", "ctx"], { shape, inst, memo, syms });
|
|
23997
24003
|
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
23998
24004
|
const prefixStr = (id, k) => `
|
|
24005
|
+
let ${id}_ab = false;
|
|
23999
24006
|
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
24000
24007
|
const iss = ${id}.issues[i];
|
|
24001
24008
|
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
24002
24009
|
payload.issues.push(iss);
|
|
24010
|
+
if (iss.continue !== true) ${id}_ab = true;
|
|
24011
|
+
}
|
|
24012
|
+
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
24013
|
+
payload.value = newResult;
|
|
24014
|
+
return payload;
|
|
24003
24015
|
}`;
|
|
24004
24016
|
doc.write(`const input = payload.value;`);
|
|
24005
24017
|
const ids = Object.create(null);
|
|
@@ -24045,6 +24057,10 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
24045
24057
|
input: undefined,
|
|
24046
24058
|
path: [${k}]
|
|
24047
24059
|
});
|
|
24060
|
+
if (ctx && ctx.abortEarly) {
|
|
24061
|
+
payload.value = newResult;
|
|
24062
|
+
return payload;
|
|
24063
|
+
}
|
|
24048
24064
|
}
|
|
24049
24065
|
|
|
24050
24066
|
if (${id}_present) {
|
|
@@ -24056,16 +24072,16 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
24056
24072
|
doc.write(`
|
|
24057
24073
|
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
24058
24074
|
}
|
|
24059
|
-
|
|
24060
|
-
if (
|
|
24061
|
-
|
|
24062
|
-
newResult[${k}] = undefined;
|
|
24063
|
-
}
|
|
24075
|
+
`);
|
|
24076
|
+
if (optin === "defaulted") {
|
|
24077
|
+
doc.write(`newResult[${k}] = ${id}.value;`);
|
|
24064
24078
|
} else {
|
|
24079
|
+
doc.write(`
|
|
24080
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
24065
24081
|
newResult[${k}] = ${id}.value;
|
|
24066
24082
|
}
|
|
24067
|
-
|
|
24068
24083
|
`);
|
|
24084
|
+
}
|
|
24069
24085
|
}
|
|
24070
24086
|
}
|
|
24071
24087
|
doc.write(`payload.value = newResult;`);
|
|
@@ -24097,7 +24113,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
24097
24113
|
payload = fastpass(payload, ctx);
|
|
24098
24114
|
if (!catchall)
|
|
24099
24115
|
return payload;
|
|
24100
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
24116
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
24101
24117
|
}
|
|
24102
24118
|
return superParse(payload, ctx);
|
|
24103
24119
|
};
|
|
@@ -24167,16 +24183,37 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
24167
24183
|
});
|
|
24168
24184
|
};
|
|
24169
24185
|
});
|
|
24186
|
+
function discriminatorMap(def) {
|
|
24187
|
+
const map = new Map;
|
|
24188
|
+
for (const option of def.options) {
|
|
24189
|
+
const values = option._zod.propValues?.[def.discriminator];
|
|
24190
|
+
if (!values || values.size === 0)
|
|
24191
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
24192
|
+
for (const value of values) {
|
|
24193
|
+
if (map.has(value)) {
|
|
24194
|
+
if (value !== undefined)
|
|
24195
|
+
throw new Error(`Duplicate discriminator value "${String(value)}"`);
|
|
24196
|
+
map.set(value, null);
|
|
24197
|
+
} else {
|
|
24198
|
+
map.set(value, option);
|
|
24199
|
+
}
|
|
24200
|
+
}
|
|
24201
|
+
}
|
|
24202
|
+
return map;
|
|
24203
|
+
}
|
|
24170
24204
|
var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
24171
24205
|
def.inclusive = false;
|
|
24172
24206
|
$ZodUnion.init(inst, def);
|
|
24173
24207
|
const _super = inst._zod.parse;
|
|
24174
24208
|
defineLazyInternal(inst, "propValues", (zod) => {
|
|
24175
24209
|
const propValues = {};
|
|
24210
|
+
let undefinedCount = 0;
|
|
24176
24211
|
for (const option of zod.def.options) {
|
|
24177
24212
|
const pv = option._zod.propValues;
|
|
24178
24213
|
if (!pv || Object.keys(pv).length === 0)
|
|
24179
24214
|
throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
|
|
24215
|
+
if (pv[zod.def.discriminator]?.has(undefined))
|
|
24216
|
+
undefinedCount++;
|
|
24180
24217
|
for (const [k, v] of Object.entries(pv)) {
|
|
24181
24218
|
if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
|
|
24182
24219
|
assignProp(propValues, k, new Set);
|
|
@@ -24186,30 +24223,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
24186
24223
|
}
|
|
24187
24224
|
}
|
|
24188
24225
|
}
|
|
24226
|
+
if (!zod.def.unionFallback && undefinedCount > 1)
|
|
24227
|
+
propValues[zod.def.discriminator]?.delete(undefined);
|
|
24189
24228
|
return propValues;
|
|
24190
24229
|
});
|
|
24191
24230
|
def.options.forEach((option, i) => {
|
|
24192
|
-
const propShape =
|
|
24231
|
+
const propShape = rawShape(option._zod.def);
|
|
24193
24232
|
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
|
|
24194
24233
|
throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
24195
24234
|
}
|
|
24196
24235
|
});
|
|
24197
|
-
const disc = cached(() =>
|
|
24198
|
-
const opts = def.options;
|
|
24199
|
-
const map = new Map;
|
|
24200
|
-
for (const o of opts) {
|
|
24201
|
-
const values = o._zod.propValues?.[def.discriminator];
|
|
24202
|
-
if (!values || values.size === 0)
|
|
24203
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
24204
|
-
for (const v of values) {
|
|
24205
|
-
if (map.has(v)) {
|
|
24206
|
-
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
24207
|
-
}
|
|
24208
|
-
map.set(v, o);
|
|
24209
|
-
}
|
|
24210
|
-
}
|
|
24211
|
-
return map;
|
|
24212
|
-
});
|
|
24236
|
+
const disc = cached(() => discriminatorMap(def));
|
|
24213
24237
|
inst._zod.parse = (payload, ctx) => {
|
|
24214
24238
|
const input = payload.value;
|
|
24215
24239
|
if (!isObject(input)) {
|
|
@@ -24221,8 +24245,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
24221
24245
|
});
|
|
24222
24246
|
return payload;
|
|
24223
24247
|
}
|
|
24224
|
-
const
|
|
24225
|
-
|
|
24248
|
+
const value = input?.[def.discriminator];
|
|
24249
|
+
const opt = disc.value.get(value);
|
|
24250
|
+
if (opt && (value !== undefined || ctx.direction !== "backward")) {
|
|
24226
24251
|
return opt._zod.run(payload, ctx);
|
|
24227
24252
|
}
|
|
24228
24253
|
if (def.unionFallback || ctx.direction === "backward") {
|
|
@@ -24233,7 +24258,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
24233
24258
|
errors: [],
|
|
24234
24259
|
note: "No matching discriminator",
|
|
24235
24260
|
discriminator: def.discriminator,
|
|
24236
|
-
options: Array.from(disc.value.keys()),
|
|
24261
|
+
options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
|
|
24237
24262
|
input,
|
|
24238
24263
|
path: [def.discriminator],
|
|
24239
24264
|
inst
|
|
@@ -24515,8 +24540,10 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
24515
24540
|
const values = getEnumValues(def.entries);
|
|
24516
24541
|
const valuesSet = new Set(values);
|
|
24517
24542
|
inst._zod.values = valuesSet;
|
|
24518
|
-
|
|
24519
|
-
|
|
24543
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
24544
|
+
const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
|
|
24545
|
+
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
24546
|
+
});
|
|
24520
24547
|
inst._zod.parse = (payload, _ctx) => {
|
|
24521
24548
|
const input = payload.value;
|
|
24522
24549
|
if (valuesSet.has(input)) {
|
|
@@ -24535,7 +24562,10 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
24535
24562
|
$ZodType.init(inst, def);
|
|
24536
24563
|
const values = new Set(def.values);
|
|
24537
24564
|
inst._zod.values = values;
|
|
24538
|
-
inst
|
|
24565
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
24566
|
+
const vals = zod.def.values;
|
|
24567
|
+
return new RegExp(vals.length ? `^(${vals.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
|
|
24568
|
+
});
|
|
24539
24569
|
inst._zod.parse = (payload, _ctx) => {
|
|
24540
24570
|
const input = payload.value;
|
|
24541
24571
|
if (values.has(input)) {
|
|
@@ -24815,28 +24845,53 @@ class $ZodCyclicError extends Error {
|
|
|
24815
24845
|
}
|
|
24816
24846
|
var STATE = "~memo";
|
|
24817
24847
|
var NO_ISSUES = [];
|
|
24848
|
+
function isRef(value) {
|
|
24849
|
+
return value !== null && typeof value === "object";
|
|
24850
|
+
}
|
|
24818
24851
|
function cloneIssues(issues) {
|
|
24819
24852
|
return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
|
|
24820
24853
|
}
|
|
24821
24854
|
var recursive = /* @__PURE__ */ new WeakMap;
|
|
24822
|
-
|
|
24855
|
+
var NONE = 0;
|
|
24856
|
+
var ASSUMED = 1;
|
|
24857
|
+
var PROVEN = 2;
|
|
24858
|
+
function isRecursive(inst, stack, resolve) {
|
|
24823
24859
|
const cached = recursive.get(inst);
|
|
24824
24860
|
if (cached !== undefined)
|
|
24825
|
-
return cached;
|
|
24861
|
+
return cached ? PROVEN : NONE;
|
|
24826
24862
|
if (stack.has(inst))
|
|
24827
|
-
return
|
|
24863
|
+
return PROVEN;
|
|
24828
24864
|
stack.add(inst);
|
|
24829
|
-
let result =
|
|
24865
|
+
let result = NONE;
|
|
24830
24866
|
const check = (child) => {
|
|
24831
|
-
if (
|
|
24832
|
-
|
|
24867
|
+
if (result !== PROVEN && child?._zod) {
|
|
24868
|
+
const answer = isRecursive(child, stack, resolve);
|
|
24869
|
+
if (answer > result)
|
|
24870
|
+
result = answer;
|
|
24871
|
+
}
|
|
24872
|
+
};
|
|
24873
|
+
const shape = (sh, spread) => {
|
|
24874
|
+
let answer = NONE;
|
|
24875
|
+
for (const key of Reflect.ownKeys(sh)) {
|
|
24876
|
+
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
24877
|
+
if (spread && !desc.enumerable)
|
|
24878
|
+
continue;
|
|
24879
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
|
|
24880
|
+
if (child > answer)
|
|
24881
|
+
answer = child;
|
|
24882
|
+
}
|
|
24883
|
+
return answer;
|
|
24884
|
+
};
|
|
24885
|
+
const merge = (answer) => {
|
|
24886
|
+
if (answer > result)
|
|
24887
|
+
result = answer;
|
|
24833
24888
|
};
|
|
24834
24889
|
const def = inst._zod.def;
|
|
24835
24890
|
const kind = def.type;
|
|
24836
24891
|
switch (kind) {
|
|
24837
24892
|
case "object": {
|
|
24838
|
-
|
|
24839
|
-
|
|
24893
|
+
const raw = rawShape(def);
|
|
24894
|
+
merge(raw ? shape(raw, true) : ASSUMED);
|
|
24840
24895
|
check(def.catchall);
|
|
24841
24896
|
break;
|
|
24842
24897
|
}
|
|
@@ -24883,9 +24938,11 @@ function isRecursive(inst, stack) {
|
|
|
24883
24938
|
check(def.input);
|
|
24884
24939
|
check(def.output);
|
|
24885
24940
|
break;
|
|
24886
|
-
case "lazy":
|
|
24887
|
-
|
|
24941
|
+
case "lazy": {
|
|
24942
|
+
const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : undefined);
|
|
24943
|
+
merge(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
24888
24944
|
break;
|
|
24945
|
+
}
|
|
24889
24946
|
case "template_literal":
|
|
24890
24947
|
case "string":
|
|
24891
24948
|
case "number":
|
|
@@ -24924,13 +24981,17 @@ function isRecursive(inst, stack) {
|
|
|
24924
24981
|
}
|
|
24925
24982
|
}
|
|
24926
24983
|
stack.delete(inst);
|
|
24927
|
-
|
|
24928
|
-
|
|
24984
|
+
return settle(inst, result);
|
|
24985
|
+
}
|
|
24986
|
+
function settle(inst, answer) {
|
|
24987
|
+
if (answer !== ASSUMED)
|
|
24988
|
+
recursive.set(inst, answer === PROVEN);
|
|
24989
|
+
return answer;
|
|
24929
24990
|
}
|
|
24930
24991
|
function bucketFor(state, inst) {
|
|
24931
24992
|
let bucket = state.buckets.get(inst);
|
|
24932
24993
|
if (!bucket) {
|
|
24933
|
-
bucket = new
|
|
24994
|
+
bucket = new WeakMap;
|
|
24934
24995
|
state.buckets.set(inst, bucket);
|
|
24935
24996
|
}
|
|
24936
24997
|
return bucket;
|
|
@@ -24966,6 +25027,7 @@ var memo = {
|
|
|
24966
25027
|
attach(inst) {
|
|
24967
25028
|
var _a;
|
|
24968
25029
|
let isRecursiveInst;
|
|
25030
|
+
let rechecked = false;
|
|
24969
25031
|
let lastCtx;
|
|
24970
25032
|
let lastBucket;
|
|
24971
25033
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
@@ -24973,20 +25035,24 @@ var memo = {
|
|
|
24973
25035
|
const base = inst._zod.parse;
|
|
24974
25036
|
const wrapped = (payload, ctx) => {
|
|
24975
25037
|
if (isRecursiveInst === undefined) {
|
|
24976
|
-
|
|
24977
|
-
if (
|
|
25038
|
+
const walked = isRecursive(inst, new Set, false);
|
|
25039
|
+
if (walked === NONE) {
|
|
24978
25040
|
inst._zod.parse = base;
|
|
24979
25041
|
if (inst._zod.run === wrapped)
|
|
24980
25042
|
inst._zod.run = base;
|
|
24981
25043
|
return base(payload, ctx);
|
|
24982
25044
|
}
|
|
25045
|
+
if (walked === PROVEN || rechecked)
|
|
25046
|
+
isRecursiveInst = true;
|
|
25047
|
+
else
|
|
25048
|
+
rechecked = true;
|
|
24983
25049
|
}
|
|
24984
25050
|
const input = payload.value;
|
|
24985
|
-
if (input
|
|
25051
|
+
if (!isRef(input))
|
|
24986
25052
|
return base(payload, ctx);
|
|
24987
25053
|
let state = ctx[STATE];
|
|
24988
25054
|
if (!state) {
|
|
24989
|
-
state = { buckets: new
|
|
25055
|
+
state = { buckets: new WeakMap, backEdges: undefined };
|
|
24990
25056
|
ctx[STATE] = state;
|
|
24991
25057
|
}
|
|
24992
25058
|
let bucket;
|
|
@@ -25005,7 +25071,7 @@ var memo = {
|
|
|
25005
25071
|
payload.issues.push(...cloneIssues(hit.issues));
|
|
25006
25072
|
} else {
|
|
25007
25073
|
payload.memo = true;
|
|
25008
|
-
state.backEdges ?? (state.backEdges = new
|
|
25074
|
+
state.backEdges ?? (state.backEdges = new WeakSet);
|
|
25009
25075
|
state.backEdges.add(hit.value);
|
|
25010
25076
|
}
|
|
25011
25077
|
return payload;
|
|
@@ -25037,7 +25103,7 @@ function memoizer() {
|
|
|
25037
25103
|
}
|
|
25038
25104
|
function isBackEdge(ctx, value) {
|
|
25039
25105
|
const backEdges = ctx[STATE]?.backEdges;
|
|
25040
|
-
return backEdges !== undefined && value
|
|
25106
|
+
return backEdges !== undefined && isRef(value) && backEdges.has(value);
|
|
25041
25107
|
}
|
|
25042
25108
|
// node_modules/zod/v4/locales/en.js
|
|
25043
25109
|
var error = () => {
|
|
@@ -25079,7 +25145,9 @@ var error = () => {
|
|
|
25079
25145
|
base64url: "base64url-encoded string",
|
|
25080
25146
|
json_string: "JSON string",
|
|
25081
25147
|
e164: "E.164 number",
|
|
25148
|
+
currency_code: "currency code",
|
|
25082
25149
|
credit_card: "credit card number",
|
|
25150
|
+
iban: "IBAN",
|
|
25083
25151
|
jwt: "JWT",
|
|
25084
25152
|
template_literal: "input"
|
|
25085
25153
|
};
|
|
@@ -25207,18 +25275,16 @@ function registry() {
|
|
|
25207
25275
|
(_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
|
|
25208
25276
|
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
25209
25277
|
// node_modules/zod/v4/core/api.js
|
|
25278
|
+
function snapshotChecks(def) {
|
|
25279
|
+
if (def.checks)
|
|
25280
|
+
def.checks = [...def.checks];
|
|
25281
|
+
return def;
|
|
25282
|
+
}
|
|
25210
25283
|
function _string(Class, params) {
|
|
25211
|
-
return new Class({
|
|
25212
|
-
type: "string",
|
|
25213
|
-
...normalizeParams(params)
|
|
25214
|
-
});
|
|
25284
|
+
return new Class(snapshotChecks({ type: "string", ...normalizeParams(params) }));
|
|
25215
25285
|
}
|
|
25216
25286
|
function _coercedString(Class, params) {
|
|
25217
|
-
return new Class({
|
|
25218
|
-
type: "string",
|
|
25219
|
-
coerce: true,
|
|
25220
|
-
...normalizeParams(params)
|
|
25221
|
-
});
|
|
25287
|
+
return new Class(snapshotChecks({ type: "string", coerce: true, ...normalizeParams(params) }));
|
|
25222
25288
|
}
|
|
25223
25289
|
function _email(Class, params) {
|
|
25224
25290
|
return new Class({
|
|
@@ -25458,19 +25524,10 @@ function _isoDuration(Class, params) {
|
|
|
25458
25524
|
});
|
|
25459
25525
|
}
|
|
25460
25526
|
function _number(Class, params) {
|
|
25461
|
-
return new Class({
|
|
25462
|
-
type: "number",
|
|
25463
|
-
checks: [],
|
|
25464
|
-
...normalizeParams(params)
|
|
25465
|
-
});
|
|
25527
|
+
return new Class(snapshotChecks({ type: "number", checks: [], ...normalizeParams(params) }));
|
|
25466
25528
|
}
|
|
25467
25529
|
function _coercedNumber(Class, params) {
|
|
25468
|
-
return new Class({
|
|
25469
|
-
type: "number",
|
|
25470
|
-
coerce: true,
|
|
25471
|
-
checks: [],
|
|
25472
|
-
...normalizeParams(params)
|
|
25473
|
-
});
|
|
25530
|
+
return new Class(snapshotChecks({ type: "number", coerce: true, checks: [], ...normalizeParams(params) }));
|
|
25474
25531
|
}
|
|
25475
25532
|
function _int(Class, params) {
|
|
25476
25533
|
return new Class({
|
|
@@ -25753,7 +25810,7 @@ function handleUnrepresentable(schema, ctx, json, params, message) {
|
|
|
25753
25810
|
Object.assign(json, result);
|
|
25754
25811
|
return true;
|
|
25755
25812
|
}
|
|
25756
|
-
function
|
|
25813
|
+
function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
25757
25814
|
var _a;
|
|
25758
25815
|
const def = schema._zod.def;
|
|
25759
25816
|
const seen = ctx.seen.get(schema);
|
|
@@ -25792,7 +25849,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
25792
25849
|
if (parent) {
|
|
25793
25850
|
if (!result.ref)
|
|
25794
25851
|
result.ref = parent;
|
|
25795
|
-
|
|
25852
|
+
processSchema(parent, ctx, params);
|
|
25796
25853
|
ctx.seen.get(parent).isParent = true;
|
|
25797
25854
|
}
|
|
25798
25855
|
}
|
|
@@ -25897,7 +25954,6 @@ function extractDefs(ctx, schema) {
|
|
|
25897
25954
|
if (seen.count > 1) {
|
|
25898
25955
|
if (ctx.reused === "ref") {
|
|
25899
25956
|
extractToDef(entry);
|
|
25900
|
-
continue;
|
|
25901
25957
|
}
|
|
25902
25958
|
}
|
|
25903
25959
|
}
|
|
@@ -26222,18 +26278,106 @@ function isTransforming(_schema, _ctx) {
|
|
|
26222
26278
|
}
|
|
26223
26279
|
var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
26224
26280
|
const ctx = initializeContext({ ...params, processors });
|
|
26225
|
-
|
|
26281
|
+
processSchema(schema, ctx);
|
|
26226
26282
|
extractDefs(ctx, schema);
|
|
26227
26283
|
return finalize(ctx, schema);
|
|
26228
26284
|
};
|
|
26229
26285
|
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
26230
26286
|
const { libraryOptions, target } = params ?? {};
|
|
26231
26287
|
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
26232
|
-
|
|
26288
|
+
processSchema(schema, ctx);
|
|
26233
26289
|
extractDefs(ctx, schema);
|
|
26234
26290
|
return finalize(ctx, schema);
|
|
26235
26291
|
};
|
|
26236
26292
|
// node_modules/zod/v4/core/json-schema-processors.js
|
|
26293
|
+
var narrowMin = (agg, key, value) => {
|
|
26294
|
+
if (agg[key] === undefined || value > agg[key])
|
|
26295
|
+
agg[key] = value;
|
|
26296
|
+
};
|
|
26297
|
+
var narrowMax = (agg, key, value) => {
|
|
26298
|
+
if (agg[key] === undefined || value < agg[key])
|
|
26299
|
+
agg[key] = value;
|
|
26300
|
+
};
|
|
26301
|
+
var narrowBoth = (agg, value) => {
|
|
26302
|
+
narrowMin(agg, "minimum", value);
|
|
26303
|
+
narrowMax(agg, "maximum", value);
|
|
26304
|
+
};
|
|
26305
|
+
var addDivisor = (agg, value) => {
|
|
26306
|
+
agg.multipleOf ?? (agg.multipleOf = []);
|
|
26307
|
+
if (!agg.multipleOf.includes(value))
|
|
26308
|
+
agg.multipleOf.push(value);
|
|
26309
|
+
};
|
|
26310
|
+
var addPattern = (agg, pattern) => {
|
|
26311
|
+
agg.patterns ?? (agg.patterns = new Set);
|
|
26312
|
+
agg.patterns.add(pattern);
|
|
26313
|
+
};
|
|
26314
|
+
var intersectMime = (agg, mime) => {
|
|
26315
|
+
agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
|
|
26316
|
+
};
|
|
26317
|
+
var setFormat = (agg, format) => {
|
|
26318
|
+
agg.format = format;
|
|
26319
|
+
if (format.includes("int"))
|
|
26320
|
+
agg.isInt = true;
|
|
26321
|
+
};
|
|
26322
|
+
var minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
|
|
26323
|
+
var maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
|
|
26324
|
+
var formatContributor = (ranges) => (agg, def) => {
|
|
26325
|
+
setFormat(agg, def.format);
|
|
26326
|
+
const [minimum, maximum] = ranges[def.format];
|
|
26327
|
+
narrowMin(agg, "minimum", minimum);
|
|
26328
|
+
narrowMax(agg, "maximum", maximum);
|
|
26329
|
+
};
|
|
26330
|
+
var contributors = {
|
|
26331
|
+
greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
|
|
26332
|
+
less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
|
|
26333
|
+
multiple_of: (agg, def) => addDivisor(agg, def.value),
|
|
26334
|
+
number_format: formatContributor(NUMBER_FORMAT_RANGES),
|
|
26335
|
+
bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
|
|
26336
|
+
min_length: minContributor,
|
|
26337
|
+
max_length: maxContributor,
|
|
26338
|
+
length_equals: (agg, def) => narrowBoth(agg, def.length),
|
|
26339
|
+
min_size: minContributor,
|
|
26340
|
+
max_size: maxContributor,
|
|
26341
|
+
size_equals: (agg, def) => narrowBoth(agg, def.size),
|
|
26342
|
+
string_format: (agg, def) => {
|
|
26343
|
+
setFormat(agg, def.format);
|
|
26344
|
+
if (def.pattern)
|
|
26345
|
+
addPattern(agg, def.pattern);
|
|
26346
|
+
if (def.format === "base64" || def.format === "base64url")
|
|
26347
|
+
agg.contentEncoding = def.format;
|
|
26348
|
+
if (def.local || def.precision === -1)
|
|
26349
|
+
agg.laxFormat = true;
|
|
26350
|
+
},
|
|
26351
|
+
mime_type: (agg, def) => intersectMime(agg, def.mime)
|
|
26352
|
+
};
|
|
26353
|
+
function aggregateChecks(schema) {
|
|
26354
|
+
const agg = {};
|
|
26355
|
+
const def = schema._zod.def;
|
|
26356
|
+
const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
|
|
26357
|
+
for (const ch of list)
|
|
26358
|
+
contributors[ch._zod.def.check]?.(agg, ch._zod.def);
|
|
26359
|
+
const bag = schema._zod.bag;
|
|
26360
|
+
if (bag.minimum !== undefined)
|
|
26361
|
+
narrowMin(agg, "minimum", bag.minimum);
|
|
26362
|
+
if (bag.exclusiveMinimum !== undefined)
|
|
26363
|
+
narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
|
|
26364
|
+
if (bag.maximum !== undefined)
|
|
26365
|
+
narrowMax(agg, "maximum", bag.maximum);
|
|
26366
|
+
if (bag.exclusiveMaximum !== undefined)
|
|
26367
|
+
narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
|
|
26368
|
+
if (bag.multipleOf !== undefined)
|
|
26369
|
+
addDivisor(agg, bag.multipleOf);
|
|
26370
|
+
if (bag.format !== undefined) {
|
|
26371
|
+
agg.format ?? (agg.format = bag.format);
|
|
26372
|
+
if (bag.format.includes("int"))
|
|
26373
|
+
agg.isInt = true;
|
|
26374
|
+
}
|
|
26375
|
+
if (bag.mime)
|
|
26376
|
+
intersectMime(agg, bag.mime);
|
|
26377
|
+
for (const pattern of bag.patterns ?? [])
|
|
26378
|
+
addPattern(agg, pattern);
|
|
26379
|
+
return agg;
|
|
26380
|
+
}
|
|
26237
26381
|
var formatMap = {
|
|
26238
26382
|
guid: "uuid",
|
|
26239
26383
|
url: "uri",
|
|
@@ -26241,10 +26385,15 @@ var formatMap = {
|
|
|
26241
26385
|
json_string: "json-string",
|
|
26242
26386
|
regex: ""
|
|
26243
26387
|
};
|
|
26388
|
+
var exactPatterns = new Map([
|
|
26389
|
+
[base64Charset, base64],
|
|
26390
|
+
[base64urlCharset, base64url]
|
|
26391
|
+
]);
|
|
26392
|
+
var exactPattern = (p) => exactPatterns.get(p) ?? p;
|
|
26244
26393
|
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
26245
26394
|
const json = _json;
|
|
26246
26395
|
json.type = "string";
|
|
26247
|
-
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema
|
|
26396
|
+
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
|
|
26248
26397
|
if (typeof minimum === "number")
|
|
26249
26398
|
json.minLength = minimum;
|
|
26250
26399
|
if (typeof maximum === "number")
|
|
@@ -26260,7 +26409,7 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
26260
26409
|
if (contentEncoding)
|
|
26261
26410
|
json.contentEncoding = contentEncoding;
|
|
26262
26411
|
if (patterns && patterns.size > 0) {
|
|
26263
|
-
const patternList = [...patterns];
|
|
26412
|
+
const patternList = [...patterns].map(exactPattern);
|
|
26264
26413
|
if (patternList.length === 1)
|
|
26265
26414
|
json.pattern = patternList[0].source;
|
|
26266
26415
|
else if (patternList.length > 1) {
|
|
@@ -26275,11 +26424,8 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
26275
26424
|
};
|
|
26276
26425
|
var numberProcessor = (schema, ctx, _json, params) => {
|
|
26277
26426
|
const json = _json;
|
|
26278
|
-
const { minimum, maximum,
|
|
26279
|
-
|
|
26280
|
-
json.type = "integer";
|
|
26281
|
-
else
|
|
26282
|
-
json.type = "number";
|
|
26427
|
+
const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
|
|
26428
|
+
json.type = isInt ? "integer" : "number";
|
|
26283
26429
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
26284
26430
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
26285
26431
|
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
@@ -26303,11 +26449,19 @@ var numberProcessor = (schema, ctx, _json, params) => {
|
|
|
26303
26449
|
} else if (typeof maximum === "number") {
|
|
26304
26450
|
json.maximum = maximum;
|
|
26305
26451
|
}
|
|
26306
|
-
if (
|
|
26307
|
-
|
|
26308
|
-
|
|
26309
|
-
|
|
26310
|
-
|
|
26452
|
+
if (multipleOf) {
|
|
26453
|
+
const divisors = new Set;
|
|
26454
|
+
for (const divisor of multipleOf) {
|
|
26455
|
+
if (Number.isFinite(divisor) && divisor !== 0)
|
|
26456
|
+
divisors.add(Math.abs(divisor));
|
|
26457
|
+
else
|
|
26458
|
+
handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
|
|
26459
|
+
}
|
|
26460
|
+
const [first, ...rest] = divisors;
|
|
26461
|
+
if (first !== undefined)
|
|
26462
|
+
json.multipleOf = first;
|
|
26463
|
+
if (rest.length)
|
|
26464
|
+
json.allOf = [...json.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
|
|
26311
26465
|
}
|
|
26312
26466
|
};
|
|
26313
26467
|
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
@@ -26407,27 +26561,22 @@ var templateLiteralProcessor = (schema, _ctx, json, _params) => {
|
|
|
26407
26561
|
};
|
|
26408
26562
|
var fileProcessor = (schema, _ctx, json, _params) => {
|
|
26409
26563
|
const _json = json;
|
|
26410
|
-
|
|
26411
|
-
|
|
26412
|
-
|
|
26413
|
-
|
|
26414
|
-
};
|
|
26415
|
-
const { minimum, maximum, mime } = schema._zod.bag;
|
|
26564
|
+
_json.type = "string";
|
|
26565
|
+
_json.format = "binary";
|
|
26566
|
+
_json.contentEncoding = "binary";
|
|
26567
|
+
const { minimum, maximum, mime } = aggregateChecks(schema);
|
|
26416
26568
|
if (minimum !== undefined)
|
|
26417
|
-
|
|
26569
|
+
_json.minLength = minimum;
|
|
26418
26570
|
if (maximum !== undefined)
|
|
26419
|
-
|
|
26420
|
-
if (mime)
|
|
26421
|
-
|
|
26422
|
-
|
|
26423
|
-
|
|
26424
|
-
|
|
26425
|
-
|
|
26426
|
-
|
|
26427
|
-
}
|
|
26428
|
-
} else {
|
|
26429
|
-
Object.assign(_json, file);
|
|
26430
|
-
}
|
|
26571
|
+
_json.maxLength = maximum;
|
|
26572
|
+
if (!mime)
|
|
26573
|
+
return;
|
|
26574
|
+
if (mime.length === 0)
|
|
26575
|
+
_json.not = {};
|
|
26576
|
+
else if (mime.length === 1)
|
|
26577
|
+
_json.contentMediaType = mime[0];
|
|
26578
|
+
else
|
|
26579
|
+
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
26431
26580
|
};
|
|
26432
26581
|
var successProcessor = (_schema, _ctx, json, _params) => {
|
|
26433
26582
|
json.type = "boolean";
|
|
@@ -26450,13 +26599,13 @@ var setProcessor = (schema, ctx, json, params) => {
|
|
|
26450
26599
|
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
26451
26600
|
const json = _json;
|
|
26452
26601
|
const def = schema._zod.def;
|
|
26453
|
-
const { minimum, maximum } = schema
|
|
26602
|
+
const { minimum, maximum } = aggregateChecks(schema);
|
|
26454
26603
|
if (typeof minimum === "number")
|
|
26455
26604
|
json.minItems = minimum;
|
|
26456
26605
|
if (typeof maximum === "number")
|
|
26457
26606
|
json.maxItems = maximum;
|
|
26458
26607
|
json.type = "array";
|
|
26459
|
-
json.items =
|
|
26608
|
+
json.items = processSchema(def.element, ctx, {
|
|
26460
26609
|
...params,
|
|
26461
26610
|
path: [...params.path, "items"]
|
|
26462
26611
|
});
|
|
@@ -26482,22 +26631,20 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
26482
26631
|
json.type = "object";
|
|
26483
26632
|
json.properties = {};
|
|
26484
26633
|
for (const key in shape) {
|
|
26485
|
-
assignProp(json.properties, key,
|
|
26634
|
+
assignProp(json.properties, key, processSchema(shape[key], ctx, {
|
|
26486
26635
|
...params,
|
|
26487
26636
|
path: [...params.path, "properties", key]
|
|
26488
26637
|
}));
|
|
26489
26638
|
}
|
|
26490
|
-
const
|
|
26491
|
-
const
|
|
26639
|
+
const requiredKeys = [];
|
|
26640
|
+
for (const key of Object.keys(shape)) {
|
|
26492
26641
|
const field = def.shape[key];
|
|
26493
|
-
if (ctx.io === "input") {
|
|
26494
|
-
|
|
26495
|
-
} else {
|
|
26496
|
-
return field._zod.optout === undefined;
|
|
26642
|
+
if (ctx.io === "input" ? inputOptin(field) === undefined : field._zod.optout === undefined) {
|
|
26643
|
+
requiredKeys.push(key);
|
|
26497
26644
|
}
|
|
26498
|
-
}
|
|
26499
|
-
if (requiredKeys.
|
|
26500
|
-
json.required =
|
|
26645
|
+
}
|
|
26646
|
+
if (requiredKeys.length > 0) {
|
|
26647
|
+
json.required = requiredKeys;
|
|
26501
26648
|
}
|
|
26502
26649
|
if (def.catchall?._zod.def.type === "never") {
|
|
26503
26650
|
json.additionalProperties = false;
|
|
@@ -26505,7 +26652,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
26505
26652
|
if (ctx.io === "output")
|
|
26506
26653
|
json.additionalProperties = false;
|
|
26507
26654
|
} else if (def.catchall) {
|
|
26508
|
-
json.additionalProperties =
|
|
26655
|
+
json.additionalProperties = processSchema(def.catchall, ctx, {
|
|
26509
26656
|
...params,
|
|
26510
26657
|
path: [...params.path, "additionalProperties"]
|
|
26511
26658
|
});
|
|
@@ -26514,7 +26661,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
26514
26661
|
var unionProcessor = (schema, ctx, json, params) => {
|
|
26515
26662
|
const def = schema._zod.def;
|
|
26516
26663
|
const isExclusive = def.inclusive === false;
|
|
26517
|
-
const options = def.options.map((x, i) =>
|
|
26664
|
+
const options = def.options.map((x, i) => processSchema(x, ctx, {
|
|
26518
26665
|
...params,
|
|
26519
26666
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
26520
26667
|
}));
|
|
@@ -26526,11 +26673,11 @@ var unionProcessor = (schema, ctx, json, params) => {
|
|
|
26526
26673
|
};
|
|
26527
26674
|
var intersectionProcessor = (schema, ctx, json, params) => {
|
|
26528
26675
|
const def = schema._zod.def;
|
|
26529
|
-
const a =
|
|
26676
|
+
const a = processSchema(def.left, ctx, {
|
|
26530
26677
|
...params,
|
|
26531
26678
|
path: [...params.path, "allOf", 0]
|
|
26532
26679
|
});
|
|
26533
|
-
const b =
|
|
26680
|
+
const b = processSchema(def.right, ctx, {
|
|
26534
26681
|
...params,
|
|
26535
26682
|
path: [...params.path, "allOf", 1]
|
|
26536
26683
|
});
|
|
@@ -26548,11 +26695,11 @@ var tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
26548
26695
|
json.type = "array";
|
|
26549
26696
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
26550
26697
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
26551
|
-
const prefixItems = def.items.map((x, i) =>
|
|
26698
|
+
const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
|
|
26552
26699
|
...params,
|
|
26553
26700
|
path: [...params.path, prefixPath, i]
|
|
26554
26701
|
}));
|
|
26555
|
-
const rest = def.rest ?
|
|
26702
|
+
const rest = def.rest ? processSchema(def.rest, ctx, {
|
|
26556
26703
|
...params,
|
|
26557
26704
|
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
|
|
26558
26705
|
}) : null;
|
|
@@ -26600,7 +26747,7 @@ var tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
26600
26747
|
if (isClosed)
|
|
26601
26748
|
json.maxItems = maxItems;
|
|
26602
26749
|
}
|
|
26603
|
-
const { minimum, maximum } = schema
|
|
26750
|
+
const { minimum, maximum } = aggregateChecks(schema);
|
|
26604
26751
|
if (typeof minimum === "number")
|
|
26605
26752
|
json.minItems = minimum;
|
|
26606
26753
|
if (typeof maximum === "number")
|
|
@@ -26674,20 +26821,19 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
26674
26821
|
const def = schema._zod.def;
|
|
26675
26822
|
json.type = "object";
|
|
26676
26823
|
const keyType = def.keyType;
|
|
26677
|
-
const
|
|
26678
|
-
const patterns = keyBag?.patterns;
|
|
26824
|
+
const patterns = aggregateChecks(keyType).patterns;
|
|
26679
26825
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
26680
|
-
const valueSchema =
|
|
26826
|
+
const valueSchema = processSchema(def.valueType, ctx, {
|
|
26681
26827
|
...params,
|
|
26682
26828
|
path: [...params.path, "patternProperties", "*"]
|
|
26683
26829
|
});
|
|
26684
26830
|
json.patternProperties = {};
|
|
26685
26831
|
for (const pattern of patterns) {
|
|
26686
|
-
assignProp(json.patternProperties, pattern.source, valueSchema);
|
|
26832
|
+
assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);
|
|
26687
26833
|
}
|
|
26688
26834
|
} else {
|
|
26689
26835
|
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
26690
|
-
json.propertyNames =
|
|
26836
|
+
json.propertyNames = processSchema(def.keyType, ctx, {
|
|
26691
26837
|
...params,
|
|
26692
26838
|
path: [...params.path, "propertyNames"]
|
|
26693
26839
|
});
|
|
@@ -26699,7 +26845,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
26699
26845
|
}
|
|
26700
26846
|
pending.push(schema);
|
|
26701
26847
|
}
|
|
26702
|
-
json.additionalProperties =
|
|
26848
|
+
json.additionalProperties = processSchema(def.valueType, ctx, {
|
|
26703
26849
|
...params,
|
|
26704
26850
|
path: [...params.path, "additionalProperties"]
|
|
26705
26851
|
});
|
|
@@ -26715,7 +26861,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
26715
26861
|
};
|
|
26716
26862
|
var nullableProcessor = (schema, ctx, json, params) => {
|
|
26717
26863
|
const def = schema._zod.def;
|
|
26718
|
-
const inner =
|
|
26864
|
+
const inner = processSchema(def.innerType, ctx, params);
|
|
26719
26865
|
const seen = ctx.seen.get(schema);
|
|
26720
26866
|
if (ctx.target === "openapi-3.0") {
|
|
26721
26867
|
seen.ref = def.innerType;
|
|
@@ -26726,7 +26872,7 @@ var nullableProcessor = (schema, ctx, json, params) => {
|
|
|
26726
26872
|
};
|
|
26727
26873
|
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
26728
26874
|
const def = schema._zod.def;
|
|
26729
|
-
|
|
26875
|
+
processSchema(def.innerType, ctx, params);
|
|
26730
26876
|
const seen = ctx.seen.get(schema);
|
|
26731
26877
|
seen.ref = def.innerType;
|
|
26732
26878
|
};
|
|
@@ -26746,7 +26892,7 @@ function serializeDefaultValue(value, schema, ctx, json, params) {
|
|
|
26746
26892
|
}
|
|
26747
26893
|
var defaultProcessor = (schema, ctx, json, params) => {
|
|
26748
26894
|
const def = schema._zod.def;
|
|
26749
|
-
|
|
26895
|
+
processSchema(def.innerType, ctx, params);
|
|
26750
26896
|
const seen = ctx.seen.get(schema);
|
|
26751
26897
|
seen.ref = def.innerType;
|
|
26752
26898
|
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
@@ -26755,7 +26901,7 @@ var defaultProcessor = (schema, ctx, json, params) => {
|
|
|
26755
26901
|
};
|
|
26756
26902
|
var prefaultProcessor = (schema, ctx, json, params) => {
|
|
26757
26903
|
const def = schema._zod.def;
|
|
26758
|
-
|
|
26904
|
+
processSchema(def.innerType, ctx, params);
|
|
26759
26905
|
const seen = ctx.seen.get(schema);
|
|
26760
26906
|
seen.ref = def.innerType;
|
|
26761
26907
|
if (ctx.io !== "input")
|
|
@@ -26766,7 +26912,7 @@ var prefaultProcessor = (schema, ctx, json, params) => {
|
|
|
26766
26912
|
};
|
|
26767
26913
|
var catchProcessor = (schema, ctx, json, params) => {
|
|
26768
26914
|
const def = schema._zod.def;
|
|
26769
|
-
|
|
26915
|
+
processSchema(def.innerType, ctx, params);
|
|
26770
26916
|
const seen = ctx.seen.get(schema);
|
|
26771
26917
|
seen.ref = def.innerType;
|
|
26772
26918
|
let catchValue;
|
|
@@ -26782,32 +26928,32 @@ var pipeProcessor = (schema, ctx, _json, params) => {
|
|
|
26782
26928
|
const def = schema._zod.def;
|
|
26783
26929
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
26784
26930
|
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
26785
|
-
|
|
26931
|
+
processSchema(innerType, ctx, params);
|
|
26786
26932
|
const seen = ctx.seen.get(schema);
|
|
26787
26933
|
seen.ref = innerType;
|
|
26788
26934
|
};
|
|
26789
26935
|
var readonlyProcessor = (schema, ctx, json, params) => {
|
|
26790
26936
|
const def = schema._zod.def;
|
|
26791
|
-
|
|
26937
|
+
processSchema(def.innerType, ctx, params);
|
|
26792
26938
|
const seen = ctx.seen.get(schema);
|
|
26793
26939
|
seen.ref = def.innerType;
|
|
26794
26940
|
json.readOnly = true;
|
|
26795
26941
|
};
|
|
26796
26942
|
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
26797
26943
|
const def = schema._zod.def;
|
|
26798
|
-
|
|
26944
|
+
processSchema(def.innerType, ctx, params);
|
|
26799
26945
|
const seen = ctx.seen.get(schema);
|
|
26800
26946
|
seen.ref = def.innerType;
|
|
26801
26947
|
};
|
|
26802
26948
|
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
26803
26949
|
const def = schema._zod.def;
|
|
26804
|
-
|
|
26950
|
+
processSchema(def.innerType, ctx, params);
|
|
26805
26951
|
const seen = ctx.seen.get(schema);
|
|
26806
26952
|
seen.ref = def.innerType;
|
|
26807
26953
|
};
|
|
26808
26954
|
var lazyProcessor = (schema, ctx, _json, params) => {
|
|
26809
26955
|
const innerType = schema._zod.innerType;
|
|
26810
|
-
|
|
26956
|
+
processSchema(innerType, ctx, params);
|
|
26811
26957
|
const seen = ctx.seen.get(schema);
|
|
26812
26958
|
seen.ref = innerType;
|
|
26813
26959
|
};
|
|
@@ -26859,7 +27005,7 @@ function toJSONSchema(input, params) {
|
|
|
26859
27005
|
const defs = {};
|
|
26860
27006
|
for (const entry of registry._idmap.entries()) {
|
|
26861
27007
|
const [_, schema] = entry;
|
|
26862
|
-
|
|
27008
|
+
processSchema(schema, ctx);
|
|
26863
27009
|
}
|
|
26864
27010
|
const schemas = {};
|
|
26865
27011
|
const external = {
|
|
@@ -26882,7 +27028,7 @@ function toJSONSchema(input, params) {
|
|
|
26882
27028
|
return { schemas };
|
|
26883
27029
|
}
|
|
26884
27030
|
const ctx = initializeContext({ ...params, processors: allProcessors });
|
|
26885
|
-
|
|
27031
|
+
processSchema(input, ctx);
|
|
26886
27032
|
extractDefs(ctx, input);
|
|
26887
27033
|
return finalize(ctx, input);
|
|
26888
27034
|
}
|
|
@@ -27308,6 +27454,12 @@ var ZodType2 = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
27308
27454
|
set spa(value) {
|
|
27309
27455
|
own(this, "spa", value);
|
|
27310
27456
|
},
|
|
27457
|
+
validate(data, params) {
|
|
27458
|
+
return validate(this, data, params);
|
|
27459
|
+
},
|
|
27460
|
+
validateAsync(data, params) {
|
|
27461
|
+
return validateAsync(this, data, params);
|
|
27462
|
+
},
|
|
27311
27463
|
encode: function _encode(data, params) {
|
|
27312
27464
|
return encode2(this, data, params, { callee: _encode });
|
|
27313
27465
|
},
|
|
@@ -27346,10 +27498,10 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
|
27346
27498
|
$ZodString.init(inst, def);
|
|
27347
27499
|
ZodType2.init(inst, def);
|
|
27348
27500
|
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
27349
|
-
|
|
27350
|
-
|
|
27351
|
-
|
|
27352
|
-
|
|
27501
|
+
}, /* @__PURE__ */ derived({
|
|
27502
|
+
format: (inst) => aggregateChecks(inst).format ?? null,
|
|
27503
|
+
minLength: (inst) => aggregateChecks(inst).minimum ?? null,
|
|
27504
|
+
maxLength: (inst) => aggregateChecks(inst).maximum ?? null
|
|
27353
27505
|
}, {
|
|
27354
27506
|
regex(...args) {
|
|
27355
27507
|
return this.check(_regex(...args));
|
|
@@ -27396,7 +27548,7 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
|
27396
27548
|
slugify() {
|
|
27397
27549
|
return this.check(_slugify());
|
|
27398
27550
|
}
|
|
27399
|
-
});
|
|
27551
|
+
}));
|
|
27400
27552
|
var ZodString2 = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
27401
27553
|
$ZodString.init(inst, def);
|
|
27402
27554
|
_ZodString.init(inst, def);
|
|
@@ -27583,12 +27735,21 @@ var ZodNumber2 = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
|
27583
27735
|
$ZodNumber.init(inst, def);
|
|
27584
27736
|
ZodType2.init(inst, def);
|
|
27585
27737
|
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
27586
|
-
const bag = inst._zod.bag;
|
|
27587
|
-
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
27588
|
-
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
27589
|
-
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
|
|
27590
27738
|
inst.isFinite = true;
|
|
27591
|
-
|
|
27739
|
+
}, /* @__PURE__ */ derived({
|
|
27740
|
+
minValue: (inst) => {
|
|
27741
|
+
const { minimum, exclusiveMinimum } = aggregateChecks(inst);
|
|
27742
|
+
return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
|
|
27743
|
+
},
|
|
27744
|
+
maxValue: (inst) => {
|
|
27745
|
+
const { maximum, exclusiveMaximum } = aggregateChecks(inst);
|
|
27746
|
+
return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
|
|
27747
|
+
},
|
|
27748
|
+
isInt: (inst) => {
|
|
27749
|
+
const { isInt, multipleOf } = aggregateChecks(inst);
|
|
27750
|
+
return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
|
|
27751
|
+
},
|
|
27752
|
+
format: (inst) => aggregateChecks(inst).format ?? null
|
|
27592
27753
|
}, {
|
|
27593
27754
|
gt(value, params) {
|
|
27594
27755
|
return this.check(_gt(value, params));
|
|
@@ -27635,7 +27796,7 @@ var ZodNumber2 = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
|
27635
27796
|
finite() {
|
|
27636
27797
|
return this;
|
|
27637
27798
|
}
|
|
27638
|
-
});
|
|
27799
|
+
}));
|
|
27639
27800
|
function number2(params) {
|
|
27640
27801
|
return _number(ZodNumber2, params);
|
|
27641
27802
|
}
|
|
@@ -27658,10 +27819,10 @@ var ZodBigInt2 = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
|
27658
27819
|
$ZodBigInt.init(inst, def);
|
|
27659
27820
|
ZodType2.init(inst, def);
|
|
27660
27821
|
inst._zod.processJSONSchema = (ctx, json, params) => bigintProcessor(inst, ctx, json, params);
|
|
27661
|
-
|
|
27662
|
-
|
|
27663
|
-
|
|
27664
|
-
|
|
27822
|
+
}, /* @__PURE__ */ derived({
|
|
27823
|
+
minValue: (inst) => aggregateChecks(inst).minimum ?? null,
|
|
27824
|
+
maxValue: (inst) => aggregateChecks(inst).maximum ?? null,
|
|
27825
|
+
format: (inst) => aggregateChecks(inst).format ?? null
|
|
27665
27826
|
}, {
|
|
27666
27827
|
gte(value, params) {
|
|
27667
27828
|
return this.check(_gte(value, params));
|
|
@@ -27696,7 +27857,7 @@ var ZodBigInt2 = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
|
27696
27857
|
multipleOf(value, params) {
|
|
27697
27858
|
return this.check(_multipleOf(value, params));
|
|
27698
27859
|
}
|
|
27699
|
-
});
|
|
27860
|
+
}));
|
|
27700
27861
|
var ZodNull2 = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
27701
27862
|
$ZodNull.init(inst, def);
|
|
27702
27863
|
ZodType2.init(inst, def);
|
|
@@ -27727,10 +27888,16 @@ var ZodDate2 = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
|
27727
27888
|
inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx, json, params);
|
|
27728
27889
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
27729
27890
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
27730
|
-
|
|
27731
|
-
|
|
27732
|
-
|
|
27733
|
-
|
|
27891
|
+
}, /* @__PURE__ */ derived({
|
|
27892
|
+
minDate: (inst) => {
|
|
27893
|
+
const { minimum } = aggregateChecks(inst);
|
|
27894
|
+
return minimum ? new Date(minimum) : null;
|
|
27895
|
+
},
|
|
27896
|
+
maxDate: (inst) => {
|
|
27897
|
+
const { maximum } = aggregateChecks(inst);
|
|
27898
|
+
return maximum ? new Date(maximum) : null;
|
|
27899
|
+
}
|
|
27900
|
+
}, {}));
|
|
27734
27901
|
var ZodArray2 = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
27735
27902
|
_ensureDefaultMemoizer();
|
|
27736
27903
|
$ZodArray.init(inst, def);
|
|
@@ -27768,19 +27935,19 @@ var ZodObject2 = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
27768
27935
|
return _enum(Object.keys(this._zod.def.shape));
|
|
27769
27936
|
},
|
|
27770
27937
|
catchall(catchall) {
|
|
27771
|
-
return this.clone(
|
|
27938
|
+
return this.clone(mergeDefs(this._zod.def, { catchall }));
|
|
27772
27939
|
},
|
|
27773
27940
|
passthrough() {
|
|
27774
|
-
return this.clone(
|
|
27941
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
27775
27942
|
},
|
|
27776
27943
|
loose() {
|
|
27777
|
-
return this.clone(
|
|
27944
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
27778
27945
|
},
|
|
27779
27946
|
strict() {
|
|
27780
|
-
return this.clone(
|
|
27947
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
|
|
27781
27948
|
},
|
|
27782
27949
|
strip() {
|
|
27783
|
-
return this.clone(
|
|
27950
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: undefined }));
|
|
27784
27951
|
},
|
|
27785
27952
|
extend(incoming) {
|
|
27786
27953
|
return extend(this, incoming);
|
|
@@ -27889,7 +28056,7 @@ var ZodEnum2 = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
27889
28056
|
ZodType2.init(inst, def);
|
|
27890
28057
|
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
27891
28058
|
inst.enum = def.entries;
|
|
27892
|
-
inst.options =
|
|
28059
|
+
inst.options = [...inst._zod.values];
|
|
27893
28060
|
const keys = new Set(Object.keys(def.entries));
|
|
27894
28061
|
inst.extract = (values, params) => {
|
|
27895
28062
|
const newEntries = {};
|
|
@@ -29366,7 +29533,7 @@ function parseStringDef(def, refs) {
|
|
|
29366
29533
|
addFormat(res, "idn-email", check.message, refs);
|
|
29367
29534
|
break;
|
|
29368
29535
|
case "pattern:zod":
|
|
29369
|
-
|
|
29536
|
+
addPattern2(res, zodPatterns.email, check.message, refs);
|
|
29370
29537
|
break;
|
|
29371
29538
|
}
|
|
29372
29539
|
break;
|
|
@@ -29377,19 +29544,19 @@ function parseStringDef(def, refs) {
|
|
|
29377
29544
|
addFormat(res, "uuid", check.message, refs);
|
|
29378
29545
|
break;
|
|
29379
29546
|
case "regex":
|
|
29380
|
-
|
|
29547
|
+
addPattern2(res, check.regex, check.message, refs);
|
|
29381
29548
|
break;
|
|
29382
29549
|
case "cuid":
|
|
29383
|
-
|
|
29550
|
+
addPattern2(res, zodPatterns.cuid, check.message, refs);
|
|
29384
29551
|
break;
|
|
29385
29552
|
case "cuid2":
|
|
29386
|
-
|
|
29553
|
+
addPattern2(res, zodPatterns.cuid2, check.message, refs);
|
|
29387
29554
|
break;
|
|
29388
29555
|
case "startsWith":
|
|
29389
|
-
|
|
29556
|
+
addPattern2(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);
|
|
29390
29557
|
break;
|
|
29391
29558
|
case "endsWith":
|
|
29392
|
-
|
|
29559
|
+
addPattern2(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);
|
|
29393
29560
|
break;
|
|
29394
29561
|
case "datetime":
|
|
29395
29562
|
addFormat(res, "date-time", check.message, refs);
|
|
@@ -29408,7 +29575,7 @@ function parseStringDef(def, refs) {
|
|
|
29408
29575
|
setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
|
29409
29576
|
break;
|
|
29410
29577
|
case "includes": {
|
|
29411
|
-
|
|
29578
|
+
addPattern2(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
|
|
29412
29579
|
break;
|
|
29413
29580
|
}
|
|
29414
29581
|
case "ip": {
|
|
@@ -29421,25 +29588,25 @@ function parseStringDef(def, refs) {
|
|
|
29421
29588
|
break;
|
|
29422
29589
|
}
|
|
29423
29590
|
case "base64url":
|
|
29424
|
-
|
|
29591
|
+
addPattern2(res, zodPatterns.base64url, check.message, refs);
|
|
29425
29592
|
break;
|
|
29426
29593
|
case "jwt":
|
|
29427
|
-
|
|
29594
|
+
addPattern2(res, zodPatterns.jwt, check.message, refs);
|
|
29428
29595
|
break;
|
|
29429
29596
|
case "cidr": {
|
|
29430
29597
|
if (check.version !== "v6") {
|
|
29431
|
-
|
|
29598
|
+
addPattern2(res, zodPatterns.ipv4Cidr, check.message, refs);
|
|
29432
29599
|
}
|
|
29433
29600
|
if (check.version !== "v4") {
|
|
29434
|
-
|
|
29601
|
+
addPattern2(res, zodPatterns.ipv6Cidr, check.message, refs);
|
|
29435
29602
|
}
|
|
29436
29603
|
break;
|
|
29437
29604
|
}
|
|
29438
29605
|
case "emoji":
|
|
29439
|
-
|
|
29606
|
+
addPattern2(res, zodPatterns.emoji(), check.message, refs);
|
|
29440
29607
|
break;
|
|
29441
29608
|
case "ulid": {
|
|
29442
|
-
|
|
29609
|
+
addPattern2(res, zodPatterns.ulid, check.message, refs);
|
|
29443
29610
|
break;
|
|
29444
29611
|
}
|
|
29445
29612
|
case "base64": {
|
|
@@ -29453,14 +29620,14 @@ function parseStringDef(def, refs) {
|
|
|
29453
29620
|
break;
|
|
29454
29621
|
}
|
|
29455
29622
|
case "pattern:zod": {
|
|
29456
|
-
|
|
29623
|
+
addPattern2(res, zodPatterns.base64, check.message, refs);
|
|
29457
29624
|
break;
|
|
29458
29625
|
}
|
|
29459
29626
|
}
|
|
29460
29627
|
break;
|
|
29461
29628
|
}
|
|
29462
29629
|
case "nanoid": {
|
|
29463
|
-
|
|
29630
|
+
addPattern2(res, zodPatterns.nanoid, check.message, refs);
|
|
29464
29631
|
}
|
|
29465
29632
|
case "toLowerCase":
|
|
29466
29633
|
case "toUpperCase":
|
|
@@ -29515,7 +29682,7 @@ function addFormat(schema, value, message, refs) {
|
|
|
29515
29682
|
setResponseValueAndErrors(schema, "format", value, message, refs);
|
|
29516
29683
|
}
|
|
29517
29684
|
}
|
|
29518
|
-
function
|
|
29685
|
+
function addPattern2(schema, regex, message, refs) {
|
|
29519
29686
|
if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
|
|
29520
29687
|
if (!schema.allOf) {
|
|
29521
29688
|
schema.allOf = [];
|
|
@@ -32423,7 +32590,7 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
32423
32590
|
};
|
|
32424
32591
|
|
|
32425
32592
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
32426
|
-
import
|
|
32593
|
+
import process2 from "node:process";
|
|
32427
32594
|
|
|
32428
32595
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
32429
32596
|
var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
|
|
@@ -32467,7 +32634,7 @@ function serializeMessage(message) {
|
|
|
32467
32634
|
|
|
32468
32635
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
32469
32636
|
class StdioServerTransport {
|
|
32470
|
-
constructor(_stdin =
|
|
32637
|
+
constructor(_stdin = process2.stdin, _stdout = process2.stdout, options) {
|
|
32471
32638
|
this._stdin = _stdin;
|
|
32472
32639
|
this._stdout = _stdout;
|
|
32473
32640
|
this._started = false;
|
|
@@ -33912,9 +34079,11 @@ function formatToolForPermission(toolName, input, formatter, options = {}) {
|
|
|
33912
34079
|
});
|
|
33913
34080
|
return result.permissionText ?? result.display ?? toolName;
|
|
33914
34081
|
}
|
|
34082
|
+
// src/operations/transformer.ts
|
|
34083
|
+
init_cli();
|
|
33915
34084
|
// src/session/lifecycle-fsm.ts
|
|
33916
34085
|
init_logger();
|
|
33917
|
-
var
|
|
34086
|
+
var log2 = createLogger("fsm");
|
|
33918
34087
|
var ALLOWED_TRANSITIONS = {
|
|
33919
34088
|
starting: new Set(["active", "paused", "interrupted", "cancelling", "restarting"]),
|
|
33920
34089
|
active: new Set([
|
|
@@ -33956,7 +34125,7 @@ function createSessionLog(baseLog) {
|
|
|
33956
34125
|
init_logger();
|
|
33957
34126
|
|
|
33958
34127
|
// src/version.ts
|
|
33959
|
-
import { readFileSync, existsSync } from "fs";
|
|
34128
|
+
import { readFileSync, existsSync as existsSync2 } from "fs";
|
|
33960
34129
|
import { dirname, resolve } from "path";
|
|
33961
34130
|
import { fileURLToPath } from "url";
|
|
33962
34131
|
var __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
@@ -33967,7 +34136,7 @@ function loadPackageJson() {
|
|
|
33967
34136
|
resolve(process.cwd(), "package.json")
|
|
33968
34137
|
];
|
|
33969
34138
|
for (const candidate of candidates) {
|
|
33970
|
-
if (
|
|
34139
|
+
if (existsSync2(candidate)) {
|
|
33971
34140
|
try {
|
|
33972
34141
|
const pkg = JSON.parse(readFileSync(candidate, "utf-8"));
|
|
33973
34142
|
if (pkg.name === "claude-threads") {
|
|
@@ -33995,23 +34164,34 @@ function formatShortId(id) {
|
|
|
33995
34164
|
}
|
|
33996
34165
|
|
|
33997
34166
|
// src/utils/error-handler/index.ts
|
|
33998
|
-
var
|
|
34167
|
+
var log3 = createLogger("error");
|
|
33999
34168
|
|
|
34000
34169
|
// src/operations/post-helpers/index.ts
|
|
34001
34170
|
init_emoji();
|
|
34002
34171
|
|
|
34003
34172
|
// src/git/worktree.ts
|
|
34004
34173
|
init_spawn();
|
|
34174
|
+
|
|
34175
|
+
// src/utils/state-home.ts
|
|
34176
|
+
import { homedir } from "os";
|
|
34177
|
+
import { resolve as resolve2 } from "path";
|
|
34178
|
+
function stateHome() {
|
|
34179
|
+
return resolve2(process.env.CLAUDE_THREADS_HOME || homedir());
|
|
34180
|
+
}
|
|
34181
|
+
|
|
34182
|
+
// src/git/worktree.ts
|
|
34005
34183
|
import * as path from "path";
|
|
34006
34184
|
init_logger();
|
|
34007
|
-
|
|
34008
|
-
var
|
|
34009
|
-
var
|
|
34010
|
-
var METADATA_STORE_PATH = path.join(homedir(), ".claude-threads", "worktree-metadata.json");
|
|
34185
|
+
var log4 = createLogger("git-wt");
|
|
34186
|
+
var WORKTREES_DIR = path.join(stateHome(), ".claude-threads", "worktrees");
|
|
34187
|
+
var METADATA_STORE_PATH = path.join(stateHome(), ".claude-threads", "worktree-metadata.json");
|
|
34011
34188
|
|
|
34012
34189
|
// src/operations/post-helpers/index.ts
|
|
34013
|
-
var
|
|
34014
|
-
var sessionLog = createSessionLog(
|
|
34190
|
+
var log5 = createLogger("helpers");
|
|
34191
|
+
var sessionLog = createSessionLog(log5);
|
|
34192
|
+
|
|
34193
|
+
// src/operations/message-manager.ts
|
|
34194
|
+
init_types();
|
|
34015
34195
|
|
|
34016
34196
|
// src/operations/task-tracker.ts
|
|
34017
34197
|
var VALID_STATUSES = new Set(["pending", "in_progress", "completed"]);
|
|
@@ -34144,7 +34324,7 @@ init_emoji();
|
|
|
34144
34324
|
|
|
34145
34325
|
// src/persistence/audit-log.ts
|
|
34146
34326
|
init_logger();
|
|
34147
|
-
var
|
|
34327
|
+
var log6 = createLogger("audit");
|
|
34148
34328
|
var enabledPlatforms = new Set;
|
|
34149
34329
|
var preparedDirs = new Set;
|
|
34150
34330
|
var openFds = new Map;
|
|
@@ -34157,13 +34337,13 @@ init_emoji();
|
|
|
34157
34337
|
// src/operations/executors/worktree-prompt.ts
|
|
34158
34338
|
init_emoji();
|
|
34159
34339
|
init_logger();
|
|
34160
|
-
var
|
|
34340
|
+
var log7 = createLogger("wt-prompt");
|
|
34161
34341
|
// src/operations/message-manager.ts
|
|
34162
34342
|
init_logger();
|
|
34163
34343
|
|
|
34164
34344
|
// src/transcription/elevenlabs.ts
|
|
34165
34345
|
init_logger();
|
|
34166
|
-
var
|
|
34346
|
+
var log8 = createLogger("transcribe");
|
|
34167
34347
|
|
|
34168
34348
|
// src/transcription/types.ts
|
|
34169
34349
|
var AUDIO_EXTENSIONS = new Set(["m4a", "mp3", "ogg", "opus", "wav", "aac", "flac", "webm"]);
|
|
@@ -34192,12 +34372,11 @@ function formatBytes(bytes) {
|
|
|
34192
34372
|
}
|
|
34193
34373
|
|
|
34194
34374
|
// src/operations/streaming/handler.ts
|
|
34195
|
-
var
|
|
34375
|
+
var log9 = createLogger("streaming");
|
|
34196
34376
|
// src/operations/message-manager.ts
|
|
34197
|
-
var
|
|
34377
|
+
var log10 = createLogger("msg-mgr");
|
|
34198
34378
|
// src/persistence/session-store.ts
|
|
34199
34379
|
init_logger();
|
|
34200
|
-
import { homedir as homedir2 } from "os";
|
|
34201
34380
|
import { join as join3 } from "path";
|
|
34202
34381
|
|
|
34203
34382
|
// src/sponsor.ts
|
|
@@ -34208,13 +34387,12 @@ function formatSponsorFooter(formatter) {
|
|
|
34208
34387
|
}
|
|
34209
34388
|
|
|
34210
34389
|
// src/persistence/session-store.ts
|
|
34211
|
-
var
|
|
34212
|
-
var DEFAULT_CONFIG_DIR = join3(
|
|
34390
|
+
var log11 = createLogger("persist");
|
|
34391
|
+
var DEFAULT_CONFIG_DIR = join3(stateHome(), ".config", "claude-threads");
|
|
34213
34392
|
var DEFAULT_SESSIONS_FILE = join3(DEFAULT_CONFIG_DIR, "sessions.json");
|
|
34214
34393
|
|
|
34215
34394
|
// src/config/index.ts
|
|
34216
|
-
import { resolve as
|
|
34217
|
-
import { homedir as homedir3 } from "os";
|
|
34395
|
+
import { resolve as resolve4, dirname as dirname3 } from "path";
|
|
34218
34396
|
|
|
34219
34397
|
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
34220
34398
|
function getDefaultExportFromCjs(x) {
|
|
@@ -37356,7 +37534,7 @@ init_types();
|
|
|
37356
37534
|
init_types();
|
|
37357
37535
|
|
|
37358
37536
|
// src/config/index.ts
|
|
37359
|
-
var CONFIG_PATH =
|
|
37537
|
+
var CONFIG_PATH = resolve4(stateHome(), ".config", "claude-threads", "config.yaml");
|
|
37360
37538
|
|
|
37361
37539
|
// src/utils/battery.ts
|
|
37362
37540
|
import { exec } from "child_process";
|
|
@@ -37365,13 +37543,13 @@ var execAsync = promisify(exec);
|
|
|
37365
37543
|
|
|
37366
37544
|
// src/changelog.ts
|
|
37367
37545
|
import { readFileSync as readFileSync2, existsSync as existsSync3 } from "fs";
|
|
37368
|
-
import { dirname as dirname4, resolve as
|
|
37546
|
+
import { dirname as dirname4, resolve as resolve5 } from "path";
|
|
37369
37547
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
37370
37548
|
var __dirname3 = dirname4(fileURLToPath2(import.meta.url));
|
|
37371
37549
|
function getReleaseNotes(version) {
|
|
37372
37550
|
const possiblePaths = [
|
|
37373
|
-
|
|
37374
|
-
|
|
37551
|
+
resolve5(__dirname3, "..", "CHANGELOG.md"),
|
|
37552
|
+
resolve5(__dirname3, "..", "..", "CHANGELOG.md")
|
|
37375
37553
|
];
|
|
37376
37554
|
let changelogPath = null;
|
|
37377
37555
|
for (const p of possiblePaths) {
|
|
@@ -37465,7 +37643,7 @@ init_logger();
|
|
|
37465
37643
|
// src/utils/keep-alive.ts
|
|
37466
37644
|
init_logger();
|
|
37467
37645
|
import { spawn } from "child_process";
|
|
37468
|
-
var
|
|
37646
|
+
var log12 = createLogger("keepalive");
|
|
37469
37647
|
function keepAliveSpawnSpec(platform, parentPid) {
|
|
37470
37648
|
switch (platform) {
|
|
37471
37649
|
case "darwin":
|
|
@@ -37521,7 +37699,7 @@ class KeepAliveManager {
|
|
|
37521
37699
|
if (!enabled && this.keepAliveProcess) {
|
|
37522
37700
|
this.stopKeepAlive();
|
|
37523
37701
|
}
|
|
37524
|
-
|
|
37702
|
+
log12.debug(`Keep-alive ${enabled ? "enabled" : "disabled"}`);
|
|
37525
37703
|
}
|
|
37526
37704
|
isEnabled() {
|
|
37527
37705
|
return this.enabled;
|
|
@@ -37531,7 +37709,7 @@ class KeepAliveManager {
|
|
|
37531
37709
|
}
|
|
37532
37710
|
sessionStarted() {
|
|
37533
37711
|
this.activeSessionCount++;
|
|
37534
|
-
|
|
37712
|
+
log12.debug(`Session started (${this.activeSessionCount} active)`);
|
|
37535
37713
|
if (this.activeSessionCount === 1) {
|
|
37536
37714
|
this.startKeepAlive();
|
|
37537
37715
|
}
|
|
@@ -37540,7 +37718,7 @@ class KeepAliveManager {
|
|
|
37540
37718
|
if (this.activeSessionCount > 0) {
|
|
37541
37719
|
this.activeSessionCount--;
|
|
37542
37720
|
}
|
|
37543
|
-
|
|
37721
|
+
log12.debug(`Session ended (${this.activeSessionCount} active)`);
|
|
37544
37722
|
if (this.activeSessionCount === 0) {
|
|
37545
37723
|
this.stopKeepAlive();
|
|
37546
37724
|
}
|
|
@@ -37554,11 +37732,11 @@ class KeepAliveManager {
|
|
|
37554
37732
|
}
|
|
37555
37733
|
startKeepAlive() {
|
|
37556
37734
|
if (!this.enabled) {
|
|
37557
|
-
|
|
37735
|
+
log12.debug("Keep-alive disabled, skipping");
|
|
37558
37736
|
return;
|
|
37559
37737
|
}
|
|
37560
37738
|
if (this.keepAliveProcess) {
|
|
37561
|
-
|
|
37739
|
+
log12.debug("Keep-alive already running");
|
|
37562
37740
|
return;
|
|
37563
37741
|
}
|
|
37564
37742
|
switch (this.platform) {
|
|
@@ -37572,12 +37750,12 @@ class KeepAliveManager {
|
|
|
37572
37750
|
this.startWindowsKeepAlive();
|
|
37573
37751
|
break;
|
|
37574
37752
|
default:
|
|
37575
|
-
|
|
37753
|
+
log12.warn(`Keep-alive not supported on ${this.platform}`);
|
|
37576
37754
|
}
|
|
37577
37755
|
}
|
|
37578
37756
|
stopKeepAlive() {
|
|
37579
37757
|
if (this.keepAliveProcess) {
|
|
37580
|
-
|
|
37758
|
+
log12.debug("Stopping keep-alive");
|
|
37581
37759
|
this.keepAliveProcess.kill();
|
|
37582
37760
|
this.keepAliveProcess = null;
|
|
37583
37761
|
}
|
|
@@ -37592,18 +37770,18 @@ class KeepAliveManager {
|
|
|
37592
37770
|
detached: false
|
|
37593
37771
|
});
|
|
37594
37772
|
this.keepAliveProcess.on("error", (err) => {
|
|
37595
|
-
|
|
37773
|
+
log12.error(`Failed to start caffeinate: ${err.message}`);
|
|
37596
37774
|
this.keepAliveProcess = null;
|
|
37597
37775
|
});
|
|
37598
37776
|
this.keepAliveProcess.on("exit", (code) => {
|
|
37599
37777
|
if (code !== null && code !== 0 && this.activeSessionCount > 0) {
|
|
37600
|
-
|
|
37778
|
+
log12.debug(`caffeinate exited with code ${code}`);
|
|
37601
37779
|
}
|
|
37602
37780
|
this.keepAliveProcess = null;
|
|
37603
37781
|
});
|
|
37604
|
-
|
|
37782
|
+
log12.info("Sleep prevention active (caffeinate)");
|
|
37605
37783
|
} catch (err) {
|
|
37606
|
-
|
|
37784
|
+
log12.error(`Failed to start caffeinate: ${err}`);
|
|
37607
37785
|
}
|
|
37608
37786
|
}
|
|
37609
37787
|
startLinuxKeepAlive() {
|
|
@@ -37616,19 +37794,19 @@ class KeepAliveManager {
|
|
|
37616
37794
|
detached: false
|
|
37617
37795
|
});
|
|
37618
37796
|
this.keepAliveProcess.on("error", (err) => {
|
|
37619
|
-
|
|
37797
|
+
log12.debug(`systemd-inhibit not available: ${err.message}`);
|
|
37620
37798
|
this.keepAliveProcess = null;
|
|
37621
37799
|
this.startLinuxKeepAliveFallback();
|
|
37622
37800
|
});
|
|
37623
37801
|
this.keepAliveProcess.on("exit", (code) => {
|
|
37624
37802
|
if (code !== null && code !== 0 && this.activeSessionCount > 0) {
|
|
37625
|
-
|
|
37803
|
+
log12.debug(`systemd-inhibit exited with code ${code}`);
|
|
37626
37804
|
}
|
|
37627
37805
|
this.keepAliveProcess = null;
|
|
37628
37806
|
});
|
|
37629
|
-
|
|
37807
|
+
log12.info("Sleep prevention active (systemd-inhibit)");
|
|
37630
37808
|
} catch (err) {
|
|
37631
|
-
|
|
37809
|
+
log12.debug(`Failed to start systemd-inhibit: ${err}`);
|
|
37632
37810
|
this.startLinuxKeepAliveFallback();
|
|
37633
37811
|
}
|
|
37634
37812
|
}
|
|
@@ -37639,15 +37817,15 @@ class KeepAliveManager {
|
|
|
37639
37817
|
detached: false
|
|
37640
37818
|
});
|
|
37641
37819
|
this.keepAliveProcess.on("error", (err) => {
|
|
37642
|
-
|
|
37820
|
+
log12.warn(`Linux keep-alive fallback not available: ${err.message}`);
|
|
37643
37821
|
this.keepAliveProcess = null;
|
|
37644
37822
|
});
|
|
37645
37823
|
this.keepAliveProcess.on("exit", () => {
|
|
37646
37824
|
this.keepAliveProcess = null;
|
|
37647
37825
|
});
|
|
37648
|
-
|
|
37826
|
+
log12.info("Sleep prevention active (xdg-screensaver)");
|
|
37649
37827
|
} catch (err) {
|
|
37650
|
-
|
|
37828
|
+
log12.warn(`Linux keep-alive not available: ${err}`);
|
|
37651
37829
|
}
|
|
37652
37830
|
}
|
|
37653
37831
|
startWindowsKeepAlive() {
|
|
@@ -37659,25 +37837,25 @@ class KeepAliveManager {
|
|
|
37659
37837
|
windowsHide: true
|
|
37660
37838
|
});
|
|
37661
37839
|
this.keepAliveProcess.on("error", (err) => {
|
|
37662
|
-
|
|
37840
|
+
log12.warn(`Windows keep-alive not available: ${err.message}`);
|
|
37663
37841
|
this.keepAliveProcess = null;
|
|
37664
37842
|
});
|
|
37665
37843
|
this.keepAliveProcess.on("exit", (code) => {
|
|
37666
37844
|
if (code !== null && code !== 0 && this.activeSessionCount > 0) {
|
|
37667
|
-
|
|
37845
|
+
log12.debug(`PowerShell keep-alive exited with code ${code}`);
|
|
37668
37846
|
}
|
|
37669
37847
|
this.keepAliveProcess = null;
|
|
37670
37848
|
});
|
|
37671
|
-
|
|
37849
|
+
log12.info("Sleep prevention active (SetThreadExecutionState)");
|
|
37672
37850
|
} catch (err) {
|
|
37673
|
-
|
|
37851
|
+
log12.warn(`Windows keep-alive not available: ${err}`);
|
|
37674
37852
|
}
|
|
37675
37853
|
}
|
|
37676
37854
|
}
|
|
37677
37855
|
var keepAlive = new KeepAliveManager;
|
|
37678
37856
|
|
|
37679
37857
|
// src/operations/sticky-message/handler.ts
|
|
37680
|
-
var
|
|
37858
|
+
var log13 = createLogger("sticky");
|
|
37681
37859
|
var botStartedAt = new Date;
|
|
37682
37860
|
var stickyPostIds = new Map;
|
|
37683
37861
|
var needsBump = new Map;
|
|
@@ -37920,10 +38098,9 @@ init_version_check();
|
|
|
37920
38098
|
|
|
37921
38099
|
// src/persistence/thread-logger.ts
|
|
37922
38100
|
init_logger();
|
|
37923
|
-
import { homedir as homedir4 } from "os";
|
|
37924
38101
|
import { join as join4, dirname as dirname5 } from "path";
|
|
37925
|
-
var
|
|
37926
|
-
var LOGS_BASE_DIR = join4(
|
|
38102
|
+
var log14 = createLogger("thread-log");
|
|
38103
|
+
var LOGS_BASE_DIR = join4(stateHome(), ".claude-threads", "logs");
|
|
37927
38104
|
|
|
37928
38105
|
// src/operations/bug-report/handler.ts
|
|
37929
38106
|
var piiRedactor = new Redactor({ aggressive: true });
|
|
@@ -38830,11 +39007,10 @@ var sessionLog3 = createSessionLog(log21);
|
|
|
38830
39007
|
var contextPromptTimeouts = new Map;
|
|
38831
39008
|
var contextPromptFiles = new Map;
|
|
38832
39009
|
// src/memory/store.ts
|
|
38833
|
-
import { homedir as homedir6 } from "os";
|
|
38834
39010
|
import { basename as basename3, dirname as dirname6, join as join5, sep as sep2 } from "path";
|
|
38835
39011
|
init_logger();
|
|
38836
39012
|
var log22 = createLogger("memory");
|
|
38837
|
-
var DEFAULT_ROOT = join5(
|
|
39013
|
+
var DEFAULT_ROOT = join5(stateHome(), ".config", "claude-threads", "memory");
|
|
38838
39014
|
var CHANNEL_BLOCK_MAX_BYTES = 25 * 1024;
|
|
38839
39015
|
|
|
38840
39016
|
// src/memory/distiller.ts
|
|
@@ -38849,9 +39025,8 @@ import { join as join7 } from "path";
|
|
|
38849
39025
|
init_logger();
|
|
38850
39026
|
|
|
38851
39027
|
// src/persistence/platform-list-store.ts
|
|
38852
|
-
import { homedir as homedir7 } from "os";
|
|
38853
39028
|
import { join as join6 } from "path";
|
|
38854
|
-
var STORES_CONFIG_DIR = join6(
|
|
39029
|
+
var STORES_CONFIG_DIR = join6(stateHome(), ".config", "claude-threads");
|
|
38855
39030
|
|
|
38856
39031
|
// src/persistence/routines-store.ts
|
|
38857
39032
|
var log24 = createLogger("routines");
|
|
@@ -38904,11 +39079,10 @@ init_logger();
|
|
|
38904
39079
|
init_quick_query();
|
|
38905
39080
|
|
|
38906
39081
|
// src/persistence/github-emails-store.ts
|
|
38907
|
-
import { homedir as homedir8 } from "os";
|
|
38908
39082
|
import { join as join9 } from "path";
|
|
38909
39083
|
init_logger();
|
|
38910
39084
|
var log32 = createLogger("gh-emails");
|
|
38911
|
-
var DEFAULT_CONFIG_DIR2 = join9(
|
|
39085
|
+
var DEFAULT_CONFIG_DIR2 = join9(stateHome(), ".config", "claude-threads");
|
|
38912
39086
|
var DEFAULT_FILE3 = join9(DEFAULT_CONFIG_DIR2, "github-emails.yaml");
|
|
38913
39087
|
|
|
38914
39088
|
// src/operations/commands/handler.ts
|