@powersync/service-jpgwire 0.21.8 → 0.21.9
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/dist/legacy_pgwire_types.d.ts +289 -0
- package/dist/legacy_pgwire_types.js +4 -0
- package/dist/legacy_pgwire_types.js.map +1 -0
- package/dist/pgwire.d.ts +5 -4
- package/dist/pgwire.js +4 -7
- package/dist/pgwire.js.map +1 -1
- package/dist/pgwire_node.js +7 -26
- package/dist/pgwire_node.js.map +1 -1
- package/dist/pgwire_types.d.ts +3 -2
- package/dist/pgwire_types.js +10 -2
- package/dist/pgwire_types.js.map +1 -1
- package/dist/socket_adapter.d.ts +1 -1
- package/dist/socket_adapter.js +2 -2
- package/dist/socket_adapter.js.map +1 -1
- package/dist/util.js +62 -46
- package/dist/util.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
export declare function pgconnect(...optionsChain: PgConnectOptions[]): Promise<PgConnection>;
|
|
2
|
+
export declare function pgconnection(...optionsChain: PgConnectOptions[]): PgConnection;
|
|
3
|
+
export declare function pgpool(...optionsChain: PgConnectOptions[]): PgClient;
|
|
4
|
+
export type PgConnectOptions = string | URL | (PgConnectKnownOptions & Record<string, string | Uint8Array>);
|
|
5
|
+
export interface PgConnectKnownOptions {
|
|
6
|
+
readonly host?: string;
|
|
7
|
+
readonly port?: number;
|
|
8
|
+
readonly sslmode?: 'require' | 'prefer' | 'allow' | 'disable' | null;
|
|
9
|
+
readonly password?: string | Uint8Array;
|
|
10
|
+
readonly user?: string | Uint8Array;
|
|
11
|
+
readonly database?: string | Uint8Array;
|
|
12
|
+
readonly replication?: string | Uint8Array;
|
|
13
|
+
readonly application_name?: string | Uint8Array;
|
|
14
|
+
/** Connection attempts duration. If 0 (default) then only one connection attempt will be made. */
|
|
15
|
+
readonly _connectRetry?: number | string;
|
|
16
|
+
readonly _wakeInterval?: number | string;
|
|
17
|
+
readonly _poolIdleTimeout?: number | string;
|
|
18
|
+
readonly _poolSize?: number;
|
|
19
|
+
readonly _debug?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface PgClient {
|
|
22
|
+
/** Simple query protocol. */
|
|
23
|
+
query(script: string, options?: PgSimpleQueryOptions): Promise<PgResult>;
|
|
24
|
+
/** Simple query protocol. */
|
|
25
|
+
stream(script: string, options?: PgSimpleQueryOptions): AsyncIterableIterator<PgChunk>;
|
|
26
|
+
/** Extended query protocol. */
|
|
27
|
+
query(statements: Statement[], options?: PgExtendedQueryOptions): Promise<PgResult>;
|
|
28
|
+
/** Extended query protocol. */
|
|
29
|
+
stream(statements: Statement[], options?: PgExtendedQueryOptions): AsyncIterableIterator<PgChunk>;
|
|
30
|
+
/** Extended query protocol. */
|
|
31
|
+
query(...statements: Statement[]): Promise<PgResult>;
|
|
32
|
+
/** Extended query protocol. */
|
|
33
|
+
stream(...statements: Statement[]): AsyncIterableIterator<PgChunk>;
|
|
34
|
+
/** Terminates client gracefully if possible and waits until pending queries complete.
|
|
35
|
+
* New queries will be rejected. Has no effect if client already ended or destroyed. */
|
|
36
|
+
end(): Promise<void>;
|
|
37
|
+
/** Terminates client abruptly. Pending queries will be rejected.
|
|
38
|
+
* Has no effect when called on destroyed connection.
|
|
39
|
+
* @param {Error} reason Pending queries will be rejected with provided reason.
|
|
40
|
+
* New queries will also be rejected with provided reason unless `.end` was called
|
|
41
|
+
* before `.destroy`
|
|
42
|
+
* @returns reason back so you can destroy and throw in one line. */
|
|
43
|
+
destroy<R>(reason?: R): R;
|
|
44
|
+
/** Number of pending queries. */
|
|
45
|
+
readonly pending: number;
|
|
46
|
+
}
|
|
47
|
+
export interface PgConnection extends PgClient {
|
|
48
|
+
logicalReplication(options: LogicalReplicationOptions): ReplicationStream;
|
|
49
|
+
/** ID of postgres backend process. */
|
|
50
|
+
readonly pid: number | null;
|
|
51
|
+
readonly inTransaction: number | null;
|
|
52
|
+
readonly ssl: boolean | null;
|
|
53
|
+
/** Notification handler */
|
|
54
|
+
onnotification: (n: PgNotification) => void;
|
|
55
|
+
parameters: Record<string, string>;
|
|
56
|
+
}
|
|
57
|
+
export interface PgSimpleQueryOptions {
|
|
58
|
+
readonly stdin?: AsyncIterable<Uint8Array>;
|
|
59
|
+
readonly stdins?: Iterable<AsyncIterable<Uint8Array>>;
|
|
60
|
+
readonly signal?: AbortSignal;
|
|
61
|
+
}
|
|
62
|
+
export interface PgExtendedQueryOptions {
|
|
63
|
+
readonly signal?: AbortSignal;
|
|
64
|
+
}
|
|
65
|
+
export interface PgRow {
|
|
66
|
+
readonly length: number;
|
|
67
|
+
readonly columns: ColumnDescription[];
|
|
68
|
+
readonly raw: (string | Uint8Array)[];
|
|
69
|
+
decodeWithoutCustomTypes(index: number): any;
|
|
70
|
+
}
|
|
71
|
+
export interface PgResult extends Iterable<any> {
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated Use iterator instead.
|
|
74
|
+
*
|
|
75
|
+
* First row first column value. `undefined` if no rows returned. a */
|
|
76
|
+
readonly scalar: any;
|
|
77
|
+
readonly rows: PgRow[];
|
|
78
|
+
readonly columns: ColumnDescription[];
|
|
79
|
+
/** - Command tag (`'SELECT ...'`, `'UPDATE ...'`) if CommandComplete received.
|
|
80
|
+
* - `'PortalSuspended'` if {@link Statement.limit} has been reached.
|
|
81
|
+
* - `'EmptyQueryResponse'` if statement contains whitespaces or comments only.
|
|
82
|
+
* - `null` if there were more than one statement. */
|
|
83
|
+
readonly status: string | 'PortalSuspended' | 'EmptyQueryResponse' | null;
|
|
84
|
+
readonly results: PgSubResult[];
|
|
85
|
+
readonly notices: PgNotice[];
|
|
86
|
+
}
|
|
87
|
+
export interface PgSubResult {
|
|
88
|
+
/** First row first column value. `undefined` if no rows returned. */
|
|
89
|
+
readonly scalar: any;
|
|
90
|
+
readonly rows: PgRow[];
|
|
91
|
+
readonly columns: ColumnDescription[];
|
|
92
|
+
/** - Command tag (`'SELECT ...'`, `'UPDATE ...'`) if CommandComplete received.
|
|
93
|
+
* - `'PortalSuspended'` if {@link Statement.limit} has been reached.
|
|
94
|
+
* - `'EmptyQueryResponse'` if statement contains whitespaces or comments only. */
|
|
95
|
+
readonly status: string | 'PortalSuspended' | 'EmptyQueryResponse';
|
|
96
|
+
}
|
|
97
|
+
export type PgChunk = PgChunkDataRow | PgChunkCopyData | PgChunkCommandComplete | PgChunkRowDescription;
|
|
98
|
+
export interface PgChunkDataRow extends Uint8Array {
|
|
99
|
+
readonly tag: 'DataRow';
|
|
100
|
+
readonly rows: PgRow[];
|
|
101
|
+
readonly copies: [];
|
|
102
|
+
readonly payload: null;
|
|
103
|
+
}
|
|
104
|
+
export interface PgChunkCopyData extends Uint8Array {
|
|
105
|
+
readonly tag: 'CopyData';
|
|
106
|
+
readonly rows: PgRow[];
|
|
107
|
+
readonly copies: Uint8Array[];
|
|
108
|
+
readonly payload: null;
|
|
109
|
+
}
|
|
110
|
+
export interface PgChunkCommandComplete extends Uint8Array {
|
|
111
|
+
readonly tag: 'CommandComplete';
|
|
112
|
+
readonly rows: PgRow[];
|
|
113
|
+
readonly copies: [];
|
|
114
|
+
/** Command, SELECT N, UPDATE 0 N, ... */
|
|
115
|
+
readonly payload: string;
|
|
116
|
+
}
|
|
117
|
+
export interface PgChunkRowDescription extends Uint8Array {
|
|
118
|
+
readonly tag: 'RowDescription';
|
|
119
|
+
readonly rows: PgRow[];
|
|
120
|
+
readonly copies: [];
|
|
121
|
+
readonly payload: ColumnDescription[];
|
|
122
|
+
}
|
|
123
|
+
export interface ColumnDescription {
|
|
124
|
+
readonly name: string;
|
|
125
|
+
readonly typeOid: number;
|
|
126
|
+
readonly typeMod: number;
|
|
127
|
+
}
|
|
128
|
+
export interface Statement {
|
|
129
|
+
readonly statement: string;
|
|
130
|
+
readonly params?: StatementParam[];
|
|
131
|
+
/** Max number of rows to fetch.
|
|
132
|
+
* {@link StatementResult.suspended} will be `true` if limit has been reached. */
|
|
133
|
+
readonly limit?: number;
|
|
134
|
+
readonly stdin?: AsyncIterable<Uint8Array>;
|
|
135
|
+
}
|
|
136
|
+
export interface StatementParam {
|
|
137
|
+
/** Valid type oid or builtin type name. */
|
|
138
|
+
readonly type?: number | 'uuid' | 'varchar' | 'bool' | 'bytea' | 'int2' | 'int4' | 'float4' | 'float8' | 'int8' | 'json' | 'jsonb' | 'pg_lsn';
|
|
139
|
+
readonly value: any;
|
|
140
|
+
}
|
|
141
|
+
export interface LogicalReplicationOptions {
|
|
142
|
+
readonly slot: string;
|
|
143
|
+
readonly startLsn?: string;
|
|
144
|
+
/** Decoder options */
|
|
145
|
+
readonly options?: Record<string, string>;
|
|
146
|
+
readonly ackIntervalMillis?: number;
|
|
147
|
+
}
|
|
148
|
+
export interface ReplicationStream extends AsyncIterable<ReplicationChunk> {
|
|
149
|
+
/** Confirms receipt of replication packet by lsn.
|
|
150
|
+
* Use {@link ReplicationMessage.lsn} to get packet lsn. */
|
|
151
|
+
ack(lsn: string): undefined;
|
|
152
|
+
/**
|
|
153
|
+
* Decodes {@link ReplicationMessage.data} and yields upgraded pgoutput packets.
|
|
154
|
+
* Use this method if replication is started with pgoutput slot. */
|
|
155
|
+
pgoutputDecode(): AsyncIterable<PgotputChunk>;
|
|
156
|
+
}
|
|
157
|
+
export interface ReplicationChunk {
|
|
158
|
+
readonly endLsn: string;
|
|
159
|
+
readonly time: bigint;
|
|
160
|
+
readonly messages: ReplicationMessage[];
|
|
161
|
+
}
|
|
162
|
+
export interface ReplicationMessage {
|
|
163
|
+
/** Log Serial Number of packet.
|
|
164
|
+
* Use it for {@link ReplicationStream.ack} to confirm receipt of packet. */
|
|
165
|
+
readonly lsn: string | null;
|
|
166
|
+
readonly endLsn: string | null;
|
|
167
|
+
/** microseconds since unix epoch */
|
|
168
|
+
readonly time: bigint;
|
|
169
|
+
/** binary payload */
|
|
170
|
+
readonly data: Uint8Array;
|
|
171
|
+
}
|
|
172
|
+
export interface PgotputChunk extends ReplicationChunk {
|
|
173
|
+
lastLsn: string;
|
|
174
|
+
readonly messages: PgoutputMessage[];
|
|
175
|
+
}
|
|
176
|
+
/** https://www.postgresql.org/docs/14/protocol-logicalrep-message-formats.html */
|
|
177
|
+
export type PgoutputMessage = PgoutputBegin | PgoutputCommit | PgoutputRelation | PgoutputInsert | PgoutputUpdate | PgoutputDelete | PgoutputTruncate | PgoutputCustomMessage;
|
|
178
|
+
export interface PgoutputBegin extends ReplicationMessage {
|
|
179
|
+
readonly tag: 'begin';
|
|
180
|
+
/** https://github.com/postgres/postgres/blob/27b77ecf9f4d5be211900eda54d8155ada50d696/src/include/replication/reorderbuffer.h#L275 */
|
|
181
|
+
readonly commitLsn: string;
|
|
182
|
+
readonly commitTime: bigint;
|
|
183
|
+
readonly xid: number;
|
|
184
|
+
}
|
|
185
|
+
export interface PgoutputCommit extends ReplicationMessage {
|
|
186
|
+
readonly tag: 'commit';
|
|
187
|
+
readonly commitLsn: string;
|
|
188
|
+
readonly commitTime: bigint;
|
|
189
|
+
}
|
|
190
|
+
export interface PgoutputRelation extends ReplicationMessage {
|
|
191
|
+
readonly tag: 'relation';
|
|
192
|
+
readonly relationid: number;
|
|
193
|
+
readonly schema: string;
|
|
194
|
+
readonly name: string;
|
|
195
|
+
/** https://www.postgresql.org/docs/14/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY */
|
|
196
|
+
readonly replicaIdentity: 'default' | 'nothing' | 'full' | 'index';
|
|
197
|
+
readonly keyColumns: string[];
|
|
198
|
+
readonly columns: Array<{
|
|
199
|
+
/** `0b1` if attribute is part of replica identity */
|
|
200
|
+
readonly flags: number;
|
|
201
|
+
readonly name: string;
|
|
202
|
+
readonly typeOid: number;
|
|
203
|
+
readonly typeMod: number;
|
|
204
|
+
readonly typeSchema: string | null;
|
|
205
|
+
readonly typeName: string | null;
|
|
206
|
+
}>;
|
|
207
|
+
}
|
|
208
|
+
export interface PgoutputInsert extends ReplicationMessage {
|
|
209
|
+
readonly tag: 'insert';
|
|
210
|
+
readonly relation: PgoutputRelation;
|
|
211
|
+
readonly key: Record<string, any>;
|
|
212
|
+
readonly before: null;
|
|
213
|
+
readonly after: Record<string, any>;
|
|
214
|
+
}
|
|
215
|
+
export interface PgoutputUpdate extends ReplicationMessage {
|
|
216
|
+
readonly tag: 'update';
|
|
217
|
+
readonly relation: PgoutputRelation;
|
|
218
|
+
readonly key: Record<string, any>;
|
|
219
|
+
/**
|
|
220
|
+
* If {@link PgoutputRelation.replicaIdentity} is not `full`
|
|
221
|
+
* then gets row values before update, otherwise gets `null` */
|
|
222
|
+
readonly before: Record<string, any> | null;
|
|
223
|
+
/**
|
|
224
|
+
* Gets row values after update.
|
|
225
|
+
* If {@link PgoutputRelation.replicaIdentity} is not `full`
|
|
226
|
+
* then unchanged TOASTed values will be `undefined`.
|
|
227
|
+
* See https://www.postgresql.org/docs/14/storage-toast.html for TOASTing */
|
|
228
|
+
readonly after: Record<string, any>;
|
|
229
|
+
}
|
|
230
|
+
export interface PgoutputDelete extends ReplicationMessage {
|
|
231
|
+
readonly tag: 'delete';
|
|
232
|
+
readonly relation: PgoutputRelation;
|
|
233
|
+
readonly key: Record<string, any>;
|
|
234
|
+
/**
|
|
235
|
+
* If {@link PgoutputRelation.replicaIdentity} is not `full`
|
|
236
|
+
* then gets values of deleted row, otherwise gets `null`. */
|
|
237
|
+
readonly before: Record<string, any> | null;
|
|
238
|
+
readonly after: null;
|
|
239
|
+
}
|
|
240
|
+
export interface PgoutputTruncate extends ReplicationMessage {
|
|
241
|
+
readonly tag: 'truncate';
|
|
242
|
+
readonly cascade: boolean;
|
|
243
|
+
readonly restartIdentity: boolean;
|
|
244
|
+
/** Truncated relations. */
|
|
245
|
+
readonly relations: PgoutputRelation[];
|
|
246
|
+
}
|
|
247
|
+
export interface PgoutputCustomMessage extends ReplicationMessage {
|
|
248
|
+
readonly tag: 'message';
|
|
249
|
+
readonly transactional: boolean;
|
|
250
|
+
readonly messageLsn: string;
|
|
251
|
+
readonly prefix: string;
|
|
252
|
+
readonly content: Uint8Array;
|
|
253
|
+
}
|
|
254
|
+
/** https://www.postgresql.org/docs/14/protocol-error-fields.html */
|
|
255
|
+
export interface PgNotice {
|
|
256
|
+
/** WARNING, NOTICE, DEBUG, INFO, or LOG, or a localized translation of one of these. */
|
|
257
|
+
severity: string;
|
|
258
|
+
/** The SQLSTATE code for the error. Not localizable.
|
|
259
|
+
* https://www.postgresql.org/docs/14/errcodes-appendix.html */
|
|
260
|
+
code: string;
|
|
261
|
+
/** The primary human-readable error message. This should be accurate but terse (typically one line). */
|
|
262
|
+
message: string;
|
|
263
|
+
/** Optional secondary error message carrying more detail about the problem. Might run to multiple lines. */
|
|
264
|
+
detail: string | undefined;
|
|
265
|
+
/** An optional suggestion what to do about the problem.
|
|
266
|
+
* This is intended to differ from Detail in that it offers advice
|
|
267
|
+
* (potentially inappropriate) rather than hard facts.
|
|
268
|
+
* Might run to multiple lines. */
|
|
269
|
+
hint: string | undefined;
|
|
270
|
+
/** Error cursor position as an index into the original query string.
|
|
271
|
+
* The first character has index 1, and positions are measured in characters not bytes. */
|
|
272
|
+
position: number | undefined;
|
|
273
|
+
internalPosition: number | undefined;
|
|
274
|
+
internalQuery: string | undefined;
|
|
275
|
+
where: string | undefined;
|
|
276
|
+
file: string | undefined;
|
|
277
|
+
line: string | undefined;
|
|
278
|
+
routine: string | undefined;
|
|
279
|
+
schema: string | undefined;
|
|
280
|
+
table: string | undefined;
|
|
281
|
+
column: string | undefined;
|
|
282
|
+
datatype: string | undefined;
|
|
283
|
+
constraint: string | undefined;
|
|
284
|
+
}
|
|
285
|
+
export interface PgNotification {
|
|
286
|
+
readonly pid: number;
|
|
287
|
+
readonly channel: string;
|
|
288
|
+
readonly payload: string;
|
|
289
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy_pgwire_types.js","sourceRoot":"","sources":["../src/legacy_pgwire_types.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,qDAAqD"}
|
package/dist/pgwire.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
import type * as
|
|
3
|
-
|
|
4
|
-
export declare
|
|
1
|
+
export type * from './legacy_pgwire_types.js';
|
|
2
|
+
import type * as pgwire_typed from './legacy_pgwire_types.js';
|
|
3
|
+
export declare const pgconnect: typeof pgwire_typed.pgconnect;
|
|
4
|
+
export declare const pgconnection: typeof pgwire_typed.pgconnection;
|
|
5
|
+
export declare const pgpool: typeof pgwire_typed.pgpool;
|
package/dist/pgwire.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
// The pgwire module system doesn't play nice with node.
|
|
2
2
|
// This works around it, and provides a proper export.
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
const pgwireImport = await import('pgwire/mod.js');
|
|
8
|
-
return await pgwireImport.pgconnect(...options);
|
|
9
|
-
}
|
|
3
|
+
import * as pgwire_untyped from './pgwire_node.js';
|
|
4
|
+
export const pgconnect = pgwire_untyped.pgconnect;
|
|
5
|
+
export const pgconnection = pgwire_untyped.pgconnection;
|
|
6
|
+
export const pgpool = pgwire_untyped.pgpool;
|
|
10
7
|
//# sourceMappingURL=pgwire.js.map
|
package/dist/pgwire.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pgwire.js","sourceRoot":"","sources":["../src/pgwire.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,sDAAsD;
|
|
1
|
+
{"version":3,"file":"pgwire.js","sourceRoot":"","sources":["../src/pgwire.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,sDAAsD;AAKtD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AAGnD,MAAM,CAAC,MAAM,SAAS,GAAmC,cAAsB,CAAC,SAAS,CAAC;AAC1F,MAAM,CAAC,MAAM,YAAY,GAAsC,cAAsB,CAAC,YAAY,CAAC;AACnG,MAAM,CAAC,MAAM,MAAM,GAAgC,cAAsB,CAAC,MAAM,CAAC"}
|
package/dist/pgwire_node.js
CHANGED
|
@@ -1,33 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// Modifications marked with `START POWERSYNC ...`
|
|
4
|
-
import { createHash, pbkdf2 as _pbkdf2, randomFillSync } from 'crypto';
|
|
5
|
-
import { promisify } from 'util';
|
|
6
|
-
import { _net, SaslScramSha256 } from 'pgwire/mod.js';
|
|
1
|
+
import { pbkdf2 as _pbkdf2 } from 'crypto';
|
|
2
|
+
import { _net } from 'pgwire';
|
|
7
3
|
import { SocketAdapter } from './socket_adapter.js';
|
|
8
|
-
const pbkdf2 = promisify(_pbkdf2);
|
|
9
|
-
Object.assign(SaslScramSha256.prototype, {
|
|
10
|
-
_b64encode(bytes) {
|
|
11
|
-
return Buffer.from(bytes).toString('base64');
|
|
12
|
-
},
|
|
13
|
-
_b64decode(b64) {
|
|
14
|
-
return Uint8Array.from(Buffer.from(b64, 'base64'));
|
|
15
|
-
},
|
|
16
|
-
_randomBytes(n) {
|
|
17
|
-
return randomFillSync(new Uint8Array(n));
|
|
18
|
-
},
|
|
19
|
-
async _hash(val) {
|
|
20
|
-
return Uint8Array.from(createHash('sha256').update(val).digest());
|
|
21
|
-
},
|
|
22
|
-
async _hi(pwd, salt, iterations) {
|
|
23
|
-
const buf = await pbkdf2(pwd, salt, iterations, 32, 'sha256');
|
|
24
|
-
return Uint8Array.from(buf);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
4
|
Object.assign(_net, {
|
|
28
|
-
|
|
5
|
+
connectTcp(options) {
|
|
29
6
|
return SocketAdapter.connect(options);
|
|
30
7
|
},
|
|
8
|
+
connectUnix(_options) {
|
|
9
|
+
throw `Unused and unsupported in PowerSync`;
|
|
10
|
+
},
|
|
31
11
|
reconnectable(err) {
|
|
32
12
|
return ['ENOTFOUND', 'ECONNREFUSED', 'ECONNRESET'].includes(err?.code);
|
|
33
13
|
},
|
|
@@ -46,4 +26,5 @@ Object.assign(_net, {
|
|
|
46
26
|
return sockadapt.close();
|
|
47
27
|
}
|
|
48
28
|
});
|
|
29
|
+
export * from 'pgwire';
|
|
49
30
|
//# sourceMappingURL=pgwire_node.js.map
|
package/dist/pgwire_node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pgwire_node.js","sourceRoot":"","sources":["../src/pgwire_node.js"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"pgwire_node.js","sourceRoot":"","sources":["../src/pgwire_node.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;IAClB,UAAU,CAAC,OAAO;QAChB,OAAO,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IACD,WAAW,CAAC,QAAQ;QAClB,MAAM,qCAAqC,CAAC;IAC9C,CAAC;IACD,aAAa,CAAC,GAAG;QACf,OAAO,CAAC,WAAW,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;IACD,QAAQ,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE;QACvC,OAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,CAAC,SAAS,EAAE,GAAG;QACjB,OAAO,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,KAAK,CAAC,SAAS,EAAE,IAAI;QACnB,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IACD,aAAa,CAAC,SAAS;QACrB,IAAI,CAAC,SAAS;YAAE,OAAO;QACvB,OAAO,SAAS,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC;AAEH,cAAc,QAAQ,CAAC"}
|
package/dist/pgwire_types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DatabaseInputValue } from '@powersync/service-sync-rules';
|
|
1
|
+
import { type DatabaseInputValue, DateTimeSourceOptions } from '@powersync/service-sync-rules';
|
|
2
2
|
export declare enum PgTypeOid {
|
|
3
3
|
TEXT = 25,
|
|
4
4
|
UUID = 2950,
|
|
@@ -22,9 +22,10 @@ export declare enum PgTypeOid {
|
|
|
22
22
|
export declare const ARRAY_TO_ELEM_OID: Map<number, number>;
|
|
23
23
|
export declare class PgType {
|
|
24
24
|
static getArrayType(typeOid: number): number | undefined;
|
|
25
|
-
static decode(text: string, typeOid: number): DatabaseInputValue;
|
|
25
|
+
static decode(text: string | Uint8Array, typeOid: number): DatabaseInputValue;
|
|
26
26
|
static elemTypeOid(arrayTypeOid: number): number | undefined;
|
|
27
27
|
static _decodeArray(text: string, elemTypeOid: number): DatabaseInputValue[];
|
|
28
28
|
static _decodeBytea(text: string): Uint8Array;
|
|
29
29
|
static _encodeBytea(bytes: Uint8Array): string;
|
|
30
30
|
}
|
|
31
|
+
export declare const postgresTimeOptions: DateTimeSourceOptions;
|
package/dist/pgwire_types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Adapted from https://github.com/kagis/pgwire/blob/0dc927f9f8990a903f238737326e53ba1c8d094f/mod.js#L2218
|
|
2
2
|
import { JsonContainer } from '@powersync/service-jsonbig';
|
|
3
|
-
import { TimeValue } from '@powersync/service-sync-rules';
|
|
3
|
+
import { TimeValue, TimeValuePrecision } from '@powersync/service-sync-rules';
|
|
4
4
|
import { dateToSqlite, lsnMakeComparable, timestampToSqlite, timestamptzToSqlite } from './util.js';
|
|
5
5
|
import { StructureParser } from './structure_parser.js';
|
|
6
6
|
export var PgTypeOid;
|
|
@@ -104,6 +104,10 @@ export class PgType {
|
|
|
104
104
|
return ELEM_OID_TO_ARRAY.get(typeOid);
|
|
105
105
|
}
|
|
106
106
|
static decode(text, typeOid) {
|
|
107
|
+
if (typeof text != 'string') {
|
|
108
|
+
// We don't support decoding binary values.
|
|
109
|
+
return text;
|
|
110
|
+
}
|
|
107
111
|
switch (typeOid) {
|
|
108
112
|
// add line here when register new type
|
|
109
113
|
case PgTypeOid.TEXT:
|
|
@@ -129,7 +133,7 @@ export class PgType {
|
|
|
129
133
|
case PgTypeOid.TIMESTAMPTZ:
|
|
130
134
|
return timestamptzToSqlite(text);
|
|
131
135
|
case PgTypeOid.TIME:
|
|
132
|
-
return TimeValue.parse(text);
|
|
136
|
+
return TimeValue.parse(text, postgresTimeOptions);
|
|
133
137
|
case PgTypeOid.JSON:
|
|
134
138
|
case PgTypeOid.JSONB:
|
|
135
139
|
// Don't parse the contents
|
|
@@ -165,4 +169,8 @@ export class PgType {
|
|
|
165
169
|
return '\\x' + Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
|
|
166
170
|
}
|
|
167
171
|
}
|
|
172
|
+
export const postgresTimeOptions = Object.freeze({
|
|
173
|
+
subSecondPrecision: TimeValuePrecision.microseconds,
|
|
174
|
+
defaultSubSecondPrecision: TimeValuePrecision.microseconds
|
|
175
|
+
});
|
|
168
176
|
//# sourceMappingURL=pgwire_types.js.map
|
package/dist/pgwire_types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pgwire_types.js","sourceRoot":"","sources":["../src/pgwire_types.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAE1G,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"pgwire_types.js","sourceRoot":"","sources":["../src/pgwire_types.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAE1G,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAGL,SAAS,EACT,kBAAkB,EACnB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EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;IACxF,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,IAAY;QAC9B,mEAAmE;QACnE,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,kCAAkC;YAC7D,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YACvD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,wBAAwB;QACxB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IACnC,CAAC;IACD,MAAM,CAAC,YAAY,CAAC,KAAiB;QACnC,OAAO,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpF,CAAC;CACF;AAED,MAAM,CAAC,MAAM,mBAAmB,GAA0B,MAAM,CAAC,MAAM,CAAC;IACtE,kBAAkB,EAAE,kBAAkB,CAAC,YAAY;IACnD,yBAAyB,EAAE,kBAAkB,CAAC,YAAY;CAC3D,CAAC,CAAC"}
|
package/dist/socket_adapter.d.ts
CHANGED
package/dist/socket_adapter.js
CHANGED
|
@@ -17,7 +17,7 @@ export class SocketAdapter {
|
|
|
17
17
|
static async connect(options) {
|
|
18
18
|
// Custom timeout handling
|
|
19
19
|
const socket = net.connect({
|
|
20
|
-
host: options.
|
|
20
|
+
host: options.host,
|
|
21
21
|
port: options.port,
|
|
22
22
|
lookup: options.lookup,
|
|
23
23
|
// This closes the connection if no data was sent or received for the given time,
|
|
@@ -31,7 +31,7 @@ export class SocketAdapter {
|
|
|
31
31
|
});
|
|
32
32
|
try {
|
|
33
33
|
const timeout = setTimeout(() => {
|
|
34
|
-
socket.destroy(new Error(`Timeout while connecting to ${options.
|
|
34
|
+
socket.destroy(new Error(`Timeout while connecting to ${options.host}:${options.port}`));
|
|
35
35
|
}, POWERSYNC_SOCKET_CONNECT_TIMEOUT);
|
|
36
36
|
await once(socket, 'connect');
|
|
37
37
|
clearTimeout(timeout);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket_adapter.js","sourceRoot":"","sources":["../src/socket_adapter.ts"],"names":[],"mappings":"AAAA,uEAAuE;AAEvE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,wFAAwF;AACxF,+EAA+E;AAC/E,MAAM,gCAAgC,GAAG,OAAO,CAAC;AAEjD,+CAA+C;AAC/C,mDAAmD;AACnD,MAAM,gCAAgC,GAAG,MAAM,CAAC;AAEhD,uCAAuC;AACvC,iDAAiD;AACjD,MAAM,wCAAwC,GAAG,MAAM,CAAC;AASxD,MAAM,OAAO,aAAa;IAqCd;IApCV,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAuB;QAC1C,0BAA0B;QAC1B,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;YACzB,IAAI,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"socket_adapter.js","sourceRoot":"","sources":["../src/socket_adapter.ts"],"names":[],"mappings":"AAAA,uEAAuE;AAEvE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,wFAA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CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACb,yBAAyB;QACzB,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC5B,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,IAAgB;QAC1B,yBAAyB;QACzB,0BAA0B;QAC1B,IAAI,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,iBAAiB;QACrD,MAAM,CAAC,GAAG,IAAI,OAAO,CAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC5C,MAAM,CAAC,CAAC;QACR,IAAI,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,iBAAiB;QACrD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IACD,uBAAuB;IACvB,0DAA0D;IAC1D,8DAA8D;IAC9D,wBAAwB;IACxB,IAAI;IACJ,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAClD,CAAC;CACF"}
|
package/dist/util.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as datefns from 'date-fns';
|
|
2
2
|
import { DEFAULT_CERTS } from './certs.js';
|
|
3
3
|
import * as pgwire from './pgwire.js';
|
|
4
|
-
import { PgType } from './pgwire_types.js';
|
|
4
|
+
import { PgType, postgresTimeOptions } from './pgwire_types.js';
|
|
5
5
|
import { DateTimeValue } from '@powersync/service-sync-rules';
|
|
6
6
|
export function clientTlsOptions(options) {
|
|
7
7
|
if (options.client_certificate && options.client_private_key) {
|
|
@@ -52,7 +52,7 @@ export async function connectPgWire(config, options) {
|
|
|
52
52
|
let connectionOptions = {
|
|
53
53
|
application_name: options?.applicationName ?? 'powersync',
|
|
54
54
|
// tlsOptions below contains the original hostname
|
|
55
|
-
|
|
55
|
+
host: config.resolved_ip ?? config.hostname,
|
|
56
56
|
port: config.port,
|
|
57
57
|
database: config.database,
|
|
58
58
|
user: config.username,
|
|
@@ -61,40 +61,67 @@ export async function connectPgWire(config, options) {
|
|
|
61
61
|
if (options?.type != 'standard') {
|
|
62
62
|
connectionOptions.replication = 'database';
|
|
63
63
|
}
|
|
64
|
-
let tlsOptions = false;
|
|
65
64
|
if (config.sslmode != 'disable') {
|
|
66
65
|
connectionOptions.sslmode = 'require';
|
|
67
|
-
tlsOptions = makeTlsOptions(config);
|
|
68
66
|
}
|
|
69
67
|
else {
|
|
70
68
|
connectionOptions.sslmode = 'disable';
|
|
71
69
|
}
|
|
72
70
|
const connection = pgwire.pgconnection(connectionOptions);
|
|
73
|
-
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
patchConnection(connection, config);
|
|
72
|
+
// To test the connection, send an empty query. This appears to be the only way to establish a connection, see e.g.
|
|
73
|
+
// this: https://github.com/exe-dealer/pgwire/blob/24465b25768ef0d9048acee1fddc748cf1690a14/mod.js#L26.
|
|
74
|
+
try {
|
|
75
|
+
await connection.query();
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
await connection.end();
|
|
79
|
+
if (e instanceof Error && e.message == 'postgres query failed') {
|
|
80
|
+
// We didn't actually send a query, so we report the inner cause instead:
|
|
81
|
+
// https://github.com/exe-dealer/pgwire/blob/24465b25768ef0d9048acee1fddc748cf1690a14/mod.js#L334
|
|
82
|
+
throw e.cause;
|
|
83
|
+
}
|
|
84
|
+
throw e;
|
|
85
|
+
}
|
|
81
86
|
return connection;
|
|
82
87
|
}
|
|
83
|
-
function
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
function patchConnection(connection, config) {
|
|
89
|
+
// Just the easiest way to pass on our config to SocketAdapter
|
|
90
|
+
const connectOptions = connection._socketOptions;
|
|
91
|
+
connectOptions.tlsOptions = makeTlsOptions(config);
|
|
92
|
+
connectOptions.lookup = config.lookup;
|
|
93
|
+
// Hack for safety: We always want to be responsible for decoding values ourselves, and NEVER
|
|
94
|
+
// use the PgType.decode implementation from pgwire. We can use our own implementation by using
|
|
95
|
+
// row.raw, this ensures that forgetting to do that is an error instead of potentially corrupted
|
|
96
|
+
// data.
|
|
97
|
+
// Original definition: https://github.com/exe-dealer/pgwire/blob/24465b25768ef0d9048acee1fddc748cf1690a14/mod.js#L679-L701
|
|
98
|
+
connection._recvRowDescription = async function (m, columns) {
|
|
99
|
+
class RowImplementation {
|
|
100
|
+
raw;
|
|
101
|
+
constructor(raw) {
|
|
102
|
+
this.raw = raw;
|
|
103
|
+
}
|
|
104
|
+
get length() {
|
|
105
|
+
return this.raw.length;
|
|
106
|
+
}
|
|
107
|
+
decodeWithoutCustomTypes(index) {
|
|
108
|
+
return PgType.decode(this.raw[index], this.columns[index].typeOid);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
Object.defineProperties(RowImplementation.prototype, {
|
|
112
|
+
columns: { enumerable: true, value: columns }
|
|
113
|
+
});
|
|
114
|
+
for (const [i] of columns.entries()) {
|
|
115
|
+
Object.defineProperty(RowImplementation.prototype, i, {
|
|
116
|
+
enumerable: false,
|
|
117
|
+
get() {
|
|
118
|
+
throw new Error(`Illegal call to PgRow[i]. Use decodeWithoutCustomTypes(i) instead, or use a custom type registry.`);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
88
121
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
? // do not valbuf.slice() because nodejs Buffer .slice does not copy
|
|
93
|
-
// TODO but we not going to receive Buffer here ?
|
|
94
|
-
Uint8Array.prototype.slice.call(valbuf)
|
|
95
|
-
: PgType.decode(this._rowTextDecoder.decode(valbuf), typeOid);
|
|
96
|
-
}
|
|
97
|
-
batch.rows.push(row);
|
|
122
|
+
this._rowCtor = RowImplementation;
|
|
123
|
+
await this._fwdBemsg(m);
|
|
124
|
+
};
|
|
98
125
|
}
|
|
99
126
|
/**
|
|
100
127
|
* Open a postgres pool.
|
|
@@ -107,7 +134,7 @@ export function connectPgWirePool(config, options) {
|
|
|
107
134
|
let connectionOptions = {
|
|
108
135
|
application_name: options?.applicationName ?? 'powersync',
|
|
109
136
|
// tlsOptions below contains the original hostname
|
|
110
|
-
|
|
137
|
+
host: config.resolved_ip ?? config.hostname,
|
|
111
138
|
port: config.port,
|
|
112
139
|
database: config.database,
|
|
113
140
|
user: config.username,
|
|
@@ -115,10 +142,8 @@ export function connectPgWirePool(config, options) {
|
|
|
115
142
|
_poolSize: maxSize,
|
|
116
143
|
_poolIdleTimeout: idleTimeout
|
|
117
144
|
};
|
|
118
|
-
let tlsOptions = false;
|
|
119
145
|
if (config.sslmode != 'disable') {
|
|
120
146
|
connectionOptions.sslmode = 'require';
|
|
121
|
-
tlsOptions = makeTlsOptions(config);
|
|
122
147
|
}
|
|
123
148
|
else {
|
|
124
149
|
connectionOptions.sslmode = 'disable';
|
|
@@ -127,11 +152,7 @@ export function connectPgWirePool(config, options) {
|
|
|
127
152
|
const originalGetConnection = pool._getConnection;
|
|
128
153
|
pool._getConnection = function () {
|
|
129
154
|
const con = originalGetConnection.call(this);
|
|
130
|
-
|
|
131
|
-
connectOptions.tlsOptions = tlsOptions;
|
|
132
|
-
connectOptions.lookup = config.lookup;
|
|
133
|
-
// HACK: Replace row decoding with our own implementation
|
|
134
|
-
con._recvDataRow = _recvDataRow;
|
|
155
|
+
patchConnection(con, config);
|
|
135
156
|
return con;
|
|
136
157
|
};
|
|
137
158
|
return pool;
|
|
@@ -160,10 +181,10 @@ export function timestamptzToSqlite(source) {
|
|
|
160
181
|
const match = timeRegex.exec(source);
|
|
161
182
|
if (match == null) {
|
|
162
183
|
if (source == 'infinity') {
|
|
163
|
-
return new DateTimeValue('9999-12-31T23:59:59Z');
|
|
184
|
+
return new DateTimeValue('9999-12-31T23:59:59Z', undefined, postgresTimeOptions);
|
|
164
185
|
}
|
|
165
186
|
else if (source == '-infinity') {
|
|
166
|
-
return new DateTimeValue('0000-01-01T00:00:00Z');
|
|
187
|
+
return new DateTimeValue('0000-01-01T00:00:00Z', undefined, postgresTimeOptions);
|
|
167
188
|
}
|
|
168
189
|
else {
|
|
169
190
|
return null;
|
|
@@ -179,13 +200,8 @@ export function timestamptzToSqlite(source) {
|
|
|
179
200
|
return null;
|
|
180
201
|
}
|
|
181
202
|
const baseValue = parsed.toISOString().replace('.000', '').replace('Z', '');
|
|
182
|
-
// In the new format, we always use ISO 8601. Since Postgres drops zeroes from the fractional seconds, we also pad
|
|
183
|
-
// that back to the highest theoretical precision (microseconds). This ensures that sorting returned values as text
|
|
184
|
-
// returns them in order of the time value they represent.
|
|
185
|
-
//
|
|
186
203
|
// In the old format, we keep the sub-second precision only if it's not `.000`.
|
|
187
|
-
|
|
188
|
-
return new DateTimeValue(`${baseValue}${missingPrecision}Z`, `${baseValue.replace('T', ' ')}${precision ?? ''}Z`);
|
|
204
|
+
return new DateTimeValue(`${baseValue}${precision ?? ''}Z`, `${baseValue.replace('T', ' ')}${precision ?? ''}Z`, postgresTimeOptions);
|
|
189
205
|
}
|
|
190
206
|
/**
|
|
191
207
|
* For timestamp without timezone, we keep it mostly as-is.
|
|
@@ -201,10 +217,10 @@ export function timestampToSqlite(source) {
|
|
|
201
217
|
const match = timeRegex.exec(source);
|
|
202
218
|
if (match == null) {
|
|
203
219
|
if (source == 'infinity') {
|
|
204
|
-
return new DateTimeValue('9999-12-31T23:59:59');
|
|
220
|
+
return new DateTimeValue('9999-12-31T23:59:59', undefined, postgresTimeOptions);
|
|
205
221
|
}
|
|
206
222
|
else if (source == '-infinity') {
|
|
207
|
-
return new DateTimeValue('0000-01-01T00:00:00');
|
|
223
|
+
return new DateTimeValue('0000-01-01T00:00:00', undefined, postgresTimeOptions);
|
|
208
224
|
}
|
|
209
225
|
else {
|
|
210
226
|
return null;
|
|
@@ -212,7 +228,7 @@ export function timestampToSqlite(source) {
|
|
|
212
228
|
}
|
|
213
229
|
const [_, date, time, precision, __] = match;
|
|
214
230
|
const missingPrecision = precision?.padEnd(7, '0') ?? '.000000';
|
|
215
|
-
return new DateTimeValue(`${date}T${time}${missingPrecision}`, source);
|
|
231
|
+
return new DateTimeValue(`${date}T${time}${missingPrecision}`, source, postgresTimeOptions);
|
|
216
232
|
}
|
|
217
233
|
/**
|
|
218
234
|
* For date, we keep it mostly as-is.
|
|
@@ -246,7 +262,7 @@ export function pgwireRows(rs) {
|
|
|
246
262
|
let r = {};
|
|
247
263
|
for (let i = 0; i < columns.length; i++) {
|
|
248
264
|
const c = columns[i];
|
|
249
|
-
r[c.name] = row
|
|
265
|
+
r[c.name] = row.decodeWithoutCustomTypes(i);
|
|
250
266
|
}
|
|
251
267
|
return r;
|
|
252
268
|
});
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AA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,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,IAAI,UAAU,EAAE,CAAC;QACzB,OAAO,YAAY,CAAC;IACtB,CAAC;SAAM,IAAI,MAAM,IAAI,WAAW,EAAE,CAAC;QACjC,OAAO,YAAY,CAAC;IACtB,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAA0B,EAAmB;IACrE,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC;IAC3B,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACzB,IAAI,CAAC,GAAM,EAAS,CAAC;QACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAEpB,CAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC;QACvD,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.21.
|
|
8
|
+
"version": "0.21.9",
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"license": "FSL-1.1-ALv2",
|
|
11
11
|
"files": [
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"date-fns": "^4.1.0",
|
|
18
|
-
"pgwire": "
|
|
18
|
+
"pgwire": "^0.8.1",
|
|
19
19
|
"@powersync/service-jsonbig": "^0.17.12",
|
|
20
|
-
"@powersync/service-sync-rules": "^0.29.
|
|
20
|
+
"@powersync/service-sync-rules": "^0.29.10"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"vitest": "^3.2.4"
|