postgrejs 2.15.2 → 2.16.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 (143) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/esm/connection/bind-param.js +5 -1
  3. package/esm/connection/connection.js +20 -16
  4. package/esm/connection/cursor.js +15 -10
  5. package/esm/connection/intl-connection.js +46 -41
  6. package/esm/connection/pool.js +32 -28
  7. package/esm/connection/portal.js +31 -27
  8. package/esm/connection/prepared-statement.js +35 -31
  9. package/esm/constants.js +125 -122
  10. package/esm/data-type-map.js +75 -71
  11. package/esm/data-types/bool-type.js +10 -7
  12. package/esm/data-types/box-type.js +10 -7
  13. package/esm/data-types/bytea-type.js +13 -9
  14. package/esm/data-types/char-type.js +10 -7
  15. package/esm/data-types/circle-type.js +10 -7
  16. package/esm/data-types/date-type.js +15 -12
  17. package/esm/data-types/float4-type.js +10 -7
  18. package/esm/data-types/float8-type.js +10 -7
  19. package/esm/data-types/int2-type.js +13 -10
  20. package/esm/data-types/int2-vector-type.js +16 -13
  21. package/esm/data-types/int4-type.js +13 -10
  22. package/esm/data-types/int8-type.js +12 -9
  23. package/esm/data-types/json-type.js +12 -9
  24. package/esm/data-types/jsonb-type.js +14 -11
  25. package/esm/data-types/lseg-type.js +10 -7
  26. package/esm/data-types/numeric-type.js +12 -8
  27. package/esm/data-types/oid-type.js +18 -15
  28. package/esm/data-types/point-type.js +10 -7
  29. package/esm/data-types/time-type.js +16 -13
  30. package/esm/data-types/timestamp-type.js +15 -12
  31. package/esm/data-types/timestamptz-type.js +15 -12
  32. package/esm/data-types/uuid-type.js +10 -7
  33. package/esm/data-types/varchar-type.js +10 -7
  34. package/esm/index.js +28 -25
  35. package/esm/interfaces/command-result.js +2 -1
  36. package/esm/interfaces/data-mapping-options.js +2 -1
  37. package/esm/interfaces/data-type.js +2 -1
  38. package/esm/interfaces/database-connection-params.js +2 -1
  39. package/esm/interfaces/field-info.js +2 -1
  40. package/esm/interfaces/query-options.js +2 -1
  41. package/esm/interfaces/query-result.js +2 -1
  42. package/esm/interfaces/script-execute-options.js +2 -1
  43. package/esm/interfaces/script-result.js +2 -1
  44. package/esm/interfaces/statement-prepare-options.js +2 -1
  45. package/esm/protocol/backend.js +28 -24
  46. package/esm/protocol/buffer-reader.js +5 -1
  47. package/esm/protocol/database-error.js +5 -1
  48. package/esm/protocol/frontend.js +31 -27
  49. package/esm/protocol/pg-socket.js +53 -48
  50. package/esm/protocol/protocol.js +5 -2
  51. package/esm/protocol/sasl.js +11 -7
  52. package/esm/protocol/smart-buffer.js +10 -5
  53. package/esm/safe-event-emitter.js +6 -2
  54. package/esm/types.js +2 -1
  55. package/esm/util/array-calculatedim.js +4 -1
  56. package/esm/util/bigint-methods.js +6 -2
  57. package/esm/util/config-from-env.js +8 -5
  58. package/esm/util/connection-config.js +13 -8
  59. package/esm/util/convert-row-to-object.js +4 -1
  60. package/esm/util/decode-binaryarray.js +6 -3
  61. package/esm/util/encode-binaryarray.js +8 -5
  62. package/esm/util/escape-literal.js +4 -1
  63. package/esm/util/fast-parseint.js +4 -1
  64. package/esm/util/get-parsers.js +11 -8
  65. package/esm/util/parse-array.js +4 -1
  66. package/esm/util/parse-datetime.js +8 -5
  67. package/esm/util/parse-row.js +4 -1
  68. package/esm/util/parse-time.js +12 -8
  69. package/esm/util/stringify-arrayliteral.js +6 -3
  70. package/esm/util/stringify-for-sql.js +12 -8
  71. package/esm/util/wrap-row-description.js +9 -6
  72. package/package.json +23 -16
  73. package/cjs/package.json +0 -3
  74. /package/{typings → types}/connection/bind-param.d.ts +0 -0
  75. /package/{typings → types}/connection/connection.d.ts +0 -0
  76. /package/{typings → types}/connection/cursor.d.ts +0 -0
  77. /package/{typings → types}/connection/intl-connection.d.ts +0 -0
  78. /package/{typings → types}/connection/pool.d.ts +0 -0
  79. /package/{typings → types}/connection/portal.d.ts +0 -0
  80. /package/{typings → types}/connection/prepared-statement.d.ts +0 -0
  81. /package/{typings → types}/constants.d.ts +0 -0
  82. /package/{typings → types}/data-type-map.d.ts +0 -0
  83. /package/{typings → types}/data-types/bool-type.d.ts +0 -0
  84. /package/{typings → types}/data-types/box-type.d.ts +0 -0
  85. /package/{typings → types}/data-types/bytea-type.d.ts +0 -0
  86. /package/{typings → types}/data-types/char-type.d.ts +0 -0
  87. /package/{typings → types}/data-types/circle-type.d.ts +0 -0
  88. /package/{typings → types}/data-types/date-type.d.ts +0 -0
  89. /package/{typings → types}/data-types/float4-type.d.ts +0 -0
  90. /package/{typings → types}/data-types/float8-type.d.ts +0 -0
  91. /package/{typings → types}/data-types/int2-type.d.ts +0 -0
  92. /package/{typings → types}/data-types/int2-vector-type.d.ts +0 -0
  93. /package/{typings → types}/data-types/int4-type.d.ts +0 -0
  94. /package/{typings → types}/data-types/int8-type.d.ts +0 -0
  95. /package/{typings → types}/data-types/json-type.d.ts +0 -0
  96. /package/{typings → types}/data-types/jsonb-type.d.ts +0 -0
  97. /package/{typings → types}/data-types/lseg-type.d.ts +0 -0
  98. /package/{typings → types}/data-types/numeric-type.d.ts +0 -0
  99. /package/{typings → types}/data-types/oid-type.d.ts +0 -0
  100. /package/{typings → types}/data-types/point-type.d.ts +0 -0
  101. /package/{typings → types}/data-types/time-type.d.ts +0 -0
  102. /package/{typings → types}/data-types/timestamp-type.d.ts +0 -0
  103. /package/{typings → types}/data-types/timestamptz-type.d.ts +0 -0
  104. /package/{typings → types}/data-types/uuid-type.d.ts +0 -0
  105. /package/{typings → types}/data-types/varchar-type.d.ts +0 -0
  106. /package/{typings → types}/index.d.ts +0 -0
  107. /package/{typings → types}/interfaces/command-result.d.ts +0 -0
  108. /package/{typings → types}/interfaces/data-mapping-options.d.ts +0 -0
  109. /package/{typings → types}/interfaces/data-type.d.ts +0 -0
  110. /package/{typings → types}/interfaces/database-connection-params.d.ts +0 -0
  111. /package/{typings → types}/interfaces/field-info.d.ts +0 -0
  112. /package/{typings → types}/interfaces/query-options.d.ts +0 -0
  113. /package/{typings → types}/interfaces/query-result.d.ts +0 -0
  114. /package/{typings → types}/interfaces/script-execute-options.d.ts +0 -0
  115. /package/{typings → types}/interfaces/script-result.d.ts +0 -0
  116. /package/{typings → types}/interfaces/statement-prepare-options.d.ts +0 -0
  117. /package/{typings → types}/protocol/backend.d.ts +0 -0
  118. /package/{typings → types}/protocol/buffer-reader.d.ts +0 -0
  119. /package/{typings → types}/protocol/database-error.d.ts +0 -0
  120. /package/{typings → types}/protocol/frontend.d.ts +0 -0
  121. /package/{typings → types}/protocol/pg-socket.d.ts +0 -0
  122. /package/{typings → types}/protocol/protocol.d.ts +0 -0
  123. /package/{typings → types}/protocol/sasl.d.ts +0 -0
  124. /package/{typings → types}/protocol/smart-buffer.d.ts +0 -0
  125. /package/{typings → types}/safe-event-emitter.d.ts +0 -0
  126. /package/{typings → types}/types.d.ts +0 -0
  127. /package/{typings → types}/util/array-calculatedim.d.ts +0 -0
  128. /package/{typings → types}/util/bigint-methods.d.ts +0 -0
  129. /package/{typings → types}/util/config-from-env.d.ts +0 -0
  130. /package/{typings → types}/util/connection-config.d.ts +0 -0
  131. /package/{typings → types}/util/convert-row-to-object.d.ts +0 -0
  132. /package/{typings → types}/util/decode-binaryarray.d.ts +0 -0
  133. /package/{typings → types}/util/encode-binaryarray.d.ts +0 -0
  134. /package/{typings → types}/util/escape-literal.d.ts +0 -0
  135. /package/{typings → types}/util/fast-parseint.d.ts +0 -0
  136. /package/{typings → types}/util/get-parsers.d.ts +0 -0
  137. /package/{typings → types}/util/parse-array.d.ts +0 -0
  138. /package/{typings → types}/util/parse-datetime.d.ts +0 -0
  139. /package/{typings → types}/util/parse-row.d.ts +0 -0
  140. /package/{typings → types}/util/parse-time.d.ts +0 -0
  141. /package/{typings → types}/util/stringify-arrayliteral.d.ts +0 -0
  142. /package/{typings → types}/util/stringify-for-sql.d.ts +0 -0
  143. /package/{typings → types}/util/wrap-row-description.d.ts +0 -0
