drizzle-kit 0.17.0 → 0.17.1-4d93888

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 (4) hide show
  1. package/index.js +372 -303
  2. package/package.json +3 -2
  3. package/readme.md +2 -2
  4. package/utils.js +88 -118
package/index.js CHANGED
@@ -29,9 +29,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  ));
30
30
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
31
 
32
- // node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/error.js
32
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/error.js
33
33
  var require_error = __commonJS({
34
- "node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/error.js"(exports) {
34
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/error.js"(exports) {
35
35
  var CommanderError2 = class extends Error {
36
36
  constructor(exitCode, code, message) {
37
37
  super(message);
@@ -54,9 +54,9 @@ var require_error = __commonJS({
54
54
  }
55
55
  });
56
56
 
57
- // node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/argument.js
57
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/argument.js
58
58
  var require_argument = __commonJS({
59
- "node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/argument.js"(exports) {
59
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/argument.js"(exports) {
60
60
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
61
61
  var Argument2 = class {
62
62
  constructor(name, description) {
@@ -134,16 +134,15 @@ var require_argument = __commonJS({
134
134
  }
135
135
  });
136
136
 
137
- // node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/help.js
137
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/help.js
138
138
  var require_help = __commonJS({
139
- "node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/help.js"(exports) {
139
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/help.js"(exports) {
140
140
  var { humanReadableArgName } = require_argument();
141
141
  var Help2 = class {
142
142
  constructor() {
143
143
  this.helpWidth = void 0;
144
144
  this.sortSubcommands = false;
145
145
  this.sortOptions = false;
146
- this.showGlobalOptions = false;
147
146
  }
148
147
  visibleCommands(cmd) {
149
148
  const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
@@ -162,12 +161,6 @@ var require_help = __commonJS({
162
161
  }
163
162
  return visibleCommands;
164
163
  }
165
- compareOptions(a, b) {
166
- const getSortKey = (option) => {
167
- return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
168
- };
169
- return getSortKey(a).localeCompare(getSortKey(b));
170
- }
171
164
  visibleOptions(cmd) {
172
165
  const visibleOptions = cmd.options.filter((option) => !option.hidden);
173
166
  const showShortHelpFlag = cmd._hasHelpOption && cmd._helpShortFlag && !cmd._findOption(cmd._helpShortFlag);
@@ -184,23 +177,15 @@ var require_help = __commonJS({
184
177
  visibleOptions.push(helpOption);
185
178
  }
186
179
  if (this.sortOptions) {
187
- visibleOptions.sort(this.compareOptions);
180
+ const getSortKey = (option) => {
181
+ return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
182
+ };
183
+ visibleOptions.sort((a, b) => {
184
+ return getSortKey(a).localeCompare(getSortKey(b));
185
+ });
188
186
  }
189
187
  return visibleOptions;
190
188
  }
191
- visibleGlobalOptions(cmd) {
192
- if (!this.showGlobalOptions)
193
- return [];
194
- const globalOptions = [];
195
- for (let parentCmd = cmd.parent; parentCmd; parentCmd = parentCmd.parent) {
196
- const visibleOptions = parentCmd.options.filter((option) => !option.hidden);
197
- globalOptions.push(...visibleOptions);
198
- }
199
- if (this.sortOptions) {
200
- globalOptions.sort(this.compareOptions);
201
- }
202
- return globalOptions;
203
- }
204
189
  visibleArguments(cmd) {
205
190
  if (cmd._argsDescription) {
206
191
  cmd._args.forEach((argument) => {
@@ -232,11 +217,6 @@ var require_help = __commonJS({
232
217
  return Math.max(max, helper.optionTerm(option).length);
233
218
  }, 0);
234
219
  }
235
- longestGlobalOptionTermLength(cmd, helper) {
236
- return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
237
- return Math.max(max, helper.optionTerm(option).length);
238
- }, 0);
239
- }
240
220
  longestArgumentTermLength(cmd, helper) {
241
221
  return helper.visibleArguments(cmd).reduce((max, argument) => {
242
222
  return Math.max(max, helper.argumentTerm(argument).length);
@@ -334,14 +314,6 @@ var require_help = __commonJS({
334
314
  if (optionList.length > 0) {
335
315
  output = output.concat(["Options:", formatList(optionList), ""]);
336
316
  }
337
- if (this.showGlobalOptions) {
338
- const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
339
- return formatItem(helper.optionTerm(option), helper.optionDescription(option));
340
- });
341
- if (globalOptionList.length > 0) {
342
- output = output.concat(["Global Options:", formatList(globalOptionList), ""]);
343
- }
344
- }
345
317
  const commandList = helper.visibleCommands(cmd).map((cmd2) => {
346
318
  return formatItem(helper.subcommandTerm(cmd2), helper.subcommandDescription(cmd2));
347
319
  });
@@ -353,7 +325,6 @@ var require_help = __commonJS({
353
325
  padWidth(cmd, helper) {
354
326
  return Math.max(
355
327
  helper.longestOptionTermLength(cmd, helper),
356
- helper.longestGlobalOptionTermLength(cmd, helper),
357
328
  helper.longestSubcommandTermLength(cmd, helper),
358
329
  helper.longestArgumentTermLength(cmd, helper)
359
330
  );
@@ -381,9 +352,9 @@ var require_help = __commonJS({
381
352
  }
382
353
  });
383
354
 
384
- // node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/option.js
355
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/option.js
385
356
  var require_option = __commonJS({
386
- "node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/option.js"(exports) {
357
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/option.js"(exports) {
387
358
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
388
359
  var Option2 = class {
389
360
  constructor(flags, description) {
@@ -529,9 +500,9 @@ var require_option = __commonJS({
529
500
  }
530
501
  });
531
502
 
532
- // node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/suggestSimilar.js
503
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/suggestSimilar.js
533
504
  var require_suggestSimilar = __commonJS({
534
- "node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/suggestSimilar.js"(exports) {
505
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/suggestSimilar.js"(exports) {
535
506
  var maxDistance = 3;
536
507
  function editDistance(a, b) {
537
508
  if (Math.abs(a.length - b.length) > maxDistance)
@@ -608,9 +579,9 @@ var require_suggestSimilar = __commonJS({
608
579
  }
609
580
  });
610
581
 
611
- // node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js
582
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/command.js
612
583
  var require_command = __commonJS({
613
- "node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js"(exports) {
584
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/lib/command.js"(exports) {
614
585
  var EventEmitter = require("events").EventEmitter;
615
586
  var childProcess = require("child_process");
616
587
  var path2 = require("path");
@@ -991,15 +962,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
991
962
  getOptionValueSource(key) {
992
963
  return this._optionValueSources[key];
993
964
  }
994
- getOptionValueSourceWithGlobals(key) {
995
- let source;
996
- getCommandAndParents(this).forEach((cmd) => {
997
- if (cmd.getOptionValueSource(key) !== void 0) {
998
- source = cmd.getOptionValueSource(key);
999
- }
1000
- });
1001
- return source;
1002
- }
1003
965
  _prepareUserArgs(argv, parseOptions) {
1004
966
  if (argv !== void 0 && !Array.isArray(argv)) {
1005
967
  throw new Error("first parameter to parse must be array or undefined");
@@ -1797,9 +1759,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
1797
1759
  }
1798
1760
  });
1799
1761
 
1800
- // node_modules/.pnpm/commander@9.5.0/node_modules/commander/index.js
1762
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/index.js
1801
1763
  var require_commander = __commonJS({
1802
- "node_modules/.pnpm/commander@9.5.0/node_modules/commander/index.js"(exports, module2) {
1764
+ "node_modules/.pnpm/commander@9.4.1/node_modules/commander/index.js"(exports, module2) {
1803
1765
  var { Argument: Argument2 } = require_argument();
1804
1766
  var { Command: Command2 } = require_command();
1805
1767
  var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
@@ -1817,7 +1779,7 @@ var require_commander = __commonJS({
1817
1779
  }
1818
1780
  });
1819
1781
 
1820
- // node_modules/.pnpm/zod@3.20.6/node_modules/zod/lib/index.mjs
1782
+ // node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
1821
1783
  function getErrorMap() {
1822
1784
  return overrideErrorMap;
1823
1785
  }
@@ -1930,9 +1892,9 @@ function createZodEnum(values, params) {
1930
1892
  ...processCreateParams(params)
1931
1893
  });
1932
1894
  }
1933
- var util, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, uuidRegex, emailRegex, datetimeRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, objectUtil, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, 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;
1895
+ var util, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, ParseInputLazyPath, handleResult, ZodType, cuidRegex, uuidRegex, emailRegex, datetimeRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, objectUtil, AugmentFactory, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, 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;
1934
1896
  var init_lib = __esm({
1935
- "node_modules/.pnpm/zod@3.20.6/node_modules/zod/lib/index.mjs"() {
1897
+ "node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs"() {
1936
1898
  (function(util2) {
1937
1899
  util2.assertEqual = (val) => val;
1938
1900
  function assertIs(_arg) {
@@ -2329,7 +2291,7 @@ var init_lib = __esm({
2329
2291
  isAborted = (x) => x.status === "aborted";
2330
2292
  isDirty = (x) => x.status === "dirty";
2331
2293
  isValid = (x) => x.status === "valid";
2332
- isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
2294
+ isAsync = (x) => typeof Promise !== void 0 && x instanceof Promise;
2333
2295
  (function(errorUtil2) {
2334
2296
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
2335
2297
  errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
@@ -2525,29 +2487,28 @@ var init_lib = __esm({
2525
2487
  return this._refinement(refinement);
2526
2488
  }
2527
2489
  optional() {
2528
- return ZodOptional.create(this, this._def);
2490
+ return ZodOptional.create(this);
2529
2491
  }
2530
2492
  nullable() {
2531
- return ZodNullable.create(this, this._def);
2493
+ return ZodNullable.create(this);
2532
2494
  }
2533
2495
  nullish() {
2534
- return this.nullable().optional();
2496
+ return this.optional().nullable();
2535
2497
  }
2536
2498
  array() {
2537
- return ZodArray.create(this, this._def);
2499
+ return ZodArray.create(this);
2538
2500
  }
2539
2501
  promise() {
2540
- return ZodPromise.create(this, this._def);
2502
+ return ZodPromise.create(this);
2541
2503
  }
2542
2504
  or(option) {
2543
- return ZodUnion.create([this, option], this._def);
2505
+ return ZodUnion.create([this, option]);
2544
2506
  }
2545
2507
  and(incoming) {
2546
- return ZodIntersection.create(this, incoming, this._def);
2508
+ return ZodIntersection.create(this, incoming);
2547
2509
  }
2548
2510
  transform(transform) {
2549
2511
  return new ZodEffects({
2550
- ...processCreateParams(this._def),
2551
2512
  schema: this,
2552
2513
  typeName: ZodFirstPartyTypeKind.ZodEffects,
2553
2514
  effect: { type: "transform", transform }
@@ -2556,7 +2517,6 @@ var init_lib = __esm({
2556
2517
  default(def) {
2557
2518
  const defaultValueFunc = typeof def === "function" ? def : () => def;
2558
2519
  return new ZodDefault({
2559
- ...processCreateParams(this._def),
2560
2520
  innerType: this,
2561
2521
  defaultValue: defaultValueFunc,
2562
2522
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -2566,15 +2526,14 @@ var init_lib = __esm({
2566
2526
  return new ZodBranded({
2567
2527
  typeName: ZodFirstPartyTypeKind.ZodBranded,
2568
2528
  type: this,
2569
- ...processCreateParams(this._def)
2529
+ ...processCreateParams(void 0)
2570
2530
  });
2571
2531
  }
2572
2532
  catch(def) {
2573
- const catchValueFunc = typeof def === "function" ? def : () => def;
2533
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
2574
2534
  return new ZodCatch({
2575
- ...processCreateParams(this._def),
2576
2535
  innerType: this,
2577
- catchValue: catchValueFunc,
2536
+ defaultValue: defaultValueFunc,
2578
2537
  typeName: ZodFirstPartyTypeKind.ZodCatch
2579
2538
  });
2580
2539
  }
@@ -2596,25 +2555,24 @@ var init_lib = __esm({
2596
2555
  }
2597
2556
  };
2598
2557
  cuidRegex = /^c[^\s-]{8,}$/i;
2599
- cuid2Regex = /^[a-z][a-z0-9]*$/;
2600
2558
  uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
2601
- emailRegex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|([^-]([a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}))$/;
2559
+ emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
2602
2560
  datetimeRegex = (args) => {
2603
2561
  if (args.precision) {
2604
2562
  if (args.offset) {
2605
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
2563
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
2606
2564
  } else {
2607
2565
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
2608
2566
  }
2609
2567
  } else if (args.precision === 0) {
2610
2568
  if (args.offset) {
2611
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
2569
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
2612
2570
  } else {
2613
2571
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
2614
2572
  }
2615
2573
  } else {
2616
2574
  if (args.offset) {
2617
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
2575
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
2618
2576
  } else {
2619
2577
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
2620
2578
  }
@@ -2736,16 +2694,6 @@ var init_lib = __esm({
2736
2694
  });
2737
2695
  status.dirty();
2738
2696
  }
2739
- } else if (check.kind === "cuid2") {
2740
- if (!cuid2Regex.test(input.data)) {
2741
- ctx = this._getOrReturnCtx(input, ctx);
2742
- addIssueToContext(ctx, {
2743
- validation: "cuid2",
2744
- code: ZodIssueCode.invalid_string,
2745
- message: check.message
2746
- });
2747
- status.dirty();
2748
- }
2749
2697
  } else if (check.kind === "url") {
2750
2698
  try {
2751
2699
  new URL(input.data);
@@ -2827,9 +2775,6 @@ var init_lib = __esm({
2827
2775
  cuid(message) {
2828
2776
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
2829
2777
  }
2830
- cuid2(message) {
2831
- return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
2832
- }
2833
2778
  datetime(options) {
2834
2779
  var _a;
2835
2780
  if (typeof options === "string") {
@@ -2904,9 +2849,6 @@ var init_lib = __esm({
2904
2849
  get isCUID() {
2905
2850
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
2906
2851
  }
2907
- get isCUID2() {
2908
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
2909
- }
2910
2852
  get minLength() {
2911
2853
  let min = null;
2912
2854
  for (const ch of this._def.checks) {
@@ -3129,22 +3071,7 @@ var init_lib = __esm({
3129
3071
  return max;
3130
3072
  }
3131
3073
  get isInt() {
3132
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
3133
- }
3134
- get isFinite() {
3135
- let max = null, min = null;
3136
- for (const ch of this._def.checks) {
3137
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
3138
- return true;
3139
- } else if (ch.kind === "min") {
3140
- if (min === null || ch.value > min)
3141
- min = ch.value;
3142
- } else if (ch.kind === "max") {
3143
- if (max === null || ch.value < max)
3144
- max = ch.value;
3145
- }
3146
- }
3147
- return Number.isFinite(min) && Number.isFinite(max);
3074
+ return !!this._def.checks.find((ch) => ch.kind === "int");
3148
3075
  }
3149
3076
  };
3150
3077
  ZodNumber.create = (params) => {
@@ -3501,13 +3428,13 @@ var init_lib = __esm({
3501
3428
  }
3502
3429
  }
3503
3430
  if (ctx.common.async) {
3504
- return Promise.all([...ctx.data].map((item, i) => {
3431
+ return Promise.all(ctx.data.map((item, i) => {
3505
3432
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
3506
3433
  })).then((result2) => {
3507
3434
  return ParseStatus.mergeArray(status, result2);
3508
3435
  });
3509
3436
  }
3510
- const result = [...ctx.data].map((item, i) => {
3437
+ const result = ctx.data.map((item, i) => {
3511
3438
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
3512
3439
  });
3513
3440
  return ParseStatus.mergeArray(status, result);
@@ -3555,12 +3482,22 @@ var init_lib = __esm({
3555
3482
  };
3556
3483
  };
3557
3484
  })(objectUtil || (objectUtil = {}));
3485
+ AugmentFactory = (def) => (augmentation) => {
3486
+ return new ZodObject({
3487
+ ...def,
3488
+ shape: () => ({
3489
+ ...def.shape(),
3490
+ ...augmentation
3491
+ })
3492
+ });
3493
+ };
3558
3494
  ZodObject = class extends ZodType {
3559
3495
  constructor() {
3560
3496
  super(...arguments);
3561
3497
  this._cached = null;
3562
3498
  this.nonstrict = this.passthrough;
3563
- this.augment = this.extend;
3499
+ this.augment = AugmentFactory(this._def);
3500
+ this.extend = AugmentFactory(this._def);
3564
3501
  }
3565
3502
  _getCached() {
3566
3503
  if (this._cached !== null)
@@ -3689,14 +3626,8 @@ var init_lib = __esm({
3689
3626
  unknownKeys: "passthrough"
3690
3627
  });
3691
3628
  }
3692
- extend(augmentation) {
3693
- return new ZodObject({
3694
- ...this._def,
3695
- shape: () => ({
3696
- ...this._def.shape(),
3697
- ...augmentation
3698
- })
3699
- });
3629
+ setKey(key, schema4) {
3630
+ return this.augment({ [key]: schema4 });
3700
3631
  }
3701
3632
  merge(merging) {
3702
3633
  const merged = new ZodObject({
@@ -3707,9 +3638,6 @@ var init_lib = __esm({
3707
3638
  });
3708
3639
  return merged;
3709
3640
  }
3710
- setKey(key, schema4) {
3711
- return this.augment({ [key]: schema4 });
3712
- }
3713
3641
  catchall(index4) {
3714
3642
  return new ZodObject({
3715
3643
  ...this._def,
@@ -3718,10 +3646,9 @@ var init_lib = __esm({
3718
3646
  }
3719
3647
  pick(mask) {
3720
3648
  const shape = {};
3721
- util.objectKeys(mask).forEach((key) => {
3722
- if (mask[key] && this.shape[key]) {
3649
+ util.objectKeys(mask).map((key) => {
3650
+ if (this.shape[key])
3723
3651
  shape[key] = this.shape[key];
3724
- }
3725
3652
  });
3726
3653
  return new ZodObject({
3727
3654
  ...this._def,
@@ -3730,8 +3657,8 @@ var init_lib = __esm({
3730
3657
  }
3731
3658
  omit(mask) {
3732
3659
  const shape = {};
3733
- util.objectKeys(this.shape).forEach((key) => {
3734
- if (!mask[key]) {
3660
+ util.objectKeys(this.shape).map((key) => {
3661
+ if (util.objectKeys(mask).indexOf(key) === -1) {
3735
3662
  shape[key] = this.shape[key];
3736
3663
  }
3737
3664
  });
@@ -3745,14 +3672,24 @@ var init_lib = __esm({
3745
3672
  }
3746
3673
  partial(mask) {
3747
3674
  const newShape = {};
3748
- util.objectKeys(this.shape).forEach((key) => {
3749
- const fieldSchema = this.shape[key];
3750
- if (mask && !mask[key]) {
3751
- newShape[key] = fieldSchema;
3752
- } else {
3675
+ if (mask) {
3676
+ util.objectKeys(this.shape).map((key) => {
3677
+ if (util.objectKeys(mask).indexOf(key) === -1) {
3678
+ newShape[key] = this.shape[key];
3679
+ } else {
3680
+ newShape[key] = this.shape[key].optional();
3681
+ }
3682
+ });
3683
+ return new ZodObject({
3684
+ ...this._def,
3685
+ shape: () => newShape
3686
+ });
3687
+ } else {
3688
+ for (const key in this.shape) {
3689
+ const fieldSchema = this.shape[key];
3753
3690
  newShape[key] = fieldSchema.optional();
3754
3691
  }
3755
- });
3692
+ }
3756
3693
  return new ZodObject({
3757
3694
  ...this._def,
3758
3695
  shape: () => newShape
@@ -3760,10 +3697,21 @@ var init_lib = __esm({
3760
3697
  }
3761
3698
  required(mask) {
3762
3699
  const newShape = {};
3763
- util.objectKeys(this.shape).forEach((key) => {
3764
- if (mask && !mask[key]) {
3765
- newShape[key] = this.shape[key];
3766
- } else {
3700
+ if (mask) {
3701
+ util.objectKeys(this.shape).map((key) => {
3702
+ if (util.objectKeys(mask).indexOf(key) === -1) {
3703
+ newShape[key] = this.shape[key];
3704
+ } else {
3705
+ const fieldSchema = this.shape[key];
3706
+ let newField = fieldSchema;
3707
+ while (newField instanceof ZodOptional) {
3708
+ newField = newField._def.innerType;
3709
+ }
3710
+ newShape[key] = newField;
3711
+ }
3712
+ });
3713
+ } else {
3714
+ for (const key in this.shape) {
3767
3715
  const fieldSchema = this.shape[key];
3768
3716
  let newField = fieldSchema;
3769
3717
  while (newField instanceof ZodOptional) {
@@ -3771,7 +3719,7 @@ var init_lib = __esm({
3771
3719
  }
3772
3720
  newShape[key] = newField;
3773
3721
  }
3774
- });
3722
+ }
3775
3723
  return new ZodObject({
3776
3724
  ...this._def,
3777
3725
  shape: () => newShape
@@ -4073,7 +4021,7 @@ var init_lib = __esm({
4073
4021
  });
4074
4022
  status.dirty();
4075
4023
  }
4076
- const items = [...ctx.data].map((item, itemIndex) => {
4024
+ const items = ctx.data.map((item, itemIndex) => {
4077
4025
  const schema4 = this._def.items[itemIndex] || this._def.rest;
4078
4026
  if (!schema4)
4079
4027
  return null;
@@ -4440,7 +4388,6 @@ var init_lib = __esm({
4440
4388
  if (input.data !== this._def.value) {
4441
4389
  const ctx = this._getOrReturnCtx(input);
4442
4390
  addIssueToContext(ctx, {
4443
- received: ctx.data,
4444
4391
  code: ZodIssueCode.invalid_literal,
4445
4392
  expected: this._def.value
4446
4393
  });
@@ -4507,12 +4454,6 @@ var init_lib = __esm({
4507
4454
  }
4508
4455
  return enumValues;
4509
4456
  }
4510
- extract(values) {
4511
- return ZodEnum.create(values);
4512
- }
4513
- exclude(values) {
4514
- return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
4515
- }
4516
4457
  };
4517
4458
  ZodEnum.create = createZodEnum;
4518
4459
  ZodNativeEnum = class extends ZodType {
@@ -4551,9 +4492,6 @@ var init_lib = __esm({
4551
4492
  });
4552
4493
  };
4553
4494
  ZodPromise = class extends ZodType {
4554
- unwrap() {
4555
- return this._def.type;
4556
- }
4557
4495
  _parse(input) {
4558
4496
  const { ctx } = this._processInputParams(input);
4559
4497
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -4767,29 +4705,23 @@ var init_lib = __esm({
4767
4705
  const result = this._def.innerType._parse({
4768
4706
  data: ctx.data,
4769
4707
  path: ctx.path,
4770
- parent: {
4771
- ...ctx,
4772
- common: {
4773
- ...ctx.common,
4774
- issues: []
4775
- }
4776
- }
4708
+ parent: ctx
4777
4709
  });
4778
4710
  if (isAsync(result)) {
4779
4711
  return result.then((result2) => {
4780
4712
  return {
4781
4713
  status: "valid",
4782
- value: result2.status === "valid" ? result2.value : this._def.catchValue()
4714
+ value: result2.status === "valid" ? result2.value : this._def.defaultValue()
4783
4715
  };
4784
4716
  });
4785
4717
  } else {
4786
4718
  return {
4787
4719
  status: "valid",
4788
- value: result.status === "valid" ? result.value : this._def.catchValue()
4720
+ value: result.status === "valid" ? result.value : this._def.defaultValue()
4789
4721
  };
4790
4722
  }
4791
4723
  }
4792
- removeCatch() {
4724
+ removeDefault() {
4793
4725
  return this._def.innerType;
4794
4726
  }
4795
4727
  };
@@ -4797,7 +4729,7 @@ var init_lib = __esm({
4797
4729
  return new ZodCatch({
4798
4730
  innerType: type,
4799
4731
  typeName: ZodFirstPartyTypeKind.ZodCatch,
4800
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
4732
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
4801
4733
  ...processCreateParams(params)
4802
4734
  });
4803
4735
  };
@@ -4969,10 +4901,7 @@ var init_lib = __esm({
4969
4901
  coerce = {
4970
4902
  string: (arg) => ZodString.create({ ...arg, coerce: true }),
4971
4903
  number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
4972
- boolean: (arg) => ZodBoolean.create({
4973
- ...arg,
4974
- coerce: true
4975
- }),
4904
+ boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
4976
4905
  bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
4977
4906
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
4978
4907
  };
@@ -13648,7 +13577,7 @@ var init_sqlgenerator = __esm({
13648
13577
  }
13649
13578
  convert(statement) {
13650
13579
  const { tableName, oldColumnName, newColumnName } = statement;
13651
- return `ALTER TABLE ${tableName} RENAME COLUMN "${oldColumnName}" TO "${newColumnName}";`;
13580
+ return `ALTER TABLE "${tableName}" RENAME COLUMN "${oldColumnName}" TO "${newColumnName}";`;
13652
13581
  }
13653
13582
  };
13654
13583
  MySqlAlterTableRenameColumnConvertor = class extends Convertor {
@@ -13675,7 +13604,7 @@ var init_sqlgenerator = __esm({
13675
13604
  }
13676
13605
  convert(statement) {
13677
13606
  const { tableName, columnName } = statement;
13678
- return `ALTER TABLE ${tableName} DROP COLUMN IF EXISTS "${columnName}";`;
13607
+ return `ALTER TABLE "${tableName}" DROP COLUMN IF EXISTS "${columnName}";`;
13679
13608
  }
13680
13609
  };
13681
13610
  MySqlAlterTableDropColumnConvertor = class extends Convertor {
@@ -13706,7 +13635,7 @@ var init_sqlgenerator = __esm({
13706
13635
  const defaultStatement = `${column6.default !== void 0 ? `DEFAULT ${column6.default}` : ""}`;
13707
13636
  const fixedType = isPgNativeType(column6.type) ? column6.type : `"${column6.type}"`;
13708
13637
  const notNullStatement = `${notNull ? "NOT NULL" : ""}`;
13709
- return `ALTER TABLE ${tableName} ADD COLUMN "${name}" ${fixedType} ${defaultStatement} ${notNullStatement}`.replace(/ +/g, " ").trim() + ";";
13638
+ return `ALTER TABLE "${tableName}" ADD COLUMN "${name}" ${fixedType} ${defaultStatement} ${notNullStatement}`.replace(/ +/g, " ").trim() + ";";
13710
13639
  }
13711
13640
  };
13712
13641
  MySqlAlterTableAddColumnConvertor = class extends Convertor {
@@ -13744,7 +13673,7 @@ var init_sqlgenerator = __esm({
13744
13673
  }
13745
13674
  convert(statement) {
13746
13675
  const { tableName, columnName, newDataType } = statement;
13747
- return `ALTER TABLE ${tableName} ALTER COLUMN "${columnName}" SET DATA TYPE ${newDataType};`;
13676
+ return `ALTER TABLE "${tableName}" ALTER COLUMN "${columnName}" SET DATA TYPE ${newDataType};`;
13748
13677
  }
13749
13678
  };
13750
13679
  SQLiteAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
@@ -13768,7 +13697,7 @@ var init_sqlgenerator = __esm({
13768
13697
  }
13769
13698
  convert(statement) {
13770
13699
  const { tableName, columnName } = statement;
13771
- return `ALTER TABLE ${tableName} ALTER COLUMN "${columnName}" SET DEFAULT ${statement.newDefaultValue};`;
13700
+ return `ALTER TABLE "${tableName}" ALTER COLUMN "${columnName}" SET DEFAULT ${statement.newDefaultValue};`;
13772
13701
  }
13773
13702
  };
13774
13703
  SqliteAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
@@ -13792,7 +13721,7 @@ var init_sqlgenerator = __esm({
13792
13721
  }
13793
13722
  convert(statement) {
13794
13723
  const { tableName, columnName } = statement;
13795
- return `ALTER TABLE ${tableName} ALTER COLUMN "${columnName}" DROP DEFAULT;`;
13724
+ return `ALTER TABLE "${tableName}" ALTER COLUMN "${columnName}" DROP DEFAULT;`;
13796
13725
  }
13797
13726
  };
13798
13727
  MySqlAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
@@ -14032,7 +13961,7 @@ ALTER TABLE "${statement.tableName}" ADD CONSTRAINT ${statement.newConstraintNam
14032
13961
  }
14033
13962
  convert(statement) {
14034
13963
  const { tableName, columnName } = statement;
14035
- return `ALTER TABLE ${tableName} ALTER COLUMN "${columnName}" SET NOT NULL;`;
13964
+ return `ALTER TABLE "${tableName}" ALTER COLUMN "${columnName}" SET NOT NULL;`;
14036
13965
  }
14037
13966
  };
14038
13967
  SqliteAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
@@ -14056,7 +13985,7 @@ ALTER TABLE "${statement.tableName}" ADD CONSTRAINT ${statement.newConstraintNam
14056
13985
  }
14057
13986
  convert(statement) {
14058
13987
  const { tableName, columnName } = statement;
14059
- return `ALTER TABLE ${tableName} ALTER COLUMN "${columnName}" DROP NOT NULL;`;
13988
+ return `ALTER TABLE "${tableName}" ALTER COLUMN "${columnName}" DROP NOT NULL;`;
14060
13989
  }
14061
13990
  };
14062
13991
  SqliteAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
@@ -14092,7 +14021,7 @@ ALTER TABLE "${statement.tableName}" ADD CONSTRAINT ${statement.newConstraintNam
14092
14021
  const onUpdateStatement = onUpdate ? `ON UPDATE ${onUpdate}` : "";
14093
14022
  const fromColumnsString = columnsFrom.map((it) => `"${it}"`).join(",");
14094
14023
  const toColumnsString = columnsTo.map((it) => `"${it}"`).join(",");
14095
- const alterStatement = `ALTER TABLE ${tableFrom} ADD CONSTRAINT ${name} FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableTo}(${toColumnsString}) ${onDeleteStatement} ${onUpdateStatement}`.replace(/ +/g, " ").trim();
14024
+ const alterStatement = `ALTER TABLE "${tableFrom}" ADD CONSTRAINT ${name} FOREIGN KEY (${fromColumnsString}) REFERENCES "${tableTo}"(${toColumnsString}) ${onDeleteStatement} ${onUpdateStatement}`.replace(/ +/g, " ").trim();
14096
14025
  let sql = "DO $$ BEGIN\n";
14097
14026
  sql += " " + alterStatement + ";\n";
14098
14027
  sql += "EXCEPTION\n";
@@ -14143,13 +14072,13 @@ ALTER TABLE "${statement.tableName}" ADD CONSTRAINT ${statement.newConstraintNam
14143
14072
  convert(statement) {
14144
14073
  const newFk = PgSquasher.unsquashFK(statement.data);
14145
14074
  const oldFk = PgSquasher.unsquashFK(statement.oldFkey);
14146
- let sql = `ALTER TABLE ${oldFk.tableFrom} DROP CONSTRAINT ${oldFk.name};
14075
+ let sql = `ALTER TABLE "${oldFk.tableFrom}" DROP CONSTRAINT ${oldFk.name};
14147
14076
  `;
14148
14077
  const onDeleteStatement = newFk.onDelete ? `ON DELETE ${newFk.onDelete}` : "";
14149
14078
  const onUpdateStatement = newFk.onUpdate ? `ON UPDATE ${newFk.onDelete}` : "";
14150
14079
  const fromColumnsString = newFk.columnsFrom.map((it) => `"${it}"`).join(",");
14151
14080
  const toColumnsString = newFk.columnsTo.map((it) => `"${it}"`).join(",");
14152
- const alterStatement = `ALTER TABLE ${newFk.tableFrom} ADD CONSTRAINT ${newFk.name} FOREIGN KEY (${fromColumnsString}) REFERENCES ${newFk.tableTo}(${toColumnsString}) ${onDeleteStatement} ${onUpdateStatement}`.replace(/ +/g, " ").trim();
14081
+ const alterStatement = `ALTER TABLE "${newFk.tableFrom}" ADD CONSTRAINT ${newFk.name} FOREIGN KEY (${fromColumnsString}) REFERENCES "${newFk.tableTo}"(${toColumnsString}) ${onDeleteStatement} ${onUpdateStatement}`.replace(/ +/g, " ").trim();
14153
14082
  sql += "DO $$ BEGIN\n";
14154
14083
  sql += " " + alterStatement + ";\n";
14155
14084
  sql += "EXCEPTION\n";
@@ -14180,7 +14109,7 @@ ALTER TABLE "${statement.tableName}" ADD CONSTRAINT ${statement.newConstraintNam
14180
14109
  convert(statement) {
14181
14110
  const tableFrom = statement.tableName;
14182
14111
  const { name } = PgSquasher.unsquashFK(statement.data);
14183
- return `ALTER TABLE ${tableFrom} DROP CONSTRAINT ${name};
14112
+ return `ALTER TABLE "${tableFrom}" DROP CONSTRAINT ${name};
14184
14113
  `;
14185
14114
  }
14186
14115
  };
@@ -14217,7 +14146,7 @@ ALTER TABLE "${statement.tableName}" ADD CONSTRAINT ${statement.newConstraintNam
14217
14146
  const { name, columns, isUnique } = PgSquasher.unsquashIdx(statement.data);
14218
14147
  const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
14219
14148
  const value = columns.map((it) => `"${it}"`).join(",");
14220
- return `CREATE ${indexPart} IF NOT EXISTS ${name} ON ${statement.tableName} (${value});`;
14149
+ return `CREATE ${indexPart} IF NOT EXISTS "${name}" ON "${statement.tableName}" (${value});`;
14221
14150
  }
14222
14151
  };
14223
14152
  CreateMySqlIndexConvertor = class extends Convertor {
@@ -14253,7 +14182,7 @@ ALTER TABLE "${statement.tableName}" ADD CONSTRAINT ${statement.newConstraintNam
14253
14182
  }
14254
14183
  convert(statement) {
14255
14184
  const { name } = PgSquasher.unsquashIdx(statement.data);
14256
- return `DROP INDEX IF EXISTS ${name};`;
14185
+ return `DROP INDEX IF EXISTS "${name}";`;
14257
14186
  }
14258
14187
  };
14259
14188
  PgCreateSchemaConvertor = class extends Convertor {
@@ -25712,9 +25641,7 @@ var init_mysqlImports = __esm({
25712
25641
  const i0values = Object.values(i0);
25713
25642
  i0values.forEach((t) => {
25714
25643
  if (t instanceof import_mysql_core.MySqlTable) {
25715
- tables.push(
25716
- t
25717
- );
25644
+ tables.push(t);
25718
25645
  }
25719
25646
  if ((0, import_mysql_core.isMySqlSchema)(t)) {
25720
25647
  schemas.push(t);
@@ -25759,6 +25686,7 @@ var init_mysqlSerializer = __esm({
25759
25686
  import_sql = require("drizzle-orm/sql");
25760
25687
  import_common = require("drizzle-orm/mysql-core/columns/common");
25761
25688
  import_date = require("drizzle-orm/mysql-core/columns/date.common");
25689
+ init_serializer();
25762
25690
  dialect3 = new import_mysql_core2.MySqlDialect();
25763
25691
  indexName = (tableName, columns) => {
25764
25692
  return `${tableName}_${columns.join("_")}_index`;
@@ -25792,12 +25720,7 @@ var init_mysqlSerializer = __esm({
25792
25720
  };
25793
25721
  if (column6.default !== void 0) {
25794
25722
  if (column6.default instanceof import_sql.SQL) {
25795
- columnToSet.default = column6.default.queryChunks.map((it) => {
25796
- if (typeof it === "string") {
25797
- return `${it}`;
25798
- }
25799
- throw new Error();
25800
- }).join();
25723
+ columnToSet.default = sqlToStr(column6.default);
25801
25724
  } else {
25802
25725
  if (typeof column6.default === "string") {
25803
25726
  columnToSet.default = `'${column6.default}'`;
@@ -26111,9 +26034,7 @@ var init_pgImports = __esm({
26111
26034
  return;
26112
26035
  }
26113
26036
  if (t instanceof import_pg_core.PgTable) {
26114
- tables.push(
26115
- t
26116
- );
26037
+ tables.push(t);
26117
26038
  }
26118
26039
  if ((0, import_pg_core.isPgSchema)(t)) {
26119
26040
  schemas.push(t);
@@ -26139,6 +26060,7 @@ var init_pgSerializer = __esm({
26139
26060
  import_utils10 = require("drizzle-orm/pg-core/utils");
26140
26061
  import_sql2 = require("drizzle-orm/sql");
26141
26062
  import_table2 = require("drizzle-orm/table");
26063
+ init_serializer();
26142
26064
  dialect4 = new import_pg_core2.PgDialect();
26143
26065
  indexName2 = (tableName, columns) => {
26144
26066
  return `${tableName}_${columns.join("_")}_index`;
@@ -26171,12 +26093,7 @@ var init_pgSerializer = __esm({
26171
26093
  };
26172
26094
  if (column6.default !== void 0) {
26173
26095
  if (column6.default instanceof import_sql2.SQL) {
26174
- columnToSet.default = column6.default.queryChunks.map((it) => {
26175
- if (typeof it === "string") {
26176
- return `${it}`;
26177
- }
26178
- throw new Error("Only strings are allowed in .default()");
26179
- }).join();
26096
+ columnToSet.default = sqlToStr(column6.default);
26180
26097
  } else {
26181
26098
  if (typeof column6.default === "string") {
26182
26099
  columnToSet.default = `'${column6.default}'`;
@@ -26644,6 +26561,7 @@ var init_sqliteSerializer = __esm({
26644
26561
  import_sql3 = require("drizzle-orm/sql");
26645
26562
  import_sqlite_core2 = require("drizzle-orm/sqlite-core");
26646
26563
  import_utils11 = require("drizzle-orm/sqlite-core/utils");
26564
+ init_serializer();
26647
26565
  dialect5 = new import_sqlite_core2.SQLiteSyncDialect();
26648
26566
  generateSqliteSnapshot = (tables, enums) => {
26649
26567
  const result = {};
@@ -26657,7 +26575,6 @@ var init_sqliteSerializer = __esm({
26657
26575
  columns,
26658
26576
  indexes,
26659
26577
  foreignKeys: tableForeignKeys,
26660
- schema: schema4,
26661
26578
  primaryKeys
26662
26579
  } = (0, import_utils11.getTableConfig)(table4);
26663
26580
  columns.forEach((column6) => {
@@ -26672,12 +26589,7 @@ var init_sqliteSerializer = __esm({
26672
26589
  };
26673
26590
  if (column6.default !== void 0) {
26674
26591
  if (column6.default instanceof import_sql3.SQL) {
26675
- columnToSet.default = column6.default.queryChunks.map((it) => {
26676
- if (typeof it === "string") {
26677
- return `${it}`;
26678
- }
26679
- throw new Error("Only strings are allowed in .default()");
26680
- }).join();
26592
+ columnToSet.default = sqlToStr(column6.default);
26681
26593
  } else {
26682
26594
  columnToSet.default = typeof column6.default === "string" ? `'${column6.default}'` : column6.default;
26683
26595
  }
@@ -26762,7 +26674,7 @@ var init_sqliteSerializer = __esm({
26762
26674
  });
26763
26675
 
26764
26676
  // src/serializer/index.ts
26765
- var import_fs5, import_node, import_path3, import_glob, safeRegister, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
26677
+ var import_fs5, import_node, import_path3, import_glob, safeRegister, sqlToStr, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
26766
26678
  var init_serializer = __esm({
26767
26679
  "src/serializer/index.ts"() {
26768
26680
  import_fs5 = __toESM(require("fs"));
@@ -26781,6 +26693,19 @@ var init_serializer = __esm({
26781
26693
  } };
26782
26694
  }
26783
26695
  };
26696
+ sqlToStr = (sql) => {
26697
+ return sql.toQuery({
26698
+ escapeName: (name) => {
26699
+ throw new Error("we don't support params for `sql` default values");
26700
+ },
26701
+ escapeParam: (num, value) => {
26702
+ throw new Error("we don't support params for `sql` default values");
26703
+ },
26704
+ escapeString: (str) => {
26705
+ throw new Error("we don't support params for `sql` default values");
26706
+ }
26707
+ }).sql;
26708
+ };
26784
26709
  serializeMySql = (path2) => {
26785
26710
  const filenames = prepareFilenames(path2);
26786
26711
  const { unregister } = safeRegister();
@@ -26845,7 +26770,13 @@ var init_migrationPreparator = __esm({
26845
26770
  const idPrev = prevSnapshot.id;
26846
26771
  const { version, dialect: dialect6, ...rest } = serialized;
26847
26772
  const result = { version, dialect: dialect6, id, prevId: idPrev, ...rest };
26848
- return { prev: prevSnapshot, cur: result };
26773
+ const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
26774
+ const custom = {
26775
+ id,
26776
+ prevId: idPrev,
26777
+ ...prevRest
26778
+ };
26779
+ return { prev: prevSnapshot, cur: result, custom };
26849
26780
  };
26850
26781
  prepareSqliteMigrationSnapshot = (snapshots, schemaPath) => {
26851
26782
  const prevSnapshot = sqliteSchema.parse(
@@ -26862,7 +26793,13 @@ var init_migrationPreparator = __esm({
26862
26793
  prevId: idPrev,
26863
26794
  ...rest
26864
26795
  };
26865
- return { prev: prevSnapshot, cur: result };
26796
+ const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
26797
+ const custom = {
26798
+ id,
26799
+ prevId: idPrev,
26800
+ ...prevRest
26801
+ };
26802
+ return { prev: prevSnapshot, cur: result, custom };
26866
26803
  };
26867
26804
  preparePgMigrationSnapshot = (snapshots, schemaPath) => {
26868
26805
  const prevSnapshot = pgSchema.parse(preparePrevSnapshot(snapshots, dryPg));
@@ -26871,7 +26808,13 @@ var init_migrationPreparator = __esm({
26871
26808
  const idPrev = prevSnapshot.id;
26872
26809
  const { version, dialect: dialect6, ...rest } = serialized;
26873
26810
  const result = { version, dialect: dialect6, id, prevId: idPrev, ...rest };
26874
- return { prev: prevSnapshot, cur: result };
26811
+ const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
26812
+ const custom = {
26813
+ id,
26814
+ prevId: idPrev,
26815
+ ...prevRest
26816
+ };
26817
+ return { prev: prevSnapshot, cur: result, custom };
26875
26818
  };
26876
26819
  preparePrevSnapshot = (snapshots, defaultPrev) => {
26877
26820
  let prevSnapshot;
@@ -26917,9 +26860,25 @@ var init_migrate = __esm({
26917
26860
  try {
26918
26861
  assertV1OutFolder(outFolder, "pg");
26919
26862
  const { snapshots, journal } = prepareMigrationFolder(outFolder, "pg");
26920
- const { prev, cur } = preparePgMigrationSnapshot(snapshots, schemaPath);
26863
+ const { prev, cur, custom } = preparePgMigrationSnapshot(snapshots, schemaPath);
26921
26864
  const validatedPrev = pgSchema.parse(prev);
26922
26865
  const validatedCur = pgSchema.parse(cur);
26866
+ if (config.custom) {
26867
+ writeResult(
26868
+ custom,
26869
+ [],
26870
+ journal,
26871
+ {
26872
+ columns: {},
26873
+ schemas: {},
26874
+ tables: {}
26875
+ },
26876
+ outFolder,
26877
+ config.breakpoints,
26878
+ "custom"
26879
+ );
26880
+ return;
26881
+ }
26923
26882
  const squashedPrev = squashPgScheme(validatedPrev);
26924
26883
  const squashedCur = squashPgScheme(validatedCur);
26925
26884
  const { sqlStatements, _meta } = await prepareSQL(
@@ -26947,9 +26906,25 @@ var init_migrate = __esm({
26947
26906
  try {
26948
26907
  assertV1OutFolder(outFolder, "mysql");
26949
26908
  const { snapshots, journal } = prepareMigrationFolder(outFolder, "mysql");
26950
- const { prev, cur } = prepareMySqlMigrationSnapshot(snapshots, schemaPath);
26909
+ const { prev, cur, custom } = prepareMySqlMigrationSnapshot(snapshots, schemaPath);
26951
26910
  const validatedPrev = mysqlSchema.parse(prev);
26952
26911
  const validatedCur = mysqlSchema.parse(cur);
26912
+ if (config.custom) {
26913
+ writeResult(
26914
+ custom,
26915
+ [],
26916
+ journal,
26917
+ {
26918
+ columns: {},
26919
+ schemas: {},
26920
+ tables: {}
26921
+ },
26922
+ outFolder,
26923
+ config.breakpoints,
26924
+ "custom"
26925
+ );
26926
+ return;
26927
+ }
26953
26928
  const squashedPrev = squashMysqlScheme(validatedPrev);
26954
26929
  const squashedCur = squashMysqlScheme(validatedCur);
26955
26930
  const { sqlStatements, _meta } = await prepareSQL(
@@ -26977,9 +26952,25 @@ var init_migrate = __esm({
26977
26952
  try {
26978
26953
  assertV1OutFolder(outFolder, "sqlite");
26979
26954
  const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
26980
- const { prev, cur } = prepareSqliteMigrationSnapshot(snapshots, schemaPath);
26955
+ const { prev, cur, custom } = prepareSqliteMigrationSnapshot(snapshots, schemaPath);
26981
26956
  const validatedPrev = sqliteSchema.parse(prev);
26982
26957
  const validatedCur = sqliteSchema.parse(cur);
26958
+ if (config.custom) {
26959
+ writeResult(
26960
+ custom,
26961
+ [],
26962
+ journal,
26963
+ {
26964
+ columns: {},
26965
+ schemas: {},
26966
+ tables: {}
26967
+ },
26968
+ outFolder,
26969
+ config.breakpoints,
26970
+ "custom"
26971
+ );
26972
+ return;
26973
+ }
26983
26974
  const squashedPrev = squashSqliteScheme(validatedPrev);
26984
26975
  const squashedCur = squashSqliteScheme(validatedCur);
26985
26976
  const { sqlStatements, _meta } = await prepareSQL(
@@ -27181,11 +27172,13 @@ var init_migrate = __esm({
27181
27172
  result.deleted.push(...leftMissing);
27182
27173
  return result;
27183
27174
  };
27184
- writeResult = (cur, sqlStatements, journal, _meta, outFolder, breakpoints, isIntrospect = false) => {
27185
- console.log(schema(cur));
27186
- if (sqlStatements.length === 0) {
27187
- console.log("No schema changes, nothing to migrate \u{1F634}");
27188
- return;
27175
+ writeResult = (cur, sqlStatements, journal, _meta, outFolder, breakpoints, type = "none") => {
27176
+ if (type === "none") {
27177
+ console.log(schema(cur));
27178
+ if (sqlStatements.length === 0) {
27179
+ console.log("No schema changes, nothing to migrate \u{1F634}");
27180
+ return;
27181
+ }
27189
27182
  }
27190
27183
  const lastEntryInJournal = journal.entries[journal.entries.length - 1];
27191
27184
  const idx = typeof lastEntryInJournal === "undefined" ? 0 : lastEntryInJournal.idx + 1;
@@ -27200,13 +27193,17 @@ var init_migrate = __esm({
27200
27193
  );
27201
27194
  const sqlDelimiter = breakpoints ? "--> statement-breakpoint\n" : "\n";
27202
27195
  let sql = sqlStatements.join(sqlDelimiter);
27203
- if (isIntrospect) {
27196
+ if (type === "introspect") {
27204
27197
  sql = `-- Current sql file was generated after introspecting the database
27205
27198
  -- If you want to run this migration please uncomment this code before executing migraitons
27206
27199
  /*
27207
27200
  ${sql}
27208
27201
  */`;
27209
27202
  }
27203
+ if (type === "custom") {
27204
+ console.log("Prepared empty file for your custom SQL migration!");
27205
+ sql = "-- Custom SQL migration file, put you code below! --";
27206
+ }
27210
27207
  journal.entries.push({
27211
27208
  idx,
27212
27209
  version: cur.version,
@@ -28299,9 +28296,9 @@ var require_pg_types = __commonJS({
28299
28296
  }
28300
28297
  });
28301
28298
 
28302
- // node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/defaults.js
28299
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/defaults.js
28303
28300
  var require_defaults = __commonJS({
28304
- "node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/defaults.js"(exports, module2) {
28301
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/defaults.js"(exports, module2) {
28305
28302
  "use strict";
28306
28303
  module2.exports = {
28307
28304
  host: "localhost",
@@ -28338,9 +28335,9 @@ var require_defaults = __commonJS({
28338
28335
  }
28339
28336
  });
28340
28337
 
28341
- // node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/utils.js
28338
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/utils.js
28342
28339
  var require_utils2 = __commonJS({
28343
- "node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/utils.js"(exports, module2) {
28340
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/utils.js"(exports, module2) {
28344
28341
  "use strict";
28345
28342
  var crypto = require("crypto");
28346
28343
  var defaults = require_defaults();
@@ -28476,9 +28473,9 @@ var require_utils2 = __commonJS({
28476
28473
  }
28477
28474
  });
28478
28475
 
28479
- // node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/sasl.js
28476
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/sasl.js
28480
28477
  var require_sasl = __commonJS({
28481
- "node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/sasl.js"(exports, module2) {
28478
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/sasl.js"(exports, module2) {
28482
28479
  "use strict";
28483
28480
  var crypto = require("crypto");
28484
28481
  function startSession(mechanisms) {
@@ -28500,9 +28497,6 @@ var require_sasl = __commonJS({
28500
28497
  if (typeof password !== "string") {
28501
28498
  throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");
28502
28499
  }
28503
- if (password === "") {
28504
- throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string");
28505
- }
28506
28500
  if (typeof serverData !== "string") {
28507
28501
  throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string");
28508
28502
  }
@@ -28513,7 +28507,7 @@ var require_sasl = __commonJS({
28513
28507
  throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short");
28514
28508
  }
28515
28509
  var saltBytes = Buffer.from(sv.salt, "base64");
28516
- var saltedPassword = crypto.pbkdf2Sync(password, saltBytes, sv.iteration, 32, "sha256");
28510
+ var saltedPassword = Hi(password, saltBytes, sv.iteration);
28517
28511
  var clientKey = hmacSha256(saltedPassword, "Client Key");
28518
28512
  var storedKey = sha256(clientKey);
28519
28513
  var clientFirstMessageBare = "n=*,r=" + session.clientNonce;
@@ -28625,6 +28619,15 @@ var require_sasl = __commonJS({
28625
28619
  function hmacSha256(key, msg) {
28626
28620
  return crypto.createHmac("sha256", key).update(msg).digest();
28627
28621
  }
28622
+ function Hi(password, saltBytes, iterations) {
28623
+ var ui1 = hmacSha256(password, Buffer.concat([saltBytes, Buffer.from([0, 0, 0, 1])]));
28624
+ var ui = ui1;
28625
+ for (var i = 0; i < iterations - 1; i++) {
28626
+ ui1 = hmacSha256(password, ui1);
28627
+ ui = xorBuffers(ui, ui1);
28628
+ }
28629
+ return ui;
28630
+ }
28628
28631
  module2.exports = {
28629
28632
  startSession,
28630
28633
  continueSession,
@@ -28633,9 +28636,9 @@ var require_sasl = __commonJS({
28633
28636
  }
28634
28637
  });
28635
28638
 
28636
- // node_modules/.pnpm/split2@4.1.0/node_modules/split2/index.js
28639
+ // node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js
28637
28640
  var require_split2 = __commonJS({
28638
- "node_modules/.pnpm/split2@4.1.0/node_modules/split2/index.js"(exports, module2) {
28641
+ "node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js"(exports, module2) {
28639
28642
  "use strict";
28640
28643
  var { Transform } = require("stream");
28641
28644
  var { StringDecoder } = require("string_decoder");
@@ -28697,7 +28700,7 @@ var require_split2 = __commonJS({
28697
28700
  if (typeof matcher === "function") {
28698
28701
  mapper = matcher;
28699
28702
  matcher = /\r?\n/;
28700
- } else if (typeof matcher === "object" && !(matcher instanceof RegExp)) {
28703
+ } else if (typeof matcher === "object" && !(matcher instanceof RegExp) && !matcher[Symbol.split]) {
28701
28704
  options = matcher;
28702
28705
  matcher = /\r?\n/;
28703
28706
  }
@@ -28922,9 +28925,9 @@ var require_lib2 = __commonJS({
28922
28925
  }
28923
28926
  });
28924
28927
 
28925
- // node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/type-overrides.js
28928
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/type-overrides.js
28926
28929
  var require_type_overrides = __commonJS({
28927
- "node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/type-overrides.js"(exports, module2) {
28930
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/type-overrides.js"(exports, module2) {
28928
28931
  "use strict";
28929
28932
  var types = require_pg_types();
28930
28933
  function TypeOverrides(userTypes) {
@@ -29042,9 +29045,9 @@ var require_pg_connection_string = __commonJS({
29042
29045
  }
29043
29046
  });
29044
29047
 
29045
- // node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/connection-parameters.js
29048
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/connection-parameters.js
29046
29049
  var require_connection_parameters = __commonJS({
29047
- "node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/connection-parameters.js"(exports, module2) {
29050
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/connection-parameters.js"(exports, module2) {
29048
29051
  "use strict";
29049
29052
  var dns = require("dns");
29050
29053
  var defaults = require_defaults();
@@ -29181,9 +29184,9 @@ var require_connection_parameters = __commonJS({
29181
29184
  }
29182
29185
  });
29183
29186
 
29184
- // node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/result.js
29187
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/result.js
29185
29188
  var require_result = __commonJS({
29186
- "node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/result.js"(exports, module2) {
29189
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/result.js"(exports, module2) {
29187
29190
  "use strict";
29188
29191
  var types = require_pg_types();
29189
29192
  var matchRegexp = /^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/;
@@ -29266,9 +29269,9 @@ var require_result = __commonJS({
29266
29269
  }
29267
29270
  });
29268
29271
 
29269
- // node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/query.js
29272
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/query.js
29270
29273
  var require_query = __commonJS({
29271
- "node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/query.js"(exports, module2) {
29274
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/query.js"(exports, module2) {
29272
29275
  "use strict";
29273
29276
  var { EventEmitter } = require("events");
29274
29277
  var Result = require_result();
@@ -30234,9 +30237,9 @@ var require_dist = __commonJS({
30234
30237
  }
30235
30238
  });
30236
30239
 
30237
- // node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/connection.js
30240
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/connection.js
30238
30241
  var require_connection = __commonJS({
30239
- "node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/connection.js"(exports, module2) {
30242
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/connection.js"(exports, module2) {
30240
30243
  "use strict";
30241
30244
  var net = require("net");
30242
30245
  var EventEmitter = require("events").EventEmitter;
@@ -30249,9 +30252,6 @@ var require_connection = __commonJS({
30249
30252
  super();
30250
30253
  config = config || {};
30251
30254
  this.stream = config.stream || new net.Socket();
30252
- if (typeof this.stream === "function") {
30253
- this.stream = this.stream(config);
30254
- }
30255
30255
  this._keepAlive = config.keepAlive;
30256
30256
  this._keepAliveInitialDelayMillis = config.keepAliveInitialDelayMillis;
30257
30257
  this.lastBuffer = false;
@@ -30380,6 +30380,7 @@ var require_connection = __commonJS({
30380
30380
  }
30381
30381
  sync() {
30382
30382
  this._ending = true;
30383
+ this._send(flushBuffer);
30383
30384
  this._send(syncBuffer);
30384
30385
  }
30385
30386
  ref() {
@@ -30418,11 +30419,12 @@ var require_connection = __commonJS({
30418
30419
  }
30419
30420
  });
30420
30421
 
30421
- // node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/client.js
30422
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/client.js
30422
30423
  var require_client = __commonJS({
30423
- "node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/client.js"(exports, module2) {
30424
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/client.js"(exports, module2) {
30424
30425
  "use strict";
30425
30426
  var EventEmitter = require("events").EventEmitter;
30427
+ var util2 = require("util");
30426
30428
  var utils = require_utils2();
30427
30429
  var sasl = require_sasl();
30428
30430
  var pgPass = require_lib2();
@@ -30618,29 +30620,17 @@ var require_client = __commonJS({
30618
30620
  }
30619
30621
  _handleAuthSASL(msg) {
30620
30622
  this._checkPgPass(() => {
30621
- try {
30622
- this.saslSession = sasl.startSession(msg.mechanisms);
30623
- this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism, this.saslSession.response);
30624
- } catch (err2) {
30625
- this.connection.emit("error", err2);
30626
- }
30623
+ this.saslSession = sasl.startSession(msg.mechanisms);
30624
+ this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism, this.saslSession.response);
30627
30625
  });
30628
30626
  }
30629
30627
  _handleAuthSASLContinue(msg) {
30630
- try {
30631
- sasl.continueSession(this.saslSession, this.password, msg.data);
30632
- this.connection.sendSCRAMClientFinalMessage(this.saslSession.response);
30633
- } catch (err2) {
30634
- this.connection.emit("error", err2);
30635
- }
30628
+ sasl.continueSession(this.saslSession, this.password, msg.data);
30629
+ this.connection.sendSCRAMClientFinalMessage(this.saslSession.response);
30636
30630
  }
30637
30631
  _handleAuthSASLFinal(msg) {
30638
- try {
30639
- sasl.finalizeSession(this.saslSession, msg.data);
30640
- this.saslSession = null;
30641
- } catch (err2) {
30642
- this.connection.emit("error", err2);
30643
- }
30632
+ sasl.finalizeSession(this.saslSession, msg.data);
30633
+ this.saslSession = null;
30644
30634
  }
30645
30635
  _handleBackendKeyData(msg) {
30646
30636
  this.processID = msg.processID;
@@ -30919,9 +30909,9 @@ var require_client = __commonJS({
30919
30909
  }
30920
30910
  });
30921
30911
 
30922
- // node_modules/.pnpm/pg-pool@3.5.2_pg@8.9.0/node_modules/pg-pool/index.js
30912
+ // node_modules/.pnpm/pg-pool@3.6.0_pg@8.8.0/node_modules/pg-pool/index.js
30923
30913
  var require_pg_pool = __commonJS({
30924
- "node_modules/.pnpm/pg-pool@3.5.2_pg@8.9.0/node_modules/pg-pool/index.js"(exports, module2) {
30914
+ "node_modules/.pnpm/pg-pool@3.6.0_pg@8.8.0/node_modules/pg-pool/index.js"(exports, module2) {
30925
30915
  "use strict";
30926
30916
  var EventEmitter = require("events").EventEmitter;
30927
30917
  var NOOP = function() {
@@ -31183,6 +31173,7 @@ var require_pg_pool = __commonJS({
31183
31173
  _release(client, idleListener, err2) {
31184
31174
  client.on("error", idleListener);
31185
31175
  client._poolUseCount = (client._poolUseCount || 0) + 1;
31176
+ this.emit("release", err2, client);
31186
31177
  if (err2 || this.ending || !client._queryable || client._ending || client._poolUseCount >= this.options.maxUses) {
31187
31178
  if (client._poolUseCount >= this.options.maxUses) {
31188
31179
  this.log("remove expended client");
@@ -31294,9 +31285,72 @@ var require_pg_pool = __commonJS({
31294
31285
  }
31295
31286
  });
31296
31287
 
31297
- // node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/native/query.js
31288
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/package.json
31289
+ var require_package = __commonJS({
31290
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/package.json"(exports, module2) {
31291
+ module2.exports = {
31292
+ name: "pg",
31293
+ version: "8.8.0",
31294
+ description: "PostgreSQL client - pure javascript & libpq with the same API",
31295
+ keywords: [
31296
+ "database",
31297
+ "libpq",
31298
+ "pg",
31299
+ "postgre",
31300
+ "postgres",
31301
+ "postgresql",
31302
+ "rdbms"
31303
+ ],
31304
+ homepage: "https://github.com/brianc/node-postgres",
31305
+ repository: {
31306
+ type: "git",
31307
+ url: "git://github.com/brianc/node-postgres.git",
31308
+ directory: "packages/pg"
31309
+ },
31310
+ author: "Brian Carlson <brian.m.carlson@gmail.com>",
31311
+ main: "./lib",
31312
+ dependencies: {
31313
+ "buffer-writer": "2.0.0",
31314
+ "packet-reader": "1.0.0",
31315
+ "pg-connection-string": "^2.5.0",
31316
+ "pg-pool": "^3.5.2",
31317
+ "pg-protocol": "^1.5.0",
31318
+ "pg-types": "^2.1.0",
31319
+ pgpass: "1.x"
31320
+ },
31321
+ devDependencies: {
31322
+ async: "2.6.4",
31323
+ bluebird: "3.5.2",
31324
+ co: "4.6.0",
31325
+ "pg-copy-streams": "0.3.0"
31326
+ },
31327
+ peerDependencies: {
31328
+ "pg-native": ">=3.0.1"
31329
+ },
31330
+ peerDependenciesMeta: {
31331
+ "pg-native": {
31332
+ optional: true
31333
+ }
31334
+ },
31335
+ scripts: {
31336
+ test: "make test-all"
31337
+ },
31338
+ files: [
31339
+ "lib",
31340
+ "SPONSORS.md"
31341
+ ],
31342
+ license: "MIT",
31343
+ engines: {
31344
+ node: ">= 8.0.0"
31345
+ },
31346
+ gitHead: "c99fb2c127ddf8d712500db2c7b9a5491a178655"
31347
+ };
31348
+ }
31349
+ });
31350
+
31351
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/query.js
31298
31352
  var require_query2 = __commonJS({
31299
- "node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/native/query.js"(exports, module2) {
31353
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/query.js"(exports, module2) {
31300
31354
  "use strict";
31301
31355
  var EventEmitter = require("events").EventEmitter;
31302
31356
  var util2 = require("util");
@@ -31435,12 +31489,13 @@ var require_query2 = __commonJS({
31435
31489
  }
31436
31490
  });
31437
31491
 
31438
- // node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/native/client.js
31492
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/client.js
31439
31493
  var require_client2 = __commonJS({
31440
- "node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/native/client.js"(exports, module2) {
31494
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/client.js"(exports, module2) {
31441
31495
  "use strict";
31442
31496
  var Native = require("pg-native");
31443
31497
  var TypeOverrides = require_type_overrides();
31498
+ var pkg = require_package();
31444
31499
  var EventEmitter = require("events").EventEmitter;
31445
31500
  var util2 = require("util");
31446
31501
  var ConnectionParameters = require_connection_parameters();
@@ -31667,17 +31722,17 @@ var require_client2 = __commonJS({
31667
31722
  }
31668
31723
  });
31669
31724
 
31670
- // node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/native/index.js
31725
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/index.js
31671
31726
  var require_native = __commonJS({
31672
- "node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/native/index.js"(exports, module2) {
31727
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/index.js"(exports, module2) {
31673
31728
  "use strict";
31674
31729
  module2.exports = require_client2();
31675
31730
  }
31676
31731
  });
31677
31732
 
31678
- // node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/index.js
31733
+ // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/index.js
31679
31734
  var require_lib3 = __commonJS({
31680
- "node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/index.js"(exports, module2) {
31735
+ "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/index.js"(exports, module2) {
31681
31736
  "use strict";
31682
31737
  var Client = require_client();
31683
31738
  var defaults = require_defaults();
@@ -45623,9 +45678,9 @@ var require_connection_config = __commonJS({
45623
45678
  }
45624
45679
  });
45625
45680
 
45626
- // node_modules/.pnpm/lru-cache@7.18.1/node_modules/lru-cache/index.js
45681
+ // node_modules/.pnpm/lru-cache@7.18.3/node_modules/lru-cache/index.js
45627
45682
  var require_lru_cache2 = __commonJS({
45628
- "node_modules/.pnpm/lru-cache@7.18.1/node_modules/lru-cache/index.js"(exports, module2) {
45683
+ "node_modules/.pnpm/lru-cache@7.18.3/node_modules/lru-cache/index.js"(exports, module2) {
45629
45684
  var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
45630
45685
  var hasAbortController = typeof AbortController === "function";
45631
45686
  var AC = hasAbortController ? AbortController : class AbortController {
@@ -46020,46 +46075,46 @@ var require_lru_cache2 = __commonJS({
46020
46075
  }
46021
46076
  }
46022
46077
  isValidIndex(index4) {
46023
- return this.keyMap.get(this.keyList[index4]) === index4;
46078
+ return index4 !== void 0 && this.keyMap.get(this.keyList[index4]) === index4;
46024
46079
  }
46025
46080
  *entries() {
46026
46081
  for (const i of this.indexes()) {
46027
- if (!this.isBackgroundFetch(this.valList[i])) {
46082
+ if (this.valList[i] !== void 0 && this.keyList[i] !== void 0 && !this.isBackgroundFetch(this.valList[i])) {
46028
46083
  yield [this.keyList[i], this.valList[i]];
46029
46084
  }
46030
46085
  }
46031
46086
  }
46032
46087
  *rentries() {
46033
46088
  for (const i of this.rindexes()) {
46034
- if (!this.isBackgroundFetch(this.valList[i])) {
46089
+ if (this.valList[i] !== void 0 && this.keyList[i] !== void 0 && !this.isBackgroundFetch(this.valList[i])) {
46035
46090
  yield [this.keyList[i], this.valList[i]];
46036
46091
  }
46037
46092
  }
46038
46093
  }
46039
46094
  *keys() {
46040
46095
  for (const i of this.indexes()) {
46041
- if (!this.isBackgroundFetch(this.valList[i])) {
46096
+ if (this.keyList[i] !== void 0 && !this.isBackgroundFetch(this.valList[i])) {
46042
46097
  yield this.keyList[i];
46043
46098
  }
46044
46099
  }
46045
46100
  }
46046
46101
  *rkeys() {
46047
46102
  for (const i of this.rindexes()) {
46048
- if (!this.isBackgroundFetch(this.valList[i])) {
46103
+ if (this.keyList[i] !== void 0 && !this.isBackgroundFetch(this.valList[i])) {
46049
46104
  yield this.keyList[i];
46050
46105
  }
46051
46106
  }
46052
46107
  }
46053
46108
  *values() {
46054
46109
  for (const i of this.indexes()) {
46055
- if (!this.isBackgroundFetch(this.valList[i])) {
46110
+ if (this.valList[i] !== void 0 && !this.isBackgroundFetch(this.valList[i])) {
46056
46111
  yield this.valList[i];
46057
46112
  }
46058
46113
  }
46059
46114
  }
46060
46115
  *rvalues() {
46061
46116
  for (const i of this.rindexes()) {
46062
- if (!this.isBackgroundFetch(this.valList[i])) {
46117
+ if (this.valList[i] !== void 0 && !this.isBackgroundFetch(this.valList[i])) {
46063
46118
  yield this.valList[i];
46064
46119
  }
46065
46120
  }
@@ -46067,21 +46122,33 @@ var require_lru_cache2 = __commonJS({
46067
46122
  [Symbol.iterator]() {
46068
46123
  return this.entries();
46069
46124
  }
46070
- find(fn, getOptions = {}) {
46125
+ find(fn, getOptions) {
46071
46126
  for (const i of this.indexes()) {
46072
- if (fn(this.valList[i], this.keyList[i], this)) {
46127
+ const v = this.valList[i];
46128
+ const value = this.isBackgroundFetch(v) ? v.__staleWhileFetching : v;
46129
+ if (value === void 0)
46130
+ continue;
46131
+ if (fn(value, this.keyList[i], this)) {
46073
46132
  return this.get(this.keyList[i], getOptions);
46074
46133
  }
46075
46134
  }
46076
46135
  }
46077
46136
  forEach(fn, thisp = this) {
46078
46137
  for (const i of this.indexes()) {
46079
- fn.call(thisp, this.valList[i], this.keyList[i], this);
46138
+ const v = this.valList[i];
46139
+ const value = this.isBackgroundFetch(v) ? v.__staleWhileFetching : v;
46140
+ if (value === void 0)
46141
+ continue;
46142
+ fn.call(thisp, value, this.keyList[i], this);
46080
46143
  }
46081
46144
  }
46082
46145
  rforEach(fn, thisp = this) {
46083
46146
  for (const i of this.rindexes()) {
46084
- fn.call(thisp, this.valList[i], this.keyList[i], this);
46147
+ const v = this.valList[i];
46148
+ const value = this.isBackgroundFetch(v) ? v.__staleWhileFetching : v;
46149
+ if (value === void 0)
46150
+ continue;
46151
+ fn.call(thisp, value, this.keyList[i], this);
46085
46152
  }
46086
46153
  }
46087
46154
  get prune() {
@@ -49166,7 +49233,7 @@ __export(cli_exports, {
49166
49233
  });
49167
49234
  module.exports = __toCommonJS(cli_exports);
49168
49235
 
49169
- // node_modules/.pnpm/commander@9.5.0/node_modules/commander/esm.mjs
49236
+ // node_modules/.pnpm/commander@9.4.1/node_modules/commander/esm.mjs
49170
49237
  var import_index = __toESM(require_commander(), 1);
49171
49238
  var {
49172
49239
  program,
@@ -49242,7 +49309,7 @@ var assertPackages = (...pkgs) => {
49242
49309
  process.exit(1);
49243
49310
  }
49244
49311
  };
49245
- var requiredApiVersion = 3;
49312
+ var requiredApiVersion = 4;
49246
49313
  var assertOrmCoreVersion = () => {
49247
49314
  const { compatibilityVersion } = require("drizzle-orm/version");
49248
49315
  if (compatibilityVersion && compatibilityVersion === requiredApiVersion)
@@ -49273,7 +49340,7 @@ init_source();
49273
49340
  // package.json
49274
49341
  var package_default = {
49275
49342
  name: "drizzle-kit",
49276
- version: "0.17.0",
49343
+ version: "0.17.1",
49277
49344
  repository: "https://github.com/drizzle-team/drizzle-kit-mirror",
49278
49345
  author: "Drizzle Team",
49279
49346
  license: "MIT",
@@ -49339,8 +49406,9 @@ var package_default = {
49339
49406
  "@typescript-eslint/parser": "^5.46.1",
49340
49407
  ava: "^5.1.0",
49341
49408
  dockerode: "^3.3.4",
49409
+ dotenv: "^16.0.3",
49342
49410
  "drizzle-kit": "^0.16.8",
49343
- "drizzle-orm": "0.21.0-26e3751",
49411
+ "drizzle-orm": "0.23.2-e17a5ba",
49344
49412
  esbuild: "^0.15.7",
49345
49413
  "esbuild-register": "^3.3.3",
49346
49414
  eslint: "^8.29.0",
@@ -49467,21 +49535,22 @@ drizzle-orm: v${npmVersion}` : "";
49467
49535
  var configSchema = objectType({
49468
49536
  schema: unionType([stringType(), stringType().array()]),
49469
49537
  out: stringType().default("drizzle"),
49470
- breakpoints: booleanType()
49538
+ breakpoints: booleanType(),
49539
+ custom: booleanType()
49471
49540
  }).strict();
49472
49541
  var optionsSchema = objectType({
49473
49542
  schema: unionType([stringType(), stringType().array()]).optional(),
49474
49543
  out: stringType().optional(),
49475
49544
  config: stringType().optional(),
49476
- breakpoints: booleanType().optional().default(false)
49545
+ breakpoints: booleanType().optional().default(false),
49546
+ custom: booleanType().optional().default(false)
49477
49547
  }).strict();
49478
- var generatePgCommand = new Command("generate:pg").option("--schema <schema...>", "Path to a schema file or folder").option("--out <out>", `Output folder, 'drizzle' by default`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
49548
+ var generatePgCommand = new Command("generate:pg").option("--schema <schema...>", "Path to a schema file or folder").option("--out <out>", `Output folder, 'drizzle' by default`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option("--custom", "Prepare empty migration file for custom SQL").option(
49479
49549
  "--config <config>",
49480
49550
  "Path to a config.json file, drizzle.config.json by default"
49481
49551
  ).action(async (options) => {
49482
49552
  printVersions();
49483
49553
  assertOrmCoreVersion();
49484
- console.log(options);
49485
49554
  const oprtionsParsed = optionsSchema.parse(options);
49486
49555
  const result = prepareGenerateConfig(oprtionsParsed);
49487
49556
  if (result instanceof Error) {
@@ -49492,7 +49561,7 @@ var generatePgCommand = new Command("generate:pg").option("--schema <schema...>"
49492
49561
  const { prepareAndMigratePg: prepareAndMigratePg2 } = (init_migrate(), __toCommonJS(migrate_exports));
49493
49562
  await prepareAndMigratePg2(result);
49494
49563
  });
49495
- var generateMysqlCommand = new Command("generate:mysql").option("--schema <schema...>", "Path to a schema file or folder").option("--out <out>", `Output folder, 'drizzle' by default`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
49564
+ var generateMysqlCommand = new Command("generate:mysql").option("--schema <schema...>", "Path to a schema file or folder").option("--out <out>", `Output folder, 'drizzle' by default`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option("--custom", "Prepare empty migration file for custom SQL").option(
49496
49565
  "--config <config>",
49497
49566
  "Path to a config.json file, drizzle.config.json by default"
49498
49567
  ).action(async (options) => {
@@ -49508,7 +49577,7 @@ var generateMysqlCommand = new Command("generate:mysql").option("--schema <schem
49508
49577
  const { prepareAndMigrateMySql: prepareAndMigrateMySql2 } = (init_migrate(), __toCommonJS(migrate_exports));
49509
49578
  await prepareAndMigrateMySql2(result);
49510
49579
  });
49511
- var generateSqliteCommand = new Command("generate:sqlite").option("--schema <schema...>", "Path to a schema file or folder").option("--out <out>", `Output folder, 'drizzle' by default`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
49580
+ var generateSqliteCommand = new Command("generate:sqlite").option("--schema <schema...>", "Path to a schema file or folder").option("--out <out>", `Output folder, 'drizzle' by default`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option("--custom", "Prepare empty migration file for custom SQL").option(
49512
49581
  "--config <config>",
49513
49582
  "Path to a config.json file, drizzle.config.json by default"
49514
49583
  ).action(async (options) => {
@@ -49525,7 +49594,7 @@ var generateSqliteCommand = new Command("generate:sqlite").option("--schema <sch
49525
49594
  await prepareAndMigrateSqlite2(result);
49526
49595
  });
49527
49596
  var prepareGenerateConfig = (options) => {
49528
- const { schema: schema4, out, config, breakpoints } = options;
49597
+ const { schema: schema4, out, config, breakpoints, custom } = options;
49529
49598
  if (!(schema4 || out)) {
49530
49599
  const path2 = config != null ? config : "drizzle.config.json";
49531
49600
  const drizzleConfig = JSON.parse(
@@ -49536,7 +49605,7 @@ var prepareGenerateConfig = (options) => {
49536
49605
  if (!schema4) {
49537
49606
  return new Error(`'schema' param must be set`);
49538
49607
  }
49539
- return configSchema.parse({ schema: schema4, out, breakpoints });
49608
+ return configSchema.parse({ schema: schema4, out, breakpoints, custom });
49540
49609
  };
49541
49610
  var checkSchema = objectType({
49542
49611
  out: stringType().optional(),
@@ -49657,7 +49726,7 @@ var introspectPgCommand = new Command("introspect:pg").option("--out <out>", `Mi
49657
49726
  _meta,
49658
49727
  res.data.out,
49659
49728
  res.data.breakpoints,
49660
- true
49729
+ "introspect"
49661
49730
  );
49662
49731
  } else {
49663
49732
  (0, import_hanji6.render)(
@@ -49709,7 +49778,7 @@ var introspectMySqlCommand = new Command("introspect:mysql").option("--out <out>
49709
49778
  _meta,
49710
49779
  res.data.out,
49711
49780
  res.data.breakpoints,
49712
- true
49781
+ "introspect"
49713
49782
  );
49714
49783
  } else {
49715
49784
  (0, import_hanji6.render)(