prisma-guard 1.9.0 → 1.9.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.
@@ -132,7 +132,7 @@ import { z as z3 } from "zod";
132
132
  // src/runtime/zod-type-map.ts
133
133
  import { z as z2 } from "zod";
134
134
  var SCALAR_OPERATORS = {
135
- String: /* @__PURE__ */ new Set(["equals", "not", "contains", "startsWith", "endsWith", "in", "notIn"]),
135
+ String: /* @__PURE__ */ new Set(["equals", "not", "contains", "startsWith", "endsWith", "in", "notIn", "gt", "gte", "lt", "lte"]),
136
136
  Int: /* @__PURE__ */ new Set(["equals", "not", "gt", "gte", "lt", "lte", "in", "notIn"]),
137
137
  Float: /* @__PURE__ */ new Set(["equals", "not", "gt", "gte", "lt", "lte", "in", "notIn"]),
138
138
  Decimal: /* @__PURE__ */ new Set(["equals", "not", "gt", "gte", "lt", "lte", "in", "notIn"]),
@@ -708,6 +708,9 @@ function applyBuiltShape(built, body, isUniqueMethod) {
708
708
  const hasWhereInSchema = "where" in built.zodSchema.shape;
709
709
  if (isPlainObject(body)) {
710
710
  const bodyObj = body;
711
+ if ("select" in bodyObj && "include" in bodyObj) {
712
+ throw new ShapeError('Request cannot define both "include" and "select"');
713
+ }
711
714
  if ("where" in bodyObj) {
712
715
  if (!hasWhereInSchema) {
713
716
  const { where: _, ...rest } = bodyObj;
@@ -2110,11 +2113,6 @@ function createQueryBuilder(typeMap, enumMap, uniqueMap, scalarBase) {
2110
2113
  if (UNIQUE_WHERE_METHODS.has(method) && !shape.where) {
2111
2114
  throw new ShapeError(`${method} shape must define "where"`);
2112
2115
  }
2113
- if (shape.include && shape.select) {
2114
- throw new ShapeError(
2115
- 'Shape config cannot define both "include" and "select".'
2116
- );
2117
- }
2118
2116
  if (method === "groupBy" && !shape.by)
2119
2117
  throw new ShapeError('groupBy shape must define "by"');
2120
2118
  if (method === "groupBy" && (shape.include || shape.select)) {
@@ -3364,9 +3362,6 @@ function createModelGuardExtension(config) {
3364
3362
  return queryBuilder.buildWhereSchema(modelName, whereConfig);
3365
3363
  }
3366
3364
  function buildProjectionSchema(shape) {
3367
- if (shape.select && shape.include) {
3368
- throw new ShapeError('Shape cannot define both "select" and "include"');
3369
- }
3370
3365
  const schemaFields = {};
3371
3366
  let forcedIncludeTree = {};
3372
3367
  let forcedSelectTree = {};
@@ -3418,6 +3413,11 @@ function createModelGuardExtension(config) {
3418
3413
  `Guard shape does not define "select" or "include" for ${method} return projection`
3419
3414
  );
3420
3415
  }
3416
+ if ("select" in parsed && "include" in parsed) {
3417
+ throw new ShapeError(
3418
+ 'Request body cannot define both "select" and "include"'
3419
+ );
3420
+ }
3421
3421
  if (!hasShapeProjection)
3422
3422
  return {};
3423
3423
  if (!hasBodyProjection && !enforceProjection)