prisma-guard 1.22.0 → 1.22.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/README.md
CHANGED
|
@@ -1400,6 +1400,25 @@ Without a `default` key, missing or unmatched callers throw `CallerError`.
|
|
|
1400
1400
|
|
|
1401
1401
|
The `default` fallback works consistently across both `.guard()` and `guard.query().parse()` API surfaces.
|
|
1402
1402
|
|
|
1403
|
+
### Note for generated route configs
|
|
1404
|
+
|
|
1405
|
+
The direct `.guard({ where: ... })` form is still valid in the runtime API. Generated route configs from `prisma-generator-express`, however, type operation `shape` as a named shape map. For a single generated-route shape, put it under `default`:
|
|
1406
|
+
|
|
1407
|
+
```ts
|
|
1408
|
+
const projectConfig = {
|
|
1409
|
+
findMany: {
|
|
1410
|
+
shape: {
|
|
1411
|
+
default: {
|
|
1412
|
+
where: { title: { contains: true } },
|
|
1413
|
+
take: { max: 50, default: 20 },
|
|
1414
|
+
},
|
|
1415
|
+
},
|
|
1416
|
+
},
|
|
1417
|
+
}
|
|
1418
|
+
```
|
|
1419
|
+
|
|
1420
|
+
Additional keys such as `admin`, `public`, or path patterns are caller-routed variants. Reserved shape keys such as `where`, `data`, `include`, and `select` cannot be used as caller keys.
|
|
1421
|
+
|
|
1403
1422
|
### Caller resolution order
|
|
1404
1423
|
|
|
1405
1424
|
Caller is resolved in priority order:
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -25,7 +25,6 @@ __export(runtime_exports, {
|
|
|
25
25
|
ShapeError: () => ShapeError,
|
|
26
26
|
createGuard: () => createGuard,
|
|
27
27
|
force: () => force,
|
|
28
|
-
namedShapes: () => namedShapes,
|
|
29
28
|
unsupported: () => unsupported
|
|
30
29
|
});
|
|
31
30
|
module.exports = __toCommonJS(runtime_exports);
|
|
@@ -5279,11 +5278,6 @@ function createGuard(config) {
|
|
|
5279
5278
|
}
|
|
5280
5279
|
};
|
|
5281
5280
|
}
|
|
5282
|
-
|
|
5283
|
-
// src/shared/typed-shape.ts
|
|
5284
|
-
function namedShapes(shapes) {
|
|
5285
|
-
return shapes;
|
|
5286
|
-
}
|
|
5287
5281
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5288
5282
|
0 && (module.exports = {
|
|
5289
5283
|
CallerError,
|
|
@@ -5291,7 +5285,6 @@ function namedShapes(shapes) {
|
|
|
5291
5285
|
ShapeError,
|
|
5292
5286
|
createGuard,
|
|
5293
5287
|
force,
|
|
5294
|
-
namedShapes,
|
|
5295
5288
|
unsupported
|
|
5296
5289
|
});
|
|
5297
5290
|
//# sourceMappingURL=index.cjs.map
|