@pkgverse/prismock 2.0.2 → 2.0.3

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
@@ -119,6 +119,22 @@ const client = await getClient({
119
119
 
120
120
  Then, you will be able to write your tests as if your app was using an in-memory Prisma client.
121
121
 
122
+ ## Using with Prisma v7
123
+
124
+ The prisma schema went through breaking changes going from v6 -> v7.
125
+
126
+ You can import from the `v6` or `v7` package subpaths depending on which major version of prisma you're on.
127
+
128
+ ```ts
129
+ import { PrismaClient } from '${your_prisma_client_directory}';
130
+ import { getClient } from '@pkgverse/prismock/v7';
131
+
132
+ const client = await getClient({
133
+ PrismaClient,
134
+ schemaPath: "prisma/schema.prisma",
135
+ });
136
+ ```
137
+
122
138
  ## Use with decimal.js
123
139
 
124
140
  See [use with decimal.js](https://github.com/morintd/prismock/blob/master/docs/use-with-decimal-js.md).
@@ -1,5 +1,5 @@
1
1
  import type { PrismaClient } from "@prisma/client";
2
- import type { DMMF } from "@prisma/generator-helper";
2
+ import type { DMMF } from "@prisma/generator-helper-v7";
3
3
  import type * as runtime from "@prisma/client/runtime/library";
4
4
  import { Data } from "./prismock";
5
5
  import { type ExtensionsDefinition } from "./extensions";
@@ -52,10 +52,9 @@ type GetClientOptions<PrismaClientClassType extends new (...args: any[]) => any>
52
52
  prismaClient: PrismaClientClassType;
53
53
  schemaPath: string;
54
54
  usePgLite?: boolean | null | undefined;
55
+ clientOptions?: Record<string, any>;
55
56
  };
56
- export declare function getClient<PrismaClientType extends new (options: {
57
- adapter?: runtime.SqlDriverAdapterFactory | null;
58
- }, ...args: any[]) => any>(options: GetClientOptions<PrismaClientType>): Promise<PrismockClientType<InstanceType<PrismaClientType>>>;
57
+ export declare function getClient<PrismaClientType extends new (...args: any[]) => any>(options: GetClientOptions<PrismaClientType>): Promise<PrismockClientType<InstanceType<PrismaClientType>>>;
59
58
  type GetClientClassOptions<PrismaClientClassType extends new (...args: any[]) => any> = {
60
59
  PrismaClient: PrismaClientClassType;
61
60
  schemaPath: string;
@@ -1,4 +1,4 @@
1
- import type { DMMF } from '@prisma/generator-helper';
1
+ import type { DMMF } from '@prisma/generator-helper-v7';
2
2
  import type { ConfigMetaFormat } from '@prisma/internals/dist/engine-commands/getConfig';
3
3
  export declare function generateDMMF(schemaPath?: string): Promise<DMMF.Document>;
4
4
  export declare function generateConfig(schemaPath: string): Promise<ConfigMetaFormat>;
@@ -1,5 +1,4 @@
1
- import { type ActiveConnectorType } from '@prisma/generator-helper';
2
- import type { Generator } from '@prisma/internals';
1
+ import type { ActiveConnectorType } from '@prisma/generator-helper';
3
2
  import { Delegate, DelegateProperties, Item } from './delegate';
4
3
  import type { Model } from "@prisma/dmmf";
5
4
  type OptionsSync = {
@@ -9,7 +8,6 @@ export type Data = Record<string, Item[]>;
9
8
  export type Properties = Record<string, DelegateProperties>;
10
9
  export type Delegates = Record<string, Delegate>;
11
10
  export declare function fetchProvider(schemaPath?: string): Promise<ActiveConnectorType>;
12
- export declare function getProvider(generator: Generator): ActiveConnectorType | undefined;
13
11
  export declare function generateDelegates(options: OptionsSync): {
14
12
  delegates: Delegates;
15
13
  getData: () => Promise<Data>;