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.
Files changed (72) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/esm/connection/bind-param.js +1 -5
  3. package/esm/connection/connection.js +16 -20
  4. package/esm/connection/cursor.js +10 -15
  5. package/esm/connection/intl-connection.js +41 -46
  6. package/esm/connection/pool.js +28 -32
  7. package/esm/connection/portal.js +27 -31
  8. package/esm/connection/prepared-statement.js +31 -35
  9. package/esm/constants.js +122 -125
  10. package/esm/data-type-map.js +71 -75
  11. package/esm/data-types/bool-type.js +7 -10
  12. package/esm/data-types/box-type.js +7 -10
  13. package/esm/data-types/bytea-type.js +9 -13
  14. package/esm/data-types/char-type.js +7 -10
  15. package/esm/data-types/circle-type.js +7 -10
  16. package/esm/data-types/date-type.js +12 -15
  17. package/esm/data-types/float4-type.js +7 -10
  18. package/esm/data-types/float8-type.js +7 -10
  19. package/esm/data-types/int2-type.js +10 -13
  20. package/esm/data-types/int2-vector-type.js +13 -16
  21. package/esm/data-types/int4-type.js +10 -13
  22. package/esm/data-types/int8-type.js +9 -12
  23. package/esm/data-types/json-type.js +9 -12
  24. package/esm/data-types/jsonb-type.js +11 -14
  25. package/esm/data-types/lseg-type.js +7 -10
  26. package/esm/data-types/numeric-type.js +8 -12
  27. package/esm/data-types/oid-type.js +15 -18
  28. package/esm/data-types/point-type.js +7 -10
  29. package/esm/data-types/time-type.js +13 -16
  30. package/esm/data-types/timestamp-type.js +12 -15
  31. package/esm/data-types/timestamptz-type.js +12 -15
  32. package/esm/data-types/uuid-type.js +7 -10
  33. package/esm/data-types/varchar-type.js +7 -10
  34. package/esm/index.js +25 -28
  35. package/esm/interfaces/command-result.js +1 -2
  36. package/esm/interfaces/data-mapping-options.js +1 -2
  37. package/esm/interfaces/data-type.js +1 -2
  38. package/esm/interfaces/database-connection-params.js +1 -2
  39. package/esm/interfaces/field-info.js +1 -2
  40. package/esm/interfaces/query-options.js +1 -2
  41. package/esm/interfaces/query-result.js +1 -2
  42. package/esm/interfaces/script-execute-options.js +1 -2
  43. package/esm/interfaces/script-result.js +1 -2
  44. package/esm/interfaces/statement-prepare-options.js +1 -2
  45. package/esm/protocol/backend.js +24 -28
  46. package/esm/protocol/buffer-reader.js +1 -5
  47. package/esm/protocol/database-error.js +1 -5
  48. package/esm/protocol/frontend.js +27 -31
  49. package/esm/protocol/pg-socket.js +48 -53
  50. package/esm/protocol/protocol.js +2 -5
  51. package/esm/protocol/sasl.js +7 -11
  52. package/esm/protocol/smart-buffer.js +5 -10
  53. package/esm/safe-event-emitter.js +2 -6
  54. package/esm/types.js +1 -2
  55. package/esm/util/array-calculatedim.js +1 -4
  56. package/esm/util/bigint-methods.js +2 -6
  57. package/esm/util/config-from-env.js +5 -8
  58. package/esm/util/connection-config.js +8 -13
  59. package/esm/util/convert-row-to-object.js +1 -4
  60. package/esm/util/decode-binaryarray.js +3 -6
  61. package/esm/util/encode-binaryarray.js +5 -8
  62. package/esm/util/escape-literal.js +1 -4
  63. package/esm/util/fast-parseint.js +1 -4
  64. package/esm/util/get-parsers.js +8 -11
  65. package/esm/util/parse-array.js +1 -4
  66. package/esm/util/parse-datetime.js +5 -8
  67. package/esm/util/parse-row.js +1 -4
  68. package/esm/util/parse-time.js +8 -12
  69. package/esm/util/stringify-arrayliteral.js +3 -6
  70. package/esm/util/stringify-for-sql.js +8 -12
  71. package/esm/util/wrap-row-description.js +6 -9
  72. package/package.json +2 -2
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringifyArrayLiteral = stringifyArrayLiteral;
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringifyArrayForSQL = stringifyArrayForSQL;
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' && uuid_type_js_1.UuidType.isType(v))
25
- return (0, escape_literal_js_1.escapeLiteral)('' + v) + '::uuid';
20
+ if (typeof v === 'string' && UuidType.isType(v))
21
+ return escapeLiteral('' + v) + '::uuid';
26
22
  if (typeof v === 'object')
27
- return (0, escape_literal_js_1.escapeLiteral)(JSON.stringify(v)) + '::json';
28
- return (0, escape_literal_js_1.escapeLiteral)('' + v);
23
+ return escapeLiteral(JSON.stringify(v)) + '::json';
24
+ return escapeLiteral('' + v);
29
25
  }
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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: constants_js_1.DataTypeNames[f.dataTypeId] || '',
14
- jsType: cf === constants_js_1.DataFormat.binary ? 'Buffer' : 'string',
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(constants_js_1.DataTypeNames)) {
20
- if (constants_js_1.DataTypeNames[oid] === x.elementDataTypeName)
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.16.0",
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.8.0",
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",