drizzle-kit 0.31.1-8eb999a → 0.31.1-a2a1a62
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/api.d.mts +24 -24
- package/api.d.ts +24 -24
- package/api.js +592 -454
- package/api.mjs +595 -456
- package/bin.cjs +4908 -4573
- package/package.json +10 -11
- package/utils.js +90 -106
- package/utils.mjs +90 -106
package/api.mjs
CHANGED
@@ -233,9 +233,9 @@ var init_ansi_styles = __esm({
|
|
233
233
|
});
|
234
234
|
|
235
235
|
// ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/supports-color/index.js
|
236
|
-
import process2 from "
|
237
|
-
import os from "
|
238
|
-
import tty from "
|
236
|
+
import process2 from "process";
|
237
|
+
import os from "os";
|
238
|
+
import tty from "tty";
|
239
239
|
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
240
240
|
const prefix2 = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
241
241
|
const position = argv.indexOf(prefix2 + flag);
|
@@ -3443,206 +3443,14 @@ var init_global = __esm({
|
|
3443
3443
|
}
|
3444
3444
|
});
|
3445
3445
|
|
3446
|
-
// ../node_modules/.pnpm/zod@3.
|
3447
|
-
|
3448
|
-
|
3449
|
-
|
3450
|
-
function addIssueToContext(ctx, issueData) {
|
3451
|
-
const overrideMap = getErrorMap();
|
3452
|
-
const issue = makeIssue({
|
3453
|
-
issueData,
|
3454
|
-
data: ctx.data,
|
3455
|
-
path: ctx.path,
|
3456
|
-
errorMaps: [
|
3457
|
-
ctx.common.contextualErrorMap,
|
3458
|
-
// contextual error map is first priority
|
3459
|
-
ctx.schemaErrorMap,
|
3460
|
-
// then schema-bound map if available
|
3461
|
-
overrideMap,
|
3462
|
-
// then global override map
|
3463
|
-
overrideMap === errorMap ? void 0 : errorMap
|
3464
|
-
// then global default map
|
3465
|
-
].filter((x) => !!x)
|
3466
|
-
});
|
3467
|
-
ctx.common.issues.push(issue);
|
3468
|
-
}
|
3469
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
3470
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
3471
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
3472
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
3473
|
-
}
|
3474
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
3475
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
3476
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
3477
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
3478
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
3479
|
-
}
|
3480
|
-
function processCreateParams(params) {
|
3481
|
-
if (!params)
|
3482
|
-
return {};
|
3483
|
-
const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
|
3484
|
-
if (errorMap2 && (invalid_type_error || required_error)) {
|
3485
|
-
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
3486
|
-
}
|
3487
|
-
if (errorMap2)
|
3488
|
-
return { errorMap: errorMap2, description };
|
3489
|
-
const customMap = (iss, ctx) => {
|
3490
|
-
var _a437, _b326;
|
3491
|
-
const { message } = params;
|
3492
|
-
if (iss.code === "invalid_enum_value") {
|
3493
|
-
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
3494
|
-
}
|
3495
|
-
if (typeof ctx.data === "undefined") {
|
3496
|
-
return { message: (_a437 = message !== null && message !== void 0 ? message : required_error) !== null && _a437 !== void 0 ? _a437 : ctx.defaultError };
|
3497
|
-
}
|
3498
|
-
if (iss.code !== "invalid_type")
|
3499
|
-
return { message: ctx.defaultError };
|
3500
|
-
return { message: (_b326 = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b326 !== void 0 ? _b326 : ctx.defaultError };
|
3501
|
-
};
|
3502
|
-
return { errorMap: customMap, description };
|
3503
|
-
}
|
3504
|
-
function timeRegexSource(args) {
|
3505
|
-
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
3506
|
-
if (args.precision) {
|
3507
|
-
regex = `${regex}\\.\\d{${args.precision}}`;
|
3508
|
-
} else if (args.precision == null) {
|
3509
|
-
regex = `${regex}(\\.\\d+)?`;
|
3510
|
-
}
|
3511
|
-
return regex;
|
3512
|
-
}
|
3513
|
-
function timeRegex(args) {
|
3514
|
-
return new RegExp(`^${timeRegexSource(args)}$`);
|
3515
|
-
}
|
3516
|
-
function datetimeRegex(args) {
|
3517
|
-
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
3518
|
-
const opts = [];
|
3519
|
-
opts.push(args.local ? `Z?` : `Z`);
|
3520
|
-
if (args.offset)
|
3521
|
-
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
3522
|
-
regex = `${regex}(${opts.join("|")})`;
|
3523
|
-
return new RegExp(`^${regex}$`);
|
3524
|
-
}
|
3525
|
-
function isValidIP(ip, version2) {
|
3526
|
-
if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
|
3527
|
-
return true;
|
3528
|
-
}
|
3529
|
-
if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) {
|
3530
|
-
return true;
|
3531
|
-
}
|
3532
|
-
return false;
|
3533
|
-
}
|
3534
|
-
function isValidJWT(jwt, alg) {
|
3535
|
-
if (!jwtRegex.test(jwt))
|
3536
|
-
return false;
|
3537
|
-
try {
|
3538
|
-
const [header] = jwt.split(".");
|
3539
|
-
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
3540
|
-
const decoded = JSON.parse(atob(base64));
|
3541
|
-
if (typeof decoded !== "object" || decoded === null)
|
3542
|
-
return false;
|
3543
|
-
if (!decoded.typ || !decoded.alg)
|
3544
|
-
return false;
|
3545
|
-
if (alg && decoded.alg !== alg)
|
3546
|
-
return false;
|
3547
|
-
return true;
|
3548
|
-
} catch (_a437) {
|
3549
|
-
return false;
|
3550
|
-
}
|
3551
|
-
}
|
3552
|
-
function isValidCidr(ip, version2) {
|
3553
|
-
if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) {
|
3554
|
-
return true;
|
3555
|
-
}
|
3556
|
-
if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) {
|
3557
|
-
return true;
|
3558
|
-
}
|
3559
|
-
return false;
|
3560
|
-
}
|
3561
|
-
function floatSafeRemainder(val, step) {
|
3562
|
-
const valDecCount = (val.toString().split(".")[1] || "").length;
|
3563
|
-
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
3564
|
-
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
3565
|
-
const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
|
3566
|
-
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
3567
|
-
return valInt % stepInt / Math.pow(10, decCount);
|
3568
|
-
}
|
3569
|
-
function deepPartialify(schema5) {
|
3570
|
-
if (schema5 instanceof ZodObject) {
|
3571
|
-
const newShape = {};
|
3572
|
-
for (const key in schema5.shape) {
|
3573
|
-
const fieldSchema = schema5.shape[key];
|
3574
|
-
newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
|
3575
|
-
}
|
3576
|
-
return new ZodObject({
|
3577
|
-
...schema5._def,
|
3578
|
-
shape: () => newShape
|
3579
|
-
});
|
3580
|
-
} else if (schema5 instanceof ZodArray) {
|
3581
|
-
return new ZodArray({
|
3582
|
-
...schema5._def,
|
3583
|
-
type: deepPartialify(schema5.element)
|
3584
|
-
});
|
3585
|
-
} else if (schema5 instanceof ZodOptional) {
|
3586
|
-
return ZodOptional.create(deepPartialify(schema5.unwrap()));
|
3587
|
-
} else if (schema5 instanceof ZodNullable) {
|
3588
|
-
return ZodNullable.create(deepPartialify(schema5.unwrap()));
|
3589
|
-
} else if (schema5 instanceof ZodTuple) {
|
3590
|
-
return ZodTuple.create(schema5.items.map((item) => deepPartialify(item)));
|
3591
|
-
} else {
|
3592
|
-
return schema5;
|
3593
|
-
}
|
3594
|
-
}
|
3595
|
-
function mergeValues(a, b) {
|
3596
|
-
const aType = getParsedType(a);
|
3597
|
-
const bType = getParsedType(b);
|
3598
|
-
if (a === b) {
|
3599
|
-
return { valid: true, data: a };
|
3600
|
-
} else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
3601
|
-
const bKeys = util.objectKeys(b);
|
3602
|
-
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
3603
|
-
const newObj = { ...a, ...b };
|
3604
|
-
for (const key of sharedKeys) {
|
3605
|
-
const sharedValue = mergeValues(a[key], b[key]);
|
3606
|
-
if (!sharedValue.valid) {
|
3607
|
-
return { valid: false };
|
3608
|
-
}
|
3609
|
-
newObj[key] = sharedValue.data;
|
3610
|
-
}
|
3611
|
-
return { valid: true, data: newObj };
|
3612
|
-
} else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
|
3613
|
-
if (a.length !== b.length) {
|
3614
|
-
return { valid: false };
|
3615
|
-
}
|
3616
|
-
const newArray = [];
|
3617
|
-
for (let index6 = 0; index6 < a.length; index6++) {
|
3618
|
-
const itemA = a[index6];
|
3619
|
-
const itemB = b[index6];
|
3620
|
-
const sharedValue = mergeValues(itemA, itemB);
|
3621
|
-
if (!sharedValue.valid) {
|
3622
|
-
return { valid: false };
|
3623
|
-
}
|
3624
|
-
newArray.push(sharedValue.data);
|
3625
|
-
}
|
3626
|
-
return { valid: true, data: newArray };
|
3627
|
-
} else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
|
3628
|
-
return { valid: true, data: a };
|
3629
|
-
} else {
|
3630
|
-
return { valid: false };
|
3631
|
-
}
|
3632
|
-
}
|
3633
|
-
function createZodEnum(values, params) {
|
3634
|
-
return new ZodEnum({
|
3635
|
-
values,
|
3636
|
-
typeName: ZodFirstPartyTypeKind.ZodEnum,
|
3637
|
-
...processCreateParams(params)
|
3638
|
-
});
|
3639
|
-
}
|
3640
|
-
var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, jwtRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv4CidrRegex, ipv6Regex, ipv6CidrRegex, base64Regex, base64urlRegex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, coerce;
|
3641
|
-
var init_lib = __esm({
|
3642
|
-
"../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs"() {
|
3446
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/util.js
|
3447
|
+
var util, objectUtil, ZodParsedType, getParsedType;
|
3448
|
+
var init_util = __esm({
|
3449
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/util.js"() {
|
3643
3450
|
"use strict";
|
3644
3451
|
(function(util2) {
|
3645
|
-
util2.assertEqual = (
|
3452
|
+
util2.assertEqual = (_2) => {
|
3453
|
+
};
|
3646
3454
|
function assertIs(_arg) {
|
3647
3455
|
}
|
3648
3456
|
util2.assertIs = assertIs;
|
@@ -3686,7 +3494,7 @@ var init_lib = __esm({
|
|
3686
3494
|
}
|
3687
3495
|
return void 0;
|
3688
3496
|
};
|
3689
|
-
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
|
3497
|
+
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
3690
3498
|
function joinValues(array2, separator = " | ") {
|
3691
3499
|
return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
3692
3500
|
}
|
@@ -3737,7 +3545,7 @@ var init_lib = __esm({
|
|
3737
3545
|
case "string":
|
3738
3546
|
return ZodParsedType.string;
|
3739
3547
|
case "number":
|
3740
|
-
return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
3548
|
+
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
3741
3549
|
case "boolean":
|
3742
3550
|
return ZodParsedType.boolean;
|
3743
3551
|
case "function":
|
@@ -3770,6 +3578,15 @@ var init_lib = __esm({
|
|
3770
3578
|
return ZodParsedType.unknown;
|
3771
3579
|
}
|
3772
3580
|
};
|
3581
|
+
}
|
3582
|
+
});
|
3583
|
+
|
3584
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/ZodError.js
|
3585
|
+
var ZodIssueCode, ZodError;
|
3586
|
+
var init_ZodError = __esm({
|
3587
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/ZodError.js"() {
|
3588
|
+
"use strict";
|
3589
|
+
init_util();
|
3773
3590
|
ZodIssueCode = util.arrayToEnum([
|
3774
3591
|
"invalid_type",
|
3775
3592
|
"invalid_literal",
|
@@ -3881,6 +3698,16 @@ var init_lib = __esm({
|
|
3881
3698
|
const error2 = new ZodError(issues);
|
3882
3699
|
return error2;
|
3883
3700
|
};
|
3701
|
+
}
|
3702
|
+
});
|
3703
|
+
|
3704
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/locales/en.js
|
3705
|
+
var errorMap, en_default;
|
3706
|
+
var init_en = __esm({
|
3707
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/locales/en.js"() {
|
3708
|
+
"use strict";
|
3709
|
+
init_ZodError();
|
3710
|
+
init_util();
|
3884
3711
|
errorMap = (issue, _ctx) => {
|
3885
3712
|
let message;
|
3886
3713
|
switch (issue.code) {
|
@@ -3979,7 +3806,49 @@ var init_lib = __esm({
|
|
3979
3806
|
}
|
3980
3807
|
return { message };
|
3981
3808
|
};
|
3982
|
-
|
3809
|
+
en_default = errorMap;
|
3810
|
+
}
|
3811
|
+
});
|
3812
|
+
|
3813
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/errors.js
|
3814
|
+
function getErrorMap() {
|
3815
|
+
return overrideErrorMap;
|
3816
|
+
}
|
3817
|
+
var overrideErrorMap;
|
3818
|
+
var init_errors = __esm({
|
3819
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/errors.js"() {
|
3820
|
+
"use strict";
|
3821
|
+
init_en();
|
3822
|
+
overrideErrorMap = en_default;
|
3823
|
+
}
|
3824
|
+
});
|
3825
|
+
|
3826
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/parseUtil.js
|
3827
|
+
function addIssueToContext(ctx, issueData) {
|
3828
|
+
const overrideMap = getErrorMap();
|
3829
|
+
const issue = makeIssue({
|
3830
|
+
issueData,
|
3831
|
+
data: ctx.data,
|
3832
|
+
path: ctx.path,
|
3833
|
+
errorMaps: [
|
3834
|
+
ctx.common.contextualErrorMap,
|
3835
|
+
// contextual error map is first priority
|
3836
|
+
ctx.schemaErrorMap,
|
3837
|
+
// then schema-bound map if available
|
3838
|
+
overrideMap,
|
3839
|
+
// then global override map
|
3840
|
+
overrideMap === en_default ? void 0 : en_default
|
3841
|
+
// then global default map
|
3842
|
+
].filter((x) => !!x)
|
3843
|
+
});
|
3844
|
+
ctx.common.issues.push(issue);
|
3845
|
+
}
|
3846
|
+
var makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync;
|
3847
|
+
var init_parseUtil = __esm({
|
3848
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/parseUtil.js"() {
|
3849
|
+
"use strict";
|
3850
|
+
init_errors();
|
3851
|
+
init_en();
|
3983
3852
|
makeIssue = (params) => {
|
3984
3853
|
const { data, path: path2, errorMaps, issueData } = params;
|
3985
3854
|
const fullPath = [...path2, ...issueData.path || []];
|
@@ -4068,10 +3937,200 @@ var init_lib = __esm({
|
|
4068
3937
|
isDirty = (x) => x.status === "dirty";
|
4069
3938
|
isValid = (x) => x.status === "valid";
|
4070
3939
|
isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
3940
|
+
}
|
3941
|
+
});
|
3942
|
+
|
3943
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/typeAliases.js
|
3944
|
+
var init_typeAliases = __esm({
|
3945
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/typeAliases.js"() {
|
3946
|
+
"use strict";
|
3947
|
+
}
|
3948
|
+
});
|
3949
|
+
|
3950
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/errorUtil.js
|
3951
|
+
var errorUtil;
|
3952
|
+
var init_errorUtil = __esm({
|
3953
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/errorUtil.js"() {
|
3954
|
+
"use strict";
|
4071
3955
|
(function(errorUtil2) {
|
4072
3956
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
4073
|
-
errorUtil2.toString = (message) => typeof message === "string" ? message : message
|
3957
|
+
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
4074
3958
|
})(errorUtil || (errorUtil = {}));
|
3959
|
+
}
|
3960
|
+
});
|
3961
|
+
|
3962
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/types.js
|
3963
|
+
function processCreateParams(params) {
|
3964
|
+
if (!params)
|
3965
|
+
return {};
|
3966
|
+
const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
|
3967
|
+
if (errorMap2 && (invalid_type_error || required_error)) {
|
3968
|
+
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
3969
|
+
}
|
3970
|
+
if (errorMap2)
|
3971
|
+
return { errorMap: errorMap2, description };
|
3972
|
+
const customMap = (iss, ctx) => {
|
3973
|
+
const { message } = params;
|
3974
|
+
if (iss.code === "invalid_enum_value") {
|
3975
|
+
return { message: message ?? ctx.defaultError };
|
3976
|
+
}
|
3977
|
+
if (typeof ctx.data === "undefined") {
|
3978
|
+
return { message: message ?? required_error ?? ctx.defaultError };
|
3979
|
+
}
|
3980
|
+
if (iss.code !== "invalid_type")
|
3981
|
+
return { message: ctx.defaultError };
|
3982
|
+
return { message: message ?? invalid_type_error ?? ctx.defaultError };
|
3983
|
+
};
|
3984
|
+
return { errorMap: customMap, description };
|
3985
|
+
}
|
3986
|
+
function timeRegexSource(args) {
|
3987
|
+
let secondsRegexSource = `[0-5]\\d`;
|
3988
|
+
if (args.precision) {
|
3989
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
3990
|
+
} else if (args.precision == null) {
|
3991
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
3992
|
+
}
|
3993
|
+
const secondsQuantifier = args.precision ? "+" : "?";
|
3994
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
3995
|
+
}
|
3996
|
+
function timeRegex(args) {
|
3997
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
3998
|
+
}
|
3999
|
+
function datetimeRegex(args) {
|
4000
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
4001
|
+
const opts = [];
|
4002
|
+
opts.push(args.local ? `Z?` : `Z`);
|
4003
|
+
if (args.offset)
|
4004
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
4005
|
+
regex = `${regex}(${opts.join("|")})`;
|
4006
|
+
return new RegExp(`^${regex}$`);
|
4007
|
+
}
|
4008
|
+
function isValidIP(ip, version2) {
|
4009
|
+
if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
|
4010
|
+
return true;
|
4011
|
+
}
|
4012
|
+
if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) {
|
4013
|
+
return true;
|
4014
|
+
}
|
4015
|
+
return false;
|
4016
|
+
}
|
4017
|
+
function isValidJWT(jwt, alg) {
|
4018
|
+
if (!jwtRegex.test(jwt))
|
4019
|
+
return false;
|
4020
|
+
try {
|
4021
|
+
const [header] = jwt.split(".");
|
4022
|
+
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
4023
|
+
const decoded = JSON.parse(atob(base64));
|
4024
|
+
if (typeof decoded !== "object" || decoded === null)
|
4025
|
+
return false;
|
4026
|
+
if ("typ" in decoded && decoded?.typ !== "JWT")
|
4027
|
+
return false;
|
4028
|
+
if (!decoded.alg)
|
4029
|
+
return false;
|
4030
|
+
if (alg && decoded.alg !== alg)
|
4031
|
+
return false;
|
4032
|
+
return true;
|
4033
|
+
} catch {
|
4034
|
+
return false;
|
4035
|
+
}
|
4036
|
+
}
|
4037
|
+
function isValidCidr(ip, version2) {
|
4038
|
+
if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) {
|
4039
|
+
return true;
|
4040
|
+
}
|
4041
|
+
if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) {
|
4042
|
+
return true;
|
4043
|
+
}
|
4044
|
+
return false;
|
4045
|
+
}
|
4046
|
+
function floatSafeRemainder(val, step) {
|
4047
|
+
const valDecCount = (val.toString().split(".")[1] || "").length;
|
4048
|
+
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
4049
|
+
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
4050
|
+
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
4051
|
+
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
4052
|
+
return valInt % stepInt / 10 ** decCount;
|
4053
|
+
}
|
4054
|
+
function deepPartialify(schema5) {
|
4055
|
+
if (schema5 instanceof ZodObject) {
|
4056
|
+
const newShape = {};
|
4057
|
+
for (const key in schema5.shape) {
|
4058
|
+
const fieldSchema = schema5.shape[key];
|
4059
|
+
newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
|
4060
|
+
}
|
4061
|
+
return new ZodObject({
|
4062
|
+
...schema5._def,
|
4063
|
+
shape: () => newShape
|
4064
|
+
});
|
4065
|
+
} else if (schema5 instanceof ZodArray) {
|
4066
|
+
return new ZodArray({
|
4067
|
+
...schema5._def,
|
4068
|
+
type: deepPartialify(schema5.element)
|
4069
|
+
});
|
4070
|
+
} else if (schema5 instanceof ZodOptional) {
|
4071
|
+
return ZodOptional.create(deepPartialify(schema5.unwrap()));
|
4072
|
+
} else if (schema5 instanceof ZodNullable) {
|
4073
|
+
return ZodNullable.create(deepPartialify(schema5.unwrap()));
|
4074
|
+
} else if (schema5 instanceof ZodTuple) {
|
4075
|
+
return ZodTuple.create(schema5.items.map((item) => deepPartialify(item)));
|
4076
|
+
} else {
|
4077
|
+
return schema5;
|
4078
|
+
}
|
4079
|
+
}
|
4080
|
+
function mergeValues(a, b) {
|
4081
|
+
const aType = getParsedType(a);
|
4082
|
+
const bType = getParsedType(b);
|
4083
|
+
if (a === b) {
|
4084
|
+
return { valid: true, data: a };
|
4085
|
+
} else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
4086
|
+
const bKeys = util.objectKeys(b);
|
4087
|
+
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
4088
|
+
const newObj = { ...a, ...b };
|
4089
|
+
for (const key of sharedKeys) {
|
4090
|
+
const sharedValue = mergeValues(a[key], b[key]);
|
4091
|
+
if (!sharedValue.valid) {
|
4092
|
+
return { valid: false };
|
4093
|
+
}
|
4094
|
+
newObj[key] = sharedValue.data;
|
4095
|
+
}
|
4096
|
+
return { valid: true, data: newObj };
|
4097
|
+
} else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
|
4098
|
+
if (a.length !== b.length) {
|
4099
|
+
return { valid: false };
|
4100
|
+
}
|
4101
|
+
const newArray = [];
|
4102
|
+
for (let index6 = 0; index6 < a.length; index6++) {
|
4103
|
+
const itemA = a[index6];
|
4104
|
+
const itemB = b[index6];
|
4105
|
+
const sharedValue = mergeValues(itemA, itemB);
|
4106
|
+
if (!sharedValue.valid) {
|
4107
|
+
return { valid: false };
|
4108
|
+
}
|
4109
|
+
newArray.push(sharedValue.data);
|
4110
|
+
}
|
4111
|
+
return { valid: true, data: newArray };
|
4112
|
+
} else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
|
4113
|
+
return { valid: true, data: a };
|
4114
|
+
} else {
|
4115
|
+
return { valid: false };
|
4116
|
+
}
|
4117
|
+
}
|
4118
|
+
function createZodEnum(values, params) {
|
4119
|
+
return new ZodEnum({
|
4120
|
+
values,
|
4121
|
+
typeName: ZodFirstPartyTypeKind.ZodEnum,
|
4122
|
+
...processCreateParams(params)
|
4123
|
+
});
|
4124
|
+
}
|
4125
|
+
var ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, jwtRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv4CidrRegex, ipv6Regex, ipv6CidrRegex, base64Regex, base64urlRegex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, coerce;
|
4126
|
+
var init_types = __esm({
|
4127
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/types.js"() {
|
4128
|
+
"use strict";
|
4129
|
+
init_ZodError();
|
4130
|
+
init_errors();
|
4131
|
+
init_errorUtil();
|
4132
|
+
init_parseUtil();
|
4133
|
+
init_util();
|
4075
4134
|
ParseInputLazyPath = class {
|
4076
4135
|
constructor(parent, value, path2, key) {
|
4077
4136
|
this._cachedPath = [];
|
@@ -4082,7 +4141,7 @@ var init_lib = __esm({
|
|
4082
4141
|
}
|
4083
4142
|
get path() {
|
4084
4143
|
if (!this._cachedPath.length) {
|
4085
|
-
if (this._key
|
4144
|
+
if (Array.isArray(this._key)) {
|
4086
4145
|
this._cachedPath.push(...this._path, ...this._key);
|
4087
4146
|
} else {
|
4088
4147
|
this._cachedPath.push(...this._path, this._key);
|
@@ -4158,14 +4217,13 @@ var init_lib = __esm({
|
|
4158
4217
|
throw result.error;
|
4159
4218
|
}
|
4160
4219
|
safeParse(data, params) {
|
4161
|
-
var _a437;
|
4162
4220
|
const ctx = {
|
4163
4221
|
common: {
|
4164
4222
|
issues: [],
|
4165
|
-
async:
|
4166
|
-
contextualErrorMap: params
|
4223
|
+
async: params?.async ?? false,
|
4224
|
+
contextualErrorMap: params?.errorMap
|
4167
4225
|
},
|
4168
|
-
path:
|
4226
|
+
path: params?.path || [],
|
4169
4227
|
schemaErrorMap: this._def.errorMap,
|
4170
4228
|
parent: null,
|
4171
4229
|
data,
|
@@ -4175,7 +4233,6 @@ var init_lib = __esm({
|
|
4175
4233
|
return handleResult(ctx, result);
|
4176
4234
|
}
|
4177
4235
|
"~validate"(data) {
|
4178
|
-
var _a437, _b326;
|
4179
4236
|
const ctx = {
|
4180
4237
|
common: {
|
4181
4238
|
issues: [],
|
@@ -4196,7 +4253,7 @@ var init_lib = __esm({
|
|
4196
4253
|
issues: ctx.common.issues
|
4197
4254
|
};
|
4198
4255
|
} catch (err) {
|
4199
|
-
if (
|
4256
|
+
if (err?.message?.toLowerCase()?.includes("encountered")) {
|
4200
4257
|
this["~standard"].async = true;
|
4201
4258
|
}
|
4202
4259
|
ctx.common = {
|
@@ -4221,10 +4278,10 @@ var init_lib = __esm({
|
|
4221
4278
|
const ctx = {
|
4222
4279
|
common: {
|
4223
4280
|
issues: [],
|
4224
|
-
contextualErrorMap: params
|
4281
|
+
contextualErrorMap: params?.errorMap,
|
4225
4282
|
async: true
|
4226
4283
|
},
|
4227
|
-
path:
|
4284
|
+
path: params?.path || [],
|
4228
4285
|
schemaErrorMap: this._def.errorMap,
|
4229
4286
|
parent: null,
|
4230
4287
|
data,
|
@@ -4558,7 +4615,7 @@ var init_lib = __esm({
|
|
4558
4615
|
} else if (check.kind === "url") {
|
4559
4616
|
try {
|
4560
4617
|
new URL(input.data);
|
4561
|
-
} catch
|
4618
|
+
} catch {
|
4562
4619
|
ctx = this._getOrReturnCtx(input, ctx);
|
4563
4620
|
addIssueToContext(ctx, {
|
4564
4621
|
validation: "url",
|
@@ -4770,7 +4827,6 @@ var init_lib = __esm({
|
|
4770
4827
|
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
4771
4828
|
}
|
4772
4829
|
datetime(options) {
|
4773
|
-
var _a437, _b326;
|
4774
4830
|
if (typeof options === "string") {
|
4775
4831
|
return this._addCheck({
|
4776
4832
|
kind: "datetime",
|
@@ -4782,10 +4838,10 @@ var init_lib = __esm({
|
|
4782
4838
|
}
|
4783
4839
|
return this._addCheck({
|
4784
4840
|
kind: "datetime",
|
4785
|
-
precision: typeof
|
4786
|
-
offset:
|
4787
|
-
local:
|
4788
|
-
...errorUtil.errToObj(options
|
4841
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
4842
|
+
offset: options?.offset ?? false,
|
4843
|
+
local: options?.local ?? false,
|
4844
|
+
...errorUtil.errToObj(options?.message)
|
4789
4845
|
});
|
4790
4846
|
}
|
4791
4847
|
date(message) {
|
@@ -4801,8 +4857,8 @@ var init_lib = __esm({
|
|
4801
4857
|
}
|
4802
4858
|
return this._addCheck({
|
4803
4859
|
kind: "time",
|
4804
|
-
precision: typeof
|
4805
|
-
...errorUtil.errToObj(options
|
4860
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
4861
|
+
...errorUtil.errToObj(options?.message)
|
4806
4862
|
});
|
4807
4863
|
}
|
4808
4864
|
duration(message) {
|
@@ -4819,8 +4875,8 @@ var init_lib = __esm({
|
|
4819
4875
|
return this._addCheck({
|
4820
4876
|
kind: "includes",
|
4821
4877
|
value,
|
4822
|
-
position: options
|
4823
|
-
...errorUtil.errToObj(options
|
4878
|
+
position: options?.position,
|
4879
|
+
...errorUtil.errToObj(options?.message)
|
4824
4880
|
});
|
4825
4881
|
}
|
4826
4882
|
startsWith(value, message) {
|
@@ -4952,11 +5008,10 @@ var init_lib = __esm({
|
|
4952
5008
|
}
|
4953
5009
|
};
|
4954
5010
|
ZodString.create = (params) => {
|
4955
|
-
var _a437;
|
4956
5011
|
return new ZodString({
|
4957
5012
|
checks: [],
|
4958
5013
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
4959
|
-
coerce:
|
5014
|
+
coerce: params?.coerce ?? false,
|
4960
5015
|
...processCreateParams(params)
|
4961
5016
|
});
|
4962
5017
|
};
|
@@ -5168,7 +5223,8 @@ var init_lib = __esm({
|
|
5168
5223
|
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
5169
5224
|
}
|
5170
5225
|
get isFinite() {
|
5171
|
-
let max2 = null
|
5226
|
+
let max2 = null;
|
5227
|
+
let min2 = null;
|
5172
5228
|
for (const ch of this._def.checks) {
|
5173
5229
|
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
5174
5230
|
return true;
|
@@ -5187,7 +5243,7 @@ var init_lib = __esm({
|
|
5187
5243
|
return new ZodNumber({
|
5188
5244
|
checks: [],
|
5189
5245
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
5190
|
-
coerce:
|
5246
|
+
coerce: params?.coerce || false,
|
5191
5247
|
...processCreateParams(params)
|
5192
5248
|
});
|
5193
5249
|
};
|
@@ -5201,7 +5257,7 @@ var init_lib = __esm({
|
|
5201
5257
|
if (this._def.coerce) {
|
5202
5258
|
try {
|
5203
5259
|
input.data = BigInt(input.data);
|
5204
|
-
} catch
|
5260
|
+
} catch {
|
5205
5261
|
return this._getInvalidInput(input);
|
5206
5262
|
}
|
5207
5263
|
}
|
@@ -5356,11 +5412,10 @@ var init_lib = __esm({
|
|
5356
5412
|
}
|
5357
5413
|
};
|
5358
5414
|
ZodBigInt.create = (params) => {
|
5359
|
-
var _a437;
|
5360
5415
|
return new ZodBigInt({
|
5361
5416
|
checks: [],
|
5362
5417
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
5363
|
-
coerce:
|
5418
|
+
coerce: params?.coerce ?? false,
|
5364
5419
|
...processCreateParams(params)
|
5365
5420
|
});
|
5366
5421
|
};
|
@@ -5385,7 +5440,7 @@ var init_lib = __esm({
|
|
5385
5440
|
ZodBoolean.create = (params) => {
|
5386
5441
|
return new ZodBoolean({
|
5387
5442
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
5388
|
-
coerce:
|
5443
|
+
coerce: params?.coerce || false,
|
5389
5444
|
...processCreateParams(params)
|
5390
5445
|
});
|
5391
5446
|
};
|
@@ -5404,7 +5459,7 @@ var init_lib = __esm({
|
|
5404
5459
|
});
|
5405
5460
|
return INVALID;
|
5406
5461
|
}
|
5407
|
-
if (isNaN(input.data.getTime())) {
|
5462
|
+
if (Number.isNaN(input.data.getTime())) {
|
5408
5463
|
const ctx2 = this._getOrReturnCtx(input);
|
5409
5464
|
addIssueToContext(ctx2, {
|
5410
5465
|
code: ZodIssueCode.invalid_date
|
@@ -5493,7 +5548,7 @@ var init_lib = __esm({
|
|
5493
5548
|
ZodDate.create = (params) => {
|
5494
5549
|
return new ZodDate({
|
5495
5550
|
checks: [],
|
5496
|
-
coerce:
|
5551
|
+
coerce: params?.coerce || false,
|
5497
5552
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
5498
5553
|
...processCreateParams(params)
|
5499
5554
|
});
|
@@ -5742,7 +5797,8 @@ var init_lib = __esm({
|
|
5742
5797
|
return this._cached;
|
5743
5798
|
const shape = this._def.shape();
|
5744
5799
|
const keys = util.objectKeys(shape);
|
5745
|
-
|
5800
|
+
this._cached = { shape, keys };
|
5801
|
+
return this._cached;
|
5746
5802
|
}
|
5747
5803
|
_parse(input) {
|
5748
5804
|
const parsedType = this._getType(input);
|
@@ -5792,8 +5848,8 @@ var init_lib = __esm({
|
|
5792
5848
|
});
|
5793
5849
|
status.dirty();
|
5794
5850
|
}
|
5795
|
-
} else if (unknownKeys === "strip")
|
5796
|
-
else {
|
5851
|
+
} else if (unknownKeys === "strip") {
|
5852
|
+
} else {
|
5797
5853
|
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
|
5798
5854
|
}
|
5799
5855
|
} else {
|
@@ -5840,11 +5896,10 @@ var init_lib = __esm({
|
|
5840
5896
|
unknownKeys: "strict",
|
5841
5897
|
...message !== void 0 ? {
|
5842
5898
|
errorMap: (issue, ctx) => {
|
5843
|
-
|
5844
|
-
const defaultError = (_c14 = (_b326 = (_a437 = this._def).errorMap) === null || _b326 === void 0 ? void 0 : _b326.call(_a437, issue, ctx).message) !== null && _c14 !== void 0 ? _c14 : ctx.defaultError;
|
5899
|
+
const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
|
5845
5900
|
if (issue.code === "unrecognized_keys")
|
5846
5901
|
return {
|
5847
|
-
message:
|
5902
|
+
message: errorUtil.errToObj(message).message ?? defaultError
|
5848
5903
|
};
|
5849
5904
|
return {
|
5850
5905
|
message: defaultError
|
@@ -5975,11 +6030,11 @@ var init_lib = __esm({
|
|
5975
6030
|
}
|
5976
6031
|
pick(mask) {
|
5977
6032
|
const shape = {};
|
5978
|
-
util.objectKeys(mask)
|
6033
|
+
for (const key of util.objectKeys(mask)) {
|
5979
6034
|
if (mask[key] && this.shape[key]) {
|
5980
6035
|
shape[key] = this.shape[key];
|
5981
6036
|
}
|
5982
|
-
}
|
6037
|
+
}
|
5983
6038
|
return new _ZodObject({
|
5984
6039
|
...this._def,
|
5985
6040
|
shape: () => shape
|
@@ -5987,11 +6042,11 @@ var init_lib = __esm({
|
|
5987
6042
|
}
|
5988
6043
|
omit(mask) {
|
5989
6044
|
const shape = {};
|
5990
|
-
util.objectKeys(this.shape)
|
6045
|
+
for (const key of util.objectKeys(this.shape)) {
|
5991
6046
|
if (!mask[key]) {
|
5992
6047
|
shape[key] = this.shape[key];
|
5993
6048
|
}
|
5994
|
-
}
|
6049
|
+
}
|
5995
6050
|
return new _ZodObject({
|
5996
6051
|
...this._def,
|
5997
6052
|
shape: () => shape
|
@@ -6005,14 +6060,14 @@ var init_lib = __esm({
|
|
6005
6060
|
}
|
6006
6061
|
partial(mask) {
|
6007
6062
|
const newShape = {};
|
6008
|
-
util.objectKeys(this.shape)
|
6063
|
+
for (const key of util.objectKeys(this.shape)) {
|
6009
6064
|
const fieldSchema = this.shape[key];
|
6010
6065
|
if (mask && !mask[key]) {
|
6011
6066
|
newShape[key] = fieldSchema;
|
6012
6067
|
} else {
|
6013
6068
|
newShape[key] = fieldSchema.optional();
|
6014
6069
|
}
|
6015
|
-
}
|
6070
|
+
}
|
6016
6071
|
return new _ZodObject({
|
6017
6072
|
...this._def,
|
6018
6073
|
shape: () => newShape
|
@@ -6020,7 +6075,7 @@ var init_lib = __esm({
|
|
6020
6075
|
}
|
6021
6076
|
required(mask) {
|
6022
6077
|
const newShape = {};
|
6023
|
-
util.objectKeys(this.shape)
|
6078
|
+
for (const key of util.objectKeys(this.shape)) {
|
6024
6079
|
if (mask && !mask[key]) {
|
6025
6080
|
newShape[key] = this.shape[key];
|
6026
6081
|
} else {
|
@@ -6031,7 +6086,7 @@ var init_lib = __esm({
|
|
6031
6086
|
}
|
6032
6087
|
newShape[key] = newField;
|
6033
6088
|
}
|
6034
|
-
}
|
6089
|
+
}
|
6035
6090
|
return new _ZodObject({
|
6036
6091
|
...this._def,
|
6037
6092
|
shape: () => newShape
|
@@ -6609,12 +6664,7 @@ var init_lib = __esm({
|
|
6609
6664
|
return makeIssue({
|
6610
6665
|
data: args,
|
6611
6666
|
path: ctx.path,
|
6612
|
-
errorMaps: [
|
6613
|
-
ctx.common.contextualErrorMap,
|
6614
|
-
ctx.schemaErrorMap,
|
6615
|
-
getErrorMap(),
|
6616
|
-
errorMap
|
6617
|
-
].filter((x) => !!x),
|
6667
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
6618
6668
|
issueData: {
|
6619
6669
|
code: ZodIssueCode.invalid_arguments,
|
6620
6670
|
argumentsError: error2
|
@@ -6625,12 +6675,7 @@ var init_lib = __esm({
|
|
6625
6675
|
return makeIssue({
|
6626
6676
|
data: returns,
|
6627
6677
|
path: ctx.path,
|
6628
|
-
errorMaps: [
|
6629
|
-
ctx.common.contextualErrorMap,
|
6630
|
-
ctx.schemaErrorMap,
|
6631
|
-
getErrorMap(),
|
6632
|
-
errorMap
|
6633
|
-
].filter((x) => !!x),
|
6678
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
6634
6679
|
issueData: {
|
6635
6680
|
code: ZodIssueCode.invalid_return_type,
|
6636
6681
|
returnTypeError: error2
|
@@ -6747,10 +6792,6 @@ var init_lib = __esm({
|
|
6747
6792
|
});
|
6748
6793
|
};
|
6749
6794
|
ZodEnum = class _ZodEnum extends ZodType {
|
6750
|
-
constructor() {
|
6751
|
-
super(...arguments);
|
6752
|
-
_ZodEnum_cache.set(this, void 0);
|
6753
|
-
}
|
6754
6795
|
_parse(input) {
|
6755
6796
|
if (typeof input.data !== "string") {
|
6756
6797
|
const ctx = this._getOrReturnCtx(input);
|
@@ -6762,10 +6803,10 @@ var init_lib = __esm({
|
|
6762
6803
|
});
|
6763
6804
|
return INVALID;
|
6764
6805
|
}
|
6765
|
-
if (!
|
6766
|
-
|
6806
|
+
if (!this._cache) {
|
6807
|
+
this._cache = new Set(this._def.values);
|
6767
6808
|
}
|
6768
|
-
if (!
|
6809
|
+
if (!this._cache.has(input.data)) {
|
6769
6810
|
const ctx = this._getOrReturnCtx(input);
|
6770
6811
|
const expectedValues = this._def.values;
|
6771
6812
|
addIssueToContext(ctx, {
|
@@ -6814,13 +6855,8 @@ var init_lib = __esm({
|
|
6814
6855
|
});
|
6815
6856
|
}
|
6816
6857
|
};
|
6817
|
-
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
6818
6858
|
ZodEnum.create = createZodEnum;
|
6819
6859
|
ZodNativeEnum = class extends ZodType {
|
6820
|
-
constructor() {
|
6821
|
-
super(...arguments);
|
6822
|
-
_ZodNativeEnum_cache.set(this, void 0);
|
6823
|
-
}
|
6824
6860
|
_parse(input) {
|
6825
6861
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
6826
6862
|
const ctx = this._getOrReturnCtx(input);
|
@@ -6833,10 +6869,10 @@ var init_lib = __esm({
|
|
6833
6869
|
});
|
6834
6870
|
return INVALID;
|
6835
6871
|
}
|
6836
|
-
if (!
|
6837
|
-
|
6872
|
+
if (!this._cache) {
|
6873
|
+
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
6838
6874
|
}
|
6839
|
-
if (!
|
6875
|
+
if (!this._cache.has(input.data)) {
|
6840
6876
|
const expectedValues = util.objectValues(nativeEnumValues);
|
6841
6877
|
addIssueToContext(ctx, {
|
6842
6878
|
received: ctx.data,
|
@@ -6851,7 +6887,6 @@ var init_lib = __esm({
|
|
6851
6887
|
return this._def.values;
|
6852
6888
|
}
|
6853
6889
|
};
|
6854
|
-
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
6855
6890
|
ZodNativeEnum.create = (values, params) => {
|
6856
6891
|
return new ZodNativeEnum({
|
6857
6892
|
values,
|
@@ -6992,7 +7027,7 @@ var init_lib = __esm({
|
|
6992
7027
|
parent: ctx
|
6993
7028
|
});
|
6994
7029
|
if (!isValid(base))
|
6995
|
-
return
|
7030
|
+
return INVALID;
|
6996
7031
|
const result = effect.transform(base.value, checkCtx);
|
6997
7032
|
if (result instanceof Promise) {
|
6998
7033
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
@@ -7001,8 +7036,11 @@ var init_lib = __esm({
|
|
7001
7036
|
} else {
|
7002
7037
|
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
7003
7038
|
if (!isValid(base))
|
7004
|
-
return
|
7005
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
7039
|
+
return INVALID;
|
7040
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
7041
|
+
status: status.value,
|
7042
|
+
value: result
|
7043
|
+
}));
|
7006
7044
|
});
|
7007
7045
|
}
|
7008
7046
|
}
|
@@ -7342,13 +7380,44 @@ var init_lib = __esm({
|
|
7342
7380
|
}
|
7343
7381
|
});
|
7344
7382
|
|
7383
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/external.js
|
7384
|
+
var init_external = __esm({
|
7385
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/external.js"() {
|
7386
|
+
"use strict";
|
7387
|
+
init_errors();
|
7388
|
+
init_parseUtil();
|
7389
|
+
init_typeAliases();
|
7390
|
+
init_util();
|
7391
|
+
init_types();
|
7392
|
+
init_ZodError();
|
7393
|
+
}
|
7394
|
+
});
|
7395
|
+
|
7396
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/index.js
|
7397
|
+
var init_v3 = __esm({
|
7398
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/index.js"() {
|
7399
|
+
"use strict";
|
7400
|
+
init_external();
|
7401
|
+
init_external();
|
7402
|
+
}
|
7403
|
+
});
|
7404
|
+
|
7405
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/index.js
|
7406
|
+
var init_esm = __esm({
|
7407
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/index.js"() {
|
7408
|
+
"use strict";
|
7409
|
+
init_v3();
|
7410
|
+
init_v3();
|
7411
|
+
}
|
7412
|
+
});
|
7413
|
+
|
7345
7414
|
// src/serializer/gelSchema.ts
|
7346
7415
|
var enumSchema, enumSchemaV1, indexColumn, index, fk, sequenceSchema, roleSchema, sequenceSquashed, column, checkConstraint, columnSquashed, compositePK, uniqueConstraint, policy, policySquashed, viewWithOption, matViewWithOption, mergedViewWithOption, view, table, schemaHash, kitInternals, gelSchemaExternal, gelSchemaInternal, tableSquashed, gelSchemaSquashed, gelSchema, dryGel;
|
7347
7416
|
var init_gelSchema = __esm({
|
7348
7417
|
"src/serializer/gelSchema.ts"() {
|
7349
7418
|
"use strict";
|
7350
7419
|
init_global();
|
7351
|
-
|
7420
|
+
init_esm();
|
7352
7421
|
enumSchema = objectType({
|
7353
7422
|
name: stringType(),
|
7354
7423
|
schema: stringType(),
|
@@ -7612,7 +7681,7 @@ var index2, fk2, column2, tableV3, compositePK2, uniqueConstraint2, checkConstra
|
|
7612
7681
|
var init_mysqlSchema = __esm({
|
7613
7682
|
"src/serializer/mysqlSchema.ts"() {
|
7614
7683
|
"use strict";
|
7615
|
-
|
7684
|
+
init_esm();
|
7616
7685
|
init_global();
|
7617
7686
|
index2 = objectType({
|
7618
7687
|
name: stringType(),
|
@@ -7941,7 +8010,7 @@ var init_pgSchema = __esm({
|
|
7941
8010
|
"src/serializer/pgSchema.ts"() {
|
7942
8011
|
"use strict";
|
7943
8012
|
init_global();
|
7944
|
-
|
8013
|
+
init_esm();
|
7945
8014
|
indexV2 = objectType({
|
7946
8015
|
name: stringType(),
|
7947
8016
|
columns: recordType(
|
@@ -8691,7 +8760,7 @@ var index4, column4, compositePK4, uniqueConstraint4, table4, viewMeta2, kitInte
|
|
8691
8760
|
var init_singlestoreSchema = __esm({
|
8692
8761
|
"src/serializer/singlestoreSchema.ts"() {
|
8693
8762
|
"use strict";
|
8694
|
-
|
8763
|
+
init_esm();
|
8695
8764
|
init_global();
|
8696
8765
|
index4 = objectType({
|
8697
8766
|
name: stringType(),
|
@@ -8888,7 +8957,7 @@ var index5, fk4, compositePK5, column5, tableV33, uniqueConstraint5, checkConstr
|
|
8888
8957
|
var init_sqliteSchema = __esm({
|
8889
8958
|
"src/serializer/sqliteSchema.ts"() {
|
8890
8959
|
"use strict";
|
8891
|
-
|
8960
|
+
init_esm();
|
8892
8961
|
init_global();
|
8893
8962
|
index5 = objectType({
|
8894
8963
|
name: stringType(),
|
@@ -17389,7 +17458,7 @@ var makeChanged, makeSelfOrChanged, makePatched, makeSelfOrPatched, columnSchema
|
|
17389
17458
|
var init_snapshotsDiffer = __esm({
|
17390
17459
|
"src/snapshotsDiffer.ts"() {
|
17391
17460
|
"use strict";
|
17392
|
-
|
17461
|
+
init_esm();
|
17393
17462
|
init_jsonDiffer();
|
17394
17463
|
init_sqlgenerator();
|
17395
17464
|
init_jsonStatements();
|
@@ -20301,7 +20370,7 @@ var dialects, dialect4, commonSquashedSchema, commonSchema;
|
|
20301
20370
|
var init_schemaValidator = __esm({
|
20302
20371
|
"src/schemaValidator.ts"() {
|
20303
20372
|
"use strict";
|
20304
|
-
|
20373
|
+
init_esm();
|
20305
20374
|
init_mysqlSchema();
|
20306
20375
|
init_pgSchema();
|
20307
20376
|
init_singlestoreSchema();
|
@@ -20323,7 +20392,7 @@ var sqliteDriversLiterals, postgresqlDriversLiterals, prefixes, prefix, casingTy
|
|
20323
20392
|
var init_common = __esm({
|
20324
20393
|
"src/cli/validations/common.ts"() {
|
20325
20394
|
"use strict";
|
20326
|
-
|
20395
|
+
init_esm();
|
20327
20396
|
init_schemaValidator();
|
20328
20397
|
init_outputs();
|
20329
20398
|
sqliteDriversLiterals = [
|
@@ -22101,8 +22170,7 @@ var init_column_builder = __esm({
|
|
22101
22170
|
}
|
22102
22171
|
/** @internal Sets the name of the column to the key within the table definition if a name was not given. */
|
22103
22172
|
setName(name2) {
|
22104
|
-
if (this.config.name !== "")
|
22105
|
-
return;
|
22173
|
+
if (this.config.name !== "") return;
|
22106
22174
|
this.config.name = name2;
|
22107
22175
|
}
|
22108
22176
|
};
|
@@ -22534,8 +22602,7 @@ var init_common2 = __esm({
|
|
22534
22602
|
const a = value.map(
|
22535
22603
|
(v) => v === null ? null : is(this.baseColumn, _PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v)
|
22536
22604
|
);
|
22537
|
-
if (isNestedArray)
|
22538
|
-
return a;
|
22605
|
+
if (isNestedArray) return a;
|
22539
22606
|
return makePgArray(a);
|
22540
22607
|
}
|
22541
22608
|
};
|
@@ -22668,7 +22735,7 @@ var version;
|
|
22668
22735
|
var init_version = __esm({
|
22669
22736
|
"../drizzle-orm/dist/version.js"() {
|
22670
22737
|
"use strict";
|
22671
|
-
version = "0.
|
22738
|
+
version = "0.44.2";
|
22672
22739
|
}
|
22673
22740
|
});
|
22674
22741
|
|
@@ -23344,7 +23411,7 @@ var init_alias = __esm({
|
|
23344
23411
|
|
23345
23412
|
// ../drizzle-orm/dist/errors.js
|
23346
23413
|
var _a31, _b13, DrizzleError, _a32, _b14, TransactionRollbackError;
|
23347
|
-
var
|
23414
|
+
var init_errors2 = __esm({
|
23348
23415
|
"../drizzle-orm/dist/errors.js"() {
|
23349
23416
|
"use strict";
|
23350
23417
|
init_entity();
|
@@ -23448,7 +23515,6 @@ var init_query_promise = __esm({
|
|
23448
23515
|
});
|
23449
23516
|
|
23450
23517
|
// ../drizzle-orm/dist/utils.js
|
23451
|
-
import * as crypto from "node:crypto";
|
23452
23518
|
function mapResultRow(columns, row, joinsNotNullableMap) {
|
23453
23519
|
const nullifyMap = {};
|
23454
23520
|
const result = columns.reduce(
|
@@ -23539,8 +23605,7 @@ function mapUpdateSet(table6, values) {
|
|
23539
23605
|
function applyMixins(baseClass, extendedClasses) {
|
23540
23606
|
for (const extendedClass of extendedClasses) {
|
23541
23607
|
for (const name2 of Object.getOwnPropertyNames(extendedClass.prototype)) {
|
23542
|
-
if (name2 === "constructor")
|
23543
|
-
continue;
|
23608
|
+
if (name2 === "constructor") continue;
|
23544
23609
|
Object.defineProperty(
|
23545
23610
|
baseClass.prototype,
|
23546
23611
|
name2,
|
@@ -23555,15 +23620,6 @@ function getTableColumns(table6) {
|
|
23555
23620
|
function getViewSelectedFields(view5) {
|
23556
23621
|
return view5[ViewBaseConfig].selectedFields;
|
23557
23622
|
}
|
23558
|
-
async function hashQuery(sql2, params) {
|
23559
|
-
const dataToHash = `${sql2}-${JSON.stringify(params)}`;
|
23560
|
-
const encoder = new TextEncoder();
|
23561
|
-
const data = encoder.encode(dataToHash);
|
23562
|
-
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
23563
|
-
const hashArray = [...new Uint8Array(hashBuffer)];
|
23564
|
-
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
23565
|
-
return hashHex;
|
23566
|
-
}
|
23567
23623
|
function getTableLikeName(table6) {
|
23568
23624
|
return is(table6, Subquery) ? table6._.alias : is(table6, View3) ? table6[ViewBaseConfig].name : is(table6, SQL) ? void 0 : table6[Table2.Symbol.IsAlias] ? table6[Table2.Symbol.Name] : table6[Table2.Symbol.BaseName];
|
23569
23625
|
}
|
@@ -23574,47 +23630,38 @@ function getColumnNameAndConfig(a, b) {
|
|
23574
23630
|
};
|
23575
23631
|
}
|
23576
23632
|
function isConfig(data) {
|
23577
|
-
if (typeof data !== "object" || data === null)
|
23578
|
-
|
23579
|
-
if (data.constructor.name !== "Object")
|
23580
|
-
return false;
|
23633
|
+
if (typeof data !== "object" || data === null) return false;
|
23634
|
+
if (data.constructor.name !== "Object") return false;
|
23581
23635
|
if ("logger" in data) {
|
23582
23636
|
const type = typeof data["logger"];
|
23583
|
-
if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined")
|
23584
|
-
return false;
|
23637
|
+
if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined") return false;
|
23585
23638
|
return true;
|
23586
23639
|
}
|
23587
23640
|
if ("schema" in data) {
|
23588
23641
|
const type = typeof data["schema"];
|
23589
|
-
if (type !== "object" && type !== "undefined")
|
23590
|
-
return false;
|
23642
|
+
if (type !== "object" && type !== "undefined") return false;
|
23591
23643
|
return true;
|
23592
23644
|
}
|
23593
23645
|
if ("casing" in data) {
|
23594
23646
|
const type = typeof data["casing"];
|
23595
|
-
if (type !== "string" && type !== "undefined")
|
23596
|
-
return false;
|
23647
|
+
if (type !== "string" && type !== "undefined") return false;
|
23597
23648
|
return true;
|
23598
23649
|
}
|
23599
23650
|
if ("mode" in data) {
|
23600
|
-
if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== void 0)
|
23601
|
-
return false;
|
23651
|
+
if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== void 0) return false;
|
23602
23652
|
return true;
|
23603
23653
|
}
|
23604
23654
|
if ("connection" in data) {
|
23605
23655
|
const type = typeof data["connection"];
|
23606
|
-
if (type !== "string" && type !== "object" && type !== "undefined")
|
23607
|
-
return false;
|
23656
|
+
if (type !== "string" && type !== "object" && type !== "undefined") return false;
|
23608
23657
|
return true;
|
23609
23658
|
}
|
23610
23659
|
if ("client" in data) {
|
23611
23660
|
const type = typeof data["client"];
|
23612
|
-
if (type !== "object" && type !== "function" && type !== "undefined")
|
23613
|
-
return false;
|
23661
|
+
if (type !== "object" && type !== "function" && type !== "undefined") return false;
|
23614
23662
|
return true;
|
23615
23663
|
}
|
23616
|
-
if (Object.keys(data).length === 0)
|
23617
|
-
return true;
|
23664
|
+
if (Object.keys(data).length === 0) return true;
|
23618
23665
|
return false;
|
23619
23666
|
}
|
23620
23667
|
var init_utils2 = __esm({
|
@@ -24432,8 +24479,7 @@ var init_numeric = __esm({
|
|
24432
24479
|
this.scale = config.scale;
|
24433
24480
|
}
|
24434
24481
|
mapFromDriverValue(value) {
|
24435
|
-
if (typeof value === "string")
|
24436
|
-
return value;
|
24482
|
+
if (typeof value === "string") return value;
|
24437
24483
|
return String(value);
|
24438
24484
|
}
|
24439
24485
|
getSQLType() {
|
@@ -24472,8 +24518,7 @@ var init_numeric = __esm({
|
|
24472
24518
|
this.scale = config.scale;
|
24473
24519
|
}
|
24474
24520
|
mapFromDriverValue(value) {
|
24475
|
-
if (typeof value === "number")
|
24476
|
-
return value;
|
24521
|
+
if (typeof value === "number") return value;
|
24477
24522
|
return Number(value);
|
24478
24523
|
}
|
24479
24524
|
getSQLType() {
|
@@ -26087,7 +26132,6 @@ __export(dist_exports, {
|
|
26087
26132
|
gte: () => gte,
|
26088
26133
|
hammingDistance: () => hammingDistance,
|
26089
26134
|
hasOwnEntityKind: () => hasOwnEntityKind,
|
26090
|
-
hashQuery: () => hashQuery,
|
26091
26135
|
haveSameKeys: () => haveSameKeys,
|
26092
26136
|
ilike: () => ilike,
|
26093
26137
|
inArray: () => inArray,
|
@@ -26141,7 +26185,7 @@ var init_dist = __esm({
|
|
26141
26185
|
init_column_builder();
|
26142
26186
|
init_column();
|
26143
26187
|
init_entity();
|
26144
|
-
|
26188
|
+
init_errors2();
|
26145
26189
|
init_logger();
|
26146
26190
|
init_operations();
|
26147
26191
|
init_query_promise();
|
@@ -26510,8 +26554,7 @@ var init_casing = __esm({
|
|
26510
26554
|
this.convert = casing2 === "snake_case" ? toSnakeCase : casing2 === "camelCase" ? toCamelCase : noopCase;
|
26511
26555
|
}
|
26512
26556
|
getColumnCasing(column6) {
|
26513
|
-
if (!column6.keyAsName)
|
26514
|
-
return column6.name;
|
26557
|
+
if (!column6.keyAsName) return column6.name;
|
26515
26558
|
const schema5 = column6.table[Table2.Symbol.Schema] ?? "public";
|
26516
26559
|
const tableName = column6.table[Table2.Symbol.OriginalName];
|
26517
26560
|
const key = `${schema5}.${tableName}.${column6.name}`;
|
@@ -26563,7 +26606,7 @@ var init_dialect = __esm({
|
|
26563
26606
|
init_casing();
|
26564
26607
|
init_column();
|
26565
26608
|
init_entity();
|
26566
|
-
|
26609
|
+
init_errors2();
|
26567
26610
|
init_columns();
|
26568
26611
|
init_table2();
|
26569
26612
|
init_relations();
|
@@ -26620,8 +26663,7 @@ var init_dialect = __esm({
|
|
26620
26663
|
return `'${str.replace(/'/g, "''")}'`;
|
26621
26664
|
}
|
26622
26665
|
buildWithCTE(queries) {
|
26623
|
-
if (!queries?.length)
|
26624
|
-
return void 0;
|
26666
|
+
if (!queries?.length) return void 0;
|
26625
26667
|
const withSqlChunks = [sql`with `];
|
26626
26668
|
for (const [i, w] of queries.entries()) {
|
26627
26669
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -28171,8 +28213,7 @@ var init_select2 = __esm({
|
|
28171
28213
|
};
|
28172
28214
|
this.tableName = getTableLikeName(table6);
|
28173
28215
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
28174
|
-
for (const item of extractUsedTable(table6))
|
28175
|
-
this.usedTables.add(item);
|
28216
|
+
for (const item of extractUsedTable(table6)) this.usedTables.add(item);
|
28176
28217
|
}
|
28177
28218
|
/** @internal */
|
28178
28219
|
getUsedTables() {
|
@@ -28182,8 +28223,7 @@ var init_select2 = __esm({
|
|
28182
28223
|
return (table6, on) => {
|
28183
28224
|
const baseTableName = this.tableName;
|
28184
28225
|
const tableName = getTableLikeName(table6);
|
28185
|
-
for (const item of extractUsedTable(table6))
|
28186
|
-
this.usedTables.add(item);
|
28226
|
+
for (const item of extractUsedTable(table6)) this.usedTables.add(item);
|
28187
28227
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
28188
28228
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
28189
28229
|
}
|
@@ -28444,8 +28484,7 @@ var init_select2 = __esm({
|
|
28444
28484
|
const usedTables = [];
|
28445
28485
|
usedTables.push(...extractUsedTable(this.config.table));
|
28446
28486
|
if (this.config.joins) {
|
28447
|
-
for (const it of this.config.joins)
|
28448
|
-
usedTables.push(...extractUsedTable(it.table));
|
28487
|
+
for (const it of this.config.joins) usedTables.push(...extractUsedTable(it.table));
|
28449
28488
|
}
|
28450
28489
|
return new Proxy(
|
28451
28490
|
new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
|
@@ -30227,6 +30266,15 @@ var init_schema = __esm({
|
|
30227
30266
|
});
|
30228
30267
|
|
30229
30268
|
// ../drizzle-orm/dist/cache/core/cache.js
|
30269
|
+
async function hashQuery(sql2, params) {
|
30270
|
+
const dataToHash = `${sql2}-${JSON.stringify(params)}`;
|
30271
|
+
const encoder = new TextEncoder();
|
30272
|
+
const data = encoder.encode(dataToHash);
|
30273
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
30274
|
+
const hashArray = [...new Uint8Array(hashBuffer)];
|
30275
|
+
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
30276
|
+
return hashHex;
|
30277
|
+
}
|
30230
30278
|
var _a165, Cache, _a166, _b119, NoopCache;
|
30231
30279
|
var init_cache = __esm({
|
30232
30280
|
"../drizzle-orm/dist/cache/core/cache.js"() {
|
@@ -30252,6 +30300,25 @@ var init_cache = __esm({
|
|
30252
30300
|
}
|
30253
30301
|
});
|
30254
30302
|
|
30303
|
+
// ../drizzle-orm/dist/errors/index.js
|
30304
|
+
var DrizzleQueryError;
|
30305
|
+
var init_errors3 = __esm({
|
30306
|
+
"../drizzle-orm/dist/errors/index.js"() {
|
30307
|
+
"use strict";
|
30308
|
+
DrizzleQueryError = class _DrizzleQueryError extends Error {
|
30309
|
+
constructor(query, params, cause) {
|
30310
|
+
super(`Failed query: ${query}
|
30311
|
+
params: ${params}`);
|
30312
|
+
this.query = query;
|
30313
|
+
this.params = params;
|
30314
|
+
this.cause = cause;
|
30315
|
+
Error.captureStackTrace(this, _DrizzleQueryError);
|
30316
|
+
if (cause) this.cause = cause;
|
30317
|
+
}
|
30318
|
+
};
|
30319
|
+
}
|
30320
|
+
});
|
30321
|
+
|
30255
30322
|
// ../drizzle-orm/dist/pg-core/session.js
|
30256
30323
|
var _a167, PgPreparedQuery, _a168, PgSession, _a169, _b120, PgTransaction;
|
30257
30324
|
var init_session = __esm({
|
@@ -30259,10 +30326,10 @@ var init_session = __esm({
|
|
30259
30326
|
"use strict";
|
30260
30327
|
init_cache();
|
30261
30328
|
init_entity();
|
30262
|
-
|
30329
|
+
init_errors2();
|
30330
|
+
init_errors3();
|
30263
30331
|
init_sql2();
|
30264
30332
|
init_tracing();
|
30265
|
-
init_utils2();
|
30266
30333
|
init_db();
|
30267
30334
|
_a167 = entityKind;
|
30268
30335
|
PgPreparedQuery = class {
|
@@ -30295,20 +30362,36 @@ var init_session = __esm({
|
|
30295
30362
|
/** @internal */
|
30296
30363
|
async queryWithCache(queryString, params, query) {
|
30297
30364
|
if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
|
30298
|
-
|
30365
|
+
try {
|
30366
|
+
return await query();
|
30367
|
+
} catch (e) {
|
30368
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30369
|
+
}
|
30299
30370
|
}
|
30300
30371
|
if (this.cacheConfig && !this.cacheConfig.enable) {
|
30301
|
-
|
30372
|
+
try {
|
30373
|
+
return await query();
|
30374
|
+
} catch (e) {
|
30375
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30376
|
+
}
|
30302
30377
|
}
|
30303
30378
|
if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
|
30304
|
-
|
30305
|
-
|
30306
|
-
|
30307
|
-
|
30308
|
-
|
30379
|
+
try {
|
30380
|
+
const [res] = await Promise.all([
|
30381
|
+
query(),
|
30382
|
+
this.cache.onMutate({ tables: this.queryMetadata.tables })
|
30383
|
+
]);
|
30384
|
+
return res;
|
30385
|
+
} catch (e) {
|
30386
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30387
|
+
}
|
30309
30388
|
}
|
30310
30389
|
if (!this.cacheConfig) {
|
30311
|
-
|
30390
|
+
try {
|
30391
|
+
return await query();
|
30392
|
+
} catch (e) {
|
30393
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30394
|
+
}
|
30312
30395
|
}
|
30313
30396
|
if (this.queryMetadata.type === "select") {
|
30314
30397
|
const fromCache = await this.cache.get(
|
@@ -30318,7 +30401,12 @@ var init_session = __esm({
|
|
30318
30401
|
this.cacheConfig.autoInvalidate
|
30319
30402
|
);
|
30320
30403
|
if (fromCache === void 0) {
|
30321
|
-
|
30404
|
+
let result;
|
30405
|
+
try {
|
30406
|
+
result = await query();
|
30407
|
+
} catch (e) {
|
30408
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30409
|
+
}
|
30322
30410
|
await this.cache.put(
|
30323
30411
|
this.cacheConfig.tag ?? await hashQuery(queryString, params),
|
30324
30412
|
result,
|
@@ -30331,7 +30419,11 @@ var init_session = __esm({
|
|
30331
30419
|
}
|
30332
30420
|
return fromCache;
|
30333
30421
|
}
|
30334
|
-
|
30422
|
+
try {
|
30423
|
+
return await query();
|
30424
|
+
} catch (e) {
|
30425
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30426
|
+
}
|
30335
30427
|
}
|
30336
30428
|
};
|
30337
30429
|
__publicField(PgPreparedQuery, _a167, "PgPreparedQuery");
|
@@ -32668,8 +32760,7 @@ var init_numeric2 = __esm({
|
|
32668
32760
|
__publicField(SQLiteNumericBuilder, _a195, "SQLiteNumericBuilder");
|
32669
32761
|
SQLiteNumeric = class extends (_b140 = SQLiteColumn, _a196 = entityKind, _b140) {
|
32670
32762
|
mapFromDriverValue(value) {
|
32671
|
-
if (typeof value === "string")
|
32672
|
-
return value;
|
32763
|
+
if (typeof value === "string") return value;
|
32673
32764
|
return String(value);
|
32674
32765
|
}
|
32675
32766
|
getSQLType() {
|
@@ -32696,8 +32787,7 @@ var init_numeric2 = __esm({
|
|
32696
32787
|
__publicField(this, "mapToDriverValue", String);
|
32697
32788
|
}
|
32698
32789
|
mapFromDriverValue(value) {
|
32699
|
-
if (typeof value === "number")
|
32700
|
-
return value;
|
32790
|
+
if (typeof value === "number") return value;
|
32701
32791
|
return Number(value);
|
32702
32792
|
}
|
32703
32793
|
getSQLType() {
|
@@ -33232,7 +33322,7 @@ var init_dialect2 = __esm({
|
|
33232
33322
|
init_casing();
|
33233
33323
|
init_column();
|
33234
33324
|
init_entity();
|
33235
|
-
|
33325
|
+
init_errors2();
|
33236
33326
|
init_relations();
|
33237
33327
|
init_sql2();
|
33238
33328
|
init_sql();
|
@@ -33260,8 +33350,7 @@ var init_dialect2 = __esm({
|
|
33260
33350
|
return `'${str.replace(/'/g, "''")}'`;
|
33261
33351
|
}
|
33262
33352
|
buildWithCTE(queries) {
|
33263
|
-
if (!queries?.length)
|
33264
|
-
return void 0;
|
33353
|
+
if (!queries?.length) return void 0;
|
33265
33354
|
const withSqlChunks = [sql`with `];
|
33266
33355
|
for (const [i, w] of queries.entries()) {
|
33267
33356
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -34212,8 +34301,7 @@ var init_select3 = __esm({
|
|
34212
34301
|
};
|
34213
34302
|
this.tableName = getTableLikeName(table6);
|
34214
34303
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
34215
|
-
for (const item of extractUsedTable2(table6))
|
34216
|
-
this.usedTables.add(item);
|
34304
|
+
for (const item of extractUsedTable2(table6)) this.usedTables.add(item);
|
34217
34305
|
}
|
34218
34306
|
/** @internal */
|
34219
34307
|
getUsedTables() {
|
@@ -34223,8 +34311,7 @@ var init_select3 = __esm({
|
|
34223
34311
|
return (table6, on) => {
|
34224
34312
|
const baseTableName = this.tableName;
|
34225
34313
|
const tableName = getTableLikeName(table6);
|
34226
|
-
for (const item of extractUsedTable2(table6))
|
34227
|
-
this.usedTables.add(item);
|
34314
|
+
for (const item of extractUsedTable2(table6)) this.usedTables.add(item);
|
34228
34315
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
34229
34316
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
34230
34317
|
}
|
@@ -34471,8 +34558,7 @@ var init_select3 = __esm({
|
|
34471
34558
|
const usedTables = [];
|
34472
34559
|
usedTables.push(...extractUsedTable2(this.config.table));
|
34473
34560
|
if (this.config.joins) {
|
34474
|
-
for (const it of this.config.joins)
|
34475
|
-
usedTables.push(...extractUsedTable2(it.table));
|
34561
|
+
for (const it of this.config.joins) usedTables.push(...extractUsedTable2(it.table));
|
34476
34562
|
}
|
34477
34563
|
return new Proxy(
|
34478
34564
|
new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
|
@@ -34730,8 +34816,7 @@ var init_insert2 = __esm({
|
|
34730
34816
|
* ```
|
34731
34817
|
*/
|
34732
34818
|
onConflictDoNothing(config = {}) {
|
34733
|
-
if (!this.config.onConflict)
|
34734
|
-
this.config.onConflict = [];
|
34819
|
+
if (!this.config.onConflict) this.config.onConflict = [];
|
34735
34820
|
if (config.target === void 0) {
|
34736
34821
|
this.config.onConflict.push(sql` on conflict do nothing`);
|
34737
34822
|
} else {
|
@@ -34776,8 +34861,7 @@ var init_insert2 = __esm({
|
|
34776
34861
|
'You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.'
|
34777
34862
|
);
|
34778
34863
|
}
|
34779
|
-
if (!this.config.onConflict)
|
34780
|
-
this.config.onConflict = [];
|
34864
|
+
if (!this.config.onConflict) this.config.onConflict = [];
|
34781
34865
|
const whereSql = config.where ? sql` where ${config.where}` : void 0;
|
34782
34866
|
const targetWhereSql = config.targetWhere ? sql` where ${config.targetWhere}` : void 0;
|
34783
34867
|
const setWhereSql = config.setWhere ? sql` where ${config.setWhere}` : void 0;
|
@@ -35583,9 +35667,9 @@ var init_session2 = __esm({
|
|
35583
35667
|
"use strict";
|
35584
35668
|
init_cache();
|
35585
35669
|
init_entity();
|
35586
|
-
|
35670
|
+
init_errors2();
|
35671
|
+
init_errors3();
|
35587
35672
|
init_query_promise();
|
35588
|
-
init_utils2();
|
35589
35673
|
init_db2();
|
35590
35674
|
ExecuteResultSync = class extends (_b164 = QueryPromise, _a232 = entityKind, _b164) {
|
35591
35675
|
constructor(resultCb) {
|
@@ -35621,20 +35705,36 @@ var init_session2 = __esm({
|
|
35621
35705
|
/** @internal */
|
35622
35706
|
async queryWithCache(queryString, params, query) {
|
35623
35707
|
if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
|
35624
|
-
|
35708
|
+
try {
|
35709
|
+
return await query();
|
35710
|
+
} catch (e) {
|
35711
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35712
|
+
}
|
35625
35713
|
}
|
35626
35714
|
if (this.cacheConfig && !this.cacheConfig.enable) {
|
35627
|
-
|
35715
|
+
try {
|
35716
|
+
return await query();
|
35717
|
+
} catch (e) {
|
35718
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35719
|
+
}
|
35628
35720
|
}
|
35629
35721
|
if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
|
35630
|
-
|
35631
|
-
|
35632
|
-
|
35633
|
-
|
35634
|
-
|
35722
|
+
try {
|
35723
|
+
const [res] = await Promise.all([
|
35724
|
+
query(),
|
35725
|
+
this.cache.onMutate({ tables: this.queryMetadata.tables })
|
35726
|
+
]);
|
35727
|
+
return res;
|
35728
|
+
} catch (e) {
|
35729
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35730
|
+
}
|
35635
35731
|
}
|
35636
35732
|
if (!this.cacheConfig) {
|
35637
|
-
|
35733
|
+
try {
|
35734
|
+
return await query();
|
35735
|
+
} catch (e) {
|
35736
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35737
|
+
}
|
35638
35738
|
}
|
35639
35739
|
if (this.queryMetadata.type === "select") {
|
35640
35740
|
const fromCache = await this.cache.get(
|
@@ -35644,7 +35744,12 @@ var init_session2 = __esm({
|
|
35644
35744
|
this.cacheConfig.autoInvalidate
|
35645
35745
|
);
|
35646
35746
|
if (fromCache === void 0) {
|
35647
|
-
|
35747
|
+
let result;
|
35748
|
+
try {
|
35749
|
+
result = await query();
|
35750
|
+
} catch (e) {
|
35751
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35752
|
+
}
|
35648
35753
|
await this.cache.put(
|
35649
35754
|
this.cacheConfig.tag ?? await hashQuery(queryString, params),
|
35650
35755
|
result,
|
@@ -35657,7 +35762,11 @@ var init_session2 = __esm({
|
|
35657
35762
|
}
|
35658
35763
|
return fromCache;
|
35659
35764
|
}
|
35660
|
-
|
35765
|
+
try {
|
35766
|
+
return await query();
|
35767
|
+
} catch (e) {
|
35768
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35769
|
+
}
|
35661
35770
|
}
|
35662
35771
|
getQuery() {
|
35663
35772
|
return this.query;
|
@@ -36929,10 +37038,8 @@ var init_binary = __esm({
|
|
36929
37038
|
__publicField(this, "length", this.config.length);
|
36930
37039
|
}
|
36931
37040
|
mapFromDriverValue(value) {
|
36932
|
-
if (typeof value === "string")
|
36933
|
-
|
36934
|
-
if (Buffer.isBuffer(value))
|
36935
|
-
return value.toString();
|
37041
|
+
if (typeof value === "string") return value;
|
37042
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
36936
37043
|
const str = [];
|
36937
37044
|
for (const v of value) {
|
36938
37045
|
str.push(v === 49 ? "1" : "0");
|
@@ -37254,8 +37361,7 @@ var init_decimal = __esm({
|
|
37254
37361
|
__publicField(this, "unsigned", this.config.unsigned);
|
37255
37362
|
}
|
37256
37363
|
mapFromDriverValue(value) {
|
37257
|
-
if (typeof value === "string")
|
37258
|
-
return value;
|
37364
|
+
if (typeof value === "string") return value;
|
37259
37365
|
return String(value);
|
37260
37366
|
}
|
37261
37367
|
getSQLType() {
|
@@ -37297,8 +37403,7 @@ var init_decimal = __esm({
|
|
37297
37403
|
__publicField(this, "mapToDriverValue", String);
|
37298
37404
|
}
|
37299
37405
|
mapFromDriverValue(value) {
|
37300
|
-
if (typeof value === "number")
|
37301
|
-
return value;
|
37406
|
+
if (typeof value === "number") return value;
|
37302
37407
|
return Number(value);
|
37303
37408
|
}
|
37304
37409
|
getSQLType() {
|
@@ -38027,10 +38132,8 @@ var init_varbinary = __esm({
|
|
38027
38132
|
__publicField(this, "length", this.config.length);
|
38028
38133
|
}
|
38029
38134
|
mapFromDriverValue(value) {
|
38030
|
-
if (typeof value === "string")
|
38031
|
-
|
38032
|
-
if (Buffer.isBuffer(value))
|
38033
|
-
return value.toString();
|
38135
|
+
if (typeof value === "string") return value;
|
38136
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
38034
38137
|
const str = [];
|
38035
38138
|
for (const v of value) {
|
38036
38139
|
str.push(v === 49 ? "1" : "0");
|
@@ -38639,7 +38742,7 @@ var init_dialect3 = __esm({
|
|
38639
38742
|
init_casing();
|
38640
38743
|
init_column();
|
38641
38744
|
init_entity();
|
38642
|
-
|
38745
|
+
init_errors2();
|
38643
38746
|
init_relations();
|
38644
38747
|
init_expressions();
|
38645
38748
|
init_sql();
|
@@ -38694,8 +38797,7 @@ var init_dialect3 = __esm({
|
|
38694
38797
|
return `'${str.replace(/'/g, "''")}'`;
|
38695
38798
|
}
|
38696
38799
|
buildWithCTE(queries) {
|
38697
|
-
if (!queries?.length)
|
38698
|
-
return void 0;
|
38800
|
+
if (!queries?.length) return void 0;
|
38699
38801
|
const withSqlChunks = [sql`with `];
|
38700
38802
|
for (const [i, w] of queries.entries()) {
|
38701
38803
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -39975,8 +40077,7 @@ var init_select4 = __esm({
|
|
39975
40077
|
};
|
39976
40078
|
this.tableName = getTableLikeName(table6);
|
39977
40079
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
39978
|
-
for (const item of extractUsedTable3(table6))
|
39979
|
-
this.usedTables.add(item);
|
40080
|
+
for (const item of extractUsedTable3(table6)) this.usedTables.add(item);
|
39980
40081
|
}
|
39981
40082
|
/** @internal */
|
39982
40083
|
getUsedTables() {
|
@@ -39989,8 +40090,7 @@ var init_select4 = __esm({
|
|
39989
40090
|
const onIndex = isCrossJoin ? a : b;
|
39990
40091
|
const baseTableName = this.tableName;
|
39991
40092
|
const tableName = getTableLikeName(table6);
|
39992
|
-
for (const item of extractUsedTable3(table6))
|
39993
|
-
this.usedTables.add(item);
|
40093
|
+
for (const item of extractUsedTable3(table6)) this.usedTables.add(item);
|
39994
40094
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
39995
40095
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
39996
40096
|
}
|
@@ -40258,8 +40358,7 @@ var init_select4 = __esm({
|
|
40258
40358
|
const usedTables = [];
|
40259
40359
|
usedTables.push(...extractUsedTable3(this.config.table));
|
40260
40360
|
if (this.config.joins) {
|
40261
|
-
for (const it of this.config.joins)
|
40262
|
-
usedTables.push(...extractUsedTable3(it.table));
|
40361
|
+
for (const it of this.config.joins) usedTables.push(...extractUsedTable3(it.table));
|
40263
40362
|
}
|
40264
40363
|
return new Proxy(
|
40265
40364
|
new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
|
@@ -41208,9 +41307,9 @@ var init_session3 = __esm({
|
|
41208
41307
|
"use strict";
|
41209
41308
|
init_cache();
|
41210
41309
|
init_entity();
|
41211
|
-
|
41310
|
+
init_errors2();
|
41311
|
+
init_errors3();
|
41212
41312
|
init_sql();
|
41213
|
-
init_utils2();
|
41214
41313
|
init_db3();
|
41215
41314
|
_a341 = entityKind;
|
41216
41315
|
MySqlPreparedQuery = class {
|
@@ -41230,20 +41329,36 @@ var init_session3 = __esm({
|
|
41230
41329
|
/** @internal */
|
41231
41330
|
async queryWithCache(queryString, params, query) {
|
41232
41331
|
if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
|
41233
|
-
|
41332
|
+
try {
|
41333
|
+
return await query();
|
41334
|
+
} catch (e) {
|
41335
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41336
|
+
}
|
41234
41337
|
}
|
41235
41338
|
if (this.cacheConfig && !this.cacheConfig.enable) {
|
41236
|
-
|
41339
|
+
try {
|
41340
|
+
return await query();
|
41341
|
+
} catch (e) {
|
41342
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41343
|
+
}
|
41237
41344
|
}
|
41238
41345
|
if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
|
41239
|
-
|
41240
|
-
|
41241
|
-
|
41242
|
-
|
41243
|
-
|
41346
|
+
try {
|
41347
|
+
const [res] = await Promise.all([
|
41348
|
+
query(),
|
41349
|
+
this.cache.onMutate({ tables: this.queryMetadata.tables })
|
41350
|
+
]);
|
41351
|
+
return res;
|
41352
|
+
} catch (e) {
|
41353
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41354
|
+
}
|
41244
41355
|
}
|
41245
41356
|
if (!this.cacheConfig) {
|
41246
|
-
|
41357
|
+
try {
|
41358
|
+
return await query();
|
41359
|
+
} catch (e) {
|
41360
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41361
|
+
}
|
41247
41362
|
}
|
41248
41363
|
if (this.queryMetadata.type === "select") {
|
41249
41364
|
const fromCache = await this.cache.get(
|
@@ -41253,7 +41368,12 @@ var init_session3 = __esm({
|
|
41253
41368
|
this.cacheConfig.autoInvalidate
|
41254
41369
|
);
|
41255
41370
|
if (fromCache === void 0) {
|
41256
|
-
|
41371
|
+
let result;
|
41372
|
+
try {
|
41373
|
+
result = await query();
|
41374
|
+
} catch (e) {
|
41375
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41376
|
+
}
|
41257
41377
|
await this.cache.put(
|
41258
41378
|
this.cacheConfig.tag ?? await hashQuery(queryString, params),
|
41259
41379
|
result,
|
@@ -41266,7 +41386,11 @@ var init_session3 = __esm({
|
|
41266
41386
|
}
|
41267
41387
|
return fromCache;
|
41268
41388
|
}
|
41269
|
-
|
41389
|
+
try {
|
41390
|
+
return await query();
|
41391
|
+
} catch (e) {
|
41392
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41393
|
+
}
|
41270
41394
|
}
|
41271
41395
|
};
|
41272
41396
|
__publicField(MySqlPreparedQuery, _a341, "MySqlPreparedQuery");
|
@@ -42112,7 +42236,7 @@ var cliConfigGenerate, pushParams, pullParams, configCheck, cliConfigCheck;
|
|
42112
42236
|
var init_cli = __esm({
|
42113
42237
|
"src/cli/validations/cli.ts"() {
|
42114
42238
|
"use strict";
|
42115
|
-
|
42239
|
+
init_esm();
|
42116
42240
|
init_schemaValidator();
|
42117
42241
|
init_common();
|
42118
42242
|
cliConfigGenerate = objectType({
|
@@ -42180,7 +42304,7 @@ var gelCredentials;
|
|
42180
42304
|
var init_gel = __esm({
|
42181
42305
|
"src/cli/validations/gel.ts"() {
|
42182
42306
|
"use strict";
|
42183
|
-
|
42307
|
+
init_esm();
|
42184
42308
|
init_views();
|
42185
42309
|
init_common();
|
42186
42310
|
gelCredentials = unionType([
|
@@ -42228,7 +42352,7 @@ var libSQLCredentials;
|
|
42228
42352
|
var init_libsql = __esm({
|
42229
42353
|
"src/cli/validations/libsql.ts"() {
|
42230
42354
|
"use strict";
|
42231
|
-
|
42355
|
+
init_esm();
|
42232
42356
|
init_views();
|
42233
42357
|
init_common();
|
42234
42358
|
libSQLCredentials = objectType({
|
@@ -42243,7 +42367,7 @@ var mysqlCredentials;
|
|
42243
42367
|
var init_mysql = __esm({
|
42244
42368
|
"src/cli/validations/mysql.ts"() {
|
42245
42369
|
"use strict";
|
42246
|
-
|
42370
|
+
init_esm();
|
42247
42371
|
init_views();
|
42248
42372
|
init_common();
|
42249
42373
|
init_outputs();
|
@@ -42280,7 +42404,7 @@ var postgresCredentials;
|
|
42280
42404
|
var init_postgres = __esm({
|
42281
42405
|
"src/cli/validations/postgres.ts"() {
|
42282
42406
|
"use strict";
|
42283
|
-
|
42407
|
+
init_esm();
|
42284
42408
|
init_views();
|
42285
42409
|
init_common();
|
42286
42410
|
postgresCredentials = unionType([
|
@@ -42329,7 +42453,7 @@ var singlestoreCredentials;
|
|
42329
42453
|
var init_singlestore = __esm({
|
42330
42454
|
"src/cli/validations/singlestore.ts"() {
|
42331
42455
|
"use strict";
|
42332
|
-
|
42456
|
+
init_esm();
|
42333
42457
|
init_views();
|
42334
42458
|
init_common();
|
42335
42459
|
init_outputs();
|
@@ -42367,7 +42491,7 @@ var init_sqlite = __esm({
|
|
42367
42491
|
"src/cli/validations/sqlite.ts"() {
|
42368
42492
|
"use strict";
|
42369
42493
|
init_global();
|
42370
|
-
|
42494
|
+
init_esm();
|
42371
42495
|
init_views();
|
42372
42496
|
init_common();
|
42373
42497
|
sqliteCredentials = unionType([
|
@@ -42398,7 +42522,7 @@ var credentials, studioCliParams, studioConfig;
|
|
42398
42522
|
var init_studio = __esm({
|
42399
42523
|
"src/cli/validations/studio.ts"() {
|
42400
42524
|
"use strict";
|
42401
|
-
|
42525
|
+
init_esm();
|
42402
42526
|
init_schemaValidator();
|
42403
42527
|
init_mysql();
|
42404
42528
|
init_postgres();
|
@@ -42440,7 +42564,7 @@ var init_utils9 = __esm({
|
|
42440
42564
|
"src/cli/commands/utils.ts"() {
|
42441
42565
|
"use strict";
|
42442
42566
|
import_hanji7 = __toESM(require_hanji());
|
42443
|
-
|
42567
|
+
init_esm();
|
42444
42568
|
init_getTablesFilterByExtensions();
|
42445
42569
|
init_global();
|
42446
42570
|
init_schemaValidator();
|
@@ -42771,10 +42895,8 @@ var init_binary2 = __esm({
|
|
42771
42895
|
__publicField(this, "length", this.config.length);
|
42772
42896
|
}
|
42773
42897
|
mapFromDriverValue(value) {
|
42774
|
-
if (typeof value === "string")
|
42775
|
-
|
42776
|
-
if (Buffer.isBuffer(value))
|
42777
|
-
return value.toString();
|
42898
|
+
if (typeof value === "string") return value;
|
42899
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
42778
42900
|
const str = [];
|
42779
42901
|
for (const v of value) {
|
42780
42902
|
str.push(v === 49 ? "1" : "0");
|
@@ -43101,8 +43223,7 @@ var init_decimal2 = __esm({
|
|
43101
43223
|
__publicField(this, "unsigned", this.config.unsigned);
|
43102
43224
|
}
|
43103
43225
|
mapFromDriverValue(value) {
|
43104
|
-
if (typeof value === "string")
|
43105
|
-
return value;
|
43226
|
+
if (typeof value === "string") return value;
|
43106
43227
|
return String(value);
|
43107
43228
|
}
|
43108
43229
|
getSQLType() {
|
@@ -43144,8 +43265,7 @@ var init_decimal2 = __esm({
|
|
43144
43265
|
__publicField(this, "mapToDriverValue", String);
|
43145
43266
|
}
|
43146
43267
|
mapFromDriverValue(value) {
|
43147
|
-
if (typeof value === "number")
|
43148
|
-
return value;
|
43268
|
+
if (typeof value === "number") return value;
|
43149
43269
|
return Number(value);
|
43150
43270
|
}
|
43151
43271
|
getSQLType() {
|
@@ -43854,10 +43974,8 @@ var init_varbinary2 = __esm({
|
|
43854
43974
|
__publicField(this, "length", this.config.length);
|
43855
43975
|
}
|
43856
43976
|
mapFromDriverValue(value) {
|
43857
|
-
if (typeof value === "string")
|
43858
|
-
|
43859
|
-
if (Buffer.isBuffer(value))
|
43860
|
-
return value.toString();
|
43977
|
+
if (typeof value === "string") return value;
|
43978
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
43861
43979
|
const str = [];
|
43862
43980
|
for (const v of value) {
|
43863
43981
|
str.push(v === 49 ? "1" : "0");
|
@@ -44596,7 +44714,7 @@ var init_dialect4 = __esm({
|
|
44596
44714
|
init_casing();
|
44597
44715
|
init_column();
|
44598
44716
|
init_entity();
|
44599
|
-
|
44717
|
+
init_errors2();
|
44600
44718
|
init_relations();
|
44601
44719
|
init_expressions();
|
44602
44720
|
init_sql();
|
@@ -44650,8 +44768,7 @@ var init_dialect4 = __esm({
|
|
44650
44768
|
return `'${str.replace(/'/g, "''")}'`;
|
44651
44769
|
}
|
44652
44770
|
buildWithCTE(queries) {
|
44653
|
-
if (!queries?.length)
|
44654
|
-
return void 0;
|
44771
|
+
if (!queries?.length) return void 0;
|
44655
44772
|
const withSqlChunks = [sql`with `];
|
44656
44773
|
for (const [i, w] of queries.entries()) {
|
44657
44774
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -45585,8 +45702,7 @@ var init_select5 = __esm({
|
|
45585
45702
|
};
|
45586
45703
|
this.tableName = getTableLikeName(table6);
|
45587
45704
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
45588
|
-
for (const item of extractUsedTable4(table6))
|
45589
|
-
this.usedTables.add(item);
|
45705
|
+
for (const item of extractUsedTable4(table6)) this.usedTables.add(item);
|
45590
45706
|
}
|
45591
45707
|
/** @internal */
|
45592
45708
|
getUsedTables() {
|
@@ -45596,8 +45712,7 @@ var init_select5 = __esm({
|
|
45596
45712
|
return (table6, on) => {
|
45597
45713
|
const baseTableName = this.tableName;
|
45598
45714
|
const tableName = getTableLikeName(table6);
|
45599
|
-
for (const item of extractUsedTable4(table6))
|
45600
|
-
this.usedTables.add(item);
|
45715
|
+
for (const item of extractUsedTable4(table6)) this.usedTables.add(item);
|
45601
45716
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
45602
45717
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
45603
45718
|
}
|
@@ -45856,8 +45971,7 @@ var init_select5 = __esm({
|
|
45856
45971
|
const usedTables = [];
|
45857
45972
|
usedTables.push(...extractUsedTable4(this.config.table));
|
45858
45973
|
if (this.config.joins) {
|
45859
|
-
for (const it of this.config.joins)
|
45860
|
-
usedTables.push(...extractUsedTable4(it.table));
|
45974
|
+
for (const it of this.config.joins) usedTables.push(...extractUsedTable4(it.table));
|
45861
45975
|
}
|
45862
45976
|
return new Proxy(
|
45863
45977
|
new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
|
@@ -46415,9 +46529,9 @@ var init_session4 = __esm({
|
|
46415
46529
|
"use strict";
|
46416
46530
|
init_cache();
|
46417
46531
|
init_entity();
|
46418
|
-
|
46532
|
+
init_errors2();
|
46533
|
+
init_errors3();
|
46419
46534
|
init_sql();
|
46420
|
-
init_utils2();
|
46421
46535
|
init_db4();
|
46422
46536
|
_a434 = entityKind;
|
46423
46537
|
SingleStorePreparedQuery = class {
|
@@ -46437,20 +46551,36 @@ var init_session4 = __esm({
|
|
46437
46551
|
/** @internal */
|
46438
46552
|
async queryWithCache(queryString, params, query) {
|
46439
46553
|
if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
|
46440
|
-
|
46554
|
+
try {
|
46555
|
+
return await query();
|
46556
|
+
} catch (e) {
|
46557
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46558
|
+
}
|
46441
46559
|
}
|
46442
46560
|
if (this.cacheConfig && !this.cacheConfig.enable) {
|
46443
|
-
|
46561
|
+
try {
|
46562
|
+
return await query();
|
46563
|
+
} catch (e) {
|
46564
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46565
|
+
}
|
46444
46566
|
}
|
46445
46567
|
if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
|
46446
|
-
|
46447
|
-
|
46448
|
-
|
46449
|
-
|
46450
|
-
|
46568
|
+
try {
|
46569
|
+
const [res] = await Promise.all([
|
46570
|
+
query(),
|
46571
|
+
this.cache.onMutate({ tables: this.queryMetadata.tables })
|
46572
|
+
]);
|
46573
|
+
return res;
|
46574
|
+
} catch (e) {
|
46575
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46576
|
+
}
|
46451
46577
|
}
|
46452
46578
|
if (!this.cacheConfig) {
|
46453
|
-
|
46579
|
+
try {
|
46580
|
+
return await query();
|
46581
|
+
} catch (e) {
|
46582
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46583
|
+
}
|
46454
46584
|
}
|
46455
46585
|
if (this.queryMetadata.type === "select") {
|
46456
46586
|
const fromCache = await this.cache.get(
|
@@ -46460,7 +46590,12 @@ var init_session4 = __esm({
|
|
46460
46590
|
this.cacheConfig.autoInvalidate
|
46461
46591
|
);
|
46462
46592
|
if (fromCache === void 0) {
|
46463
|
-
|
46593
|
+
let result;
|
46594
|
+
try {
|
46595
|
+
result = await query();
|
46596
|
+
} catch (e) {
|
46597
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46598
|
+
}
|
46464
46599
|
await this.cache.put(
|
46465
46600
|
this.cacheConfig.tag ?? await hashQuery(queryString, params),
|
46466
46601
|
result,
|
@@ -46473,7 +46608,11 @@ var init_session4 = __esm({
|
|
46473
46608
|
}
|
46474
46609
|
return fromCache;
|
46475
46610
|
}
|
46476
|
-
|
46611
|
+
try {
|
46612
|
+
return await query();
|
46613
|
+
} catch (e) {
|
46614
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46615
|
+
}
|
46477
46616
|
}
|
46478
46617
|
};
|
46479
46618
|
__publicField(SingleStorePreparedQuery, _a434, "SingleStorePreparedQuery");
|