@zenstackhq/orm 3.9.7-beta.1 → 3.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { t as __exportAll } from "./chunk-CfYAbeIz.mjs";
2
2
  import { AnyNull, AnyNullClass, DbNull, DbNullClass, JsonNull, JsonNullClass } from "./common-types.mjs";
3
3
  import { clone, enumerate, invariant, isPlainObject, lowerCaseFirst, upperCaseFirst } from "@zenstackhq/common-helpers";
4
4
  import { AliasNode, AndNode, ColumnNode, ColumnUpdateNode, CompiledQuery, DefaultConnectionProvider, DefaultQueryExecutor, DeleteQueryNode, ExpressionWrapper, FromNode, IdentifierNode, InsertQueryNode, Kysely, Log, OperationNodeTransformer, OperationNodeVisitor, PrimitiveValueListNode, RawNode, ReferenceNode, ReturningNode, SelectAllNode, SelectionNode, SingleConnectionProvider, TableNode, Transaction, UpdateQueryNode, ValueListNode, ValueNode, ValuesNode, WhereNode, createQueryId, expressionBuilder, sql } from "kysely";
5
- import z$1, { ZodObject, ZodType, z } from "zod";
5
+ import z, { ZodObject, ZodType, z as z$1 } from "zod";
6
6
  import { fromError } from "zod-validation-error/v4";
7
7
  import { P, match } from "ts-pattern";
8
8
  import { ExpressionUtils } from "@zenstackhq/schema";
@@ -2031,7 +2031,11 @@ var PostgresCrudDialect = class PostgresCrudDialect extends LateralJoinDialectBa
2031
2031
  if (columnResolved.sqlType === "uuid" && (op === "=" || op === "!=")) {
2032
2032
  const value = valueNode.value;
2033
2033
  if (typeof value === "string" && PostgresCrudDialect.uuidFormatRegex.test(value)) return this.eb(left, op, right);
2034
- else return this.eb.lit(op === "!=");
2034
+ else if (op === "=") return this.eb.lit(false);
2035
+ else {
2036
+ const column = valueNode === rightNode ? left : right;
2037
+ return this.eb(column, "is not", null);
2038
+ }
2035
2039
  }
2036
2040
  }
