@roundtreasury/prisma-extension-soft-delete 1.0.1 → 1.1.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.
@@ -1,4 +1,3 @@
1
- import { Prisma } from "@prisma/client";
2
1
  import { Prisma as PrismaExtensions } from "@prisma/client/extension";
3
2
  import { withNestedOperations, } from "@roundtreasury/prisma-extension-nested-operations";
4
3
  import { createAggregateParams, createCountParams, createDeleteManyParams, createDeleteParams, createFindFirstParams, createFindFirstOrThrowParams, createFindManyParams, createFindUniqueParams, createFindUniqueOrThrowParams, createIncludeParams, createSelectParams, createUpdateManyParams, createUpdateParams, createUpsertParams, createWhereParams, createGroupByParams, createContext, } from "./helpers/createParams";
@@ -15,7 +14,10 @@ export function createSoftDeleteExtension({ models, defaultConfig = {
15
14
  if (!defaultConfig.createValue) {
16
15
  throw new Error("prisma-extension-soft-delete: defaultConfig.createValue is required");
17
16
  }
18
- const dmmfToUse = dmmf !== null && dmmf !== void 0 ? dmmf : Prisma.dmmf;
17
+ let dmmfToUse = dmmf;
18
+ if (!dmmfToUse) {
19
+ throw new Error("prisma-extension-soft-delete: dmmf is required, pass it in manually");
20
+ }
19
21
  const modelConfig = {};
20
22
  Object.keys(models).forEach((model) => {
21
23
  const modelName = model;
@@ -1,5 +1,5 @@
1
1
  import { NestedParams } from "@roundtreasury/prisma-extension-nested-operations";
2
- import { BaseDMMF } from "@prisma/client/runtime/library";
2
+ import type { BaseDMMF } from "@prisma/client/runtime/library";
3
3
  import { Context, ModelConfig } from "../types";
4
4
  export declare const createContext: (dmmf: BaseDMMF) => Context;
5
5
  export type Params = Omit<NestedParams<any>, "operation"> & {
@@ -1,5 +1,5 @@
1
- import { Prisma } from "@prisma/client";
2
- import { BaseDMMF } from "@prisma/client/runtime/library";
1
+ import type { Prisma } from "@prisma/client";
2
+ import type { BaseDMMF } from "@prisma/client/runtime/library";
3
3
  export type Context = {
4
4
  uniqueFieldsByModel: Record<string, string[]>;
5
5
  uniqueIndexFieldsByModel: Record<string, string[]>;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createSoftDeleteExtension = void 0;
4
- const client_1 = require("@prisma/client");
5
4
  const extension_1 = require("@prisma/client/extension");
6
5
  const prisma_extension_nested_operations_1 = require("@roundtreasury/prisma-extension-nested-operations");
7
6
  const createParams_1 = require("./helpers/createParams");
@@ -18,7 +17,10 @@ function createSoftDeleteExtension({ models, defaultConfig = {
18
17
  if (!defaultConfig.createValue) {
19
18
  throw new Error("prisma-extension-soft-delete: defaultConfig.createValue is required");
20
19
  }
21
- const dmmfToUse = dmmf !== null && dmmf !== void 0 ? dmmf : client_1.Prisma.dmmf;
20
+ let dmmfToUse = dmmf;
21
+ if (!dmmfToUse) {
22
+ throw new Error("prisma-extension-soft-delete: dmmf is required, pass it in manually");
23
+ }
22
24
  const modelConfig = {};
23
25
  Object.keys(models).forEach((model) => {
24
26
  const modelName = model;
@@ -1,5 +1,5 @@
1
1
  import { NestedParams } from "@roundtreasury/prisma-extension-nested-operations";
2
- import { BaseDMMF } from "@prisma/client/runtime/library";
2
+ import type { BaseDMMF } from "@prisma/client/runtime/library";
3
3
  import { Context, ModelConfig } from "../types";
4
4
  export declare const createContext: (dmmf: BaseDMMF) => Context;
5
5
  export type Params = Omit<NestedParams<any>, "operation"> & {
@@ -1,5 +1,5 @@
1
- import { Prisma } from "@prisma/client";
2
- import { BaseDMMF } from "@prisma/client/runtime/library";
1
+ import type { Prisma } from "@prisma/client";
2
+ import type { BaseDMMF } from "@prisma/client/runtime/library";
3
3
  export type Context = {
4
4
  uniqueFieldsByModel: Record<string, string[]>;
5
5
  uniqueIndexFieldsByModel: Record<string, string[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roundtreasury/prisma-extension-soft-delete",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Round Treasury Prisma extension for soft deleting records",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "author": "Olivier Wilkinson",
30
30
  "license": "Apache-2.0",
31
31
  "dependencies": {
32
- "@roundtreasury/prisma-extension-nested-operations": "^1.1.0"
32
+ "@roundtreasury/prisma-extension-nested-operations": "^1.2.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@prisma/client": "*"