mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 18:04:55 +10:00
chore: merge main, resolve biome formatting conflicts
Merge origin/main into feat/external-2fa-codes. Resolve formatting conflicts caused by biome rollout; preserve both feature streams: PR's external 2FA token + signing-session 2FA proof additions plus main's RateLimit/RecipientExpired/signingReminders/date-auto-insert. In complete-document-with-token.ts, drop the duplicate early field-fetching block introduced when main moved that logic later with date auto-insert support; keep the EXTERNAL_TWO_FACTOR_AUTH check using derivedRecipientActionAuth.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/// <reference types="@documenso/prisma/types/types.d.ts" />
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import { readReplicas } from '@prisma/extension-read-replicas';
|
||||
import { Kysely, PostgresAdapter, PostgresIntrospector, PostgresQueryCompiler } from 'kysely';
|
||||
import kyselyExtension from 'prisma-extension-kysely';
|
||||
|
||||
@@ -7,11 +8,15 @@ import type { DB } from './generated/types';
|
||||
import { getDatabaseUrl } from './helper';
|
||||
import { remember } from './utils/remember';
|
||||
|
||||
export const prisma = remember(
|
||||
const prisma = remember(
|
||||
'prisma',
|
||||
() =>
|
||||
new PrismaClient({
|
||||
datasourceUrl: getDatabaseUrl(),
|
||||
transactionOptions: {
|
||||
maxWait: 5000,
|
||||
timeout: 10000,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -65,4 +70,22 @@ export const prismaWithLogging = remember('prismaWithLogging', () => {
|
||||
return client;
|
||||
});
|
||||
|
||||
export const prismaWithReplicas = remember('prismaWithReplicas', () => {
|
||||
if (!process.env.NEXT_PRIVATE_DATABASE_REPLICA_URLS) {
|
||||
return prisma;
|
||||
}
|
||||
|
||||
const replicaUrls = process.env.NEXT_PRIVATE_DATABASE_REPLICA_URLS.split(',').map((url) => url.trim());
|
||||
|
||||
// !: Nasty hack, means we can't do any fancy $primary/$replica queries
|
||||
// !: but it is acceptable since not all setups will have replicas anyway.
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||
return prisma.$extends(
|
||||
readReplicas({
|
||||
url: replicaUrls,
|
||||
}),
|
||||
) as unknown as typeof prisma;
|
||||
});
|
||||
|
||||
export { sql } from 'kysely';
|
||||
export { prismaWithReplicas as prisma };
|
||||
|
||||
Reference in New Issue
Block a user