Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ index.js
index.d.ts
index.mjs
index.d.mts
tests/packages/prisma/client/
75 changes: 45 additions & 30 deletions index.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ export declare interface Client {
* https://node-postgres.com/apis/client
*/
export declare class Client extends Client_2 {
config?: (string | ClientConfig) | undefined;
config?: string | ClientConfig | undefined;
get neonConfig(): neonConfig;
constructor(config?: (string | ClientConfig) | undefined);
constructor(config?: string | ClientConfig | undefined);
connect(): Promise<void>;
connect(callback: (err?: Error) => void): void;
_handleAuthSASLContinue(msg: any): Promise<void>;
Expand Down Expand Up @@ -306,6 +306,19 @@ export declare class Connection extends EventEmitter {

export declare type ConnectionConfig = ClientConfig;

declare interface ConnectionOptions {
host: string | null
password?: string
user?: string
port?: string | null
database: string | null | undefined
client_encoding?: string
ssl?: boolean | string
application_name?: string
fallback_application_name?: string
options?: string
}

export declare interface CustomTypesConfig {
getTypeParser: (id: PgTypeId, format?: PgTypeFormat) => any;
}
Expand Down Expand Up @@ -603,7 +616,7 @@ export declare class neonConfig extends EventEmitter {
*
* Default: `false`.
*/
static get poolQueryViaFetch(): NeonConfig["poolQueryViaFetch"];
static get poolQueryViaFetch(): NeonConfig['poolQueryViaFetch'];
static set poolQueryViaFetch(newValue: NeonConfig['poolQueryViaFetch']);
/**
* Set `fetchEndpoint` to set the server endpoint to be sent queries via http
Expand All @@ -616,7 +629,7 @@ export declare class neonConfig extends EventEmitter {
*
* Default: custom logic to connect to Neon endpoints.
*/
static get fetchEndpoint(): NeonConfig["fetchEndpoint"];
static get fetchEndpoint(): NeonConfig['fetchEndpoint'];
static set fetchEndpoint(newValue: NeonConfig['fetchEndpoint']);
/**
* **DEPRECATED**. Previously, only when `fetchConnectionCache` was `true`
Expand All @@ -626,7 +639,7 @@ export declare class neonConfig extends EventEmitter {
*
* Default: `true`.
*/
static get fetchConnectionCache(): NeonConfig["fetchConnectionCache"];
static get fetchConnectionCache(): NeonConfig['fetchConnectionCache'];
static set fetchConnectionCache(newValue: NeonConfig['fetchConnectionCache']);
/**
* The `fetchFunction` option allows you to supply an alternative function
Expand All @@ -635,7 +648,7 @@ export declare class neonConfig extends EventEmitter {
*
* Default: `undefined`.
*/
static get fetchFunction(): NeonConfig["fetchFunction"];
static get fetchFunction(): NeonConfig['fetchFunction'];
static set fetchFunction(newValue: NeonConfig['fetchFunction']);
/**
* Only if no global `WebSocket` object is available, such as in older
Expand All @@ -645,9 +658,9 @@ export declare class neonConfig extends EventEmitter {
*
* Default: `undefined`.
*/
static get webSocketConstructor(): NeonConfig["webSocketConstructor"];
static get webSocketConstructor(): NeonConfig['webSocketConstructor'];
static set webSocketConstructor(newValue: NeonConfig['webSocketConstructor']);
get webSocketConstructor(): NeonConfig["webSocketConstructor"];
get webSocketConstructor(): NeonConfig['webSocketConstructor'];
set webSocketConstructor(newValue: NeonConfig['webSocketConstructor']);
/**
* Set `wsProxy` to use your own WebSocket proxy server.
Expand All @@ -660,28 +673,28 @@ export declare class neonConfig extends EventEmitter {
*
* Default: `host => host + '/v2'`
*/
static get wsProxy(): NeonConfig["wsProxy"];
static get wsProxy(): NeonConfig['wsProxy'];
static set wsProxy(newValue: NeonConfig['wsProxy']);
get wsProxy(): NeonConfig["wsProxy"];
get wsProxy(): NeonConfig['wsProxy'];
set wsProxy(newValue: NeonConfig['wsProxy']);
/**
* Batch multiple network writes per run-loop into a single outgoing
* WebSocket message.
*
* Default: `true`.
*/
static get coalesceWrites(): NeonConfig["coalesceWrites"];
static get coalesceWrites(): NeonConfig['coalesceWrites'];
static set coalesceWrites(newValue: NeonConfig['coalesceWrites']);
get coalesceWrites(): NeonConfig["coalesceWrites"];
get coalesceWrites(): NeonConfig['coalesceWrites'];
set coalesceWrites(newValue: NeonConfig['coalesceWrites']);
/**
* Use a secure (`wss:`) connection to the WebSocket proxy.
*
* Default: `true`.
*/
static get useSecureWebSocket(): NeonConfig["useSecureWebSocket"];
static get useSecureWebSocket(): NeonConfig['useSecureWebSocket'];
static set useSecureWebSocket(newValue: NeonConfig['useSecureWebSocket']);
get useSecureWebSocket(): NeonConfig["useSecureWebSocket"];
get useSecureWebSocket(): NeonConfig['useSecureWebSocket'];
set useSecureWebSocket(newValue: NeonConfig['useSecureWebSocket']);
/**
* Disable TLS encryption in the Postgres protocol (as set via e.g.
Expand All @@ -690,9 +703,9 @@ export declare class neonConfig extends EventEmitter {
*
* Default: `true`
*/
static get forceDisablePgSSL(): NeonConfig["forceDisablePgSSL"];
static get forceDisablePgSSL(): NeonConfig['forceDisablePgSSL'];
static set forceDisablePgSSL(newValue: NeonConfig['forceDisablePgSSL']);
get forceDisablePgSSL(): NeonConfig["forceDisablePgSSL"];
get forceDisablePgSSL(): NeonConfig['forceDisablePgSSL'];
set forceDisablePgSSL(newValue: NeonConfig['forceDisablePgSSL']);
/**
* When using subtls with `forceDisablePgSSL = false` and Postgres connection
Expand All @@ -705,29 +718,29 @@ export declare class neonConfig extends EventEmitter {
*
* Default: `false`.
*/
static get disableSNI(): NeonConfig["disableSNI"];
static get disableSNI(): NeonConfig['disableSNI'];
static set disableSNI(newValue: NeonConfig['disableSNI']);
get disableSNI(): NeonConfig["disableSNI"];
get disableSNI(): NeonConfig['disableSNI'];
set disableSNI(newValue: NeonConfig['disableSNI']);
/**
* When `disableWarningInBrowsers` is set to `true`, it disables the warning about
* running this driver in the browser.
*
* Default: `false`.
*/
static get disableWarningInBrowsers(): NeonConfig["disableWarningInBrowsers"];
static get disableWarningInBrowsers(): NeonConfig['disableWarningInBrowsers'];
static set disableWarningInBrowsers(newValue: NeonConfig['disableWarningInBrowsers']);
get disableWarningInBrowsers(): NeonConfig["disableWarningInBrowsers"];
get disableWarningInBrowsers(): NeonConfig['disableWarningInBrowsers'];
set disableWarningInBrowsers(newValue: NeonConfig['disableWarningInBrowsers']);
/**
* Pipelines the startup message, cleartext password message and first query
* when set to `"password"`. This works only for cleartext password auth.
*
* Default: `"password"`.
*/
static get pipelineConnect(): NeonConfig["pipelineConnect"];
static get pipelineConnect(): NeonConfig['pipelineConnect'];
static set pipelineConnect(newValue: NeonConfig['pipelineConnect']);
get pipelineConnect(): NeonConfig["pipelineConnect"];
get pipelineConnect(): NeonConfig['pipelineConnect'];
set pipelineConnect(newValue: NeonConfig['pipelineConnect']);
/**
* If `forceDisablePgSSL` is `false` and the Postgres connection parameters
Expand All @@ -741,9 +754,9 @@ export declare class neonConfig extends EventEmitter {
*
* Default: `undefined`.
*/
static get subtls(): NeonConfig["subtls"];
static get subtls(): NeonConfig['subtls'];
static set subtls(newValue: NeonConfig['subtls']);
get subtls(): NeonConfig["subtls"];
get subtls(): NeonConfig['subtls'];
set subtls(newValue: NeonConfig['subtls']);
/**
* Pipeline the pg SSL request and TLS handshake when `forceDisablePgSSL` is
Expand All @@ -752,9 +765,9 @@ export declare class neonConfig extends EventEmitter {
*
* Default: `false`.
*/
static get pipelineTLS(): NeonConfig["pipelineTLS"];
static get pipelineTLS(): NeonConfig['pipelineTLS'];
static set pipelineTLS(newValue: NeonConfig['pipelineTLS']);
get pipelineTLS(): NeonConfig["pipelineTLS"];
get pipelineTLS(): NeonConfig['pipelineTLS'];
set pipelineTLS(newValue: NeonConfig['pipelineTLS']);
/**
* Set `rootCerts` to a string comprising one or more PEM files. These are
Expand All @@ -764,9 +777,9 @@ export declare class neonConfig extends EventEmitter {
*
* Default: `""`.
*/
static get rootCerts(): NeonConfig["rootCerts"];
static get rootCerts(): NeonConfig['rootCerts'];
static set rootCerts(newValue: NeonConfig['rootCerts']);
get rootCerts(): NeonConfig["rootCerts"];
get rootCerts(): NeonConfig['rootCerts'];
set rootCerts(newValue: NeonConfig['rootCerts']);
wsProxyAddrForHost(host: string, port: number): string;
connecting: boolean;
Expand All @@ -793,7 +806,7 @@ export declare type NeonConfigGlobalAndClient = Omit<NeonConfig, keyof NeonConfi
export declare type NeonConfigGlobalOnly = Pick<NeonConfig, 'fetchEndpoint' | 'poolQueryViaFetch' | 'fetchConnectionCache' | 'fetchFunction'>;

export declare class NeonDbError extends Error {
name: "NeonDbError";
name: 'NeonDbError';
severity: string | undefined;
code: string | undefined;
detail: string | undefined;
Expand Down Expand Up @@ -942,6 +955,8 @@ export declare interface ParameterizedQuery {
params: any[];
}

export declare function parseConnectionString(connectionString: string): ConnectionOptions;

declare type PgTypeFormat = 'text' | 'binary';

declare type PgTypeId = number;
Expand All @@ -960,7 +975,7 @@ export declare class Pool extends Pool_2 {
Client: typeof Client;
hasFetchUnsupportedListeners: boolean;
on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this;
addListener: (event: "error" | "connect" | "acquire" | "release" | "remove", listener: any) => this;
addListener: (event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any) => this;
query<T extends Submittable>(queryStream: T): T;
query<R extends any[] = any[], I = any[]>(queryConfig: QueryArrayConfig<I>, values?: QueryConfigValues<I>): Promise<QueryArrayResult<R>>;
query<R extends QueryResultRow = any, I = any[]>(queryConfig: QueryConfig<I>): Promise<QueryResult<R>>;
Expand Down
Loading
Loading