@@ -1,6 +1,9 @@
1
- import { arrayCalculateDim } from './array-calculatedim.js';
2
- export function stringifyArrayLiteral(value, options, encode) {
3
- const dim = arrayCalculateDim(value);
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);
4
7
  const writeDim = (arr, level) => {
5
8
  const elemCount = dim[level];
6
9
  const out = [];
@@ -1,10 +1,14 @@
1
- import { UuidType } from '../data-types/uuid-type.js';
2
- import { escapeLiteral } from './escape-literal.js';
3
- export function stringifyArrayForSQL(v, options, encode) {
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) {
4
8
  const arr = v.map(x => stringifyValueForSQL(x, options, encode));
5
9
  return 'ARRAY[' + arr.join(',') + ']';
6
10
  }
7
- export function stringifyValueForSQL(v, options, encode) {
11
+ function stringifyValueForSQL(v, options, encode) {
8
12
  if (v == null)
9
13
  return 'null';
10
14
  if (typeof v === 'boolean')
@@ -17,9 +21,9 @@ export function stringifyValueForSQL(v, options, encode) {
17
21
  return '' + v;
18
22
  if (typeof v === 'bigint')
19
23
  return v.toString();
20
- if (typeof v === 'string' && UuidType.isType(v))
21
- return escapeLiteral('' + v) + '::uuid';
24
+ if (typeof v === 'string' && uuid_type_js_1.UuidType.isType(v))
25
+ return (0, escape_literal_js_1.escapeLiteral)('' + v) + '::uuid';
22
26
  if (typeof v === 'object')
23
- return escapeLiteral(JSON.stringify(v)) + '::json';
24
- return escapeLiteral('' + v);
27
+ return (0, escape_literal_js_1.escapeLiteral)(JSON.stringify(v)) + '::json';
28
+ return (0, escape_literal_js_1.escapeLiteral)('' + v);
25
29
  }
@@ -1,5 +1,8 @@
1
- import { DataFormat, DataTypeNames } from '../constants.js';
2
- export function wrapRowDescription(typeMap, fields, columnFormat) {
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) {
3
6
  return fields.map((f, idx) => {
4
7
  const cf = Array.isArray(columnFormat) ? columnFormat[idx] : columnFormat;
5
8
  const x = {
@@ -7,14 +10,14 @@ export function wrapRowDescription(typeMap, fields, columnFormat) {
7
10
  tableId: f.tableId,
8
11
  columnId: f.columnId,
9
12
  dataTypeId: f.dataTypeId,
10
- dataTypeName: DataTypeNames[f.dataTypeId] || '',
11
- jsType: cf === DataFormat.binary ? 'Buffer' : 'string',
13
+ dataTypeName: constants_js_1.DataTypeNames[f.dataTypeId] || '',
14
+ jsType: cf === constants_js_1.DataFormat.binary ? 'Buffer' : 'string',
12
15
  };
13
16
  x.isArray = x.dataTypeName.startsWith('_');
14
17
  if (x.isArray) {
15
18
  x.elementDataTypeName = x.dataTypeName.substring(1);
16
- for (const oid of Object.keys(DataTypeNames)) {
17
- if (DataTypeNames[oid] === x.elementDataTypeName)
19
+ for (const oid of Object.keys(constants_js_1.DataTypeNames)) {
20
+ if (constants_js_1.DataTypeNames[oid] === x.elementDataTypeName)
18
21
  x.elementDataTypeId = parseInt(oid, 10);
19
22
  }
20
23
  }
package/package.json CHANGED
@@ -1,37 +1,44 @@
1
1
  {
2
2
  "name": "postgrejs",
3
3
  "description": "Professional PostgreSQL client NodeJS",
4
- "version": "2.15.2",
4
+ "version": "2.16.0",
5
5
  "author": "Panates",
6
+ "license": "MIT",
7
+ "dependencies": {
8
+ "doublylinked": "^2.5.4",
9
+ "lightning-pool": "^4.5.0",
10
+ "postgres-bytea": "^3.0.0",
11
+ "power-tasks": "^1.8.0",
12
+ "putil-merge": "^3.13.0",
13
+ "putil-promisify": "^1.10.1",
14
+ "putil-varhelpers": "^1.6.5",
15
+ "tslib": "^2.6.3"
16
+ },
17
+ "main": "./cjs/index.js",
18
+ "module": "./esm/index.js",
19
+ "types": "./types/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "require": "./cjs/index.js",
23
+ "import": "./esm/index.js",
24
+ "types": "./types/index.d.ts"
25
+ }
26
+ },
6
27
  "homepage": "https://postgrejs.panates.com/",
7
28
  "contributors": [
8
29
  "Eray Hanoglu <e.hanoglu@panates.com>"
9
30
  ],
10
- "license": "MIT",
11
31
  "repository": {
12
32
  "type": "git",
13
33
  "url": "https://github.com/panates/postgrejs.git"
14
34
  },
15
- "type": "module",
16
- "main": "./cjs/index.js",
17
- "module": "./esm/index.js",
18
- "types": "typings/index.d.ts",
19
- "dependencies": {
20
- "doublylinked": "^2.5.4",
21
- "lightning-pool": "^4.2.2",
22
- "postgres-bytea": "^3.0.0",
23
- "power-tasks": "^1.7.4",
24
- "putil-merge": "^3.12.1",
25
- "putil-promisify": "^1.10.1",
26
- "putil-varhelpers": "^1.6.5"
27
- },
28
35
  "engines": {
29
36
  "node": ">=16.0"
30
37
  },
31
38
  "files": [
32
39
  "cjs/",
33
40
  "esm/",
34
- "typings/",
41
+ "types/",
35
42
  "LICENSE",
36
43
  "README.md",
37
44
  "CHANGELOG.md"
package/cjs/package.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes