postgrejs
Version:
Professional PostgreSQL client NodeJS
180 lines (179 loc) • 5.44 kB
TypeScript
import type { Nullable } from '../types.js';
export declare namespace Protocol {
const VERSION_MAJOR = 3;
const VERSION_MINOR = 0;
enum BackendMessageCode {
Authentication = 82,// R
BackendKeyData = 75,// K
BindComplete = 50,// 2
CloseComplete = 51,// 3
CommandComplete = 67,// C
CopyData = 100,// d
CopyDone = 99,// c
CopyInResponse = 103,// G
CopyOutResponse = 72,// H
CopyBothResponse = 87,// W
DataRow = 68,// D
EmptyQueryResponse = 73,// I
ErrorResponse = 69,// E
FunctionCallResponse = 86,// V
NegotiateProtocolVersion = 118,// v
NoData = 110,// n
NoticeResponse = 78,// N
NotificationResponse = 65,// A
ParameterDescription = 116,// t
ParameterStatus = 83,// S
ParseComplete = 49,// 1
PortalSuspended = 115,// s
ReadyForQuery = 90,// Z
RowDescription = 84
}
enum FrontendMessageCode {
Bind = 66,// R
Close = 67,// C
CopyData = 100,// d
CopyDone = 99,// c
CopyFail = 102,// f
Describe = 68,// D
Execute = 69,// E
Flush = 72,// H
FunctionCall = 70,// F
Parse = 80,// P
PasswordMessage = 112,// p
Query = 81,// Q
Sync = 83,// S
Terminate = 88
}
enum AuthenticationMessageKind {
KerberosV5 = "KerberosV5",
CleartextPassword = "CleartextPassword",
MD5Password = "MD5Password",
SCMCredential = "SCMCredential",
GSS = "GSS",
SSPI = "SSPI",
GSSContinue = "GSSContinue",
SASL = "SASL",
SASLContinue = "SASLContinue",
SASLFinal = "SASLFinal"
}
enum DataFormat {
text = 0,
binary = 1
}
interface AuthenticationRequiredMessage {
kind: AuthenticationMessageKind;
}
interface AuthenticationKerberosV5Message extends AuthenticationRequiredMessage {
kind: AuthenticationMessageKind.KerberosV5;
}
interface AuthenticationCleartextPasswordMessage extends AuthenticationRequiredMessage {
kind: AuthenticationMessageKind.CleartextPassword;
}
interface AuthenticationMD5PasswordMessage extends AuthenticationRequiredMessage {
kind: AuthenticationMessageKind.MD5Password;
salt: Buffer;
}
interface AuthenticationSCMCredentialMessage extends AuthenticationRequiredMessage {
kind: AuthenticationMessageKind.SCMCredential;
}
interface AuthenticationGSSMessage extends AuthenticationRequiredMessage {
kind: AuthenticationMessageKind.GSS;
}
interface AuthenticationSSPIMessage extends AuthenticationRequiredMessage {
kind: AuthenticationMessageKind.SSPI;
}
interface AuthenticationGSSContinueMessage extends AuthenticationRequiredMessage {
kind: AuthenticationMessageKind.GSSContinue;
data: Buffer;
}
interface AuthenticationSASLMessage extends AuthenticationRequiredMessage {
kind: AuthenticationMessageKind.SASL;
mechanisms: string[];
}
interface AuthenticationSASLContinueMessage extends AuthenticationRequiredMessage {
kind: AuthenticationMessageKind.SASLContinue;
data: string;
}
interface AuthenticationSASLFinalMessage extends AuthenticationRequiredMessage {
kind: AuthenticationMessageKind.SASLFinal;
data: string;
}
interface BackendKeyDataMessage {
processID: number;
secretKey: number;
}
interface CommandCompleteMessage {
command: string;
oid?: number;
rowCount?: number;
}
interface CopyDataMessage {
data: Buffer;
}
interface CopyResponseMessage {
overallFormat: DataFormat;
columnCount: number;
columnFormats?: DataFormat[];
}
interface DataRow {
}
interface DataRowMessage {
columnCount: number;
columns: Nullable<Buffer>[];
}
interface ErrorResponseMessage {
severity?: string;
code?: string;
message?: string;
detail?: string;
hint?: string;
position?: string;
internalPosition?: string;
internalQuery?: string;
where?: string;
schema?: string;
table?: string;
column?: string;
dataType?: string;
constraint?: string;
file?: string;
line?: string;
routine?: string;
}
interface NotificationResponseMessage {
processId: number;
channel: string;
payload: string;
}
interface FunctionCallResponseMessage {
result: Buffer;
}
interface NegotiateProtocolVersionMessage {
supportedVersionMinor: number;
numberOfNotSupportedVersions: number;
option: string;
}
interface ParameterDescriptionMessage {
parameterCount: number;
parameterIds: number[];
}
interface ParameterStatusMessage {
name: string;
value: string;
}
interface ReadyForQueryMessage {
status: string;
}
interface RowDescription {
fieldName: string;
tableId: number;
columnId: number;
dataTypeId: number;
fixedSize?: number;
modifier?: number;
format: DataFormat;
}
interface RowDescriptionMessage {
fields: RowDescription[];
}
}