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.
Files changed (8) hide show
  1. package/api.d.mts +443 -443
  2. package/api.d.ts +443 -443
  3. package/api.js +277 -338
  4. package/api.mjs +277 -337
  5. package/bin.cjs +20520 -20063
  6. package/package.json +10 -11
  7. package/utils.js +51 -181
  8. package/utils.mjs +51 -181
package/api.mjs CHANGED
@@ -40,7 +40,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
40
40
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
41
41
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
42
42
 
43
- // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/ansi-styles/index.js
43
+ // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
44
44
  function assembleStyles() {
45
45
  const codes = /* @__PURE__ */ new Map();
46
46
  for (const [groupName, group] of Object.entries(styles)) {
@@ -157,7 +157,7 @@ function assembleStyles() {
157
157
  }
158
158
  var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
159
159
  var init_ansi_styles = __esm({
160
- "../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
160
+ "../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
161
161
  "use strict";
162
162
  ANSI_BACKGROUND_OFFSET = 10;
163
163
  wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
@@ -232,7 +232,7 @@ var init_ansi_styles = __esm({
232
232
  }
233
233
  });
234
234
 
235
- // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/supports-color/index.js
235
+ // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
236
236
  import process2 from "node:process";
237
237
  import os from "node:os";
238
238
  import tty from "node:tty";
@@ -299,10 +299,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
299
299
  return 1;
300
300
  }
301
301
  if ("CI" in env) {
302
- if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
302
+ if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
303
303
  return 3;
304
304
  }
305
- if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
305
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
306
306
  return 1;
307
307
  }
308
308
  return min2;
@@ -347,7 +347,7 @@ function createSupportsColor(stream, options = {}) {
347
347
  }
348
348
  var env, flagForceColor, supportsColor, supports_color_default;
349
349
  var init_supports_color = __esm({
350
- "../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/supports-color/index.js"() {
350
+ "../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js"() {
351
351
  "use strict";
352
352
  ({ env } = process2);
353
353
  if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
@@ -363,7 +363,7 @@ var init_supports_color = __esm({
363
363
  }
364
364
  });
365
365
 
366
- // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/utilities.js
366
+ // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
367
367
  function stringReplaceAll(string, substring, replacer) {
368
368
  let index6 = string.indexOf(substring);
369
369
  if (index6 === -1) {
@@ -393,18 +393,18 @@ function stringEncaseCRLFWithFirstIndex(string, prefix2, postfix, index6) {
393
393
  return returnValue;
394
394
  }
395
395
  var init_utilities = __esm({
396
- "../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/utilities.js"() {
396
+ "../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js"() {
397
397
  "use strict";
398
398
  }
399
399
  });
400
400
 
401
- // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js
401
+ // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
402
402
  function createChalk(options) {
403
403
  return chalkFactory(options);
404
404
  }
405
405
  var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
406
406
  var init_source = __esm({
407
- "../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js"() {
407
+ "../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js"() {
408
408
  "use strict";
409
409
  init_ansi_styles();
410
410
  init_supports_color();
@@ -3443,7 +3443,7 @@ var init_global = __esm({
3443
3443
  }
3444
3444
  });
3445
3445
 
3446
- // ../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
3446
+ // ../node_modules/.pnpm/zod@3.23.7/node_modules/zod/lib/index.mjs
3447
3447
  function getErrorMap() {
3448
3448
  return overrideErrorMap;
3449
3449
  }
@@ -3455,11 +3455,8 @@ function addIssueToContext(ctx, issueData) {
3455
3455
  path: ctx.path,
3456
3456
  errorMaps: [
3457
3457
  ctx.common.contextualErrorMap,
3458
- // contextual error map is first priority
3459
3458
  ctx.schemaErrorMap,
3460
- // then schema-bound map if available
3461
3459
  overrideMap,
3462
- // then global override map
3463
3460
  overrideMap === errorMap ? void 0 : errorMap
3464
3461
  // then global default map
3465
3462
  ].filter((x) => !!x)
@@ -3531,33 +3528,6 @@ function isValidIP(ip, version2) {
3531
3528
  }
3532
3529
  return false;
3533
3530
  }
3534
- function isValidJWT(jwt, alg) {
3535
- if (!jwtRegex.test(jwt))
3536
- return false;
3537
- try {
3538
- const [header] = jwt.split(".");
3539
- const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
3540
- const decoded = JSON.parse(atob(base64));
3541
- if (typeof decoded !== "object" || decoded === null)
3542
- return false;
3543
- if (!decoded.typ || !decoded.alg)
3544
- return false;
3545
- if (alg && decoded.alg !== alg)
3546
- return false;
3547
- return true;
3548
- } catch (_a437) {
3549
- return false;
3550
- }
3551
- }
3552
- function isValidCidr(ip, version2) {
3553
- if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) {
3554
- return true;
3555
- }
3556
- if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) {
3557
- return true;
3558
- }
3559
- return false;
3560
- }
3561
3531
  function floatSafeRemainder(val, step) {
3562
3532
  const valDecCount = (val.toString().split(".")[1] || "").length;
3563
3533
  const stepDecCount = (step.toString().split(".")[1] || "").length;
@@ -3637,9 +3607,9 @@ function createZodEnum(values, params) {
3637
3607
  ...processCreateParams(params)
3638
3608
  });
3639
3609
  }
3640
- var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, jwtRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv4CidrRegex, ipv6Regex, ipv6CidrRegex, base64Regex, base64urlRegex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, coerce;
3610
+ 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;
3641
3611
  var init_lib = __esm({
3642
- "../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs"() {
3612
+ "../node_modules/.pnpm/zod@3.23.7/node_modules/zod/lib/index.mjs"() {
3643
3613
  "use strict";
3644
3614
  (function(util2) {
3645
3615
  util2.assertEqual = (val) => val;
@@ -3789,9 +3759,6 @@ var init_lib = __esm({
3789
3759
  "not_finite"
3790
3760
  ]);
3791
3761
  ZodError = class _ZodError extends Error {
3792
- get errors() {
3793
- return this.issues;
3794
- }
3795
3762
  constructor(issues) {
3796
3763
  super();
3797
3764
  this.issues = [];
@@ -3810,6 +3777,9 @@ var init_lib = __esm({
3810
3777
  this.name = "ZodError";
3811
3778
  this.issues = issues;
3812
3779
  }
3780
+ get errors() {
3781
+ return this.issues;
3782
+ }
3813
3783
  format(_mapper) {
3814
3784
  const mapper = _mapper || function(issue) {
3815
3785
  return issue.message;
@@ -4111,6 +4081,34 @@ var init_lib = __esm({
4111
4081
  }
4112
4082
  };
4113
4083
  ZodType = class {
4084
+ constructor(def) {
4085
+ this.spa = this.safeParseAsync;
4086
+ this._def = def;
4087
+ this.parse = this.parse.bind(this);
4088
+ this.safeParse = this.safeParse.bind(this);
4089
+ this.parseAsync = this.parseAsync.bind(this);
4090
+ this.safeParseAsync = this.safeParseAsync.bind(this);
4091
+ this.spa = this.spa.bind(this);
4092
+ this.refine = this.refine.bind(this);
4093
+ this.refinement = this.refinement.bind(this);
4094
+ this.superRefine = this.superRefine.bind(this);
4095
+ this.optional = this.optional.bind(this);
4096
+ this.nullable = this.nullable.bind(this);
4097
+ this.nullish = this.nullish.bind(this);
4098
+ this.array = this.array.bind(this);
4099
+ this.promise = this.promise.bind(this);
4100
+ this.or = this.or.bind(this);
4101
+ this.and = this.and.bind(this);
4102
+ this.transform = this.transform.bind(this);
4103
+ this.brand = this.brand.bind(this);
4104
+ this.default = this.default.bind(this);
4105
+ this.catch = this.catch.bind(this);
4106
+ this.describe = this.describe.bind(this);
4107
+ this.pipe = this.pipe.bind(this);
4108
+ this.readonly = this.readonly.bind(this);
4109
+ this.isNullable = this.isNullable.bind(this);
4110
+ this.isOptional = this.isOptional.bind(this);
4111
+ }
4114
4112
  get description() {
4115
4113
  return this._def.description;
4116
4114
  }
@@ -4174,43 +4172,6 @@ var init_lib = __esm({
4174
4172
  const result = this._parseSync({ data, path: ctx.path, parent: ctx });
4175
4173
  return handleResult(ctx, result);
4176
4174
  }
4177
- "~validate"(data) {
4178
- var _a437, _b326;
4179
- const ctx = {
4180
- common: {
4181
- issues: [],
4182
- async: !!this["~standard"].async
4183
- },
4184
- path: [],
4185
- schemaErrorMap: this._def.errorMap,
4186
- parent: null,
4187
- data,
4188
- parsedType: getParsedType(data)
4189
- };
4190
- if (!this["~standard"].async) {
4191
- try {
4192
- const result = this._parseSync({ data, path: [], parent: ctx });
4193
- return isValid(result) ? {
4194
- value: result.value
4195
- } : {
4196
- issues: ctx.common.issues
4197
- };
4198
- } catch (err) {
4199
- 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")) {
4200
- this["~standard"].async = true;
4201
- }
4202
- ctx.common = {
4203
- issues: [],
4204
- async: true
4205
- };
4206
- }
4207
- }
4208
- return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
4209
- value: result.value
4210
- } : {
4211
- issues: ctx.common.issues
4212
- });
4213
- }
4214
4175
  async parseAsync(data, params) {
4215
4176
  const result = await this.safeParseAsync(data, params);
4216
4177
  if (result.success)
@@ -4288,39 +4249,6 @@ var init_lib = __esm({
4288
4249
  superRefine(refinement) {
4289
4250
  return this._refinement(refinement);
4290
4251
  }
4291
- constructor(def) {
4292
- this.spa = this.safeParseAsync;
4293
- this._def = def;
4294
- this.parse = this.parse.bind(this);
4295
- this.safeParse = this.safeParse.bind(this);
4296
- this.parseAsync = this.parseAsync.bind(this);
4297
- this.safeParseAsync = this.safeParseAsync.bind(this);
4298
- this.spa = this.spa.bind(this);
4299
- this.refine = this.refine.bind(this);
4300
- this.refinement = this.refinement.bind(this);
4301
- this.superRefine = this.superRefine.bind(this);
4302
- this.optional = this.optional.bind(this);
4303
- this.nullable = this.nullable.bind(this);
4304
- this.nullish = this.nullish.bind(this);
4305
- this.array = this.array.bind(this);
4306
- this.promise = this.promise.bind(this);
4307
- this.or = this.or.bind(this);
4308
- this.and = this.and.bind(this);
4309
- this.transform = this.transform.bind(this);
4310
- this.brand = this.brand.bind(this);
4311
- this.default = this.default.bind(this);
4312
- this.catch = this.catch.bind(this);
4313
- this.describe = this.describe.bind(this);
4314
- this.pipe = this.pipe.bind(this);
4315
- this.readonly = this.readonly.bind(this);
4316
- this.isNullable = this.isNullable.bind(this);
4317
- this.isOptional = this.isOptional.bind(this);
4318
- this["~standard"] = {
4319
- version: 1,
4320
- vendor: "zod",
4321
- validate: (data) => this["~validate"](data)
4322
- };
4323
- }
4324
4252
  optional() {
4325
4253
  return ZodOptional.create(this, this._def);
4326
4254
  }
@@ -4331,7 +4259,7 @@ var init_lib = __esm({
4331
4259
  return this.nullable().optional();
4332
4260
  }
4333
4261
  array() {
4334
- return ZodArray.create(this);
4262
+ return ZodArray.create(this, this._def);
4335
4263
  }
4336
4264
  promise() {
4337
4265
  return ZodPromise.create(this, this._def);
@@ -4397,19 +4325,15 @@ var init_lib = __esm({
4397
4325
  };
4398
4326
  cuidRegex = /^c[^\s-]{8,}$/i;
4399
4327
  cuid2Regex = /^[0-9a-z]+$/;
4400
- ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
4328
+ ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
4401
4329
  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;
4402
4330
  nanoidRegex = /^[a-z0-9_-]{21}$/i;
4403
- jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
4404
4331
  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)?)??$/;
4405
4332
  emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
4406
4333
  _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
4407
4334
  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])$/;
4408
- ipv4CidrRegex = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/;
4409
- 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]))$/;
4410
- 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])$/;
4335
+ 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})))$/;
4411
4336
  base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
4412
- base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
4413
4337
  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])))`;
4414
4338
  dateRegex = new RegExp(`^${dateRegexSource}$`);
4415
4339
  ZodString = class _ZodString extends ZodType {
@@ -4668,26 +4592,6 @@ var init_lib = __esm({
4668
4592
  });
4669
4593
  status.dirty();
4670
4594
  }
4671
- } else if (check.kind === "jwt") {
4672
- if (!isValidJWT(input.data, check.alg)) {
4673
- ctx = this._getOrReturnCtx(input, ctx);
4674
- addIssueToContext(ctx, {
4675
- validation: "jwt",
4676
- code: ZodIssueCode.invalid_string,
4677
- message: check.message
4678
- });
4679
- status.dirty();
4680
- }
4681
- } else if (check.kind === "cidr") {
4682
- if (!isValidCidr(input.data, check.version)) {
4683
- ctx = this._getOrReturnCtx(input, ctx);
4684
- addIssueToContext(ctx, {
4685
- validation: "cidr",
4686
- code: ZodIssueCode.invalid_string,
4687
- message: check.message
4688
- });
4689
- status.dirty();
4690
- }
4691
4595
  } else if (check.kind === "base64") {
4692
4596
  if (!base64Regex.test(input.data)) {
4693
4597
  ctx = this._getOrReturnCtx(input, ctx);
@@ -4698,16 +4602,6 @@ var init_lib = __esm({
4698
4602
  });
4699
4603
  status.dirty();
4700
4604
  }
4701
- } else if (check.kind === "base64url") {
4702
- if (!base64urlRegex.test(input.data)) {
4703
- ctx = this._getOrReturnCtx(input, ctx);
4704
- addIssueToContext(ctx, {
4705
- validation: "base64url",
4706
- code: ZodIssueCode.invalid_string,
4707
- message: check.message
4708
- });
4709
- status.dirty();
4710
- }
4711
4605
  } else {
4712
4606
  util.assertNever(check);
4713
4607
  }
@@ -4754,21 +4648,9 @@ var init_lib = __esm({
4754
4648
  base64(message) {
4755
4649
  return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
4756
4650
  }
4757
- base64url(message) {
4758
- return this._addCheck({
4759
- kind: "base64url",
4760
- ...errorUtil.errToObj(message)
4761
- });
4762
- }
4763
- jwt(options) {
4764
- return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
4765
- }
4766
4651
  ip(options) {
4767
4652
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
4768
4653
  }
4769
- cidr(options) {
4770
- return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
4771
- }
4772
4654
  datetime(options) {
4773
4655
  var _a437, _b326;
4774
4656
  if (typeof options === "string") {
@@ -4859,7 +4741,8 @@ var init_lib = __esm({
4859
4741
  });
4860
4742
  }
4861
4743
  /**
4862
- * Equivalent to `.min(1)`
4744
+ * @deprecated Use z.string().min(1) instead.
4745
+ * @see {@link ZodString.min}
4863
4746
  */
4864
4747
  nonempty(message) {
4865
4748
  return this.min(1, errorUtil.errToObj(message));
@@ -4921,15 +4804,9 @@ var init_lib = __esm({
4921
4804
  get isIP() {
4922
4805
  return !!this._def.checks.find((ch) => ch.kind === "ip");
4923
4806
  }
4924
- get isCIDR() {
4925
- return !!this._def.checks.find((ch) => ch.kind === "cidr");
4926
- }
4927
4807
  get isBase64() {
4928
4808
  return !!this._def.checks.find((ch) => ch.kind === "base64");
4929
4809
  }
4930
- get isBase64url() {
4931
- return !!this._def.checks.find((ch) => ch.kind === "base64url");
4932
- }
4933
4810
  get minLength() {
4934
4811
  let min2 = null;
4935
4812
  for (const ch of this._def.checks) {
@@ -5199,15 +5076,17 @@ var init_lib = __esm({
5199
5076
  }
5200
5077
  _parse(input) {
5201
5078
  if (this._def.coerce) {
5202
- try {
5203
- input.data = BigInt(input.data);
5204
- } catch (_a437) {
5205
- return this._getInvalidInput(input);
5206
- }
5079
+ input.data = BigInt(input.data);
5207
5080
  }
5208
5081
  const parsedType = this._getType(input);
5209
5082
  if (parsedType !== ZodParsedType.bigint) {
5210
- return this._getInvalidInput(input);
5083
+ const ctx2 = this._getOrReturnCtx(input);
5084
+ addIssueToContext(ctx2, {
5085
+ code: ZodIssueCode.invalid_type,
5086
+ expected: ZodParsedType.bigint,
5087
+ received: ctx2.parsedType
5088
+ });
5089
+ return INVALID;
5211
5090
  }
5212
5091
  let ctx = void 0;
5213
5092
  const status = new ParseStatus();
@@ -5254,15 +5133,6 @@ var init_lib = __esm({
5254
5133
  }
5255
5134
  return { status: status.value, value: input.data };
5256
5135
  }
5257
- _getInvalidInput(input) {
5258
- const ctx = this._getOrReturnCtx(input);
5259
- addIssueToContext(ctx, {
5260
- code: ZodIssueCode.invalid_type,
5261
- expected: ZodParsedType.bigint,
5262
- received: ctx.parsedType
5263
- });
5264
- return INVALID;
5265
- }
5266
5136
  gte(value, message) {
5267
5137
  return this.setLimit("min", value, true, errorUtil.toString(message));
5268
5138
  }
@@ -22101,8 +21971,7 @@ var init_column_builder = __esm({
22101
21971
  }
22102
21972
  /** @internal Sets the name of the column to the key within the table definition if a name was not given. */
22103
21973
  setName(name2) {
22104
- if (this.config.name !== "")
22105
- return;
21974
+ if (this.config.name !== "") return;
22106
21975
  this.config.name = name2;
22107
21976
  }
22108
21977
  };
@@ -22534,8 +22403,7 @@ var init_common2 = __esm({
22534
22403
  const a = value.map(
22535
22404
  (v) => v === null ? null : is(this.baseColumn, _PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v)
22536
22405
  );
22537
- if (isNestedArray)
22538
- return a;
22406
+ if (isNestedArray) return a;
22539
22407
  return makePgArray(a);
22540
22408
  }
22541
22409
  };
@@ -22668,7 +22536,7 @@ var version;
22668
22536
  var init_version = __esm({
22669
22537
  "../drizzle-orm/dist/version.js"() {
22670
22538
  "use strict";
22671
- version = "0.43.1";
22539
+ version = "0.44.0";
22672
22540
  }
22673
22541
  });
22674
22542
 
@@ -23448,7 +23316,6 @@ var init_query_promise = __esm({
23448
23316
  });
23449
23317
 
23450
23318
  // ../drizzle-orm/dist/utils.js
23451
- import * as crypto from "node:crypto";
23452
23319
  function mapResultRow(columns, row, joinsNotNullableMap) {
23453
23320
  const nullifyMap = {};
23454
23321
  const result = columns.reduce(
@@ -23539,8 +23406,7 @@ function mapUpdateSet(table6, values) {
23539
23406
  function applyMixins(baseClass, extendedClasses) {
23540
23407
  for (const extendedClass of extendedClasses) {
23541
23408
  for (const name2 of Object.getOwnPropertyNames(extendedClass.prototype)) {
23542
- if (name2 === "constructor")
23543
- continue;
23409
+ if (name2 === "constructor") continue;
23544
23410
  Object.defineProperty(
23545
23411
  baseClass.prototype,
23546
23412
  name2,
@@ -23555,15 +23421,6 @@ function getTableColumns(table6) {
23555
23421
  function getViewSelectedFields(view5) {
23556
23422
  return view5[ViewBaseConfig].selectedFields;
23557
23423
  }
23558
- async function hashQuery(sql2, params) {
23559
- const dataToHash = `${sql2}-${JSON.stringify(params)}`;
23560
- const encoder = new TextEncoder();
23561
- const data = encoder.encode(dataToHash);
23562
- const hashBuffer = await crypto.subtle.digest("SHA-256", data);
23563
- const hashArray = [...new Uint8Array(hashBuffer)];
23564
- const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
23565
- return hashHex;
23566
- }
23567
23424
  function getTableLikeName(table6) {
23568
23425
  return is(table6, Subquery) ? table6._.alias : is(table6, View3) ? table6[ViewBaseConfig].name : is(table6, SQL) ? void 0 : table6[Table2.Symbol.IsAlias] ? table6[Table2.Symbol.Name] : table6[Table2.Symbol.BaseName];
23569
23426
  }
@@ -23574,47 +23431,38 @@ function getColumnNameAndConfig(a, b) {
23574
23431
  };
23575
23432
  }
23576
23433
  function isConfig(data) {
23577
- if (typeof data !== "object" || data === null)
23578
- return false;
23579
- if (data.constructor.name !== "Object")
23580
- return false;
23434
+ if (typeof data !== "object" || data === null) return false;
23435
+ if (data.constructor.name !== "Object") return false;
23581
23436
  if ("logger" in data) {
23582
23437
  const type = typeof data["logger"];
23583
- if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined")
23584
- return false;
23438
+ if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined") return false;
23585
23439
  return true;
23586
23440
  }
23587
23441
  if ("schema" in data) {
23588
23442
  const type = typeof data["schema"];
23589
- if (type !== "object" && type !== "undefined")
23590
- return false;
23443
+ if (type !== "object" && type !== "undefined") return false;
23591
23444
  return true;
23592
23445
  }
23593
23446
  if ("casing" in data) {
23594
23447
  const type = typeof data["casing"];
23595
- if (type !== "string" && type !== "undefined")
23596
- return false;
23448
+ if (type !== "string" && type !== "undefined") return false;
23597
23449
  return true;
23598
23450
  }
23599
23451
  if ("mode" in data) {
23600
- if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== void 0)
23601
- return false;
23452
+ if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== void 0) return false;
23602
23453
  return true;
23603
23454
  }
23604
23455
  if ("connection" in data) {
23605
23456
  const type = typeof data["connection"];
23606
- if (type !== "string" && type !== "object" && type !== "undefined")
23607
- return false;
23457
+ if (type !== "string" && type !== "object" && type !== "undefined") return false;
23608
23458
  return true;
23609
23459
  }
23610
23460
  if ("client" in data) {
23611
23461
  const type = typeof data["client"];
23612
- if (type !== "object" && type !== "function" && type !== "undefined")
23613
- return false;
23462
+ if (type !== "object" && type !== "function" && type !== "undefined") return false;
23614
23463
  return true;
23615
23464
  }
23616
- if (Object.keys(data).length === 0)
23617
- return true;
23465
+ if (Object.keys(data).length === 0) return true;
23618
23466
  return false;
23619
23467
  }
23620
23468
  var init_utils2 = __esm({
@@ -24432,8 +24280,7 @@ var init_numeric = __esm({
24432
24280
  this.scale = config.scale;
24433
24281
  }
24434
24282
  mapFromDriverValue(value) {
24435
- if (typeof value === "string")
24436
- return value;
24283
+ if (typeof value === "string") return value;
24437
24284
  return String(value);
24438
24285
  }
24439
24286
  getSQLType() {
@@ -24472,8 +24319,7 @@ var init_numeric = __esm({
24472
24319
  this.scale = config.scale;
24473
24320
  }
24474
24321
  mapFromDriverValue(value) {
24475
- if (typeof value === "number")
24476
- return value;
24322
+ if (typeof value === "number") return value;
24477
24323
  return Number(value);
24478
24324
  }
24479
24325
  getSQLType() {
@@ -26087,7 +25933,6 @@ __export(dist_exports, {
26087
25933
  gte: () => gte,
26088
25934
  hammingDistance: () => hammingDistance,
26089
25935
  hasOwnEntityKind: () => hasOwnEntityKind,
26090
- hashQuery: () => hashQuery,
26091
25936
  haveSameKeys: () => haveSameKeys,
26092
25937
  ilike: () => ilike,
26093
25938
  inArray: () => inArray,
@@ -26510,8 +26355,7 @@ var init_casing = __esm({
26510
26355
  this.convert = casing2 === "snake_case" ? toSnakeCase : casing2 === "camelCase" ? toCamelCase : noopCase;
26511
26356
  }
26512
26357
  getColumnCasing(column6) {
26513
- if (!column6.keyAsName)
26514
- return column6.name;
26358
+ if (!column6.keyAsName) return column6.name;
26515
26359
  const schema5 = column6.table[Table2.Symbol.Schema] ?? "public";
26516
26360
  const tableName = column6.table[Table2.Symbol.OriginalName];
26517
26361
  const key = `${schema5}.${tableName}.${column6.name}`;
@@ -26620,8 +26464,7 @@ var init_dialect = __esm({
26620
26464
  return `'${str.replace(/'/g, "''")}'`;
26621
26465
  }
26622
26466
  buildWithCTE(queries) {
26623
- if (!queries?.length)
26624
- return void 0;
26467
+ if (!queries?.length) return void 0;
26625
26468
  const withSqlChunks = [sql`with `];
26626
26469
  for (const [i, w] of queries.entries()) {
26627
26470
  withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
@@ -28171,8 +28014,7 @@ var init_select2 = __esm({
28171
28014
  };
28172
28015
  this.tableName = getTableLikeName(table6);
28173
28016
  this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
28174
- for (const item of extractUsedTable(table6))
28175
- this.usedTables.add(item);
28017
+ for (const item of extractUsedTable(table6)) this.usedTables.add(item);
28176
28018
  }
28177
28019
  /** @internal */
28178
28020
  getUsedTables() {
@@ -28182,8 +28024,7 @@ var init_select2 = __esm({
28182
28024
  return (table6, on) => {
28183
28025
  const baseTableName = this.tableName;
28184
28026
  const tableName = getTableLikeName(table6);
28185
- for (const item of extractUsedTable(table6))
28186
- this.usedTables.add(item);
28027
+ for (const item of extractUsedTable(table6)) this.usedTables.add(item);
28187
28028
  if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
28188
28029
  throw new Error(`Alias "${tableName}" is already used in this query`);
28189
28030
  }
@@ -28444,8 +28285,7 @@ var init_select2 = __esm({
28444
28285
  const usedTables = [];
28445
28286
  usedTables.push(...extractUsedTable(this.config.table));
28446
28287
  if (this.config.joins) {
28447
- for (const it of this.config.joins)
28448
- usedTables.push(...extractUsedTable(it.table));
28288
+ for (const it of this.config.joins) usedTables.push(...extractUsedTable(it.table));
28449
28289
  }
28450
28290
  return new Proxy(
28451
28291
  new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
@@ -30227,6 +30067,15 @@ var init_schema = __esm({
30227
30067
  });
30228
30068
 
30229
30069
  // ../drizzle-orm/dist/cache/core/cache.js
30070
+ async function hashQuery(sql2, params) {
30071
+ const dataToHash = `${sql2}-${JSON.stringify(params)}`;
30072
+ const encoder = new TextEncoder();
30073
+ const data = encoder.encode(dataToHash);
30074
+ const hashBuffer = await crypto.subtle.digest("SHA-256", data);
30075
+ const hashArray = [...new Uint8Array(hashBuffer)];
30076
+ const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
30077
+ return hashHex;
30078
+ }
30230
30079
  var _a165, Cache, _a166, _b119, NoopCache;
30231
30080
  var init_cache = __esm({
30232
30081
  "../drizzle-orm/dist/cache/core/cache.js"() {
@@ -30252,6 +30101,25 @@ var init_cache = __esm({
30252
30101
  }
30253
30102
  });
30254
30103
 
30104
+ // ../drizzle-orm/dist/errors/index.js
30105
+ var DrizzleQueryError;
30106
+ var init_errors2 = __esm({
30107
+ "../drizzle-orm/dist/errors/index.js"() {
30108
+ "use strict";
30109
+ DrizzleQueryError = class _DrizzleQueryError extends Error {
30110
+ constructor(query, params, cause) {
30111
+ super(`Failed query: ${query}
30112
+ params: ${params}`);
30113
+ this.query = query;
30114
+ this.params = params;
30115
+ this.cause = cause;
30116
+ Error.captureStackTrace(this, _DrizzleQueryError);
30117
+ if (cause) this.cause = cause;
30118
+ }
30119
+ };
30120
+ }
30121
+ });
30122
+
30255
30123
  // ../drizzle-orm/dist/pg-core/session.js
30256
30124
  var _a167, PgPreparedQuery, _a168, PgSession, _a169, _b120, PgTransaction;
30257
30125
  var init_session = __esm({
@@ -30260,9 +30128,9 @@ var init_session = __esm({
30260
30128
  init_cache();
30261
30129
  init_entity();
30262
30130
  init_errors();
30131
+ init_errors2();
30263
30132
  init_sql2();
30264
30133
  init_tracing();
30265
- init_utils2();
30266
30134
  init_db();
30267
30135
  _a167 = entityKind;
30268
30136
  PgPreparedQuery = class {
@@ -30295,20 +30163,36 @@ var init_session = __esm({
30295
30163
  /** @internal */
30296
30164
  async queryWithCache(queryString, params, query) {
30297
30165
  if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
30298
- return await query();
30166
+ try {
30167
+ return await query();
30168
+ } catch (e) {
30169
+ throw new DrizzleQueryError(queryString, params, e);
30170
+ }
30299
30171
  }
30300
30172
  if (this.cacheConfig && !this.cacheConfig.enable) {
30301
- return await query();
30173
+ try {
30174
+ return await query();
30175
+ } catch (e) {
30176
+ throw new DrizzleQueryError(queryString, params, e);
30177
+ }
30302
30178
  }
30303
30179
  if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
30304
- const [res] = await Promise.all([
30305
- query(),
30306
- this.cache.onMutate({ tables: this.queryMetadata.tables })
30307
- ]);
30308
- return res;
30180
+ try {
30181
+ const [res] = await Promise.all([
30182
+ query(),
30183
+ this.cache.onMutate({ tables: this.queryMetadata.tables })
30184
+ ]);
30185
+ return res;
30186
+ } catch (e) {
30187
+ throw new DrizzleQueryError(queryString, params, e);
30188
+ }
30309
30189
  }
30310
30190
  if (!this.cacheConfig) {
30311
- return await query();
30191
+ try {
30192
+ return await query();
30193
+ } catch (e) {
30194
+ throw new DrizzleQueryError(queryString, params, e);
30195
+ }
30312
30196
  }
30313
30197
  if (this.queryMetadata.type === "select") {
30314
30198
  const fromCache = await this.cache.get(
@@ -30318,7 +30202,12 @@ var init_session = __esm({
30318
30202
  this.cacheConfig.autoInvalidate
30319
30203
  );
30320
30204
  if (fromCache === void 0) {
30321
- const result = await query();
30205
+ let result;
30206
+ try {
30207
+ result = await query();
30208
+ } catch (e) {
30209
+ throw new DrizzleQueryError(queryString, params, e);
30210
+ }
30322
30211
  await this.cache.put(
30323
30212
  this.cacheConfig.tag ?? await hashQuery(queryString, params),
30324
30213
  result,
@@ -30331,7 +30220,11 @@ var init_session = __esm({
30331
30220
  }
30332
30221
  return fromCache;
30333
30222
  }
30334
- return await query();
30223
+ try {
30224
+ return await query();
30225
+ } catch (e) {
30226
+ throw new DrizzleQueryError(queryString, params, e);
30227
+ }
30335
30228
  }
30336
30229
  };
30337
30230
  __publicField(PgPreparedQuery, _a167, "PgPreparedQuery");
@@ -32668,8 +32561,7 @@ var init_numeric2 = __esm({
32668
32561
  __publicField(SQLiteNumericBuilder, _a195, "SQLiteNumericBuilder");
32669
32562
  SQLiteNumeric = class extends (_b140 = SQLiteColumn, _a196 = entityKind, _b140) {
32670
32563
  mapFromDriverValue(value) {
32671
- if (typeof value === "string")
32672
- return value;
32564
+ if (typeof value === "string") return value;
32673
32565
  return String(value);
32674
32566
  }
32675
32567
  getSQLType() {
@@ -32696,8 +32588,7 @@ var init_numeric2 = __esm({
32696
32588
  __publicField(this, "mapToDriverValue", String);
32697
32589
  }
32698
32590
  mapFromDriverValue(value) {
32699
- if (typeof value === "number")
32700
- return value;
32591
+ if (typeof value === "number") return value;
32701
32592
  return Number(value);
32702
32593
  }
32703
32594
  getSQLType() {
@@ -33260,8 +33151,7 @@ var init_dialect2 = __esm({
33260
33151
  return `'${str.replace(/'/g, "''")}'`;
33261
33152
  }
33262
33153
  buildWithCTE(queries) {
33263
- if (!queries?.length)
33264
- return void 0;
33154
+ if (!queries?.length) return void 0;
33265
33155
  const withSqlChunks = [sql`with `];
33266
33156
  for (const [i, w] of queries.entries()) {
33267
33157
  withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
@@ -34212,8 +34102,7 @@ var init_select3 = __esm({
34212
34102
  };
34213
34103
  this.tableName = getTableLikeName(table6);
34214
34104
  this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
34215
- for (const item of extractUsedTable2(table6))
34216
- this.usedTables.add(item);
34105
+ for (const item of extractUsedTable2(table6)) this.usedTables.add(item);
34217
34106
  }
34218
34107
  /** @internal */
34219
34108
  getUsedTables() {
@@ -34223,8 +34112,7 @@ var init_select3 = __esm({
34223
34112
  return (table6, on) => {
34224
34113
  const baseTableName = this.tableName;
34225
34114
  const tableName = getTableLikeName(table6);
34226
- for (const item of extractUsedTable2(table6))
34227
- this.usedTables.add(item);
34115
+ for (const item of extractUsedTable2(table6)) this.usedTables.add(item);
34228
34116
  if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
34229
34117
  throw new Error(`Alias "${tableName}" is already used in this query`);
34230
34118
  }
@@ -34471,8 +34359,7 @@ var init_select3 = __esm({
34471
34359
  const usedTables = [];
34472
34360
  usedTables.push(...extractUsedTable2(this.config.table));
34473
34361
  if (this.config.joins) {
34474
- for (const it of this.config.joins)
34475
- usedTables.push(...extractUsedTable2(it.table));
34362
+ for (const it of this.config.joins) usedTables.push(...extractUsedTable2(it.table));
34476
34363
  }
34477
34364
  return new Proxy(
34478
34365
  new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
@@ -34730,8 +34617,7 @@ var init_insert2 = __esm({
34730
34617
  * ```
34731
34618
  */
34732
34619
  onConflictDoNothing(config = {}) {
34733
- if (!this.config.onConflict)
34734
- this.config.onConflict = [];
34620
+ if (!this.config.onConflict) this.config.onConflict = [];
34735
34621
  if (config.target === void 0) {
34736
34622
  this.config.onConflict.push(sql` on conflict do nothing`);
34737
34623
  } else {
@@ -34776,8 +34662,7 @@ var init_insert2 = __esm({
34776
34662
  'You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.'
34777
34663
  );
34778
34664
  }
34779
- if (!this.config.onConflict)
34780
- this.config.onConflict = [];
34665
+ if (!this.config.onConflict) this.config.onConflict = [];
34781
34666
  const whereSql = config.where ? sql` where ${config.where}` : void 0;
34782
34667
  const targetWhereSql = config.targetWhere ? sql` where ${config.targetWhere}` : void 0;
34783
34668
  const setWhereSql = config.setWhere ? sql` where ${config.setWhere}` : void 0;
@@ -35584,8 +35469,8 @@ var init_session2 = __esm({
35584
35469
  init_cache();
35585
35470
  init_entity();
35586
35471
  init_errors();
35472
+ init_errors2();
35587
35473
  init_query_promise();
35588
- init_utils2();
35589
35474
  init_db2();
35590
35475
  ExecuteResultSync = class extends (_b164 = QueryPromise, _a232 = entityKind, _b164) {
35591
35476
  constructor(resultCb) {
@@ -35621,20 +35506,36 @@ var init_session2 = __esm({
35621
35506
  /** @internal */
35622
35507
  async queryWithCache(queryString, params, query) {
35623
35508
  if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
35624
- return await query();
35509
+ try {
35510
+ return await query();
35511
+ } catch (e) {
35512
+ throw new DrizzleQueryError(queryString, params, e);
35513
+ }
35625
35514
  }
35626
35515
  if (this.cacheConfig && !this.cacheConfig.enable) {
35627
- return await query();
35516
+ try {
35517
+ return await query();
35518
+ } catch (e) {
35519
+ throw new DrizzleQueryError(queryString, params, e);
35520
+ }
35628
35521
  }
35629
35522
  if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
35630
- const [res] = await Promise.all([
35631
- query(),
35632
- this.cache.onMutate({ tables: this.queryMetadata.tables })
35633
- ]);
35634
- return res;
35523
+ try {
35524
+ const [res] = await Promise.all([
35525
+ query(),
35526
+ this.cache.onMutate({ tables: this.queryMetadata.tables })
35527
+ ]);
35528
+ return res;
35529
+ } catch (e) {
35530
+ throw new DrizzleQueryError(queryString, params, e);
35531
+ }
35635
35532
  }
35636
35533
  if (!this.cacheConfig) {
35637
- return await query();
35534
+ try {
35535
+ return await query();
35536
+ } catch (e) {
35537
+ throw new DrizzleQueryError(queryString, params, e);
35538
+ }
35638
35539
  }
35639
35540
  if (this.queryMetadata.type === "select") {
35640
35541
  const fromCache = await this.cache.get(
@@ -35644,7 +35545,12 @@ var init_session2 = __esm({
35644
35545
  this.cacheConfig.autoInvalidate
35645
35546
  );
35646
35547
  if (fromCache === void 0) {
35647
- const result = await query();
35548
+ let result;
35549
+ try {
35550
+ result = await query();
35551
+ } catch (e) {
35552
+ throw new DrizzleQueryError(queryString, params, e);
35553
+ }
35648
35554
  await this.cache.put(
35649
35555
  this.cacheConfig.tag ?? await hashQuery(queryString, params),
35650
35556
  result,
@@ -35657,7 +35563,11 @@ var init_session2 = __esm({
35657
35563
  }
35658
35564
  return fromCache;
35659
35565
  }
35660
- return await query();
35566
+ try {
35567
+ return await query();
35568
+ } catch (e) {
35569
+ throw new DrizzleQueryError(queryString, params, e);
35570
+ }
35661
35571
  }
35662
35572
  getQuery() {
35663
35573
  return this.query;
@@ -36929,10 +36839,8 @@ var init_binary = __esm({
36929
36839
  __publicField(this, "length", this.config.length);
36930
36840
  }
36931
36841
  mapFromDriverValue(value) {
36932
- if (typeof value === "string")
36933
- return value;
36934
- if (Buffer.isBuffer(value))
36935
- return value.toString();
36842
+ if (typeof value === "string") return value;
36843
+ if (Buffer.isBuffer(value)) return value.toString();
36936
36844
  const str = [];
36937
36845
  for (const v of value) {
36938
36846
  str.push(v === 49 ? "1" : "0");
@@ -37254,8 +37162,7 @@ var init_decimal = __esm({
37254
37162
  __publicField(this, "unsigned", this.config.unsigned);
37255
37163
  }
37256
37164
  mapFromDriverValue(value) {
37257
- if (typeof value === "string")
37258
- return value;
37165
+ if (typeof value === "string") return value;
37259
37166
  return String(value);
37260
37167
  }
37261
37168
  getSQLType() {
@@ -37297,8 +37204,7 @@ var init_decimal = __esm({
37297
37204
  __publicField(this, "mapToDriverValue", String);
37298
37205
  }
37299
37206
  mapFromDriverValue(value) {
37300
- if (typeof value === "number")
37301
- return value;
37207
+ if (typeof value === "number") return value;
37302
37208
  return Number(value);
37303
37209
  }
37304
37210
  getSQLType() {
@@ -38027,10 +37933,8 @@ var init_varbinary = __esm({
38027
37933
  __publicField(this, "length", this.config.length);
38028
37934
  }
38029
37935
  mapFromDriverValue(value) {
38030
- if (typeof value === "string")
38031
- return value;
38032
- if (Buffer.isBuffer(value))
38033
- return value.toString();
37936
+ if (typeof value === "string") return value;
37937
+ if (Buffer.isBuffer(value)) return value.toString();
38034
37938
  const str = [];
38035
37939
  for (const v of value) {
38036
37940
  str.push(v === 49 ? "1" : "0");
@@ -38694,8 +38598,7 @@ var init_dialect3 = __esm({
38694
38598
  return `'${str.replace(/'/g, "''")}'`;
38695
38599
  }
38696
38600
  buildWithCTE(queries) {
38697
- if (!queries?.length)
38698
- return void 0;
38601
+ if (!queries?.length) return void 0;
38699
38602
  const withSqlChunks = [sql`with `];
38700
38603
  for (const [i, w] of queries.entries()) {
38701
38604
  withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
@@ -39975,8 +39878,7 @@ var init_select4 = __esm({
39975
39878
  };
39976
39879
  this.tableName = getTableLikeName(table6);
39977
39880
  this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
39978
- for (const item of extractUsedTable3(table6))
39979
- this.usedTables.add(item);
39881
+ for (const item of extractUsedTable3(table6)) this.usedTables.add(item);
39980
39882
  }
39981
39883
  /** @internal */
39982
39884
  getUsedTables() {
@@ -39989,8 +39891,7 @@ var init_select4 = __esm({
39989
39891
  const onIndex = isCrossJoin ? a : b;
39990
39892
  const baseTableName = this.tableName;
39991
39893
  const tableName = getTableLikeName(table6);
39992
- for (const item of extractUsedTable3(table6))
39993
- this.usedTables.add(item);
39894
+ for (const item of extractUsedTable3(table6)) this.usedTables.add(item);
39994
39895
  if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
39995
39896
  throw new Error(`Alias "${tableName}" is already used in this query`);
39996
39897
  }
@@ -40258,8 +40159,7 @@ var init_select4 = __esm({
40258
40159
  const usedTables = [];
40259
40160
  usedTables.push(...extractUsedTable3(this.config.table));
40260
40161
  if (this.config.joins) {
40261
- for (const it of this.config.joins)
40262
- usedTables.push(...extractUsedTable3(it.table));
40162
+ for (const it of this.config.joins) usedTables.push(...extractUsedTable3(it.table));
40263
40163
  }
40264
40164
  return new Proxy(
40265
40165
  new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
@@ -41209,8 +41109,8 @@ var init_session3 = __esm({
41209
41109
  init_cache();
41210
41110
  init_entity();
41211
41111
  init_errors();
41112
+ init_errors2();
41212
41113
  init_sql();
41213
- init_utils2();
41214
41114
  init_db3();
41215
41115
  _a341 = entityKind;
41216
41116
  MySqlPreparedQuery = class {
@@ -41230,20 +41130,36 @@ var init_session3 = __esm({
41230
41130
  /** @internal */
41231
41131
  async queryWithCache(queryString, params, query) {
41232
41132
  if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
41233
- return await query();
41133
+ try {
41134
+ return await query();
41135
+ } catch (e) {
41136
+ throw new DrizzleQueryError(queryString, params, e);
41137
+ }
41234
41138
  }
41235
41139
  if (this.cacheConfig && !this.cacheConfig.enable) {
41236
- return await query();
41140
+ try {
41141
+ return await query();
41142
+ } catch (e) {
41143
+ throw new DrizzleQueryError(queryString, params, e);
41144
+ }
41237
41145
  }
41238
41146
  if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
41239
- const [res] = await Promise.all([
41240
- query(),
41241
- this.cache.onMutate({ tables: this.queryMetadata.tables })
41242
- ]);
41243
- return res;
41147
+ try {
41148
+ const [res] = await Promise.all([
41149
+ query(),
41150
+ this.cache.onMutate({ tables: this.queryMetadata.tables })
41151
+ ]);
41152
+ return res;
41153
+ } catch (e) {
41154
+ throw new DrizzleQueryError(queryString, params, e);
41155
+ }
41244
41156
  }
41245
41157
  if (!this.cacheConfig) {
41246
- return await query();
41158
+ try {
41159
+ return await query();
41160
+ } catch (e) {
41161
+ throw new DrizzleQueryError(queryString, params, e);
41162
+ }
41247
41163
  }
41248
41164
  if (this.queryMetadata.type === "select") {
41249
41165
  const fromCache = await this.cache.get(
@@ -41253,7 +41169,12 @@ var init_session3 = __esm({
41253
41169
  this.cacheConfig.autoInvalidate
41254
41170
  );
41255
41171
  if (fromCache === void 0) {
41256
- const result = await query();
41172
+ let result;
41173
+ try {
41174
+ result = await query();
41175
+ } catch (e) {
41176
+ throw new DrizzleQueryError(queryString, params, e);
41177
+ }
41257
41178
  await this.cache.put(
41258
41179
  this.cacheConfig.tag ?? await hashQuery(queryString, params),
41259
41180
  result,
@@ -41266,7 +41187,11 @@ var init_session3 = __esm({
41266
41187
  }
41267
41188
  return fromCache;
41268
41189
  }
41269
- return await query();
41190
+ try {
41191
+ return await query();
41192
+ } catch (e) {
41193
+ throw new DrizzleQueryError(queryString, params, e);
41194
+ }
41270
41195
  }
41271
41196
  };
41272
41197
  __publicField(MySqlPreparedQuery, _a341, "MySqlPreparedQuery");
@@ -42771,10 +42696,8 @@ var init_binary2 = __esm({
42771
42696
  __publicField(this, "length", this.config.length);
42772
42697
  }
42773
42698
  mapFromDriverValue(value) {
42774
- if (typeof value === "string")
42775
- return value;
42776
- if (Buffer.isBuffer(value))
42777
- return value.toString();
42699
+ if (typeof value === "string") return value;
42700
+ if (Buffer.isBuffer(value)) return value.toString();
42778
42701
  const str = [];
42779
42702
  for (const v of value) {
42780
42703
  str.push(v === 49 ? "1" : "0");
@@ -43101,8 +43024,7 @@ var init_decimal2 = __esm({
43101
43024
  __publicField(this, "unsigned", this.config.unsigned);
43102
43025
  }
43103
43026
  mapFromDriverValue(value) {
43104
- if (typeof value === "string")
43105
- return value;
43027
+ if (typeof value === "string") return value;
43106
43028
  return String(value);
43107
43029
  }
43108
43030
  getSQLType() {
@@ -43144,8 +43066,7 @@ var init_decimal2 = __esm({
43144
43066
  __publicField(this, "mapToDriverValue", String);
43145
43067
  }
43146
43068
  mapFromDriverValue(value) {
43147
- if (typeof value === "number")
43148
- return value;
43069
+ if (typeof value === "number") return value;
43149
43070
  return Number(value);
43150
43071
  }
43151
43072
  getSQLType() {
@@ -43854,10 +43775,8 @@ var init_varbinary2 = __esm({
43854
43775
  __publicField(this, "length", this.config.length);
43855
43776
  }
43856
43777
  mapFromDriverValue(value) {
43857
- if (typeof value === "string")
43858
- return value;
43859
- if (Buffer.isBuffer(value))
43860
- return value.toString();
43778
+ if (typeof value === "string") return value;
43779
+ if (Buffer.isBuffer(value)) return value.toString();
43861
43780
  const str = [];
43862
43781
  for (const v of value) {
43863
43782
  str.push(v === 49 ? "1" : "0");
@@ -44650,8 +44569,7 @@ var init_dialect4 = __esm({
44650
44569
  return `'${str.replace(/'/g, "''")}'`;
44651
44570
  }
44652
44571
  buildWithCTE(queries) {
44653
- if (!queries?.length)
44654
- return void 0;
44572
+ if (!queries?.length) return void 0;
44655
44573
  const withSqlChunks = [sql`with `];
44656
44574
  for (const [i, w] of queries.entries()) {
44657
44575
  withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
@@ -45585,8 +45503,7 @@ var init_select5 = __esm({
45585
45503
  };
45586
45504
  this.tableName = getTableLikeName(table6);
45587
45505
  this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
45588
- for (const item of extractUsedTable4(table6))
45589
- this.usedTables.add(item);
45506
+ for (const item of extractUsedTable4(table6)) this.usedTables.add(item);
45590
45507
  }
45591
45508
  /** @internal */
45592
45509
  getUsedTables() {
@@ -45596,8 +45513,7 @@ var init_select5 = __esm({
45596
45513
  return (table6, on) => {
45597
45514
  const baseTableName = this.tableName;
45598
45515
  const tableName = getTableLikeName(table6);
45599
- for (const item of extractUsedTable4(table6))
45600
- this.usedTables.add(item);
45516
+ for (const item of extractUsedTable4(table6)) this.usedTables.add(item);
45601
45517
  if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
45602
45518
  throw new Error(`Alias "${tableName}" is already used in this query`);
45603
45519
  }
@@ -45856,8 +45772,7 @@ var init_select5 = __esm({
45856
45772
  const usedTables = [];
45857
45773
  usedTables.push(...extractUsedTable4(this.config.table));
45858
45774
  if (this.config.joins) {
45859
- for (const it of this.config.joins)
45860
- usedTables.push(...extractUsedTable4(it.table));
45775
+ for (const it of this.config.joins) usedTables.push(...extractUsedTable4(it.table));
45861
45776
  }
45862
45777
  return new Proxy(
45863
45778
  new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]),
@@ -46416,8 +46331,8 @@ var init_session4 = __esm({
46416
46331
  init_cache();
46417
46332
  init_entity();
46418
46333
  init_errors();
46334
+ init_errors2();
46419
46335
  init_sql();
46420
- init_utils2();
46421
46336
  init_db4();
46422
46337
  _a434 = entityKind;
46423
46338
  SingleStorePreparedQuery = class {
@@ -46437,20 +46352,36 @@ var init_session4 = __esm({
46437
46352
  /** @internal */
46438
46353
  async queryWithCache(queryString, params, query) {
46439
46354
  if (this.cache === void 0 || is(this.cache, NoopCache) || this.queryMetadata === void 0) {
46440
- return await query();
46355
+ try {
46356
+ return await query();
46357
+ } catch (e) {
46358
+ throw new DrizzleQueryError(queryString, params, e);
46359
+ }
46441
46360
  }
46442
46361
  if (this.cacheConfig && !this.cacheConfig.enable) {
46443
- return await query();
46362
+ try {
46363
+ return await query();
46364
+ } catch (e) {
46365
+ throw new DrizzleQueryError(queryString, params, e);
46366
+ }
46444
46367
  }
46445
46368
  if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
46446
- const [res] = await Promise.all([
46447
- query(),
46448
- this.cache.onMutate({ tables: this.queryMetadata.tables })
46449
- ]);
46450
- return res;
46369
+ try {
46370
+ const [res] = await Promise.all([
46371
+ query(),
46372
+ this.cache.onMutate({ tables: this.queryMetadata.tables })
46373
+ ]);
46374
+ return res;
46375
+ } catch (e) {
46376
+ throw new DrizzleQueryError(queryString, params, e);
46377
+ }
46451
46378
  }
46452
46379
  if (!this.cacheConfig) {
46453
- return await query();
46380
+ try {
46381
+ return await query();
46382
+ } catch (e) {
46383
+ throw new DrizzleQueryError(queryString, params, e);
46384
+ }
46454
46385
  }
46455
46386
  if (this.queryMetadata.type === "select") {
46456
46387
  const fromCache = await this.cache.get(
@@ -46460,7 +46391,12 @@ var init_session4 = __esm({
46460
46391
  this.cacheConfig.autoInvalidate
46461
46392
  );
46462
46393
  if (fromCache === void 0) {
46463
- const result = await query();
46394
+ let result;
46395
+ try {
46396
+ result = await query();
46397
+ } catch (e) {
46398
+ throw new DrizzleQueryError(queryString, params, e);
46399
+ }
46464
46400
  await this.cache.put(
46465
46401
  this.cacheConfig.tag ?? await hashQuery(queryString, params),
46466
46402
  result,
@@ -46473,7 +46409,11 @@ var init_session4 = __esm({
46473
46409
  }
46474
46410
  return fromCache;
46475
46411
  }
46476
- return await query();
46412
+ try {
46413
+ return await query();
46414
+ } catch (e) {
46415
+ throw new DrizzleQueryError(queryString, params, e);
46416
+ }
46477
46417
  }
46478
46418
  };
46479
46419
  __publicField(SingleStorePreparedQuery, _a434, "SingleStorePreparedQuery");