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.
@@ -3361,23 +3361,20 @@ function buildRelationWriteSchema(model, fieldName, relatedModelName, isList, co
3361
3361
  }
3362
3362
  if (!isPlainObject(config.deleteMany)) {
3363
3363
  throw new ShapeError(
3364
- `deleteMany config on "${model}.${fieldName}" must be an object`
3364
+ `deleteMany config on "${model}.${fieldName}" must be an object of allowed filter fields`
3365
3365
  );
3366
3366
  }
3367
- const dmConfig = config.deleteMany;
3368
- if (!dmConfig.where || !isPlainObject(dmConfig.where)) {
3369
- throw new ShapeError(
3370
- `deleteMany on "${model}.${fieldName}" requires "where" object`
3371
- );
3372
- }
3373
- const whereSchema = buildWhereFieldsSchema(
3367
+ const filterSchema = buildWhereFieldsSchema(
3374
3368
  relatedModelName,
3375
- dmConfig.where,
3369
+ config.deleteMany,
3376
3370
  typeMap,
3377
3371
  schemaBuilder
3378
3372
  );
3379
- const dmSchema = z8.object({ where: whereSchema }).strict();
3380
- opSchemas["deleteMany"] = z8.union([dmSchema, z8.preprocess(coerceToArray, z8.array(dmSchema))]).optional();
3373
+ opSchemas["deleteMany"] = z8.union([
3374
+ filterSchema,
3375
+ z8.preprocess(coerceToArray, z8.array(filterSchema)),
3376
+ z8.object({}).strict()
3377
+ ]).optional();
3381
3378
  }
3382
3379
  return z8.object(opSchemas).strict();
3383
3380
  }