2037
2041
  getStringCasingBehavior() {
@@ -2429,7 +2433,7 @@ function createQuerySchemaFactory(clientOrSchema, options) {
2429
2433
  * @see https://github.com/zenstackhq/zenstack/issues/2631
2430
2434
  */
2431
2435
  function coercedDateTimeSchema() {
2432
- return z.preprocess((val) => {
2436
+ return z$1.preprocess((val) => {
2433
2437
  if (typeof val !== "string") return val;
2434
2438
  if (/^\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d\d(?::\d\d)?)?$/.test(val)) {
2435
2439
  const hasTz = val.endsWith("Z") || /[+-]\d\d(?::\d\d)?$/.test(val);
@@ -2438,10 +2442,10 @@ function coercedDateTimeSchema() {
2438
2442
  }
2439
2443
  const d = new Date(val);
2440
2444
  return isNaN(d.getTime()) ? val : d;
2441
- }, z.union([
2442
- z.iso.datetime(),
2443
- z.iso.date(),
2444
- z.date()
2445
+ }, z$1.union([
2446
+ z$1.iso.datetime(),
2447
+ z$1.iso.date(),
2448
+ z$1.date()
2445
2449
  ]));
2446
2450
  }
2447
2451
  /**
@@ -2449,7 +2453,7 @@ function coercedDateTimeSchema() {
2449
2453
  */
2450
2454
  var ZodSchemaFactory = class {
2451
2455
  schemaCache = /* @__PURE__ */ new Map();
2452
- schemaRegistry = z.registry();
2456
+ schemaRegistry = z$1.registry();
2453
2457
  allFilterKinds = [...new Set(Object.values(FILTER_PROPERTY_TO_KIND))];
2454
2458
  schema;
2455
2459
  options;
@@ -2541,7 +2545,7 @@ var ZodSchemaFactory = class {
2541
2545
  this.makeGroupBySchema(m);
2542
2546
  }
2543
2547
  for (const procName of Object.keys(this.schema.procedures ?? {})) if (this.isProcedureAllowed(procName)) this.makeProcedureArgsSchema(procName);
2544
- return z.toJSONSchema(this.schemaRegistry, { unrepresentable: "any" });
2548
+ return z$1.toJSONSchema(this.schemaRegistry, { unrepresentable: "any" });
2545
2549
  }
2546
2550
  get cacheStats() {
2547
2551
  return {
@@ -2570,13 +2574,13 @@ var ZodSchemaFactory = class {
2570
2574
  fields["omit"] = this.makeOmitSchema(model).optional().nullable();
2571
2575
  if (!unique) {
2572
2576
  fields["skip"] = this.makeSkipSchema().optional();
2573
- if (findOne) fields["take"] = z.literal(1).optional();
2577
+ if (findOne) fields["take"] = z$1.literal(1).optional();
2574
2578
  else fields["take"] = this.makeTakeSchema().optional();
2575
2579
  fields["orderBy"] = this.orArray(this.makeOrderBySchema(model, true, false, options), true).optional();
2576
2580
  fields["cursor"] = this.makeCursorSchema(model, options).optional();
2577
2581
  fields["distinct"] = this.makeDistinctSchema(model).optional();
2578
2582
  }
2579
- const baseSchema = z.strictObject(fields);
2583
+ const baseSchema = z$1.strictObject(fields);
2580
2584
  let result = this.mergePluginArgsSchema(baseSchema, operation);
2581
2585
  result = this.refineForSelectIncludeMutuallyExclusive(result);
2582
2586
  result = this.refineForSelectOmitMutuallyExclusive(result);
@@ -2586,7 +2590,7 @@ var ZodSchemaFactory = class {
2586
2590
  return result;
2587
2591
  }
2588
2592
  makeExistsSchema(model, options) {
2589
- const baseSchema = z.strictObject({ where: this.makeWhereSchema(model, false, false, false, options).optional() });
2593
+ const baseSchema = z$1.strictObject({ where: this.makeWhereSchema(model, false, false, false, options).optional() });
2590
2594
  const result = this.mergePluginArgsSchema(baseSchema, "exists").optional();
2591
2595
  this.registerSchema(`${model}ExistsArgs`, result);
2592
2596
  return result;
@@ -2594,19 +2598,19 @@ var ZodSchemaFactory = class {
2594
2598
  makeScalarSchema(type, attributes) {
2595
2599
  if (this.schema.typeDefs && type in this.schema.typeDefs) return this.makeTypeDefSchema(type);
2596
2600
  else if (this.schema.enums && type in this.schema.enums) return this.makeEnumSchema(type);
2597
- else return match(type).with("String", () => this.extraValidationsEnabled ? ZodUtils.addStringValidation(z.string(), attributes) : z.string()).with("Int", () => this.extraValidationsEnabled ? ZodUtils.addNumberValidation(z.number().int(), attributes) : z.number().int()).with("Float", () => this.extraValidationsEnabled ? ZodUtils.addNumberValidation(z.number(), attributes) : z.number()).with("Boolean", () => z.boolean()).with("BigInt", () => z.union([this.extraValidationsEnabled ? ZodUtils.addNumberValidation(z.number().int(), attributes) : z.number().int(), this.extraValidationsEnabled ? ZodUtils.addBigIntValidation(z.bigint(), attributes) : z.bigint()])).with("Decimal", () => {
2598
- return z.union([
2599
- this.extraValidationsEnabled ? ZodUtils.addNumberValidation(z.number(), attributes) : z.number(),
2600
- ZodUtils.addDecimalValidation(z.instanceof(Decimal), attributes, this.extraValidationsEnabled),
2601
- ZodUtils.addDecimalValidation(z.string(), attributes, this.extraValidationsEnabled)
2601
+ else return match(type).with("String", () => this.extraValidationsEnabled ? ZodUtils.addStringValidation(z$1.string(), attributes) : z$1.string()).with("Int", () => this.extraValidationsEnabled ? ZodUtils.addNumberValidation(z$1.number().int(), attributes) : z$1.number().int()).with("Float", () => this.extraValidationsEnabled ? ZodUtils.addNumberValidation(z$1.number(), attributes) : z$1.number()).with("Boolean", () => z$1.boolean()).with("BigInt", () => z$1.union([this.extraValidationsEnabled ? ZodUtils.addNumberValidation(z$1.number().int(), attributes) : z$1.number().int(), this.extraValidationsEnabled ? ZodUtils.addBigIntValidation(z$1.bigint(), attributes) : z$1.bigint()])).with("Decimal", () => {
2602
+ return z$1.union([
2603
+ this.extraValidationsEnabled ? ZodUtils.addNumberValidation(z$1.number(), attributes) : z$1.number(),
2604
+ ZodUtils.addDecimalValidation(z$1.instanceof(Decimal), attributes, this.extraValidationsEnabled),
2605
+ ZodUtils.addDecimalValidation(z$1.string(), attributes, this.extraValidationsEnabled)
2602
2606
  ]);
2603
- }).with("DateTime", () => this.makeDateTimeValueSchema()).with("Bytes", () => z.instanceof(Uint8Array)).with("Json", () => this.makeJsonValueSchema()).otherwise(() => z.unknown());
2607
+ }).with("DateTime", () => this.makeDateTimeValueSchema()).with("Bytes", () => z$1.instanceof(Uint8Array)).with("Json", () => this.makeJsonValueSchema()).otherwise(() => z$1.unknown());
2604
2608
  }
2605
2609
  isParameterizedComputedField(fieldDef) {
2606
2610
  return !!(fieldDef.computed && fieldDef.params);
2607
2611
  }
2608
2612
  makeFieldArgsSchema(params) {
2609
- return z.strictObject(Object.fromEntries(Object.entries(params).map(([name, param]) => {
2613
+ return z$1.strictObject(Object.fromEntries(Object.entries(params).map(([name, param]) => {
2610
2614
  let paramSchema = this.makeScalarSchema(param.type);
2611
2615
  if (param.array) paramSchema = paramSchema.array();
2612
2616
  if (param.optional) paramSchema = paramSchema.optional();
@@ -2614,9 +2618,9 @@ var ZodSchemaFactory = class {
2614
2618
  })));
2615
2619
  }
2616
2620
  addComputedArgsToFilter(filterSchema, params) {
2617
- const objectMembers = (filterSchema instanceof z.ZodUnion ? filterSchema.options : [filterSchema]).filter((m) => m instanceof z.ZodObject);
2621
+ const objectMembers = (filterSchema instanceof z$1.ZodUnion ? filterSchema.options : [filterSchema]).filter((m) => m instanceof z$1.ZodObject);
2618
2622
  const components = Object.assign({}, ...objectMembers.map((o) => o.shape));
2619
- return z.strictObject({
2623
+ return z$1.strictObject({
2620
2624
  args: this.makeFieldArgsSchema(params),
2621
2625
  ...components
2622
2626
  });
@@ -2624,20 +2628,20 @@ var ZodSchemaFactory = class {
2624
2628
  makeEnumSchema(_enum) {
2625
2629
  const enumDef = getEnum(this.schema, _enum);
2626
2630
  invariant(enumDef, `Enum "${_enum}" not found in schema`);
2627
- const schema = z.enum(Object.keys(enumDef.values));
2631
+ const schema = z$1.enum(Object.keys(enumDef.values));
2628
2632
  this.registerSchema(_enum, schema);
2629
2633
  return schema;
2630
2634
  }
2631
2635
  makeTypeDefSchema(type) {
2632
2636
  const typeDef = getTypeDef(this.schema, type);
2633
2637
  invariant(typeDef, `Type definition "${type}" not found in schema`);
2634
- const schema = (typeDef.strict ? z.strictObject : z.looseObject)(Object.fromEntries(Object.entries(typeDef.fields).map(([field, def]) => {
2635
- let fieldSchema = isTypeDef(this.schema, def.type) ? z.lazy(() => this.makeTypeDefSchema(def.type)) : this.makeScalarSchema(def.type);
2638
+ const schema = (typeDef.strict ? z$1.strictObject : z$1.looseObject)(Object.fromEntries(Object.entries(typeDef.fields).map(([field, def]) => {
2639
+ let fieldSchema = isTypeDef(this.schema, def.type) ? z$1.lazy(() => this.makeTypeDefSchema(def.type)) : this.makeScalarSchema(def.type);
2636
2640
  if (def.array) fieldSchema = fieldSchema.array();
2637
2641
  if (def.optional) fieldSchema = fieldSchema.nullish();
2638
2642
  return [field, fieldSchema];
2639
2643
  })));
2640
- const finalSchema = z.any().superRefine((value, ctx) => {
2644
+ const finalSchema = z$1.any().superRefine((value, ctx) => {
2641
2645
  const parseResult = schema.safeParse(value);
2642
2646
  if (!parseResult.success) parseResult.error.issues.forEach((issue) => ctx.addIssue(issue));
2643
2647
  });
@@ -2653,17 +2657,17 @@ var ZodSchemaFactory = class {
2653
2657
  if (fieldDef.relation) {
2654
2658
  if (withoutRelationFields || !this.shouldIncludeRelations(options)) continue;
2655
2659
  const allowedFilterKinds = this.getEffectiveFilterKinds(model, field);
2656
- if (allowedFilterKinds && !allowedFilterKinds.includes("Relation")) fieldSchema = z.never();
2660
+ if (allowedFilterKinds && !allowedFilterKinds.includes("Relation")) fieldSchema = z$1.never();
2657
2661
  else {
2658
- fieldSchema = z.lazy(() => this.makeWhereSchema(fieldDef.type, false, false, false, nextOpts).optional());
2659
- if (fieldDef.array) fieldSchema = z.strictObject({
2662
+ fieldSchema = z$1.lazy(() => this.makeWhereSchema(fieldDef.type, false, false, false, nextOpts).optional());
2663
+ if (fieldDef.array) fieldSchema = z$1.strictObject({
2660
2664
  some: fieldSchema.optional(),
2661
2665
  every: fieldSchema.optional(),
2662
2666
  none: fieldSchema.optional()
2663
2667
  });
2664
2668
  else {
2665
2669
  fieldSchema = this.nullableIf(fieldSchema, !fieldDef.array && !!fieldDef.optional);
2666
- fieldSchema = z.union([fieldSchema, z.strictObject({
2670
+ fieldSchema = z$1.union([fieldSchema, z$1.strictObject({
2667
2671
  is: fieldSchema.optional(),
2668
2672
  isNot: fieldSchema.optional()
2669
2673
  })]);
@@ -2683,21 +2687,21 @@ var ZodSchemaFactory = class {
2683
2687
  }
2684
2688
  if (unique) {
2685
2689
  const uniqueFields = getUniqueFields(this.schema, model);
2686
- for (const uniqueField of uniqueFields) if ("defs" in uniqueField) fields[uniqueField.name] = z.object(Object.fromEntries(Object.entries(uniqueField.defs).map(([key, def]) => {
2690
+ for (const uniqueField of uniqueFields) if ("defs" in uniqueField) fields[uniqueField.name] = z$1.object(Object.fromEntries(Object.entries(uniqueField.defs).map(([key, def]) => {
2687
2691
  invariant(!def.relation, "unique field cannot be a relation");
2688
2692
  let fieldSchema;
2689
2693
  const enumDef = getEnum(this.schema, def.type);
2690
2694
  if (enumDef) if (Object.keys(enumDef.values).length > 0) fieldSchema = this.makeEnumFilterSchema(def.type, !!def.optional, !!def.array, false, void 0);
2691
- else fieldSchema = z.never();
2695
+ else fieldSchema = z$1.never();
2692
2696
  else fieldSchema = this.makePrimitiveFilterSchema(def.type, !!def.optional, false, void 0);
2693
2697
  return [key, fieldSchema];
2694
2698
  }))).optional();
2695
2699
  }
2696
- fields["$expr"] = z.custom((v) => typeof v === "function", { error: "\"$expr\" must be a function" }).optional();
2697
- fields["AND"] = this.orArray(z.lazy(() => this.makeWhereSchema(model, false, withoutRelationFields, false, options)), true).optional();
2698
- fields["OR"] = z.lazy(() => this.makeWhereSchema(model, false, withoutRelationFields, false, options)).array().optional();
2699
- fields["NOT"] = this.orArray(z.lazy(() => this.makeWhereSchema(model, false, withoutRelationFields, false, options)), true).optional();
2700
- const baseWhere = z.strictObject(fields);
2700
+ fields["$expr"] = z$1.custom((v) => typeof v === "function", { error: "\"$expr\" must be a function" }).optional();
2701
+ fields["AND"] = this.orArray(z$1.lazy(() => this.makeWhereSchema(model, false, withoutRelationFields, false, options)), true).optional();
2702
+ fields["OR"] = z$1.lazy(() => this.makeWhereSchema(model, false, withoutRelationFields, false, options)).array().optional();
2703
+ fields["NOT"] = this.orArray(z$1.lazy(() => this.makeWhereSchema(model, false, withoutRelationFields, false, options)), true).optional();
2704
+ const baseWhere = z$1.strictObject(fields);
2701
2705
  let result = baseWhere;
2702
2706
  if (unique) {
2703
2707
  const uniqueFields = getUniqueFields(this.schema, model);
@@ -2723,26 +2727,26 @@ var ZodSchemaFactory = class {
2723
2727
  else if (getEnum(this.schema, fieldDef.type)) fieldSchemas[fieldName] = this.makeEnumFilterSchema(fieldDef.type, !!fieldDef.optional, !!fieldDef.array, false, void 0).optional();
2724
2728
  else if (fieldDef.array) fieldSchemas[fieldName] = this.makeArrayFilterSchema(fieldDef.type, void 0).optional();
2725
2729
  else fieldSchemas[fieldName] = this.makePrimitiveFilterSchema(fieldDef.type, !!fieldDef.optional, false, void 0).optional();
2726
- candidates.push(z.strictObject(fieldSchemas));
2730
+ candidates.push(z$1.strictObject(fieldSchemas));
2727
2731
  }
2728
- const recursiveSchema = z.lazy(() => this.makeTypedJsonFilterSchema(type, optional, false, allowedFilterKinds)).optional();
2729
- if (array) candidates.push(z.strictObject({
2732
+ const recursiveSchema = z$1.lazy(() => this.makeTypedJsonFilterSchema(type, optional, false, allowedFilterKinds)).optional();
2733
+ if (array) candidates.push(z$1.strictObject({
2730
2734
  some: recursiveSchema,
2731
2735
  every: recursiveSchema,
2732
2736
  none: recursiveSchema
2733
2737
  }));
2734
- else candidates.push(z.strictObject({
2738
+ else candidates.push(z$1.strictObject({
2735
2739
  is: recursiveSchema,
2736
2740
  isNot: recursiveSchema
2737
2741
  }));
2738
2742
  candidates.push(this.makeJsonFilterSchema(optional, allowedFilterKinds));
2739
2743
  if (optional) {
2740
- candidates.push(z.null());
2741
- candidates.push(z.instanceof(DbNullClass));
2742
- candidates.push(z.instanceof(JsonNullClass));
2743
- candidates.push(z.instanceof(AnyNullClass));
2744
+ candidates.push(z$1.null());
2745
+ candidates.push(z$1.instanceof(DbNullClass));
2746
+ candidates.push(z$1.instanceof(JsonNullClass));
2747
+ candidates.push(z$1.instanceof(AnyNullClass));
2744
2748
  }
2745
- const result = z.union(candidates);
2749
+ const result = z$1.union(candidates);
2746
2750
  this.registerSchema(`${type}Filter${this.filterSchemaSuffix({
2747
2751
  optional,
2748
2752
  array,
@@ -2751,7 +2755,7 @@ var ZodSchemaFactory = class {
2751
2755
  return result;
2752
2756
  }
2753
2757
  makeNullableTypedJsonMutationSchema(fieldSchema) {
2754
- return z.any().superRefine((value, ctx) => {
2758
+ return z$1.any().superRefine((value, ctx) => {
2755
2759
  if (value instanceof DbNullClass || value instanceof JsonNullClass || value === null || value === void 0) return;
2756
2760
  const parseResult = fieldSchema.safeParse(value);
2757
2761
  if (!parseResult.success) parseResult.error.issues.forEach((issue) => ctx.addIssue(issue));
@@ -2763,11 +2767,11 @@ var ZodSchemaFactory = class {
2763
2767
  makeEnumFilterSchema(enumName, optional, array, withAggregations, allowedFilterKinds) {
2764
2768
  const enumDef = getEnum(this.schema, enumName);
2765
2769
  invariant(enumDef, `Enum "${enumName}" not found in schema`);
2766
- const baseSchema = z.enum(Object.keys(enumDef.values));
2770
+ const baseSchema = z$1.enum(Object.keys(enumDef.values));
2767
2771
  let schema;
2768
2772
  if (array) schema = this.internalMakeArrayFilterSchema(baseSchema, allowedFilterKinds);
2769
2773
  else {
2770
- const components = this.makeCommonPrimitiveFilterComponents(baseSchema, optional, () => z.lazy(() => this.makeEnumFilterSchema(enumName, optional, array, withAggregations, allowedFilterKinds)), [
2774
+ const components = this.makeCommonPrimitiveFilterComponents(baseSchema, optional, () => z$1.lazy(() => this.makeEnumFilterSchema(enumName, optional, array, withAggregations, allowedFilterKinds)), [
2771
2775
  "equals",
2772
2776
  "in",
2773
2777
  "notIn",
@@ -2801,42 +2805,42 @@ var ZodSchemaFactory = class {
2801
2805
  has: elementSchema.optional(),
2802
2806
  hasEvery: elementSchema.array().optional(),
2803
2807
  hasSome: elementSchema.array().optional(),
2804
- isEmpty: z.boolean().optional()
2808
+ isEmpty: z$1.boolean().optional()
2805
2809
  };
2806
2810
  const filteredOperators = this.trimFilterOperators(operators, allowedFilterKinds);
2807
- return z.strictObject(filteredOperators);
2811
+ return z$1.strictObject(filteredOperators);
2808
2812
  }
2809
2813
  makePrimitiveFilterSchema(type, optional, withAggregations, allowedFilterKinds, withFuzzy = false, withFullText = false) {
2810
- return match(type).with("String", () => this.makeStringFilterSchema(optional, withAggregations, allowedFilterKinds, withFuzzy, withFullText)).with(P.union("Int", "Float", "Decimal", "BigInt"), (type) => this.makeNumberFilterSchema(type, optional, withAggregations, allowedFilterKinds)).with("Boolean", () => this.makeBooleanFilterSchema(optional, withAggregations, allowedFilterKinds)).with("DateTime", () => this.makeDateTimeFilterSchema(optional, withAggregations, allowedFilterKinds)).with("Bytes", () => this.makeBytesFilterSchema(optional, withAggregations, allowedFilterKinds)).with("Json", () => this.makeJsonFilterSchema(optional, allowedFilterKinds)).with("Unsupported", () => z.never()).exhaustive();
2814
+ return match(type).with("String", () => this.makeStringFilterSchema(optional, withAggregations, allowedFilterKinds, withFuzzy, withFullText)).with(P.union("Int", "Float", "Decimal", "BigInt"), (type) => this.makeNumberFilterSchema(type, optional, withAggregations, allowedFilterKinds)).with("Boolean", () => this.makeBooleanFilterSchema(optional, withAggregations, allowedFilterKinds)).with("DateTime", () => this.makeDateTimeFilterSchema(optional, withAggregations, allowedFilterKinds)).with("Bytes", () => this.makeBytesFilterSchema(optional, withAggregations, allowedFilterKinds)).with("Json", () => this.makeJsonFilterSchema(optional, allowedFilterKinds)).with("Unsupported", () => z$1.never()).exhaustive();
2811
2815
  }
2812
2816
  makeJsonValueSchema() {
2813
- const schema = z.union([
2814
- z.string(),
2815
- z.number(),
2816
- z.boolean(),
2817
- z.instanceof(JsonNullClass),
2818
- z.lazy(() => z.union([this.makeJsonValueSchema(), z.null()]).array()),
2819
- z.record(z.string(), z.lazy(() => z.union([this.makeJsonValueSchema(), z.null()])))
2817
+ const schema = z$1.union([
2818
+ z$1.string(),
2819
+ z$1.number(),
2820
+ z$1.boolean(),
2821
+ z$1.instanceof(JsonNullClass),
2822
+ z$1.lazy(() => z$1.union([this.makeJsonValueSchema(), z$1.null()]).array()),
2823
+ z$1.record(z$1.string(), z$1.lazy(() => z$1.union([this.makeJsonValueSchema(), z$1.null()])))
2820
2824
  ]);
2821
2825
  this.registerSchema("JsonValue", schema);
2822
2826
  return schema;
2823
2827
  }
2824
2828
  makeJsonFilterSchema(optional, allowedFilterKinds) {
2825
- if (allowedFilterKinds && !allowedFilterKinds.includes("Json")) return z.never();
2829
+ if (allowedFilterKinds && !allowedFilterKinds.includes("Json")) return z$1.never();
2826
2830
  const filterMembers = [
2827
2831
  this.makeJsonValueSchema(),
2828
- z.instanceof(DbNullClass),
2829
- z.instanceof(AnyNullClass)
2832
+ z$1.instanceof(DbNullClass),
2833
+ z$1.instanceof(AnyNullClass)
2830
2834
  ];
2831
- if (optional) filterMembers.push(z.null());
2832
- const filterValueSchema = z.union(filterMembers);
2833
- const schema = z.strictObject({
2834
- path: z.string().optional(),
2835
+ if (optional) filterMembers.push(z$1.null());
2836
+ const filterValueSchema = z$1.union(filterMembers);
2837
+ const schema = z$1.strictObject({
2838
+ path: z$1.string().optional(),
2835
2839
  equals: filterValueSchema.optional(),
2836
2840
  not: filterValueSchema.optional(),
2837
- string_contains: z.string().optional(),
2838
- string_starts_with: z.string().optional(),
2839
- string_ends_with: z.string().optional(),
2841
+ string_contains: z$1.string().optional(),
2842
+ string_starts_with: z$1.string().optional(),
2843
+ string_ends_with: z$1.string().optional(),
2840
2844
  mode: this.makeStringModeSchema().optional(),
2841
2845
  array_contains: filterValueSchema.optional(),
2842
2846
  array_starts_with: filterValueSchema.optional(),
@@ -2855,7 +2859,7 @@ var ZodSchemaFactory = class {
2855
2859
  }
2856
2860
  makeDateTimeFilterSchema(optional, withAggregations, allowedFilterKinds) {
2857
2861
  const filterValueSchema = this.makeDateTimeValueSchema();
2858
- const schema = this.makeCommonPrimitiveFilterSchema(filterValueSchema, optional, () => z.lazy(() => this.makeDateTimeFilterSchema(optional, withAggregations, allowedFilterKinds)), withAggregations ? [
2862
+ const schema = this.makeCommonPrimitiveFilterSchema(filterValueSchema, optional, () => z$1.lazy(() => this.makeDateTimeFilterSchema(optional, withAggregations, allowedFilterKinds)), withAggregations ? [
2859
2863
  "_count",
2860
2864
  "_min",
2861
2865
  "_max"
@@ -2868,12 +2872,12 @@ var ZodSchemaFactory = class {
2868
2872
  return schema;
2869
2873
  }
2870
2874
  makeBooleanFilterSchema(optional, withAggregations, allowedFilterKinds) {
2871
- const components = this.makeCommonPrimitiveFilterComponents(z.boolean(), optional, () => z.lazy(() => this.makeBooleanFilterSchema(optional, withAggregations, allowedFilterKinds)), ["equals", "not"], withAggregations ? [
2875
+ const components = this.makeCommonPrimitiveFilterComponents(z$1.boolean(), optional, () => z$1.lazy(() => this.makeBooleanFilterSchema(optional, withAggregations, allowedFilterKinds)), ["equals", "not"], withAggregations ? [
2872
2876
  "_count",
2873
2877
  "_min",
2874
2878
  "_max"
2875
2879
  ] : void 0, allowedFilterKinds);
2876
- const schema = this.createUnionFilterSchema(z.boolean(), optional, components, allowedFilterKinds);
2880
+ const schema = this.createUnionFilterSchema(z$1.boolean(), optional, components, allowedFilterKinds);
2877
2881
  this.registerSchema(`BooleanFilter${this.filterSchemaSuffix({
2878
2882
  optional,
2879
2883
  allowedFilterKinds,
@@ -2882,8 +2886,8 @@ var ZodSchemaFactory = class {
2882
2886
  return schema;
2883
2887
  }
2884
2888
  makeBytesFilterSchema(optional, withAggregations, allowedFilterKinds) {
2885
- const baseSchema = z.instanceof(Uint8Array);
2886
- const components = this.makeCommonPrimitiveFilterComponents(baseSchema, optional, () => z.instanceof(Uint8Array), [
2889
+ const baseSchema = z$1.instanceof(Uint8Array);
2890
+ const components = this.makeCommonPrimitiveFilterComponents(baseSchema, optional, () => z$1.instanceof(Uint8Array), [
2887
2891
  "equals",
2888
2892
  "in",
2889
2893
  "notIn",
@@ -2931,7 +2935,7 @@ var ZodSchemaFactory = class {
2931
2935
  return this.createUnionFilterSchema(baseSchema, optional, components, allowedFilterKinds);
2932
2936
  }
2933
2937
  makeNumberFilterSchema(type, optional, withAggregations, allowedFilterKinds) {
2934
- const schema = this.makeCommonPrimitiveFilterSchema(this.makeScalarSchema(type), optional, () => z.lazy(() => this.makeNumberFilterSchema(type, optional, withAggregations, allowedFilterKinds)), withAggregations ? [
2938
+ const schema = this.makeCommonPrimitiveFilterSchema(this.makeScalarSchema(type), optional, () => z$1.lazy(() => this.makeNumberFilterSchema(type, optional, withAggregations, allowedFilterKinds)), withAggregations ? [
2935
2939
  "_count",
2936
2940
  "_avg",
2937
2941
  "_sum",
@@ -2946,15 +2950,15 @@ var ZodSchemaFactory = class {
2946
2950
  return schema;
2947
2951
  }
2948
2952
  makeStringFilterSchema(optional, withAggregations, allowedFilterKinds, withFuzzy = false, withFullText = false) {
2949
- const baseComponents = this.makeCommonPrimitiveFilterComponents(z.string(), optional, () => z.lazy(() => this.makeStringFilterSchema(optional, withAggregations, allowedFilterKinds, withFuzzy, withFullText)), void 0, withAggregations ? [
2953
+ const baseComponents = this.makeCommonPrimitiveFilterComponents(z$1.string(), optional, () => z$1.lazy(() => this.makeStringFilterSchema(optional, withAggregations, allowedFilterKinds, withFuzzy, withFullText)), void 0, withAggregations ? [
2950
2954
  "_count",
2951
2955
  "_min",
2952
2956
  "_max"
2953
2957
  ] : void 0, allowedFilterKinds);
2954
2958
  const stringSpecificOperators = {
2955
- startsWith: z.string().optional(),
2956
- endsWith: z.string().optional(),
2957
- contains: z.string().optional(),
2959
+ startsWith: z$1.string().optional(),
2960
+ endsWith: z$1.string().optional(),
2961
+ contains: z$1.string().optional(),
2958
2962
  ...withFuzzy && this.providerSupportsFuzzySearch ? { fuzzy: this.makeFuzzyFilterSchema().optional() } : {},
2959
2963
  ...withFullText && this.providerSupportsFullTextSearch ? { fts: this.makeFullTextFilterSchema().optional() } : {},
2960
2964
  ...this.providerSupportsCaseSensitivity ? { mode: this.makeStringModeSchema().optional() } : {}
@@ -2964,7 +2968,7 @@ var ZodSchemaFactory = class {
2964
2968
  ...baseComponents,
2965
2969
  ...filteredStringOperators
2966
2970
  };
2967
- const schema = this.createUnionFilterSchema(z.string(), optional, allComponents, allowedFilterKinds);
2971
+ const schema = this.createUnionFilterSchema(z$1.string(), optional, allComponents, allowedFilterKinds);
2968
2972
  const featureSuffix = `${withFuzzy ? "Fuzzy" : ""}${withFullText ? "FullText" : ""}`;
2969
2973
  this.registerSchema(`StringFilter${this.filterSchemaSuffix({
2970
2974
  optional,
@@ -2974,45 +2978,45 @@ var ZodSchemaFactory = class {
2974
2978
  return schema;
2975
2979
  }
2976
2980
  makeStringModeSchema() {
2977
- return z.union([z.literal("default"), z.literal("insensitive")]);
2981
+ return z$1.union([z$1.literal("default"), z$1.literal("insensitive")]);
2978
2982
  }
2979
2983
  makeFuzzyFilterSchema() {
2980
- return z.strictObject({
2981
- search: z.string().min(1),
2982
- mode: z.union([
2983
- z.literal("simple"),
2984
- z.literal("word"),
2985
- z.literal("strictWord")
2984
+ return z$1.strictObject({
2985
+ search: z$1.string().min(1),
2986
+ mode: z$1.union([
2987
+ z$1.literal("simple"),
2988
+ z$1.literal("word"),
2989
+ z$1.literal("strictWord")
2986
2990
  ]).default("simple"),
2987
- threshold: z.number().min(0).max(1).optional(),
2988
- unaccent: z.boolean().default(false)
2991
+ threshold: z$1.number().min(0).max(1).optional(),
2992
+ unaccent: z$1.boolean().default(false)
2989
2993
  });
2990
2994
  }
2991
2995
  makeFullTextFilterSchema() {
2992
- return z.strictObject({
2993
- search: z.string().min(1),
2994
- config: z.string().min(1).optional()
2996
+ return z$1.strictObject({
2997
+ search: z$1.string().min(1),
2998
+ config: z$1.string().min(1).optional()
2995
2999
  });
2996
3000
  }
2997
3001
  makeSelectSchema(model, options) {
2998
3002
  const fields = {};
2999
3003
  for (const [field, fieldDef] of this.getModelFields(model)) {
3000
3004
  if (this.isParameterizedComputedField(fieldDef)) {
3001
- fields[field] = z.strictObject({ args: this.makeFieldArgsSchema(fieldDef.params) }).optional();
3005
+ fields[field] = z$1.strictObject({ args: this.makeFieldArgsSchema(fieldDef.params) }).optional();
3002
3006
  continue;
3003
3007
  }
3004
3008
  if (fieldDef.relation) {
3005
3009
  if (!this.shouldIncludeRelations(options)) continue;
3006
3010
  if (this.isModelAllowed(fieldDef.type)) fields[field] = this.makeRelationSelectIncludeSchema(model, field, options).optional();
3007
- } else if (this.options.allowQueryTimeOmitOverride === false && this.isFieldOmittedByConfig(model, field)) fields[field] = z.literal(false).optional();
3008
- else fields[field] = z.boolean().optional();
3011
+ } else if (this.options.allowQueryTimeOmitOverride === false && this.isFieldOmittedByConfig(model, field)) fields[field] = z$1.literal(false).optional();
3012
+ else fields[field] = z$1.boolean().optional();
3009
3013
  }
3010
3014
  if (this.shouldIncludeRelations(options)) {
3011
3015
  const _countSchema = this.makeCountSelectionSchema(model, options);
3012
- if (!(_countSchema instanceof z.ZodNever)) fields["_count"] = _countSchema;
3016
+ if (!(_countSchema instanceof z$1.ZodNever)) fields["_count"] = _countSchema;
3013
3017
  }
3014
3018
  this.addExtResultFields(model, fields);
3015
- const result = z.strictObject(fields);
3019
+ const result = z$1.strictObject(fields);
3016
3020
  this.registerSchema(`${model}Select`, result);
3017
3021
  return result;
3018
3022
  }
@@ -3021,24 +3025,24 @@ var ZodSchemaFactory = class {
3021
3025
  const toManyRelations = Object.values(modelDef.fields).filter((def) => def.relation && def.array);
3022
3026
  if (toManyRelations.length > 0) {
3023
3027
  const nextOpts = this.nextOptions(options);
3024
- const schema = z.union([z.literal(true), z.strictObject({ select: z.strictObject(toManyRelations.reduce((acc, fieldDef) => ({
3028
+ const schema = z$1.union([z$1.literal(true), z$1.strictObject({ select: z$1.strictObject(toManyRelations.reduce((acc, fieldDef) => ({
3025
3029
  ...acc,
3026
- [fieldDef.name]: z.union([z.boolean(), z.strictObject({ where: this.makeWhereSchema(fieldDef.type, false, false, false, nextOpts) })]).optional()
3030
+ [fieldDef.name]: z$1.union([z$1.boolean(), z$1.strictObject({ where: this.makeWhereSchema(fieldDef.type, false, false, false, nextOpts) })]).optional()
3027
3031
  }), {})) })]).optional();
3028
3032
  this.registerSchema(`${model}CountSelection`, schema);
3029
3033
  return schema;
3030
- } else return z.never();
3034
+ } else return z$1.never();
3031
3035
  }
3032
3036
  makeRelationSelectIncludeSchema(model, field, options) {
3033
3037
  const fieldDef = requireField(this.schema, model, field);
3034
3038
  const nextOpts = this.nextOptions(options);
3035
- let objSchema = z.strictObject({
3036
- ...fieldDef.array || fieldDef.optional ? { where: z.lazy(() => this.makeWhereSchema(fieldDef.type, false, false, false, nextOpts)).optional() } : {},
3037
- select: z.lazy(() => this.makeSelectSchema(fieldDef.type, nextOpts)).optional().nullable(),
3038
- include: z.lazy(() => this.makeIncludeSchema(fieldDef.type, nextOpts)).optional().nullable(),
3039
- omit: z.lazy(() => this.makeOmitSchema(fieldDef.type)).optional().nullable(),
3039
+ let objSchema = z$1.strictObject({
3040
+ ...fieldDef.array || fieldDef.optional ? { where: z$1.lazy(() => this.makeWhereSchema(fieldDef.type, false, false, false, nextOpts)).optional() } : {},
3041
+ select: z$1.lazy(() => this.makeSelectSchema(fieldDef.type, nextOpts)).optional().nullable(),
3042
+ include: z$1.lazy(() => this.makeIncludeSchema(fieldDef.type, nextOpts)).optional().nullable(),
3043
+ omit: z$1.lazy(() => this.makeOmitSchema(fieldDef.type)).optional().nullable(),
3040
3044
  ...fieldDef.array ? {
3041
- orderBy: z.lazy(() => this.orArray(this.makeOrderBySchema(fieldDef.type, true, false, nextOpts), true)).optional(),
3045
+ orderBy: z$1.lazy(() => this.orArray(this.makeOrderBySchema(fieldDef.type, true, false, nextOpts), true)).optional(),
3042
3046
  skip: this.makeSkipSchema().optional(),
3043
3047
  take: this.makeTakeSchema().optional(),
3044
3048
  cursor: this.makeCursorSchema(fieldDef.type, nextOpts).optional(),
@@ -3048,7 +3052,7 @@ var ZodSchemaFactory = class {
3048
3052
  objSchema = this.refineForSelectIncludeMutuallyExclusive(objSchema);
3049
3053
  objSchema = this.refineForSelectOmitMutuallyExclusive(objSchema);
3050
3054
  objSchema = this.refineForSelectHasTruthyField(objSchema);
3051
- const result = z.union([z.boolean(), objSchema]);
3055
+ const result = z$1.union([z$1.boolean(), objSchema]);
3052
3056
  this.registerSchema(`${model}${upperCaseFirst(field)}RelationInput`, result);
3053
3057
  return result;
3054
3058
  }
@@ -3065,11 +3069,11 @@ var ZodSchemaFactory = class {
3065
3069
  const fields = {};
3066
3070
  for (const [field, fieldDef] of this.getModelFields(model)) {
3067
3071
  if (this.isParameterizedComputedField(fieldDef)) continue;
3068
- if (!fieldDef.relation) if (this.options.allowQueryTimeOmitOverride !== false) fields[field] = z.boolean().optional();
3069
- else fields[field] = z.literal(true).optional();
3072
+ if (!fieldDef.relation) if (this.options.allowQueryTimeOmitOverride !== false) fields[field] = z$1.boolean().optional();
3073
+ else fields[field] = z$1.literal(true).optional();
3070
3074
  }
3071
3075
  this.addExtResultFields(model, fields);
3072
- const result = z.strictObject(fields);
3076
+ const result = z$1.strictObject(fields);
3073
3077
  this.registerSchema(`${model}OmitInput`, result);
3074
3078
  return result;
3075
3079
  }
@@ -3078,7 +3082,7 @@ var ZodSchemaFactory = class {
3078
3082
  const resultConfig = plugin.result;
3079
3083
  if (resultConfig) {
3080
3084
  const modelConfig = resultConfig[lowerCaseFirst(model)];
3081
- if (modelConfig) for (const field of Object.keys(modelConfig)) fields[field] = z.boolean().optional();
3085
+ if (modelConfig) for (const field of Object.keys(modelConfig)) fields[field] = z$1.boolean().optional();
3082
3086
  }
3083
3087
  }
3084
3088
  }
@@ -3090,35 +3094,35 @@ var ZodSchemaFactory = class {
3090
3094
  if (fieldDef.relation) {
3091
3095
  if (!this.shouldIncludeRelations(options)) continue;
3092
3096
  if (this.isModelAllowed(fieldDef.type)) fields[field] = this.makeRelationSelectIncludeSchema(model, field, options).optional();
3093
- } else if (this.isParameterizedComputedField(fieldDef)) fields[field] = z.strictObject({ args: this.makeFieldArgsSchema(fieldDef.params) }).optional();
3097
+ } else if (this.isParameterizedComputedField(fieldDef)) fields[field] = z$1.strictObject({ args: this.makeFieldArgsSchema(fieldDef.params) }).optional();
3094
3098
  }
3095
3099
  if (this.shouldIncludeRelations(options)) {
3096
3100
  const _countSchema = this.makeCountSelectionSchema(model, options);
3097
- if (!(_countSchema instanceof z.ZodNever)) fields["_count"] = _countSchema;
3101
+ if (!(_countSchema instanceof z$1.ZodNever)) fields["_count"] = _countSchema;
3098
3102
  }
3099
- const result = z.strictObject(fields);
3103
+ const result = z$1.strictObject(fields);
3100
3104
  this.registerSchema(`${model}Include`, result);
3101
3105
  return result;
3102
3106
  }
3103
3107
  makeOrderBySchema(model, withRelation, WithAggregation, options) {
3104
3108
  const fields = {};
3105
- const sort = z.union([z.literal("asc"), z.literal("desc")]);
3109
+ const sort = z$1.union([z$1.literal("asc"), z$1.literal("desc")]);
3106
3110
  const refineAtMostOneKey = (s) => s.refine((v) => Object.keys(v).length <= 1, { message: "Each orderBy element must have at most one key" });
3107
3111
  const nextOpts = this.nextOptions(options);
3108
3112
  for (const [field, fieldDef] of this.getModelFields(model)) if (fieldDef.relation) {
3109
- if (withRelation && this.shouldIncludeRelations(options)) fields[field] = z.lazy(() => {
3113
+ if (withRelation && this.shouldIncludeRelations(options)) fields[field] = z$1.lazy(() => {
3110
3114
  let relationOrderBy = this.makeOrderBySchema(fieldDef.type, withRelation, WithAggregation, nextOpts);
3111
3115
  if (fieldDef.array) relationOrderBy = refineAtMostOneKey(relationOrderBy.safeExtend({ _count: sort }));
3112
3116
  return relationOrderBy;
3113
3117
  }).optional();
3114
- } else if (fieldDef.computed && fieldDef.params) fields[field] = z.strictObject({
3118
+ } else if (fieldDef.computed && fieldDef.params) fields[field] = z$1.strictObject({
3115
3119
  args: this.makeFieldArgsSchema(fieldDef.params),
3116
3120
  sort,
3117
- nulls: z.union([z.literal("first"), z.literal("last")]).optional()
3121
+ nulls: z$1.union([z$1.literal("first"), z$1.literal("last")]).optional()
3118
3122
  }).optional();
3119
- else if (fieldDef.optional) fields[field] = z.union([sort, z.strictObject({
3123
+ else if (fieldDef.optional) fields[field] = z$1.union([sort, z$1.strictObject({
3120
3124
  sort,
3121
- nulls: z.union([z.literal("first"), z.literal("last")]).optional()
3125
+ nulls: z$1.union([z$1.literal("first"), z$1.literal("last")]).optional()
3122
3126
  })]).optional();
3123
3127
  else fields[field] = sort.optional();
3124
3128
  if (WithAggregation) for (const agg of [
@@ -3127,31 +3131,31 @@ var ZodSchemaFactory = class {
3127
3131
  "_sum",
3128
3132
  "_min",
3129
3133
  "_max"
3130
- ]) fields[agg] = z.lazy(() => this.makeOrderBySchema(model, true, false, options).optional());
3134
+ ]) fields[agg] = z$1.lazy(() => this.makeOrderBySchema(model, true, false, options).optional());
3131
3135
  if (this.providerSupportsFuzzySearch) {
3132
3136
  const fuzzyFieldNames = this.getModelFields(model).filter(([, def]) => !def.relation && def.type === "String" && def.fuzzy === true).map(([name]) => name);
3133
- if (fuzzyFieldNames.length > 0) fields["_fuzzyRelevance"] = z.strictObject({
3134
- fields: z.array(z.enum(fuzzyFieldNames)).min(1),
3135
- search: z.string(),
3136
- mode: z.union([
3137
- z.literal("simple"),
3138
- z.literal("word"),
3139
- z.literal("strictWord")
3137
+ if (fuzzyFieldNames.length > 0) fields["_fuzzyRelevance"] = z$1.strictObject({
3138
+ fields: z$1.array(z$1.enum(fuzzyFieldNames)).min(1),
3139
+ search: z$1.string(),
3140
+ mode: z$1.union([
3141
+ z$1.literal("simple"),
3142
+ z$1.literal("word"),
3143
+ z$1.literal("strictWord")
3140
3144
  ]).default("simple"),
3141
- unaccent: z.boolean().default(false),
3145
+ unaccent: z$1.boolean().default(false),
3142
3146
  sort
3143
3147
  }).optional();
3144
3148
  }
3145
3149
  if (this.providerSupportsFullTextSearch) {
3146
3150
  const fullTextFieldNames = this.getModelFields(model).filter(([, def]) => !def.relation && def.type === "String" && def.fullText === true).map(([name]) => name);
3147
- if (fullTextFieldNames.length > 0) fields["_ftsRelevance"] = z.strictObject({
3148
- fields: z.array(z.enum(fullTextFieldNames)).min(1),
3149
- search: z.string().min(1),
3150
- config: z.string().min(1).optional(),
3151
+ if (fullTextFieldNames.length > 0) fields["_ftsRelevance"] = z$1.strictObject({
3152
+ fields: z$1.array(z$1.enum(fullTextFieldNames)).min(1),
3153
+ search: z$1.string().min(1),
3154
+ config: z$1.string().min(1).optional(),
3151
3155
  sort
3152
3156
  }).optional();
3153
3157
  }
3154
- const schema = refineAtMostOneKey(z.strictObject(fields));
3158
+ const schema = refineAtMostOneKey(z$1.strictObject(fields));
3155
3159
  let schemaId = `${model}OrderBy`;
3156
3160
  if (withRelation) schemaId += "WithRelation";
3157
3161
  if (WithAggregation) schemaId += "WithAggregation";
@@ -3161,7 +3165,7 @@ var ZodSchemaFactory = class {
3161
3165
  }
3162
3166
  makeDistinctSchema(model) {
3163
3167
  const nonRelationFields = this.getModelFields(model).filter(([, def]) => !def.relation && !this.isParameterizedComputedField(def)).map(([name]) => name);
3164
- const schema = nonRelationFields.length > 0 ? this.orArray(z.enum(nonRelationFields), true) : z.never();
3168
+ const schema = nonRelationFields.length > 0 ? this.orArray(z$1.enum(nonRelationFields), true) : z$1.never();
3165
3169
  this.registerSchema(`${model}DistinctInput`, schema);
3166
3170
  return schema;
3167
3171
  }
@@ -3172,7 +3176,7 @@ var ZodSchemaFactory = class {
3172
3176
  }
3173
3177
  makeCreateSchema(model, options) {
3174
3178
  const dataSchema = this.makeCreateDataSchema(model, false, [], false, options);
3175
- const baseSchema = z.strictObject({
3179
+ const baseSchema = z$1.strictObject({
3176
3180
  data: dataSchema,
3177
3181
  select: this.makeSelectSchema(model, options).optional().nullable(),
3178
3182
  include: this.makeIncludeSchema(model, options).optional().nullable(),
@@ -3221,7 +3225,7 @@ var ZodSchemaFactory = class {
3221
3225
  const oppositeFieldDef = requireField(this.schema, fieldDef.type, oppositeField);
3222
3226
  if (oppositeFieldDef.relation?.fields) excludeFields.push(...oppositeFieldDef.relation.fields);
3223
3227
  }
3224
- let fieldSchema = z.lazy(() => this.makeRelationManipulationSchema(model, field, excludeFields, "create", nextOpts));
3228
+ let fieldSchema = z$1.lazy(() => this.makeRelationManipulationSchema(model, field, excludeFields, "create", nextOpts));
3225
3229
  if (fieldDef.optional || fieldDef.array) fieldSchema = fieldSchema.optional();
3226
3230
  else {
3227
3231
  let allFksOptional = false;
@@ -3238,23 +3242,23 @@ var ZodSchemaFactory = class {
3238
3242
  let fieldSchema = this.makeScalarSchema(fieldDef.type, fieldDef.attributes);
3239
3243
  if (fieldDef.array) {
3240
3244
  fieldSchema = ZodUtils.addListValidation(fieldSchema.array(), fieldDef.attributes);
3241
- fieldSchema = z.union([fieldSchema, z.strictObject({ set: fieldSchema })]).optional();
3245
+ fieldSchema = z$1.union([fieldSchema, z$1.strictObject({ set: fieldSchema })]).optional();
3242
3246
  }
3243
3247
  if (fieldDef.optional || fieldHasDefaultValue(fieldDef)) fieldSchema = fieldSchema.optional();
3244
- if (fieldDef.optional) if (fieldDef.type === "Json") fieldSchema = z.union([fieldSchema, z.instanceof(DbNullClass)]);
3248
+ if (fieldDef.optional) if (fieldDef.type === "Json") fieldSchema = z$1.union([fieldSchema, z$1.instanceof(DbNullClass)]);
3245
3249
  else if (this.isTypeDefType(fieldDef.type)) fieldSchema = this.makeNullableTypedJsonMutationSchema(fieldSchema);
3246
3250
  else fieldSchema = fieldSchema.nullable();
3247
3251
  uncheckedVariantFields[field] = fieldSchema;
3248
3252
  if (!fieldDef.foreignKeyFor) checkedVariantFields[field] = fieldSchema;
3249
3253
  }
3250
3254
  });
3251
- const uncheckedCreateSchema = this.extraValidationsEnabled ? ZodUtils.addCustomValidation(z.strictObject(uncheckedVariantFields), modelDef.attributes) : z.strictObject(uncheckedVariantFields);
3252
- const checkedCreateSchema = this.extraValidationsEnabled ? ZodUtils.addCustomValidation(z.strictObject(checkedVariantFields), modelDef.attributes) : z.strictObject(checkedVariantFields);
3253
- const result = !hasRelation ? this.orArray(uncheckedCreateSchema, canBeArray) : z.union([
3255
+ const uncheckedCreateSchema = this.extraValidationsEnabled ? ZodUtils.addCustomValidation(z$1.strictObject(uncheckedVariantFields), modelDef.attributes) : z$1.strictObject(uncheckedVariantFields);
3256
+ const checkedCreateSchema = this.extraValidationsEnabled ? ZodUtils.addCustomValidation(z$1.strictObject(checkedVariantFields), modelDef.attributes) : z$1.strictObject(checkedVariantFields);
3257
+ const result = !hasRelation ? this.orArray(uncheckedCreateSchema, canBeArray) : z$1.union([
3254
3258
  uncheckedCreateSchema,
3255
3259
  checkedCreateSchema,
3256
- ...canBeArray ? [z.array(uncheckedCreateSchema)] : [],
3257
- ...canBeArray ? [z.array(checkedCreateSchema)] : []
3260
+ ...canBeArray ? [z$1.array(uncheckedCreateSchema)] : [],
3261
+ ...canBeArray ? [z$1.array(checkedCreateSchema)] : []
3258
3262
  ]);
3259
3263
  const idParts = [`${model}CreateData`];
3260
3264
  if (canBeArray) idParts.push("Array");
@@ -3279,17 +3283,17 @@ var ZodSchemaFactory = class {
3279
3283
  fields["disconnect"] = this.makeDisconnectDataSchema(fieldType, array, options).optional();
3280
3284
  fields["delete"] = this.makeDeleteRelationDataSchema(fieldType, array, true, options).optional();
3281
3285
  }
3282
- fields["update"] = array ? this.orArray(z.strictObject({
3286
+ fields["update"] = array ? this.orArray(z$1.strictObject({
3283
3287
  where: this.makeWhereSchema(fieldType, true, false, false, options),
3284
3288
  data: this.makeUpdateDataSchema(fieldType, withoutFields, false, options)
3285
- }), true).optional() : z.union([z.strictObject({
3289
+ }), true).optional() : z$1.union([z$1.strictObject({
3286
3290
  where: this.makeWhereSchema(fieldType, false, false, false, options).optional(),
3287
3291
  data: this.makeUpdateDataSchema(fieldType, withoutFields, false, options)
3288
3292
  }), this.makeUpdateDataSchema(fieldType, withoutFields, false, options)]).optional();
3289
3293
  if (canCreateModel) {
3290
3294
  let upsertWhere = this.makeWhereSchema(fieldType, true, false, false, options);
3291
3295
  if (!fieldDef.array) upsertWhere = upsertWhere.optional();
3292
- fields["upsert"] = this.orArray(z.strictObject({
3296
+ fields["upsert"] = this.orArray(z$1.strictObject({
3293
3297
  where: upsertWhere,
3294
3298
  create: this.makeCreateDataSchema(fieldType, false, withoutFields, false, options),
3295
3299
  update: this.makeUpdateDataSchema(fieldType, withoutFields, false, options)
@@ -3297,14 +3301,14 @@ var ZodSchemaFactory = class {
3297
3301
  }
3298
3302
  if (array) {
3299
3303
  fields["set"] = this.makeSetDataSchema(fieldType, true, options).optional();
3300
- fields["updateMany"] = this.orArray(z.strictObject({
3304
+ fields["updateMany"] = this.orArray(z$1.strictObject({
3301
3305
  where: this.makeWhereSchema(fieldType, false, true, false, options),
3302
3306
  data: this.makeUpdateDataSchema(fieldType, withoutFields, false, options)
3303
3307
  }), true).optional();
3304
3308
  fields["deleteMany"] = this.makeDeleteRelationDataSchema(fieldType, true, false, options).optional();
3305
3309
  }
3306
3310
  }
3307
- return z.strictObject(fields);
3311
+ return z$1.strictObject(fields);
3308
3312
  }
3309
3313
  makeSetDataSchema(model, canBeArray, options) {
3310
3314
  return this.orArray(this.makeWhereSchema(model, true, false, false, options), canBeArray);
@@ -3314,23 +3318,23 @@ var ZodSchemaFactory = class {
3314
3318
  }
3315
3319
  makeDisconnectDataSchema(model, canBeArray, options) {
3316
3320
  if (canBeArray) return this.orArray(this.makeWhereSchema(model, true, false, false, options), canBeArray);
3317
- else return z.union([z.boolean(), this.makeWhereSchema(model, false, false, false, options)]);
3321
+ else return z$1.union([z$1.boolean(), this.makeWhereSchema(model, false, false, false, options)]);
3318
3322
  }
3319
3323
  makeDeleteRelationDataSchema(model, toManyRelation, uniqueFilter, options) {
3320
- return toManyRelation ? this.orArray(this.makeWhereSchema(model, uniqueFilter, false, false, options), true) : z.union([z.boolean(), this.makeWhereSchema(model, uniqueFilter, false, false, options)]);
3324
+ return toManyRelation ? this.orArray(this.makeWhereSchema(model, uniqueFilter, false, false, options), true) : z$1.union([z$1.boolean(), this.makeWhereSchema(model, uniqueFilter, false, false, options)]);
3321
3325
  }
3322
3326
  makeConnectOrCreateDataSchema(model, canBeArray, withoutFields, options) {
3323
3327
  const whereSchema = this.makeWhereSchema(model, true, false, false, options);
3324
3328
  const createSchema = this.makeCreateDataSchema(model, false, withoutFields, false, options);
3325
- return this.orArray(z.strictObject({
3329
+ return this.orArray(z$1.strictObject({
3326
3330
  where: whereSchema,
3327
3331
  create: createSchema
3328
3332
  }), canBeArray);
3329
3333
  }
3330
3334
  makeCreateManyPayloadSchema(model, withoutFields, options) {
3331
- const schema = z.strictObject({
3335
+ const schema = z$1.strictObject({
3332
3336
  data: this.makeCreateDataSchema(model, true, withoutFields, true, options),
3333
- skipDuplicates: z.boolean().optional()
3337
+ skipDuplicates: z$1.boolean().optional()
3334
3338
  });
3335
3339
  const idParts = [`${model}CreateManyPayload`];
3336
3340
  if (withoutFields.length) idParts.push(`Without${withoutFields.slice().sort().join("")}`);
@@ -3338,7 +3342,7 @@ var ZodSchemaFactory = class {
3338
3342
  return schema;
3339
3343
  }
3340
3344
  makeUpdateSchema(model, options) {
3341
- const baseSchema = z.strictObject({
3345
+ const baseSchema = z$1.strictObject({
3342
3346
  where: this.makeWhereSchema(model, true, false, false, options),
3343
3347
  data: this.makeUpdateDataSchema(model, [], false, options),
3344
3348
  select: this.makeSelectSchema(model, options).optional().nullable(),
@@ -3353,10 +3357,10 @@ var ZodSchemaFactory = class {
3353
3357
  return schema;
3354
3358
  }
3355
3359
  makeUpdateManySchema(model, options) {
3356
- const result = this.mergePluginArgsSchema(z.strictObject({
3360
+ const result = this.mergePluginArgsSchema(z$1.strictObject({
3357
3361
  where: this.makeWhereSchema(model, false, false, false, options).optional(),
3358
3362
  data: this.makeUpdateDataSchema(model, [], true, options),
3359
- limit: z.number().int().nonnegative().optional()
3363
+ limit: z$1.number().int().nonnegative().optional()
3360
3364
  }), "updateMany");
3361
3365
  this.registerSchema(`${model}UpdateManyArgs`, result);
3362
3366
  return result;
@@ -3372,7 +3376,7 @@ var ZodSchemaFactory = class {
3372
3376
  return schema;
3373
3377
  }
3374
3378
  makeUpsertSchema(model, options) {
3375
- const baseSchema = z.strictObject({
3379
+ const baseSchema = z$1.strictObject({
3376
3380
  where: this.makeWhereSchema(model, true, false, false, options),
3377
3381
  create: this.makeCreateDataSchema(model, false, [], false, options),
3378
3382
  update: this.makeUpdateDataSchema(model, [], false, options),
@@ -3408,27 +3412,27 @@ var ZodSchemaFactory = class {
3408
3412
  const oppositeFieldDef = requireField(this.schema, fieldDef.type, oppositeField);
3409
3413
  if (oppositeFieldDef.relation?.fields) excludeFields.push(...oppositeFieldDef.relation.fields);
3410
3414
  }
3411
- let fieldSchema = z.lazy(() => this.makeRelationManipulationSchema(model, field, excludeFields, "update", nextOpts)).optional();
3415
+ let fieldSchema = z$1.lazy(() => this.makeRelationManipulationSchema(model, field, excludeFields, "update", nextOpts)).optional();
3412
3416
  if (fieldDef.optional && !fieldDef.array) fieldSchema = fieldSchema.nullable();
3413
3417
  checkedVariantFields[field] = fieldSchema;
3414
3418
  if (fieldDef.array || !fieldDef.relation.references) uncheckedVariantFields[field] = fieldSchema;
3415
3419
  } else {
3416
3420
  let fieldSchema = this.makeScalarSchema(fieldDef.type, fieldDef.attributes);
3417
- if (this.isNumericField(fieldDef)) fieldSchema = z.union([fieldSchema, z.object({
3418
- set: this.nullableIf(z.number().optional(), !!fieldDef.optional).optional(),
3419
- increment: z.number().optional(),
3420
- decrement: z.number().optional(),
3421
- multiply: z.number().optional(),
3422
- divide: z.number().optional()
3421
+ if (this.isNumericField(fieldDef)) fieldSchema = z$1.union([fieldSchema, z$1.object({
3422
+ set: this.nullableIf(z$1.number().optional(), !!fieldDef.optional).optional(),
3423
+ increment: z$1.number().optional(),
3424
+ decrement: z$1.number().optional(),
3425
+ multiply: z$1.number().optional(),
3426
+ divide: z$1.number().optional()
3423
3427
  }).refine((v) => Object.keys(v).length === 1, "Only one of \"set\", \"increment\", \"decrement\", \"multiply\", or \"divide\" can be provided")]);
3424
3428
  if (fieldDef.array) {
3425
3429
  const arraySchema = ZodUtils.addListValidation(fieldSchema.array(), fieldDef.attributes);
3426
- fieldSchema = z.union([arraySchema, z.object({
3430
+ fieldSchema = z$1.union([arraySchema, z$1.object({
3427
3431
  set: arraySchema.optional(),
3428
- push: z.union([fieldSchema, fieldSchema.array()]).optional()
3432
+ push: z$1.union([fieldSchema, fieldSchema.array()]).optional()
3429
3433
  }).refine((v) => Object.keys(v).length === 1, "Only one of \"set\", \"push\" can be provided")]);
3430
3434
  }
3431
- if (fieldDef.optional) if (fieldDef.type === "Json") fieldSchema = z.union([fieldSchema, z.instanceof(DbNullClass)]);
3435
+ if (fieldDef.optional) if (fieldDef.type === "Json") fieldSchema = z$1.union([fieldSchema, z$1.instanceof(DbNullClass)]);
3432
3436
  else if (this.isTypeDefType(fieldDef.type)) fieldSchema = this.makeNullableTypedJsonMutationSchema(fieldSchema);
3433
3437
  else fieldSchema = fieldSchema.nullable();
3434
3438
  fieldSchema = fieldSchema.optional();
@@ -3436,9 +3440,9 @@ var ZodSchemaFactory = class {
3436
3440
  if (!fieldDef.foreignKeyFor) checkedVariantFields[field] = fieldSchema;
3437
3441
  }
3438
3442
  });
3439
- const uncheckedUpdateSchema = this.extraValidationsEnabled ? ZodUtils.addCustomValidation(z.strictObject(uncheckedVariantFields), modelDef.attributes) : z.strictObject(uncheckedVariantFields);
3440
- const checkedUpdateSchema = this.extraValidationsEnabled ? ZodUtils.addCustomValidation(z.strictObject(checkedVariantFields), modelDef.attributes) : z.strictObject(checkedVariantFields);
3441
- const result = !hasRelation ? uncheckedUpdateSchema : z.union([uncheckedUpdateSchema, checkedUpdateSchema]);
3443
+ const uncheckedUpdateSchema = this.extraValidationsEnabled ? ZodUtils.addCustomValidation(z$1.strictObject(uncheckedVariantFields), modelDef.attributes) : z$1.strictObject(uncheckedVariantFields);
3444
+ const checkedUpdateSchema = this.extraValidationsEnabled ? ZodUtils.addCustomValidation(z$1.strictObject(checkedVariantFields), modelDef.attributes) : z$1.strictObject(checkedVariantFields);
3445
+ const result = !hasRelation ? uncheckedUpdateSchema : z$1.union([uncheckedUpdateSchema, checkedUpdateSchema]);
3442
3446
  const idParts = [`${model}UpdateData`];
3443
3447
  if (withoutRelationFields) idParts.push("WithoutRelation");
3444
3448
  if (withoutFields.length) idParts.push(`Without${withoutFields.slice().sort().join("")}`);
@@ -3446,7 +3450,7 @@ var ZodSchemaFactory = class {
3446
3450
  return result;
3447
3451
  }
3448
3452
  makeDeleteSchema(model, options) {
3449
- const baseSchema = z.strictObject({
3453
+ const baseSchema = z$1.strictObject({
3450
3454
  where: this.makeWhereSchema(model, true, false, false, options),
3451
3455
  select: this.makeSelectSchema(model, options).optional().nullable(),
3452
3456
  include: this.makeIncludeSchema(model, options).optional().nullable(),
@@ -3460,15 +3464,15 @@ var ZodSchemaFactory = class {
3460
3464
  return schema;
3461
3465
  }
3462
3466
  makeDeleteManySchema(model, options) {
3463
- const result = this.mergePluginArgsSchema(z.strictObject({
3467
+ const result = this.mergePluginArgsSchema(z$1.strictObject({
3464
3468
  where: this.makeWhereSchema(model, false, false, false, options).optional(),
3465
- limit: z.number().int().nonnegative().optional()
3469
+ limit: z$1.number().int().nonnegative().optional()
3466
3470
  }), "deleteMany").optional();
3467
3471
  this.registerSchema(`${model}DeleteManyArgs`, result);
3468
3472
  return result;
3469
3473
  }
3470
3474
  makeCountSchema(model, options) {
3471
- const result = this.mergePluginArgsSchema(z.strictObject({
3475
+ const result = this.mergePluginArgsSchema(z$1.strictObject({
3472
3476
  where: this.makeWhereSchema(model, false, false, false, options).optional(),
3473
3477
  skip: this.makeSkipSchema().optional(),
3474
3478
  take: this.makeTakeSchema().optional(),
@@ -3479,10 +3483,10 @@ var ZodSchemaFactory = class {
3479
3483
  return result;
3480
3484
  }
3481
3485
  makeCountAggregateInputSchema(model) {
3482
- const schema = z.union([z.literal(true), z.strictObject({
3483
- _all: z.literal(true).optional(),
3486
+ const schema = z$1.union([z$1.literal(true), z$1.strictObject({
3487
+ _all: z$1.literal(true).optional(),
3484
3488
  ...this.getModelFields(model).reduce((acc, [field, fieldDef]) => {
3485
- acc[field] = this.isParameterizedComputedField(fieldDef) ? z.strictObject({ args: this.makeFieldArgsSchema(fieldDef.params) }).optional() : z.literal(true).optional();
3489
+ acc[field] = this.isParameterizedComputedField(fieldDef) ? z$1.strictObject({ args: this.makeFieldArgsSchema(fieldDef.params) }).optional() : z$1.literal(true).optional();
3486
3490
  return acc;
3487
3491
  }, {})
3488
3492
  })]);
@@ -3490,7 +3494,7 @@ var ZodSchemaFactory = class {
3490
3494
  return schema;
3491
3495
  }
3492
3496
  makeAggregateSchema(model, options) {
3493
- const result = this.mergePluginArgsSchema(z.strictObject({
3497
+ const result = this.mergePluginArgsSchema(z$1.strictObject({
3494
3498
  where: this.makeWhereSchema(model, false, false, false, options).optional(),
3495
3499
  skip: this.makeSkipSchema().optional(),
3496
3500
  take: this.makeTakeSchema().optional(),
@@ -3505,16 +3509,16 @@ var ZodSchemaFactory = class {
3505
3509
  return result;
3506
3510
  }
3507
3511
  makeSumAvgInputSchema(model) {
3508
- const schema = z.strictObject(this.getModelFields(model).reduce((acc, [field, fieldDef]) => {
3509
- if (this.isNumericField(fieldDef)) acc[field] = this.isParameterizedComputedField(fieldDef) ? z.strictObject({ args: this.makeFieldArgsSchema(fieldDef.params) }).optional() : z.literal(true).optional();
3512
+ const schema = z$1.strictObject(this.getModelFields(model).reduce((acc, [field, fieldDef]) => {
3513
+ if (this.isNumericField(fieldDef)) acc[field] = this.isParameterizedComputedField(fieldDef) ? z$1.strictObject({ args: this.makeFieldArgsSchema(fieldDef.params) }).optional() : z$1.literal(true).optional();
3510
3514
  return acc;
3511
3515
  }, {}));
3512
3516
  this.registerSchema(`${model}SumAvgAggregateInput`, schema);
3513
3517
  return schema;
3514
3518
  }
3515
3519
  makeMinMaxInputSchema(model) {
3516
- const schema = z.strictObject(this.getModelFields(model).reduce((acc, [field, fieldDef]) => {
3517
- if (!fieldDef.relation && !fieldDef.array) acc[field] = this.isParameterizedComputedField(fieldDef) ? z.strictObject({ args: this.makeFieldArgsSchema(fieldDef.params) }).optional() : z.literal(true).optional();
3520
+ const schema = z$1.strictObject(this.getModelFields(model).reduce((acc, [field, fieldDef]) => {
3521
+ if (!fieldDef.relation && !fieldDef.array) acc[field] = this.isParameterizedComputedField(fieldDef) ? z$1.strictObject({ args: this.makeFieldArgsSchema(fieldDef.params) }).optional() : z$1.literal(true).optional();
3518
3522
  return acc;
3519
3523
  }, {}));
3520
3524
  this.registerSchema(`${model}MinMaxAggregateInput`, schema);
@@ -3523,14 +3527,14 @@ var ZodSchemaFactory = class {
3523
3527
  makeGroupBySchema(model, options) {
3524
3528
  const nonRelationFields = this.getModelFields(model).filter(([, def]) => !def.relation && !this.isParameterizedComputedField(def)).map(([name]) => name);
3525
3529
  const byMembers = [];
3526
- if (nonRelationFields.length > 0) byMembers.push(z.enum(nonRelationFields));
3527
- for (const [field, fieldDef] of this.getModelFields(model)) if (this.isParameterizedComputedField(fieldDef)) byMembers.push(z.strictObject({
3528
- field: z.literal(field),
3530
+ if (nonRelationFields.length > 0) byMembers.push(z$1.enum(nonRelationFields));
3531
+ for (const [field, fieldDef] of this.getModelFields(model)) if (this.isParameterizedComputedField(fieldDef)) byMembers.push(z$1.strictObject({
3532
+ field: z$1.literal(field),
3529
3533
  args: this.makeFieldArgsSchema(fieldDef.params)
3530
3534
  }));
3531
- const byElement = byMembers.length === 0 ? void 0 : byMembers.length === 1 ? byMembers[0] : z.union(byMembers);
3532
- const bySchema = byElement ? this.orArray(byElement, true) : z.never();
3533
- const baseSchema = z.strictObject({
3535
+ const byElement = byMembers.length === 0 ? void 0 : byMembers.length === 1 ? byMembers[0] : z$1.union(byMembers);
3536
+ const bySchema = byElement ? this.orArray(byElement, true) : z$1.never();
3537
+ const baseSchema = z$1.strictObject({
3534
3538
  where: this.makeWhereSchema(model, false, false, false, options).optional(),
3535
3539
  orderBy: this.orArray(this.makeOrderBySchema(model, false, true, options), true).optional(),
3536
3540
  by: bySchema,
@@ -3582,7 +3586,7 @@ var ZodSchemaFactory = class {
3582
3586
  if (!procDef) throw createInternalError(`Procedure not found: ${procName}`);
3583
3587
  const shape = {};
3584
3588
  for (const param of Object.values(procDef.params ?? {})) shape[param.name] = this.makeProcedureParamSchema(param);
3585
- const schema = z.object(shape);
3589
+ const schema = z$1.object(shape);
3586
3590
  this.registerSchema(`${procName}ProcArgs`, schema);
3587
3591
  return schema;
3588
3592
  }
@@ -3590,10 +3594,10 @@ var ZodSchemaFactory = class {
3590
3594
  let schema;
3591
3595
  if (isTypeDef(this.schema, param.type)) schema = this.makeTypeDefSchema(param.type);
3592
3596
  else if (isEnum(this.schema, param.type)) schema = this.makeEnumSchema(param.type);
3593
- else if (param.type in (this.schema.models ?? {})) schema = z.record(z.string(), z.unknown());
3597
+ else if (param.type in (this.schema.models ?? {})) schema = z$1.record(z$1.string(), z$1.unknown());
3594
3598
  else {
3595
3599
  schema = this.makeScalarSchema(param.type);
3596
- if (schema instanceof z.ZodUnknown) throw createInternalError(`Unsupported procedure parameter type: ${param.type}`);
3600
+ if (schema instanceof z$1.ZodUnknown) throw createInternalError(`Unsupported procedure parameter type: ${param.type}`);
3597
3601
  }
3598
3602
  if (param.array) schema = schema.array();
3599
3603
  if (param.optional) schema = schema.optional();
@@ -3629,10 +3633,10 @@ var ZodSchemaFactory = class {
3629
3633
  return result;
3630
3634
  }
3631
3635
  makeSkipSchema() {
3632
- return z.number().int().nonnegative();
3636
+ return z$1.number().int().nonnegative();
3633
3637
  }
3634
3638
  makeTakeSchema() {
3635
- return z.number().int();
3639
+ return z$1.number().int();
3636
3640
  }
3637
3641
  refineForSelectIncludeMutuallyExclusive(schema) {
3638
3642
  return schema.refine((value) => !(value["select"] && value["include"]), "\"select\" and \"include\" cannot be used together");
@@ -3651,7 +3655,7 @@ var ZodSchemaFactory = class {
3651
3655
  return nullable ? schema.nullable() : schema;
3652
3656
  }
3653
3657
  orArray(schema, canBeArray) {
3654
- return canBeArray ? z.union([schema, z.array(schema)]) : schema;
3658
+ return canBeArray ? z$1.union([schema, z$1.array(schema)]) : schema;
3655
3659
  }
3656
3660
  isNumericField(fieldDef) {
3657
3661
  return NUMERIC_FIELD_TYPES.includes(fieldDef.type) && !fieldDef.array;
@@ -3713,10 +3717,10 @@ var ZodSchemaFactory = class {
3713
3717
  createUnionFilterSchema(valueSchema, optional, components, allowedFilterKinds) {
3714
3718
  if (Object.keys(components).length === 0) {
3715
3719
  if (!allowedFilterKinds || allowedFilterKinds.includes("Equality")) return this.nullableIf(valueSchema, optional);
3716
- return z.never();
3720
+ return z$1.never();
3717
3721
  }
3718
- if (!allowedFilterKinds || allowedFilterKinds.includes("Equality")) return z.union([this.nullableIf(valueSchema, optional), z.strictObject(components)]);
3719
- else return z.strictObject(components);
3722
+ if (!allowedFilterKinds || allowedFilterKinds.includes("Equality")) return z$1.union([this.nullableIf(valueSchema, optional), z$1.strictObject(components)]);
3723
+ else return z$1.strictObject(components);
3720
3724
  }
3721
3725
  canCreateModel(model) {
3722
3726
  const modelDef = requireModel(this.schema, model);
@@ -7422,9 +7426,9 @@ var ClientImpl = class ClientImpl {
7422
7426
  validateOptions(baseClient, options) {
7423
7427
  if (!baseClient && !options.skipValidationForComputedFields) this.validateComputedFieldsConfig(options);
7424
7428
  if (options.diagnostics) {
7425
- const parseResult = z$1.object({
7426
- slowQueryThresholdMs: z$1.number().nonnegative().optional(),
7427
- slowQueryMaxRecords: z$1.int().nonnegative().or(z$1.literal(Infinity)).optional()
7429
+ const parseResult = z.object({
7430
+ slowQueryThresholdMs: z.number().nonnegative().optional(),
7431
+ slowQueryMaxRecords: z.int().nonnegative().or(z.literal(Infinity)).optional()
7428
7432
  }).safeParse(options.diagnostics);
7429
7433
  if (!parseResult.success) throw createConfigError(`Invalid diagnostics configuration: ${formatError(parseResult.error)}`);
7430
7434
  }