postgrejs 2.22.9 → 2.23.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.
Files changed (216) hide show
  1. package/CHANGELOG.md +18 -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/{types/data-type-map.d.ts → data-type-map.d.ts} +2 -2
  11. package/{esm/data-type-map.js → data-type-map.js} +2 -2
  12. package/{esm/data-types → data-types}/int2-vector-type.js +1 -0
  13. package/{types/data-types → data-types}/timestamptz-type.d.ts +1 -1
  14. package/{esm/data-types → data-types}/timestamptz-type.js +1 -0
  15. package/package.json +12 -31
  16. package/{esm/protocol → protocol}/backend.js +1 -0
  17. package/{esm/protocol → protocol}/buffer-reader.js +2 -1
  18. package/{esm/protocol → protocol}/database-error.js +17 -0
  19. package/{esm/protocol → protocol}/frontend.js +2 -0
  20. package/{types/protocol → protocol}/pg-socket.d.ts +1 -1
  21. package/{esm/protocol → protocol}/pg-socket.js +9 -3
  22. package/{esm/protocol → protocol}/smart-buffer.js +9 -5
  23. package/{esm/util → util}/bigint-methods.js +1 -0
  24. package/cjs/connection/bind-param.js +0 -10
  25. package/cjs/connection/connection.js +0 -295
  26. package/cjs/connection/cursor.js +0 -91
  27. package/cjs/connection/intl-connection.js +0 -258
  28. package/cjs/connection/pool.js +0 -236
  29. package/cjs/connection/portal.js +0 -157
  30. package/cjs/connection/prepared-statement.js +0 -226
  31. package/cjs/constants.js +0 -249
  32. package/cjs/data-type-map.js +0 -131
  33. package/cjs/data-types/bool-type.js +0 -33
  34. package/cjs/data-types/box-type.js +0 -52
  35. package/cjs/data-types/bytea-type.js +0 -28
  36. package/cjs/data-types/char-type.js +0 -27
  37. package/cjs/data-types/circle-type.js +0 -51
  38. package/cjs/data-types/date-type.js +0 -75
  39. package/cjs/data-types/float4-type.js +0 -25
  40. package/cjs/data-types/float8-type.js +0 -25
  41. package/cjs/data-types/int2-type.js +0 -26
  42. package/cjs/data-types/int2-vector-type.js +0 -42
  43. package/cjs/data-types/int4-type.js +0 -28
  44. package/cjs/data-types/int8-type.js +0 -36
  45. package/cjs/data-types/json-type.js +0 -40
  46. package/cjs/data-types/jsonb-type.js +0 -44
  47. package/cjs/data-types/lseg-type.js +0 -55
  48. package/cjs/data-types/numeric-type.js +0 -125
  49. package/cjs/data-types/oid-type.js +0 -32
  50. package/cjs/data-types/point-type.js +0 -42
  51. package/cjs/data-types/time-type.js +0 -66
  52. package/cjs/data-types/timestamp-type.js +0 -89
  53. package/cjs/data-types/timestamptz-type.js +0 -76
  54. package/cjs/data-types/uuid-type.js +0 -39
  55. package/cjs/data-types/varchar-type.js +0 -27
  56. package/cjs/index.js +0 -28
  57. package/cjs/interfaces/command-result.js +0 -2
  58. package/cjs/interfaces/data-mapping-options.js +0 -2
  59. package/cjs/interfaces/data-type.js +0 -2
  60. package/cjs/interfaces/database-connection-params.js +0 -2
  61. package/cjs/interfaces/field-info.js +0 -2
  62. package/cjs/interfaces/query-options.js +0 -2
  63. package/cjs/interfaces/query-result.js +0 -2
  64. package/cjs/interfaces/script-execute-options.js +0 -2
  65. package/cjs/interfaces/script-result.js +0 -2
  66. package/cjs/interfaces/statement-prepare-options.js +0 -2
  67. package/cjs/package.json +0 -3
  68. package/cjs/protocol/backend.js +0 -262
  69. package/cjs/protocol/buffer-reader.js +0 -78
  70. package/cjs/protocol/database-error.js +0 -17
  71. package/cjs/protocol/frontend.js +0 -255
  72. package/cjs/protocol/pg-socket.js +0 -367
  73. package/cjs/protocol/protocol.js +0 -71
  74. package/cjs/protocol/sasl.js +0 -108
  75. package/cjs/protocol/smart-buffer.js +0 -178
  76. package/cjs/safe-event-emitter.js +0 -17
  77. package/cjs/tsconfig-build-cjs.tsbuildinfo +0 -1
  78. package/cjs/types.js +0 -2
  79. package/cjs/util/array-calculatedim.js +0 -18
  80. package/cjs/util/bigint-methods.js +0 -44
  81. package/cjs/util/config-from-env.js +0 -29
  82. package/cjs/util/connection-config.js +0 -61
  83. package/cjs/util/convert-row-to-object.js +0 -12
  84. package/cjs/util/decode-binaryarray.js +0 -38
  85. package/cjs/util/encode-binaryarray.js +0 -44
  86. package/cjs/util/escape-literal.js +0 -26
  87. package/cjs/util/fast-parseint.js +0 -31
  88. package/cjs/util/get-parsers.js +0 -41
  89. package/cjs/util/parse-array.js +0 -60
  90. package/cjs/util/parse-datetime.js +0 -37
  91. package/cjs/util/parse-row.js +0 -11
  92. package/cjs/util/parse-time.js +0 -30
  93. package/cjs/util/stringify-arrayliteral.js +0 -37
  94. package/cjs/util/stringify-for-sql.js +0 -29
  95. package/cjs/util/wrap-row-description.js +0 -34
  96. package/esm/package.json +0 -3
  97. package/types/index.d.cts +0 -25
  98. /package/{types/connection → connection}/bind-param.d.ts +0 -0
  99. /package/{types/connection → connection}/connection.d.ts +0 -0
  100. /package/{types/connection → connection}/cursor.d.ts +0 -0
  101. /package/{types/connection → connection}/intl-connection.d.ts +0 -0
  102. /package/{types/connection → connection}/pool.d.ts +0 -0
  103. /package/{types/connection → connection}/portal.d.ts +0 -0
  104. /package/{types/connection → connection}/prepared-statement.d.ts +0 -0
  105. /package/{types/constants.d.ts → constants.d.ts} +0 -0
  106. /package/{types/data-types → data-types}/bool-type.d.ts +0 -0
  107. /package/{esm/data-types → data-types}/bool-type.js +0 -0
  108. /package/{types/data-types → data-types}/box-type.d.ts +0 -0
  109. /package/{esm/data-types → data-types}/box-type.js +0 -0
  110. /package/{types/data-types → data-types}/bytea-type.d.ts +0 -0
  111. /package/{esm/data-types → data-types}/bytea-type.js +0 -0
  112. /package/{types/data-types → data-types}/char-type.d.ts +0 -0
  113. /package/{esm/data-types → data-types}/char-type.js +0 -0
  114. /package/{types/data-types → data-types}/circle-type.d.ts +0 -0
  115. /package/{esm/data-types → data-types}/circle-type.js +0 -0
  116. /package/{types/data-types → data-types}/date-type.d.ts +0 -0
  117. /package/{esm/data-types → data-types}/date-type.js +0 -0
  118. /package/{types/data-types → data-types}/float4-type.d.ts +0 -0
  119. /package/{esm/data-types → data-types}/float4-type.js +0 -0
  120. /package/{types/data-types → data-types}/float8-type.d.ts +0 -0
  121. /package/{esm/data-types → data-types}/float8-type.js +0 -0
  122. /package/{types/data-types → data-types}/int2-type.d.ts +0 -0
  123. /package/{esm/data-types → data-types}/int2-type.js +0 -0
  124. /package/{types/data-types → data-types}/int2-vector-type.d.ts +0 -0
  125. /package/{types/data-types → data-types}/int4-type.d.ts +0 -0
  126. /package/{esm/data-types → data-types}/int4-type.js +0 -0
  127. /package/{types/data-types → data-types}/int8-type.d.ts +0 -0
  128. /package/{esm/data-types → data-types}/int8-type.js +0 -0
  129. /package/{types/data-types → data-types}/json-type.d.ts +0 -0
  130. /package/{esm/data-types → data-types}/json-type.js +0 -0
  131. /package/{types/data-types → data-types}/jsonb-type.d.ts +0 -0
  132. /package/{esm/data-types → data-types}/jsonb-type.js +0 -0
  133. /package/{types/data-types → data-types}/lseg-type.d.ts +0 -0
  134. /package/{esm/data-types → data-types}/lseg-type.js +0 -0
  135. /package/{types/data-types → data-types}/numeric-type.d.ts +0 -0
  136. /package/{esm/data-types → data-types}/numeric-type.js +0 -0
  137. /package/{types/data-types → data-types}/oid-type.d.ts +0 -0
  138. /package/{esm/data-types → data-types}/oid-type.js +0 -0
  139. /package/{types/data-types → data-types}/point-type.d.ts +0 -0
  140. /package/{esm/data-types → data-types}/point-type.js +0 -0
  141. /package/{types/data-types → data-types}/time-type.d.ts +0 -0
  142. /package/{esm/data-types → data-types}/time-type.js +0 -0
  143. /package/{types/data-types → data-types}/timestamp-type.d.ts +0 -0
  144. /package/{esm/data-types → data-types}/timestamp-type.js +0 -0
  145. /package/{types/data-types → data-types}/uuid-type.d.ts +0 -0
  146. /package/{esm/data-types → data-types}/uuid-type.js +0 -0
  147. /package/{types/data-types → data-types}/varchar-type.d.ts +0 -0
  148. /package/{esm/data-types → data-types}/varchar-type.js +0 -0
  149. /package/{types/index.d.ts → index.d.ts} +0 -0
  150. /package/{esm/index.js → index.js} +0 -0
  151. /package/{types/interfaces → interfaces}/command-result.d.ts +0 -0
  152. /package/{esm/interfaces → interfaces}/command-result.js +0 -0
  153. /package/{types/interfaces → interfaces}/data-mapping-options.d.ts +0 -0
  154. /package/{esm/interfaces → interfaces}/data-mapping-options.js +0 -0
  155. /package/{types/interfaces → interfaces}/data-type.d.ts +0 -0
  156. /package/{esm/interfaces → interfaces}/data-type.js +0 -0
  157. /package/{types/interfaces → interfaces}/database-connection-params.d.ts +0 -0
  158. /package/{esm/interfaces → interfaces}/database-connection-params.js +0 -0
  159. /package/{types/interfaces → interfaces}/field-info.d.ts +0 -0
  160. /package/{esm/interfaces → interfaces}/field-info.js +0 -0
  161. /package/{types/interfaces → interfaces}/query-options.d.ts +0 -0
  162. /package/{esm/interfaces → interfaces}/query-options.js +0 -0
  163. /package/{types/interfaces → interfaces}/query-result.d.ts +0 -0
  164. /package/{esm/interfaces → interfaces}/query-result.js +0 -0
  165. /package/{types/interfaces → interfaces}/script-execute-options.d.ts +0 -0
  166. /package/{esm/interfaces → interfaces}/script-execute-options.js +0 -0
  167. /package/{types/interfaces → interfaces}/script-result.d.ts +0 -0
  168. /package/{esm/interfaces → interfaces}/script-result.js +0 -0
  169. /package/{types/interfaces → interfaces}/statement-prepare-options.d.ts +0 -0
  170. /package/{esm/interfaces → interfaces}/statement-prepare-options.js +0 -0
  171. /package/{types/protocol → protocol}/backend.d.ts +0 -0
  172. /package/{types/protocol → protocol}/buffer-reader.d.ts +0 -0
  173. /package/{types/protocol → protocol}/database-error.d.ts +0 -0
  174. /package/{types/protocol → protocol}/frontend.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
