prisma-guard 1.5.1 → 1.6.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.
- package/dist/runtime/index.cjs +14 -14
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.js +14 -14
- package/dist/runtime/index.js.map +1 -1
- package/package.json +1 -1
package/dist/runtime/index.js
CHANGED
|
@@ -705,24 +705,24 @@ function mergeUniqueWhereForced(where, forced) {
|
|
|
705
705
|
}
|
|
706
706
|
function applyBuiltShape(built, body, isUniqueMethod) {
|
|
707
707
|
let parseable = body;
|
|
708
|
+
const hasWhereInSchema = "where" in built.zodSchema.shape;
|
|
708
709
|
if (isPlainObject(body)) {
|
|
709
710
|
const bodyObj = body;
|
|
710
|
-
if (
|
|
711
|
-
|
|
712
|
-
let modified = false;
|
|
713
|
-
if (built.forcedOnlyWhereKeys.size > 0) {
|
|
714
|
-
for (const key of built.forcedOnlyWhereKeys) {
|
|
715
|
-
if (key in where) {
|
|
716
|
-
delete where[key];
|
|
717
|
-
modified = true;
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
if (Object.keys(where).length === 0 && hasWhereForced(built.forcedWhere)) {
|
|
711
|
+
if ("where" in bodyObj) {
|
|
712
|
+
if (!hasWhereInSchema) {
|
|
722
713
|
const { where: _, ...rest } = bodyObj;
|
|
723
714
|
parseable = rest;
|
|
724
|
-
} else if (
|
|
725
|
-
|
|
715
|
+
} else if (built.forcedOnlyWhereKeys.size > 0 && isPlainObject(bodyObj.where)) {
|
|
716
|
+
const where = { ...bodyObj.where };
|
|
717
|
+
for (const key of built.forcedOnlyWhereKeys) {
|
|
718
|
+
delete where[key];
|
|
719
|
+
}
|
|
720
|
+
if (Object.keys(where).length === 0 && hasWhereForced(built.forcedWhere)) {
|
|
721
|
+
const { where: _, ...rest } = bodyObj;
|
|
722
|
+
parseable = rest;
|
|
723
|
+
} else {
|
|
724
|
+
parseable = { ...bodyObj, where };
|
|
725
|
+
}
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
728
|
}
|