postgrejs 3.12.0 → 3.12.2
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/README.md +1 -1
- package/connection/bind-param.d.ts +21 -0
- package/connection/bind-param.js +21 -0
- package/connection/connection.d.ts +136 -0
- package/connection/connection.js +132 -5
- package/connection/copy-stream.d.ts +2 -0
- package/connection/copy-stream.js +2 -0
- package/connection/cursor.d.ts +67 -5
- package/connection/cursor.js +88 -15
- package/connection/intl-connection.d.ts +14 -0
- package/connection/intl-connection.js +95 -15
- package/connection/large-object.d.ts +18 -0
- package/connection/large-object.js +17 -0
- package/connection/logical-replication.d.ts +15 -0
- package/connection/logical-replication.js +6 -0
- package/connection/pool.d.ts +80 -0
- package/connection/pool.js +82 -9
- package/connection/portal.d.ts +37 -0
- package/connection/portal.js +29 -0
- package/connection/prepared-statement.d.ts +68 -0
- package/connection/prepared-statement.js +71 -2
- package/constants.d.ts +18 -0
- package/constants.js +18 -0
- package/data-type-map.d.ts +38 -0
- package/data-type-map.js +38 -0
- package/data-types/bit-type.d.ts +4 -0
- package/data-types/bit-type.js +4 -0
- package/data-types/bool-type.d.ts +2 -0
- package/data-types/bool-type.js +2 -0
- package/data-types/box-type.d.ts +2 -0
- package/data-types/box-type.js +2 -0
- package/data-types/bytea-type.d.ts +2 -0
- package/data-types/bytea-type.js +2 -0
- package/data-types/char-type.d.ts +2 -0
- package/data-types/char-type.js +2 -0
- package/data-types/circle-type.d.ts +2 -0
- package/data-types/circle-type.js +2 -0
- package/data-types/date-type.d.ts +2 -0
- package/data-types/date-type.js +2 -0
- package/data-types/float4-type.d.ts +2 -0
- package/data-types/float4-type.js +2 -0
- package/data-types/float8-type.d.ts +2 -0
- package/data-types/float8-type.js +2 -0
- package/data-types/inet-type.d.ts +4 -0
- package/data-types/inet-type.js +4 -0
- package/data-types/int2-type.d.ts +2 -0
- package/data-types/int2-type.js +2 -0
- package/data-types/int2-vector-type.d.ts +2 -0
- package/data-types/int2-vector-type.js +2 -0
- package/data-types/int4-type.d.ts +2 -0
- package/data-types/int4-type.js +2 -0
- package/data-types/int8-type.d.ts +2 -0
- package/data-types/int8-type.js +2 -0
- package/data-types/interval-type.d.ts +9 -0
- package/data-types/interval-type.js +9 -0
- package/data-types/json-type.d.ts +2 -0
- package/data-types/json-type.js +2 -0
- package/data-types/jsonb-type.d.ts +2 -0
- package/data-types/jsonb-type.js +2 -0
- package/data-types/jsonpath-type.d.ts +2 -0
- package/data-types/jsonpath-type.js +2 -0
- package/data-types/line-type.d.ts +2 -0
- package/data-types/line-type.js +2 -0
- package/data-types/lseg-type.d.ts +2 -0
- package/data-types/lseg-type.js +2 -0
- package/data-types/macaddr-type.d.ts +4 -0
- package/data-types/macaddr-type.js +4 -0
- package/data-types/money-type.d.ts +1 -0
- package/data-types/money-type.js +17 -10
- package/data-types/numeric-type.d.ts +2 -0
- package/data-types/numeric-type.js +2 -0
- package/data-types/oid-type.d.ts +2 -0
- package/data-types/oid-type.js +2 -0
- package/data-types/oid-vector-type.d.ts +1 -0
- package/data-types/oid-vector-type.js +1 -0
- package/data-types/path-type.d.ts +4 -0
- package/data-types/path-type.js +4 -0
- package/data-types/pg-lsn-type.d.ts +2 -0
- package/data-types/pg-lsn-type.js +2 -0
- package/data-types/point-type.d.ts +2 -0
- package/data-types/point-type.js +2 -0
- package/data-types/range-type.d.ts +4 -0
- package/data-types/range-type.js +4 -0
- package/data-types/snapshot-type.d.ts +4 -0
- package/data-types/snapshot-type.js +4 -0
- package/data-types/tid-type.d.ts +2 -0
- package/data-types/tid-type.js +2 -0
- package/data-types/time-type.d.ts +2 -0
- package/data-types/time-type.js +2 -0
- package/data-types/timestamp-type.d.ts +2 -0
- package/data-types/timestamp-type.js +2 -0
- package/data-types/timestamptz-type.d.ts +2 -0
- package/data-types/timestamptz-type.js +2 -0
- package/data-types/timetz-type.d.ts +2 -0
- package/data-types/timetz-type.js +2 -0
- package/data-types/tsvector-type.d.ts +4 -0
- package/data-types/tsvector-type.js +4 -0
- package/data-types/uuid-type.d.ts +2 -0
- package/data-types/uuid-type.js +2 -0
- package/data-types/varchar-type.d.ts +2 -0
- package/data-types/varchar-type.js +2 -0
- package/data-types/xid-type.d.ts +6 -0
- package/data-types/xid-type.js +6 -0
- package/interfaces/command-result.d.ts +7 -0
- package/interfaces/copy-from-rows-options.d.ts +4 -0
- package/interfaces/data-mapping-options.d.ts +6 -0
- package/interfaces/data-type.d.ts +37 -0
- package/interfaces/database-connection-params.d.ts +31 -0
- package/interfaces/field-info.d.ts +8 -0
- package/interfaces/function-call-options.d.ts +1 -0
- package/interfaces/function-call-result.d.ts +6 -0
- package/interfaces/pipeline-request.d.ts +2 -0
- package/interfaces/query-options.d.ts +7 -0
- package/interfaces/query-result.d.ts +7 -0
- package/interfaces/script-execute-options.d.ts +4 -0
- package/interfaces/script-result.d.ts +1 -0
- package/interfaces/statement-prepare-options.d.ts +1 -0
- package/package.json +5 -5
- package/protocol/backend.d.ts +6 -0
- package/protocol/backend.js +35 -5
- package/protocol/cert-signature.d.ts +8 -0
- package/protocol/cert-signature.js +8 -0
- package/protocol/database-error.d.ts +8 -0
- package/protocol/database-error.js +8 -0
- package/protocol/frontend.d.ts +16 -0
- package/protocol/frontend.js +13 -6
- package/protocol/pg-socket.d.ts +10 -0
- package/protocol/pg-socket.js +14 -7
- package/protocol/pgoutput.d.ts +15 -0
- package/protocol/pgoutput.js +7 -0
- package/protocol/protocol.d.ts +50 -2
- package/protocol/protocol.js +17 -1
- package/protocol/sasl.d.ts +22 -0
- package/protocol/sasl.js +21 -0
- package/protocol/smart-buffer.d.ts +4 -0
- package/safe-event-emitter.d.ts +7 -0
- package/safe-event-emitter.js +7 -0
- package/types.d.ts +21 -0
- package/util/array-calculatedim.d.ts +10 -0
- package/util/array-calculatedim.js +10 -0
- package/util/bigint-methods.d.ts +7 -0
- package/util/bigint-methods.js +9 -0
- package/util/config-from-env.d.ts +10 -0
- package/util/config-from-env.js +10 -0
- package/util/connection-config.d.ts +17 -0
- package/util/connection-config.js +17 -0
- package/util/copy-from-rows.d.ts +12 -0
- package/util/copy-from-rows.js +9 -0
- package/util/decimal-as-string.d.ts +6 -0
- package/util/decimal-as-string.js +6 -0
- package/util/decode-binaryarray.d.ts +9 -0
- package/util/decode-binaryarray.js +9 -0
- package/util/escape-literal.d.ts +11 -0
- package/util/escape-literal.js +13 -0
- package/util/fast-parseint.d.ts +14 -0
- package/util/fast-parseint.js +14 -0
- package/util/format-datetime.d.ts +26 -0
- package/util/format-datetime.js +26 -0
- package/util/get-parsers.d.ts +9 -0
- package/util/get-parsers.js +9 -0
- package/util/hex-text.d.ts +13 -21
- package/util/hex-text.js +24 -21
- package/util/local-date.d.ts +2 -41
- package/util/local-date.js +39 -41
- package/util/parse-array.d.ts +8 -0
- package/util/parse-array.js +8 -0
- package/util/parse-bytea.d.ts +15 -0
- package/util/parse-bytea.js +15 -0
- package/util/parse-datetime.d.ts +26 -0
- package/util/parse-datetime.js +26 -0
- package/util/parse-row.d.ts +23 -2
- package/util/parse-row.js +56 -36
- package/util/parse-time.d.ts +10 -0
- package/util/parse-time.js +10 -0
- package/util/resolve-column-formats.d.ts +1 -0
- package/util/row-decoder.d.ts +32 -0
- package/util/row-decoder.js +22 -0
- package/util/stringify-arrayliteral.d.ts +33 -0
- package/util/stringify-arrayliteral.js +220 -20
- package/util/stringify-for-sql.d.ts +17 -0
- package/util/stringify-for-sql.js +17 -0
- package/util/wrap-row-description.d.ts +10 -0
- package/util/wrap-row-description.js +10 -0
- package/CHANGELOG.md +0 -1453
package/protocol/protocol.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire protocol itself: the message codes, the shapes each message
|
|
3
|
+
* carries, and the version numbers the handshake negotiates.
|
|
4
|
+
*
|
|
5
|
+
* These are PostgreSQL's own definitions, named as the documentation
|
|
6
|
+
* names them - nothing here is this client's invention, and a reader
|
|
7
|
+
* comparing it against the protocol pages should find the two line up.
|
|
8
|
+
*/
|
|
1
9
|
export declare namespace Protocol {
|
|
10
|
+
/** The protocol major version, which has been 3 since PostgreSQL 7.4. */
|
|
2
11
|
const VERSION_MAJOR = 3;
|
|
12
|
+
/** The minor version a connection asks for by default. */
|
|
3
13
|
const VERSION_MINOR = 0;
|
|
4
14
|
/**
|
|
5
15
|
* Minor version 3.2 (PostgreSQL 18+) differs from 3.0 only in that
|
|
@@ -11,6 +21,7 @@ export declare namespace Protocol {
|
|
|
11
21
|
* never a connection-breaking choice, only ever a possible no-op.
|
|
12
22
|
*/
|
|
13
23
|
const VERSION_MINOR_LONG_CANCEL_KEY = 2;
|
|
24
|
+
/** The first byte of each message the server sends. */
|
|
14
25
|
enum BackendMessageCode {
|
|
15
26
|
Authentication = 82,// R
|
|
16
27
|
BackendKeyData = 75,// K
|
|
@@ -37,6 +48,7 @@ export declare namespace Protocol {
|
|
|
37
48
|
ReadyForQuery = 90,// Z
|
|
38
49
|
RowDescription = 84
|
|
39
50
|
}
|
|
51
|
+
/** The first byte of each message the client sends. */
|
|
40
52
|
enum FrontendMessageCode {
|
|
41
53
|
Bind = 66,// B
|
|
42
54
|
Close = 67,// C
|
|
@@ -53,6 +65,7 @@ export declare namespace Protocol {
|
|
|
53
65
|
Sync = 83,// S
|
|
54
66
|
Terminate = 88
|
|
55
67
|
}
|
|
68
|
+
/** Which authentication the server asked for, by name rather than by its number. */
|
|
56
69
|
enum AuthenticationMessageKind {
|
|
57
70
|
KerberosV5 = "KerberosV5",
|
|
58
71
|
CleartextPassword = "CleartextPassword",
|
|
@@ -65,48 +78,64 @@ export declare namespace Protocol {
|
|
|
65
78
|
SASLContinue = "SASLContinue",
|
|
66
79
|
SASLFinal = "SASLFinal"
|
|
67
80
|
}
|
|
81
|
+
/** How a value travels: as the text the server prints, or in its binary form. */
|
|
68
82
|
enum DataFormat {
|
|
83
|
+
/** The type's own text, as `::text` would render it. */
|
|
69
84
|
text = 0,
|
|
85
|
+
/** The type's binary form - fewer bytes, and no text to parse. */
|
|
70
86
|
binary = 1
|
|
71
87
|
}
|
|
88
|
+
/** What every Authentication message carries: which kind it is. */
|
|
72
89
|
interface AuthenticationRequiredMessage {
|
|
90
|
+
/** The authentication the server is asking for. */
|
|
73
91
|
kind: AuthenticationMessageKind;
|
|
74
92
|
}
|
|
93
|
+
/** Kerberos V5 authentication is required - not implemented by this client, nor by any modern server. */
|
|
75
94
|
interface AuthenticationKerberosV5Message extends AuthenticationRequiredMessage {
|
|
76
95
|
kind: AuthenticationMessageKind.KerberosV5;
|
|
77
96
|
}
|
|
97
|
+
/** The server wants the password as it is, which only a trusted transport should be asked for. */
|
|
78
98
|
interface AuthenticationCleartextPasswordMessage extends AuthenticationRequiredMessage {
|
|
79
99
|
kind: AuthenticationMessageKind.CleartextPassword;
|
|
80
100
|
}
|
|
101
|
+
/** The server wants the password MD5-hashed with the salt it sent. */
|
|
81
102
|
interface AuthenticationMD5PasswordMessage extends AuthenticationRequiredMessage {
|
|
82
103
|
kind: AuthenticationMessageKind.MD5Password;
|
|
83
104
|
salt: Buffer;
|
|
84
105
|
}
|
|
106
|
+
/** SCM credential authentication, which only ever applied to some unix sockets. */
|
|
85
107
|
interface AuthenticationSCMCredentialMessage extends AuthenticationRequiredMessage {
|
|
86
108
|
kind: AuthenticationMessageKind.SCMCredential;
|
|
87
109
|
}
|
|
110
|
+
/** GSSAPI authentication is required. */
|
|
88
111
|
interface AuthenticationGSSMessage extends AuthenticationRequiredMessage {
|
|
89
112
|
kind: AuthenticationMessageKind.GSS;
|
|
90
113
|
}
|
|
114
|
+
/** SSPI authentication is required - the Windows spelling of GSSAPI. */
|
|
91
115
|
interface AuthenticationSSPIMessage extends AuthenticationRequiredMessage {
|
|
92
116
|
kind: AuthenticationMessageKind.SSPI;
|
|
93
117
|
}
|
|
118
|
+
/** One more round of GSSAPI/SSPI data. */
|
|
94
119
|
interface AuthenticationGSSContinueMessage extends AuthenticationRequiredMessage {
|
|
95
120
|
kind: AuthenticationMessageKind.GSSContinue;
|
|
96
121
|
data: Buffer;
|
|
97
122
|
}
|
|
123
|
+
/** SASL authentication is required; the message names which mechanisms the server offers. */
|
|
98
124
|
interface AuthenticationSASLMessage extends AuthenticationRequiredMessage {
|
|
99
125
|
kind: AuthenticationMessageKind.SASL;
|
|
100
126
|
mechanisms: string[];
|
|
101
127
|
}
|
|
128
|
+
/** The server's half of the SCRAM exchange in progress. */
|
|
102
129
|
interface AuthenticationSASLContinueMessage extends AuthenticationRequiredMessage {
|
|
103
130
|
kind: AuthenticationMessageKind.SASLContinue;
|
|
104
131
|
data: string;
|
|
105
132
|
}
|
|
133
|
+
/** The server's final SCRAM message, which proves it knew the password too. */
|
|
106
134
|
interface AuthenticationSASLFinalMessage extends AuthenticationRequiredMessage {
|
|
107
135
|
kind: AuthenticationMessageKind.SASLFinal;
|
|
108
136
|
data: string;
|
|
109
137
|
}
|
|
138
|
+
/** The process id and secret key a cancel request has to carry, sent once at startup. */
|
|
110
139
|
interface BackendKeyDataMessage {
|
|
111
140
|
processID: number;
|
|
112
141
|
/**
|
|
@@ -118,25 +147,36 @@ export declare namespace Protocol {
|
|
|
118
147
|
*/
|
|
119
148
|
secretKey: Buffer;
|
|
120
149
|
}
|
|
150
|
+
/** One statement finished: its tag, and what the tag reports. */
|
|
121
151
|
interface CommandCompleteMessage {
|
|
122
152
|
command: string;
|
|
123
153
|
oid?: number;
|
|
124
154
|
rowCount?: number;
|
|
125
155
|
}
|
|
156
|
+
/** One chunk of a copy in either direction. */
|
|
126
157
|
interface CopyDataMessage {
|
|
127
158
|
data: Buffer;
|
|
128
159
|
}
|
|
160
|
+
/** A copy is starting: which format it is in, and per column. */
|
|
129
161
|
interface CopyResponseMessage {
|
|
130
162
|
overallFormat: DataFormat;
|
|
131
163
|
columnCount: number;
|
|
132
164
|
columnFormats?: DataFormat[];
|
|
133
165
|
}
|
|
166
|
+
/** The DataRow message body, kept for its name; `DataRowMessage` is the shape actually used. */
|
|
134
167
|
interface DataRow {
|
|
135
168
|
}
|
|
169
|
+
/** One row, still as the bytes it arrived in - the values are read out of `data` by the column parsers. */
|
|
136
170
|
interface DataRowMessage {
|
|
137
171
|
columnCount: number;
|
|
138
|
-
|
|
139
|
-
|
|
172
|
+
/** The read buffer the row's values sit in. */
|
|
173
|
+
buffer: Buffer;
|
|
174
|
+
/** Where they start in it. */
|
|
175
|
+
offset: number;
|
|
176
|
+
/** How many bytes they run for. */
|
|
177
|
+
len: number;
|
|
178
|
+
}
|
|
179
|
+
/** An error or a notice, with every field the server chose to send. `code` is the SQLSTATE and is the part to branch on. */
|
|
140
180
|
interface ErrorResponseMessage {
|
|
141
181
|
severity?: string;
|
|
142
182
|
code?: string;
|
|
@@ -156,15 +196,18 @@ export declare namespace Protocol {
|
|
|
156
196
|
line?: string;
|
|
157
197
|
routine?: string;
|
|
158
198
|
}
|
|
199
|
+
/** A `NOTIFY` arriving: which channel, what payload, and which backend sent it. */
|
|
159
200
|
interface NotificationResponseMessage {
|
|
160
201
|
processId: number;
|
|
161
202
|
channel: string;
|
|
162
203
|
payload: string;
|
|
163
204
|
}
|
|
205
|
+
/** A fast-path function's return value, undecoded - the protocol says nothing about its type. */
|
|
164
206
|
interface FunctionCallResponseMessage {
|
|
165
207
|
/** `null` when the function returned SQL NULL. */
|
|
166
208
|
result: Buffer | null;
|
|
167
209
|
}
|
|
210
|
+
/** The server does not speak the minor version that was asked for, and names the highest it does. */
|
|
168
211
|
interface NegotiateProtocolVersionMessage {
|
|
169
212
|
/** Newest minor protocol version the server supports. */
|
|
170
213
|
supportedVersionMinor: number;
|
|
@@ -175,17 +218,21 @@ export declare namespace Protocol {
|
|
|
175
218
|
*/
|
|
176
219
|
unrecognizedOptions: string[];
|
|
177
220
|
}
|
|
221
|
+
/** What the server resolved each parameter of a prepared statement to. */
|
|
178
222
|
interface ParameterDescriptionMessage {
|
|
179
223
|
parameterCount: number;
|
|
180
224
|
parameterIds: number[];
|
|
181
225
|
}
|
|
226
|
+
/** A session setting the server reports, at startup and whenever it changes. */
|
|
182
227
|
interface ParameterStatusMessage {
|
|
183
228
|
name: string;
|
|
184
229
|
value: string;
|
|
185
230
|
}
|
|
231
|
+
/** The server is ready for the next statement, and says whether a transaction is open. */
|
|
186
232
|
interface ReadyForQueryMessage {
|
|
187
233
|
status: string;
|
|
188
234
|
}
|
|
235
|
+
/** One column of a result, as the server describes it. */
|
|
189
236
|
interface RowDescription {
|
|
190
237
|
fieldName: string;
|
|
191
238
|
tableId: number;
|
|
@@ -195,6 +242,7 @@ export declare namespace Protocol {
|
|
|
195
242
|
modifier?: number;
|
|
196
243
|
format: DataFormat;
|
|
197
244
|
}
|
|
245
|
+
/** The columns a statement will return, sent before its rows. */
|
|
198
246
|
interface RowDescriptionMessage {
|
|
199
247
|
fields: RowDescription[];
|
|
200
248
|
}
|
package/protocol/protocol.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire protocol itself: the message codes, the shapes each message
|
|
3
|
+
* carries, and the version numbers the handshake negotiates.
|
|
4
|
+
*
|
|
5
|
+
* These are PostgreSQL's own definitions, named as the documentation
|
|
6
|
+
* names them - nothing here is this client's invention, and a reader
|
|
7
|
+
* comparing it against the protocol pages should find the two line up.
|
|
8
|
+
*/
|
|
1
9
|
export var Protocol;
|
|
2
10
|
(function (Protocol) {
|
|
11
|
+
/** The protocol major version, which has been 3 since PostgreSQL 7.4. */
|
|
3
12
|
Protocol.VERSION_MAJOR = 3;
|
|
13
|
+
/** The minor version a connection asks for by default. */
|
|
4
14
|
Protocol.VERSION_MINOR = 0;
|
|
5
15
|
/**
|
|
6
16
|
* Minor version 3.2 (PostgreSQL 18+) differs from 3.0 only in that
|
|
@@ -12,7 +22,8 @@ export var Protocol;
|
|
|
12
22
|
* never a connection-breaking choice, only ever a possible no-op.
|
|
13
23
|
*/
|
|
14
24
|
Protocol.VERSION_MINOR_LONG_CANCEL_KEY = 2;
|
|
15
|
-
|
|
25
|
+
/** The first byte of each message the server sends. */
|
|
26
|
+
/* https://www.postgresql.org/docs/9.3/protocol-message-formats.html */
|
|
16
27
|
let BackendMessageCode;
|
|
17
28
|
(function (BackendMessageCode) {
|
|
18
29
|
BackendMessageCode[BackendMessageCode["Authentication"] = 82] = "Authentication";
|
|
@@ -40,6 +51,7 @@ export var Protocol;
|
|
|
40
51
|
BackendMessageCode[BackendMessageCode["ReadyForQuery"] = 90] = "ReadyForQuery";
|
|
41
52
|
BackendMessageCode[BackendMessageCode["RowDescription"] = 84] = "RowDescription";
|
|
42
53
|
})(BackendMessageCode = Protocol.BackendMessageCode || (Protocol.BackendMessageCode = {}));
|
|
54
|
+
/** The first byte of each message the client sends. */
|
|
43
55
|
let FrontendMessageCode;
|
|
44
56
|
(function (FrontendMessageCode) {
|
|
45
57
|
FrontendMessageCode[FrontendMessageCode["Bind"] = 66] = "Bind";
|
|
@@ -57,6 +69,7 @@ export var Protocol;
|
|
|
57
69
|
FrontendMessageCode[FrontendMessageCode["Sync"] = 83] = "Sync";
|
|
58
70
|
FrontendMessageCode[FrontendMessageCode["Terminate"] = 88] = "Terminate";
|
|
59
71
|
})(FrontendMessageCode = Protocol.FrontendMessageCode || (Protocol.FrontendMessageCode = {}));
|
|
72
|
+
/** Which authentication the server asked for, by name rather than by its number. */
|
|
60
73
|
let AuthenticationMessageKind;
|
|
61
74
|
(function (AuthenticationMessageKind) {
|
|
62
75
|
AuthenticationMessageKind["KerberosV5"] = "KerberosV5";
|
|
@@ -70,9 +83,12 @@ export var Protocol;
|
|
|
70
83
|
AuthenticationMessageKind["SASLContinue"] = "SASLContinue";
|
|
71
84
|
AuthenticationMessageKind["SASLFinal"] = "SASLFinal";
|
|
72
85
|
})(AuthenticationMessageKind = Protocol.AuthenticationMessageKind || (Protocol.AuthenticationMessageKind = {}));
|
|
86
|
+
/** How a value travels: as the text the server prints, or in its binary form. */
|
|
73
87
|
let DataFormat;
|
|
74
88
|
(function (DataFormat) {
|
|
89
|
+
/** The type's own text, as `::text` would render it. */
|
|
75
90
|
DataFormat[DataFormat["text"] = 0] = "text";
|
|
91
|
+
/** The type's binary form - fewer bytes, and no text to parse. */
|
|
76
92
|
DataFormat[DataFormat["binary"] = 1] = "binary";
|
|
77
93
|
})(DataFormat = Protocol.DataFormat || (Protocol.DataFormat = {}));
|
|
78
94
|
})(Protocol || (Protocol = {}));
|
package/protocol/sasl.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SCRAM-SHA-256, and the channel binding that ties it to the TLS
|
|
3
|
+
* connection underneath.
|
|
4
|
+
*/
|
|
1
5
|
export declare namespace SASL {
|
|
6
|
+
/** One exchange in progress: what was sent, and what is needed to check the reply. */
|
|
2
7
|
interface Session {
|
|
3
8
|
username: string;
|
|
4
9
|
mechanism: string;
|
|
@@ -18,6 +23,23 @@ export declare namespace SASL {
|
|
|
18
23
|
* is what tells the server a stripped -PLUS offer would be an attack.
|
|
19
24
|
*/
|
|
20
25
|
function createSession(username: string, mechanism: string, bindingData?: Buffer, supportsBinding?: boolean): Session;
|
|
26
|
+
/**
|
|
27
|
+
* Answers the server's first SCRAM message.
|
|
28
|
+
*
|
|
29
|
+
* @param session The session started for this connection.
|
|
30
|
+
* @param password The password to prove knowledge of.
|
|
31
|
+
* @param serverData The server's message.
|
|
32
|
+
* @param channelBinding The binding data, when the mechanism uses it.
|
|
33
|
+
*/
|
|
21
34
|
function continueSession(session: Session, password: string, data: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Checks the server's final message, which is what proves the server
|
|
37
|
+
* knew the password too.
|
|
38
|
+
*
|
|
39
|
+
* @param session The session in progress.
|
|
40
|
+
* @param data The server's final message.
|
|
41
|
+
* @throws Error When the signature does not match, meaning the server
|
|
42
|
+
* is not the one it claims to be.
|
|
43
|
+
*/
|
|
22
44
|
function finalizeSession(session: Session, data: string): void;
|
|
23
45
|
}
|
package/protocol/sasl.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import crypto from 'crypto';
|
|
2
|
+
/**
|
|
3
|
+
* SCRAM-SHA-256, and the channel binding that ties it to the TLS
|
|
4
|
+
* connection underneath.
|
|
5
|
+
*/
|
|
2
6
|
export var SASL;
|
|
3
7
|
(function (SASL) {
|
|
4
8
|
const CLIENT_KEY = 'Client Key';
|
|
@@ -37,6 +41,14 @@ export var SASL;
|
|
|
37
41
|
};
|
|
38
42
|
}
|
|
39
43
|
SASL.createSession = createSession;
|
|
44
|
+
/**
|
|
45
|
+
* Answers the server's first SCRAM message.
|
|
46
|
+
*
|
|
47
|
+
* @param session The session started for this connection.
|
|
48
|
+
* @param password The password to prove knowledge of.
|
|
49
|
+
* @param serverData The server's message.
|
|
50
|
+
* @param channelBinding The binding data, when the mechanism uses it.
|
|
51
|
+
*/
|
|
40
52
|
function continueSession(session, password, data) {
|
|
41
53
|
const s = data.toString();
|
|
42
54
|
const items = s.split(',');
|
|
@@ -91,6 +103,15 @@ export var SASL;
|
|
|
91
103
|
clientFinalMessageWithoutProof + ',p=' + clientProof;
|
|
92
104
|
}
|
|
93
105
|
SASL.continueSession = continueSession;
|
|
106
|
+
/**
|
|
107
|
+
* Checks the server's final message, which is what proves the server
|
|
108
|
+
* knew the password too.
|
|
109
|
+
*
|
|
110
|
+
* @param session The session in progress.
|
|
111
|
+
* @param data The server's final message.
|
|
112
|
+
* @throws Error When the signature does not match, meaning the server
|
|
113
|
+
* is not the one it claims to be.
|
|
114
|
+
*/
|
|
94
115
|
function finalizeSession(session, data) {
|
|
95
116
|
let serverSignature = '';
|
|
96
117
|
const arr = data.split(',');
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { FlexyBuffer } from 'flexy-buffer';
|
|
2
|
+
/** How a `SmartBuffer` grows, how far, and when it gives the pages back. */
|
|
2
3
|
export interface SmartBufferConfig {
|
|
4
|
+
/** Bytes added at a time when it has to grow. */
|
|
3
5
|
pageSize?: number;
|
|
6
|
+
/** The most it may ever hold. */
|
|
4
7
|
maxLength?: number;
|
|
8
|
+
/** Idle milliseconds before the grown capacity is released. */
|
|
5
9
|
houseKeepMs?: number;
|
|
6
10
|
}
|
|
7
11
|
/**
|
package/safe-event-emitter.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
+
/**
|
|
3
|
+
* An `EventEmitter` whose listeners cannot take the process down.
|
|
4
|
+
*
|
|
5
|
+
* A listener that throws would otherwise escape into whatever was
|
|
6
|
+
* emitting - the socket's own data handler, more often than not - and
|
|
7
|
+
* an `error` event with nobody listening would throw by definition.
|
|
8
|
+
*/
|
|
2
9
|
export declare class SafeEventEmitter extends EventEmitter {
|
|
3
10
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
4
11
|
}
|
package/safe-event-emitter.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
+
/**
|
|
3
|
+
* An `EventEmitter` whose listeners cannot take the process down.
|
|
4
|
+
*
|
|
5
|
+
* A listener that throws would otherwise escape into whatever was
|
|
6
|
+
* emitting - the socket's own data handler, more often than not - and
|
|
7
|
+
* an `error` event with nobody listening would throw by definition.
|
|
8
|
+
*/
|
|
2
9
|
export class SafeEventEmitter extends EventEmitter {
|
|
3
10
|
emit(event, ...args) {
|
|
4
11
|
try {
|
package/types.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { DataMappingOptions } from './interfaces/data-mapping-options.js';
|
|
2
2
|
import type { SmartBuffer } from './protocol/smart-buffer.js';
|
|
3
|
+
/** A PostgreSQL type identifier, as `pg_type.oid` gives it. */
|
|
3
4
|
export type OID = number;
|
|
5
|
+
/** `T`, or nothing. */
|
|
4
6
|
export type Maybe<T> = T | undefined;
|
|
7
|
+
/** `T`, or SQL NULL. */
|
|
5
8
|
export type Nullable<T> = T | null;
|
|
9
|
+
/** One decoded row - an array, an object, or whatever a custom decoder returns. */
|
|
6
10
|
export type Row = any;
|
|
11
|
+
/** The node-style callback the stream-facing methods accept. */
|
|
7
12
|
export type Callback = (err?: Error | null) => void;
|
|
8
13
|
/**
|
|
9
14
|
* What a DataType's own `decodeBinary` implements. `buf` is a shared
|
|
@@ -18,12 +23,28 @@ export type Callback = (err?: Error | null) => void;
|
|
|
18
23
|
* end of the buffer" must not.
|
|
19
24
|
*/
|
|
20
25
|
export type DecodeBinaryFunction = (buf: Buffer, offset: number, len: number, options: DataMappingOptions & Record<string, any>) => any;
|
|
26
|
+
/**
|
|
27
|
+
* What a DataType's own `decodeTextBuffer` implements: the same value
|
|
28
|
+
* `decodeText` would be given, still as bytes in the shared row buffer.
|
|
29
|
+
*/
|
|
21
30
|
export type DecodeTextBufferFunction = (buf: Buffer, offset: number, len: number, options: DataMappingOptions & Record<string, any>) => any;
|
|
31
|
+
/** What a DataType's own `encodeBinary` implements: writes the value into the send buffer. */
|
|
22
32
|
export type EncodeBinaryFunction = (buf: SmartBuffer, v: any, options: DataMappingOptions) => void;
|
|
33
|
+
/** Measures an array's dimensions, for a type whose own values are arrays. */
|
|
23
34
|
export type EncodeCalculateDimFunction = (v: any[]) => number[];
|
|
35
|
+
/** Whether this value should go out as SQL NULL instead of being encoded. */
|
|
24
36
|
export type EncodeAsNullFunction = (v: any, options: DataMappingOptions) => boolean;
|
|
37
|
+
/** What a DataType's own `decodeText` implements: reads the value out of the server's text. */
|
|
25
38
|
export type DecodeTextFunction = (v: any, options: DataMappingOptions) => any;
|
|
39
|
+
/** What a DataType's own `encodeText` implements: renders the value as text the server parses. */
|
|
26
40
|
export type EncodeTextFunction = (v: any, options: DataMappingOptions) => string;
|
|
41
|
+
/**
|
|
42
|
+
* One column's parser, already chosen for the format that column arrives
|
|
43
|
+
* in: called with the whole row's buffer and where this value sits in
|
|
44
|
+
* it.
|
|
45
|
+
*/
|
|
27
46
|
export type ResolvedColumnParser = (data: Buffer, offset: number, len: number, options: DataMappingOptions & Record<string, any>) => any;
|
|
47
|
+
/** Any of the decode functions, which all share the column parser's shape. */
|
|
28
48
|
export type AnyParseFunction = ResolvedColumnParser;
|
|
49
|
+
/** What `debugLogger` is called with - a namespace, then `util.format` arguments. */
|
|
29
50
|
export type DebugLogger = (namespace: string, format: any, ...args: any[]) => void;
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dimensions of a nested array, each level sized to its longest row.
|
|
3
|
+
*
|
|
4
|
+
* PostgreSQL arrays are rectangular: every row of a level has the same
|
|
5
|
+
* length. A ragged JavaScript array is squared off against these numbers
|
|
6
|
+
* by the writers, with the missing elements written as NULL.
|
|
7
|
+
*
|
|
8
|
+
* @param arr The array to measure.
|
|
9
|
+
* @returns One length per level; `[0]` for an empty array.
|
|
10
|
+
*/
|
|
1
11
|
export declare function arrayCalculateDim(arr: any[]): number[];
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dimensions of a nested array, each level sized to its longest row.
|
|
3
|
+
*
|
|
4
|
+
* PostgreSQL arrays are rectangular: every row of a level has the same
|
|
5
|
+
* length. A ragged JavaScript array is squared off against these numbers
|
|
6
|
+
* by the writers, with the missing elements written as NULL.
|
|
7
|
+
*
|
|
8
|
+
* @param arr The array to measure.
|
|
9
|
+
* @returns One length per level; `[0]` for an empty array.
|
|
10
|
+
*/
|
|
1
11
|
export function arrayCalculateDim(arr) {
|
|
2
12
|
if (!arr || arr.length === 0)
|
|
3
13
|
return [0];
|
package/util/bigint-methods.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Buffer.readBigInt64BE` for a runtime that does not have it.
|
|
3
|
+
*
|
|
4
|
+
* @param buf The buffer to read from.
|
|
5
|
+
* @param offset Where the eight bytes start.
|
|
6
|
+
* @returns The signed 64-bit value.
|
|
7
|
+
*/
|
|
1
8
|
export declare function readBigInt64BE(buf: Buffer, offset?: number): bigint;
|
package/util/bigint-methods.js
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
const big0 = BigInt(0);
|
|
3
3
|
const big32 = BigInt(32);
|
|
4
4
|
// https://github.com/nodejs/node/blob/v13.9.0/lib/internal/buffer.js
|
|
5
|
+
/**
|
|
6
|
+
* `Buffer.readBigInt64BE` for a runtime that does not have it.
|
|
7
|
+
*
|
|
8
|
+
* @param buf The buffer to read from.
|
|
9
|
+
* @param offset Where the eight bytes start.
|
|
10
|
+
* @returns The signed 64-bit value.
|
|
11
|
+
*/
|
|
12
|
+
/* Ported from Node's own lib/internal/buffer.js (v13.9.0), so the two
|
|
13
|
+
agree bit for bit where both exist. */
|
|
5
14
|
export function readBigInt64BE(buf, offset = 0) {
|
|
6
15
|
const first = buf[offset];
|
|
7
16
|
const last = buf[offset + 7];
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
|
|
2
|
+
/**
|
|
3
|
+
* What the environment says about where to connect.
|
|
4
|
+
*
|
|
5
|
+
* The variables `psql` itself reads - `PGHOST`, `PGPORT`, `PGUSER`,
|
|
6
|
+
* `PGPASSWORD`, `PGDATABASE` and the rest - so a program configured for
|
|
7
|
+
* one is configured for the other.
|
|
8
|
+
*
|
|
9
|
+
* @returns Whatever the environment named; anything it did not is left
|
|
10
|
+
* out rather than defaulted here.
|
|
11
|
+
*/
|
|
2
12
|
export declare function configFromEnv(): ConnectionConfiguration;
|
package/util/config-from-env.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { toInt, toIntDef } from 'putil-varhelpers';
|
|
2
|
+
/**
|
|
3
|
+
* What the environment says about where to connect.
|
|
4
|
+
*
|
|
5
|
+
* The variables `psql` itself reads - `PGHOST`, `PGPORT`, `PGUSER`,
|
|
6
|
+
* `PGPASSWORD`, `PGDATABASE` and the rest - so a program configured for
|
|
7
|
+
* one is configured for the other.
|
|
8
|
+
*
|
|
9
|
+
* @returns Whatever the environment named; anything it did not is left
|
|
10
|
+
* out rather than defaulted here.
|
|
11
|
+
*/
|
|
2
12
|
export function configFromEnv() {
|
|
3
13
|
const env = process.env;
|
|
4
14
|
const result = {};
|
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
import type { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves what a caller passed into the configuration a connection is
|
|
4
|
+
* opened with.
|
|
5
|
+
*
|
|
6
|
+
* @param config An object, a connection string, or nothing at all.
|
|
7
|
+
* @returns The configuration, with the environment and PostgreSQL's own
|
|
8
|
+
* defaults filling what was left out.
|
|
9
|
+
* @throws Error When a field is named that no configuration has, which
|
|
10
|
+
* is usually a typo and is reported with what was probably meant.
|
|
11
|
+
*/
|
|
2
12
|
export declare function getConnectionConfig(config?: ConnectionConfiguration | string): ConnectionConfiguration;
|
|
13
|
+
/**
|
|
14
|
+
* Reads a `postgres://` URL, or the `host=... port=...` keyword form,
|
|
15
|
+
* into a configuration.
|
|
16
|
+
*
|
|
17
|
+
* @param str The connection string.
|
|
18
|
+
* @returns What it named.
|
|
19
|
+
*/
|
|
3
20
|
export declare function parseConnectionString(str: string): ConnectionConfiguration;
|
|
@@ -39,6 +39,16 @@ function checkForeignKeys(config) {
|
|
|
39
39
|
'name that is nearly right does nothing and says nothing.');
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Resolves what a caller passed into the configuration a connection is
|
|
44
|
+
* opened with.
|
|
45
|
+
*
|
|
46
|
+
* @param config An object, a connection string, or nothing at all.
|
|
47
|
+
* @returns The configuration, with the environment and PostgreSQL's own
|
|
48
|
+
* defaults filling what was left out.
|
|
49
|
+
* @throws Error When a field is named that no configuration has, which
|
|
50
|
+
* is usually a typo and is reported with what was probably meant.
|
|
51
|
+
*/
|
|
42
52
|
export function getConnectionConfig(config) {
|
|
43
53
|
const cfg = configFromEnv();
|
|
44
54
|
if (typeof config === 'string') {
|
|
@@ -125,6 +135,13 @@ function splitHosts(value, fallbackPort) {
|
|
|
125
135
|
* has been accepted for longer than either and stays.
|
|
126
136
|
*/
|
|
127
137
|
const DATABASE_PATH_SCHEMES = ['pg:', 'postgres:', 'postgresql:'];
|
|
138
|
+
/**
|
|
139
|
+
* Reads a `postgres://` URL, or the `host=... port=...` keyword form,
|
|
140
|
+
* into a configuration.
|
|
141
|
+
*
|
|
142
|
+
* @param str The connection string.
|
|
143
|
+
* @returns What it named.
|
|
144
|
+
*/
|
|
128
145
|
export function parseConnectionString(str) {
|
|
129
146
|
if (str.startsWith('/'))
|
|
130
147
|
str = 'socket:/' + str;
|
package/util/copy-from-rows.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import type { CopyFromRowsOptions } from '../interfaces/copy-from-rows-options.j
|
|
|
3
3
|
import type { OID } from '../types.js';
|
|
4
4
|
/** Default bytes accumulated before a CopyData message goes out. */
|
|
5
5
|
export declare const DEFAULT_COPY_CHUNK_SIZE: number;
|
|
6
|
+
/** One row to copy: values in column order, or keyed by column name. */
|
|
6
7
|
export type CopyRow = any[] | Record<string, any>;
|
|
8
|
+
/** Where `copyFromRows()` takes its rows from - an array, an iterable, an async one, or a stream. */
|
|
7
9
|
export type CopyRowSource = Iterable<CopyRow> | AsyncIterable<CopyRow> | Readable;
|
|
8
10
|
/**
|
|
9
11
|
* Quotes a possibly schema-qualified name. A single dot separates schema
|
|
@@ -21,7 +23,17 @@ export declare function quoteQualifiedName(name: string): string;
|
|
|
21
23
|
* name here could only approximate.
|
|
22
24
|
*/
|
|
23
25
|
export declare function buildProbeSql(table: string, columns?: string[]): string;
|
|
26
|
+
/**
|
|
27
|
+
* Writes the `COPY ... FROM STDIN (FORMAT binary)` the rows will be sent
|
|
28
|
+
* under.
|
|
29
|
+
*
|
|
30
|
+
* @param table The destination, optionally schema-qualified.
|
|
31
|
+
* @param columns Which columns the rows line up with; all of them when
|
|
32
|
+
* absent.
|
|
33
|
+
* @returns The statement.
|
|
34
|
+
*/
|
|
24
35
|
export declare function buildCopySql(table: string, columns?: string[]): string;
|
|
36
|
+
/** What a copy in flight needs to keep between its chunks. */
|
|
25
37
|
export interface CopyFromRowsContext {
|
|
26
38
|
columns: string[];
|
|
27
39
|
dataTypeIds: OID[];
|
package/util/copy-from-rows.js
CHANGED
|
@@ -30,6 +30,15 @@ export function buildProbeSql(table, columns) {
|
|
|
30
30
|
const cols = columns?.length ? columns.map(escapeIdentifier).join(', ') : '*';
|
|
31
31
|
return `select ${cols} from ${quoteQualifiedName(table)} where false`;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Writes the `COPY ... FROM STDIN (FORMAT binary)` the rows will be sent
|
|
35
|
+
* under.
|
|
36
|
+
*
|
|
37
|
+
* @param table The destination, optionally schema-qualified.
|
|
38
|
+
* @param columns Which columns the rows line up with; all of them when
|
|
39
|
+
* absent.
|
|
40
|
+
* @returns The statement.
|
|
41
|
+
*/
|
|
33
42
|
export function buildCopySql(table, columns) {
|
|
34
43
|
const cols = columns?.length
|
|
35
44
|
? ' (' + columns.map(escapeIdentifier).join(', ') + ')'
|
|
@@ -8,4 +8,10 @@ import type { Maybe, OID } from '../types.js';
|
|
|
8
8
|
export declare const DecimalAsStringOIDs: readonly OID[];
|
|
9
9
|
/** Whether this type's values are wanted as their exact decimal string. */
|
|
10
10
|
export declare function wantsDecimalString(options: Maybe<DataMappingOptions>, oid: OID): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Refuses a `decimalAsString` that names a type it cannot apply to.
|
|
13
|
+
*
|
|
14
|
+
* @param v The option as the caller wrote it.
|
|
15
|
+
* @throws TypeError When it names an OID outside the decimal types.
|
|
16
|
+
*/
|
|
11
17
|
export declare function validateDecimalAsString(v: Maybe<boolean | OID[]>): void;
|
|
@@ -15,6 +15,12 @@ export function wantsDecimalString(options, oid) {
|
|
|
15
15
|
return false;
|
|
16
16
|
return v === true || v.includes(oid);
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Refuses a `decimalAsString` that names a type it cannot apply to.
|
|
20
|
+
*
|
|
21
|
+
* @param v The option as the caller wrote it.
|
|
22
|
+
* @throws TypeError When it names an OID outside the decimal types.
|
|
23
|
+
*/
|
|
18
24
|
export function validateDecimalAsString(v) {
|
|
19
25
|
if (v === undefined || typeof v === 'boolean')
|
|
20
26
|
return;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import type { DataMappingOptions } from '../interfaces/data-mapping-options.js';
|
|
2
2
|
import type { DecodeBinaryFunction, Nullable } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Reads an array out of the binary wire format, nested to whatever depth
|
|
5
|
+
* it declares.
|
|
6
|
+
*
|
|
7
|
+
* @param buf The value's own bytes.
|
|
8
|
+
* @param decode The element type's binary decoder.
|
|
9
|
+
* @param options Passed to it.
|
|
10
|
+
* @returns The array, with SQL NULLs as `null`.
|
|
11
|
+
*/
|
|
3
12
|
export declare function decodeBinaryArray<T = any>(buf: Buffer, offset: number, decoder: DecodeBinaryFunction, options?: DataMappingOptions): Nullable<T[]>;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { BufferReader } from '../protocol/buffer-reader.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reads an array out of the binary wire format, nested to whatever depth
|
|
4
|
+
* it declares.
|
|
5
|
+
*
|
|
6
|
+
* @param buf The value's own bytes.
|
|
7
|
+
* @param decode The element type's binary decoder.
|
|
8
|
+
* @param options Passed to it.
|
|
9
|
+
* @returns The array, with SQL NULLs as `null`.
|
|
10
|
+
*/
|
|
2
11
|
export function decodeBinaryArray(buf, offset, decoder, options = {}) {
|
|
3
12
|
if (!buf.length)
|
|
4
13
|
return null;
|
package/util/escape-literal.d.ts
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quotes a string as an SQL literal, escaping what has to be escaped.
|
|
3
|
+
*
|
|
4
|
+
* For the `sql` tag and anything else that has to put a value into the
|
|
5
|
+
* statement text; a parameter never needs this.
|
|
6
|
+
*
|
|
7
|
+
* @param str The value to quote.
|
|
8
|
+
* @returns The quoted literal, `E`-prefixed when it carries a backslash.
|
|
9
|
+
* @throws Error When the string holds a NUL byte, which PostgreSQL text
|
|
10
|
+
* cannot.
|
|
11
|
+
*/
|
|
1
12
|
export declare function escapeLiteral(str: string): string;
|