@adaptic/backend 0.0.1045 → 0.0.1046

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/prismaClient.d.ts CHANGED
@@ -69,6 +69,20 @@ export declare function stampQuerySuccess<T>(run: () => Promise<T>): Promise<T>;
69
69
  * @returns The client with the ceiling applied.
70
70
  */
71
71
  export declare function withFindManyGuard(client: PrismaClient): PrismaClient;
72
+ /**
73
+ * Apply every guard the server's Prisma client carries: the unqualified
74
+ * `findMany` ceiling, and credential redaction on every `AuditLog` write
75
+ * (`./middleware/audit-log-write-redaction`), so a row written by any caller —
76
+ * a generated mutation, a plugin, a guard — stores no credential value.
77
+ *
78
+ * Both client assignment sites call this and nothing else. A guard installed
79
+ * only on the initial client silently disappears on the first reconnect,
80
+ * which is precisely when the process is already unhealthy.
81
+ *
82
+ * @param client - The client to wrap.
83
+ * @returns The client with every guard applied.
84
+ */
85
+ export declare function withClientGuards(client: PrismaClient): PrismaClient;
72
86
  /** Default statement timeout (30s) prevents hung queries from blocking pool slots indefinitely */
73
87
  export declare const DEFAULT_STATEMENT_TIMEOUT_MS = 30000;
74
88
  /** Heartbeat interval: how often we verify the DB connection is alive */
@@ -86,6 +100,14 @@ export declare const MAX_HEARTBEAT_FAILURES = 3;
86
100
  */
87
101
  export declare function resolveStatementTimeoutMs(): number;
88
102
  declare const prisma: PrismaClient;
103
+ /**
104
+ * Replace the global client with a fresh one, dropping every pooled
105
+ * connection. Called by the heartbeat after repeated failures.
106
+ *
107
+ * @internal Exported so the reconnect path's guards can be exercised by a
108
+ * test without failing the heartbeat three times.
109
+ */
110
+ export declare function reconnectPrisma(): Promise<void>;
89
111
  /**
90
112
  * Starts the periodic database heartbeat monitor.
91
113
  * Call once during server startup. The returned cleanup function