drizzle-kit 0.31.1-8eb999a → 0.31.1-a42461b
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 +443 -443
- package/api.d.ts +443 -443
- package/api.js +277 -338
- package/api.mjs +277 -337
- package/bin.cjs +20520 -20063
- package/package.json +10 -11
- package/utils.js +51 -181
- package/utils.mjs +51 -181
package/api.js
CHANGED
@@ -35,7 +35,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
35
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
36
36
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
37
37
|
|
38
|
-
// ../node_modules/.pnpm/chalk@5.
|
38
|
+
// ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
39
39
|
function assembleStyles() {
|
40
40
|
const codes = /* @__PURE__ */ new Map();
|
41
41
|
for (const [groupName, group] of Object.entries(styles)) {
|
@@ -152,7 +152,7 @@ function assembleStyles() {
|
|
152
152
|
}
|
153
153
|
var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
|
154
154
|
var init_ansi_styles = __esm({
|
155
|
-
"../node_modules/.pnpm/chalk@5.
|
155
|
+
"../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
|
156
156
|
"use strict";
|
157
157
|
ANSI_BACKGROUND_OFFSET = 10;
|
158
158
|
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
@@ -227,7 +227,7 @@ var init_ansi_styles = __esm({
|
|
227
227
|
}
|
228
228
|
});
|
229
229
|
|
230
|
-
// ../node_modules/.pnpm/chalk@5.
|
230
|
+
// ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
|
231
231
|
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
|
232
232
|
const prefix2 = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
233
233
|
const position = argv.indexOf(prefix2 + flag);
|
@@ -291,10 +291,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
291
291
|
return 1;
|
292
292
|
}
|
293
293
|
if ("CI" in env) {
|
294
|
-
if (
|
294
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
295
295
|
return 3;
|
296
296
|
}
|
297
|
-
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
297
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
298
298
|
return 1;
|
299
299
|
}
|
300
300
|
return min2;
|
@@ -339,7 +339,7 @@ function createSupportsColor(stream, options = {}) {
|
|
339
339
|
}
|
340
340
|
var import_node_process, import_node_os, import_node_tty, env, flagForceColor, supportsColor, supports_color_default;
|
341
341
|
var init_supports_color = __esm({
|
342
|
-
"../node_modules/.pnpm/chalk@5.
|
342
|
+
"../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js"() {
|
343
343
|
"use strict";
|
344
344
|
import_node_process = __toESM(require("process"), 1);
|
345
345
|
import_node_os = __toESM(require("os"), 1);
|
@@ -358,7 +358,7 @@ var init_supports_color = __esm({
|
|
358
358
|
}
|
359
359
|
});
|
360
360
|
|
361
|
-
// ../node_modules/.pnpm/chalk@5.
|
361
|
+
// ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
|
362
362
|
function stringReplaceAll(string, substring, replacer) {
|
363
363
|
let index6 = string.indexOf(substring);
|
364
364
|
if (index6 === -1) {
|
@@ -388,18 +388,18 @@ function stringEncaseCRLFWithFirstIndex(string, prefix2, postfix, index6) {
|
|
388
388
|
return returnValue;
|
389
389
|
}
|
390
390
|
var init_utilities = __esm({
|
391
|
-
"../node_modules/.pnpm/chalk@5.
|
391
|
+
"../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js"() {
|
392
392
|
"use strict";
|
393
393
|
}
|
394
394
|
});
|
395
395
|
|
396
|
-
// ../node_modules/.pnpm/chalk@5.
|
396
|
+
// ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
|
397
397
|
function createChalk(options) {
|
398
398
|
return chalkFactory(options);
|
399
399
|
}
|
400
400
|
var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
|
401
401
|
var init_source = __esm({
|
402
|
-
"../node_modules/.pnpm/chalk@5.
|
402
|
+
"../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js"() {
|
403
403
|
"use strict";
|
404
404
|
init_ansi_styles();
|
405
405
|
init_supports_color();
|
@@ -3438,7 +3438,7 @@ var init_global = __esm({
|
|
3438
3438
|
}
|
3439
3439
|
});
|
3440
3440
|
|
3441
|
-
// ../node_modules/.pnpm/zod@3.
|
3441
|
+
// ../node_modules/.pnpm/zod@3.23.7/node_modules/zod/lib/index.mjs
|
3442
3442
|
function getErrorMap() {
|
3443
3443
|
return overrideErrorMap;
|
3444
3444
|
}
|
@@ -3450,11 +3450,8 @@ function addIssueToContext(ctx, issueData) {
|
|
3450
3450
|
path: ctx.path,
|
3451
3451
|
errorMaps: [
|
3452
3452
|
ctx.common.contextualErrorMap,
|
3453
|
-
// contextual error map is first priority
|
3454
3453
|
ctx.schemaErrorMap,
|
3455
|
-
// then schema-bound map if available
|
3456
3454
|
overrideMap,
|
3457
|
-
// then global override map
|
3458
3455
|
overrideMap === errorMap ? void 0 : errorMap
|
3459
3456
|
// then global default map
|
3460
3457
|
].filter((x) => !!x)
|
@@ -3526,33 +3523,6 @@ function isValidIP(ip, version2) {
|
|
3526
3523
|
}
|
3527
3524
|
return false;
|
3528
3525
|
}
|
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
3526
|
function floatSafeRemainder(val, step) {
|
3557
3527
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
3558
3528
|
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
@@ -3632,9 +3602,9 @@ function createZodEnum(values, params) {
|
|
3632
3602
|
...processCreateParams(params)
|
3633
3603
|
});
|
3634
3604
|
}
|
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,
|
3605
|
+
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, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv6Regex, base64Regex, 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
3606
|
var init_lib = __esm({
|
3637
|
-
"../node_modules/.pnpm/zod@3.
|
3607
|
+
"../node_modules/.pnpm/zod@3.23.7/node_modules/zod/lib/index.mjs"() {
|
3638
3608
|
"use strict";
|
3639
3609
|
(function(util2) {
|
3640
3610
|
util2.assertEqual = (val) => val;
|
@@ -3784,9 +3754,6 @@ var init_lib = __esm({
|
|
3784
3754
|
"not_finite"
|
3785
3755
|
]);
|
3786
3756
|
ZodError = class _ZodError extends Error {
|
3787
|
-
get errors() {
|
3788
|
-
return this.issues;
|
3789
|
-
}
|
3790
3757
|
constructor(issues) {
|
3791
3758
|
super();
|
3792
3759
|
this.issues = [];
|
@@ -3805,6 +3772,9 @@ var init_lib = __esm({
|
|
3805
3772
|
this.name = "ZodError";
|
3806
3773
|
this.issues = issues;
|
3807
3774
|
}
|
3775
|
+
get errors() {
|
3776
|
+
return this.issues;
|
3777
|
+
}
|
3808
3778
|
format(_mapper) {
|
3809
3779
|
const mapper = _mapper || function(issue) {
|
3810
3780
|
return issue.message;
|
@@ -4106,6 +4076,34 @@ var init_lib = __esm({
|
|
4106
4076
|
}
|
4107
4077
|
};
|
4108
4078
|
ZodType = class {
|
4079
|
+
constructor(def) {
|
4080
|
+
this.spa = this.safeParseAsync;
|
4081
|
+
this._def = def;
|
4082
|
+
this.parse = this.parse.bind(this);
|
4083
|
+
this.safeParse = this.safeParse.bind(this);
|
4084
|
+
this.parseAsync = this.parseAsync.bind(this);
|
4085
|
+
this.safeParseAsync = this.safeParseAsync.bind(this);
|
4086
|
+
this.spa = this.spa.bind(this);
|
4087
|
+
this.refine = this.refine.bind(this);
|
4088
|
+
this.refinement = this.refinement.bind(this);
|
4089
|
+
this.superRefine = this.superRefine.bind(this);
|
4090
|
+
this.optional = this.optional.bind(this);
|
4091
|
+
this.nullable = this.nullable.bind(this);
|
4092
|
+
this.nullish = this.nullish.bind(this);
|
4093
|
+
this.array = this.array.bind(this);
|
4094
|
+
this.promise = this.promise.bind(this);
|
4095
|
+
this.or = this.or.bind(this);
|
4096
|
+
this.and = this.and.bind(this);
|
4097
|
+
this.transform = this.transform.bind(this);
|
4098
|
+
this.brand = this.brand.bind(this);
|
4099
|
+
this.default = this.default.bind(this);
|
4100
|
+
this.catch = this.catch.bind(this);
|
4101
|
+
this.describe = this.describe.bind(this);
|
4102
|
+
this.pipe = this.pipe.bind(this);
|
4103
|
+
this.readonly = this.readonly.bind(this);
|
4104
|
+
this.isNullable = this.isNullable.bind(this);
|
4105
|
+
this.isOptional = this.isOptional.bind(this);
|
4106
|
+
}
|
4109
4107
|
get description() {
|
4110
4108
|
return this._def.description;
|
4111
4109
|
}
|
@@ -4169,43 +4167,6 @@ var init_lib = __esm({
|
|
4169
4167
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
4170
4168
|
return handleResult(ctx, result);
|
4171
4169
|
}
|
4172
|
-
"~validate"(data) {
|
4173
|
-
var _a437, _b326;
|
4174
|
-
const ctx = {
|
4175
|
-
common: {
|
4176
|
-
issues: [],
|
4177
|
-
async: !!this["~standard"].async
|
4178
|
-
},
|
4179
|
-
path: [],
|
4180
|
-
schemaErrorMap: this._def.errorMap,
|
4181
|
-
parent: null,
|
4182
|
-
data,
|
4183
|
-
parsedType: getParsedType(data)
|
4184
|
-
};
|
4185
|
-
if (!this["~standard"].async) {
|
4186
|
-
try {
|
4187
|
-
const result = this._parseSync({ data, path: [], parent: ctx });
|
4188
|
-
return isValid(result) ? {
|
4189
|
-
value: result.value
|
4190
|
-
} : {
|
4191
|
-
issues: ctx.common.issues
|
4192
|
-
};
|
4193
|
-
} catch (err) {
|
4194
|
-
if ((_b326 = (_a437 = err === null || err === void 0 ? void 0 : err.message) === null || _a437 === void 0 ? void 0 : _a437.toLowerCase()) === null || _b326 === void 0 ? void 0 : _b326.includes("encountered")) {
|
4195
|
-
this["~standard"].async = true;
|
4196
|
-
}
|
4197
|
-
ctx.common = {
|
4198
|
-
issues: [],
|
4199
|
-
async: true
|
4200
|
-
};
|
4201
|
-
}
|
4202
|
-
}
|
4203
|
-
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
|
4204
|
-
value: result.value
|
4205
|
-
} : {
|
4206
|
-
issues: ctx.common.issues
|
4207
|
-
});
|
4208
|
-
}
|
4209
4170
|
async parseAsync(data, params) {
|
4210
4171
|
const result = await this.safeParseAsync(data, params);
|
4211
4172
|
if (result.success)
|
@@ -4283,39 +4244,6 @@ var init_lib = __esm({
|
|
4283
4244
|
superRefine(refinement) {
|
4284
4245
|
return this._refinement(refinement);
|
4285
4246
|
}
|
4286
|
-
constructor(def) {
|
4287
|
-
this.spa = this.safeParseAsync;
|
4288
|
-
this._def = def;
|
4289
|
-
this.parse = this.parse.bind(this);
|
4290
|
-
this.safeParse = this.safeParse.bind(this);
|
4291
|
-
this.parseAsync = this.parseAsync.bind(this);
|
4292
|
-
this.safeParseAsync = this.safeParseAsync.bind(this);
|
4293
|
-
this.spa = this.spa.bind(this);
|
4294
|
-
this.refine = this.refine.bind(this);
|
4295
|
-
this.refinement = this.refinement.bind(this);
|
4296
|
-
this.superRefine = this.superRefine.bind(this);
|
4297
|
-
this.optional = this.optional.bind(this);
|
4298
|
-
this.nullable = this.nullable.bind(this);
|
4299
|
-
this.nullish = this.nullish.bind(this);
|
4300
|
-
this.array = this.array.bind(this);
|
4301
|
-
this.promise = this.promise.bind(this);
|
4302
|
-
this.or = this.or.bind(this);
|
4303
|
-
this.and = this.and.bind(this);
|
4304
|
-
this.transform = this.transform.bind(this);
|
4305
|
-
this.brand = this.brand.bind(this);
|
4306
|
-
this.default = this.default.bind(this);
|
4307
|
-
this.catch = this.catch.bind(this);
|
4308
|
-
this.describe = this.describe.bind(this);
|
4309
|
-
this.pipe = this.pipe.bind(this);
|
4310
|
-
this.readonly = this.readonly.bind(this);
|
4311
|
-
this.isNullable = this.isNullable.bind(this);
|
4312
|
-
this.isOptional = this.isOptional.bind(this);
|
4313
|
-
this["~standard"] = {
|
4314
|
-
version: 1,
|
4315
|
-
vendor: "zod",
|
4316
|
-
validate: (data) => this["~validate"](data)
|
4317
|
-
};
|
4318
|
-
}
|
4319
4247
|
optional() {
|
4320
4248
|
return ZodOptional.create(this, this._def);
|
4321
4249
|
}
|
@@ -4326,7 +4254,7 @@ var init_lib = __esm({
|
|
4326
4254
|
return this.nullable().optional();
|
4327
4255
|
}
|
4328
4256
|
array() {
|
4329
|
-
return ZodArray.create(this);
|
4257
|
+
return ZodArray.create(this, this._def);
|
4330
4258
|
}
|
4331
4259
|
promise() {
|
4332
4260
|
return ZodPromise.create(this, this._def);
|
@@ -4392,19 +4320,15 @@ var init_lib = __esm({
|
|
4392
4320
|
};
|
4393
4321
|
cuidRegex = /^c[^\s-]{8,}$/i;
|
4394
4322
|
cuid2Regex = /^[0-9a-z]+$/;
|
4395
|
-
ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}
|
4323
|
+
ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
4396
4324
|
uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
4397
4325
|
nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
4398
|
-
jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
4399
4326
|
durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
4400
4327
|
emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
4401
4328
|
_emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
4402
4329
|
ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
4403
|
-
|
4404
|
-
ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
4405
|
-
ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
4330
|
+
ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
|
4406
4331
|
base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
4407
|
-
base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
4408
4332
|
dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
4409
4333
|
dateRegex = new RegExp(`^${dateRegexSource}$`);
|
4410
4334
|
ZodString = class _ZodString extends ZodType {
|
@@ -4663,26 +4587,6 @@ var init_lib = __esm({
|
|
4663
4587
|
});
|
4664
4588
|
status.dirty();
|
4665
4589
|
}
|
4666
|
-
} else if (check.kind === "jwt") {
|
4667
|
-
if (!isValidJWT(input.data, check.alg)) {
|
4668
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
4669
|
-
addIssueToContext(ctx, {
|
4670
|
-
validation: "jwt",
|
4671
|
-
code: ZodIssueCode.invalid_string,
|
4672
|
-
message: check.message
|
4673
|
-
});
|
4674
|
-
status.dirty();
|
4675
|
-
}
|
4676
|
-
} else if (check.kind === "cidr") {
|
4677
|
-
if (!isValidCidr(input.data, check.version)) {
|
4678
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
4679
|
-
addIssueToContext(ctx, {
|
4680
|
-
validation: "cidr",
|
4681
|
-
code: ZodIssueCode.invalid_string,
|
4682
|
-
message: check.message
|
4683
|
-
});
|
4684
|
-
status.dirty();
|
4685
|
-
}
|
4686
4590
|
} else if (check.kind === "base64") {
|
4687
4591
|
if (!base64Regex.test(input.data)) {
|
4688
4592
|
ctx = this._getOrReturnCtx(input, ctx);
|
@@ -4693,16 +4597,6 @@ var init_lib = __esm({
|
|
4693
4597
|
});
|
4694
4598
|
status.dirty();
|
4695
4599
|
}
|
4696
|
-
} else if (check.kind === "base64url") {
|
4697
|
-
if (!base64urlRegex.test(input.data)) {
|
4698
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
4699
|
-
addIssueToContext(ctx, {
|
4700
|
-
validation: "base64url",
|
4701
|
-
code: ZodIssueCode.invalid_string,
|
4702
|
-
message: check.message
|
4703
|
-
});
|
4704
|
-
status.dirty();
|
4705
|
-
}
|
4706
4600
|
} else {
|
4707
4601
|
util.assertNever(check);
|
4708
4602
|
}
|
@@ -4749,21 +4643,9 @@ var init_lib = __esm({
|
|
4749
4643
|
base64(message) {
|
4750
4644
|
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
4751
4645
|
}
|
4752
|
-
base64url(message) {
|
4753
|
-
return this._addCheck({
|
4754
|
-
kind: "base64url",
|
4755
|
-
...errorUtil.errToObj(message)
|
4756
|
-
});
|
4757
|
-
}
|
4758
|
-
jwt(options) {
|
4759
|
-
return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
|
4760
|
-
}
|
4761
4646
|
ip(options) {
|
4762
4647
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
4763
4648
|
}
|
4764
|
-
cidr(options) {
|
4765
|
-
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
4766
|
-
}
|
4767
4649
|
datetime(options) {
|
4768
4650
|
var _a437, _b326;
|
4769
4651
|
if (typeof options === "string") {
|
@@ -4854,7 +4736,8 @@ var init_lib = __esm({
|
|
4854
4736
|
});
|
4855
4737
|
}
|
4856
4738
|
/**
|
4857
|
-
*
|
4739
|
+
* @deprecated Use z.string().min(1) instead.
|
4740
|
+
* @see {@link ZodString.min}
|
4858
4741
|
*/
|
4859
4742
|
nonempty(message) {
|
4860
4743
|
return this.min(1, errorUtil.errToObj(message));
|
@@ -4916,15 +4799,9 @@ var init_lib = __esm({
|
|
4916
4799
|
get isIP() {
|
4917
4800
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
4918
4801
|
}
|
4919
|
-
get isCIDR() {
|
4920
|
-
return !!this._def.checks.find((ch) => ch.kind === "cidr");
|
4921
|
-
}
|
4922
4802
|
get isBase64() {
|
4923
4803
|
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
4924
4804
|
}
|
4925
|
-
get isBase64url() {
|
4926
|
-
return !!this._def.checks.find((ch) => ch.kind === "base64url");
|
4927
|
-
}
|
4928
4805
|
get minLength() {
|
4929
4806
|
let min2 = null;
|
4930
4807
|
for (const ch of this._def.checks) {
|
@@ -5194,15 +5071,17 @@ var init_lib = __esm({
|
|
5194
5071
|
}
|
5195
5072
|
_parse(input) {
|
5196
5073
|
if (this._def.coerce) {
|
5197
|
-
|
5198
|
-
input.data = BigInt(input.data);
|
5199
|
-
} catch (_a437) {
|
5200
|
-
return this._getInvalidInput(input);
|
5201
|
-
}
|
5074
|
+
input.data = BigInt(input.data);
|
5202
5075
|
}
|
5203
5076
|
const parsedType = this._getType(input);
|
5204
5077
|
if (parsedType !== ZodParsedType.bigint) {
|
5205
|
-
|
5078
|
+
const ctx2 = this._getOrReturnCtx(input);
|
5079
|
+
addIssueToContext(ctx2, {
|
5080
|
+
code: ZodIssueCode.invalid_type,
|
5081
|
+
expected: ZodParsedType.bigint,
|
5082
|
+
received: ctx2.parsedType
|
5083
|
+
});
|
5084
|
+
return INVALID;
|
5206
5085
|
}
|
5207
5086
|
let ctx = void 0;
|
5208
5087
|
const status = new ParseStatus();
|
@@ -5249,15 +5128,6 @@ var init_lib = __esm({
|
|
5249
5128
|
}
|
5250
5129
|
return { status: status.value, value: input.data };
|
5251
5130
|
}
|
5252
|
-
_getInvalidInput(input) {
|
5253
|
-
const ctx = this._getOrReturnCtx(input);
|
5254
|
-
addIssueToContext(ctx, {
|
5255
|
-
code: ZodIssueCode.invalid_type,
|
5256
|
-
expected: ZodParsedType.bigint,
|
5257
|
-
received: ctx.parsedType
|
5258
|
-
});
|
5259
|
-
return INVALID;
|
5260
|
-
}
|
5261
5131
|
gte(value, message) {
|
5262
5132
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
5263
5133
|
}
|
@@ -22096,8 +21966,7 @@ var init_column_builder = __esm({
|
|
22096
21966
|
}
|
22097
21967
|
/** @internal Sets the name of the column to the key within the table definition if a name was not given. */
|
22098
21968
|
setName(name2) {
|
22099
|
-
if (this.config.name !== "")
|
22100
|
-
return;
|
21969
|
+
if (this.config.name !== "") return;
|
22101
21970
|
this.config.name = name2;
|
22102
21971
|
}
|
22103
21972
|
};
|
@@ -22529,8 +22398,7 @@ var init_common2 = __esm({
|
|
22529
22398
|
const a = value.map(
|
22530
22399
|
(v) => v === null ? null : is(this.baseColumn, _PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v)
|
22531
22400
|
);
|
22532
|
-
if (isNestedArray)
|
22533
|
-
return a;
|
22401
|
+
if (isNestedArray) return a;
|
22534
22402
|
return makePgArray(a);
|
22535
22403
|
}
|
22536
22404
|
};
|
@@ -22663,7 +22531,7 @@ var version;
|
|
22663
22531
|
var init_version = __esm({
|
22664
22532
|
"../drizzle-orm/dist/version.js"() {
|
22665
22533
|
"use strict";
|
22666
|
-
version = "0.
|
22534
|
+
version = "0.44.0";
|
22667
22535
|
}
|
22668
22536
|
});
|
22669
22537
|
|
@@ -23533,8 +23401,7 @@ function mapUpdateSet(table6, values) {
|
|
23533
23401
|
function applyMixins(baseClass, extendedClasses) {
|
23534
23402
|
for (const extendedClass of extendedClasses) {
|
23535
23403
|
for (const name2 of Object.getOwnPropertyNames(extendedClass.prototype)) {
|
23536
|
-
if (name2 === "constructor")
|
23537
|
-
continue;
|
23404
|
+
if (name2 === "constructor") continue;
|
23538
23405
|
Object.defineProperty(
|
23539
23406
|
baseClass.prototype,
|
23540
23407
|
name2,
|
@@ -23549,15 +23416,6 @@ function getTableColumns(table6) {
|
|
23549
23416
|
function getViewSelectedFields(view5) {
|
23550
23417
|
return view5[ViewBaseConfig].selectedFields;
|
23551
23418
|
}
|
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
23419
|
function getTableLikeName(table6) {
|
23562
23420
|
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
23421
|
}
|
@@ -23568,54 +23426,43 @@ function getColumnNameAndConfig(a, b) {
|
|
23568
23426
|
};
|
23569
23427
|
}
|
23570
23428
|
function isConfig(data) {
|
23571
|
-
if (typeof data !== "object" || data === null)
|
23572
|
-
|
23573
|
-
if (data.constructor.name !== "Object")
|
23574
|
-
return false;
|
23429
|
+
if (typeof data !== "object" || data === null) return false;
|
23430
|
+
if (data.constructor.name !== "Object") return false;
|
23575
23431
|
if ("logger" in data) {
|
23576
23432
|
const type = typeof data["logger"];
|
23577
|
-
if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined")
|
23578
|
-
return false;
|
23433
|
+
if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined") return false;
|
23579
23434
|
return true;
|
23580
23435
|
}
|
23581
23436
|
if ("schema" in data) {
|
23582
23437
|
const type = typeof data["schema"];
|
23583
|
-
if (type !== "object" && type !== "undefined")
|
23584
|
-
return false;
|
23438
|
+
if (type !== "object" && type !== "undefined") return false;
|
23585
23439
|
return true;
|
23586
23440
|
}
|
23587
23441
|
if ("casing" in data) {
|
23588
23442
|
const type = typeof data["casing"];
|
23589
|
-
if (type !== "string" && type !== "undefined")
|
23590
|
-
return false;
|
23443
|
+
if (type !== "string" && type !== "undefined") return false;
|
23591
23444
|
return true;
|
23592
23445
|
}
|
23593
23446
|
if ("mode" in data) {
|
23594
|
-
if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== void 0)
|
23595
|
-
return false;
|
23447
|
+
if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== void 0) return false;
|
23596
23448
|
return true;
|
23597
23449
|
}
|
23598
23450
|
if ("connection" in data) {
|
23599
23451
|
const type = typeof data["connection"];
|
23600
|
-
if (type !== "string" && type !== "object" && type !== "undefined")
|
23601
|
-
return false;
|
23452
|
+
if (type !== "string" && type !== "object" && type !== "undefined") return false;
|
23602
23453
|
return true;
|
23603
23454
|
}
|
23604
23455
|
if ("client" in data) {
|
23605
23456
|
const type = typeof data["client"];
|
23606
|
-
if (type !== "object" && type !== "function" && type !== "undefined")
|
23607
|
-
return false;
|
23457
|
+
if (type !== "object" && type !== "function" && type !== "undefined") return false;
|
23608
23458
|
return true;
|
23609
23459
|
}
|
23610
|
-
if (Object.keys(data).length === 0)
|
23611
|
-
return true;
|
23460
|
+
if (Object.keys(data).length === 0) return true;
|
23612
23461
|
return false;
|
23613
23462
|
}
|
23614
|
-
var crypto;
|
23615
23463
|
var init_utils2 = __esm({
|
23616
23464
|
"../drizzle-orm/dist/utils.js"() {
|
23617
23465
|
"use strict";
|
23618
|
-
crypto = __toESM(require("crypto"), 1);
|
23619
23466
|
init_column();
|
23620
23467
|
init_entity();
|
23621
23468
|
init_sql();
|
@@ -24428,8 +24275,7 @@ var init_numeric = __esm({
|
|
24428
24275
|
this.scale = config.scale;
|
24429
24276
|
}
|
24430
24277
|
mapFromDriverValue(value) {
|
24431
|
-
if (typeof value === "string")
|
24432
|
-
return value;
|
24278
|
+
if (typeof value === "string") return value;
|
24433
24279
|
return String(value);
|
24434
24280
|
}
|
24435
24281
|
getSQLType() {
|
@@ -24468,8 +24314,7 @@ var init_numeric = __esm({
|
|
24468
24314
|
this.scale = config.scale;
|
24469
24315
|
}
|
24470
24316
|
mapFromDriverValue(value) {
|
24471
|
-
if (typeof value === "number")
|
24472
|
-
return value;
|
24317
|
+
if (typeof value === "number") return value;
|
24473
24318
|
return Number(value);
|
24474
24319
|
}
|
24475
24320
|
getSQLType() {
|
@@ -26083,7 +25928,6 @@ __export(dist_exports, {
|
|
26083
25928
|
gte: () => gte,
|
26084
25929
|
hammingDistance: () => hammingDistance,
|
26085
25930
|
hasOwnEntityKind: () => hasOwnEntityKind,
|
26086
|
-
hashQuery: () => hashQuery,
|
26087
25931
|
haveSameKeys: () => haveSameKeys,
|
26088
25932
|
ilike: () => ilike,
|
26089
25933
|
inArray: () => inArray,
|
@@ -26506,8 +26350,7 @@ var init_casing = __esm({
|
|
26506
26350
|
this.convert = casing2 === "snake_case" ? toSnakeCase : casing2 === "camelCase" ? toCamelCase : noopCase;
|
26507
26351
|
}
|
26508
26352
|
getColumnCasing(column6) {
|
26509
|
-
if (!column6.keyAsName)
|
26510
|
-
return column6.name;
|
26353
|
+
if (!column6.keyAsName) return column6.name;
|
26511
26354
|
const schema5 = column6.table[Table2.Symbol.Schema] ?? "public";
|
26512
26355
|
const tableName = column6.table[Table2.Symbol.OriginalName];
|
26513
26356
|
const key = `${schema5}.${tableName}.${column6.name}`;
|
@@ -26616,8 +26459,7 @@ var init_dialect = __esm({
|
|
26616
26459
|
return `'${str.replace(/'/g, "''")}'`;
|
26617
26460
|
}
|
26618
26461
|
buildWithCTE(queries) {
|
26619
|
-
if (!queries?.length)
|
26620
|
-
return void 0;
|
26462
|
+
if (!queries?.length) return void 0;
|
26621
26463
|
const withSqlChunks = [sql`with `];
|
26622
26464
|
for (const [i, w] of queries.entries()) {
|
26623
26465
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -28167,8 +28009,7 @@ var init_select2 = __esm({
|
|
28167
28009
|
};
|
28168
28010
|
this.tableName = getTableLikeName(table6);
|
28169
28011
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
28170
|
-
for (const item of extractUsedTable(table6))
|
28171
|
-
this.usedTables.add(item);
|
28012
|
+
for (const item of extractUsedTable(table6)) this.usedTables.add(item);
|
28172
28013
|
}
|
28173
28014
|
/** @internal */
|
28174
28015
|
getUsedTables() {
|
@@ -28178,8 +28019,7 @@ var init_select2 = __esm({
|
|
28178
28019
|
return (table6, on) => {
|
28179
28020
|
const baseTableName = this.tableName;
|
28180
28021
|
const tableName = getTableLikeName(table6);
|
28181
|
-
for (const item of extractUsedTable(table6))
|
28182
|
-
this.usedTables.add(item);
|
28022
|
+
for (const item of extractUsedTable(table6)) this.usedTables.add(item);
|
28183
28023
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
28184
28024
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
28185
28025
|
}
|
@@ -28440,8 +28280,7 @@ var init_select2 = __esm({
|
|
28440
28280
|
const usedTables = [];
|
28441
28281
|
usedTables.push(...extractUsedTable(this.config.table));
|
28442
28282
|
if (this.config.joins) {
|
28443
|
-
for (const it of this.config.joins)
|
28444
|
-
usedTables.push(...extractUsedTable(it.table));
|
28283
|
+
for (const it of this.config.joins) usedTables.push(...extractUsedTable(it.table));
|
28445
28284
|
}
|
28446
28285
|
return new Proxy(
|
28447
28286
|
new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
|
@@ -30223,6 +30062,15 @@ var init_schema = __esm({
|
|
30223
30062
|
});
|
30224
30063
|
|
30225
30064
|
// ../drizzle-orm/dist/cache/core/cache.js
|
30065
|
+
async function hashQuery(sql2, params) {
|
30066
|
+
const dataToHash = `${sql2}-${JSON.stringify(params)}`;
|
30067
|
+
const encoder = new TextEncoder();
|
30068
|
+
const data = encoder.encode(dataToHash);
|
30069
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
30070
|
+
const hashArray = [...new Uint8Array(hashBuffer)];
|
30071
|
+
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
30072
|
+
return hashHex;
|
30073
|
+
}
|
30226
30074
|
var _a165, Cache, _a166, _b119, NoopCache;
|
30227
30075
|
var init_cache = __esm({
|
30228
30076
|
"../drizzle-orm/dist/cache/core/cache.js"() {
|
@@ -30248,6 +30096,25 @@ var init_cache = __esm({
|
|
30248
30096
|
}
|
30249
30097
|
});
|
30250
30098
|
|
30099
|
+
// ../drizzle-orm/dist/errors/index.js
|
30100
|
+
var DrizzleQueryError;
|
30101
|
+
var init_errors2 = __esm({
|
30102
|
+
"../drizzle-orm/dist/errors/index.js"() {
|
30103
|
+
"use strict";
|
30104
|
+
DrizzleQueryError = class _DrizzleQueryError extends Error {
|
30105
|
+
constructor(query, params, cause) {
|
30106
|
+
super(`Failed query: ${query}
|
30107
|
+
params: ${params}`);
|
30108
|
+
this.query = query;
|
30109
|
+
this.params = params;
|
30110
|
+
this.cause = cause;
|
30111
|
+
Error.captureStackTrace(this, _DrizzleQueryError);
|
30112
|
+
if (cause) this.cause = cause;
|
30113
|
+
}
|
30114
|
+
};
|
30115
|
+
}
|
30116
|
+
});
|
30117
|
+
|
30251
30118
|
// ../drizzle-orm/dist/pg-core/session.js
|
30252
30119
|
var _a167, PgPreparedQuery, _a168, PgSession, _a169, _b120, PgTransaction;
|
30253
30120
|
var init_session = __esm({
|
@@ -30256,9 +30123,9 @@ var init_session = __esm({
|
|
30256
30123
|
init_cache();
|
30257
30124
|
init_entity();
|
30258
30125
|
init_errors();
|
30126
|
+
init_errors2();
|
30259
30127
|
init_sql2();
|
30260
30128
|
init_tracing();
|
30261
|
-
init_utils2();
|
30262
30129
|
init_db();
|
30263
30130
|
_a167 = entityKind;
|
30264
30131
|
PgPreparedQuery = class {
|
@@ -30291,20 +30158,36 @@ var init_session = __esm({
|
|
30291
30158
|
/** @internal */
|
30292
30159
|
async queryWithCache(queryString, params, query) {
|
30293
30160
|
if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
|
30294
|
-
|
30161
|
+
try {
|
30162
|
+
return await query();
|
30163
|
+
} catch (e) {
|
30164
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30165
|
+
}
|
30295
30166
|
}
|
30296
30167
|
if (this.cacheConfig && !this.cacheConfig.enable) {
|
30297
|
-
|
30168
|
+
try {
|
30169
|
+
return await query();
|
30170
|
+
} catch (e) {
|
30171
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30172
|
+
}
|
30298
30173
|
}
|
30299
30174
|
if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
|
30300
|
-
|
30301
|
-
|
30302
|
-
|
30303
|
-
|
30304
|
-
|
30175
|
+
try {
|
30176
|
+
const [res] = await Promise.all([
|
30177
|
+
query(),
|
30178
|
+
this.cache.onMutate({ tables: this.queryMetadata.tables })
|
30179
|
+
]);
|
30180
|
+
return res;
|
30181
|
+
} catch (e) {
|
30182
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30183
|
+
}
|
30305
30184
|
}
|
30306
30185
|
if (!this.cacheConfig) {
|
30307
|
-
|
30186
|
+
try {
|
30187
|
+
return await query();
|
30188
|
+
} catch (e) {
|
30189
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30190
|
+
}
|
30308
30191
|
}
|
30309
30192
|
if (this.queryMetadata.type === "select") {
|
30310
30193
|
const fromCache = await this.cache.get(
|
@@ -30314,7 +30197,12 @@ var init_session = __esm({
|
|
30314
30197
|
this.cacheConfig.autoInvalidate
|
30315
30198
|
);
|
30316
30199
|
if (fromCache === void 0) {
|
30317
|
-
|
30200
|
+
let result;
|
30201
|
+
try {
|
30202
|
+
result = await query();
|
30203
|
+
} catch (e) {
|
30204
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30205
|
+
}
|
30318
30206
|
await this.cache.put(
|
30319
30207
|
this.cacheConfig.tag ?? await hashQuery(queryString, params),
|
30320
30208
|
result,
|
@@ -30327,7 +30215,11 @@ var init_session = __esm({
|
|
30327
30215
|
}
|
30328
30216
|
return fromCache;
|
30329
30217
|
}
|
30330
|
-
|
30218
|
+
try {
|
30219
|
+
return await query();
|
30220
|
+
} catch (e) {
|
30221
|
+
throw new DrizzleQueryError(queryString, params, e);
|
30222
|
+
}
|
30331
30223
|
}
|
30332
30224
|
};
|
30333
30225
|
__publicField(PgPreparedQuery, _a167, "PgPreparedQuery");
|
@@ -32664,8 +32556,7 @@ var init_numeric2 = __esm({
|
|
32664
32556
|
__publicField(SQLiteNumericBuilder, _a195, "SQLiteNumericBuilder");
|
32665
32557
|
SQLiteNumeric = class extends (_b140 = SQLiteColumn, _a196 = entityKind, _b140) {
|
32666
32558
|
mapFromDriverValue(value) {
|
32667
|
-
if (typeof value === "string")
|
32668
|
-
return value;
|
32559
|
+
if (typeof value === "string") return value;
|
32669
32560
|
return String(value);
|
32670
32561
|
}
|
32671
32562
|
getSQLType() {
|
@@ -32692,8 +32583,7 @@ var init_numeric2 = __esm({
|
|
32692
32583
|
__publicField(this, "mapToDriverValue", String);
|
32693
32584
|
}
|
32694
32585
|
mapFromDriverValue(value) {
|
32695
|
-
if (typeof value === "number")
|
32696
|
-
return value;
|
32586
|
+
if (typeof value === "number") return value;
|
32697
32587
|
return Number(value);
|
32698
32588
|
}
|
32699
32589
|
getSQLType() {
|
@@ -33256,8 +33146,7 @@ var init_dialect2 = __esm({
|
|
33256
33146
|
return `'${str.replace(/'/g, "''")}'`;
|
33257
33147
|
}
|
33258
33148
|
buildWithCTE(queries) {
|
33259
|
-
if (!queries?.length)
|
33260
|
-
return void 0;
|
33149
|
+
if (!queries?.length) return void 0;
|
33261
33150
|
const withSqlChunks = [sql`with `];
|
33262
33151
|
for (const [i, w] of queries.entries()) {
|
33263
33152
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -34208,8 +34097,7 @@ var init_select3 = __esm({
|
|
34208
34097
|
};
|
34209
34098
|
this.tableName = getTableLikeName(table6);
|
34210
34099
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
34211
|
-
for (const item of extractUsedTable2(table6))
|
34212
|
-
this.usedTables.add(item);
|
34100
|
+
for (const item of extractUsedTable2(table6)) this.usedTables.add(item);
|
34213
34101
|
}
|
34214
34102
|
/** @internal */
|
34215
34103
|
getUsedTables() {
|
@@ -34219,8 +34107,7 @@ var init_select3 = __esm({
|
|
34219
34107
|
return (table6, on) => {
|
34220
34108
|
const baseTableName = this.tableName;
|
34221
34109
|
const tableName = getTableLikeName(table6);
|
34222
|
-
for (const item of extractUsedTable2(table6))
|
34223
|
-
this.usedTables.add(item);
|
34110
|
+
for (const item of extractUsedTable2(table6)) this.usedTables.add(item);
|
34224
34111
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
34225
34112
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
34226
34113
|
}
|
@@ -34467,8 +34354,7 @@ var init_select3 = __esm({
|
|
34467
34354
|
const usedTables = [];
|
34468
34355
|
usedTables.push(...extractUsedTable2(this.config.table));
|
34469
34356
|
if (this.config.joins) {
|
34470
|
-
for (const it of this.config.joins)
|
34471
|
-
usedTables.push(...extractUsedTable2(it.table));
|
34357
|
+
for (const it of this.config.joins) usedTables.push(...extractUsedTable2(it.table));
|
34472
34358
|
}
|
34473
34359
|
return new Proxy(
|
34474
34360
|
new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
|
@@ -34726,8 +34612,7 @@ var init_insert2 = __esm({
|
|
34726
34612
|
* ```
|
34727
34613
|
*/
|
34728
34614
|
onConflictDoNothing(config = {}) {
|
34729
|
-
if (!this.config.onConflict)
|
34730
|
-
this.config.onConflict = [];
|
34615
|
+
if (!this.config.onConflict) this.config.onConflict = [];
|
34731
34616
|
if (config.target === void 0) {
|
34732
34617
|
this.config.onConflict.push(sql` on conflict do nothing`);
|
34733
34618
|
} else {
|
@@ -34772,8 +34657,7 @@ var init_insert2 = __esm({
|
|
34772
34657
|
'You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.'
|
34773
34658
|
);
|
34774
34659
|
}
|
34775
|
-
if (!this.config.onConflict)
|
34776
|
-
this.config.onConflict = [];
|
34660
|
+
if (!this.config.onConflict) this.config.onConflict = [];
|
34777
34661
|
const whereSql = config.where ? sql` where ${config.where}` : void 0;
|
34778
34662
|
const targetWhereSql = config.targetWhere ? sql` where ${config.targetWhere}` : void 0;
|
34779
34663
|
const setWhereSql = config.setWhere ? sql` where ${config.setWhere}` : void 0;
|
@@ -35580,8 +35464,8 @@ var init_session2 = __esm({
|
|
35580
35464
|
init_cache();
|
35581
35465
|
init_entity();
|
35582
35466
|
init_errors();
|
35467
|
+
init_errors2();
|
35583
35468
|
init_query_promise();
|
35584
|
-
init_utils2();
|
35585
35469
|
init_db2();
|
35586
35470
|
ExecuteResultSync = class extends (_b164 = QueryPromise, _a232 = entityKind, _b164) {
|
35587
35471
|
constructor(resultCb) {
|
@@ -35617,20 +35501,36 @@ var init_session2 = __esm({
|
|
35617
35501
|
/** @internal */
|
35618
35502
|
async queryWithCache(queryString, params, query) {
|
35619
35503
|
if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
|
35620
|
-
|
35504
|
+
try {
|
35505
|
+
return await query();
|
35506
|
+
} catch (e) {
|
35507
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35508
|
+
}
|
35621
35509
|
}
|
35622
35510
|
if (this.cacheConfig && !this.cacheConfig.enable) {
|
35623
|
-
|
35511
|
+
try {
|
35512
|
+
return await query();
|
35513
|
+
} catch (e) {
|
35514
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35515
|
+
}
|
35624
35516
|
}
|
35625
35517
|
if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
|
35626
|
-
|
35627
|
-
|
35628
|
-
|
35629
|
-
|
35630
|
-
|
35518
|
+
try {
|
35519
|
+
const [res] = await Promise.all([
|
35520
|
+
query(),
|
35521
|
+
this.cache.onMutate({ tables: this.queryMetadata.tables })
|
35522
|
+
]);
|
35523
|
+
return res;
|
35524
|
+
} catch (e) {
|
35525
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35526
|
+
}
|
35631
35527
|
}
|
35632
35528
|
if (!this.cacheConfig) {
|
35633
|
-
|
35529
|
+
try {
|
35530
|
+
return await query();
|
35531
|
+
} catch (e) {
|
35532
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35533
|
+
}
|
35634
35534
|
}
|
35635
35535
|
if (this.queryMetadata.type === "select") {
|
35636
35536
|
const fromCache = await this.cache.get(
|
@@ -35640,7 +35540,12 @@ var init_session2 = __esm({
|
|
35640
35540
|
this.cacheConfig.autoInvalidate
|
35641
35541
|
);
|
35642
35542
|
if (fromCache === void 0) {
|
35643
|
-
|
35543
|
+
let result;
|
35544
|
+
try {
|
35545
|
+
result = await query();
|
35546
|
+
} catch (e) {
|
35547
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35548
|
+
}
|
35644
35549
|
await this.cache.put(
|
35645
35550
|
this.cacheConfig.tag ?? await hashQuery(queryString, params),
|
35646
35551
|
result,
|
@@ -35653,7 +35558,11 @@ var init_session2 = __esm({
|
|
35653
35558
|
}
|
35654
35559
|
return fromCache;
|
35655
35560
|
}
|
35656
|
-
|
35561
|
+
try {
|
35562
|
+
return await query();
|
35563
|
+
} catch (e) {
|
35564
|
+
throw new DrizzleQueryError(queryString, params, e);
|
35565
|
+
}
|
35657
35566
|
}
|
35658
35567
|
getQuery() {
|
35659
35568
|
return this.query;
|
@@ -36925,10 +36834,8 @@ var init_binary = __esm({
|
|
36925
36834
|
__publicField(this, "length", this.config.length);
|
36926
36835
|
}
|
36927
36836
|
mapFromDriverValue(value) {
|
36928
|
-
if (typeof value === "string")
|
36929
|
-
|
36930
|
-
if (Buffer.isBuffer(value))
|
36931
|
-
return value.toString();
|
36837
|
+
if (typeof value === "string") return value;
|
36838
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
36932
36839
|
const str = [];
|
36933
36840
|
for (const v of value) {
|
36934
36841
|
str.push(v === 49 ? "1" : "0");
|
@@ -37250,8 +37157,7 @@ var init_decimal = __esm({
|
|
37250
37157
|
__publicField(this, "unsigned", this.config.unsigned);
|
37251
37158
|
}
|
37252
37159
|
mapFromDriverValue(value) {
|
37253
|
-
if (typeof value === "string")
|
37254
|
-
return value;
|
37160
|
+
if (typeof value === "string") return value;
|
37255
37161
|
return String(value);
|
37256
37162
|
}
|
37257
37163
|
getSQLType() {
|
@@ -37293,8 +37199,7 @@ var init_decimal = __esm({
|
|
37293
37199
|
__publicField(this, "mapToDriverValue", String);
|
37294
37200
|
}
|
37295
37201
|
mapFromDriverValue(value) {
|
37296
|
-
if (typeof value === "number")
|
37297
|
-
return value;
|
37202
|
+
if (typeof value === "number") return value;
|
37298
37203
|
return Number(value);
|
37299
37204
|
}
|
37300
37205
|
getSQLType() {
|
@@ -38023,10 +37928,8 @@ var init_varbinary = __esm({
|
|
38023
37928
|
__publicField(this, "length", this.config.length);
|
38024
37929
|
}
|
38025
37930
|
mapFromDriverValue(value) {
|
38026
|
-
if (typeof value === "string")
|
38027
|
-
|
38028
|
-
if (Buffer.isBuffer(value))
|
38029
|
-
return value.toString();
|
37931
|
+
if (typeof value === "string") return value;
|
37932
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
38030
37933
|
const str = [];
|
38031
37934
|
for (const v of value) {
|
38032
37935
|
str.push(v === 49 ? "1" : "0");
|
@@ -38690,8 +38593,7 @@ var init_dialect3 = __esm({
|
|
38690
38593
|
return `'${str.replace(/'/g, "''")}'`;
|
38691
38594
|
}
|
38692
38595
|
buildWithCTE(queries) {
|
38693
|
-
if (!queries?.length)
|
38694
|
-
return void 0;
|
38596
|
+
if (!queries?.length) return void 0;
|
38695
38597
|
const withSqlChunks = [sql`with `];
|
38696
38598
|
for (const [i, w] of queries.entries()) {
|
38697
38599
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -39971,8 +39873,7 @@ var init_select4 = __esm({
|
|
39971
39873
|
};
|
39972
39874
|
this.tableName = getTableLikeName(table6);
|
39973
39875
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
39974
|
-
for (const item of extractUsedTable3(table6))
|
39975
|
-
this.usedTables.add(item);
|
39876
|
+
for (const item of extractUsedTable3(table6)) this.usedTables.add(item);
|
39976
39877
|
}
|
39977
39878
|
/** @internal */
|
39978
39879
|
getUsedTables() {
|
@@ -39985,8 +39886,7 @@ var init_select4 = __esm({
|
|
39985
39886
|
const onIndex = isCrossJoin ? a : b;
|
39986
39887
|
const baseTableName = this.tableName;
|
39987
39888
|
const tableName = getTableLikeName(table6);
|
39988
|
-
for (const item of extractUsedTable3(table6))
|
39989
|
-
this.usedTables.add(item);
|
39889
|
+
for (const item of extractUsedTable3(table6)) this.usedTables.add(item);
|
39990
39890
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
39991
39891
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
39992
39892
|
}
|
@@ -40254,8 +40154,7 @@ var init_select4 = __esm({
|
|
40254
40154
|
const usedTables = [];
|
40255
40155
|
usedTables.push(...extractUsedTable3(this.config.table));
|
40256
40156
|
if (this.config.joins) {
|
40257
|
-
for (const it of this.config.joins)
|
40258
|
-
usedTables.push(...extractUsedTable3(it.table));
|
40157
|
+
for (const it of this.config.joins) usedTables.push(...extractUsedTable3(it.table));
|
40259
40158
|
}
|
40260
40159
|
return new Proxy(
|
40261
40160
|
new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
|
@@ -41205,8 +41104,8 @@ var init_session3 = __esm({
|
|
41205
41104
|
init_cache();
|
41206
41105
|
init_entity();
|
41207
41106
|
init_errors();
|
41107
|
+
init_errors2();
|
41208
41108
|
init_sql();
|
41209
|
-
init_utils2();
|
41210
41109
|
init_db3();
|
41211
41110
|
_a341 = entityKind;
|
41212
41111
|
MySqlPreparedQuery = class {
|
@@ -41226,20 +41125,36 @@ var init_session3 = __esm({
|
|
41226
41125
|
/** @internal */
|
41227
41126
|
async queryWithCache(queryString, params, query) {
|
41228
41127
|
if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
|
41229
|
-
|
41128
|
+
try {
|
41129
|
+
return await query();
|
41130
|
+
} catch (e) {
|
41131
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41132
|
+
}
|
41230
41133
|
}
|
41231
41134
|
if (this.cacheConfig && !this.cacheConfig.enable) {
|
41232
|
-
|
41135
|
+
try {
|
41136
|
+
return await query();
|
41137
|
+
} catch (e) {
|
41138
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41139
|
+
}
|
41233
41140
|
}
|
41234
41141
|
if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
|
41235
|
-
|
41236
|
-
|
41237
|
-
|
41238
|
-
|
41239
|
-
|
41142
|
+
try {
|
41143
|
+
const [res] = await Promise.all([
|
41144
|
+
query(),
|
41145
|
+
this.cache.onMutate({ tables: this.queryMetadata.tables })
|
41146
|
+
]);
|
41147
|
+
return res;
|
41148
|
+
} catch (e) {
|
41149
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41150
|
+
}
|
41240
41151
|
}
|
41241
41152
|
if (!this.cacheConfig) {
|
41242
|
-
|
41153
|
+
try {
|
41154
|
+
return await query();
|
41155
|
+
} catch (e) {
|
41156
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41157
|
+
}
|
41243
41158
|
}
|
41244
41159
|
if (this.queryMetadata.type === "select") {
|
41245
41160
|
const fromCache = await this.cache.get(
|
@@ -41249,7 +41164,12 @@ var init_session3 = __esm({
|
|
41249
41164
|
this.cacheConfig.autoInvalidate
|
41250
41165
|
);
|
41251
41166
|
if (fromCache === void 0) {
|
41252
|
-
|
41167
|
+
let result;
|
41168
|
+
try {
|
41169
|
+
result = await query();
|
41170
|
+
} catch (e) {
|
41171
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41172
|
+
}
|
41253
41173
|
await this.cache.put(
|
41254
41174
|
this.cacheConfig.tag ?? await hashQuery(queryString, params),
|
41255
41175
|
result,
|
@@ -41262,7 +41182,11 @@ var init_session3 = __esm({
|
|
41262
41182
|
}
|
41263
41183
|
return fromCache;
|
41264
41184
|
}
|
41265
|
-
|
41185
|
+
try {
|
41186
|
+
return await query();
|
41187
|
+
} catch (e) {
|
41188
|
+
throw new DrizzleQueryError(queryString, params, e);
|
41189
|
+
}
|
41266
41190
|
}
|
41267
41191
|
};
|
41268
41192
|
__publicField(MySqlPreparedQuery, _a341, "MySqlPreparedQuery");
|
@@ -42767,10 +42691,8 @@ var init_binary2 = __esm({
|
|
42767
42691
|
__publicField(this, "length", this.config.length);
|
42768
42692
|
}
|
42769
42693
|
mapFromDriverValue(value) {
|
42770
|
-
if (typeof value === "string")
|
42771
|
-
|
42772
|
-
if (Buffer.isBuffer(value))
|
42773
|
-
return value.toString();
|
42694
|
+
if (typeof value === "string") return value;
|
42695
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
42774
42696
|
const str = [];
|
42775
42697
|
for (const v of value) {
|
42776
42698
|
str.push(v === 49 ? "1" : "0");
|
@@ -43097,8 +43019,7 @@ var init_decimal2 = __esm({
|
|
43097
43019
|
__publicField(this, "unsigned", this.config.unsigned);
|
43098
43020
|
}
|
43099
43021
|
mapFromDriverValue(value) {
|
43100
|
-
if (typeof value === "string")
|
43101
|
-
return value;
|
43022
|
+
if (typeof value === "string") return value;
|
43102
43023
|
return String(value);
|
43103
43024
|
}
|
43104
43025
|
getSQLType() {
|
@@ -43140,8 +43061,7 @@ var init_decimal2 = __esm({
|
|
43140
43061
|
__publicField(this, "mapToDriverValue", String);
|
43141
43062
|
}
|
43142
43063
|
mapFromDriverValue(value) {
|
43143
|
-
if (typeof value === "number")
|
43144
|
-
return value;
|
43064
|
+
if (typeof value === "number") return value;
|
43145
43065
|
return Number(value);
|
43146
43066
|
}
|
43147
43067
|
getSQLType() {
|
@@ -43850,10 +43770,8 @@ var init_varbinary2 = __esm({
|
|
43850
43770
|
__publicField(this, "length", this.config.length);
|
43851
43771
|
}
|
43852
43772
|
mapFromDriverValue(value) {
|
43853
|
-
if (typeof value === "string")
|
43854
|
-
|
43855
|
-
if (Buffer.isBuffer(value))
|
43856
|
-
return value.toString();
|
43773
|
+
if (typeof value === "string") return value;
|
43774
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
43857
43775
|
const str = [];
|
43858
43776
|
for (const v of value) {
|
43859
43777
|
str.push(v === 49 ? "1" : "0");
|
@@ -44646,8 +44564,7 @@ var init_dialect4 = __esm({
|
|
44646
44564
|
return `'${str.replace(/'/g, "''")}'`;
|
44647
44565
|
}
|
44648
44566
|
buildWithCTE(queries) {
|
44649
|
-
if (!queries?.length)
|
44650
|
-
return void 0;
|
44567
|
+
if (!queries?.length) return void 0;
|
44651
44568
|
const withSqlChunks = [sql`with `];
|
44652
44569
|
for (const [i, w] of queries.entries()) {
|
44653
44570
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -45581,8 +45498,7 @@ var init_select5 = __esm({
|
|
45581
45498
|
};
|
45582
45499
|
this.tableName = getTableLikeName(table6);
|
45583
45500
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
45584
|
-
for (const item of extractUsedTable4(table6))
|
45585
|
-
this.usedTables.add(item);
|
45501
|
+
for (const item of extractUsedTable4(table6)) this.usedTables.add(item);
|
45586
45502
|
}
|
45587
45503
|
/** @internal */
|
45588
45504
|
getUsedTables() {
|
@@ -45592,8 +45508,7 @@ var init_select5 = __esm({
|
|
45592
45508
|
return (table6, on) => {
|
45593
45509
|
const baseTableName = this.tableName;
|
45594
45510
|
const tableName = getTableLikeName(table6);
|
45595
|
-
for (const item of extractUsedTable4(table6))
|
45596
|
-
this.usedTables.add(item);
|
45511
|
+
for (const item of extractUsedTable4(table6)) this.usedTables.add(item);
|
45597
45512
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
45598
45513
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
45599
45514
|
}
|
@@ -45852,8 +45767,7 @@ var init_select5 = __esm({
|
|
45852
45767
|
const usedTables = [];
|
45853
45768
|
usedTables.push(...extractUsedTable4(this.config.table));
|
45854
45769
|
if (this.config.joins) {
|
45855
|
-
for (const it of this.config.joins)
|
45856
|
-
usedTables.push(...extractUsedTable4(it.table));
|
45770
|
+
for (const it of this.config.joins) usedTables.push(...extractUsedTable4(it.table));
|
45857
45771
|
}
|
45858
45772
|
return new Proxy(
|
45859
45773
|
new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
|
@@ -46412,8 +46326,8 @@ var init_session4 = __esm({
|
|
46412
46326
|
init_cache();
|
46413
46327
|
init_entity();
|
46414
46328
|
init_errors();
|
46329
|
+
init_errors2();
|
46415
46330
|
init_sql();
|
46416
|
-
init_utils2();
|
46417
46331
|
init_db4();
|
46418
46332
|
_a434 = entityKind;
|
46419
46333
|
SingleStorePreparedQuery = class {
|
@@ -46433,20 +46347,36 @@ var init_session4 = __esm({
|
|
46433
46347
|
/** @internal */
|
46434
46348
|
async queryWithCache(queryString, params, query) {
|
46435
46349
|
if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
|
46436
|
-
|
46350
|
+
try {
|
46351
|
+
return await query();
|
46352
|
+
} catch (e) {
|
46353
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46354
|
+
}
|
46437
46355
|
}
|
46438
46356
|
if (this.cacheConfig && !this.cacheConfig.enable) {
|
46439
|
-
|
46357
|
+
try {
|
46358
|
+
return await query();
|
46359
|
+
} catch (e) {
|
46360
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46361
|
+
}
|
46440
46362
|
}
|
46441
46363
|
if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
|
46442
|
-
|
46443
|
-
|
46444
|
-
|
46445
|
-
|
46446
|
-
|
46364
|
+
try {
|
46365
|
+
const [res] = await Promise.all([
|
46366
|
+
query(),
|
46367
|
+
this.cache.onMutate({ tables: this.queryMetadata.tables })
|
46368
|
+
]);
|
46369
|
+
return res;
|
46370
|
+
} catch (e) {
|
46371
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46372
|
+
}
|
46447
46373
|
}
|
46448
46374
|
if (!this.cacheConfig) {
|
46449
|
-
|
46375
|
+
try {
|
46376
|
+
return await query();
|
46377
|
+
} catch (e) {
|
46378
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46379
|
+
}
|
46450
46380
|
}
|
46451
46381
|
if (this.queryMetadata.type === "select") {
|
46452
46382
|
const fromCache = await this.cache.get(
|
@@ -46456,7 +46386,12 @@ var init_session4 = __esm({
|
|
46456
46386
|
this.cacheConfig.autoInvalidate
|
46457
46387
|
);
|
46458
46388
|
if (fromCache === void 0) {
|
46459
|
-
|
46389
|
+
let result;
|
46390
|
+
try {
|
46391
|
+
result = await query();
|
46392
|
+
} catch (e) {
|
46393
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46394
|
+
}
|
46460
46395
|
await this.cache.put(
|
46461
46396
|
this.cacheConfig.tag ?? await hashQuery(queryString, params),
|
46462
46397
|
result,
|
@@ -46469,7 +46404,11 @@ var init_session4 = __esm({
|
|
46469
46404
|
}
|
46470
46405
|
return fromCache;
|
46471
46406
|
}
|
46472
|
-
|
46407
|
+
try {
|
46408
|
+
return await query();
|
46409
|
+
} catch (e) {
|
46410
|
+
throw new DrizzleQueryError(queryString, params, e);
|
46411
|
+
}
|
46473
46412
|
}
|
46474
46413
|
};
|
46475
46414
|
__publicField(SingleStorePreparedQuery, _a434, "SingleStorePreparedQuery");
|