drizzle-kit 0.17.1 → 0.17.2-5f6da95

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 +249 -241
  2. package/package.json +1 -1
  3. package/readme.md +20 -13
  4. package/utils.js +74 -104
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.17.1",
3
+ "version": "0.17.2-5f6da95",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
package/readme.md CHANGED
@@ -1,12 +1,12 @@
1
1
  ## Drizzle Kit
2
2
 
3
- DrizzleKit - is a CLI migrator tool for DrizzleORM. It is probably one and only tool that lets you completely automatically generate SQL migrations and covers ~95% of the common cases like delitions and renames by prompting user input.\
3
+ DrizzleKit - is a CLI migrator tool for DrizzleORM. It is probably one and only tool that lets you completely automatically generate SQL migrations and covers ~95% of the common cases like deletions and renames by prompting user input.
4
4
  <https://github.com/drizzle-team/drizzle-kit-mirror> - is a mirror repository for issues.
5
5
 
6
6
  ### How it works
7
7
 
8
- `drizzle-kit` will traverse `schema folder` or `schema file`, generate schema snapshot and compare it to the previous version(if there's one).\
9
- Based on the difference it will generate all needed SQL migrations and if there're any `automatically unresolvable` cases like `renames` it will prompt user for input.
8
+ `drizzle-kit` will traverse `schema folder` or `schema file`, generate schema snapshot and compare it to the previous version, if there's one.
9
+ Based on the difference it will generate all needed SQL migrations and if there are any `automatically unresolvable` cases like `renames` it will prompt user for input.
10
10
 
11
11
  For schema file:
12
12
 
@@ -78,7 +78,7 @@ Or put your file to `drizzle.config.json` configuration file:
78
78
 
79
79
  ## Upgrading to 0.17.0
80
80
 
81
- Before running any new migrations `drizzle-kit` will ask you to upgrade in a first place
81
+ Before running any new migrations `drizzle-kit` will ask you to upgrade first
82
82
 
83
83
  Migration file structure < 0.17.0
84
84
 
@@ -106,24 +106,24 @@ Migration file structure >= 0.17.0
106
106
  └ 📜 0001_strange_avengers.sql
107
107
  ```
108
108
 
109
- To easily migrate from previous folder structure to new you need to run `up` command in drizzle kit. It's a great helper to upgrade your migrations to new format on each drizzle kit major update
109
+ To easily migrate from previous folder structure to new you need to run `up` command in drizzle-kit. It's a great helper to upgrade your migrations to new format on each drizzle kit major update
110
110
 
111
111
  ![](media/up_mysql.gif)
112
112
  ---
113
113
 
114
114
  ## List of commands
115
115
 
116
- ### Generate SQL migrations based on current .ts schema\
116
+ ### Generate SQL migrations based on current .ts schema
117
117
 
118
118
  ---
119
119
 
120
120
  **`$ drizzle-kit generate:pg`** \
121
121
  **`$ drizzle-kit generate:mysql`** \
122
- **`$ drizzle-kit generate:sqlite`** \
122
+ **`$ drizzle-kit generate:sqlite`**
123
123
 
124
- `--config` [optional defalut=drizzle.config.json] config file path\
124
+ `--config` [optional default=drizzle.config.json] config file path\
125
125
  `--schema` path to typescript schema file or folder with multiple schema files\
126
- `--out` [optional default=drizzle/] migrations folder
126
+ `--out` [optional default=drizzle/] migrations folder\
127
127
 
128
128
  ```shell
129
129
  $ drizzle-kit generate:pg
@@ -137,13 +137,20 @@ $ drizzle-kit generate:pg --schema=./src/schema.ts
137
137
 
138
138
  $ drizzle-kit generate:pg --schema=./src/schema.ts --out=./migrations/
139
139
  ## runs generate command and outputs results to ./migration
140
+ ```
141
+
142
+ **Generate an empty SQL migration with `--custom`**
143
+
144
+ ```shell
145
+ $ drizzle-kit generate:pg --custom
146
+ ## runs generate command and outputs an empty migration for custom SQL
140
147
  ```
141
148
 
142
149
  ### Introspect existing database and generate typescript schema
143
150
 
144
151
  ---
145
152
 
146
- **`$ drizzle-kit introspect:pg`** \
153
+ **`$ drizzle-kit introspect:pg`**
147
154
  **`$ drizzle-kit introspect:mysql`**
148
155
 
149
156
  ```shell
@@ -163,7 +170,7 @@ drizzle-kit introspect:pg --out=migrations/ --host=0.0.0.0 --port=5432 --user=po
163
170
  **`$ drizzle-kit up:sqlite`**
164
171
 
165
172
  `--out` [optional] migrations folder\
166
- `--config` [optional defalut=drizzle.config.json] config file path
173
+ `--config` [optional default=drizzle.config.json] config file path
167
174
 
168
175
  ```shell
169
176
  ## migrations folder is taken from drizzle.config.json
@@ -181,7 +188,7 @@ drizzle-kit up:mysql --out=migrations/
181
188
  **`$ drizzle-kit drop`** \
182
189
 
183
190
  `--out` [optional] migrations folder\
184
- `--config` [optional defalut=drizzle.config.json] config file path
191
+ `--config` [optional default=drizzle.config.json] config file path
185
192
 
186
193
  ![](media/drop.gif)
187
194
 
@@ -194,7 +201,7 @@ drizzle-kit up:mysql --out=migrations/
194
201
  **`$ drizzle-kit check:sqlite`**
195
202
 
196
203
  `--out` [optional] migration folder\
197
- `--config` [optional defalut=drizzle.config.json] config file path
204
+ `--config` [optional default=drizzle.config.json] config file path
198
205
 
199
206
  ```shell
200
207
  ## migrations folder is taken from drizzle.config.json
package/utils.js CHANGED
@@ -7169,7 +7169,7 @@ var info = (msg, greyMsg = "") => {
7169
7169
  var originUUID = "00000000-0000-0000-0000-000000000000";
7170
7170
  var snapshotVersion = "5";
7171
7171
 
7172
- // node_modules/.pnpm/zod@3.20.6/node_modules/zod/lib/index.mjs
7172
+ // node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
7173
7173
  var util;
7174
7174
  (function(util2) {
7175
7175
  util2.assertEqual = (val) => val;
@@ -7584,7 +7584,7 @@ var OK = (value) => ({ status: "valid", value });
7584
7584
  var isAborted = (x) => x.status === "aborted";
7585
7585
  var isDirty = (x) => x.status === "dirty";
7586
7586
  var isValid = (x) => x.status === "valid";
7587
- var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
7587
+ var isAsync = (x) => typeof Promise !== void 0 && x instanceof Promise;
7588
7588
  var errorUtil;
7589
7589
  (function(errorUtil2) {
7590
7590
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
@@ -7800,29 +7800,28 @@ var ZodType = class {
7800
7800
  return this._refinement(refinement);
7801
7801
  }
7802
7802
  optional() {
7803
- return ZodOptional.create(this, this._def);
7803
+ return ZodOptional.create(this);
7804
7804
  }
7805
7805
  nullable() {
7806
- return ZodNullable.create(this, this._def);
7806
+ return ZodNullable.create(this);
7807
7807
  }
7808
7808
  nullish() {
7809
- return this.nullable().optional();
7809
+ return this.optional().nullable();
7810
7810
  }
7811
7811
  array() {
7812
- return ZodArray.create(this, this._def);
7812
+ return ZodArray.create(this);
7813
7813
  }
7814
7814
  promise() {
7815
- return ZodPromise.create(this, this._def);
7815
+ return ZodPromise.create(this);
7816
7816
  }
7817
7817
  or(option) {
7818
- return ZodUnion.create([this, option], this._def);
7818
+ return ZodUnion.create([this, option]);
7819
7819
  }
7820
7820
  and(incoming) {
7821
- return ZodIntersection.create(this, incoming, this._def);
7821
+ return ZodIntersection.create(this, incoming);
7822
7822
  }
7823
7823
  transform(transform) {
7824
7824
  return new ZodEffects({
7825
- ...processCreateParams(this._def),
7826
7825
  schema: this,
7827
7826
  typeName: ZodFirstPartyTypeKind.ZodEffects,
7828
7827
  effect: { type: "transform", transform }
@@ -7831,7 +7830,6 @@ var ZodType = class {
7831
7830
  default(def) {
7832
7831
  const defaultValueFunc = typeof def === "function" ? def : () => def;
7833
7832
  return new ZodDefault({
7834
- ...processCreateParams(this._def),
7835
7833
  innerType: this,
7836
7834
  defaultValue: defaultValueFunc,
7837
7835
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -7841,15 +7839,14 @@ var ZodType = class {
7841
7839
  return new ZodBranded({
7842
7840
  typeName: ZodFirstPartyTypeKind.ZodBranded,
7843
7841
  type: this,
7844
- ...processCreateParams(this._def)
7842
+ ...processCreateParams(void 0)
7845
7843
  });
7846
7844
  }
7847
7845
  catch(def) {
7848
- const catchValueFunc = typeof def === "function" ? def : () => def;
7846
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
7849
7847
  return new ZodCatch({
7850
- ...processCreateParams(this._def),
7851
7848
  innerType: this,
7852
- catchValue: catchValueFunc,
7849
+ defaultValue: defaultValueFunc,
7853
7850
  typeName: ZodFirstPartyTypeKind.ZodCatch
7854
7851
  });
7855
7852
  }
@@ -7871,25 +7868,24 @@ var ZodType = class {
7871
7868
  }
7872
7869
  };
7873
7870
  var cuidRegex = /^c[^\s-]{8,}$/i;
7874
- var cuid2Regex = /^[a-z][a-z0-9]*$/;
7875
7871
  var 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;
7876
- var 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,}))$/;
7872
+ var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
7877
7873
  var datetimeRegex = (args) => {
7878
7874
  if (args.precision) {
7879
7875
  if (args.offset) {
7880
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
7876
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
7881
7877
  } else {
7882
7878
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
7883
7879
  }
7884
7880
  } else if (args.precision === 0) {
7885
7881
  if (args.offset) {
7886
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
7882
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
7887
7883
  } else {
7888
7884
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
7889
7885
  }
7890
7886
  } else {
7891
7887
  if (args.offset) {
7892
- return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
7888
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
7893
7889
  } else {
7894
7890
  return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
7895
7891
  }
@@ -8011,16 +8007,6 @@ var ZodString = class extends ZodType {
8011
8007
  });
8012
8008
  status.dirty();
8013
8009
  }
8014
- } else if (check.kind === "cuid2") {
8015
- if (!cuid2Regex.test(input.data)) {
8016
- ctx = this._getOrReturnCtx(input, ctx);
8017
- addIssueToContext(ctx, {
8018
- validation: "cuid2",
8019
- code: ZodIssueCode.invalid_string,
8020
- message: check.message
8021
- });
8022
- status.dirty();
8023
- }
8024
8010
  } else if (check.kind === "url") {
8025
8011
  try {
8026
8012
  new URL(input.data);
@@ -8102,9 +8088,6 @@ var ZodString = class extends ZodType {
8102
8088
  cuid(message) {
8103
8089
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
8104
8090
  }
8105
- cuid2(message) {
8106
- return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
8107
- }
8108
8091
  datetime(options) {
8109
8092
  var _a;
8110
8093
  if (typeof options === "string") {
@@ -8179,9 +8162,6 @@ var ZodString = class extends ZodType {
8179
8162
  get isCUID() {
8180
8163
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
8181
8164
  }
8182
- get isCUID2() {
8183
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
8184
- }
8185
8165
  get minLength() {
8186
8166
  let min = null;
8187
8167
  for (const ch of this._def.checks) {
@@ -8412,22 +8392,7 @@ var ZodNumber = class extends ZodType {
8412
8392
  return max;
8413
8393
  }
8414
8394
  get isInt() {
8415
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
8416
- }
8417
- get isFinite() {
8418
- let max = null, min = null;
8419
- for (const ch of this._def.checks) {
8420
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
8421
- return true;
8422
- } else if (ch.kind === "min") {
8423
- if (min === null || ch.value > min)
8424
- min = ch.value;
8425
- } else if (ch.kind === "max") {
8426
- if (max === null || ch.value < max)
8427
- max = ch.value;
8428
- }
8429
- }
8430
- return Number.isFinite(min) && Number.isFinite(max);
8395
+ return !!this._def.checks.find((ch) => ch.kind === "int");
8431
8396
  }
8432
8397
  };
8433
8398
  ZodNumber.create = (params) => {
@@ -8784,13 +8749,13 @@ var ZodArray = class extends ZodType {
8784
8749
  }
8785
8750
  }
8786
8751
  if (ctx.common.async) {
8787
- return Promise.all([...ctx.data].map((item, i) => {
8752
+ return Promise.all(ctx.data.map((item, i) => {
8788
8753
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
8789
8754
  })).then((result2) => {
8790
8755
  return ParseStatus.mergeArray(status, result2);
8791
8756
  });
8792
8757
  }
8793
- const result = [...ctx.data].map((item, i) => {
8758
+ const result = ctx.data.map((item, i) => {
8794
8759
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
8795
8760
  });
8796
8761
  return ParseStatus.mergeArray(status, result);
@@ -8839,6 +8804,15 @@ var objectUtil;
8839
8804
  };
8840
8805
  };
8841
8806
  })(objectUtil || (objectUtil = {}));
8807
+ var AugmentFactory = (def) => (augmentation) => {
8808
+ return new ZodObject({
8809
+ ...def,
8810
+ shape: () => ({
8811
+ ...def.shape(),
8812
+ ...augmentation
8813
+ })
8814
+ });
8815
+ };
8842
8816
  function deepPartialify(schema3) {
8843
8817
  if (schema3 instanceof ZodObject) {
8844
8818
  const newShape = {};
@@ -8867,7 +8841,8 @@ var ZodObject = class extends ZodType {
8867
8841
  super(...arguments);
8868
8842
  this._cached = null;
8869
8843
  this.nonstrict = this.passthrough;
8870
- this.augment = this.extend;
8844
+ this.augment = AugmentFactory(this._def);
8845
+ this.extend = AugmentFactory(this._def);
8871
8846
  }
8872
8847
  _getCached() {
8873
8848
  if (this._cached !== null)
@@ -8996,14 +8971,8 @@ var ZodObject = class extends ZodType {
8996
8971
  unknownKeys: "passthrough"
8997
8972
  });
8998
8973
  }
8999
- extend(augmentation) {
9000
- return new ZodObject({
9001
- ...this._def,
9002
- shape: () => ({
9003
- ...this._def.shape(),
9004
- ...augmentation
9005
- })
9006
- });
8974
+ setKey(key, schema3) {
8975
+ return this.augment({ [key]: schema3 });
9007
8976
  }
9008
8977
  merge(merging) {
9009
8978
  const merged = new ZodObject({
@@ -9014,9 +8983,6 @@ var ZodObject = class extends ZodType {
9014
8983
  });
9015
8984
  return merged;
9016
8985
  }
9017
- setKey(key, schema3) {
9018
- return this.augment({ [key]: schema3 });
9019
- }
9020
8986
  catchall(index4) {
9021
8987
  return new ZodObject({
9022
8988
  ...this._def,
@@ -9025,10 +8991,9 @@ var ZodObject = class extends ZodType {
9025
8991
  }
9026
8992
  pick(mask) {
9027
8993
  const shape = {};
9028
- util.objectKeys(mask).forEach((key) => {
9029
- if (mask[key] && this.shape[key]) {
8994
+ util.objectKeys(mask).map((key) => {
8995
+ if (this.shape[key])
9030
8996
  shape[key] = this.shape[key];
9031
- }
9032
8997
  });
9033
8998
  return new ZodObject({
9034
8999
  ...this._def,
@@ -9037,8 +9002,8 @@ var ZodObject = class extends ZodType {
9037
9002
  }
9038
9003
  omit(mask) {
9039
9004
  const shape = {};
9040
- util.objectKeys(this.shape).forEach((key) => {
9041
- if (!mask[key]) {
9005
+ util.objectKeys(this.shape).map((key) => {
9006
+ if (util.objectKeys(mask).indexOf(key) === -1) {
9042
9007
  shape[key] = this.shape[key];
9043
9008
  }
9044
9009
  });
@@ -9052,14 +9017,24 @@ var ZodObject = class extends ZodType {
9052
9017
  }
9053
9018
  partial(mask) {
9054
9019
  const newShape = {};
9055
- util.objectKeys(this.shape).forEach((key) => {
9056
- const fieldSchema = this.shape[key];
9057
- if (mask && !mask[key]) {
9058
- newShape[key] = fieldSchema;
9059
- } else {
9020
+ if (mask) {
9021
+ util.objectKeys(this.shape).map((key) => {
9022
+ if (util.objectKeys(mask).indexOf(key) === -1) {
9023
+ newShape[key] = this.shape[key];
9024
+ } else {
9025
+ newShape[key] = this.shape[key].optional();
9026
+ }
9027
+ });
9028
+ return new ZodObject({
9029
+ ...this._def,
9030
+ shape: () => newShape
9031
+ });
9032
+ } else {
9033
+ for (const key in this.shape) {
9034
+ const fieldSchema = this.shape[key];
9060
9035
  newShape[key] = fieldSchema.optional();
9061
9036
  }
9062
- });
9037
+ }
9063
9038
  return new ZodObject({
9064
9039
  ...this._def,
9065
9040
  shape: () => newShape
@@ -9067,10 +9042,21 @@ var ZodObject = class extends ZodType {
9067
9042
  }
9068
9043
  required(mask) {
9069
9044
  const newShape = {};
9070
- util.objectKeys(this.shape).forEach((key) => {
9071
- if (mask && !mask[key]) {
9072
- newShape[key] = this.shape[key];
9073
- } else {
9045
+ if (mask) {
9046
+ util.objectKeys(this.shape).map((key) => {
9047
+ if (util.objectKeys(mask).indexOf(key) === -1) {
9048
+ newShape[key] = this.shape[key];
9049
+ } else {
9050
+ const fieldSchema = this.shape[key];
9051
+ let newField = fieldSchema;
9052
+ while (newField instanceof ZodOptional) {
9053
+ newField = newField._def.innerType;
9054
+ }
9055
+ newShape[key] = newField;
9056
+ }
9057
+ });
9058
+ } else {
9059
+ for (const key in this.shape) {
9074
9060
  const fieldSchema = this.shape[key];
9075
9061
  let newField = fieldSchema;
9076
9062
  while (newField instanceof ZodOptional) {
@@ -9078,7 +9064,7 @@ var ZodObject = class extends ZodType {
9078
9064
  }
9079
9065
  newShape[key] = newField;
9080
9066
  }
9081
- });
9067
+ }
9082
9068
  return new ZodObject({
9083
9069
  ...this._def,
9084
9070
  shape: () => newShape
@@ -9418,7 +9404,7 @@ var ZodTuple = class extends ZodType {
9418
9404
  });
9419
9405
  status.dirty();
9420
9406
  }
9421
- const items = [...ctx.data].map((item, itemIndex) => {
9407
+ const items = ctx.data.map((item, itemIndex) => {
9422
9408
  const schema3 = this._def.items[itemIndex] || this._def.rest;
9423
9409
  if (!schema3)
9424
9410
  return null;
@@ -9785,7 +9771,6 @@ var ZodLiteral = class extends ZodType {
9785
9771
  if (input.data !== this._def.value) {
9786
9772
  const ctx = this._getOrReturnCtx(input);
9787
9773
  addIssueToContext(ctx, {
9788
- received: ctx.data,
9789
9774
  code: ZodIssueCode.invalid_literal,
9790
9775
  expected: this._def.value
9791
9776
  });
@@ -9859,12 +9844,6 @@ var ZodEnum = class extends ZodType {
9859
9844
  }
9860
9845
  return enumValues;
9861
9846
  }
9862
- extract(values) {
9863
- return ZodEnum.create(values);
9864
- }
9865
- exclude(values) {
9866
- return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
9867
- }
9868
9847
  };
9869
9848
  ZodEnum.create = createZodEnum;
9870
9849
  var ZodNativeEnum = class extends ZodType {
@@ -9903,9 +9882,6 @@ ZodNativeEnum.create = (values, params) => {
9903
9882
  });
9904
9883
  };
9905
9884
  var ZodPromise = class extends ZodType {
9906
- unwrap() {
9907
- return this._def.type;
9908
- }
9909
9885
  _parse(input) {
9910
9886
  const { ctx } = this._processInputParams(input);
9911
9887
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -10119,29 +10095,23 @@ var ZodCatch = class extends ZodType {
10119
10095
  const result = this._def.innerType._parse({
10120
10096
  data: ctx.data,
10121
10097
  path: ctx.path,
10122
- parent: {
10123
- ...ctx,
10124
- common: {
10125
- ...ctx.common,
10126
- issues: []
10127
- }
10128
- }
10098
+ parent: ctx
10129
10099
  });
10130
10100
  if (isAsync(result)) {
10131
10101
  return result.then((result2) => {
10132
10102
  return {
10133
10103
  status: "valid",
10134
- value: result2.status === "valid" ? result2.value : this._def.catchValue()
10104
+ value: result2.status === "valid" ? result2.value : this._def.defaultValue()
10135
10105
  };
10136
10106
  });
10137
10107
  } else {
10138
10108
  return {
10139
10109
  status: "valid",
10140
- value: result.status === "valid" ? result.value : this._def.catchValue()
10110
+ value: result.status === "valid" ? result.value : this._def.defaultValue()
10141
10111
  };
10142
10112
  }
10143
10113
  }
10144
- removeCatch() {
10114
+ removeDefault() {
10145
10115
  return this._def.innerType;
10146
10116
  }
10147
10117
  };
@@ -10149,7 +10119,7 @@ ZodCatch.create = (type, params) => {
10149
10119
  return new ZodCatch({
10150
10120
  innerType: type,
10151
10121
  typeName: ZodFirstPartyTypeKind.ZodCatch,
10152
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
10122
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
10153
10123
  ...processCreateParams(params)
10154
10124
  });
10155
10125
  };