drizzle-kit 0.31.1-5fb460b → 0.31.1-8bf5193
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 +4715 -3744
- package/package.json +10 -11
- package/utils.js +90 -106
- package/utils.mjs +90 -106
package/api.js
CHANGED
@@ -3438,206 +3438,14 @@ var init_global = __esm({
|
|
3438
3438
|
}
|
3439
3439
|
});
|
3440
3440
|
|
3441
|
-
// ../node_modules/.pnpm/zod@3.
|
3442
|
-
|
3443
|
-
|
3444
|
-
|
3445
|
-
function addIssueToContext(ctx, issueData) {
|
3446
|
-
const overrideMap = getErrorMap();
|
3447
|
-
const issue = makeIssue({
|
3448
|
-
issueData,
|
3449
|
-
data: ctx.data,
|
3450
|
-
path: ctx.path,
|
3451
|
-
errorMaps: [
|
3452
|
-
ctx.common.contextualErrorMap,
|
3453
|
-
// contextual error map is first priority
|
3454
|
-
ctx.schemaErrorMap,
|
3455
|
-
// then schema-bound map if available
|
3456
|
-
overrideMap,
|
3457
|
-
// then global override map
|
3458
|
-
overrideMap === errorMap ? void 0 : errorMap
|
3459
|
-
// then global default map
|
3460
|
-
].filter((x) => !!x)
|
3461
|
-
});
|
3462
|
-
ctx.common.issues.push(issue);
|
3463
|
-
}
|
3464
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
3465
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
3466
|
-
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");
|
3467
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
3468
|
-
}
|
3469
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
3470
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
3471
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
3472
|
-
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");
|
3473
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
3474
|
-
}
|
3475
|
-
function processCreateParams(params) {
|
3476
|
-
if (!params)
|
3477
|
-
return {};
|
3478
|
-
const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
|
3479
|
-
if (errorMap2 && (invalid_type_error || required_error)) {
|
3480
|
-
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
3481
|
-
}
|
3482
|
-
if (errorMap2)
|
3483
|
-
return { errorMap: errorMap2, description };
|
3484
|
-
const customMap = (iss, ctx) => {
|
3485
|
-
var _a437, _b326;
|
3486
|
-
const { message } = params;
|
3487
|
-
if (iss.code === "invalid_enum_value") {
|
3488
|
-
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
3489
|
-
}
|
3490
|
-
if (typeof ctx.data === "undefined") {
|
3491
|
-
return { message: (_a437 = message !== null && message !== void 0 ? message : required_error) !== null && _a437 !== void 0 ? _a437 : ctx.defaultError };
|
3492
|
-
}
|
3493
|
-
if (iss.code !== "invalid_type")
|
3494
|
-
return { message: ctx.defaultError };
|
3495
|
-
return { message: (_b326 = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b326 !== void 0 ? _b326 : ctx.defaultError };
|
3496
|
-
};
|
3497
|
-
return { errorMap: customMap, description };
|
3498
|
-
}
|
3499
|
-
function timeRegexSource(args) {
|
3500
|
-
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
3501
|
-
if (args.precision) {
|
3502
|
-
regex = `${regex}\\.\\d{${args.precision}}`;
|
3503
|
-
} else if (args.precision == null) {
|
3504
|
-
regex = `${regex}(\\.\\d+)?`;
|
3505
|
-
}
|
3506
|
-
return regex;
|
3507
|
-
}
|
3508
|
-
function timeRegex(args) {
|
3509
|
-
return new RegExp(`^${timeRegexSource(args)}$`);
|
3510
|
-
}
|
3511
|
-
function datetimeRegex(args) {
|
3512
|
-
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
3513
|
-
const opts = [];
|
3514
|
-
opts.push(args.local ? `Z?` : `Z`);
|
3515
|
-
if (args.offset)
|
3516
|
-
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
3517
|
-
regex = `${regex}(${opts.join("|")})`;
|
3518
|
-
return new RegExp(`^${regex}$`);
|
3519
|
-
}
|
3520
|
-
function isValidIP(ip, version2) {
|
3521
|
-
if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
|
3522
|
-
return true;
|
3523
|
-
}
|
3524
|
-
if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) {
|
3525
|
-
return true;
|
3526
|
-
}
|
3527
|
-
return false;
|
3528
|
-
}
|
3529
|
-
function isValidJWT(jwt, alg) {
|
3530
|
-
if (!jwtRegex.test(jwt))
|
3531
|
-
return false;
|
3532
|
-
try {
|
3533
|
-
const [header] = jwt.split(".");
|
3534
|
-
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
3535
|
-
const decoded = JSON.parse(atob(base64));
|
3536
|
-
if (typeof decoded !== "object" || decoded === null)
|
3537
|
-
return false;
|
3538
|
-
if (!decoded.typ || !decoded.alg)
|
3539
|
-
return false;
|
3540
|
-
if (alg && decoded.alg !== alg)
|
3541
|
-
return false;
|
3542
|
-
return true;
|
3543
|
-
} catch (_a437) {
|
3544
|
-
return false;
|
3545
|
-
}
|
3546
|
-
}
|
3547
|
-
function isValidCidr(ip, version2) {
|
3548
|
-
if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) {
|
3549
|
-
return true;
|
3550
|
-
}
|
3551
|
-
if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) {
|
3552
|
-
return true;
|
3553
|
-
}
|
3554
|
-
return false;
|
3555
|
-
}
|
3556
|
-
function floatSafeRemainder(val, step) {
|
3557
|
-
const valDecCount = (val.toString().split(".")[1] || "").length;
|
3558
|
-
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
3559
|
-
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
3560
|
-
const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
|
3561
|
-
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
3562
|
-
return valInt % stepInt / Math.pow(10, decCount);
|
3563
|
-
}
|
3564
|
-
function deepPartialify(schema5) {
|
3565
|
-
if (schema5 instanceof ZodObject) {
|
3566
|
-
const newShape = {};
|
3567
|
-
for (const key in schema5.shape) {
|
3568
|
-
const fieldSchema = schema5.shape[key];
|
3569
|
-
newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
|
3570
|
-
}
|
3571
|
-
return new ZodObject({
|
3572
|
-
...schema5._def,
|
3573
|
-
shape: () => newShape
|
3574
|
-
});
|
3575
|
-
} else if (schema5 instanceof ZodArray) {
|
3576
|
-
return new ZodArray({
|
3577
|
-
...schema5._def,
|
3578
|
-
type: deepPartialify(schema5.element)
|
3579
|
-
});
|
3580
|
-
} else if (schema5 instanceof ZodOptional) {
|
3581
|
-
return ZodOptional.create(deepPartialify(schema5.unwrap()));
|
3582
|
-
} else if (schema5 instanceof ZodNullable) {
|
3583
|
-
return ZodNullable.create(deepPartialify(schema5.unwrap()));
|
3584
|
-
} else if (schema5 instanceof ZodTuple) {
|
3585
|
-
return ZodTuple.create(schema5.items.map((item) => deepPartialify(item)));
|
3586
|
-
} else {
|
3587
|
-
return schema5;
|
3588
|
-
}
|
3589
|
-
}
|
3590
|
-
function mergeValues(a, b) {
|
3591
|
-
const aType = getParsedType(a);
|
3592
|
-
const bType = getParsedType(b);
|
3593
|
-
if (a === b) {
|
3594
|
-
return { valid: true, data: a };
|
3595
|
-
} else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
3596
|
-
const bKeys = util.objectKeys(b);
|
3597
|
-
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
3598
|
-
const newObj = { ...a, ...b };
|
3599
|
-
for (const key of sharedKeys) {
|
3600
|
-
const sharedValue = mergeValues(a[key], b[key]);
|
3601
|
-
if (!sharedValue.valid) {
|
3602
|
-
return { valid: false };
|
3603
|
-
}
|
3604
|
-
newObj[key] = sharedValue.data;
|
3605
|
-
}
|
3606
|
-
return { valid: true, data: newObj };
|
3607
|
-
} else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
|
3608
|
-
if (a.length !== b.length) {
|
3609
|
-
return { valid: false };
|
3610
|
-
}
|
3611
|
-
const newArray = [];
|
3612
|
-
for (let index6 = 0; index6 < a.length; index6++) {
|
3613
|
-
const itemA = a[index6];
|
3614
|
-
const itemB = b[index6];
|
3615
|
-
const sharedValue = mergeValues(itemA, itemB);
|
3616
|
-
if (!sharedValue.valid) {
|
3617
|
-
return { valid: false };
|
3618
|
-
}
|
3619
|
-
newArray.push(sharedValue.data);
|
3620
|
-
}
|
3621
|
-
return { valid: true, data: newArray };
|
3622
|
-
} else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
|
3623
|
-
return { valid: true, data: a };
|
3624
|
-
} else {
|
3625
|
-
return { valid: false };
|
3626
|
-
}
|
3627
|
-
}
|
3628
|
-
function createZodEnum(values, params) {
|
3629
|
-
return new ZodEnum({
|
3630
|
-
values,
|
3631
|
-
typeName: ZodFirstPartyTypeKind.ZodEnum,
|
3632
|
-
...processCreateParams(params)
|
3633
|
-
});
|
3634
|
-
}
|
3635
|
-
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;
|
3636
|
-
var init_lib = __esm({
|
3637
|
-
"../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs"() {
|
3441
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/util.js
|
3442
|
+
var util, objectUtil, ZodParsedType, getParsedType;
|
3443
|
+
var init_util = __esm({
|
3444
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/util.js"() {
|
3638
3445
|
"use strict";
|
3639
3446
|
(function(util2) {
|
3640
|
-
util2.assertEqual = (
|
3447
|
+
util2.assertEqual = (_2) => {
|
3448
|
+
};
|
3641
3449
|
function assertIs(_arg) {
|
3642
3450
|
}
|
3643
3451
|
util2.assertIs = assertIs;
|
@@ -3681,7 +3489,7 @@ var init_lib = __esm({
|
|
3681
3489
|
}
|
3682
3490
|
return void 0;
|
3683
3491
|
};
|
3684
|
-
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
|
3492
|
+
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
3685
3493
|
function joinValues(array2, separator = " | ") {
|
3686
3494
|
return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
3687
3495
|
}
|
@@ -3732,7 +3540,7 @@ var init_lib = __esm({
|
|
3732
3540
|
case "string":
|
3733
3541
|
return ZodParsedType.string;
|
3734
3542
|
case "number":
|
3735
|
-
return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
3543
|
+
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
3736
3544
|
case "boolean":
|
3737
3545
|
return ZodParsedType.boolean;
|
3738
3546
|
case "function":
|
@@ -3765,6 +3573,15 @@ var init_lib = __esm({
|
|
3765
3573
|
return ZodParsedType.unknown;
|
3766
3574
|
}
|
3767
3575
|
};
|
3576
|
+
}
|
3577
|
+
});
|
3578
|
+
|
3579
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/ZodError.js
|
3580
|
+
var ZodIssueCode, ZodError;
|
3581
|
+
var init_ZodError = __esm({
|
3582
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/ZodError.js"() {
|
3583
|
+
"use strict";
|
3584
|
+
init_util();
|
3768
3585
|
ZodIssueCode = util.arrayToEnum([
|
3769
3586
|
"invalid_type",
|
3770
3587
|
"invalid_literal",
|
@@ -3876,6 +3693,16 @@ var init_lib = __esm({
|
|
3876
3693
|
const error2 = new ZodError(issues);
|
3877
3694
|
return error2;
|
3878
3695
|
};
|
3696
|
+
}
|
3697
|
+
});
|
3698
|
+
|
3699
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/locales/en.js
|
3700
|
+
var errorMap, en_default;
|
3701
|
+
var init_en = __esm({
|
3702
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/locales/en.js"() {
|
3703
|
+
"use strict";
|
3704
|
+
init_ZodError();
|
3705
|
+
init_util();
|
3879
3706
|
errorMap = (issue, _ctx) => {
|
3880
3707
|
let message;
|
3881
3708
|
switch (issue.code) {
|
@@ -3974,7 +3801,49 @@ var init_lib = __esm({
|
|
3974
3801
|
}
|
3975
3802
|
return { message };
|
3976
3803
|
};
|
3977
|
-
|
3804
|
+
en_default = errorMap;
|
3805
|
+
}
|
3806
|
+
});
|
3807
|
+
|
3808
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/errors.js
|
3809
|
+
function getErrorMap() {
|
3810
|
+
return overrideErrorMap;
|
3811
|
+
}
|
3812
|
+
var overrideErrorMap;
|
3813
|
+
var init_errors = __esm({
|
3814
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/errors.js"() {
|
3815
|
+
"use strict";
|
3816
|
+
init_en();
|
3817
|
+
overrideErrorMap = en_default;
|
3818
|
+
}
|
3819
|
+
});
|
3820
|
+
|
3821
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/parseUtil.js
|
3822
|
+
function addIssueToContext(ctx, issueData) {
|
3823
|
+
const overrideMap = getErrorMap();
|
3824
|
+
const issue = makeIssue({
|
3825
|
+
issueData,
|
3826
|
+
data: ctx.data,
|
3827
|
+
path: ctx.path,
|
3828
|
+
errorMaps: [
|
3829
|
+
ctx.common.contextualErrorMap,
|
3830
|
+
// contextual error map is first priority
|
3831
|
+
ctx.schemaErrorMap,
|
3832
|
+
// then schema-bound map if available
|
3833
|
+
overrideMap,
|
3834
|
+
// then global override map
|
3835
|
+
overrideMap === en_default ? void 0 : en_default
|
3836
|
+
// then global default map
|
3837
|
+
].filter((x) => !!x)
|
3838
|
+
});
|
3839
|
+
ctx.common.issues.push(issue);
|
3840
|
+
}
|
3841
|
+
var makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync;
|
3842
|
+
var init_parseUtil = __esm({
|
3843
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/parseUtil.js"() {
|
3844
|
+
"use strict";
|
3845
|
+
init_errors();
|
3846
|
+
init_en();
|
3978
3847
|
makeIssue = (params) => {
|
3979
3848
|
const { data, path: path2, errorMaps, issueData } = params;
|
3980
3849
|
const fullPath = [...path2, ...issueData.path || []];
|
@@ -4063,10 +3932,200 @@ var init_lib = __esm({
|
|
4063
3932
|
isDirty = (x) => x.status === "dirty";
|
4064
3933
|
isValid = (x) => x.status === "valid";
|
4065
3934
|
isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
3935
|
+
}
|
3936
|
+
});
|
3937
|
+
|
3938
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/typeAliases.js
|
3939
|
+
var init_typeAliases = __esm({
|
3940
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/typeAliases.js"() {
|
3941
|
+
"use strict";
|
3942
|
+
}
|
3943
|
+
});
|
3944
|
+
|
3945
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/errorUtil.js
|
3946
|
+
var errorUtil;
|
3947
|
+
var init_errorUtil = __esm({
|
3948
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/errorUtil.js"() {
|
3949
|
+
"use strict";
|
4066
3950
|
(function(errorUtil2) {
|
4067
3951
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
4068
|
-
errorUtil2.toString = (message) => typeof message === "string" ? message : message
|
3952
|
+
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
4069
3953
|
})(errorUtil || (errorUtil = {}));
|
3954
|
+
}
|
3955
|
+
});
|
3956
|
+
|
3957
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/types.js
|
3958
|
+
function processCreateParams(params) {
|
3959
|
+
if (!params)
|
3960
|
+
return {};
|
3961
|
+
const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
|
3962
|
+
if (errorMap2 && (invalid_type_error || required_error)) {
|
3963
|
+
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
3964
|
+
}
|
3965
|
+
if (errorMap2)
|
3966
|
+
return { errorMap: errorMap2, description };
|
3967
|
+
const customMap = (iss, ctx) => {
|
3968
|
+
const { message } = params;
|
3969
|
+
if (iss.code === "invalid_enum_value") {
|
3970
|
+
return { message: message ?? ctx.defaultError };
|
3971
|
+
}
|
3972
|
+
if (typeof ctx.data === "undefined") {
|
3973
|
+
return { message: message ?? required_error ?? ctx.defaultError };
|
3974
|
+
}
|
3975
|
+
if (iss.code !== "invalid_type")
|
3976
|
+
return { message: ctx.defaultError };
|
3977
|
+
return { message: message ?? invalid_type_error ?? ctx.defaultError };
|
3978
|
+
};
|
3979
|
+
return { errorMap: customMap, description };
|
3980
|
+
}
|
3981
|
+
function timeRegexSource(args) {
|
3982
|
+
let secondsRegexSource = `[0-5]\\d`;
|
3983
|
+
if (args.precision) {
|
3984
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
3985
|
+
} else if (args.precision == null) {
|
3986
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
3987
|
+
}
|
3988
|
+
const secondsQuantifier = args.precision ? "+" : "?";
|
3989
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
3990
|
+
}
|
3991
|
+
function timeRegex(args) {
|
3992
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
3993
|
+
}
|
3994
|
+
function datetimeRegex(args) {
|
3995
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
3996
|
+
const opts = [];
|
3997
|
+
opts.push(args.local ? `Z?` : `Z`);
|
3998
|
+
if (args.offset)
|
3999
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
4000
|
+
regex = `${regex}(${opts.join("|")})`;
|
4001
|
+
return new RegExp(`^${regex}$`);
|
4002
|
+
}
|
4003
|
+
function isValidIP(ip, version2) {
|
4004
|
+
if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
|
4005
|
+
return true;
|
4006
|
+
}
|
4007
|
+
if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) {
|
4008
|
+
return true;
|
4009
|
+
}
|
4010
|
+
return false;
|
4011
|
+
}
|
4012
|
+
function isValidJWT(jwt, alg) {
|
4013
|
+
if (!jwtRegex.test(jwt))
|
4014
|
+
return false;
|
4015
|
+
try {
|
4016
|
+
const [header] = jwt.split(".");
|
4017
|
+
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
4018
|
+
const decoded = JSON.parse(atob(base64));
|
4019
|
+
if (typeof decoded !== "object" || decoded === null)
|
4020
|
+
return false;
|
4021
|
+
if ("typ" in decoded && decoded?.typ !== "JWT")
|
4022
|
+
return false;
|
4023
|
+
if (!decoded.alg)
|
4024
|
+
return false;
|
4025
|
+
if (alg && decoded.alg !== alg)
|
4026
|
+
return false;
|
4027
|
+
return true;
|
4028
|
+
} catch {
|
4029
|
+
return false;
|
4030
|
+
}
|
4031
|
+
}
|
4032
|
+
function isValidCidr(ip, version2) {
|
4033
|
+
if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) {
|
4034
|
+
return true;
|
4035
|
+
}
|
4036
|
+
if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) {
|
4037
|
+
return true;
|
4038
|
+
}
|
4039
|
+
return false;
|
4040
|
+
}
|
4041
|
+
function floatSafeRemainder(val, step) {
|
4042
|
+
const valDecCount = (val.toString().split(".")[1] || "").length;
|
4043
|
+
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
4044
|
+
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
4045
|
+
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
4046
|
+
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
4047
|
+
return valInt % stepInt / 10 ** decCount;
|
4048
|
+
}
|
4049
|
+
function deepPartialify(schema5) {
|
4050
|
+
if (schema5 instanceof ZodObject) {
|
4051
|
+
const newShape = {};
|
4052
|
+
for (const key in schema5.shape) {
|
4053
|
+
const fieldSchema = schema5.shape[key];
|
4054
|
+
newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
|
4055
|
+
}
|
4056
|
+
return new ZodObject({
|
4057
|
+
...schema5._def,
|
4058
|
+
shape: () => newShape
|
4059
|
+
});
|
4060
|
+
} else if (schema5 instanceof ZodArray) {
|
4061
|
+
return new ZodArray({
|
4062
|
+
...schema5._def,
|
4063
|
+
type: deepPartialify(schema5.element)
|
4064
|
+
});
|
4065
|
+
} else if (schema5 instanceof ZodOptional) {
|
4066
|
+
return ZodOptional.create(deepPartialify(schema5.unwrap()));
|
4067
|
+
} else if (schema5 instanceof ZodNullable) {
|
4068
|
+
return ZodNullable.create(deepPartialify(schema5.unwrap()));
|
4069
|
+
} else if (schema5 instanceof ZodTuple) {
|
4070
|
+
return ZodTuple.create(schema5.items.map((item) => deepPartialify(item)));
|
4071
|
+
} else {
|
4072
|
+
return schema5;
|
4073
|
+
}
|
4074
|
+
}
|
4075
|
+
function mergeValues(a, b) {
|
4076
|
+
const aType = getParsedType(a);
|
4077
|
+
const bType = getParsedType(b);
|
4078
|
+
if (a === b) {
|
4079
|
+
return { valid: true, data: a };
|
4080
|
+
} else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
4081
|
+
const bKeys = util.objectKeys(b);
|
4082
|
+
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
4083
|
+
const newObj = { ...a, ...b };
|
4084
|
+
for (const key of sharedKeys) {
|
4085
|
+
const sharedValue = mergeValues(a[key], b[key]);
|
4086
|
+
if (!sharedValue.valid) {
|
4087
|
+
return { valid: false };
|
4088
|
+
}
|
4089
|
+
newObj[key] = sharedValue.data;
|
4090
|
+
}
|
4091
|
+
return { valid: true, data: newObj };
|
4092
|
+
} else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
|
4093
|
+
if (a.length !== b.length) {
|
4094
|
+
return { valid: false };
|
4095
|
+
}
|
4096
|
+
const newArray = [];
|
4097
|
+
for (let index6 = 0; index6 < a.length; index6++) {
|
4098
|
+
const itemA = a[index6];
|
4099
|
+
const itemB = b[index6];
|
4100
|
+
const sharedValue = mergeValues(itemA, itemB);
|
4101
|
+
if (!sharedValue.valid) {
|
4102
|
+
return { valid: false };
|
4103
|
+
}
|
4104
|
+
newArray.push(sharedValue.data);
|
4105
|
+
}
|
4106
|
+
return { valid: true, data: newArray };
|
4107
|
+
} else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
|
4108
|
+
return { valid: true, data: a };
|
4109
|
+
} else {
|
4110
|
+
return { valid: false };
|
4111
|
+
}
|
4112
|
+
}
|
4113
|
+
function createZodEnum(values, params) {
|
4114
|
+
return new ZodEnum({
|
4115
|
+
values,
|
4116
|
+
typeName: ZodFirstPartyTypeKind.ZodEnum,
|
4117
|
+
...processCreateParams(params)
|
4118
|
+
});
|
4119
|
+
}
|
4120
|
+
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;
|
4121
|
+
var init_types = __esm({
|
4122
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/types.js"() {
|
4123
|
+
"use strict";
|
4124
|
+
init_ZodError();
|
4125
|
+
init_errors();
|
4126
|
+
init_errorUtil();
|
4127
|
+
init_parseUtil();
|
4128
|
+
init_util();
|
4070
4129
|
ParseInputLazyPath = class {
|
4071
4130
|
constructor(parent, value, path2, key) {
|
4072
4131
|
this._cachedPath = [];
|
@@ -4077,7 +4136,7 @@ var init_lib = __esm({
|
|
4077
4136
|
}
|
4078
4137
|
get path() {
|
4079
4138
|
if (!this._cachedPath.length) {
|
4080
|
-
if (this._key
|
4139
|
+
if (Array.isArray(this._key)) {
|
4081
4140
|
this._cachedPath.push(...this._path, ...this._key);
|
4082
4141
|
} else {
|
4083
4142
|
this._cachedPath.push(...this._path, this._key);
|
@@ -4153,14 +4212,13 @@ var init_lib = __esm({
|
|
4153
4212
|
throw result.error;
|
4154
4213
|
}
|
4155
4214
|
safeParse(data, params) {
|
4156
|
-
var _a437;
|
4157
4215
|
const ctx = {
|
4158
4216
|
common: {
|
4159
4217
|
issues: [],
|
4160
|
-
async:
|
4161
|
-
contextualErrorMap: params
|
4218
|
+
async: params?.async ?? false,
|
4219
|
+
contextualErrorMap: params?.errorMap
|
4162
4220
|
},
|
4163
|
-
path:
|
4221
|
+
path: params?.path || [],
|
4164
4222
|
schemaErrorMap: this._def.errorMap,
|
4165
4223
|
parent: null,
|
4166
4224
|
data,
|
@@ -4170,7 +4228,6 @@ var init_lib = __esm({
|
|
4170
4228
|
return handleResult(ctx, result);
|
4171
4229
|
}
|
4172
4230
|
"~validate"(data) {
|
4173
|
-
var _a437, _b326;
|
4174
4231
|
const ctx = {
|
4175
4232
|
common: {
|
4176
4233
|
issues: [],
|
@@ -4191,7 +4248,7 @@ var init_lib = __esm({
|
|
4191
4248
|
issues: ctx.common.issues
|
4192
4249
|
};
|
4193
4250
|
} catch (err) {
|
4194
|
-
if (
|
4251
|
+
if (err?.message?.toLowerCase()?.includes("encountered")) {
|
4195
4252
|
this["~standard"].async = true;
|
4196
4253
|
}
|
4197
4254
|
ctx.common = {
|
@@ -4216,10 +4273,10 @@ var init_lib = __esm({
|
|
4216
4273
|
const ctx = {
|
4217
4274
|
common: {
|
4218
4275
|
issues: [],
|
4219
|
-
contextualErrorMap: params
|
4276
|
+
contextualErrorMap: params?.errorMap,
|
4220
4277
|
async: true
|
4221
4278
|
},
|
4222
|
-
path:
|
4279
|
+
path: params?.path || [],
|
4223
4280
|
schemaErrorMap: this._def.errorMap,
|
4224
4281
|
parent: null,
|
4225
4282
|
data,
|
@@ -4553,7 +4610,7 @@ var init_lib = __esm({
|
|
4553
4610
|
} else if (check.kind === "url") {
|
4554
4611
|
try {
|
4555
4612
|
new URL(input.data);
|
4556
|
-
} catch
|
4613
|
+
} catch {
|
4557
4614
|
ctx = this._getOrReturnCtx(input, ctx);
|
4558
4615
|
addIssueToContext(ctx, {
|
4559
4616
|
validation: "url",
|
@@ -4765,7 +4822,6 @@ var init_lib = __esm({
|
|
4765
4822
|
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
4766
4823
|
}
|
4767
4824
|
datetime(options) {
|
4768
|
-
var _a437, _b326;
|
4769
4825
|
if (typeof options === "string") {
|
4770
4826
|
return this._addCheck({
|
4771
4827
|
kind: "datetime",
|
@@ -4777,10 +4833,10 @@ var init_lib = __esm({
|
|
4777
4833
|
}
|
4778
4834
|
return this._addCheck({
|
4779
4835
|
kind: "datetime",
|
4780
|
-
precision: typeof
|
4781
|
-
offset:
|
4782
|
-
local:
|
4783
|
-
...errorUtil.errToObj(options
|
4836
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
4837
|
+
offset: options?.offset ?? false,
|
4838
|
+
local: options?.local ?? false,
|
4839
|
+
...errorUtil.errToObj(options?.message)
|
4784
4840
|
});
|
4785
4841
|
}
|
4786
4842
|
date(message) {
|
@@ -4796,8 +4852,8 @@ var init_lib = __esm({
|
|
4796
4852
|
}
|
4797
4853
|
return this._addCheck({
|
4798
4854
|
kind: "time",
|
4799
|
-
precision: typeof
|
4800
|
-
...errorUtil.errToObj(options
|
4855
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
4856
|
+
...errorUtil.errToObj(options?.message)
|
4801
4857
|
});
|
4802
4858
|
}
|
4803
4859
|
duration(message) {
|
@@ -4814,8 +4870,8 @@ var init_lib = __esm({
|
|
4814
4870
|
return this._addCheck({
|
4815
4871
|
kind: "includes",
|
4816
4872
|
value,
|
4817
|
-
position: options
|
4818
|
-
...errorUtil.errToObj(options
|
4873
|
+
position: options?.position,
|
4874
|
+
...errorUtil.errToObj(options?.message)
|
4819
4875
|
});
|
4820
4876
|
}
|
4821
4877
|
startsWith(value, message) {
|
@@ -4947,11 +5003,10 @@ var init_lib = __esm({
|
|
4947
5003
|
}
|
4948
5004
|
};
|
4949
5005
|
ZodString.create = (params) => {
|
4950
|
-
var _a437;
|
4951
5006
|
return new ZodString({
|
4952
5007
|
checks: [],
|
4953
5008
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
4954
|
-
coerce:
|
5009
|
+
coerce: params?.coerce ?? false,
|
4955
5010
|
...processCreateParams(params)
|
4956
5011
|
});
|
4957
5012
|
};
|
@@ -5163,7 +5218,8 @@ var init_lib = __esm({
|
|
5163
5218
|
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
5164
5219
|
}
|
5165
5220
|
get isFinite() {
|
5166
|
-
let max2 = null
|
5221
|
+
let max2 = null;
|
5222
|
+
let min2 = null;
|
5167
5223
|
for (const ch of this._def.checks) {
|
5168
5224
|
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
5169
5225
|
return true;
|
@@ -5182,7 +5238,7 @@ var init_lib = __esm({
|
|
5182
5238
|
return new ZodNumber({
|
5183
5239
|
checks: [],
|
5184
5240
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
5185
|
-
coerce:
|
5241
|
+
coerce: params?.coerce || false,
|
5186
5242
|
...processCreateParams(params)
|
5187
5243
|
});
|
5188
5244
|
};
|
@@ -5196,7 +5252,7 @@ var init_lib = __esm({
|
|
5196
5252
|
if (this._def.coerce) {
|
5197
5253
|
try {
|
5198
5254
|
input.data = BigInt(input.data);
|
5199
|
-
} catch
|
5255
|
+
} catch {
|
5200
5256
|
return this._getInvalidInput(input);
|
5201
5257
|
}
|
5202
5258
|
}
|
@@ -5351,11 +5407,10 @@ var init_lib = __esm({
|
|
5351
5407
|
}
|
5352
5408
|
};
|
5353
5409
|
ZodBigInt.create = (params) => {
|
5354
|
-
var _a437;
|
5355
5410
|
return new ZodBigInt({
|
5356
5411
|
checks: [],
|
5357
5412
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
5358
|
-
coerce:
|
5413
|
+
coerce: params?.coerce ?? false,
|
5359
5414
|
...processCreateParams(params)
|
5360
5415
|
});
|
5361
5416
|
};
|
@@ -5380,7 +5435,7 @@ var init_lib = __esm({
|
|
5380
5435
|
ZodBoolean.create = (params) => {
|
5381
5436
|
return new ZodBoolean({
|
5382
5437
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
5383
|
-
coerce:
|
5438
|
+
coerce: params?.coerce || false,
|
5384
5439
|
...processCreateParams(params)
|
5385
5440
|
});
|
5386
5441
|
};
|
@@ -5399,7 +5454,7 @@ var init_lib = __esm({
|
|
5399
5454
|
});
|
5400
5455
|
return INVALID;
|
5401
5456
|
}
|
5402
|
-
if (isNaN(input.data.getTime())) {
|
5457
|
+
if (Number.isNaN(input.data.getTime())) {
|
5403
5458
|
const ctx2 = this._getOrReturnCtx(input);
|
5404
5459
|
addIssueToContext(ctx2, {
|
5405
5460
|
code: ZodIssueCode.invalid_date
|
@@ -5488,7 +5543,7 @@ var init_lib = __esm({
|
|
5488
5543
|
ZodDate.create = (params) => {
|
5489
5544
|
return new ZodDate({
|
5490
5545
|
checks: [],
|
5491
|
-
coerce:
|
5546
|
+
coerce: params?.coerce || false,
|
5492
5547
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
5493
5548
|
...processCreateParams(params)
|
5494
5549
|
});
|
@@ -5737,7 +5792,8 @@ var init_lib = __esm({
|
|
5737
5792
|
return this._cached;
|
5738
5793
|
const shape = this._def.shape();
|
5739
5794
|
const keys = util.objectKeys(shape);
|
5740
|
-
|
5795
|
+
this._cached = { shape, keys };
|
5796
|
+
return this._cached;
|
5741
5797
|
}
|
5742
5798
|
_parse(input) {
|
5743
5799
|
const parsedType = this._getType(input);
|
@@ -5787,8 +5843,8 @@ var init_lib = __esm({
|
|
5787
5843
|
});
|
5788
5844
|
status.dirty();
|
5789
5845
|
}
|
5790
|
-
} else if (unknownKeys === "strip")
|
5791
|
-
else {
|
5846
|
+
} else if (unknownKeys === "strip") {
|
5847
|
+
} else {
|
5792
5848
|
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
|
5793
5849
|
}
|
5794
5850
|
} else {
|
@@ -5835,11 +5891,10 @@ var init_lib = __esm({
|
|
5835
5891
|
unknownKeys: "strict",
|
5836
5892
|
...message !== void 0 ? {
|
5837
5893
|
errorMap: (issue, ctx) => {
|
5838
|
-
|
5839
|
-
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;
|
5894
|
+
const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
|
5840
5895
|
if (issue.code === "unrecognized_keys")
|
5841
5896
|
return {
|
5842
|
-
message:
|
5897
|
+
message: errorUtil.errToObj(message).message ?? defaultError
|
5843
5898
|
};
|
5844
5899
|
return {
|
5845
5900
|
message: defaultError
|
@@ -5970,11 +6025,11 @@ var init_lib = __esm({
|
|
5970
6025
|
}
|
5971
6026
|
pick(mask) {
|
5972
6027
|
const shape = {};
|
5973
|
-
util.objectKeys(mask)
|
6028
|
+
for (const key of util.objectKeys(mask)) {
|
5974
6029
|
if (mask[key] && this.shape[key]) {
|
5975
6030
|
shape[key] = this.shape[key];
|
5976
6031
|
}
|
5977
|
-
}
|
6032
|
+
}
|
5978
6033
|
return new _ZodObject({
|
5979
6034
|
...this._def,
|
5980
6035
|
shape: () => shape
|
@@ -5982,11 +6037,11 @@ var init_lib = __esm({
|
|
5982
6037
|
}
|
5983
6038
|
omit(mask) {
|
5984
6039
|
const shape = {};
|
5985
|
-
util.objectKeys(this.shape)
|
6040
|
+
for (const key of util.objectKeys(this.shape)) {
|
5986
6041
|
if (!mask[key]) {
|
5987
6042
|
shape[key] = this.shape[key];
|
5988
6043
|
}
|
5989
|
-
}
|
6044
|
+
}
|
5990
6045
|
return new _ZodObject({
|
5991
6046
|
...this._def,
|
5992
6047
|
shape: () => shape
|
@@ -6000,14 +6055,14 @@ var init_lib = __esm({
|
|
6000
6055
|
}
|
6001
6056
|
partial(mask) {
|
6002
6057
|
const newShape = {};
|
6003
|
-
util.objectKeys(this.shape)
|
6058
|
+
for (const key of util.objectKeys(this.shape)) {
|
6004
6059
|
const fieldSchema = this.shape[key];
|
6005
6060
|
if (mask && !mask[key]) {
|
6006
6061
|
newShape[key] = fieldSchema;
|
6007
6062
|
} else {
|
6008
6063
|
newShape[key] = fieldSchema.optional();
|
6009
6064
|
}
|
6010
|
-
}
|
6065
|
+
}
|
6011
6066
|
return new _ZodObject({
|
6012
6067
|
...this._def,
|
6013
6068
|
shape: () => newShape
|
@@ -6015,7 +6070,7 @@ var init_lib = __esm({
|
|
6015
6070
|
}
|
6016
6071
|
required(mask) {
|
6017
6072
|
const newShape = {};
|
6018
|
-
util.objectKeys(this.shape)
|
6073
|
+
for (const key of util.objectKeys(this.shape)) {
|
6019
6074
|
if (mask && !mask[key]) {
|
6020
6075
|
newShape[key] = this.shape[key];
|
6021
6076
|
} else {
|
@@ -6026,7 +6081,7 @@ var init_lib = __esm({
|
|
6026
6081
|
}
|
6027
6082
|
newShape[key] = newField;
|
6028
6083
|
}
|
6029
|
-
}
|
6084
|
+
}
|
6030
6085
|
return new _ZodObject({
|
6031
6086
|
...this._def,
|
6032
6087
|
shape: () => newShape
|
@@ -6604,12 +6659,7 @@ var init_lib = __esm({
|
|
6604
6659
|
return makeIssue({
|
6605
6660
|
data: args,
|
6606
6661
|
path: ctx.path,
|
6607
|
-
errorMaps: [
|
6608
|
-
ctx.common.contextualErrorMap,
|
6609
|
-
ctx.schemaErrorMap,
|
6610
|
-
getErrorMap(),
|
6611
|
-
errorMap
|
6612
|
-
].filter((x) => !!x),
|
6662
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
6613
6663
|
issueData: {
|
6614
6664
|
code: ZodIssueCode.invalid_arguments,
|
6615
6665
|
argumentsError: error2
|
@@ -6620,12 +6670,7 @@ var init_lib = __esm({
|
|
6620
6670
|
return makeIssue({
|
6621
6671
|
data: returns,
|
6622
6672
|
path: ctx.path,
|
6623
|
-
errorMaps: [
|
6624
|
-
ctx.common.contextualErrorMap,
|
6625
|
-
ctx.schemaErrorMap,
|
6626
|
-
getErrorMap(),
|
6627
|
-
errorMap
|
6628
|
-
].filter((x) => !!x),
|
6673
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
6629
6674
|
issueData: {
|
6630
6675
|
code: ZodIssueCode.invalid_return_type,
|
6631
6676
|
returnTypeError: error2
|
@@ -6742,10 +6787,6 @@ var init_lib = __esm({
|
|
6742
6787
|
});
|
6743
6788
|
};
|
6744
6789
|
ZodEnum = class _ZodEnum extends ZodType {
|
6745
|
-
constructor() {
|
6746
|
-
super(...arguments);
|
6747
|
-
_ZodEnum_cache.set(this, void 0);
|
6748
|
-
}
|
6749
6790
|
_parse(input) {
|
6750
6791
|
if (typeof input.data !== "string") {
|
6751
6792
|
const ctx = this._getOrReturnCtx(input);
|
@@ -6757,10 +6798,10 @@ var init_lib = __esm({
|
|
6757
6798
|
});
|
6758
6799
|
return INVALID;
|
6759
6800
|
}
|
6760
|
-
if (!
|
6761
|
-
|
6801
|
+
if (!this._cache) {
|
6802
|
+
this._cache = new Set(this._def.values);
|
6762
6803
|
}
|
6763
|
-
if (!
|
6804
|
+
if (!this._cache.has(input.data)) {
|
6764
6805
|
const ctx = this._getOrReturnCtx(input);
|
6765
6806
|
const expectedValues = this._def.values;
|
6766
6807
|
addIssueToContext(ctx, {
|
@@ -6809,13 +6850,8 @@ var init_lib = __esm({
|
|
6809
6850
|
});
|
6810
6851
|
}
|
6811
6852
|
};
|
6812
|
-
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
6813
6853
|
ZodEnum.create = createZodEnum;
|
6814
6854
|
ZodNativeEnum = class extends ZodType {
|
6815
|
-
constructor() {
|
6816
|
-
super(...arguments);
|
6817
|
-
_ZodNativeEnum_cache.set(this, void 0);
|
6818
|
-
}
|
6819
6855
|
_parse(input) {
|
6820
6856
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
6821
6857
|
const ctx = this._getOrReturnCtx(input);
|
@@ -6828,10 +6864,10 @@ var init_lib = __esm({
|
|
6828
6864
|
});
|
6829
6865
|
return INVALID;
|
6830
6866
|
}
|
6831
|
-
if (!
|
6832
|
-
|
6867
|
+
if (!this._cache) {
|
6868
|
+
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
6833
6869
|
}
|
6834
|
-
if (!
|
6870
|
+
if (!this._cache.has(input.data)) {
|
6835
6871
|
const expectedValues = util.objectValues(nativeEnumValues);
|
6836
6872
|
addIssueToContext(ctx, {
|
6837
6873
|
received: ctx.data,
|
@@ -6846,7 +6882,6 @@ var init_lib = __esm({
|
|
6846
6882
|
return this._def.values;
|
6847
6883
|
}
|
6848
6884
|
};
|
6849
|
-
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
6850
6885
|
ZodNativeEnum.create = (values, params) => {
|
6851
6886
|
return new ZodNativeEnum({
|
6852
6887
|
values,
|
@@ -6987,7 +7022,7 @@ var init_lib = __esm({
|
|
6987
7022
|
parent: ctx
|
6988
7023
|
});
|
6989
7024
|
if (!isValid(base))
|
6990
|
-
return
|
7025
|
+
return INVALID;
|
6991
7026
|
const result = effect.transform(base.value, checkCtx);
|
6992
7027
|
if (result instanceof Promise) {
|
6993
7028
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
@@ -6996,8 +7031,11 @@ var init_lib = __esm({
|
|
6996
7031
|
} else {
|
6997
7032
|
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
6998
7033
|
if (!isValid(base))
|
6999
|
-
return
|
7000
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
7034
|
+
return INVALID;
|
7035
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
7036
|
+
status: status.value,
|
7037
|
+
value: result
|
7038
|
+
}));
|
7001
7039
|
});
|
7002
7040
|
}
|
7003
7041
|
}
|
@@ -7337,13 +7375,44 @@ var init_lib = __esm({
|
|
7337
7375
|
}
|
7338
7376
|
});
|
7339
7377
|
|
7378
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/external.js
|
7379
|
+
var init_external = __esm({
|
7380
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/external.js"() {
|
7381
|
+
"use strict";
|
7382
|
+
init_errors();
|
7383
|
+
init_parseUtil();
|
7384
|
+
init_typeAliases();
|
7385
|
+
init_util();
|
7386
|
+
init_types();
|
7387
|
+
init_ZodError();
|
7388
|
+
}
|
7389
|
+
});
|
7390
|
+
|
7391
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/index.js
|
7392
|
+
var init_v3 = __esm({
|
7393
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/index.js"() {
|
7394
|
+
"use strict";
|
7395
|
+
init_external();
|
7396
|
+
init_external();
|
7397
|
+
}
|
7398
|
+
});
|
7399
|
+
|
7400
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/index.js
|
7401
|
+
var init_esm = __esm({
|
7402
|
+
"../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/index.js"() {
|
7403
|
+
"use strict";
|
7404
|
+
init_v3();
|
7405
|
+
init_v3();
|
7406
|
+
}
|
7407
|
+
});
|
7408
|
+
|
7340
7409
|
// src/serializer/gelSchema.ts
|
7341
7410
|
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;
|
7342
7411
|
var init_gelSchema = __esm({
|
7343
7412
|
"src/serializer/gelSchema.ts"() {
|
7344
7413
|
"use strict";
|
7345
7414
|
init_global();
|
7346
|
-
|
7415
|
+
init_esm();
|
7347
7416
|
enumSchema = objectType({
|
7348
7417
|
name: stringType(),
|
7349
7418
|
schema: stringType(),
|
@@ -7607,7 +7676,7 @@ var index2, fk2, column2, tableV3, compositePK2, uniqueConstraint2, checkConstra
|
|
7607
7676
|
var init_mysqlSchema = __esm({
|
7608
7677
|
"src/serializer/mysqlSchema.ts"() {
|
7609
7678
|
"use strict";
|
7610
|
-
|
7679
|
+
init_esm();
|
7611
7680
|
init_global();
|
7612
7681
|
index2 = objectType({
|
7613
7682
|
name: stringType(),
|
@@ -7936,7 +8005,7 @@ var init_pgSchema = __esm({
|
|
7936
8005
|
"src/serializer/pgSchema.ts"() {
|
7937
8006
|
"use strict";
|
7938
8007
|
init_global();
|
7939
|
-
|
8008
|
+
init_esm();
|
7940
8009
|
indexV2 = objectType({
|
7941
8010
|
name: stringType(),
|
7942
8011
|
columns: recordType(
|
@@ -8686,7 +8755,7 @@ var index4, column4, compositePK4, uniqueConstraint4, table4, viewMeta2, kitInte
|
|
8686
8755
|
var init_singlestoreSchema = __esm({
|
8687
8756
|
"src/serializer/singlestoreSchema.ts"() {
|
8688
8757
|
"use strict";
|
8689
|
-
|
8758
|
+
init_esm();
|
8690
8759
|
init_global();
|
8691
8760
|
index4 = objectType({
|
8692
8761
|
name: stringType(),
|
@@ -8883,7 +8952,7 @@ var index5, fk4, compositePK5, column5, tableV33, uniqueConstraint5, checkConstr
|
|
8883
8952
|
var init_sqliteSchema = __esm({
|
8884
8953
|
"src/serializer/sqliteSchema.ts"() {
|
8885
8954
|
"use strict";
|
8886
|
-
|
8955
|
+
init_esm();
|
8887
8956
|
init_global();
|
8888
8957
|
index5 = objectType({
|
8889
8958
|
name: stringType(),
|
@@ -17384,7 +17453,7 @@ var makeChanged, makeSelfOrChanged, makePatched, makeSelfOrPatched, columnSchema
|
|
17384
17453
|
var init_snapshotsDiffer = __esm({
|
17385
17454
|
"src/snapshotsDiffer.ts"() {
|
17386
17455
|
"use strict";
|
17387
|
-
|
17456
|
+
init_esm();
|
17388
17457
|
init_jsonDiffer();
|
17389
17458
|
init_sqlgenerator();
|
17390
17459
|
init_jsonStatements();
|
@@ -20296,7 +20365,7 @@ var dialects, dialect4, commonSquashedSchema, commonSchema;
|
|
20296
20365
|
var init_schemaValidator = __esm({
|
20297
20366
|
"src/schemaValidator.ts"() {
|
20298
20367
|
"use strict";
|
20299
|
-
|
20368
|
+
init_esm();
|
20300
20369
|
init_mysqlSchema();
|
20301
20370
|
init_pgSchema();
|
20302
20371
|
init_singlestoreSchema();
|
@@ -20318,7 +20387,7 @@ var sqliteDriversLiterals, postgresqlDriversLiterals, prefixes, prefix, casingTy
|
|
20318
20387
|
var init_common = __esm({
|
20319
20388
|
"src/cli/validations/common.ts"() {
|
20320
20389
|
"use strict";
|
20321
|
-
|
20390
|
+
init_esm();
|
20322
20391
|
init_schemaValidator();
|
20323
20392
|
init_outputs();
|
20324
20393
|
sqliteDriversLiterals = [
|
@@ -22096,8 +22165,7 @@ var init_column_builder = __esm({
|
|
22096
22165
|
}
|
22097
22166
|
/** @internal Sets the name of the column to the key within the table definition if a name was not given. */
|
22098
22167
|
setName(name2) {
|
22099
|
-
if (this.config.name !== "")
|
22100
|
-
return;
|
22168
|
+
if (this.config.name !== "") return;
|
22101
22169
|
this.config.name = name2;
|
22102
22170
|
}
|
22103
22171
|
};
|
@@ -22529,8 +22597,7 @@ var init_common2 = __esm({
|
|
22529
22597
|
const a = value.map(
|
22530
22598
|
(v) => v === null ? null : is(this.baseColumn, _PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v)
|
22531
22599
|
);
|
22532
|
-
if (isNestedArray)
|
22533
|
-
return a;
|
22600
|
+
if (isNestedArray) return a;
|
22534
22601
|
return makePgArray(a);
|
22535
22602
|
}
|
22536
22603
|
};
|
@@ -22663,7 +22730,7 @@ var version;
|
|
22663
22730
|
var init_version = __esm({
|
22664
22731
|
"../drizzle-orm/dist/version.js"() {
|
22665
22732
|
"use strict";
|
22666
|
-
version = "0.
|
22733
|
+
version = "0.44.2";
|
22667
22734
|
}
|
22668
22735
|
});
|
22669
22736
|
|
@@ -23339,7 +23406,7 @@ var init_alias = __esm({
|
|
23339
23406
|
|
23340
23407
|
// ../drizzle-orm/dist/errors.js
|
23341
23408
|
var _a31, _b13, DrizzleError, _a32, _b14, TransactionRollbackError;
|
23342
|
-
var
|
23409
|
+
var init_errors2 = __esm({
|
23343
23410
|
"../drizzle-orm/dist/errors.js"() {
|
23344
23411
|
"use strict";
|
23345
23412
|
init_entity();
|
@@ -23533,8 +23600,7 @@ function mapUpdateSet(table6, values) {
|
|
23533
23600
|
function applyMixins(baseClass, extendedClasses) {
|
23534
23601
|
for (const extendedClass of extendedClasses) {
|
23535
23602
|
for (const name2 of Object.getOwnPropertyNames(extendedClass.prototype)) {
|
23536
|
-
if (name2 === "constructor")
|
23537
|
-
continue;
|
23603
|
+
if (name2 === "constructor") continue;
|
23538
23604
|
Object.defineProperty(
|
23539
23605
|
baseClass.prototype,
|
23540
23606
|
name2,
|
@@ -23549,15 +23615,6 @@ function getTableColumns(table6) {
|
|
23549
23615
|
function getViewSelectedFields(view5) {
|
23550
23616
|
return view5[ViewBaseConfig].selectedFields;
|
23551
23617
|
}
|
23552
|
-
async function hashQuery(sql2, params) {
|
23553
|
-
const dataToHash = `${sql2}-${JSON.stringify(params)}`;
|
23554
|
-
const encoder = new TextEncoder();
|
23555
|
-
const data = encoder.encode(dataToHash);
|
23556
|
-
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
23557
|
-
const hashArray = [...new Uint8Array(hashBuffer)];
|
23558
|
-
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
23559
|
-
return hashHex;
|
23560
|
-
}
|
23561
23618
|
function getTableLikeName(table6) {
|
23562
23619
|
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];
|
23563
23620
|
}
|
@@ -23568,54 +23625,43 @@ function getColumnNameAndConfig(a, b) {
|
|
23568
23625
|
};
|
23569
23626
|
}
|
23570
23627
|
function isConfig(data) {
|
23571
|
-
if (typeof data !== "object" || data === null)
|
23572
|
-
|
23573
|
-
if (data.constructor.name !== "Object")
|
23574
|
-
return false;
|
23628
|
+
if (typeof data !== "object" || data === null) return false;
|
23629
|
+
if (data.constructor.name !== "Object") return false;
|
23575
23630
|
if ("logger" in data) {
|
23576
23631
|
const type = typeof data["logger"];
|
23577
|
-
if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined")
|
23578
|
-
return false;
|
23632
|
+
if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined") return false;
|
23579
23633
|
return true;
|
23580
23634
|
}
|
23581
23635
|
if ("schema" in data) {
|
23582
23636
|
const type = typeof data["schema"];
|
23583
|
-
if (type !== "object" && type !== "undefined")
|
23584
|
-
return false;
|
23637
|
+
if (type !== "object" && type !== "undefined") return false;
|
23585
23638
|
return true;
|
23586
23639
|
}
|
23587
23640
|
if ("casing" in data) {
|
23588
23641
|
const type = typeof data["casing"];
|
23589
|
-
if (type !== "string" && type !== "undefined")
|
23590
|
-
return false;
|
23642
|
+
if (type !== "string" && type !== "undefined") return false;
|
23591
23643
|
return true;
|
23592
23644
|
}
|
23593
23645
|
if ("mode" in data) {
|
23594
|
-
if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== void 0)
|
23595
|
-
return false;
|
23646
|
+
if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== void 0) return false;
|
23596
23647
|
return true;
|
23597
23648
|
}
|
23598
23649
|
if ("connection" in data) {
|
23599
23650
|
const type = typeof data["connection"];
|
23600
|
-
if (type !== "string" && type !== "object" && type !== "undefined")
|
23601
|
-
return false;
|
23651
|
+
if (type !== "string" && type !== "object" && type !== "undefined") return false;
|
23602
23652
|
return true;
|
23603
23653
|
}
|
23604
23654
|
if ("client" in data) {
|
23605
23655
|
const type = typeof data["client"];
|
23606
|
-
if (type !== "object" && type !== "function" && type !== "undefined")
|
23607
|
-
return false;
|
23656
|
+
if (type !== "object" && type !== "function" && type !== "undefined") return false;
|
23608
23657
|
return true;
|
23609
23658
|
}
|
23610
|
-
if (Object.keys(data).length === 0)
|
23611
|
-
return true;
|
23659
|
+
if (Object.keys(data).length === 0) return true;
|
23612
23660
|
return false;
|
23613
23661
|
}
|
23614
|
-
var crypto;
|
23615
23662
|
var init_utils2 = __esm({
|
23616
23663
|
"../drizzle-orm/dist/utils.js"() {
|
23617
23664
|
"use strict";
|
23618
|
-
crypto = __toESM(require("crypto"), 1);
|
23619
23665
|
init_column();
|
23620
23666
|
init_entity();
|
23621
23667
|
init_sql();
|
@@ -24428,8 +24474,7 @@ var init_numeric = __esm({
|
|
24428
24474
|
this.scale = config.scale;
|
24429
24475
|
}
|
24430
24476
|
mapFromDriverValue(value) {
|
24431
|
-
if (typeof value === "string")
|
24432
|
-
return value;
|
24477
|
+
if (typeof value === "string") return value;
|
24433
24478
|
return String(value);
|
24434
24479
|
}
|
24435
24480
|
getSQLType() {
|
@@ -24468,8 +24513,7 @@ var init_numeric = __esm({
|
|
24468
24513
|
this.scale = config.scale;
|
24469
24514
|
}
|
24470
24515
|
mapFromDriverValue(value) {
|
24471
|
-
if (typeof value === "number")
|
24472
|
-
return value;
|
24516
|
+
if (typeof value === "number") return value;
|
24473
24517
|
return Number(value);
|
24474
24518
|
}
|
24475
24519
|
getSQLType() {
|
@@ -26083,7 +26127,6 @@ __export(dist_exports, {
|
|
26083
26127
|
gte: () => gte,
|
26084
26128
|
hammingDistance: () => hammingDistance,
|
26085
26129
|
hasOwnEntityKind: () => hasOwnEntityKind,
|
26086
|
-
hashQuery: () => hashQuery,
|
26087
26130
|
haveSameKeys: () => haveSameKeys,
|
26088
26131
|
ilike: () => ilike,
|
26089
26132
|
inArray: () => inArray,
|
@@ -26137,7 +26180,7 @@ var init_dist = __esm({
|
|
26137
26180
|
init_column_builder();
|
26138
26181
|
init_column();
|
26139
26182
|
init_entity();
|
26140
|
-
|
26183
|
+
init_errors2();
|
26141
26184
|
init_logger();
|
26142
26185
|
init_operations();
|
26143
26186
|
init_query_promise();
|
@@ -26506,8 +26549,7 @@ var init_casing = __esm({
|
|
26506
26549
|
this.convert = casing2 === "snake_case" ? toSnakeCase : casing2 === "camelCase" ? toCamelCase : noopCase;
|
26507
26550
|
}
|
26508
26551
|
getColumnCasing(column6) {
|
26509
|
-
if (!column6.keyAsName)
|
26510
|
-
return column6.name;
|
26552
|
+
if (!column6.keyAsName) return column6.name;
|
26511
26553
|
const schema5 = column6.table[Table2.Symbol.Schema] ?? "public";
|
26512
26554
|
const tableName = column6.table[Table2.Symbol.OriginalName];
|
26513
26555
|
const key = `${schema5}.${tableName}.${column6.name}`;
|
@@ -26559,7 +26601,7 @@ var init_dialect = __esm({
|
|
26559
26601
|
init_casing();
|
26560
26602
|
init_column();
|
26561
26603
|
init_entity();
|
26562
|
-
|
26604
|
+
init_errors2();
|
26563
26605
|
init_columns();
|
26564
26606
|
init_table2();
|
26565
26607
|
init_relations();
|
@@ -26616,8 +26658,7 @@ var init_dialect = __esm({
|
|
26616
26658
|
return `'${str.replace(/'/g, "''")}'`;
|
26617
26659
|
}
|
26618
26660
|
buildWithCTE(queries) {
|
26619
|
-
if (!queries?.length)
|
26620
|
-
return void 0;
|
26661
|
+
if (!queries?.length) return void 0;
|
26621
26662
|
const withSqlChunks = [sql`with `];
|
26622
26663
|
for (const [i, w] of queries.entries()) {
|
26623
26664
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -28167,8 +28208,7 @@ var init_select2 = __esm({
|
|
28167
28208
|
};
|
28168
28209
|
this.tableName = getTableLikeName(table6);
|
28169
28210
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
28170
|
-
for (const item of extractUsedTable(table6))
|
28171
|
-
this.usedTables.add(item);
|
28211
|
+
for (const item of extractUsedTable(table6)) this.usedTables.add(item);
|
28172
28212
|
}
|
28173
28213
|
/** @internal */
|
28174
28214
|
getUsedTables() {
|
@@ -28178,8 +28218,7 @@ var init_select2 = __esm({
|
|
28178
28218
|
return (table6, on) => {
|
28179
28219
|
const baseTableName = this.tableName;
|
28180
28220
|
const tableName = getTableLikeName(table6);
|
28181
|
-
for (const item of extractUsedTable(table6))
|
28182
|
-
this.usedTables.add(item);
|
28221
|
+
for (const item of extractUsedTable(table6)) this.usedTables.add(item);
|
28183
28222
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
28184
28223
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
28185
28224
|
}
|
@@ -28440,8 +28479,7 @@ var init_select2 = __esm({
|
|
28440
28479
|
const usedTables = [];
|
28441
28480
|
usedTables.push(...extractUsedTable(this.config.table));
|
28442
28481
|
if (this.config.joins) {
|
28443
|
-
for (const it of this.config.joins)
|
28444
|
-
usedTables.push(...extractUsedTable(it.table));
|
28482
|
+
for (const it of this.config.joins) usedTables.push(...extractUsedTable(it.table));
|
28445
28483
|
}
|
28446
28484
|
return new Proxy(
|
28447
28485
|
new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
|
@@ -30223,6 +30261,15 @@ var init_schema = __esm({
|
|
30223
30261
|
});
|
30224
30262
|
|
30225
30263
|
// ../drizzle-orm/dist/cache/core/cache.js
|
30264
|
+
async function hashQuery(sql2, params) {
|
30265
|
+
const dataToHash = `${sql2}-${JSON.stringify(params)}`;
|
30266
|
+
const encoder = new TextEncoder();
|
30267
|
+
const data = encoder.encode(dataToHash);
|
30268
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
30269
|
+
const hashArray = [...new Uint8Array(hashBuffer)];
|
30270
|
+
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
30271
|
+
return hashHex;
|
30272
|
+
}
|
30226
30273
|
var _a165, Cache, _a166, _b119, NoopCache;
|
30227
30274
|
var init_cache = __esm({
|
30228
30275
|
"../drizzle-orm/dist/cache/core/cache.js"() {
|
@@ -30248,6 +30295,25 @@ var init_cache = __esm({
|
|
30248
30295
|
}
|
30249
30296
|
});
|
30250
30297
|
|
30298
|
+
// ../drizzle-orm/dist/errors/index.js
|
30299
|
+
var DrizzleQueryError;
|
30300
|
+
var init_errors3 = __esm({
|
30301
|
+
"../drizzle-orm/dist/errors/index.js"() {
|
30302
|
+
"use strict";
|
30303
|
+
DrizzleQueryError = class _DrizzleQueryError extends Error {
|
30304
|
+
constructor(query, params, cause) {
|
30305
|
+
super(`Failed query: ${query}
|
30306
|
+
params: ${params}`);
|
30307
|
+
this.query = query;
|
30308
|
+
this.params = params;
|
30309
|
+
this.cause = cause;
|
30310
|
+
Error.captureStackTrace(this, _DrizzleQueryError);
|
30311
|
+
if (cause) this.cause = cause;
|
30312
|
+
}
|
30313
|
+
};
|
30314
|
+
}
|
30315
|
+
});
|
30316
|
+
|
30251
30317
|
// ../drizzle-orm/dist/pg-core/session.js
|
30252
30318
|
var _a167, PgPreparedQuery, _a168, PgSession, _a169, _b120, PgTransaction;
|
30253
30319
|
var init_session = __esm({
|
@@ -30255,10 +30321,10 @@ var init_session = __esm({
|
|
30255
30321
|
"use strict";
|
30256
30322
|
init_cache();
|
30257
30323
|
init_entity();
|
30258
|
-
|
30324
|
+
init_errors2();
|
30325
|
+
init_errors3();
|
30259
30326
|
init_sql2();
|
30260
30327
|
init_tracing();
|
30261
|
-
init_utils2();
|
30262
30328
|
init_db();
|
30263
30329
|
_a167 = entityKind;
|
30264
30330
|
PgPreparedQuery = class {
|
@@ -30291,20 +30357,36 @@ var init_session = __esm({
|
|
30291
30357
|
/** @internal */
|
30292
30358
|
async queryWithCache(queryString, params, query) {
|
30293
30359
|
if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
|
30294
|
-
|
30360
|
+
try {
|
30361
|
+
return await query();
|
30362
|
+
} catch (e) {
|
30363
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30364
|
+
}
|
30295
30365
|
}
|
30296
30366
|
if (this.cacheConfig && !this.cacheConfig.enable) {
|
30297
|
-
|
30367
|
+
try {
|
30368
|
+
return await query();
|
30369
|
+
} catch (e) {
|
30370
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30371
|
+
}
|
30298
30372
|
}
|
30299
30373
|
if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
|
30300
|
-
|
30301
|
-
|
30302
|
-
|
30303
|
-
|
30304
|
-
|
30374
|
+
try {
|
30375
|
+
const [res] = await Promise.all([
|
30376
|
+
query(),
|
30377
|
+
this.cache.onMutate({ tables: this.queryMetadata.tables })
|
30378
|
+
]);
|
30379
|
+
return res;
|
30380
|
+
} catch (e) {
|
30381
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30382
|
+
}
|
30305
30383
|
}
|
30306
30384
|
if (!this.cacheConfig) {
|
30307
|
-
|
30385
|
+
try {
|
30386
|
+
return await query();
|
30387
|
+
} catch (e) {
|
30388
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30389
|
+
}
|
30308
30390
|
}
|
30309
30391
|
if (this.queryMetadata.type === "select") {
|
30310
30392
|
const fromCache = await this.cache.get(
|
@@ -30314,7 +30396,12 @@ var init_session = __esm({
|
|
30314
30396
|
this.cacheConfig.autoInvalidate
|
30315
30397
|
);
|
30316
30398
|
if (fromCache === void 0) {
|
30317
|
-
|
30399
|
+
let result;
|
30400
|
+
try {
|
30401
|
+
result = await query();
|
30402
|
+
} catch (e) {
|
30403
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30404
|
+
}
|
30318
30405
|
await this.cache.put(
|
30319
30406
|
this.cacheConfig.tag ?? await hashQuery(queryString, params),
|
30320
30407
|
result,
|
@@ -30327,7 +30414,11 @@ var init_session = __esm({
|
|
30327
30414
|
}
|
30328
30415
|
return fromCache;
|
30329
30416
|
}
|
30330
|
-
|
30417
|
+
try {
|
30418
|
+
return await query();
|
30419
|
+
} catch (e) {
|
30420
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30421
|
+
}
|
30331
30422
|
}
|
30332
30423
|
};
|
30333
30424
|
__publicField(PgPreparedQuery, _a167, "PgPreparedQuery");
|
@@ -32664,8 +32755,7 @@ var init_numeric2 = __esm({
|
|
32664
32755
|
__publicField(SQLiteNumericBuilder, _a195, "SQLiteNumericBuilder");
|
32665
32756
|
SQLiteNumeric = class extends (_b140 = SQLiteColumn, _a196 = entityKind, _b140) {
|
32666
32757
|
mapFromDriverValue(value) {
|
32667
|
-
if (typeof value === "string")
|
32668
|
-
return value;
|
32758
|
+
if (typeof value === "string") return value;
|
32669
32759
|
return String(value);
|
32670
32760
|
}
|
32671
32761
|
getSQLType() {
|
@@ -32692,8 +32782,7 @@ var init_numeric2 = __esm({
|
|
32692
32782
|
__publicField(this, "mapToDriverValue", String);
|
32693
32783
|
}
|
32694
32784
|
mapFromDriverValue(value) {
|
32695
|
-
if (typeof value === "number")
|
32696
|
-
return value;
|
32785
|
+
if (typeof value === "number") return value;
|
32697
32786
|
return Number(value);
|
32698
32787
|
}
|
32699
32788
|
getSQLType() {
|
@@ -33228,7 +33317,7 @@ var init_dialect2 = __esm({
|
|
33228
33317
|
init_casing();
|
33229
33318
|
init_column();
|
33230
33319
|
init_entity();
|
33231
|
-
|
33320
|
+
init_errors2();
|
33232
33321
|
init_relations();
|
33233
33322
|
init_sql2();
|
33234
33323
|
init_sql();
|
@@ -33256,8 +33345,7 @@ var init_dialect2 = __esm({
|
|
33256
33345
|
return `'${str.replace(/'/g, "''")}'`;
|
33257
33346
|
}
|
33258
33347
|
buildWithCTE(queries) {
|
33259
|
-
if (!queries?.length)
|
33260
|
-
return void 0;
|
33348
|
+
if (!queries?.length) return void 0;
|
33261
33349
|
const withSqlChunks = [sql`with `];
|
33262
33350
|
for (const [i, w] of queries.entries()) {
|
33263
33351
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -34208,8 +34296,7 @@ var init_select3 = __esm({
|
|
34208
34296
|
};
|
34209
34297
|
this.tableName = getTableLikeName(table6);
|
34210
34298
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
34211
|
-
for (const item of extractUsedTable2(table6))
|
34212
|
-
this.usedTables.add(item);
|
34299
|
+
for (const item of extractUsedTable2(table6)) this.usedTables.add(item);
|
34213
34300
|
}
|
34214
34301
|
/** @internal */
|
34215
34302
|
getUsedTables() {
|
@@ -34219,8 +34306,7 @@ var init_select3 = __esm({
|
|
34219
34306
|
return (table6, on) => {
|
34220
34307
|
const baseTableName = this.tableName;
|
34221
34308
|
const tableName = getTableLikeName(table6);
|
34222
|
-
for (const item of extractUsedTable2(table6))
|
34223
|
-
this.usedTables.add(item);
|
34309
|
+
for (const item of extractUsedTable2(table6)) this.usedTables.add(item);
|
34224
34310
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
34225
34311
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
34226
34312
|
}
|
@@ -34467,8 +34553,7 @@ var init_select3 = __esm({
|
|
34467
34553
|
const usedTables = [];
|
34468
34554
|
usedTables.push(...extractUsedTable2(this.config.table));
|
34469
34555
|
if (this.config.joins) {
|
34470
|
-
for (const it of this.config.joins)
|
34471
|
-
usedTables.push(...extractUsedTable2(it.table));
|
34556
|
+
for (const it of this.config.joins) usedTables.push(...extractUsedTable2(it.table));
|
34472
34557
|
}
|
34473
34558
|
return new Proxy(
|
34474
34559
|
new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
|
@@ -34726,8 +34811,7 @@ var init_insert2 = __esm({
|
|
34726
34811
|
* ```
|
34727
34812
|
*/
|
34728
34813
|
onConflictDoNothing(config = {}) {
|
34729
|
-
if (!this.config.onConflict)
|
34730
|
-
this.config.onConflict = [];
|
34814
|
+
if (!this.config.onConflict) this.config.onConflict = [];
|
34731
34815
|
if (config.target === void 0) {
|
34732
34816
|
this.config.onConflict.push(sql` on conflict do nothing`);
|
34733
34817
|
} else {
|
@@ -34772,8 +34856,7 @@ var init_insert2 = __esm({
|
|
34772
34856
|
'You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.'
|
34773
34857
|
);
|
34774
34858
|
}
|
34775
|
-
if (!this.config.onConflict)
|
34776
|
-
this.config.onConflict = [];
|
34859
|
+
if (!this.config.onConflict) this.config.onConflict = [];
|
34777
34860
|
const whereSql = config.where ? sql` where ${config.where}` : void 0;
|
34778
34861
|
const targetWhereSql = config.targetWhere ? sql` where ${config.targetWhere}` : void 0;
|
34779
34862
|
const setWhereSql = config.setWhere ? sql` where ${config.setWhere}` : void 0;
|
@@ -35579,9 +35662,9 @@ var init_session2 = __esm({
|
|
35579
35662
|
"use strict";
|
35580
35663
|
init_cache();
|
35581
35664
|
init_entity();
|
35582
|
-
|
35665
|
+
init_errors2();
|
35666
|
+
init_errors3();
|
35583
35667
|
init_query_promise();
|
35584
|
-
init_utils2();
|
35585
35668
|
init_db2();
|
35586
35669
|
ExecuteResultSync = class extends (_b164 = QueryPromise, _a232 = entityKind, _b164) {
|
35587
35670
|
constructor(resultCb) {
|
@@ -35617,20 +35700,36 @@ var init_session2 = __esm({
|
|
35617
35700
|
/** @internal */
|
35618
35701
|
async queryWithCache(queryString, params, query) {
|
35619
35702
|
if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
|
35620
|
-
|
35703
|
+
try {
|
35704
|
+
return await query();
|
35705
|
+
} catch (e) {
|
35706
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35707
|
+
}
|
35621
35708
|
}
|
35622
35709
|
if (this.cacheConfig && !this.cacheConfig.enable) {
|
35623
|
-
|
35710
|
+
try {
|
35711
|
+
return await query();
|
35712
|
+
} catch (e) {
|
35713
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35714
|
+
}
|
35624
35715
|
}
|
35625
35716
|
if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
|
35626
|
-
|
35627
|
-
|
35628
|
-
|
35629
|
-
|
35630
|
-
|
35717
|
+
try {
|
35718
|
+
const [res] = await Promise.all([
|
35719
|
+
query(),
|
35720
|
+
this.cache.onMutate({ tables: this.queryMetadata.tables })
|
35721
|
+
]);
|
35722
|
+
return res;
|
35723
|
+
} catch (e) {
|
35724
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35725
|
+
}
|
35631
35726
|
}
|
35632
35727
|
if (!this.cacheConfig) {
|
35633
|
-
|
35728
|
+
try {
|
35729
|
+
return await query();
|
35730
|
+
} catch (e) {
|
35731
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35732
|
+
}
|
35634
35733
|
}
|
35635
35734
|
if (this.queryMetadata.type === "select") {
|
35636
35735
|
const fromCache = await this.cache.get(
|
@@ -35640,7 +35739,12 @@ var init_session2 = __esm({
|
|
35640
35739
|
this.cacheConfig.autoInvalidate
|
35641
35740
|
);
|
35642
35741
|
if (fromCache === void 0) {
|
35643
|
-
|
35742
|
+
let result;
|
35743
|
+
try {
|
35744
|
+
result = await query();
|
35745
|
+
} catch (e) {
|
35746
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35747
|
+
}
|
35644
35748
|
await this.cache.put(
|
35645
35749
|
this.cacheConfig.tag ?? await hashQuery(queryString, params),
|
35646
35750
|
result,
|
@@ -35653,7 +35757,11 @@ var init_session2 = __esm({
|
|
35653
35757
|
}
|
35654
35758
|
return fromCache;
|
35655
35759
|
}
|
35656
|
-
|
35760
|
+
try {
|
35761
|
+
return await query();
|
35762
|
+
} catch (e) {
|
35763
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35764
|
+
}
|
35657
35765
|
}
|
35658
35766
|
getQuery() {
|
35659
35767
|
return this.query;
|
@@ -36925,10 +37033,8 @@ var init_binary = __esm({
|
|
36925
37033
|
__publicField(this, "length", this.config.length);
|
36926
37034
|
}
|
36927
37035
|
mapFromDriverValue(value) {
|
36928
|
-
if (typeof value === "string")
|
36929
|
-
|
36930
|
-
if (Buffer.isBuffer(value))
|
36931
|
-
return value.toString();
|
37036
|
+
if (typeof value === "string") return value;
|
37037
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
36932
37038
|
const str = [];
|
36933
37039
|
for (const v of value) {
|
36934
37040
|
str.push(v === 49 ? "1" : "0");
|
@@ -37250,8 +37356,7 @@ var init_decimal = __esm({
|
|
37250
37356
|
__publicField(this, "unsigned", this.config.unsigned);
|
37251
37357
|
}
|
37252
37358
|
mapFromDriverValue(value) {
|
37253
|
-
if (typeof value === "string")
|
37254
|
-
return value;
|
37359
|
+
if (typeof value === "string") return value;
|
37255
37360
|
return String(value);
|
37256
37361
|
}
|
37257
37362
|
getSQLType() {
|
@@ -37293,8 +37398,7 @@ var init_decimal = __esm({
|
|
37293
37398
|
__publicField(this, "mapToDriverValue", String);
|
37294
37399
|
}
|
37295
37400
|
mapFromDriverValue(value) {
|
37296
|
-
if (typeof value === "number")
|
37297
|
-
return value;
|
37401
|
+
if (typeof value === "number") return value;
|
37298
37402
|
return Number(value);
|
37299
37403
|
}
|
37300
37404
|
getSQLType() {
|
@@ -38023,10 +38127,8 @@ var init_varbinary = __esm({
|
|
38023
38127
|
__publicField(this, "length", this.config.length);
|
38024
38128
|
}
|
38025
38129
|
mapFromDriverValue(value) {
|
38026
|
-
if (typeof value === "string")
|
38027
|
-
|
38028
|
-
if (Buffer.isBuffer(value))
|
38029
|
-
return value.toString();
|
38130
|
+
if (typeof value === "string") return value;
|
38131
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
38030
38132
|
const str = [];
|
38031
38133
|
for (const v of value) {
|
38032
38134
|
str.push(v === 49 ? "1" : "0");
|
@@ -38635,7 +38737,7 @@ var init_dialect3 = __esm({
|
|
38635
38737
|
init_casing();
|
38636
38738
|
init_column();
|
38637
38739
|
init_entity();
|
38638
|
-
|
38740
|
+
init_errors2();
|
38639
38741
|
init_relations();
|
38640
38742
|
init_expressions();
|
38641
38743
|
init_sql();
|
@@ -38690,8 +38792,7 @@ var init_dialect3 = __esm({
|
|
38690
38792
|
return `'${str.replace(/'/g, "''")}'`;
|
38691
38793
|
}
|
38692
38794
|
buildWithCTE(queries) {
|
38693
|
-
if (!queries?.length)
|
38694
|
-
return void 0;
|
38795
|
+
if (!queries?.length) return void 0;
|
38695
38796
|
const withSqlChunks = [sql`with `];
|
38696
38797
|
for (const [i, w] of queries.entries()) {
|
38697
38798
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -39971,8 +40072,7 @@ var init_select4 = __esm({
|
|
39971
40072
|
};
|
39972
40073
|
this.tableName = getTableLikeName(table6);
|
39973
40074
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
39974
|
-
for (const item of extractUsedTable3(table6))
|
39975
|
-
this.usedTables.add(item);
|
40075
|
+
for (const item of extractUsedTable3(table6)) this.usedTables.add(item);
|
39976
40076
|
}
|
39977
40077
|
/** @internal */
|
39978
40078
|
getUsedTables() {
|
@@ -39985,8 +40085,7 @@ var init_select4 = __esm({
|
|
39985
40085
|
const onIndex = isCrossJoin ? a : b;
|
39986
40086
|
const baseTableName = this.tableName;
|
39987
40087
|
const tableName = getTableLikeName(table6);
|
39988
|
-
for (const item of extractUsedTable3(table6))
|
39989
|
-
this.usedTables.add(item);
|
40088
|
+
for (const item of extractUsedTable3(table6)) this.usedTables.add(item);
|
39990
40089
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
39991
40090
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
39992
40091
|
}
|
@@ -40254,8 +40353,7 @@ var init_select4 = __esm({
|
|
40254
40353
|
const usedTables = [];
|
40255
40354
|
usedTables.push(...extractUsedTable3(this.config.table));
|
40256
40355
|
if (this.config.joins) {
|
40257
|
-
for (const it of this.config.joins)
|
40258
|
-
usedTables.push(...extractUsedTable3(it.table));
|
40356
|
+
for (const it of this.config.joins) usedTables.push(...extractUsedTable3(it.table));
|
40259
40357
|
}
|
40260
40358
|
return new Proxy(
|
40261
40359
|
new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
|
@@ -41204,9 +41302,9 @@ var init_session3 = __esm({
|
|
41204
41302
|
"use strict";
|
41205
41303
|
init_cache();
|
41206
41304
|
init_entity();
|
41207
|
-
|
41305
|
+
init_errors2();
|
41306
|
+
init_errors3();
|
41208
41307
|
init_sql();
|
41209
|
-
init_utils2();
|
41210
41308
|
init_db3();
|
41211
41309
|
_a341 = entityKind;
|
41212
41310
|
MySqlPreparedQuery = class {
|
@@ -41226,20 +41324,36 @@ var init_session3 = __esm({
|
|
41226
41324
|
/** @internal */
|
41227
41325
|
async queryWithCache(queryString, params, query) {
|
41228
41326
|
if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
|
41229
|
-
|
41327
|
+
try {
|
41328
|
+
return await query();
|
41329
|
+
} catch (e) {
|
41330
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41331
|
+
}
|
41230
41332
|
}
|
41231
41333
|
if (this.cacheConfig && !this.cacheConfig.enable) {
|
41232
|
-
|
41334
|
+
try {
|
41335
|
+
return await query();
|
41336
|
+
} catch (e) {
|
41337
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41338
|
+
}
|
41233
41339
|
}
|
41234
41340
|
if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
|
41235
|
-
|
41236
|
-
|
41237
|
-
|
41238
|
-
|
41239
|
-
|
41341
|
+
try {
|
41342
|
+
const [res] = await Promise.all([
|
41343
|
+
query(),
|
41344
|
+
this.cache.onMutate({ tables: this.queryMetadata.tables })
|
41345
|
+
]);
|
41346
|
+
return res;
|
41347
|
+
} catch (e) {
|
41348
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41349
|
+
}
|
41240
41350
|
}
|
41241
41351
|
if (!this.cacheConfig) {
|
41242
|
-
|
41352
|
+
try {
|
41353
|
+
return await query();
|
41354
|
+
} catch (e) {
|
41355
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41356
|
+
}
|
41243
41357
|
}
|
41244
41358
|
if (this.queryMetadata.type === "select") {
|
41245
41359
|
const fromCache = await this.cache.get(
|
@@ -41249,7 +41363,12 @@ var init_session3 = __esm({
|
|
41249
41363
|
this.cacheConfig.autoInvalidate
|
41250
41364
|
);
|
41251
41365
|
if (fromCache === void 0) {
|
41252
|
-
|
41366
|
+
let result;
|
41367
|
+
try {
|
41368
|
+
result = await query();
|
41369
|
+
} catch (e) {
|
41370
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41371
|
+
}
|
41253
41372
|
await this.cache.put(
|
41254
41373
|
this.cacheConfig.tag ?? await hashQuery(queryString, params),
|
41255
41374
|
result,
|
@@ -41262,7 +41381,11 @@ var init_session3 = __esm({
|
|
41262
41381
|
}
|
41263
41382
|
return fromCache;
|
41264
41383
|
}
|
41265
|
-
|
41384
|
+
try {
|
41385
|
+
return await query();
|
41386
|
+
} catch (e) {
|
41387
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41388
|
+
}
|
41266
41389
|
}
|
41267
41390
|
};
|
41268
41391
|
__publicField(MySqlPreparedQuery, _a341, "MySqlPreparedQuery");
|
@@ -42108,7 +42231,7 @@ var cliConfigGenerate, pushParams, pullParams, configCheck, cliConfigCheck;
|
|
42108
42231
|
var init_cli = __esm({
|
42109
42232
|
"src/cli/validations/cli.ts"() {
|
42110
42233
|
"use strict";
|
42111
|
-
|
42234
|
+
init_esm();
|
42112
42235
|
init_schemaValidator();
|
42113
42236
|
init_common();
|
42114
42237
|
cliConfigGenerate = objectType({
|
@@ -42176,7 +42299,7 @@ var gelCredentials;
|
|
42176
42299
|
var init_gel = __esm({
|
42177
42300
|
"src/cli/validations/gel.ts"() {
|
42178
42301
|
"use strict";
|
42179
|
-
|
42302
|
+
init_esm();
|
42180
42303
|
init_views();
|
42181
42304
|
init_common();
|
42182
42305
|
gelCredentials = unionType([
|
@@ -42224,7 +42347,7 @@ var libSQLCredentials;
|
|
42224
42347
|
var init_libsql = __esm({
|
42225
42348
|
"src/cli/validations/libsql.ts"() {
|
42226
42349
|
"use strict";
|
42227
|
-
|
42350
|
+
init_esm();
|
42228
42351
|
init_views();
|
42229
42352
|
init_common();
|
42230
42353
|
libSQLCredentials = objectType({
|
@@ -42239,7 +42362,7 @@ var mysqlCredentials;
|
|
42239
42362
|
var init_mysql = __esm({
|
42240
42363
|
"src/cli/validations/mysql.ts"() {
|
42241
42364
|
"use strict";
|
42242
|
-
|
42365
|
+
init_esm();
|
42243
42366
|
init_views();
|
42244
42367
|
init_common();
|
42245
42368
|
init_outputs();
|
@@ -42276,7 +42399,7 @@ var postgresCredentials;
|
|
42276
42399
|
var init_postgres = __esm({
|
42277
42400
|
"src/cli/validations/postgres.ts"() {
|
42278
42401
|
"use strict";
|
42279
|
-
|
42402
|
+
init_esm();
|
42280
42403
|
init_views();
|
42281
42404
|
init_common();
|
42282
42405
|
postgresCredentials = unionType([
|
@@ -42325,7 +42448,7 @@ var singlestoreCredentials;
|
|
42325
42448
|
var init_singlestore = __esm({
|
42326
42449
|
"src/cli/validations/singlestore.ts"() {
|
42327
42450
|
"use strict";
|
42328
|
-
|
42451
|
+
init_esm();
|
42329
42452
|
init_views();
|
42330
42453
|
init_common();
|
42331
42454
|
init_outputs();
|
@@ -42363,7 +42486,7 @@ var init_sqlite = __esm({
|
|
42363
42486
|
"src/cli/validations/sqlite.ts"() {
|
42364
42487
|
"use strict";
|
42365
42488
|
init_global();
|
42366
|
-
|
42489
|
+
init_esm();
|
42367
42490
|
init_views();
|
42368
42491
|
init_common();
|
42369
42492
|
sqliteCredentials = unionType([
|
@@ -42394,7 +42517,7 @@ var credentials, studioCliParams, studioConfig;
|
|
42394
42517
|
var init_studio = __esm({
|
42395
42518
|
"src/cli/validations/studio.ts"() {
|
42396
42519
|
"use strict";
|
42397
|
-
|
42520
|
+
init_esm();
|
42398
42521
|
init_schemaValidator();
|
42399
42522
|
init_mysql();
|
42400
42523
|
init_postgres();
|
@@ -42436,7 +42559,7 @@ var init_utils9 = __esm({
|
|
42436
42559
|
"src/cli/commands/utils.ts"() {
|
42437
42560
|
"use strict";
|
42438
42561
|
import_hanji7 = __toESM(require_hanji());
|
42439
|
-
|
42562
|
+
init_esm();
|
42440
42563
|
init_getTablesFilterByExtensions();
|
42441
42564
|
init_global();
|
42442
42565
|
init_schemaValidator();
|
@@ -42767,10 +42890,8 @@ var init_binary2 = __esm({
|
|
42767
42890
|
__publicField(this, "length", this.config.length);
|
42768
42891
|
}
|
42769
42892
|
mapFromDriverValue(value) {
|
42770
|
-
if (typeof value === "string")
|
42771
|
-
|
42772
|
-
if (Buffer.isBuffer(value))
|
42773
|
-
return value.toString();
|
42893
|
+
if (typeof value === "string") return value;
|
42894
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
42774
42895
|
const str = [];
|
42775
42896
|
for (const v of value) {
|
42776
42897
|
str.push(v === 49 ? "1" : "0");
|
@@ -43097,8 +43218,7 @@ var init_decimal2 = __esm({
|
|
43097
43218
|
__publicField(this, "unsigned", this.config.unsigned);
|
43098
43219
|
}
|
43099
43220
|
mapFromDriverValue(value) {
|
43100
|
-
if (typeof value === "string")
|
43101
|
-
return value;
|
43221
|
+
if (typeof value === "string") return value;
|
43102
43222
|
return String(value);
|
43103
43223
|
}
|
43104
43224
|
getSQLType() {
|
@@ -43140,8 +43260,7 @@ var init_decimal2 = __esm({
|
|
43140
43260
|
__publicField(this, "mapToDriverValue", String);
|
43141
43261
|
}
|
43142
43262
|
mapFromDriverValue(value) {
|
43143
|
-
if (typeof value === "number")
|
43144
|
-
return value;
|
43263
|
+
if (typeof value === "number") return value;
|
43145
43264
|
return Number(value);
|
43146
43265
|
}
|
43147
43266
|
getSQLType() {
|
@@ -43850,10 +43969,8 @@ var init_varbinary2 = __esm({
|
|
43850
43969
|
__publicField(this, "length", this.config.length);
|
43851
43970
|
}
|
43852
43971
|
mapFromDriverValue(value) {
|
43853
|
-
if (typeof value === "string")
|
43854
|
-
|
43855
|
-
if (Buffer.isBuffer(value))
|
43856
|
-
return value.toString();
|
43972
|
+
if (typeof value === "string") return value;
|
43973
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
43857
43974
|
const str = [];
|
43858
43975
|
for (const v of value) {
|
43859
43976
|
str.push(v === 49 ? "1" : "0");
|
@@ -44592,7 +44709,7 @@ var init_dialect4 = __esm({
|
|
44592
44709
|
init_casing();
|
44593
44710
|
init_column();
|
44594
44711
|
init_entity();
|
44595
|
-
|
44712
|
+
init_errors2();
|
44596
44713
|
init_relations();
|
44597
44714
|
init_expressions();
|
44598
44715
|
init_sql();
|
@@ -44646,8 +44763,7 @@ var init_dialect4 = __esm({
|
|
44646
44763
|
return `'${str.replace(/'/g, "''")}'`;
|
44647
44764
|
}
|
44648
44765
|
buildWithCTE(queries) {
|
44649
|
-
if (!queries?.length)
|
44650
|
-
return void 0;
|
44766
|
+
if (!queries?.length) return void 0;
|
44651
44767
|
const withSqlChunks = [sql`with `];
|
44652
44768
|
for (const [i, w] of queries.entries()) {
|
44653
44769
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -45581,8 +45697,7 @@ var init_select5 = __esm({
|
|
45581
45697
|
};
|
45582
45698
|
this.tableName = getTableLikeName(table6);
|
45583
45699
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
45584
|
-
for (const item of extractUsedTable4(table6))
|
45585
|
-
this.usedTables.add(item);
|
45700
|
+
for (const item of extractUsedTable4(table6)) this.usedTables.add(item);
|
45586
45701
|
}
|
45587
45702
|
/** @internal */
|
45588
45703
|
getUsedTables() {
|
@@ -45592,8 +45707,7 @@ var init_select5 = __esm({
|
|
45592
45707
|
return (table6, on) => {
|
45593
45708
|
const baseTableName = this.tableName;
|
45594
45709
|
const tableName = getTableLikeName(table6);
|
45595
|
-
for (const item of extractUsedTable4(table6))
|
45596
|
-
this.usedTables.add(item);
|
45710
|
+
for (const item of extractUsedTable4(table6)) this.usedTables.add(item);
|
45597
45711
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
45598
45712
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
45599
45713
|
}
|
@@ -45852,8 +45966,7 @@ var init_select5 = __esm({
|
|
45852
45966
|
const usedTables = [];
|
45853
45967
|
usedTables.push(...extractUsedTable4(this.config.table));
|
45854
45968
|
if (this.config.joins) {
|
45855
|
-
for (const it of this.config.joins)
|
45856
|
-
usedTables.push(...extractUsedTable4(it.table));
|
45969
|
+
for (const it of this.config.joins) usedTables.push(...extractUsedTable4(it.table));
|
45857
45970
|
}
|
45858
45971
|
return new Proxy(
|
45859
45972
|
new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
|
@@ -46411,9 +46524,9 @@ var init_session4 = __esm({
|
|
46411
46524
|
"use strict";
|
46412
46525
|
init_cache();
|
46413
46526
|
init_entity();
|
46414
|
-
|
46527
|
+
init_errors2();
|
46528
|
+
init_errors3();
|
46415
46529
|
init_sql();
|
46416
|
-
init_utils2();
|
46417
46530
|
init_db4();
|
46418
46531
|
_a434 = entityKind;
|
46419
46532
|
SingleStorePreparedQuery = class {
|
@@ -46433,20 +46546,36 @@ var init_session4 = __esm({
|
|
46433
46546
|
/** @internal */
|
46434
46547
|
async queryWithCache(queryString, params, query) {
|
46435
46548
|
if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
|
46436
|
-
|
46549
|
+
try {
|
46550
|
+
return await query();
|
46551
|
+
} catch (e) {
|
46552
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46553
|
+
}
|
46437
46554
|
}
|
46438
46555
|
if (this.cacheConfig && !this.cacheConfig.enable) {
|
46439
|
-
|
46556
|
+
try {
|
46557
|
+
return await query();
|
46558
|
+
} catch (e) {
|
46559
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46560
|
+
}
|
46440
46561
|
}
|
46441
46562
|
if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
|
46442
|
-
|
46443
|
-
|
46444
|
-
|
46445
|
-
|
46446
|
-
|
46563
|
+
try {
|
46564
|
+
const [res] = await Promise.all([
|
46565
|
+
query(),
|
46566
|
+
this.cache.onMutate({ tables: this.queryMetadata.tables })
|
46567
|
+
]);
|
46568
|
+
return res;
|
46569
|
+
} catch (e) {
|
46570
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46571
|
+
}
|
46447
46572
|
}
|
46448
46573
|
if (!this.cacheConfig) {
|
46449
|
-
|
46574
|
+
try {
|
46575
|
+
return await query();
|
46576
|
+
} catch (e) {
|
46577
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46578
|
+
}
|
46450
46579
|
}
|
46451
46580
|
if (this.queryMetadata.type === "select") {
|
46452
46581
|
const fromCache = await this.cache.get(
|
@@ -46456,7 +46585,12 @@ var init_session4 = __esm({
|
|
46456
46585
|
this.cacheConfig.autoInvalidate
|
46457
46586
|
);
|
46458
46587
|
if (fromCache === void 0) {
|
46459
|
-
|
46588
|
+
let result;
|
46589
|
+
try {
|
46590
|
+
result = await query();
|
46591
|
+
} catch (e) {
|
46592
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46593
|
+
}
|
46460
46594
|
await this.cache.put(
|
46461
46595
|
this.cacheConfig.tag ?? await hashQuery(queryString, params),
|
46462
46596
|
result,
|
@@ -46469,7 +46603,11 @@ var init_session4 = __esm({
|
|
46469
46603
|
}
|
46470
46604
|
return fromCache;
|
46471
46605
|
}
|
46472
|
-
|
46606
|
+
try {
|
46607
|
+
return await query();
|
46608
|
+
} catch (e) {
|
46609
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46610
|
+
}
|
46473
46611
|
}
|
46474
46612
|
};
|
46475
46613
|
__publicField(SingleStorePreparedQuery, _a434, "SingleStorePreparedQuery");
|