@restura/core 1.9.0 → 1.9.1
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/index.d.ts +4 -0
- package/dist/index.js +18 -8
- package/dist/index.js.map +1 -1
- package/package.json +17 -17
package/dist/index.d.ts
CHANGED
|
@@ -1130,6 +1130,10 @@ declare class PsqlEngine extends SqlEngine {
|
|
|
1130
1130
|
private readonly INITIAL_RECONNECT_DELAY;
|
|
1131
1131
|
constructor(psqlConnectionPool: PsqlPool, shouldListenForDbTriggers?: boolean, scratchDatabaseSuffix?: string);
|
|
1132
1132
|
close(): Promise<void>;
|
|
1133
|
+
/**
|
|
1134
|
+
* Setup the return types for the PostgreSQL connection.
|
|
1135
|
+
* For example return DATE as a string instead of a Date object and BIGINT as a number instead of a string.
|
|
1136
|
+
*/
|
|
1133
1137
|
private setupPgReturnTypes;
|
|
1134
1138
|
private reconnectTriggerClient;
|
|
1135
1139
|
private listenForDbTriggers;
|
package/dist/index.js
CHANGED
|
@@ -2576,15 +2576,25 @@ var PsqlEngine = class extends SqlEngine {
|
|
|
2576
2576
|
await this.triggerClient.end();
|
|
2577
2577
|
}
|
|
2578
2578
|
}
|
|
2579
|
+
/**
|
|
2580
|
+
* Setup the return types for the PostgreSQL connection.
|
|
2581
|
+
* For example return DATE as a string instead of a Date object and BIGINT as a number instead of a string.
|
|
2582
|
+
*/
|
|
2579
2583
|
setupPgReturnTypes() {
|
|
2580
|
-
const
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
}
|
|
2584
|
+
const PG_TYPE_OID = {
|
|
2585
|
+
BIGINT: 20,
|
|
2586
|
+
DATE: 1082,
|
|
2587
|
+
TIME: 1083,
|
|
2588
|
+
TIMESTAMP: 1114,
|
|
2589
|
+
TIMESTAMPTZ: 1184,
|
|
2590
|
+
TIMETZ: 1266
|
|
2591
|
+
};
|
|
2592
|
+
types.setTypeParser(PG_TYPE_OID.BIGINT, (val) => val === null ? null : Number(val));
|
|
2593
|
+
types.setTypeParser(PG_TYPE_OID.DATE, (val) => val);
|
|
2594
|
+
types.setTypeParser(PG_TYPE_OID.TIME, (val) => val);
|
|
2595
|
+
types.setTypeParser(PG_TYPE_OID.TIMETZ, (val) => val);
|
|
2596
|
+
types.setTypeParser(PG_TYPE_OID.TIMESTAMP, (val) => val === null ? null : new Date(val).toISOString());
|
|
2597
|
+
types.setTypeParser(PG_TYPE_OID.TIMESTAMPTZ, (val) => val === null ? null : new Date(val).toISOString());
|
|
2588
2598
|
}
|
|
2589
2599
|
async reconnectTriggerClient() {
|
|
2590
2600
|
if (this.reconnectAttempts >= this.MAX_RECONNECT_ATTEMPTS) {
|