@roundtreasury/prisma-extension-soft-delete 1.1.0 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  <div align="center">
2
2
  <h1>Prisma Extension Soft Delete</h1>
3
3
 
4
- <p>Round Prisma extension for soft deleting records.</p>
4
+ <p>Prisma extension for soft deleting records.</p>
5
5
 
6
6
  <p>
7
7
  Soft deleting records is a common pattern in many applications. This library provides an extension for Prisma that
@@ -14,10 +14,6 @@ export function createSoftDeleteExtension({ models, defaultConfig = {
14
14
  if (!defaultConfig.createValue) {
15
15
  throw new Error("prisma-extension-soft-delete: defaultConfig.createValue is required");
16
16
  }
17
- let dmmfToUse = dmmf;
18
- if (!dmmfToUse) {
19
- throw new Error("prisma-extension-soft-delete: dmmf is required, pass it in manually");
20
- }
21
17
  const modelConfig = {};
22
18
  Object.keys(models).forEach((model) => {
23
19
  const modelName = model;
@@ -27,7 +23,7 @@ export function createSoftDeleteExtension({ models, defaultConfig = {
27
23
  typeof config === "boolean" && config ? defaultConfig : config;
28
24
  }
29
25
  });
30
- const context = createContext(dmmfToUse);
26
+ const context = createContext(dmmf);
31
27
  const createParamsByModel = Object.keys(modelConfig).reduce((acc, model) => {
32
28
  const config = modelConfig[model];
33
29
  return {
@@ -70,7 +66,7 @@ export function createSoftDeleteExtension({ models, defaultConfig = {
70
66
  $allModels: {
71
67
  // @ts-expect-error - we don't know what the client is
72
68
  $allOperations: withNestedOperations({
73
- dmmf: dmmfToUse,
69
+ dmmf,
74
70
  async $rootOperation(initialParams) {
75
71
  var _a, _b;
76
72
  const createParams = (_a = createParamsByModel[initialParams.model || ""]) === null || _a === void 0 ? void 0 : _a[initialParams.operation];
@@ -13,5 +13,5 @@ export type ModelConfig = {
13
13
  export type Config = {
14
14
  models: Partial<Record<Prisma.ModelName, ModelConfig | boolean>>;
15
15
  defaultConfig?: ModelConfig;
16
- dmmf?: BaseDMMF;
16
+ dmmf: BaseDMMF;
17
17
  };
@@ -17,10 +17,6 @@ function createSoftDeleteExtension({ models, defaultConfig = {
17
17
  if (!defaultConfig.createValue) {
18
18
  throw new Error("prisma-extension-soft-delete: defaultConfig.createValue is required");
19
19
  }
20
- let dmmfToUse = dmmf;
21
- if (!dmmfToUse) {
22
- throw new Error("prisma-extension-soft-delete: dmmf is required, pass it in manually");
23
- }
24
20
  const modelConfig = {};
25
21
  Object.keys(models).forEach((model) => {
26
22
  const modelName = model;
@@ -30,7 +26,7 @@ function createSoftDeleteExtension({ models, defaultConfig = {
30
26
  typeof config === "boolean" && config ? defaultConfig : config;
31
27
  }
32
28
  });
33
- const context = (0, createParams_1.createContext)(dmmfToUse);
29
+ const context = (0, createParams_1.createContext)(dmmf);
34
30
  const createParamsByModel = Object.keys(modelConfig).reduce((acc, model) => {
35
31
  const config = modelConfig[model];
36
32
  return {
@@ -73,7 +69,7 @@ function createSoftDeleteExtension({ models, defaultConfig = {
73
69
  $allModels: {
74
70
  // @ts-expect-error - we don't know what the client is
75
71
  $allOperations: (0, prisma_extension_nested_operations_1.withNestedOperations)({
76
- dmmf: dmmfToUse,
72
+ dmmf,
77
73
  async $rootOperation(initialParams) {
78
74
  var _a, _b;
79
75
  const createParams = (_a = createParamsByModel[initialParams.model || ""]) === null || _a === void 0 ? void 0 : _a[initialParams.operation];
@@ -13,5 +13,5 @@ export type ModelConfig = {
13
13
  export type Config = {
14
14
  models: Partial<Record<Prisma.ModelName, ModelConfig | boolean>>;
15
15
  defaultConfig?: ModelConfig;
16
- dmmf?: BaseDMMF;
16
+ dmmf: BaseDMMF;
17
17
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@roundtreasury/prisma-extension-soft-delete",
3
- "version": "1.1.0",
4
- "description": "Round Treasury Prisma extension for soft deleting records",
3
+ "version": "1.2.0",
4
+ "description": "Prisma extension for soft deleting records",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "module": "dist/esm/index.js",
@@ -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.2.0"
32
+ "@roundtreasury/prisma-extension-nested-operations": "1.5.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@prisma/client": "*"