@lokalise/prisma-utils 4.0.0 → 4.0.1
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/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -4
- package/dist/plugins/prismaMetricsPlugin.d.ts +1 -1
- package/dist/plugins/prismaMetricsPlugin.js +2 -2
- package/dist/prismaClientFactory.d.ts +1 -1
- package/dist/prismaClientFactory.js +0 -1
- package/dist/prismaClientFactory.js.map +1 -1
- package/dist/prismaTransaction.d.ts +1 -1
- package/dist/prismaTransaction.js +2 -2
- package/dist/types.d.ts +1 -1
- package/package.json +7 -7
package/dist/errors/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './prismaError.
|
|
1
|
+
export * from './prismaError.ts';
|
package/dist/errors/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./prismaError.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type * from './types.
|
|
2
|
-
export * from './errors/index.
|
|
3
|
-
export { prismaTransaction } from './prismaTransaction.
|
|
4
|
-
export { prismaClientFactory } from './prismaClientFactory.
|
|
5
|
-
export { prismaMetricsPlugin, type PrismaMetricsPluginOptions, } from './plugins/prismaMetricsPlugin.
|
|
1
|
+
export type * from './types.ts';
|
|
2
|
+
export * from './errors/index.ts';
|
|
3
|
+
export { prismaTransaction } from './prismaTransaction.ts';
|
|
4
|
+
export { prismaClientFactory } from './prismaClientFactory.ts';
|
|
5
|
+
export { prismaMetricsPlugin, type PrismaMetricsPluginOptions, } from './plugins/prismaMetricsPlugin.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export { prismaTransaction } from
|
|
3
|
-
export { prismaClientFactory } from
|
|
4
|
-
export { prismaMetricsPlugin, } from
|
|
1
|
+
export * from "./errors/index.js";
|
|
2
|
+
export { prismaTransaction } from "./prismaTransaction.js";
|
|
3
|
+
export { prismaClientFactory } from "./prismaClientFactory.js";
|
|
4
|
+
export { prismaMetricsPlugin, } from "./plugins/prismaMetricsPlugin.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FastifyPluginCallback } from 'fastify';
|
|
2
2
|
import 'fastify-metrics';
|
|
3
3
|
import type { PrismaClient } from '@prisma/client';
|
|
4
|
-
import type { MetricCollectorOptions } from './MetricsCollector.
|
|
4
|
+
import type { MetricCollectorOptions } from './MetricsCollector.ts';
|
|
5
5
|
declare module 'fastify' {
|
|
6
6
|
interface FastifyInstance {
|
|
7
7
|
prismaMetrics: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'fastify-metrics';
|
|
2
2
|
import fp from 'fastify-plugin';
|
|
3
|
-
import { PromiseBasedCollectionScheduler } from
|
|
4
|
-
import { MetricsCollector } from
|
|
3
|
+
import { PromiseBasedCollectionScheduler } from "./CollectionScheduler.js";
|
|
4
|
+
import { MetricsCollector } from "./MetricsCollector.js";
|
|
5
5
|
function plugin(fastify, pluginOptions, next) {
|
|
6
6
|
if (!fastify.metrics) {
|
|
7
7
|
return next(new Error('No Prometheus Client found, Prisma metrics plugin requires `fastify-metrics` plugin to be registered'));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Prisma, PrismaClient } from '@prisma/client';
|
|
2
|
-
import type { PrismaClientFactoryOptions } from './types.
|
|
2
|
+
import type { PrismaClientFactoryOptions } from './types.ts';
|
|
3
3
|
type PrismaClientConstructor<P extends PrismaClient> = new (options: Prisma.PrismaClientOptions) => P;
|
|
4
4
|
export declare const prismaClientFactory: <P extends PrismaClient>(PrismaClient: PrismaClientConstructor<P>, options?: PrismaClientFactoryOptions) => P;
|
|
5
5
|
export {};
|
|
@@ -6,7 +6,6 @@ export const prismaClientFactory = (PrismaClient, options = {}) => {
|
|
|
6
6
|
...defaultOptions.transactionOptions,
|
|
7
7
|
...options.transactionOptions,
|
|
8
8
|
};
|
|
9
|
-
//@ts-expect-error - ReadCommitted is not accepted by Prisma atm
|
|
10
9
|
return new PrismaClient(options);
|
|
11
10
|
};
|
|
12
11
|
//# sourceMappingURL=prismaClientFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prismaClientFactory.js","sourceRoot":"","sources":["../src/prismaClientFactory.ts"],"names":[],"mappings":"AAGA,MAAM,cAAc,GAA+B;IACjD,kBAAkB,EAAE,EAAE,cAAc,EAAE,eAAe,EAAE;CACxD,CAAA;AAMD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,YAAwC,EACxC,UAAsC,EAAE,EACrC,EAAE;IACL,OAAO,CAAC,kBAAkB,GAAG;QAC3B,GAAG,cAAc,CAAC,kBAAkB;QACpC,GAAG,OAAO,CAAC,kBAAkB;KAC9B,CAAA;IAED,
|
|
1
|
+
{"version":3,"file":"prismaClientFactory.js","sourceRoot":"","sources":["../src/prismaClientFactory.ts"],"names":[],"mappings":"AAGA,MAAM,cAAc,GAA+B;IACjD,kBAAkB,EAAE,EAAE,cAAc,EAAE,eAAe,EAAE;CACxD,CAAA;AAMD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,YAAwC,EACxC,UAAsC,EAAE,EACrC,EAAE;IACL,OAAO,CAAC,kBAAkB,GAAG;QAC3B,GAAG,cAAc,CAAC,kBAAkB;QACpC,GAAG,OAAO,CAAC,kBAAkB;KAC9B,CAAA;IAED,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAA;AAClC,CAAC,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Either } from '@lokalise/node-core';
|
|
2
2
|
import type { Prisma, PrismaClient } from '@prisma/client';
|
|
3
3
|
import type * as runtime from '@prisma/client/runtime/library';
|
|
4
|
-
import type { PrismaTransactionBasicOptions, PrismaTransactionFn, PrismaTransactionOptions } from './types.
|
|
4
|
+
import type { PrismaTransactionBasicOptions, PrismaTransactionFn, PrismaTransactionOptions } from './types.ts';
|
|
5
5
|
/**
|
|
6
6
|
* Perform a Prisma DB transaction with automatic retries if needed.
|
|
7
7
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { setTimeout } from 'node:timers/promises';
|
|
2
2
|
import { deepClone } from '@lokalise/node-core';
|
|
3
|
-
import { isCockroachDBRetryTransaction } from
|
|
4
|
-
import { PRISMA_SERIALIZATION_ERROR, PRISMA_SERVER_CLOSED_CONNECTION_ERROR, PRISMA_TRANSACTION_ERROR, isPrismaClientKnownRequestError, isPrismaTransactionClosedError, } from
|
|
3
|
+
import { isCockroachDBRetryTransaction } from "./errors/cockroachdbError.js";
|
|
4
|
+
import { PRISMA_SERIALIZATION_ERROR, PRISMA_SERVER_CLOSED_CONNECTION_ERROR, PRISMA_TRANSACTION_ERROR, isPrismaClientKnownRequestError, isPrismaTransactionClosedError, } from "./errors/prismaError.js";
|
|
5
5
|
const DEFAULT_OPTIONS = {
|
|
6
6
|
retriesAllowed: 2, // first try + 2 retries = 3 tries
|
|
7
7
|
dbDriver: 'CockroachDb',
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Either } from '@lokalise/node-core';
|
|
2
2
|
import type { Prisma } from '@prisma/client';
|
|
3
3
|
import type * as runtime from '@prisma/client/runtime/library';
|
|
4
|
-
import type { CockroachDbIsolationLevel } from './isolation_level/isolationLevel.
|
|
4
|
+
import type { CockroachDbIsolationLevel } from './isolation_level/isolationLevel.ts';
|
|
5
5
|
type ObjectValues<T> = T[keyof T];
|
|
6
6
|
export declare const DbDriverEnum: {
|
|
7
7
|
readonly COCKROACHDB: "CockroachDb";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokalise/prisma-utils",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": ["dist", "README.md", "LICENSE.md"],
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"docker:start:ci": "docker compose up -d cockroachdb",
|
|
23
23
|
"db:migration:dev": "prisma migrate dev",
|
|
24
24
|
"db:update-client": "prisma generate",
|
|
25
|
-
"db:wait": "while ! echo \"SELECT 1;\" | prisma db execute --stdin; do sleep 1; done",
|
|
25
|
+
"db:wait": "while ! echo \"SELECT 1;\" | prisma db execute --stdin --schema prisma/schema.prisma; do sleep 1; done",
|
|
26
26
|
"test": "vitest run",
|
|
27
27
|
"test:migrate": "cross-env NODE_ENV=test prisma migrate reset --force",
|
|
28
28
|
"pretest:ci": "npm run docker:start:ci && npm run db:wait && npm run test:migrate",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"postversion": "biome check --write package.json"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lokalise/node-core": "^
|
|
36
|
+
"@lokalise/node-core": "^14.0.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@prisma/client": ">=5.0.0 <7.0.0",
|
|
@@ -41,16 +41,16 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@biomejs/biome": "^1.9.4",
|
|
44
|
-
"@lokalise/biome-config": "^
|
|
44
|
+
"@lokalise/biome-config": "^2.0.0",
|
|
45
45
|
"@lokalise/backend-http-client": "^2.3.0",
|
|
46
|
-
"@lokalise/fastify-extras": "^
|
|
47
|
-
"@lokalise/tsconfig": "^1.0
|
|
46
|
+
"@lokalise/fastify-extras": "^27.0.0",
|
|
47
|
+
"@lokalise/tsconfig": "^1.3.0",
|
|
48
48
|
"@prisma/client": "^6.0.1",
|
|
49
49
|
"@vitest/coverage-v8": "^3.0.7",
|
|
50
50
|
"cross-env": "^7.0.3",
|
|
51
51
|
"prisma": "^6.0.1",
|
|
52
52
|
"rimraf": "^6.0.1",
|
|
53
|
-
"typescript": "5.8.
|
|
53
|
+
"typescript": "5.8.3",
|
|
54
54
|
"vitest": "^3.0.7"
|
|
55
55
|
}
|
|
56
56
|
}
|