package/CHANGELOG.md CHANGED
@@ -1,6 +1,23 @@
1
1
  ## Changelog
2
2
 
3
- ### [v2.22.9](https://github.com/panates/postgrejs/compare/v2.22.8...v2.22.9) -
3
+ ### [v2.23.1](https://github.com/panates/postgrejs/compare/v2.23.0...v2.23.1) -
4
+
5
+ #### 💬 General Changes
6
+
7
+ - dev: Updated dependencies and switched to `import type` for cleaner type imports @Eray Hanoğlu
8
+ - dev: Minor lint issue @Eray Hanoğlu
9
+ - dev: Updated action/chechout version @Eray Hanoğlu
10
+ - dev: Minor lint issue @Eray Hanoğlu
11
+ - dev: Set min node test version to 20 @Eray Hanoğlu
12
+
13
+ ### [v2.23.0](https://github.com/panates/postgrejs/compare/v2.22.9...v2.23.0) - 3 April 2026
14
+
15
+ #### 🛠 Refactoring and Updates
16
+
17
+ - dev: Updated deps to support latest TypeScript and NodeJS. @Eray Hanoğlu
18
+ - dev: Updated deps to support latest TypeScript and NodeJS. @Eray Hanoğlu
19
+
20
+ ### [v2.22.9](https://github.com/panates/postgrejs/compare/v2.22.8...v2.22.9) - 4 December 2025
4
21
 
