11export type Mode = 'text' | 'binary'
22
3- export const enum MessageName {
4- parseComplete = 'parseComplete' ,
5- bindComplete = 'bindComplete' ,
6- closeComplete = 'closeComplete' ,
7- noData = 'noData' ,
8- portalSuspended = 'portalSuspended' ,
9- replicationStart = 'replicationStart' ,
10- emptyQuery = 'emptyQuery' ,
11- copyDone = 'copyDone' ,
12- copyData = 'copyData' ,
13- rowDescription = 'rowDescription' ,
14- parameterStatus = 'parameterStatus' ,
15- backendKeyData = 'backendKeyData' ,
16- notification = 'notification' ,
17- readyForQuery = 'readyForQuery' ,
18- commandComplete = 'commandComplete' ,
19- dataRow = 'dataRow' ,
20- copyInResponse = 'copyInResponse' ,
21- copyOutResponse = 'copyOutResponse' ,
22- authenticationOk = 'authenticationOk' ,
23- authenticationMD5Password = 'authenticationMD5Password' ,
24- authenticationCleartextPassword = 'authenticationCleartextPassword' ,
25- authenticationSASL = 'authenticationSASL' ,
26- authenticationSASLContinue = 'authenticationSASLContinue' ,
27- authenticationSASLFinal = 'authenticationSASLFinal' ,
28- error = 'error' ,
29- notice = 'notice' ,
30- }
3+ export type MessageName =
4+ | 'parseComplete'
5+ | 'bindComplete'
6+ | 'closeComplete'
7+ | 'noData'
8+ | 'portalSuspended'
9+ | 'replicationStart'
10+ | 'emptyQuery'
11+ | 'copyDone'
12+ | 'copyData'
13+ | 'rowDescription'
14+ | 'parameterStatus'
15+ | 'backendKeyData'
16+ | 'notification'
17+ | 'readyForQuery'
18+ | 'commandComplete'
19+ | 'dataRow'
20+ | 'copyInResponse'
21+ | 'copyOutResponse'
22+ | 'authenticationOk'
23+ | 'authenticationMD5Password'
24+ | 'authenticationCleartextPassword'
25+ | 'authenticationSASL'
26+ | 'authenticationSASLContinue'
27+ | 'authenticationSASLFinal'
28+ | 'error'
29+ | 'notice'
3130
3231export interface BackendMessage {
3332 name : MessageName
3433 length : number
3534}
3635
3736export const parseComplete : BackendMessage = {
38- name : MessageName . parseComplete ,
37+ name : ' parseComplete' ,
3938 length : 5 ,
4039}
4140
4241export const bindComplete : BackendMessage = {
43- name : MessageName . bindComplete ,
42+ name : ' bindComplete' ,
4443 length : 5 ,
4544}
4645
4746export const closeComplete : BackendMessage = {
48- name : MessageName . closeComplete ,
47+ name : ' closeComplete' ,
4948 length : 5 ,
5049}
5150
5251export const noData : BackendMessage = {
53- name : MessageName . noData ,
52+ name : ' noData' ,
5453 length : 5 ,
5554}
5655
5756export const portalSuspended : BackendMessage = {
58- name : MessageName . portalSuspended ,
57+ name : ' portalSuspended' ,
5958 length : 5 ,
6059}
6160
6261export const replicationStart : BackendMessage = {
63- name : MessageName . replicationStart ,
62+ name : ' replicationStart' ,
6463 length : 4 ,
6564}
6665
6766export const emptyQuery : BackendMessage = {
68- name : MessageName . emptyQuery ,
67+ name : ' emptyQuery' ,
6968 length : 4 ,
7069}
7170
7271export const copyDone : BackendMessage = {
73- name : MessageName . copyDone ,
72+ name : ' copyDone' ,
7473 length : 4 ,
7574}
7675
@@ -117,7 +116,7 @@ export class DatabaseError extends Error implements NoticeOrError {
117116}
118117
119118export class CopyDataMessage {
120- public readonly name = MessageName . copyData
119+ public readonly name = ' copyData'
121120 constructor ( public readonly length : number , public readonly chunk : Buffer ) { }
122121}
123122
@@ -146,15 +145,15 @@ export class Field {
146145}
147146
148147export class RowDescriptionMessage {
149- public readonly name : MessageName = MessageName . rowDescription
148+ public readonly name : MessageName = ' rowDescription'
150149 public readonly fields : Field [ ]
151150 constructor ( public readonly length : number , public readonly fieldCount : number ) {
152151 this . fields = new Array ( this . fieldCount )
153152 }
154153}
155154
156155export class ParameterStatusMessage {
157- public readonly name : MessageName = MessageName . parameterStatus
156+ public readonly name : MessageName = ' parameterStatus'
158157 constructor (
159158 public readonly length : number ,
160159 public readonly parameterName : string ,
@@ -163,17 +162,17 @@ export class ParameterStatusMessage {
163162}
164163
165164export class AuthenticationMD5Password implements BackendMessage {
166- public readonly name : MessageName = MessageName . authenticationMD5Password
165+ public readonly name : MessageName = ' authenticationMD5Password'
167166 constructor ( public readonly length : number , public readonly salt : Buffer ) { }
168167}
169168
170169export class BackendKeyDataMessage {
171- public readonly name : MessageName = MessageName . backendKeyData
170+ public readonly name : MessageName = ' backendKeyData'
172171 constructor ( public readonly length : number , public readonly processID : number , public readonly secretKey : number ) { }
173172}
174173
175174export class NotificationResponseMessage {
176- public readonly name : MessageName = MessageName . notification
175+ public readonly name : MessageName = ' notification'
177176 constructor (
178177 public readonly length : number ,
179178 public readonly processId : number ,
@@ -183,26 +182,26 @@ export class NotificationResponseMessage {
183182}
184183
185184export class ReadyForQueryMessage {
186- public readonly name : MessageName = MessageName . readyForQuery
185+ public readonly name : MessageName = ' readyForQuery'
187186 constructor ( public readonly length : number , public readonly status : string ) { }
188187}
189188
190189export class CommandCompleteMessage {
191- public readonly name : MessageName = MessageName . commandComplete
190+ public readonly name : MessageName = ' commandComplete'
192191 constructor ( public readonly length : number , public readonly text : string ) { }
193192}
194193
195194export class DataRowMessage {
196195 public readonly fieldCount : number
197- public readonly name : MessageName = MessageName . dataRow
196+ public readonly name : MessageName = ' dataRow'
198197 constructor ( public length : number , public fields : any [ ] ) {
199198 this . fieldCount = fields . length
200199 }
201200}
202201
203202export class NoticeMessage implements BackendMessage , NoticeOrError {
204203 constructor ( public readonly length : number , public readonly message : string | undefined ) { }
205- public readonly name = MessageName . notice
204+ public readonly name = ' notice'
206205 public severity : string | undefined
207206 public code : string | undefined
208207 public detail : string | undefined
0 commit comments