@pkgverse/prismock 2.0.1-beta.3 → 2.0.1-beta.4

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/dist/index.mjs CHANGED
@@ -5254,9 +5254,10 @@ function generateClient(delegates, getData, setData) {
5254
5254
  };
5255
5255
  }
5256
5256
  function getPgLitePrismockData(options) {
5257
- const sql = execSync(`bun prisma migrate diff --from-empty --to-schema-datamodel=${options.schemaPath} --script`, {
5257
+ const rawSql = execSync(`bun prisma migrate diff --from-empty --to-schema-datamodel=${options.schemaPath} --script`, {
5258
5258
  encoding: "utf-8"
5259
5259
  });
5260
+ const sql = rawSql.replace(/((?:CONSTRAINT\s+"[^"]+"\s+)?FOREIGN KEY\s*\([^)]*\)\s*REFERENCES\s+[^\s(]+\s*\([^)]*\))(?![\s\S]*?\bDEFERRABLE\b)/gi, `$1 DEFERRABLE INITIALLY DEFERRED`);
5260
5261
  const connectionPromise = options.adapter.connect();
5261
5262
  const reset = async () => {
5262
5263
  const connection = await connectionPromise;
@@ -5396,7 +5397,6 @@ async function getDefaultClientClass() {
5396
5397
  var createPrismock = getDefaultClient;
5397
5398
 
5398
5399
  // src/lib/prismock.ts
5399
- var PrismaInternals2 = await import("@prisma/internals");
5400
5400
  async function generatePrismock(options = {}) {
5401
5401
  const schema = await generateDMMF(options.schemaPath);
5402
5402
  return generatePrismockSync({ models: schema.datamodel.models });
@@ -12,13 +12,6 @@ type OptionsSync = {
12
12
  export type Data = Record<string, Item[]>;
13
13
  export type Properties = Record<string, DelegateProperties>;
14
14
  export type Delegates = Record<string, Delegate>;
15
- // export async function fetchGenerator(schemaPath?: string) {
16
- // const pathToModule = schemaPath ?? require.resolve(path.resolve(process.cwd(), 'prisma/schema.prisma'));
17
- // const config = await generateConfig(pathToModule);
18
- // return getGenerator({
19
- // schemaPath: pathToModule,
20
- // });
21
- // }
22
15
  export declare function fetchProvider(schemaPath?: string): Promise<string>;
23
16
  export declare function getProvider(generator: Generator): import("@prisma/generator").ActiveConnectorType | undefined;
24
17
  export declare function generatePrismock<T = PrismaClient>(options?: Options): Promise<PrismockClientType<T>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pkgverse/prismock",
3
- "version": "2.0.1-beta.3",
3
+ "version": "2.0.1-beta.4",
4
4
  "description": "A mock for PrismaClient, dedicated to unit testing.",
5
5
  "repository": {
6
6
  "url": "https://github.com/JQuezada0/prismock"