5
22
  ### [v2.22.8](https://github.com/panates/postgrejs/compare/v2.22.7...v2.22.8) - 27 October 2025
6
23
 
@@ -1,4 +1,6 @@
1
1
  export class BindParam {
2
+ oid;
3
+ value;
2
4
  constructor(oid, value) {
3
5
  this.oid = oid;
4
6
  this.value = value;
@@ -5,10 +5,12 @@ import { BindParam } from './bind-param.js';
5
5
  import { IntlConnection } from './intl-connection.js';
6
6
  import { PreparedStatement } from './prepared-statement.js';
7
7
  export class Connection extends SafeEventEmitter {
8
+ _pool;
9
+ _intlCon;
10
+ _notificationListeners = new SafeEventEmitter();
11
+ _closing = false;
8
12
  constructor(arg0, arg1) {
9
13
  super();
10
- this._notificationListeners = new SafeEventEmitter();
11
- this._closing = false;
12
14
  if (arg0 &&
13
15
  typeof arg0 === 'object' &&
14
16
  typeof arg0.acquire === 'function') {
@@ -4,11 +4,16 @@ import { SafeEventEmitter } from '../safe-event-emitter.js';
4
4
  import { convertRowToObject } from '../util/convert-row-to-object.js';
5
5
  import { parseRow } from '../util/parse-row.js';
6
6
  export class Cursor extends SafeEventEmitter {
7
+ _statement;
8
+ _portal;
9
+ _parsers;
10
+ _queryOptions;
11
+ _taskQueue = new TaskQueue({ concurrency: 1 });
12
+ _rows = new DoublyLinked();
13
+ _closed = false;
14
+ fields;
7
15
  constructor(statement, portal, fields, parsers, queryOptions) {
8
16
  super();
9
- this._taskQueue = new TaskQueue({ concurrency: 1 });
10
- this._rows = new DoublyLinked();
11
- this._closed = false;
12
17
  this._statement = statement;
13
18
  this._portal = portal;
14
19
  this._parsers = parsers;
@@ -13,11 +13,14 @@ import { parseRow } from '../util/parse-row.js';
13
13
  import { wrapRowDescription } from '../util/wrap-row-description.js';
14
14
  const DataFormat = Protocol.DataFormat;
15
15
  export class IntlConnection extends SafeEventEmitter {
16
+ _refCount = 0;
17
+ _config;
18
+ _onErrorSavePoint;
19
+ transactionStatus = 'I';
20
+ socket;
21
+ statementQueue = new TaskQueue({ concurrency: 1 });
16
22
  constructor(config) {
17
23
  super();
18
- this._refCount = 0;
19
- this.transactionStatus = 'I';
20
- this.statementQueue = new TaskQueue({ concurrency: 1 });
21
24
  this._config = Object.freeze(getConnectionConfig(config));
22
25
  this.socket = new PgSocket(this._config);
23
26
  this.socket.on('error', err => this._onError(err));
@@ -6,9 +6,12 @@ import { getConnectionConfig } from '../util/connection-config.js';
6
6
  import { Connection } from './connection.js';
7
7
  import { getIntlConnection, IntlConnection } from './intl-connection.js';
8
8
  export class Pool extends SafeEventEmitter {
9
+ _pool;
10
+ _notificationListeners = new SafeEventEmitter();
11
+ _notificationConnection;
12
+ config;
9
13
  constructor(config) {
10
14
  super();
11
- this._notificationListeners = new SafeEventEmitter();
12
15
  const cfg = getConnectionConfig(config);
13
16
  this.config = Object.freeze(cfg);
14
17
  const poolOptions = {};
@@ -3,8 +3,10 @@ import { GlobalTypeMap } from '../data-type-map.js';
3
3
  import { Protocol } from '../protocol/protocol.js';
4
4
  import { getIntlConnection } from './intl-connection.js';
5
5
  export class Portal {
6
+ _statement;
7
+ _name;
8
+ _columnFormat = DEFAULT_COLUMN_FORMAT;
6
9
  constructor(statement, name) {
7
- this._columnFormat = DEFAULT_COLUMN_FORMAT;
8
10
  this._statement = statement;
9
11
  this._name = name;
10
12
  }
@@ -13,11 +13,14 @@ import { Portal } from './portal.js';
13
13
  let statementCounter = 0;
14
14
  let portalCounter = 0;
15
15
  export class PreparedStatement extends SafeEventEmitter {
16
+ _connection;
17
+ _sql = '';
18
+ _name = '';
19
+ _paramTypes;
20
+ _onErrorSavePoint;
21
+ _refCount = 0;
16
22
  constructor(connection, sql, paramTypes) {
17
23
  super();
18
- this._sql = '';
19
- this._name = '';
20
- this._refCount = 0;
21
24
  this._connection = connection;
22
25
  this._name = 'S_' + ++statementCounter;
23
26
  this._sql = sql;
@@ -1,7 +1,7 @@
1
1
  import { Protocol } from './protocol/protocol.js';
2
2
  var DataFormat = Protocol.DataFormat;
3
3
  // @ts-ignore
4
- Symbol.asyncDispose ?? (Symbol.asyncDispose = Symbol('Symbol.asyncDispose'));
4
+ Symbol.asyncDispose ??= Symbol('Symbol.asyncDispose');
5
5
  export { DataFormat };
6
6
  export const DEFAULT_COLUMN_FORMAT = DataFormat.binary;
7
7
  export var ConnectionState;
@@ -1,5 +1,5 @@
1
- import { DataType } from './interfaces/data-type.js';
2
- import { OID } from './types.js';
1
+ import type { DataType } from './interfaces/data-type.js';
2
+ import type { OID } from './types.js';
3
3
  export declare class DataTypeMap {
4
4
  private _itemsByOID;
5
5
  private _items;
@@ -23,9 +23,9 @@ import { ArrayTimestamptzType, TimestamptzType, } from './data-types/timestamptz
23
23
  import { ArrayUuidType, UuidType } from './data-types/uuid-type.js';
24
24
  import { ArrayVarcharType, VarcharType } from './data-types/varchar-type.js';
25
25
  export class DataTypeMap {
26
+ _itemsByOID = {};
27
+ _items = [];
26
28
  constructor(other) {
27
- this._itemsByOID = {};
28
- this._items = [];
29
29
  if (other instanceof DataTypeMap)
30
30
  Object.assign(this._items, other._items);
31
31
  }
@@ -1,4 +1,5 @@
1
1
  import { DataTypeOIDs } from '../constants.js';
2
+ import { SmartBuffer } from '../protocol/smart-buffer.js';
2
3
  import { decodeBinaryArray } from '../util/decode-binaryarray.js';
3
4
  import { encodeBinaryArray } from '../util/encode-binaryarray.js';
4
5
  import { fastParseInt } from '../util/fast-parseint.js';
@@ -1,3 +1,3 @@
1
- import { DataType } from '../interfaces/data-type.js';
1
+ import type { DataType } from '../interfaces/data-type.js';
2
2
  export declare const TimestamptzType: DataType;
3
3
  export declare const ArrayTimestamptzType: DataType;
@@ -1,4 +1,5 @@
1
1
  import { DataTypeOIDs } from '../constants.js';
2
+ import { SmartBuffer } from '../protocol/smart-buffer.js';
2
3
  import { parseDateTime } from '../util/parse-datetime.js';
3
4
  const timeShift = 946684800000;
4
5
  const timeMul = 4294967296;
package/package.json CHANGED
@@ -1,37 +1,32 @@
1
1
  {
2
2
  "name": "postgrejs",
3
3
  "description": "Professional PostgreSQL client NodeJS",
4
- "version": "2.22.9",
4
+ "version": "2.23.1",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
- "@jsopen/objects": "^2.0.2",
8
+ "@jsopen/objects": "^2.2.3",
9
9
  "doublylinked": "^2.5.6",
10
10
  "lightning-pool": "^4.12.0",
11
11
  "postgres-bytea": "^3.0.0",
12
- "power-tasks": "^1.11.1",
12
+ "power-tasks": "^1.14.2",
13
13
  "putil-promisify": "^1.10.1",
14
- "putil-varhelpers": "^1.6.5",
14
+ "putil-varhelpers": "^1.7.0",
15
15
  "tslib": "^2.8.1"
16
16
  },
17
17
  "type": "module",
18
+ "module": "./index.js",
19
+ "types": "./index.d.ts",
18
20
  "exports": {
19
21
  ".": {
20
- "import": {
21
- "types": "./types/index.d.ts",
22
- "default": "./esm/index.js"
23
- },
24
- "require": {
25
- "types": "./types/index.d.cts",
26
- "default": "./cjs/index.js"
27
- },
28
- "default": "./esm/index.js"
22
+ "types": "./index.d.ts",
23
+ "default": "./index.js"
29
24
  },
30
25
  "./package.json": "./package.json"
31
26
  },
32
- "main": "./cjs/index.js",
33
- "module": "./esm/index.js",
34
- "types": "./types/index.d.ts",
27
+ "engines": {
28
+ "node": ">=20.0"
29
+ },
35
30
  "homepage": "https://postgrejs.panates.com/",
36
31
  "contributors": [
37
32
  "Eray Hanoglu <e.hanoglu@panates.com>"
@@ -40,17 +35,6 @@
40
35
  "type": "git",
41
36
  "url": "https://github.com/panates/postgrejs.git"
42
37
  },
43
- "engines": {
44
- "node": ">=16.0"
45
- },
46
- "files": [
47
- "cjs/",
48
- "esm/",
49
- "types/",
50
- "LICENSE",
51
- "README.md",
52
- "CHANGELOG.md"
53
- ],
54
38
  "keywords": [
55
39
  "postgresql",
56
40
  "postgres",
@@ -62,10 +46,7 @@
62
46
  "client",
63
47
  "backend",
64
48
  "rdbms",
65
- "sql",
66
- "typescript",
67
- "ts",
68
- "esm"
49
+ "sql"
69
50
  ],
70
51
  "publishConfig": {
71
52
  "access": "public"
@@ -23,6 +23,7 @@ const ErrorFieldTypes = {
23
23
  R: 'routine',
24
24
  };
25
25
  export class Backend {
26
+ _buf;
26
27
  reset() {
27
28
  this._buf = undefined;
28
29
  }
@@ -1,6 +1,7 @@
1
1
  export class BufferReader {
2
+ buffer;
3
+ offset = 0;
2
4
  constructor(buffer) {
3
- this.offset = 0;
4
5
  this.buffer = buffer;
5
6
  }
6
7
  get length() {
@@ -1,4 +1,21 @@
1
+ import { Protocol } from './protocol.js';
1
2
  export class DatabaseError extends Error {
3
+ severity;
4
+ code;
5
+ detail;
6
+ hint;
7
+ position;
8
+ internalPosition;
9
+ internalQuery;
10
+ where;
11
+ schema;
12
+ table;
13
+ column;
14
+ dataType;
15
+ constraint;
16
+ lineNr;
17
+ colNr;
18
+ line;
2
19
  constructor(msg) {
3
20
  super(msg.message);
4
21
  Object.assign(this, {
@@ -1,4 +1,5 @@
1
1
  import { DEFAULT_COLUMN_FORMAT } from '../constants.js';
2
+ import { DataTypeMap } from '../data-type-map.js';
2
3
  import { encodeBinaryArray } from '../util/encode-binaryarray.js';
3
4
  import { stringifyArrayLiteral } from '../util/stringify-arrayliteral.js';
4
5
  import { Protocol } from './protocol.js';
@@ -26,6 +27,7 @@ const StaticSyncBuffer = Buffer.from([
26
27
  0x04,
27
28
  ]);
28
29
  export class Frontend {
30
+ _io;
29
31
  constructor(options) {
30
32
  this._io = new SmartBuffer(options?.buffer);
31
33
  }
@@ -1,7 +1,7 @@
1
1
  import { ConnectionState } from '../constants.js';
2
2
  import type { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
3
3
  import { SafeEventEmitter } from '../safe-event-emitter.js';
4
- import { Callback, Maybe } from '../types.js';
4
+ import type { Callback, Maybe } from '../types.js';
5
5
  import { Frontend } from './frontend.js';
6
6
  import { Protocol } from './protocol.js';
7
7
  export type CaptureCallback = (code: Protocol.BackendMessageCode, msg: any, done: (err: Maybe<Error>, result?: any) => void) => void | Promise<void>;
@@ -13,12 +13,18 @@ import { SASL } from './sasl.js';
13
13
  const DEFAULT_PORT_NUMBER = 5432;
14
14
  const COMMAND_RESULT_PATTERN = /^([^\d]+)(?: (\d+)(?: (\d+))?)?$/;
15
15
  export class PgSocket extends SafeEventEmitter {
16
+ options;
17
+ _state = ConnectionState.CLOSED;
18
+ _socket;
19
+ _backend = new Backend();
20
+ _frontend;
21
+ _sessionParameters = {};
22
+ _saslSession;
23
+ _processID;
24
+ _secretKey;
16
25
  constructor(options) {
17
26
  super();
18
27
  this.options = options;
19
- this._state = ConnectionState.CLOSED;
20
- this._backend = new Backend();
21
- this._sessionParameters = {};
22
28
  this._frontend = new Frontend({ buffer: options.buffer });
23
29
  this.setMaxListeners(99);
24
30
  }
@@ -2,11 +2,17 @@ import * as os from 'os';
2
2
  import { writeBigUInt64BE } from '../util/bigint-methods.js';
3
3
  import { BufferReader } from './buffer-reader.js';
4
4
  export class SmartBuffer extends BufferReader {
5
+ static DEFAULT_PAGE_SIZE = 4096;
6
+ static DEFAULT_MAX_SIZE = Math.min(Math.floor(os.totalmem() / 2), 1024 * 1024 * 1024 * 2);
7
+ _houseKeepInterval;
8
+ _houseKeepTimer;
9
+ _lastHouseKeep = 0;
10
+ _stMaxPages = 1;
11
+ _length = 0;
12
+ pageSize;
13
+ maxSize;
5
14
  constructor(cfg) {
6
15
  super(Buffer.allocUnsafe(cfg?.pageSize || SmartBuffer.DEFAULT_PAGE_SIZE));
7
- this._lastHouseKeep = 0;
8
- this._stMaxPages = 1;
9
- this._length = 0;
10
16
  this._houseKeepInterval = cfg?.houseKeepInterval || 5000;
11
17
  this.pageSize = this.buffer.length;
12
18
  this.maxSize = cfg?.maxLength || SmartBuffer.DEFAULT_MAX_SIZE;
@@ -169,5 +175,3 @@ export class SmartBuffer extends BufferReader {
169
175
  this._stMaxPages = this.length ? Math.ceil(this.length / this.pageSize) : 1;
170
176
  }
171
177
  }
172
- SmartBuffer.DEFAULT_PAGE_SIZE = 4096;
173
- SmartBuffer.DEFAULT_MAX_SIZE = Math.min(Math.floor(os.totalmem() / 2), 1024 * 1024 * 1024 * 2);
@@ -1,3 +1,4 @@
1
+ /* eslint-disable */
1
2
  const big0 = BigInt(0);
2
3
  const beAnd = BigInt('0xffffffff');
3
4
  const big32 = BigInt(32);
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BindParam = void 0;
4
- class BindParam {
5
- constructor(oid, value) {
6
- this.oid = oid;
7
- this.value = value;
8
- }
9
- }
10
- exports.BindParam = BindParam;