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.
@@ -162,7 +162,7 @@ var import_zod3 = require("zod");
162
162
  // src/runtime/zod-type-map.ts
163
163
  var import_zod2 = require("zod");
164
164
  var SCALAR_OPERATORS = {
165
- String: /* @__PURE__ */ new Set(["equals", "not", "contains", "startsWith", "endsWith", "in", "notIn"]),
165
+ String: /* @__PURE__ */ new Set(["equals", "not", "contains", "startsWith", "endsWith", "in", "notIn", "gt", "gte", "lt", "lte"]),
166
166
  Int: /* @__PURE__ */ new Set(["equals", "not", "gt", "gte", "lt", "lte", "in", "notIn"]),
167
167
  Float: /* @__PURE__ */ new Set(["equals", "not", "gt", "gte", "lt", "lte", "in", "notIn"]),
168
168
  Decimal: /* @__PURE__ */ new Set(["equals", "not", "gt", "gte", "lt", "lte", "in", "notIn"]),
@@ -738,6 +738,9 @@ function applyBuiltShape(built, body, isUniqueMethod) {
738
738
  const hasWhereInSchema = "where" in built.zodSchema.shape;
739
739
  if (isPlainObject(body)) {
740
740
  const bodyObj = body;
741
+ if ("select" in bodyObj && "include" in bodyObj) {
742
+ throw new ShapeError('Request cannot define both "include" and "select"');
743
+ }
741
744
  if ("where" in bodyObj) {
742
745
  if (!hasWhereInSchema) {
743
746
  const { where: _, ...rest } = bodyObj;
@@ -2140,11 +2143,6 @@ function createQueryBuilder(typeMap, enumMap, uniqueMap, scalarBase) {
2140
2143
  if (UNIQUE_WHERE_METHODS.has(method) && !shape.where) {
2141
2144
  throw new ShapeError(`${method} shape must define "where"`);
2142
2145
  }
2143
- if (shape.include && shape.select) {
2144
- throw new ShapeError(
2145
- 'Shape config cannot define both "include" and "select".'
2146
- );
2147
- }
2148
2146
  if (method === "groupBy" && !shape.by)
2149
2147
  throw new ShapeError('groupBy shape must define "by"');
2150
2148
  if (method === "groupBy" && (shape.include || shape.select)) {
@@ -3394,9 +3392,6 @@ function createModelGuardExtension(config) {
3394
3392
  return queryBuilder.buildWhereSchema(modelName, whereConfig);
3395
3393
  }
3396
3394
  function buildProjectionSchema(shape) {
3397
- if (shape.select && shape.include) {
3398
- throw new ShapeError('Shape cannot define both "select" and "include"');
3399
- }
3400
3395
  const schemaFields = {};
3401
3396
  let forcedIncludeTree = {};
3402
3397
  let forcedSelectTree = {};
@@ -3448,6 +3443,11 @@ function createModelGuardExtension(config) {
3448
3443
  `Guard shape does not define "select" or "include" for ${method} return projection`
3449
3444
  );
3450
3445
  }
3446
+ if ("select" in parsed && "include" in parsed) {
3447
+ throw new ShapeError(
3448
+ 'Request body cannot define both "select" and "include"'
3449
+ );
3450
+ }
3451
3451
  if (!hasShapeProjection)
3452
3452
  return {};
3453
3453
  if (!hasBodyProjection && !enforceProjection)