pg-promise 11.4.3 → 11.5.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.
- package/package.json +7 -7
- package/typescript/pg-promise.d.ts +50 -50
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg-promise",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.5.1",
|
|
4
4
|
"description": "PostgreSQL interface for Node.js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "typescript/pg-promise.d.ts",
|
|
@@ -42,22 +42,22 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"assert-options": "0.8.1",
|
|
45
|
-
"pg": "8.
|
|
45
|
+
"pg": "8.11.1",
|
|
46
46
|
"pg-minify": "1.6.3",
|
|
47
47
|
"spex": "3.3.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@types/node": "
|
|
50
|
+
"@types/node": "20.4.4",
|
|
51
51
|
"bluebird": "3.7.2",
|
|
52
52
|
"coveralls": "3.1.1",
|
|
53
|
-
"cspell": "6.
|
|
54
|
-
"eslint": "8.
|
|
53
|
+
"cspell": "6.31.2",
|
|
54
|
+
"eslint": "8.45.0",
|
|
55
55
|
"istanbul": "0.4.5",
|
|
56
56
|
"jasmine-node": "3.0.0",
|
|
57
57
|
"jsdoc": "4.0.2",
|
|
58
58
|
"JSONStream": "1.3.5",
|
|
59
|
-
"pg-query-stream": "4.
|
|
59
|
+
"pg-query-stream": "4.5.1",
|
|
60
60
|
"tslint": "6.1.3",
|
|
61
|
-
"typescript": "5.
|
|
61
|
+
"typescript": "5.1.6"
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
// We use ES6 as static promise here, because generic promises are still not supported.
|
|
15
15
|
// Follow the links below:
|
|
16
|
-
//
|
|
16
|
+
// https://stackoverflow.com/questions/36593087/using-a-custom-promise-as-a-generic-type
|
|
17
17
|
// https://github.com/Microsoft/TypeScript/issues/1213
|
|
18
18
|
type XPromise<T> = Promise<T>;
|
|
19
19
|
|
|
@@ -24,7 +24,7 @@ import * as spexLib from 'spex';
|
|
|
24
24
|
// internal namespace for "txMode" property:
|
|
25
25
|
declare namespace _txMode {
|
|
26
26
|
// Transaction Isolation Level;
|
|
27
|
-
// API:
|
|
27
|
+
// API: https://vitaly-t.github.io/pg-promise/txMode.html#.isolationLevel
|
|
28
28
|
enum isolationLevel {
|
|
29
29
|
none = 0,
|
|
30
30
|
serializable = 1,
|
|
@@ -33,7 +33,7 @@ declare namespace _txMode {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// TransactionMode class;
|
|
36
|
-
// API:
|
|
36
|
+
// API: https://vitaly-t.github.io/pg-promise/txMode.TransactionMode.html
|
|
37
37
|
class TransactionMode {
|
|
38
38
|
constructor(options?: { tiLevel?: isolationLevel, readOnly?: boolean, deferrable?: boolean })
|
|
39
39
|
|
|
@@ -42,7 +42,7 @@ declare namespace _txMode {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// Main protocol of the library;
|
|
45
|
-
// API:
|
|
45
|
+
// API: https://vitaly-t.github.io/pg-promise/module-pg-promise.html
|
|
46
46
|
declare namespace pgPromise {
|
|
47
47
|
|
|
48
48
|
interface IQueryFileOptions {
|
|
@@ -160,7 +160,7 @@ declare namespace pgPromise {
|
|
|
160
160
|
type ValidSchema = string | string[] | null | void;
|
|
161
161
|
|
|
162
162
|
// helpers.TableName class;
|
|
163
|
-
// API:
|
|
163
|
+
// API: https://vitaly-t.github.io/pg-promise/helpers.TableName.html
|
|
164
164
|
class TableName {
|
|
165
165
|
constructor(table: string | ITable)
|
|
166
166
|
|
|
@@ -173,7 +173,7 @@ declare namespace pgPromise {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
// helpers.Column class;
|
|
176
|
-
// API:
|
|
176
|
+
// API: https://vitaly-t.github.io/pg-promise/helpers.Column.html
|
|
177
177
|
class Column<T = unknown> {
|
|
178
178
|
constructor(col: string | IColumnConfig<T>);
|
|
179
179
|
|
|
@@ -194,7 +194,7 @@ declare namespace pgPromise {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
// helpers.Column class;
|
|
197
|
-
// API:
|
|
197
|
+
// API: https://vitaly-t.github.io/pg-promise/helpers.ColumnSet.html
|
|
198
198
|
class ColumnSet<T = unknown> {
|
|
199
199
|
constructor(columns: Column<T>, options?: IColumnSetOptions)
|
|
200
200
|
constructor(columns: Array<string | IColumnConfig<T> | Column<T>>, options?: IColumnSetOptions)
|
|
@@ -221,7 +221,7 @@ declare namespace pgPromise {
|
|
|
221
221
|
const minify: typeof pgMinify;
|
|
222
222
|
|
|
223
223
|
// Query Result Mask;
|
|
224
|
-
// API:
|
|
224
|
+
// API: https://vitaly-t.github.io/pg-promise/global.html#queryResult
|
|
225
225
|
enum queryResult {
|
|
226
226
|
one = 1,
|
|
227
227
|
many = 2,
|
|
@@ -230,7 +230,7 @@ declare namespace pgPromise {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
// PreparedStatement class;
|
|
233
|
-
// API:
|
|
233
|
+
// API: https://vitaly-t.github.io/pg-promise/PreparedStatement.html
|
|
234
234
|
class PreparedStatement {
|
|
235
235
|
|
|
236
236
|
constructor(options?: IPreparedStatement)
|
|
@@ -251,7 +251,7 @@ declare namespace pgPromise {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
// ParameterizedQuery class;
|
|
254
|
-
// API:
|
|
254
|
+
// API: https://vitaly-t.github.io/pg-promise/ParameterizedQuery.html
|
|
255
255
|
class ParameterizedQuery {
|
|
256
256
|
|
|
257
257
|
constructor(options?: string | QueryFile | IParameterizedQuery)
|
|
@@ -270,7 +270,7 @@ declare namespace pgPromise {
|
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
// QueryFile class;
|
|
273
|
-
// API:
|
|
273
|
+
// API: https://vitaly-t.github.io/pg-promise/QueryFile.html
|
|
274
274
|
class QueryFile {
|
|
275
275
|
constructor(file: string, options?: IQueryFileOptions)
|
|
276
276
|
|
|
@@ -284,7 +284,7 @@ declare namespace pgPromise {
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
// PromiseAdapter class;
|
|
287
|
-
// API:
|
|
287
|
+
// API: https://vitaly-t.github.io/pg-promise/PromiseAdapter.html
|
|
288
288
|
class PromiseAdapter {
|
|
289
289
|
constructor(api: IPromiseConfig)
|
|
290
290
|
}
|
|
@@ -294,7 +294,7 @@ declare namespace pgPromise {
|
|
|
294
294
|
const as: IFormatting;
|
|
295
295
|
|
|
296
296
|
// Database full protocol;
|
|
297
|
-
// API:
|
|
297
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html
|
|
298
298
|
//
|
|
299
299
|
// We export this interface only to be able to help IntelliSense cast extension types correctly,
|
|
300
300
|
// which doesn't always work, depending on the version of IntelliSense being used.
|
|
@@ -318,7 +318,7 @@ declare namespace pgPromise {
|
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
// Post-initialization interface;
|
|
321
|
-
// API:
|
|
321
|
+
// API: https://vitaly-t.github.io/pg-promise/module-pg-promise.html
|
|
322
322
|
interface IMain<Ext = {}, C extends pg.IClient = pg.IClient> {
|
|
323
323
|
<T = Ext, C extends pg.IClient = pg.IClient>(cn: string | pg.IConnectionParameters<C>, dc?: any): IDatabase<T, C> & T
|
|
324
324
|
|
|
@@ -340,64 +340,64 @@ declare namespace pgPromise {
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
// Additional methods available inside tasks + transactions;
|
|
343
|
-
// API:
|
|
343
|
+
// API: https://vitaly-t.github.io/pg-promise/Task.html
|
|
344
344
|
interface ITask<Ext> extends IBaseProtocol<Ext>, spexLib.ISpexBase {
|
|
345
345
|
readonly ctx: ITaskContext
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
// Base database protocol
|
|
349
|
-
// API:
|
|
349
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html
|
|
350
350
|
interface IBaseProtocol<Ext> {
|
|
351
351
|
|
|
352
|
-
// API:
|
|
352
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#query
|
|
353
353
|
query<T = any>(query: QueryParam, values?: any, qrm?: queryResult): XPromise<T>
|
|
354
354
|
|
|
355
355
|
// result-specific methods;
|
|
356
356
|
|
|
357
|
-
// API:
|
|
357
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#none
|
|
358
358
|
none(query: QueryParam, values?: any): XPromise<null>
|
|
359
359
|
|
|
360
|
-
// API:
|
|
360
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#one
|
|
361
361
|
one<T = any>(query: QueryParam, values?: any, cb?: (value: any) => T, thisArg?: any): XPromise<T>
|
|
362
362
|
|
|
363
|
-
// API:
|
|
363
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#oneOrNone
|
|
364
364
|
oneOrNone<T = any>(query: QueryParam, values?: any, cb?: (value: any) => T, thisArg?: any): XPromise<T | null>
|
|
365
365
|
|
|
366
|
-
// API:
|
|
366
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#many
|
|
367
367
|
many<T = any>(query: QueryParam, values?: any): XPromise<T[]>
|
|
368
368
|
|
|
369
|
-
// API:
|
|
369
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#manyOrNone
|
|
370
370
|
manyOrNone<T = any>(query: QueryParam, values?: any): XPromise<T[]>
|
|
371
371
|
|
|
372
|
-
// API:
|
|
372
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#any
|
|
373
373
|
any<T = any>(query: QueryParam, values?: any): XPromise<T[]>
|
|
374
374
|
|
|
375
|
-
// API:
|
|
375
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#result
|
|
376
376
|
result<T, R = IResultExt<T>>(query: QueryParam, values?: any, cb?: (value: IResultExt<T>) => R, thisArg?: any): XPromise<R>
|
|
377
377
|
|
|
378
|
-
// API:
|
|
378
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#multiResult
|
|
379
379
|
multiResult(query: QueryParam, values?: any): XPromise<pg.IResult[]>
|
|
380
380
|
|
|
381
|
-
// API:
|
|
381
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#multi
|
|
382
382
|
multi<T = any>(query: QueryParam, values?: any): XPromise<Array<T[]>>
|
|
383
383
|
|
|
384
|
-
// API:
|
|
384
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#stream
|
|
385
385
|
stream(qs: NodeJS.ReadableStream, init: (stream: NodeJS.ReadableStream) => void): XPromise<{ processed: number, duration: number }>
|
|
386
386
|
|
|
387
|
-
// API:
|
|
387
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#func
|
|
388
388
|
func<T = any>(funcName: string, values?: any, qrm?: queryResult): XPromise<T>
|
|
389
389
|
|
|
390
|
-
// API:
|
|
390
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#proc
|
|
391
391
|
proc<T = any>(procName: string, values?: any, cb?: (value: any) => T, thisArg?: any): XPromise<T | null>
|
|
392
392
|
|
|
393
|
-
// API:
|
|
393
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#map
|
|
394
394
|
map<T = any>(query: QueryParam, values: any, cb: (row: any, index: number, data: any[]) => T, thisArg?: any): XPromise<T[]>
|
|
395
395
|
|
|
396
|
-
// API:
|
|
396
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#each
|
|
397
397
|
each<T = any>(query: QueryParam, values: any, cb: (row: any, index: number, data: any[]) => void, thisArg?: any): XPromise<T[]>
|
|
398
398
|
|
|
399
399
|
// Tasks;
|
|
400
|
-
// API:
|
|
400
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#task
|
|
401
401
|
task<T = any>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
|
|
402
402
|
|
|
403
403
|
task<T = any>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
|
|
@@ -405,7 +405,7 @@ declare namespace pgPromise {
|
|
|
405
405
|
task<T = any>(options: { tag?: any }, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
|
|
406
406
|
|
|
407
407
|
// Conditional Tasks;
|
|
408
|
-
// API:
|
|
408
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#taskIf
|
|
409
409
|
taskIf<T = any>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
|
|
410
410
|
|
|
411
411
|
taskIf<T = any>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
|
|
@@ -413,7 +413,7 @@ declare namespace pgPromise {
|
|
|
413
413
|
taskIf<T = any>(options: { tag?: any, cnd?: boolean | ((t: ITask<Ext> & Ext) => boolean) }, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
|
|
414
414
|
|
|
415
415
|
// Transactions;
|
|
416
|
-
// API:
|
|
416
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#tx
|
|
417
417
|
tx<T = any>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
|
|
418
418
|
|
|
419
419
|
tx<T = any>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
|
|
@@ -421,7 +421,7 @@ declare namespace pgPromise {
|
|
|
421
421
|
tx<T = any>(options: { tag?: any, mode?: _txMode.TransactionMode | null }, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
|
|
422
422
|
|
|
423
423
|
// Conditional Transactions;
|
|
424
|
-
// API:
|
|
424
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#txIf
|
|
425
425
|
txIf<T = any>(cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
|
|
426
426
|
|
|
427
427
|
txIf<T = any>(tag: string | number, cb: (t: ITask<Ext> & Ext) => T | XPromise<T>): XPromise<T>
|
|
@@ -447,7 +447,7 @@ declare namespace pgPromise {
|
|
|
447
447
|
}
|
|
448
448
|
|
|
449
449
|
// Event context extension for tasks + transactions;
|
|
450
|
-
// See:
|
|
450
|
+
// See: https://vitaly-t.github.io/pg-promise/global.html#TaskContext
|
|
451
451
|
interface ITaskContext {
|
|
452
452
|
|
|
453
453
|
// these are set in the beginning of each task/transaction:
|
|
@@ -477,7 +477,7 @@ declare namespace pgPromise {
|
|
|
477
477
|
}
|
|
478
478
|
|
|
479
479
|
// Generic Event Context interface;
|
|
480
|
-
// See:
|
|
480
|
+
// See: https://vitaly-t.github.io/pg-promise/global.html#EventContext
|
|
481
481
|
interface IEventContext<C extends pg.IClient = pg.IClient> {
|
|
482
482
|
client: C
|
|
483
483
|
cn: any
|
|
@@ -488,10 +488,10 @@ declare namespace pgPromise {
|
|
|
488
488
|
}
|
|
489
489
|
|
|
490
490
|
// Errors namespace
|
|
491
|
-
// API:
|
|
491
|
+
// API: https://vitaly-t.github.io/pg-promise/errors.html
|
|
492
492
|
namespace errors {
|
|
493
493
|
// QueryResultError interface;
|
|
494
|
-
// API:
|
|
494
|
+
// API: https://vitaly-t.github.io/pg-promise/errors.QueryResultError.html
|
|
495
495
|
class QueryResultError extends Error {
|
|
496
496
|
|
|
497
497
|
// standard error properties:
|
|
@@ -506,12 +506,12 @@ declare namespace pgPromise {
|
|
|
506
506
|
query: string;
|
|
507
507
|
values: any;
|
|
508
508
|
|
|
509
|
-
// API:
|
|
509
|
+
// API: https://vitaly-t.github.io/pg-promise/errors.QueryResultError.html#toString
|
|
510
510
|
toString(): string
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
// QueryFileError interface;
|
|
514
|
-
// API:
|
|
514
|
+
// API: https://vitaly-t.github.io/pg-promise/errors.QueryFileError.html
|
|
515
515
|
class QueryFileError extends Error {
|
|
516
516
|
|
|
517
517
|
// standard error properties:
|
|
@@ -528,7 +528,7 @@ declare namespace pgPromise {
|
|
|
528
528
|
}
|
|
529
529
|
|
|
530
530
|
// PreparedStatementError interface;
|
|
531
|
-
// API:
|
|
531
|
+
// API: https://vitaly-t.github.io/pg-promise/errors.PreparedStatementError.html
|
|
532
532
|
class PreparedStatementError extends Error {
|
|
533
533
|
|
|
534
534
|
// standard error properties:
|
|
@@ -543,7 +543,7 @@ declare namespace pgPromise {
|
|
|
543
543
|
}
|
|
544
544
|
|
|
545
545
|
// ParameterizedQueryError interface;
|
|
546
|
-
// API:
|
|
546
|
+
// API: https://vitaly-t.github.io/pg-promise/errors.ParameterizedQueryError.html
|
|
547
547
|
class ParameterizedQueryError extends Error {
|
|
548
548
|
|
|
549
549
|
// standard error properties:
|
|
@@ -558,7 +558,7 @@ declare namespace pgPromise {
|
|
|
558
558
|
}
|
|
559
559
|
|
|
560
560
|
// Query Result Error Code;
|
|
561
|
-
// API:
|
|
561
|
+
// API: https://vitaly-t.github.io/pg-promise/errors.html#.queryResultErrorCode
|
|
562
562
|
enum queryResultErrorCode {
|
|
563
563
|
noData = 0,
|
|
564
564
|
notEmpty = 1,
|
|
@@ -567,7 +567,7 @@ declare namespace pgPromise {
|
|
|
567
567
|
}
|
|
568
568
|
|
|
569
569
|
// Library's Initialization Options
|
|
570
|
-
// API:
|
|
570
|
+
// API: https://vitaly-t.github.io/pg-promise/module-pg-promise.html
|
|
571
571
|
interface IInitOptions<Ext = {}, C extends pg.IClient = pg.IClient> {
|
|
572
572
|
noWarnings?: boolean
|
|
573
573
|
pgFormatting?: boolean
|
|
@@ -594,7 +594,7 @@ declare namespace pgPromise {
|
|
|
594
594
|
extend?(obj: IDatabase<Ext, C> & Ext, dc: any): void
|
|
595
595
|
}
|
|
596
596
|
|
|
597
|
-
// API:
|
|
597
|
+
// API: https://vitaly-t.github.io/pg-promise/Database.html#$config
|
|
598
598
|
interface ILibConfig<Ext, C extends pg.IClient = pg.IClient> {
|
|
599
599
|
version: string
|
|
600
600
|
promiseLib: any
|
|
@@ -611,7 +611,7 @@ declare namespace pgPromise {
|
|
|
611
611
|
}
|
|
612
612
|
|
|
613
613
|
// Query formatting namespace;
|
|
614
|
-
// API:
|
|
614
|
+
// API: https://vitaly-t.github.io/pg-promise/formatting.html
|
|
615
615
|
interface IFormatting {
|
|
616
616
|
|
|
617
617
|
ctf: { toPostgres: symbol, rawType: symbol }
|
|
@@ -650,7 +650,7 @@ declare namespace pgPromise {
|
|
|
650
650
|
}
|
|
651
651
|
|
|
652
652
|
// General-purpose functions
|
|
653
|
-
// API:
|
|
653
|
+
// API: https://vitaly-t.github.io/pg-promise/utils.html
|
|
654
654
|
interface IUtils {
|
|
655
655
|
camelize(text: string): string
|
|
656
656
|
|
|
@@ -662,7 +662,7 @@ declare namespace pgPromise {
|
|
|
662
662
|
}
|
|
663
663
|
|
|
664
664
|
// Query Formatting Helpers
|
|
665
|
-
// API:
|
|
665
|
+
// API: https://vitaly-t.github.io/pg-promise/helpers.html
|
|
666
666
|
interface IHelpers {
|
|
667
667
|
|
|
668
668
|
concat(queries: Array<string | QueryFile | { query: string | QueryFile, values?: any, options?: IFormattingOptions }>): string
|
|
@@ -692,7 +692,7 @@ declare namespace pgPromise {
|
|
|
692
692
|
}
|
|
693
693
|
|
|
694
694
|
// Default library interface (before initialization)
|
|
695
|
-
// API:
|
|
695
|
+
// API: https://vitaly-t.github.io/pg-promise/module-pg-promise.html
|
|
696
696
|
declare function pgPromise<Ext = {}, C extends pg.IClient = pg.IClient>(options?: pgPromise.IInitOptions<Ext, C>): pgPromise.IMain<Ext, C>
|
|
697
697
|
|
|
698
698
|
export = pgPromise;
|