@lokalise/prisma-utils 2.0.2 → 3.0.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,3 +1,5 @@
|
|
|
1
|
-
import { PrismaClient } from '@prisma/client';
|
|
1
|
+
import type { Prisma, PrismaClient } from '@prisma/client';
|
|
2
2
|
import type { PrismaClientFactoryOptions } from './types';
|
|
3
|
-
|
|
3
|
+
type PrismaClientConstructor<P extends PrismaClient> = new (options: Prisma.PrismaClientOptions) => P;
|
|
4
|
+
export declare const prismaClientFactory: <P extends PrismaClient>(PrismaClient: PrismaClientConstructor<P>, options?: PrismaClientFactoryOptions) => P;
|
|
5
|
+
export {};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prismaClientFactory = void 0;
|
|
4
|
-
const client_1 = require("@prisma/client");
|
|
5
4
|
const defaultOptions = {
|
|
6
5
|
transactionOptions: { isolationLevel: 'ReadCommitted' },
|
|
7
6
|
};
|
|
8
|
-
const prismaClientFactory = (options = {}) => {
|
|
7
|
+
const prismaClientFactory = (PrismaClient, options = {}) => {
|
|
9
8
|
options.transactionOptions = {
|
|
10
9
|
...defaultOptions.transactionOptions,
|
|
11
10
|
...options.transactionOptions,
|
|
12
11
|
};
|
|
13
12
|
//@ts-expect-error - ReadCommitted is not accepted by Prisma atm
|
|
14
|
-
return new
|
|
13
|
+
return new PrismaClient(options);
|
|
15
14
|
};
|
|
16
15
|
exports.prismaClientFactory = prismaClientFactory;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokalise/prisma-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": ["dist", "README.md", "LICENSE.md"],
|
|
7
|
-
"main": "./dist/index.
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"homepage": "https://github.com/lokalise/shared-ts-libs",
|
|
10
10
|
"repository": {
|