prisma-guard 1.7.0 → 1.8.0
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/README.md +50 -6
- package/dist/runtime/index.cjs +12 -1
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.js +12 -1
- package/dist/runtime/index.js.map +1 -1
- package/package.json +1 -1
package/dist/runtime/index.js
CHANGED
|
@@ -3473,7 +3473,18 @@ function createModelGuardExtension(config) {
|
|
|
3473
3473
|
resolved.wasDynamic
|
|
3474
3474
|
);
|
|
3475
3475
|
const isUnique = UNIQUE_READ_METHODS.has(method);
|
|
3476
|
-
|
|
3476
|
+
let effectiveBody = resolved.body;
|
|
3477
|
+
const hasShapeProjection = !!resolved.shape.select || !!resolved.shape.include;
|
|
3478
|
+
if (hasShapeProjection) {
|
|
3479
|
+
const hasBodyProjection = "select" in resolved.body || "include" in resolved.body;
|
|
3480
|
+
if (!hasBodyProjection) {
|
|
3481
|
+
effectiveBody = {
|
|
3482
|
+
...resolved.body,
|
|
3483
|
+
...buildDefaultProjectionBody(resolved.shape)
|
|
3484
|
+
};
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
3487
|
+
const args = applyBuiltShape(built, effectiveBody, isUnique);
|
|
3477
3488
|
if (isUnique && args.where) {
|
|
3478
3489
|
validateResolvedUniqueWhere(
|
|
3479
3490
|
modelName,
|