postgrejs 2.16.0 → 2.17.0
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/CHANGELOG.md +8 -0
- package/esm/connection/bind-param.js +1 -5
- package/esm/connection/connection.js +16 -20
- package/esm/connection/cursor.js +10 -15
- package/esm/connection/intl-connection.js +41 -46
- package/esm/connection/pool.js +28 -32
- package/esm/connection/portal.js +27 -31
- package/esm/connection/prepared-statement.js +31 -35
- package/esm/constants.js +122 -125
- package/esm/data-type-map.js +71 -75
- package/esm/data-types/bool-type.js +7 -10
- package/esm/data-types/box-type.js +7 -10
- package/esm/data-types/bytea-type.js +9 -13
- package/esm/data-types/char-type.js +7 -10
- package/esm/data-types/circle-type.js +7 -10
- package/esm/data-types/date-type.js +12 -15
- package/esm/data-types/float4-type.js +7 -10
- package/esm/data-types/float8-type.js +7 -10
- package/esm/data-types/int2-type.js +10 -13
- package/esm/data-types/int2-vector-type.js +13 -16
- package/esm/data-types/int4-type.js +10 -13
- package/esm/data-types/int8-type.js +9 -12
- package/esm/data-types/json-type.js +9 -12
- package/esm/data-types/jsonb-type.js +11 -14
- package/esm/data-types/lseg-type.js +7 -10
- package/esm/data-types/numeric-type.js +8 -12
- package/esm/data-types/oid-type.js +15 -18
- package/esm/data-types/point-type.js +7 -10
- package/esm/data-types/time-type.js +13 -16
- package/esm/data-types/timestamp-type.js +12 -15
- package/esm/data-types/timestamptz-type.js +12 -15
- package/esm/data-types/uuid-type.js +7 -10
- package/esm/data-types/varchar-type.js +7 -10
- package/esm/index.js +25 -28
- package/esm/interfaces/command-result.js +1 -2
- package/esm/interfaces/data-mapping-options.js +1 -2
- package/esm/interfaces/data-type.js +1 -2
- package/esm/interfaces/database-connection-params.js +1 -2
- package/esm/interfaces/field-info.js +1 -2
- package/esm/interfaces/query-options.js +1 -2
- package/esm/interfaces/query-result.js +1 -2
- package/esm/interfaces/script-execute-options.js +1 -2
- package/esm/interfaces/script-result.js +1 -2
- package/esm/interfaces/statement-prepare-options.js +1 -2
- package/esm/protocol/backend.js +24 -28
- package/esm/protocol/buffer-reader.js +1 -5
- package/esm/protocol/database-error.js +1 -5
- package/esm/protocol/frontend.js +27 -31
- package/esm/protocol/pg-socket.js +48 -53
- package/esm/protocol/protocol.js +2 -5
- package/esm/protocol/sasl.js +7 -11
- package/esm/protocol/smart-buffer.js +5 -10
- package/esm/safe-event-emitter.js +2 -6
- package/esm/types.js +1 -2
- package/esm/util/array-calculatedim.js +1 -4
- package/esm/util/bigint-methods.js +2 -6
- package/esm/util/config-from-env.js +5 -8
- package/esm/util/connection-config.js +8 -13
- package/esm/util/convert-row-to-object.js +1 -4
- package/esm/util/decode-binaryarray.js +3 -6
- package/esm/util/encode-binaryarray.js +5 -8
- package/esm/util/escape-literal.js +1 -4
- package/esm/util/fast-parseint.js +1 -4
- package/esm/util/get-parsers.js +8 -11
- package/esm/util/parse-array.js +1 -4
- package/esm/util/parse-datetime.js +5 -8
- package/esm/util/parse-row.js +1 -4
- package/esm/util/parse-time.js +8 -12
- package/esm/util/stringify-arrayliteral.js +3 -6
- package/esm/util/stringify-for-sql.js +8 -12
- package/esm/util/wrap-row-description.js +6 -9
- package/package.json +2 -2
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const array_calculatedim_js_1 = require("./array-calculatedim.js");
|
|
5
|
-
function stringifyArrayLiteral(value, options, encode) {
|
|
6
|
-
const dim = (0, array_calculatedim_js_1.arrayCalculateDim)(value);
|
|
1
|
+
import { arrayCalculateDim } from './array-calculatedim.js';
|
|
2
|
+
export function stringifyArrayLiteral(value, options, encode) {
|
|
3
|
+
const dim = arrayCalculateDim(value);
|
|
7
4
|
const writeDim = (arr, level) => {
|
|
8
5
|
const elemCount = dim[level];
|
|
9
6
|
const out = [];
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.stringifyValueForSQL = stringifyValueForSQL;
|
|
5
|
-
const uuid_type_js_1 = require("../data-types/uuid-type.js");
|
|
6
|
-
const escape_literal_js_1 = require("./escape-literal.js");
|
|
7
|
-
function stringifyArrayForSQL(v, options, encode) {
|
|
1
|
+
import { UuidType } from '../data-types/uuid-type.js';
|
|
2
|
+
import { escapeLiteral } from './escape-literal.js';
|
|
3
|
+
export function stringifyArrayForSQL(v, options, encode) {
|
|
8
4
|
const arr = v.map(x => stringifyValueForSQL(x, options, encode));
|
|
9
5
|
return 'ARRAY[' + arr.join(',') + ']';
|
|
10
6
|
}
|
|
11
|
-
function stringifyValueForSQL(v, options, encode) {
|
|
7
|
+
export function stringifyValueForSQL(v, options, encode) {
|
|
12
8
|
if (v == null)
|
|
13
9
|
return 'null';
|
|
14
10
|
if (typeof v === 'boolean')
|
|
@@ -21,9 +17,9 @@ function stringifyValueForSQL(v, options, encode) {
|
|
|
21
17
|
return '' + v;
|
|
22
18
|
if (typeof v === 'bigint')
|
|
23
19
|
return v.toString();
|
|
24
|
-
if (typeof v === 'string' &&
|
|
25
|
-
return
|
|
20
|
+
if (typeof v === 'string' && UuidType.isType(v))
|
|
21
|
+
return escapeLiteral('' + v) + '::uuid';
|
|
26
22
|
if (typeof v === 'object')
|
|
27
|
-
return
|
|
28
|
-
return
|
|
23
|
+
return escapeLiteral(JSON.stringify(v)) + '::json';
|
|
24
|
+
return escapeLiteral('' + v);
|
|
29
25
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.wrapRowDescription = wrapRowDescription;
|
|
4
|
-
const constants_js_1 = require("../constants.js");
|
|
5
|
-
function wrapRowDescription(typeMap, fields, columnFormat) {
|
|
1
|
+
import { DataFormat, DataTypeNames } from '../constants.js';
|
|
2
|
+
export function wrapRowDescription(typeMap, fields, columnFormat) {
|
|
6
3
|
return fields.map((f, idx) => {
|
|
7
4
|
const cf = Array.isArray(columnFormat) ? columnFormat[idx] : columnFormat;
|
|
8
5
|
const x = {
|
|
@@ -10,14 +7,14 @@ function wrapRowDescription(typeMap, fields, columnFormat) {
|
|
|
10
7
|
tableId: f.tableId,
|
|
11
8
|
columnId: f.columnId,
|
|
12
9
|
dataTypeId: f.dataTypeId,
|
|
13
|
-
dataTypeName:
|
|
14
|
-
jsType: cf ===
|
|
10
|
+
dataTypeName: DataTypeNames[f.dataTypeId] || '',
|
|
11
|
+
jsType: cf === DataFormat.binary ? 'Buffer' : 'string',
|
|
15
12
|
};
|
|
16
13
|
x.isArray = x.dataTypeName.startsWith('_');
|
|
17
14
|
if (x.isArray) {
|
|
18
15
|
x.elementDataTypeName = x.dataTypeName.substring(1);
|
|
19
|
-
for (const oid of Object.keys(
|
|
20
|
-
if (
|
|
16
|
+
for (const oid of Object.keys(DataTypeNames)) {
|
|
17
|
+
if (DataTypeNames[oid] === x.elementDataTypeName)
|
|
21
18
|
x.elementDataTypeId = parseInt(oid, 10);
|
|
22
19
|
}
|
|
23
20
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postgrejs",
|
|
3
3
|
"description": "Professional PostgreSQL client NodeJS",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.17.0",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"doublylinked": "^2.5.4",
|
|
9
9
|
"lightning-pool": "^4.5.0",
|
|
10
10
|
"postgres-bytea": "^3.0.0",
|
|
11
|
-
"power-tasks": "^1.
|
|
11
|
+
"power-tasks": "^1.9.0",
|
|
12
12
|
"putil-merge": "^3.13.0",
|
|
13
13
|
"putil-promisify": "^1.10.1",
|
|
14
14
|
"putil-varhelpers": "^1.6.5",
|