prisma-guard 1.13.0 → 1.13.1

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.
@@ -3391,23 +3391,20 @@ function buildRelationWriteSchema(model, fieldName, relatedModelName, isList, co
3391
3391
  }
3392
3392
  if (!isPlainObject(config.deleteMany)) {
3393
3393
  throw new ShapeError(
3394
- `deleteMany config on "${model}.${fieldName}" must be an object`
3394
+ `deleteMany config on "${model}.${fieldName}" must be an object of allowed filter fields`
3395
3395
  );
3396
3396
  }
3397
- const dmConfig = config.deleteMany;
3398
- if (!dmConfig.where || !isPlainObject(dmConfig.where)) {
3399
- throw new ShapeError(
3400
- `deleteMany on "${model}.${fieldName}" requires "where" object`
3401
- );
3402
- }
3403
- const whereSchema = buildWhereFieldsSchema(
3397
+ const filterSchema = buildWhereFieldsSchema(
3404
3398
  relatedModelName,
3405
- dmConfig.where,
3399
+ config.deleteMany,
3406
3400
  typeMap,
3407
3401
  schemaBuilder
3408
3402
  );
3409
- const dmSchema = import_zod8.z.object({ where: whereSchema }).strict();
3410
- opSchemas["deleteMany"] = import_zod8.z.union([dmSchema, import_zod8.z.preprocess(coerceToArray, import_zod8.z.array(dmSchema))]).optional();
3403
+ opSchemas["deleteMany"] = import_zod8.z.union([
3404
+ filterSchema,
3405
+ import_zod8.z.preprocess(coerceToArray, import_zod8.z.array(filterSchema)),
3406
+ import_zod8.z.object({}).strict()
3407
+ ]).optional();
3411
3408
  }
3412
3409
  return import_zod8.z.object(opSchemas).strict();
3413
3410
  }