pg-promise 11.7.8 → 11.8.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.
@@ -168,9 +168,8 @@ npm.utils.addInspection(TableName, function () {
168
168
  * @see {@link helpers.TableName TableName}, {@link external:TemplateStringsArray TemplateStringsArray}
169
169
  */
170
170
  function _TN(path, ...args) {
171
- if (Array.isArray(path) && path.raw) {
172
- const v = i => i < args.length ? args[i] ?? '' : '';
173
- path = path.reduce((a, c, i) => a + c + v(i), '');
171
+ if (Array.isArray(path)) {
172
+ path = path.reduce((a, c, i) => a + c + (args[i] ?? ''), '');
174
173
  } // else 'path' is a string
175
174
  const [schema, table] = path.split('.');
176
175
  if (table === undefined) {
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.7
39
+ * ## pg-promise v11.8
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.7.8",
3
+ "version": "11.8.0",
4
4
  "description": "PostgreSQL interface for Node.js",
5
5
  "main": "lib/index.js",
6
6
  "typings": "typescript/pg-promise.d.ts",
@@ -47,12 +47,12 @@
47
47
  "spex": "3.3.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@eslint/js": "9.3.0",
51
- "@types/node": "20.12.12",
50
+ "@eslint/js": "9.4.0",
51
+ "@types/node": "20.13.0",
52
52
  "bluebird": "3.7.2",
53
53
  "coveralls": "3.1.1",
54
54
  "cspell": "8.8.3",
55
- "eslint": "9.3.0",
55
+ "eslint": "9.4.0",
56
56
  "globals": "15.3.0",
57
57
  "istanbul": "0.4.5",
58
58
  "jasmine-node": "3.0.0",
@@ -349,6 +349,16 @@ declare namespace pgPromise {
349
349
  readonly ctx: ITaskContext
350
350
  }
351
351
 
352
+ interface ITaskIfOptions<Ext = {}> {
353
+ cnd?: boolean | ((t: ITask<Ext> & Ext) => boolean)
354
+ tag?: any
355
+ }
356
+
357
+ interface ITxIfOptions<Ext = {}> extends ITaskIfOptions<Ext> {
358
+ mode?: _txMode.TransactionMode | null
359
+ reusable?: boolean | ((t: ITask<Ext> & Ext) => boolean)
360
+ }
361
+
352
362
  // Base database protocol
353
363
  // API: https://vitaly-t.github.io/pg-promise/Database.html
354
364
  interface IBaseProtocol<Ext> {
@@ -405,46 +415,38 @@ declare namespace pgPromise {
405
415
 
406
416
  // Tasks;
407
417
  // API: https://vitaly-t.github.io/pg-promise/Database.html#task
408
- task<T = any>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
418
+ task<T>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
409
419
 
410
- task<T = any>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
420
+ task<T>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
411
421
 
412
- task<T = any>(options: { tag?: any }, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
422
+ task<T>(options: { tag?: any }, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
413
423
 
414
424
  // Conditional Tasks;
415
425
  // API: https://vitaly-t.github.io/pg-promise/Database.html#taskIf
416
- taskIf<T = any>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
426
+ taskIf<T>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
417
427
 
418
- taskIf<T = any>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
428
+ taskIf<T>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
419
429
 
420
- taskIf<T = any>(options: {
421
- tag?: any,
422
- cnd?: boolean | ((t: ITask<Ext> & Ext) => boolean)
423
- }, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
430
+ taskIf<T>(options: ITaskIfOptions<Ext>, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
424
431
 
425
432
  // Transactions;
426
433
  // API: https://vitaly-t.github.io/pg-promise/Database.html#tx
427
- tx<T = any>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
434
+ tx<T>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
428
435
 
429
- tx<T = any>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
436
+ tx<T>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
430
437
 
431
- tx<T = any>(options: {
438
+ tx<T>(options: {
432
439
  tag?: any,
433
440
  mode?: _txMode.TransactionMode | null
434
441
  }, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
435
442
 
436
443
  // Conditional Transactions;
437
444
  // API: https://vitaly-t.github.io/pg-promise/Database.html#txIf
438
- txIf<T = any>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
445
+ txIf<T>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
439
446
 
440
- txIf<T = any>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
447
+ txIf<T>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
441
448
 
442
- txIf<T = any>(options: {
443
- tag?: any,
444
- mode?: _txMode.TransactionMode | null,
445
- reusable?: boolean | ((t: ITask<Ext> & Ext) => boolean),
446
- cnd?: boolean | ((t: ITask<Ext> & Ext) => boolean)
447
- }, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
449
+ txIf<T>(options: ITxIfOptions<Ext>, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
448
450
  }
449
451
 
450
452
  // Database object in connected state;
@@ -709,7 +711,8 @@ declare namespace pgPromise {
709
711
  TableName: typeof TableName
710
712
 
711
713
  _TN(path: TemplateStringsArray, ...args: Array<any>): ITable
712
- _TN(path: string) :ITable
714
+
715
+ _TN(path: string): ITable
713
716
  }
714
717
 
715
718
  interface IGenericPromise {