pg-promise 11.14.0 → 11.15.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/README.md CHANGED
@@ -2,7 +2,7 @@ pg-promise
2
2
  ==========
3
3
 
4
4
  [![Build Status](https://github.com/vitaly-t/pg-promise/actions/workflows/ci.yml/badge.svg)](https://github.com/vitaly-t/pg-promise/actions/workflows/ci.yml)
5
- [![Node Version](https://img.shields.io/badge/nodejs-14%20--%2024-green.svg?logo=node.js&style=flat)](https://nodejs.org)
5
+ [![Node Version](https://img.shields.io/badge/nodejs-16%20--%2024-green.svg?logo=node.js&style=flat)](https://nodejs.org)
6
6
  [![Postgres Version](https://img.shields.io/badge/postgresql-10%20--%2016-green.svg?logo=postgresql&style=flat)](https://www.postgresql.org)
7
7
 
8
8
  ---
package/lib/events.js CHANGED
@@ -531,7 +531,6 @@ module.exports = {Events};
531
531
  * It is set for all events.
532
532
  *
533
533
  * @property {string|undefined} queryFilePath
534
- * **Added in v11.14**<br/>
535
534
  * File path of a {@link QueryFile}, if the query comes from an external SQL file.
536
535
  * This is set only when the query originates from a {@link QueryFile} and only for events {@link event:query query} and {@link event:error error}.
537
536
  *
package/lib/index.js CHANGED
@@ -12,17 +12,18 @@ var v = process.versions.node.split('.'),
12
12
  highVer = +v[0];
13
13
 
14
14
  // istanbul ignore next
15
- if (highVer < 14) {
15
+ if (highVer < 16) {
16
16
 
17
- // From pg-promise v11.0.0, the oldest supported Node.js is v14.0.0
17
+ // From pg-promise v11.15.0, the oldest supported Node.js is v16.0.0
18
18
 
19
- // Node.js v12.0.0 was supported up to pg-promise v10.15.4
20
- // Node.js v8.0.0 was supported up to pg-promise v10.14.2
19
+ // Node.js v14.x was supported up to pg-promise v11.14.0
20
+ // Node.js v12.x was supported up to pg-promise v10.15.4
21
+ // Node.js v8.x was supported up to pg-promise v10.14.2
21
22
  // Node.js v7.6.0 was supported up to pg-promise v10.3.5
22
23
  // Node.js v4.5.0 was supported up to pg-promise v8.7.5
23
24
  // Node.js v0.10 was supported up to pg-promise v5.5.8
24
25
 
25
- throw new Error('Minimum Node.js version supported by pg-promise is 14.0.0');
26
+ throw new Error('Minimum Node.js version supported by pg-promise is 16.0.0');
26
27
  }
27
28
 
28
29
  module.exports = require('./main');
package/lib/main.js CHANGED
@@ -36,7 +36,7 @@ let originalClientConnect;
36
36
  * @module pg-promise
37
37
  *
38
38
  * @description
39
- * ## pg-promise v11.14
39
+ * ## pg-promise v11.15
40
40
  * All documentation here is for the latest official release only.
41
41
  *
42
42
  * ### Initialization Options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-promise",
3
- "version": "11.14.0",
3
+ "version": "11.15.0",
4
4
  "description": "PostgreSQL interface for Node.js",
5
5
  "main": "lib/index.js",
6
6
  "typings": "typescript/pg-promise.d.ts",
@@ -38,25 +38,25 @@
38
38
  },
39
39
  "license": "MIT",
40
40
  "engines": {
41
- "node": ">=14.0"
41
+ "node": ">=16.0"
42
42
  },
43
43
  "dependencies": {
44
44
  "assert-options": "0.8.3",
45
- "pg": "8.14.1",
46
- "pg-minify": "1.7.0",
45
+ "pg": "8.16.3",
46
+ "pg-minify": "1.8.0",
47
47
  "spex": "3.4.1"
48
48
  },
49
49
  "peerDependencies": {
50
- "pg-query-stream": "4.8.1"
50
+ "pg-query-stream": "4.10.3"
51
51
  },
52
52
  "devDependencies": {
53
- "@eslint/js": "9.28.0",
54
- "@types/node": "22.15.29",
53
+ "@eslint/js": "9.30.1",
54
+ "@types/node": "24.0.10",
55
55
  "bluebird": "3.7.2",
56
56
  "coveralls": "3.1.1",
57
- "cspell": "9.0.2",
58
- "eslint": "9.28.0",
59
- "globals": "16.2.0",
57
+ "cspell": "9.1.3",
58
+ "eslint": "9.30.1",
59
+ "globals": "16.3.0",
60
60
  "istanbul": "0.4.5",
61
61
  "jasmine-node": "3.0.0",
62
62
  "jsdoc": "4.0.4",
@@ -21,7 +21,7 @@ const {value} = await db.one('SELECT 123 as value');
21
21
  #### With Extensions
22
22
 
23
23
  The library supports dynamic protocol extensions, via event [extend], which requires
24
- explicit extension interface to be declared and parameterized, as shown below.
24
+ an explicit extension interface to be declared and parameterized, as shown below.
25
25
 
26
26
  ```ts
27
27
  import * as pgPromise from 'pg-promise';
@@ -7,17 +7,6 @@
7
7
  * Removal or modification of this copyright notice is prohibited.
8
8
  */
9
9
 
10
- /////////////////////////////////////////
11
- // Requires pg-promise v11.0.0 or later.
12
- /////////////////////////////////////////
13
-
14
- // We use ES6 as static promise here, because generic promises are still not supported.
15
- // Follow the links below:
16
- // https://stackoverflow.com/questions/36593087/using-a-custom-promise-as-a-generic-type
17
- // https://github.com/Microsoft/TypeScript/issues/1213
18
-
19
- type XPromise<T> = Promise<T>;
20
-
21
10
  import * as pg from './pg-subset';
22
11
  import * as pgMinify from 'pg-minify';
23
12
  import * as spexLib from 'spex';
@@ -138,13 +127,13 @@ declare namespace pgPromise {
138
127
  }
139
128
 
140
129
  interface IPromiseConfig {
141
- create(resolve: (value?: any) => void, reject?: (reason?: any) => void): XPromise<any>
130
+ create(resolve: (value?: any) => void, reject?: (reason?: any) => void): Promise<any>
142
131
 
143
132
  resolve(value?: any): void
144
133
 
145
134
  reject(reason?: any): void
146
135
 
147
- all(iterable: any): XPromise<any>
136
+ all(iterable: any): Promise<any>
148
137
  }
149
138
 
150
139
  type FormattingFilter = '^' | '~' | '#' | ':raw' | ':alias' | ':name' | ':json' | ':csv' | ':list' | ':value';
@@ -308,7 +297,7 @@ declare namespace pgPromise {
308
297
  // We export this interface only to be able to help IntelliSense cast extension types correctly,
309
298
  // which doesn't always work, depending on the version of IntelliSense being used.
310
299
  interface IDatabase<Ext, C extends pg.IClient = pg.IClient> extends IBaseProtocol<Ext> {
311
- connect(options?: IConnectionOptions<C>): XPromise<IConnected<Ext, C>>
300
+ connect(options?: IConnectionOptions<C>): Promise<IConnected<Ext, C>>
312
301
 
313
302
  /////////////////////////////////////////////////////////////////////////////
314
303
  // Hidden, read-only properties, for integrating with third-party libraries:
@@ -369,89 +358,89 @@ declare namespace pgPromise {
369
358
  interface IBaseProtocol<Ext> {
370
359
 
371
360
  // API: https://vitaly-t.github.io/pg-promise/Database.html#query
372
- query<T = any>(query: QueryParam, values?: any, qrm?: queryResult): XPromise<T>
361
+ query<T = any>(query: QueryParam, values?: any, qrm?: queryResult): Promise<T>
373
362
 
374
363
  // result-specific methods;
375
364
 
376
365
  // API: https://vitaly-t.github.io/pg-promise/Database.html#none
377
- none(query: QueryParam, values?: any): XPromise<null>
366
+ none(query: QueryParam, values?: any): Promise<null>
378
367
 
379
368
  // API: https://vitaly-t.github.io/pg-promise/Database.html#one
380
- one<T = any>(query: QueryParam, values?: any, cb?: (value: any) => T, thisArg?: any): XPromise<T>
369
+ one<T = any>(query: QueryParam, values?: any, cb?: (value: any) => T, thisArg?: any): Promise<T>
381
370
 
382
371
  // API: https://vitaly-t.github.io/pg-promise/Database.html#oneOrNone
383
- oneOrNone<T = any>(query: QueryParam, values?: any, cb?: (value: any) => T, thisArg?: any): XPromise<T | null>
372
+ oneOrNone<T = any>(query: QueryParam, values?: any, cb?: (value: any) => T, thisArg?: any): Promise<T | null>
384
373
 
385
374
  // API: https://vitaly-t.github.io/pg-promise/Database.html#many
386
- many<T = any>(query: QueryParam, values?: any): XPromise<T[]>
375
+ many<T = any>(query: QueryParam, values?: any): Promise<T[]>
387
376
 
388
377
  // API: https://vitaly-t.github.io/pg-promise/Database.html#manyOrNone
389
- manyOrNone<T = any>(query: QueryParam, values?: any): XPromise<T[]>
378
+ manyOrNone<T = any>(query: QueryParam, values?: any): Promise<T[]>
390
379
 
391
380
  // API: https://vitaly-t.github.io/pg-promise/Database.html#any
392
- any<T = any>(query: QueryParam, values?: any): XPromise<T[]>
381
+ any<T = any>(query: QueryParam, values?: any): Promise<T[]>
393
382
 
394
383
  // API: https://vitaly-t.github.io/pg-promise/Database.html#result
395
- result<T, R = IResultExt<T>>(query: QueryParam, values?: any, cb?: (value: IResultExt<T>) => R, thisArg?: any): XPromise<R>
384
+ result<T, R = IResultExt<T>>(query: QueryParam, values?: any, cb?: (value: IResultExt<T>) => R, thisArg?: any): Promise<R>
396
385
 
397
386
  // API: https://vitaly-t.github.io/pg-promise/Database.html#multiResult
398
- multiResult(query: QueryParam, values?: any): XPromise<pg.IResult[]>
387
+ multiResult(query: QueryParam, values?: any): Promise<pg.IResult[]>
399
388
 
400
389
  // API: https://vitaly-t.github.io/pg-promise/Database.html#multi
401
- multi<T = any>(query: QueryParam, values?: any): XPromise<Array<T[]>>
390
+ multi<T = any>(query: QueryParam, values?: any): Promise<Array<T[]>>
402
391
 
403
392
  // API: https://vitaly-t.github.io/pg-promise/Database.html#stream
404
- stream(qs: NodeJS.ReadableStream, init: (stream: NodeJS.ReadableStream) => void): XPromise<{
393
+ stream(qs: NodeJS.ReadableStream, init: (stream: NodeJS.ReadableStream) => void): Promise<{
405
394
  processed: number,
406
395
  duration: number
407
396
  }>
408
397
 
409
398
  // API: https://vitaly-t.github.io/pg-promise/Database.html#func
410
- func<T = any>(funcName: string, values?: any, qrm?: queryResult): XPromise<T>
399
+ func<T = any>(funcName: string, values?: any, qrm?: queryResult): Promise<T>
411
400
 
412
401
  // API: https://vitaly-t.github.io/pg-promise/Database.html#proc
413
- proc<T = any>(procName: string, values?: any, cb?: (value: any) => T, thisArg?: any): XPromise<T | null>
402
+ proc<T = any>(procName: string, values?: any, cb?: (value: any) => T, thisArg?: any): Promise<T | null>
414
403
 
415
404
  // API: https://vitaly-t.github.io/pg-promise/Database.html#map
416
- map<T = any>(query: QueryParam, values: any, cb: (row: any, index: number, data: any[]) => T, thisArg?: any): XPromise<T[]>
405
+ map<T = any>(query: QueryParam, values: any, cb: (row: any, index: number, data: any[]) => T, thisArg?: any): Promise<T[]>
417
406
 
418
407
  // API: https://vitaly-t.github.io/pg-promise/Database.html#each
419
- each<T = any>(query: QueryParam, values: any, cb: (row: any, index: number, data: any[]) => void, thisArg?: any): XPromise<T[]>
408
+ each<T = any>(query: QueryParam, values: any, cb: (row: any, index: number, data: any[]) => void, thisArg?: any): Promise<T[]>
420
409
 
421
410
  // Tasks;
422
411
  // API: https://vitaly-t.github.io/pg-promise/Database.html#task
423
- task<T>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
412
+ task<T>(cb: (t: ITask<Ext> & Ext) => T | Promise<T>): Promise<T>
424
413
 
425
- task<T>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
414
+ task<T>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | Promise<T>): Promise<T>
426
415
 
427
- task<T>(options: { tag?: any }, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
416
+ task<T>(options: { tag?: any }, cb: (t: ITask<Ext> & Ext) => T | Promise<T>): Promise<T>
428
417
 
429
418
  // Conditional Tasks;
430
419
  // API: https://vitaly-t.github.io/pg-promise/Database.html#taskIf
431
- taskIf<T>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
420
+ taskIf<T>(cb: (t: ITask<Ext> & Ext) => T | Promise<T>): Promise<T>
432
421
 
433
- taskIf<T>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
422
+ taskIf<T>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | Promise<T>): Promise<T>
434
423
 
435
- taskIf<T>(options: ITaskIfOptions<Ext>, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
424
+ taskIf<T>(options: ITaskIfOptions<Ext>, cb: (t: ITask<Ext> & Ext) => T | Promise<T>): Promise<T>
436
425
 
437
426
  // Transactions;
438
427
  // API: https://vitaly-t.github.io/pg-promise/Database.html#tx
439
- tx<T>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
428
+ tx<T>(cb: (t: ITask<Ext> & Ext) => T | Promise<T>): Promise<T>
440
429
 
441
- tx<T>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
430
+ tx<T>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | Promise<T>): Promise<T>
442
431
 
443
432
  tx<T>(options: {
444
433
  tag?: any,
445
434
  mode?: _txMode.TransactionMode | null
446
- }, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
435
+ }, cb: (t: ITask<Ext> & Ext) => T | Promise<T>): Promise<T>
447
436
 
448
437
  // Conditional Transactions;
449
438
  // API: https://vitaly-t.github.io/pg-promise/Database.html#txIf
450
- txIf<T>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
439
+ txIf<T>(cb: (t: ITask<Ext> & Ext) => T | Promise<T>): Promise<T>
451
440
 
452
- txIf<T>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
441
+ txIf<T>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | Promise<T>): Promise<T>
453
442
 
454
- txIf<T>(options: ITxIfOptions<Ext>, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
443
+ txIf<T>(options: ITxIfOptions<Ext>, cb: (t: ITask<Ext> & Ext) => T | Promise<T>): Promise<T>
455
444
  }
456
445
 
457
446
  // Database object in connected state;
@@ -465,10 +454,10 @@ declare namespace pgPromise {
465
454
 
466
455
  // But for direct connections (connect({direct: true})), `kill` flag is ignored, because
467
456
  // the connection is always closed physically, which may take time, and so in this case
468
- // the method returns a Promise, to indicate when the connection finished closing.
469
- done(kill?: boolean): void | XPromise<void>;
457
+ // the method returns a Promise to indicate when the connection finished closing.
458
+ done(kill?: boolean): void | Promise<void>;
470
459
 
471
- // Repeated calls are not allowed, and will throw an error.
460
+ // Repeated calls are not allowed and will throw an error.
472
461
  }
473
462
 
474
463
  // Event context extension for tasks + transactions;
@@ -510,7 +499,7 @@ declare namespace pgPromise {
510
499
  query: any
511
500
  params: any,
512
501
  values: any,
513
- queryFilePath?: string,
502
+ queryFilePath?: string,
514
503
  ctx: ITaskContext
515
504
  }
516
505
 
@@ -609,7 +598,7 @@ declare namespace pgPromise {
609
598
 
610
599
  query?(e: IEventContext<C>): void
611
600
 
612
- // NOTE: result is undefined when data comes from QueryStream, i.e. via method Database.stream
601
+ // NOTE: The result is undefined when data comes from QueryStream, i.e. via method Database.stream
613
602
  receive?(e: { data: any[], result: IResultExt | void, ctx: IEventContext<C> }): void
614
603
 
615
604
  task?(e: IEventContext<C>): void
@@ -723,13 +712,13 @@ declare namespace pgPromise {
723
712
  }
724
713
 
725
714
  interface IGenericPromise {
726
- (cb: (resolve: (value?: any) => void, reject: (reason?: any) => void) => void): XPromise<any>
715
+ (cb: (resolve: (value?: any) => void, reject: (reason?: any) => void) => void): Promise<any>
727
716
 
728
717
  resolve(value?: any): void
729
718
 
730
719
  reject(reason?: any): void
731
720
 
732
- all(iterable: any): XPromise<any>
721
+ all(iterable: any): Promise<any>
733
722
  }
734
723
  }
735
724
 
@@ -30,7 +30,7 @@ declare namespace pg {
30
30
  oid: number
31
31
  dataTypeID: number
32
32
 
33
- // NOTE: properties below are not available within Native Bindings:
33
+ // NOTE: The properties below are not available within Native Bindings:
34
34
 
35
35
  tableID: number
36
36
  columnID: number