prisma-guard 1.21.1 → 1.22.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.
@@ -25,6 +25,7 @@ __export(runtime_exports, {
25
25
  ShapeError: () => ShapeError,
26
26
  createGuard: () => createGuard,
27
27
  force: () => force,
28
+ namedShapes: () => namedShapes,
28
29
  unsupported: () => unsupported
29
30
  });
30
31
  module.exports = __toCommonJS(runtime_exports);
@@ -824,7 +825,7 @@ function createSchemaBuilder(typeMap, zodChains, enumMap, scalarBase, zodDefault
824
825
  var import_zod7 = require("zod");
825
826
 
826
827
  // src/shared/constants.ts
827
- var SHAPE_CONFIG_KEYS = /* @__PURE__ */ new Set([
828
+ var SHAPE_CONFIG_KEY_LIST = [
828
829
  "where",
829
830
  "include",
830
831
  "select",
@@ -840,13 +841,15 @@ var SHAPE_CONFIG_KEYS = /* @__PURE__ */ new Set([
840
841
  "_min",
841
842
  "_max",
842
843
  "by"
843
- ]);
844
- var GUARD_SHAPE_KEYS = /* @__PURE__ */ new Set([
844
+ ];
845
+ var SHAPE_CONFIG_KEYS = new Set(SHAPE_CONFIG_KEY_LIST);
846
+ var GUARD_SHAPE_KEY_LIST = [
845
847
  "data",
846
848
  "create",
847
849
  "update",
848
- ...SHAPE_CONFIG_KEYS
849
- ]);
850
+ ...SHAPE_CONFIG_KEY_LIST
851
+ ];
852
+ var GUARD_SHAPE_KEYS = new Set(GUARD_SHAPE_KEY_LIST);
850
853
  var COMBINATOR_KEYS = /* @__PURE__ */ new Set(["AND", "OR", "NOT"]);
851
854
  var TO_MANY_RELATION_OPS = /* @__PURE__ */ new Set(["some", "every", "none"]);
852
855
  var TO_ONE_RELATION_OPS = /* @__PURE__ */ new Set(["is", "isNot"]);
@@ -2484,67 +2487,51 @@ function createProjectionBuilder(typeMap, enumMap, deps) {
2484
2487
  return { buildIncludeSchema, buildSelectSchema, buildIncludeCountSchema };
2485
2488
  }
2486
2489
 
2487
- // src/runtime/query-builder.ts
2488
- var METHOD_ALLOWED_ARGS = {
2489
- findMany: /* @__PURE__ */ new Set([
2490
- "where",
2491
- "include",
2492
- "select",
2493
- "orderBy",
2494
- "cursor",
2495
- "take",
2496
- "skip",
2497
- "distinct"
2498
- ]),
2499
- findFirst: /* @__PURE__ */ new Set([
2500
- "where",
2501
- "include",
2502
- "select",
2503
- "orderBy",
2504
- "cursor",
2505
- "take",
2506
- "skip",
2507
- "distinct"
2508
- ]),
2509
- findFirstOrThrow: /* @__PURE__ */ new Set([
2510
- "where",
2511
- "include",
2512
- "select",
2513
- "orderBy",
2514
- "cursor",
2515
- "take",
2516
- "skip",
2517
- "distinct"
2518
- ]),
2519
- findUnique: /* @__PURE__ */ new Set(["where", "include", "select"]),
2520
- findUniqueOrThrow: /* @__PURE__ */ new Set(["where", "include", "select"]),
2521
- count: /* @__PURE__ */ new Set(["where", "select", "cursor", "orderBy", "skip", "take"]),
2522
- aggregate: /* @__PURE__ */ new Set([
2523
- "where",
2524
- "orderBy",
2525
- "cursor",
2526
- "take",
2527
- "skip",
2528
- "_count",
2529
- "_avg",
2530
- "_sum",
2531
- "_min",
2532
- "_max"
2533
- ]),
2534
- groupBy: /* @__PURE__ */ new Set([
2535
- "where",
2536
- "by",
2537
- "having",
2538
- "_count",
2539
- "_avg",
2540
- "_sum",
2541
- "_min",
2542
- "_max",
2543
- "orderBy",
2544
- "take",
2545
- "skip"
2546
- ])
2490
+ // src/shared/operation-shape-keys.ts
2491
+ var OPERATION_SHAPE_KEYS = {
2492
+ findMany: ["where", "include", "select", "orderBy", "cursor", "take", "skip", "distinct"],
2493
+ findFirst: ["where", "include", "select", "orderBy", "cursor", "take", "skip", "distinct"],
2494
+ findFirstOrThrow: ["where", "include", "select", "orderBy", "cursor", "take", "skip", "distinct"],
2495
+ findUnique: ["where", "include", "select"],
2496
+ findUniqueOrThrow: ["where", "include", "select"],
2497
+ findManyPaginated: ["where", "include", "select", "orderBy", "cursor", "take", "skip", "distinct"],
2498
+ count: ["where", "select", "cursor", "orderBy", "skip", "take"],
2499
+ aggregate: ["where", "orderBy", "cursor", "take", "skip", "_count", "_avg", "_sum", "_min", "_max"],
2500
+ groupBy: ["where", "by", "having", "_count", "_avg", "_sum", "_min", "_max", "orderBy", "take", "skip"],
2501
+ create: ["data", "select", "include"],
2502
+ createMany: ["data"],
2503
+ createManyAndReturn: ["data", "select", "include"],
2504
+ update: ["data", "where", "select", "include"],
2505
+ updateMany: ["data", "where"],
2506
+ updateManyAndReturn: ["data", "where", "select", "include"],
2507
+ upsert: ["where", "create", "update", "select", "include"],
2508
+ delete: ["where", "select", "include"],
2509
+ deleteMany: ["where"]
2510
+ };
2511
+ var READ_METHOD_ALLOWED_ARGS = {
2512
+ findMany: new Set(OPERATION_SHAPE_KEYS.findMany),
2513
+ findFirst: new Set(OPERATION_SHAPE_KEYS.findFirst),
2514
+ findFirstOrThrow: new Set(OPERATION_SHAPE_KEYS.findFirstOrThrow),
2515
+ findUnique: new Set(OPERATION_SHAPE_KEYS.findUnique),
2516
+ findUniqueOrThrow: new Set(OPERATION_SHAPE_KEYS.findUniqueOrThrow),
2517
+ count: new Set(OPERATION_SHAPE_KEYS.count),
2518
+ aggregate: new Set(OPERATION_SHAPE_KEYS.aggregate),
2519
+ groupBy: new Set(OPERATION_SHAPE_KEYS.groupBy)
2547
2520
  };
2521
+ var MUTATION_SHAPE_KEYS = {
2522
+ create: new Set(OPERATION_SHAPE_KEYS.create),
2523
+ createMany: new Set(OPERATION_SHAPE_KEYS.createMany),
2524
+ createManyAndReturn: new Set(OPERATION_SHAPE_KEYS.createManyAndReturn),
2525
+ update: new Set(OPERATION_SHAPE_KEYS.update),
2526
+ updateMany: new Set(OPERATION_SHAPE_KEYS.updateMany),
2527
+ updateManyAndReturn: new Set(OPERATION_SHAPE_KEYS.updateManyAndReturn),
2528
+ upsert: new Set(OPERATION_SHAPE_KEYS.upsert),
2529
+ delete: new Set(OPERATION_SHAPE_KEYS.delete),
2530
+ deleteMany: new Set(OPERATION_SHAPE_KEYS.deleteMany)
2531
+ };
2532
+
2533
+ // src/runtime/query-builder.ts
2534
+ var METHOD_ALLOWED_ARGS = READ_METHOD_ALLOWED_ARGS;
2548
2535
  var UNIQUE_WHERE_METHODS = /* @__PURE__ */ new Set([
2549
2536
  "findUnique",
2550
2537
  "findUniqueOrThrow"
@@ -5292,6 +5279,11 @@ function createGuard(config) {
5292
5279
  }
5293
5280
  };
5294
5281
  }
5282
+
5283
+ // src/shared/typed-shape.ts
5284
+ function namedShapes(shapes) {
5285
+ return shapes;
5286
+ }
5295
5287
  // Annotate the CommonJS export names for ESM import in node:
5296
5288
  0 && (module.exports = {
5297
5289
  CallerError,
@@ -5299,6 +5291,7 @@ function createGuard(config) {
5299
5291
  ShapeError,
5300
5292
  createGuard,
5301
5293
  force,
5294
+ namedShapes,
5302
5295
  unsupported
5303
5296
  });
5304
5297
  //# sourceMappingURL=index.cjs.map