postgrejs 2.22.9 → 2.23.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 (216) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/{esm/connection → connection}/bind-param.js +2 -0
  3. package/{esm/connection → connection}/connection.js +4 -2
  4. package/{esm/connection → connection}/cursor.js +8 -3
  5. package/{esm/connection → connection}/intl-connection.js +6 -3
  6. package/{esm/connection → connection}/pool.js +4 -1
  7. package/{esm/connection → connection}/portal.js +3 -1
  8. package/{esm/connection → connection}/prepared-statement.js +6 -3
  9. package/{esm/constants.js → constants.js} +1 -1
  10. package/{esm/data-type-map.js → data-type-map.js} +2 -2
  11. package/package.json +12 -31
  12. package/{esm/protocol → protocol}/backend.js +1 -0
  13. package/{esm/protocol → protocol}/buffer-reader.js +2 -1
  14. package/{esm/protocol → protocol}/database-error.js +16 -0
  15. package/{esm/protocol → protocol}/frontend.js +1 -0
  16. package/{esm/protocol → protocol}/pg-socket.js +9 -3
  17. package/{esm/protocol → protocol}/smart-buffer.js +9 -5
  18. package/{esm/util → util}/bigint-methods.js +1 -0
  19. package/cjs/connection/bind-param.js +0 -10
  20. package/cjs/connection/connection.js +0 -295
  21. package/cjs/connection/cursor.js +0 -91
  22. package/cjs/connection/intl-connection.js +0 -258
  23. package/cjs/connection/pool.js +0 -236
  24. package/cjs/connection/portal.js +0 -157
  25. package/cjs/connection/prepared-statement.js +0 -226
  26. package/cjs/constants.js +0 -249
  27. package/cjs/data-type-map.js +0 -131
  28. package/cjs/data-types/bool-type.js +0 -33
  29. package/cjs/data-types/box-type.js +0 -52
  30. package/cjs/data-types/bytea-type.js +0 -28
  31. package/cjs/data-types/char-type.js +0 -27
  32. package/cjs/data-types/circle-type.js +0 -51
  33. package/cjs/data-types/date-type.js +0 -75
  34. package/cjs/data-types/float4-type.js +0 -25
  35. package/cjs/data-types/float8-type.js +0 -25
  36. package/cjs/data-types/int2-type.js +0 -26
  37. package/cjs/data-types/int2-vector-type.js +0 -42
  38. package/cjs/data-types/int4-type.js +0 -28
  39. package/cjs/data-types/int8-type.js +0 -36
  40. package/cjs/data-types/json-type.js +0 -40
  41. package/cjs/data-types/jsonb-type.js +0 -44
  42. package/cjs/data-types/lseg-type.js +0 -55
  43. package/cjs/data-types/numeric-type.js +0 -125
  44. package/cjs/data-types/oid-type.js +0 -32
  45. package/cjs/data-types/point-type.js +0 -42
  46. package/cjs/data-types/time-type.js +0 -66
  47. package/cjs/data-types/timestamp-type.js +0 -89
  48. package/cjs/data-types/timestamptz-type.js +0 -76
  49. package/cjs/data-types/uuid-type.js +0 -39
  50. package/cjs/data-types/varchar-type.js +0 -27
  51. package/cjs/index.js +0 -28
  52. package/cjs/interfaces/command-result.js +0 -2
  53. package/cjs/interfaces/data-mapping-options.js +0 -2
  54. package/cjs/interfaces/data-type.js +0 -2
  55. package/cjs/interfaces/database-connection-params.js +0 -2
  56. package/cjs/interfaces/field-info.js +0 -2
  57. package/cjs/interfaces/query-options.js +0 -2
  58. package/cjs/interfaces/query-result.js +0 -2
  59. package/cjs/interfaces/script-execute-options.js +0 -2
  60. package/cjs/interfaces/script-result.js +0 -2
  61. package/cjs/interfaces/statement-prepare-options.js +0 -2
  62. package/cjs/package.json +0 -3
  63. package/cjs/protocol/backend.js +0 -262
  64. package/cjs/protocol/buffer-reader.js +0 -78
  65. package/cjs/protocol/database-error.js +0 -17
  66. package/cjs/protocol/frontend.js +0 -255
  67. package/cjs/protocol/pg-socket.js +0 -367
  68. package/cjs/protocol/protocol.js +0 -71
  69. package/cjs/protocol/sasl.js +0 -108
  70. package/cjs/protocol/smart-buffer.js +0 -178
  71. package/cjs/safe-event-emitter.js +0 -17
  72. package/cjs/tsconfig-build-cjs.tsbuildinfo +0 -1
  73. package/cjs/types.js +0 -2
  74. package/cjs/util/array-calculatedim.js +0 -18
  75. package/cjs/util/bigint-methods.js +0 -44
  76. package/cjs/util/config-from-env.js +0 -29
  77. package/cjs/util/connection-config.js +0 -61
  78. package/cjs/util/convert-row-to-object.js +0 -12
  79. package/cjs/util/decode-binaryarray.js +0 -38
  80. package/cjs/util/encode-binaryarray.js +0 -44
  81. package/cjs/util/escape-literal.js +0 -26
  82. package/cjs/util/fast-parseint.js +0 -31
  83. package/cjs/util/get-parsers.js +0 -41
  84. package/cjs/util/parse-array.js +0 -60
  85. package/cjs/util/parse-datetime.js +0 -37
  86. package/cjs/util/parse-row.js +0 -11
  87. package/cjs/util/parse-time.js +0 -30
  88. package/cjs/util/stringify-arrayliteral.js +0 -37
  89. package/cjs/util/stringify-for-sql.js +0 -29
  90. package/cjs/util/wrap-row-description.js +0 -34
  91. package/esm/package.json +0 -3
  92. package/types/index.d.cts +0 -25
  93. /package/{types/connection → connection}/bind-param.d.ts +0 -0
  94. /package/{types/connection → connection}/connection.d.ts +0 -0
  95. /package/{types/connection → connection}/cursor.d.ts +0 -0
  96. /package/{types/connection → connection}/intl-connection.d.ts +0 -0
  97. /package/{types/connection → connection}/pool.d.ts +0 -0
  98. /package/{types/connection → connection}/portal.d.ts +0 -0
  99. /package/{types/connection → connection}/prepared-statement.d.ts +0 -0
  100. /package/{types/constants.d.ts → constants.d.ts} +0 -0
  101. /package/{types/data-type-map.d.ts → data-type-map.d.ts} +0 -0
  102. /package/{types/data-types → data-types}/bool-type.d.ts +0 -0
  103. /package/{esm/data-types → data-types}/bool-type.js +0 -0
  104. /package/{types/data-types → data-types}/box-type.d.ts +0 -0
  105. /package/{esm/data-types → data-types}/box-type.js +0 -0
  106. /package/{types/data-types → data-types}/bytea-type.d.ts +0 -0
  107. /package/{esm/data-types → data-types}/bytea-type.js +0 -0
  108. /package/{types/data-types → data-types}/char-type.d.ts +0 -0
  109. /package/{esm/data-types → data-types}/char-type.js +0 -0
  110. /package/{types/data-types → data-types}/circle-type.d.ts +0 -0
  111. /package/{esm/data-types → data-types}/circle-type.js +0 -0
  112. /package/{types/data-types → data-types}/date-type.d.ts +0 -0
  113. /package/{esm/data-types → data-types}/date-type.js +0 -0
  114. /package/{types/data-types → data-types}/float4-type.d.ts +0 -0
  115. /package/{esm/data-types → data-types}/float4-type.js +0 -0
  116. /package/{types/data-types → data-types}/float8-type.d.ts +0 -0
  117. /package/{esm/data-types → data-types}/float8-type.js +0 -0
  118. /package/{types/data-types → data-types}/int2-type.d.ts +0 -0
  119. /package/{esm/data-types → data-types}/int2-type.js +0 -0
  120. /package/{types/data-types → data-types}/int2-vector-type.d.ts +0 -0
  121. /package/{esm/data-types → data-types}/int2-vector-type.js +0 -0
  122. /package/{types/data-types → data-types}/int4-type.d.ts +0 -0
  123. /package/{esm/data-types → data-types}/int4-type.js +0 -0
  124. /package/{types/data-types → data-types}/int8-type.d.ts +0 -0
  125. /package/{esm/data-types → data-types}/int8-type.js +0 -0
  126. /package/{types/data-types → data-types}/json-type.d.ts +0 -0
  127. /package/{esm/data-types → data-types}/json-type.js +0 -0
  128. /package/{types/data-types → data-types}/jsonb-type.d.ts +0 -0
  129. /package/{esm/data-types → data-types}/jsonb-type.js +0 -0
  130. /package/{types/data-types → data-types}/lseg-type.d.ts +0 -0
  131. /package/{esm/data-types → data-types}/lseg-type.js +0 -0
  132. /package/{types/data-types → data-types}/numeric-type.d.ts +0 -0
  133. /package/{esm/data-types → data-types}/numeric-type.js +0 -0
  134. /package/{types/data-types → data-types}/oid-type.d.ts +0 -0
  135. /package/{esm/data-types → data-types}/oid-type.js +0 -0
  136. /package/{types/data-types → data-types}/point-type.d.ts +0 -0
  137. /package/{esm/data-types → data-types}/point-type.js +0 -0
  138. /package/{types/data-types → data-types}/time-type.d.ts +0 -0
  139. /package/{esm/data-types → data-types}/time-type.js +0 -0
  140. /package/{types/data-types → data-types}/timestamp-type.d.ts +0 -0
  141. /package/{esm/data-types → data-types}/timestamp-type.js +0 -0
  142. /package/{types/data-types → data-types}/timestamptz-type.d.ts +0 -0
  143. /package/{esm/data-types → data-types}/timestamptz-type.js +0 -0
  144. /package/{types/data-types → data-types}/uuid-type.d.ts +0 -0
  145. /package/{esm/data-types → data-types}/uuid-type.js +0 -0
  146. /package/{types/data-types → data-types}/varchar-type.d.ts +0 -0
  147. /package/{esm/data-types → data-types}/varchar-type.js +0 -0
  148. /package/{types/index.d.ts → index.d.ts} +0 -0
  149. /package/{esm/index.js → index.js} +0 -0
  150. /package/{types/interfaces → interfaces}/command-result.d.ts +0 -0
  151. /package/{esm/interfaces → interfaces}/command-result.js +0 -0
  152. /package/{types/interfaces → interfaces}/data-mapping-options.d.ts +0 -0
  153. /package/{esm/interfaces → interfaces}/data-mapping-options.js +0 -0
  154. /package/{types/interfaces → interfaces}/data-type.d.ts +0 -0
  155. /package/{esm/interfaces → interfaces}/data-type.js +0 -0
  156. /package/{types/interfaces → interfaces}/database-connection-params.d.ts +0 -0
  157. /package/{esm/interfaces → interfaces}/database-connection-params.js +0 -0
  158. /package/{types/interfaces → interfaces}/field-info.d.ts +0 -0
  159. /package/{esm/interfaces → interfaces}/field-info.js +0 -0
  160. /package/{types/interfaces → interfaces}/query-options.d.ts +0 -0
  161. /package/{esm/interfaces → interfaces}/query-options.js +0 -0
  162. /package/{types/interfaces → interfaces}/query-result.d.ts +0 -0
  163. /package/{esm/interfaces → interfaces}/query-result.js +0 -0
  164. /package/{types/interfaces → interfaces}/script-execute-options.d.ts +0 -0
  165. /package/{esm/interfaces → interfaces}/script-execute-options.js +0 -0
  166. /package/{types/interfaces → interfaces}/script-result.d.ts +0 -0
  167. /package/{esm/interfaces → interfaces}/script-result.js +0 -0
  168. /package/{types/interfaces → interfaces}/statement-prepare-options.d.ts +0 -0
  169. /package/{esm/interfaces → interfaces}/statement-prepare-options.js +0 -0
  170. /package/{types/protocol → protocol}/backend.d.ts +0 -0
  171. /package/{types/protocol → protocol}/buffer-reader.d.ts +0 -0
  172. /package/{types/protocol → protocol}/database-error.d.ts +0 -0
  173. /package/{types/protocol → protocol}/frontend.d.ts +0 -0
  174. /package/{types/protocol → protocol}/pg-socket.d.ts +0 -0
  175. /package/{types/protocol → protocol}/protocol.d.ts +0 -0
  176. /package/{esm/protocol → protocol}/protocol.js +0 -0
  177. /package/{types/protocol → protocol}/sasl.d.ts +0 -0
  178. /package/{esm/protocol → protocol}/sasl.js +0 -0
  179. /package/{types/protocol → protocol}/smart-buffer.d.ts +0 -0
  180. /package/{types/safe-event-emitter.d.ts → safe-event-emitter.d.ts} +0 -0
  181. /package/{esm/safe-event-emitter.js → safe-event-emitter.js} +0 -0
  182. /package/{types/types.d.ts → types.d.ts} +0 -0
  183. /package/{esm/types.js → types.js} +0 -0
  184. /package/{types/util → util}/array-calculatedim.d.ts +0 -0
  185. /package/{esm/util → util}/array-calculatedim.js +0 -0
  186. /package/{types/util → util}/bigint-methods.d.ts +0 -0
  187. /package/{types/util → util}/config-from-env.d.ts +0 -0
  188. /package/{esm/util → util}/config-from-env.js +0 -0
  189. /package/{types/util → util}/connection-config.d.ts +0 -0
  190. /package/{esm/util → util}/connection-config.js +0 -0
  191. /package/{types/util → util}/convert-row-to-object.d.ts +0 -0
  192. /package/{esm/util → util}/convert-row-to-object.js +0 -0
  193. /package/{types/util → util}/decode-binaryarray.d.ts +0 -0
  194. /package/{esm/util → util}/decode-binaryarray.js +0 -0
  195. /package/{types/util → util}/encode-binaryarray.d.ts +0 -0
  196. /package/{esm/util → util}/encode-binaryarray.js +0 -0
  197. /package/{types/util → util}/escape-literal.d.ts +0 -0
  198. /package/{esm/util → util}/escape-literal.js +0 -0
  199. /package/{types/util → util}/fast-parseint.d.ts +0 -0
  200. /package/{esm/util → util}/fast-parseint.js +0 -0
  201. /package/{types/util → util}/get-parsers.d.ts +0 -0
  202. /package/{esm/util → util}/get-parsers.js +0 -0
  203. /package/{types/util → util}/parse-array.d.ts +0 -0
  204. /package/{esm/util → util}/parse-array.js +0 -0
  205. /package/{types/util → util}/parse-datetime.d.ts +0 -0
  206. /package/{esm/util → util}/parse-datetime.js +0 -0
  207. /package/{types/util → util}/parse-row.d.ts +0 -0
  208. /package/{esm/util → util}/parse-row.js +0 -0
  209. /package/{types/util → util}/parse-time.d.ts +0 -0
  210. /package/{esm/util → util}/parse-time.js +0 -0
  211. /package/{types/util → util}/stringify-arrayliteral.d.ts +0 -0
  212. /package/{esm/util → util}/stringify-arrayliteral.js +0 -0
  213. /package/{types/util → util}/stringify-for-sql.d.ts +0 -0
  214. /package/{esm/util → util}/stringify-for-sql.js +0 -0
  215. /package/{types/util → util}/wrap-row-description.d.ts +0 -0
  216. /package/{esm/util → util}/wrap-row-description.js +0 -0
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TIME_PATTERN = exports.STRICT_TIME_PATTERN = void 0;
4
- exports.parseTime = parseTime;
5
- const fast_parseint_js_1 = require("./fast-parseint.js");
6
- // noinspection RegExpUnnecessaryNonCapturingGroup
7
- exports.STRICT_TIME_PATTERN = /^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(?:\.(\d+))?(?:(Z)|(?:([+-])([01]?[0-9]|2[0-3]):?([0-5][0-9])?))?$/;
8
- // noinspection RegExpUnnecessaryNonCapturingGroup
9
- exports.TIME_PATTERN = /^([01][0-9]|2[0-3]):?([0-5][0-9]):?([0-5][0-9])?(?:\.(\d+))?(?:(Z)|(?:([+-])([01]?[0-9]|2[0-3]):?([0-5][0-9])?))?$/;
10
- function parseTime(str, parseTimeZone, utc) {
11
- const m = str.match(exports.TIME_PATTERN);
12
- if (!m)
13
- return new Date('invalid');
14
- const args = [
15
- 1970, 0, 1, 0, 0, 0, 0,
16
- ];
17
- for (let i = 1; i < 4; i++) {
18
- const s = m[i];
19
- args[i + 2] = (0, fast_parseint_js_1.fastParseInt)(s) || 0;
20
- }
21
- if (parseTimeZone && m[6]) {
22
- const r = m[9] === '-' ? -1 : 1;
23
- args[3] -= ((0, fast_parseint_js_1.fastParseInt)(m[7]) || 0) * r;
24
- args[4] -= ((0, fast_parseint_js_1.fastParseInt)(m[8]) || 0) * r;
25
- return new Date(Date.UTC(...args));
26
- }
27
- if (m[5] || utc)
28
- return new Date(Date.UTC(...args));
29
- return new Date(...args);
30
- }
@@ -1,37 +0,0 @@
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);
7
- const writeDim = (arr, level) => {
8
- const elemCount = dim[level];
9
- const out = [];
10
- for (let i = 0; i < elemCount; i++) {
11
- let x = arr && arr[i];
12
- if (level < dim.length - 1) {
13
- if (x != null && !Array.isArray(x))
14
- x = [x];
15
- out.push(writeDim(x, level + 1));
16
- continue;
17
- }
18
- // if value is null
19
- if (x == null) {
20
- out.push('NULL');
21
- continue;
22
- }
23
- if (Array.isArray(x)) {
24
- out.push(stringifyArrayLiteral(x, options, encode));
25
- continue;
26
- }
27
- if (encode)
28
- x = encode(x, options || {});
29
- out.push(escapeArrayItem('' + x));
30
- }
31
- return '{' + out.join(',') + '}';
32
- };
33
- return writeDim(value, 0);
34
- }
35
- function escapeArrayItem(str) {
36
- return '"' + str.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"';
37
- }
@@ -1,29 +0,0 @@
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) {
8
- const arr = v.map(x => stringifyValueForSQL(x, options, encode));
9
- return 'ARRAY[' + arr.join(',') + ']';
10
- }
11
- function stringifyValueForSQL(v, options, encode) {
12
- if (v == null)
13
- return 'null';
14
- if (typeof v === 'boolean')
15
- return v ? 'true' : 'false';
16
- if (Array.isArray(v))
17
- return stringifyArrayForSQL(v, options, encode);
18
- if (encode)
19
- v = encode(v, options || {});
20
- if (typeof v === 'number')
21
- return '' + v;
22
- if (typeof v === 'bigint')
23
- 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';
26
- 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);
29
- }
@@ -1,34 +0,0 @@
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) {
6
- return fields.map((f, idx) => {
7
- const cf = Array.isArray(columnFormat) ? columnFormat[idx] : columnFormat;
8
- const x = {
9
- fieldName: f.fieldName,
10
- tableId: f.tableId,
11
- columnId: f.columnId,
12
- dataTypeId: f.dataTypeId,
13
- dataTypeName: constants_js_1.DataTypeNames[f.dataTypeId] || '',
14
- jsType: cf === constants_js_1.DataFormat.binary ? 'Buffer' : 'string',
15
- };
16
- x.isArray = x.dataTypeName.startsWith('_');
17
- if (x.isArray) {
18
- 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)
21
- x.elementDataTypeId = parseInt(oid, 10);
22
- }
23
- }
24
- if (f.fixedSize && f.fixedSize > 0)
25
- x.fixedSize = f.fixedSize;
26
- if (f.modifier && f.modifier > 0)
27
- x.modifier = f.modifier;
28
- const reg = typeMap.get(x.dataTypeId);
29
- if (reg) {
30
- x.jsType = reg.jsType;
31
- }
32
- return x;
33
- });
34
- }
package/esm/package.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
package/types/index.d.cts DELETED
@@ -1,25 +0,0 @@
1
- export * from './connection/bind-param.js';
2
- export * from './connection/connection.js';
3
- export * from './connection/cursor.js';
4
- export * from './connection/pool.js';
5
- export * from './connection/prepared-statement.js';
6
- export * from './constants.js';
7
- export * from './data-type-map.js';
8
- export * from './interfaces/command-result.js';
9
- export * from './interfaces/data-mapping-options.js';
10
- export * from './interfaces/data-type.js';
11
- export * from './interfaces/database-connection-params.js';
12
- export * from './interfaces/field-info.js';
13
- export * from './interfaces/query-options.js';
14
- export * from './interfaces/query-result.js';
15
- export * from './interfaces/script-execute-options.js';
16
- export * from './interfaces/script-result.js';
17
- export * from './interfaces/statement-prepare-options.js';
18
- export * from './protocol/database-error.js';
19
- export * from './protocol/smart-buffer.js';
20
- export * from './types.js';
21
- export * from './util/connection-config.js';
22
- export * from './util/escape-literal.js';
23
- export * from './util/parse-datetime.js';
24
- export * from './util/stringify-arrayliteral.js';
25
- export * from './util/stringify-for-sql.js';
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
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