|
| 1 | +/// <reference types="node" /> |
| 2 | +export declare type Mode = 'text' | 'binary'; |
| 3 | +export declare type MessageName = 'parseComplete' | 'bindComplete' | 'closeComplete' | 'noData' | 'portalSuspended' | 'replicationStart' | 'emptyQuery' | 'copyDone' | 'copyData' | 'rowDescription' | 'parameterDescription' | 'parameterStatus' | 'backendKeyData' | 'notification' | 'readyForQuery' | 'commandComplete' | 'dataRow' | 'copyInResponse' | 'copyOutResponse' | 'authenticationOk' | 'authenticationMD5Password' | 'authenticationCleartextPassword' | 'authenticationSASL' | 'authenticationSASLContinue' | 'authenticationSASLFinal' | 'error' | 'notice'; |
| 4 | +export interface BackendMessage { |
| 5 | + name: MessageName; |
| 6 | + length: number; |
| 7 | +} |
| 8 | +export declare const parseComplete: BackendMessage; |
| 9 | +export declare const bindComplete: BackendMessage; |
| 10 | +export declare const closeComplete: BackendMessage; |
| 11 | +export declare const noData: BackendMessage; |
| 12 | +export declare const portalSuspended: BackendMessage; |
| 13 | +export declare const replicationStart: BackendMessage; |
| 14 | +export declare const emptyQuery: BackendMessage; |
| 15 | +export declare const copyDone: BackendMessage; |
| 16 | +interface NoticeOrError { |
| 17 | + message: string | undefined; |
| 18 | + severity: string | undefined; |
| 19 | + code: string | undefined; |
| 20 | + detail: string | undefined; |
| 21 | + hint: string | undefined; |
| 22 | + position: string | undefined; |
| 23 | + internalPosition: string | undefined; |
| 24 | + internalQuery: string | undefined; |
| 25 | + where: string | undefined; |
| 26 | + schema: string | undefined; |
| 27 | + table: string | undefined; |
| 28 | + column: string | undefined; |
| 29 | + dataType: string | undefined; |
| 30 | + constraint: string | undefined; |
| 31 | + file: string | undefined; |
| 32 | + line: string | undefined; |
| 33 | + routine: string | undefined; |
| 34 | +} |
| 35 | +export declare class DatabaseError extends Error implements NoticeOrError { |
| 36 | + readonly length: number; |
| 37 | + readonly name: MessageName; |
| 38 | + severity: string | undefined; |
| 39 | + code: string | undefined; |
| 40 | + detail: string | undefined; |
| 41 | + hint: string | undefined; |
| 42 | + position: string | undefined; |
| 43 | + internalPosition: string | undefined; |
| 44 | + internalQuery: string | undefined; |
| 45 | + where: string | undefined; |
| 46 | + schema: string | undefined; |
| 47 | + table: string | undefined; |
| 48 | + column: string | undefined; |
| 49 | + dataType: string | undefined; |
| 50 | + constraint: string | undefined; |
| 51 | + file: string | undefined; |
| 52 | + line: string | undefined; |
| 53 | + routine: string | undefined; |
| 54 | + constructor(message: string, length: number, name: MessageName); |
| 55 | +} |
| 56 | +export declare class CopyDataMessage { |
| 57 | + readonly length: number; |
| 58 | + readonly chunk: Buffer; |
| 59 | + readonly name = "copyData"; |
| 60 | + constructor(length: number, chunk: Buffer); |
| 61 | +} |
| 62 | +export declare class CopyResponse { |
| 63 | + readonly length: number; |
| 64 | + readonly name: MessageName; |
| 65 | + readonly binary: boolean; |
| 66 | + readonly columnTypes: number[]; |
| 67 | + constructor(length: number, name: MessageName, binary: boolean, columnCount: number); |
| 68 | +} |
| 69 | +export declare class Field { |
| 70 | + readonly name: string; |
| 71 | + readonly tableID: number; |
| 72 | + readonly columnID: number; |
| 73 | + readonly dataTypeID: number; |
| 74 | + readonly dataTypeSize: number; |
| 75 | + readonly dataTypeModifier: number; |
| 76 | + readonly format: Mode; |
| 77 | + constructor(name: string, tableID: number, columnID: number, dataTypeID: number, dataTypeSize: number, dataTypeModifier: number, format: Mode); |
| 78 | +} |
| 79 | +export declare class RowDescriptionMessage { |
| 80 | + readonly length: number; |
| 81 | + readonly fieldCount: number; |
| 82 | + readonly name: MessageName; |
| 83 | + readonly fields: Field[]; |
| 84 | + constructor(length: number, fieldCount: number); |
| 85 | +} |
| 86 | +export declare class ParameterDescriptionMessage { |
| 87 | + readonly length: number; |
| 88 | + readonly parameterCount: number; |
| 89 | + readonly name: MessageName; |
| 90 | + readonly dataTypeIDs: number[]; |
| 91 | + constructor(length: number, parameterCount: number); |
| 92 | +} |
| 93 | +export declare class ParameterStatusMessage { |
| 94 | + readonly length: number; |
| 95 | + readonly parameterName: string; |
| 96 | + readonly parameterValue: string; |
| 97 | + readonly name: MessageName; |
| 98 | + constructor(length: number, parameterName: string, parameterValue: string); |
| 99 | +} |
| 100 | +export declare class AuthenticationMD5Password implements BackendMessage { |
| 101 | + readonly length: number; |
| 102 | + readonly salt: Buffer; |
| 103 | + readonly name: MessageName; |
| 104 | + constructor(length: number, salt: Buffer); |
| 105 | +} |
| 106 | +export declare class BackendKeyDataMessage { |
| 107 | + readonly length: number; |
| 108 | + readonly processID: number; |
| 109 | + readonly secretKey: number; |
| 110 | + readonly name: MessageName; |
| 111 | + constructor(length: number, processID: number, secretKey: number); |
| 112 | +} |
| 113 | +export declare class NotificationResponseMessage { |
| 114 | + readonly length: number; |
| 115 | + readonly processId: number; |
| 116 | + readonly channel: string; |
| 117 | + readonly payload: string; |
| 118 | + readonly name: MessageName; |
| 119 | + constructor(length: number, processId: number, channel: string, payload: string); |
| 120 | +} |
| 121 | +export declare class ReadyForQueryMessage { |
| 122 | + readonly length: number; |
| 123 | + readonly status: string; |
| 124 | + readonly name: MessageName; |
| 125 | + constructor(length: number, status: string); |
| 126 | +} |
| 127 | +export declare class CommandCompleteMessage { |
| 128 | + readonly length: number; |
| 129 | + readonly text: string; |
| 130 | + readonly name: MessageName; |
| 131 | + constructor(length: number, text: string); |
| 132 | +} |
| 133 | +export declare class DataRowMessage { |
| 134 | + length: number; |
| 135 | + fields: any[]; |
| 136 | + readonly fieldCount: number; |
| 137 | + readonly name: MessageName; |
| 138 | + constructor(length: number, fields: any[]); |
| 139 | +} |
| 140 | +export declare class NoticeMessage implements BackendMessage, NoticeOrError { |
| 141 | + readonly length: number; |
| 142 | + readonly message: string | undefined; |
| 143 | + constructor(length: number, message: string | undefined); |
| 144 | + readonly name = "notice"; |
| 145 | + severity: string | undefined; |
| 146 | + code: string | undefined; |
| 147 | + detail: string | undefined; |
| 148 | + hint: string | undefined; |
| 149 | + position: string | undefined; |
| 150 | + internalPosition: string | undefined; |
| 151 | + internalQuery: string | undefined; |
| 152 | + where: string | undefined; |
| 153 | + schema: string | undefined; |
| 154 | + table: string | undefined; |
| 155 | + column: string | undefined; |
| 156 | + dataType: string | undefined; |
| 157 | + constraint: string | undefined; |
| 158 | + file: string | undefined; |
| 159 | + line: string | undefined; |
| 160 | + routine: string | undefined; |
| 161 | +} |
| 162 | +export {}; |
0 commit comments