@prairielearn/postgres 3.0.0 → 4.0.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/dist/pool.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import pg, { type QueryResult } from 'pg';
2
- import Cursor from 'pg-cursor';
3
2
  import { z } from 'zod';
4
3
  export type QueryParams = Record<string, any> | any[];
5
4
  export interface CursorIterator<T> {
@@ -31,68 +30,36 @@ export declare class PostgresPool {
31
30
  * Creates a new connection pool and attempts to connect to the database.
32
31
  */
33
32
  initAsync(pgConfig: PostgresPoolConfig, idleErrorHandler: (error: Error, client: pg.PoolClient) => void): Promise<void>;
34
- /**
35
- * Creates a new connection pool and attempts to connect to the database.
36
- */
37
- init: (arg1: PostgresPoolConfig, arg2: (error: Error, client: pg.PoolClient) => void, callback: (err: NodeJS.ErrnoException) => void) => void;
38
33
  /**
39
34
  * Closes the connection pool.
40
35
  */
41
36
  closeAsync(): Promise<void>;
42
37
  /**
43
- * Closes the connection pool.
44
- */
45
- close: (callback: (err: NodeJS.ErrnoException) => void) => void;
46
- /**
47
- * Gets a new client from the connection pool. If `err` is not null
48
- * then `client` and `done` are undefined. If `err` is null then
49
- * `client` is valid and can be used. The caller MUST call `done()` to
38
+ * Gets a new client from the connection pool. The caller MUST call `release()` to
50
39
  * release the client, whether or not errors occurred while using
51
40
  * `client`. The client can call `done(truthy_value)` to force
52
41
  * destruction of the client, but this should not be used except in
53
42
  * unusual circumstances.
54
43
  */
55
44
  getClientAsync(): Promise<pg.PoolClient>;
56
- /**
57
- * Gets a new client from the connection pool.
58
- */
59
- getClient(callback: (error: Error | null, client?: pg.PoolClient, done?: () => void) => void): void;
60
45
  /**
61
46
  * Performs a query with the given client.
62
47
  */
63
48
  queryWithClientAsync(client: pg.PoolClient, sql: string, params: QueryParams): Promise<pg.QueryResult>;
64
- /**
65
- * Performs a query with the given client.
66
- */
67
- queryWithClient: (arg1: import("pg").PoolClient, arg2: string, arg3: QueryParams, callback: (err: NodeJS.ErrnoException | null, result: pg.QueryResult<any>) => void) => void;
68
49
  /**
69
50
  * Performs a query with the given client. Errors if the query returns more
70
51
  * than one row.
71
52
  */
72
53
  queryWithClientOneRowAsync(client: pg.PoolClient, sql: string, params: QueryParams): Promise<pg.QueryResult>;
73
- /**
74
- * Performs a query with the given client. Errors if the query returns more
75
- * than one row.
76
- */
77
- queryWithClientOneRow: (arg1: import("pg").PoolClient, arg2: string, arg3: QueryParams, callback: (err: NodeJS.ErrnoException | null, result: pg.QueryResult<any>) => void) => void;
78
54
  /**
79
55
  * Performs a query with the given client. Errors if the query returns more
80
56
  * than one row.
81
57
  */
82
58
  queryWithClientZeroOrOneRowAsync(client: pg.PoolClient, sql: string, params: QueryParams): Promise<QueryResult>;
83
- /**
84
- * Performs a query with the given client. Errors if the query returns more
85
- * than one row.
86
- */
87
- queryWithClientZeroOrOneRow: (arg1: import("pg").PoolClient, arg2: string, arg3: QueryParams, callback: (err: NodeJS.ErrnoException | null, result: QueryResult<any>) => void) => void;
88
59
  /**
89
60
  * Rolls back the current transaction for the given client.
90
61
  */
91
62
  rollbackWithClientAsync(client: pg.PoolClient): Promise<void>;
92
- /**
93
- * Rolls back the current transaction for the given client.
94
- */
95
- rollbackWithClient(client: pg.PoolClient, _done: (release?: any) => void, callback: (err: Error | null) => void): void;
96
63
  /**
97
64
  * Begins a new transaction.
98
65
  */
@@ -102,11 +69,6 @@ export declare class PostgresPool {
102
69
  * Also releases the client.
103
70
  */
104
71
  endTransactionAsync(client: pg.PoolClient, err: Error | null | undefined): Promise<void>;
105
- /**
106
- * Commits the transaction if err is null, otherwise rollbacks the transaction.
107
- * Also releases the client.
108
- */
109
- endTransaction(client: pg.PoolClient, _done: (rollback?: any) => void, err: Error | null | undefined, callback: (error: Error | null) => void): void;
110
72
  /**
111
73
  * Runs the specified function inside of a transaction. The function will
112
74
  * receive a database client as an argument, but it can also make queries
@@ -120,86 +82,44 @@ export declare class PostgresPool {
120
82
  * Executes a query with the specified parameters.
121
83
  */
122
84
  queryAsync(sql: string, params: QueryParams): Promise<QueryResult>;
123
- /**
124
- * Executes a query with the specified parameters.
125
- */
126
- query: (arg1: string, arg2: QueryParams, callback: (err: NodeJS.ErrnoException | null, result: QueryResult<any>) => void) => void;
127
85
  /**
128
86
  * Executes a query with the specified parameters. Errors if the query does
129
87
  * not return exactly one row.
130
88
  */
131
89
  queryOneRowAsync(sql: string, params: QueryParams): Promise<pg.QueryResult>;
132
- /**
133
- * Executes a query with the specified parameters. Errors if the query does
134
- * not return exactly one row.
135
- */
136
- queryOneRow: (arg1: string, arg2: QueryParams, callback: (err: NodeJS.ErrnoException | null, result: pg.QueryResult<any>) => void) => void;
137
90
  /**
138
91
  * Executes a query with the specified parameters. Errors if the query
139
92
  * returns more than one row.
140
93
  */
141
94
  queryZeroOrOneRowAsync(sql: string, params: QueryParams): Promise<pg.QueryResult>;
142
95
  /**
143
- * Executes a query with the specified parameters. Errors if the query
144
- * returns more than one row.
145
- */
146
- queryZeroOrOneRow: (arg1: string, arg2: QueryParams, callback: (err: NodeJS.ErrnoException | null, result: pg.QueryResult<any>) => void) => void;
147
- /**
148
- * Calls the given function with the specified parameters.
96
+ * Calls the given sproc with the specified parameters.
149
97
  */
150
98
  callAsync(functionName: string, params: any[]): Promise<pg.QueryResult>;
151
99
  /**
152
- * Calls the given function with the specified parameters.
153
- */
154
- call: (arg1: string, arg2: any[], callback: (err: NodeJS.ErrnoException | null, result: pg.QueryResult<any>) => void) => void;
155
- /**
156
- * Calls the given function with the specified parameters. Errors if the
157
- * function does not return exactly one row.
100
+ * Calls the given sproc with the specified parameters. Errors if the
101
+ * sproc does not return exactly one row.
158
102
  */
159
103
  callOneRowAsync(functionName: string, params: any[]): Promise<pg.QueryResult>;
160
104
  /**
161
- * Calls the given function with the specified parameters. Errors if the
162
- * function does not return exactly one row.
163
- */
164
- callOneRow: (arg1: string, arg2: any[], callback: (err: NodeJS.ErrnoException | null, result: pg.QueryResult<any>) => void) => void;
165
- /**
166
- * Calls the given function with the specified parameters. Errors if the
167
- * function returns more than one row.
105
+ * Calls the given sproc with the specified parameters. Errors if the
106
+ * sproc returns more than one row.
168
107
  */
169
108
  callZeroOrOneRowAsync(functionName: string, params: any[]): Promise<pg.QueryResult>;
170
109
  /**
171
- * Calls the given function with the specified parameters. Errors if the
172
- * function returns more than one row.
173
- */
174
- callZeroOrOneRow: (arg1: string, arg2: any[], callback: (err: NodeJS.ErrnoException | null, result: pg.QueryResult<any>) => void) => void;
175
- /**
176
- * Calls a function with the specified parameters using a specific client.
110
+ * Calls a sproc with the specified parameters using a specific client.
177
111
  */
178
112
  callWithClientAsync(client: pg.PoolClient, functionName: string, params: any[]): Promise<pg.QueryResult>;
179
113
  /**
180
- * Calls a function with the specified parameters using a specific client.
181
- */
182
- callWithClient: (arg1: import("pg").PoolClient, arg2: string, arg3: any[], callback: (err: NodeJS.ErrnoException | null, result: pg.QueryResult<any>) => void) => void;
183
- /**
184
- * Calls a function with the specified parameters using a specific client.
185
- * Errors if the function does not return exactly one row.
114
+ * Calls a sproc with the specified parameters using a specific client.
115
+ * Errors if the sproc does not return exactly one row.
186
116
  */
187
117
  callWithClientOneRowAsync(client: pg.PoolClient, functionName: string, params: any[]): Promise<pg.QueryResult>;
188
118
  /**
189
119
  * Calls a function with the specified parameters using a specific client.
190
- * Errors if the function does not return exactly one row.
191
- */
192
- callWithClientOneRow: (arg1: import("pg").PoolClient, arg2: string, arg3: any[], callback: (err: NodeJS.ErrnoException | null, result: pg.QueryResult<any>) => void) => void;
193
- /**
194
- * Calls a function with the specified parameters using a specific client.
195
- * Errors if the function returns more than one row.
120
+ * Errors if the sproc returns more than one row.
196
121
  */
197
122
  callWithClientZeroOrOneRowAsync(client: pg.PoolClient, functionName: string, params: any[]): Promise<pg.QueryResult>;
198
- /**
199
- * Calls a function with the specified parameters using a specific client.
200
- * Errors if the function returns more than one row.
201
- */
202
- callWithClientZeroOrOneRow: (arg1: import("pg").PoolClient, arg2: string, arg3: any[], callback: (err: NodeJS.ErrnoException | null, result: pg.QueryResult<any>) => void) => void;
203
123
  queryRows<Model extends z.ZodTypeAny>(sql: string, model: Model): Promise<z.infer<Model>[]>;
204
124
  queryRows<Model extends z.ZodTypeAny>(sql: string, params: QueryParams, model: Model): Promise<z.infer<Model>[]>;
205
125
  queryRow<Model extends z.ZodTypeAny>(sql: string, model: Model): Promise<z.infer<Model>>;
@@ -216,19 +136,14 @@ export declare class PostgresPool {
216
136
  * Returns a {@link Cursor} for the given query. The cursor can be used to
217
137
  * read results in batches, which is useful for large result sets.
218
138
  */
219
- queryCursorWithClient(client: pg.PoolClient, sql: string, params: QueryParams): Promise<Cursor>;
220
- /**
221
- * Returns an {@link CursorIterator} that can be used to iterate over the
222
- * results of the query in batches, which is useful for large result sets.
223
- */
224
- queryCursor<Model extends z.ZodTypeAny>(sql: string, params: QueryParams): Promise<CursorIterator<z.infer<Model>>>;
139
+ private queryCursorWithClient;
225
140
  /**
226
141
  * Returns an {@link CursorIterator} that can be used to iterate over the
227
142
  * results of the query in batches, which is useful for large result sets.
228
143
  * Each row will be parsed by the given Zod schema.
229
144
  */
230
- queryValidatedCursor<Model extends z.ZodTypeAny>(sql: string, params: QueryParams, model: Model): Promise<CursorIterator<z.infer<Model>>>;
231
- private queryValidatedCursorInternal;
145
+ queryCursor<Model extends z.ZodTypeAny>(sql: string, params: QueryParams, model: Model): Promise<CursorIterator<z.infer<Model>>>;
146
+ private queryCursorInternal;
232
147
  /**
233
148
  * Set the schema to use for the search path.
234
149
  *
@@ -238,7 +153,7 @@ export declare class PostgresPool {
238
153
  /**
239
154
  * Get the schema that is currently used for the search path.
240
155
  *
241
- * @return schema in use (may be `null` to indicate no schema)
156
+ * @returns schema in use (may be `null` to indicate no schema)
242
157
  */
243
158
  getSearchSchema(): string | null;
244
159
  /**
@@ -248,10 +163,6 @@ export declare class PostgresPool {
248
163
  * @returns The randomly-generated search schema.
249
164
  */
250
165
  setRandomSearchSchemaAsync(prefix: string): Promise<string>;
251
- /**
252
- * Generate, set, and return a random schema name.
253
- */
254
- setRandomSearchSchema: (arg1: string, callback: (err: NodeJS.ErrnoException, result: string) => void) => void;
255
166
  /** The number of established connections. */
256
167
  get totalCount(): number;
257
168
  /** The number of idle connections. */
package/dist/pool.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { AsyncLocalStorage } from 'node:async_hooks';
2
2
  import { Readable, Transform } from 'node:stream';
3
- import { callbackify } from 'node:util';
4
3
  import debugfn from 'debug';
5
4
  import _ from 'lodash';
6
5
  import multipipe from 'multipipe';
@@ -188,10 +187,6 @@ export class PostgresPool {
188
187
  }
189
188
  }
190
189
  }
191
- /**
192
- * Creates a new connection pool and attempts to connect to the database.
193
- */
194
- init = callbackify(this.initAsync);
195
190
  /**
196
191
  * Closes the connection pool.
197
192
  */
@@ -202,13 +197,7 @@ export class PostgresPool {
202
197
  this.pool = null;
203
198
  }
204
199
  /**
205
- * Closes the connection pool.
206
- */
207
- close = callbackify(this.closeAsync);
208
- /**
209
- * Gets a new client from the connection pool. If `err` is not null
210
- * then `client` and `done` are undefined. If `err` is null then
211
- * `client` is valid and can be used. The caller MUST call `done()` to
200
+ * Gets a new client from the connection pool. The caller MUST call `release()` to
212
201
  * release the client, whether or not errors occurred while using
213
202
  * `client`. The client can call `done(truthy_value)` to force
214
203
  * destruction of the client, but this should not be used except in
@@ -253,14 +242,6 @@ export class PostgresPool {
253
242
  }
254
243
  return client;
255
244
  }
256
- /**
257
- * Gets a new client from the connection pool.
258
- */
259
- getClient(callback) {
260
- this.getClientAsync()
261
- .then((client) => callback(null, client, client.release))
262
- .catch((err) => callback(err));
263
- }
264
245
  /**
265
246
  * Performs a query with the given client.
266
247
  */
@@ -279,10 +260,6 @@ export class PostgresPool {
279
260
  throw enhanceError(err, sql, params);
280
261
  }
281
262
  }
282
- /**
283
- * Performs a query with the given client.
284
- */
285
- queryWithClient = callbackify(this.queryWithClientAsync);
286
263
  /**
287
264
  * Performs a query with the given client. Errors if the query returns more
288
265
  * than one row.
@@ -301,11 +278,6 @@ export class PostgresPool {
301
278
  debug('queryWithClientOneRow() success', 'rowCount:', result.rowCount);
302
279
  return result;
303
280
  }
304
- /**
305
- * Performs a query with the given client. Errors if the query returns more
306
- * than one row.
307
- */
308
- queryWithClientOneRow = callbackify(this.queryWithClientOneRowAsync);
309
281
  /**
310
282
  * Performs a query with the given client. Errors if the query returns more
311
283
  * than one row.
@@ -324,11 +296,6 @@ export class PostgresPool {
324
296
  debug('queryWithClientZeroOrOneRow() success', 'rowCount:', result.rowCount);
325
297
  return result;
326
298
  }
327
- /**
328
- * Performs a query with the given client. Errors if the query returns more
329
- * than one row.
330
- */
331
- queryWithClientZeroOrOneRow = callbackify(this.queryWithClientZeroOrOneRowAsync);
332
299
  /**
333
300
  * Rolls back the current transaction for the given client.
334
301
  */
@@ -351,16 +318,6 @@ export class PostgresPool {
351
318
  client.release(err);
352
319
  }
353
320
  }
354
- /**
355
- * Rolls back the current transaction for the given client.
356
- */
357
- rollbackWithClient(client, _done, callback) {
358
- // Note that we can't use `util.callbackify` here because this function
359
- // has an additional unused `done` parameter for backwards compatibility.
360
- this.rollbackWithClientAsync(client)
361
- .then(() => callback(null))
362
- .catch((err) => callback(err));
363
- }
364
321
  /**
365
322
  * Begins a new transaction.
366
323
  */
@@ -406,15 +363,6 @@ export class PostgresPool {
406
363
  }
407
364
  }
408
365
  }
409
- /**
410
- * Commits the transaction if err is null, otherwise rollbacks the transaction.
411
- * Also releases the client.
412
- */
413
- endTransaction(client, _done, err, callback) {
414
- this.endTransactionAsync(client, err)
415
- .then(() => callback(null))
416
- .catch((error) => callback(error));
417
- }
418
366
  /**
419
367
  * Runs the specified function inside of a transaction. The function will
420
368
  * receive a database client as an argument, but it can also make queries
@@ -469,10 +417,6 @@ export class PostgresPool {
469
417
  }
470
418
  }
471
419
  }
472
- /**
473
- * Executes a query with the specified parameters.
474
- */
475
- query = callbackify(this.queryAsync);
476
420
  /**
477
421
  * Executes a query with the specified parameters. Errors if the query does
478
422
  * not return exactly one row.
@@ -490,11 +434,6 @@ export class PostgresPool {
490
434
  debug('queryOneRow() success', 'rowCount:', result.rowCount);
491
435
  return result;
492
436
  }
493
- /**
494
- * Executes a query with the specified parameters. Errors if the query does
495
- * not return exactly one row.
496
- */
497
- queryOneRow = callbackify(this.queryOneRowAsync);
498
437
  /**
499
438
  * Executes a query with the specified parameters. Errors if the query
500
439
  * returns more than one row.
@@ -513,12 +452,7 @@ export class PostgresPool {
513
452
  return result;
514
453
  }
515
454
  /**
516
- * Executes a query with the specified parameters. Errors if the query
517
- * returns more than one row.
518
- */
519
- queryZeroOrOneRow = callbackify(this.queryZeroOrOneRowAsync);
520
- /**
521
- * Calls the given function with the specified parameters.
455
+ * Calls the given sproc with the specified parameters.
522
456
  */
523
457
  async callAsync(functionName, params) {
524
458
  debug('call()', 'function:', functionName);
@@ -530,12 +464,8 @@ export class PostgresPool {
530
464
  return result;
531
465
  }
532
466
  /**
533
- * Calls the given function with the specified parameters.
534
- */
535
- call = callbackify(this.callAsync);
536
- /**
537
- * Calls the given function with the specified parameters. Errors if the
538
- * function does not return exactly one row.
467
+ * Calls the given sproc with the specified parameters. Errors if the
468
+ * sproc does not return exactly one row.
539
469
  */
540
470
  async callOneRowAsync(functionName, params) {
541
471
  debug('callOneRow()', 'function:', functionName);
@@ -551,13 +481,8 @@ export class PostgresPool {
551
481
  return result;
552
482
  }
553
483
  /**
554
- * Calls the given function with the specified parameters. Errors if the
555
- * function does not return exactly one row.
556
- */
557
- callOneRow = callbackify(this.callOneRowAsync);
558
- /**
559
- * Calls the given function with the specified parameters. Errors if the
560
- * function returns more than one row.
484
+ * Calls the given sproc with the specified parameters. Errors if the
485
+ * sproc returns more than one row.
561
486
  */
562
487
  async callZeroOrOneRowAsync(functionName, params) {
563
488
  debug('callZeroOrOneRow()', 'function:', functionName);
@@ -573,12 +498,7 @@ export class PostgresPool {
573
498
  return result;
574
499
  }
575
500
  /**
576
- * Calls the given function with the specified parameters. Errors if the
577
- * function returns more than one row.
578
- */
579
- callZeroOrOneRow = callbackify(this.callZeroOrOneRowAsync);
580
- /**
581
- * Calls a function with the specified parameters using a specific client.
501
+ * Calls a sproc with the specified parameters using a specific client.
582
502
  */
583
503
  async callWithClientAsync(client, functionName, params) {
584
504
  debug('callWithClient()', 'function:', functionName);
@@ -590,12 +510,8 @@ export class PostgresPool {
590
510
  return result;
591
511
  }
592
512
  /**
593
- * Calls a function with the specified parameters using a specific client.
594
- */
595
- callWithClient = callbackify(this.callWithClientAsync);
596
- /**
597
- * Calls a function with the specified parameters using a specific client.
598
- * Errors if the function does not return exactly one row.
513
+ * Calls a sproc with the specified parameters using a specific client.
514
+ * Errors if the sproc does not return exactly one row.
599
515
  */
600
516
  async callWithClientOneRowAsync(client, functionName, params) {
601
517
  debug('callWithClientOneRow()', 'function:', functionName);
@@ -612,12 +528,7 @@ export class PostgresPool {
612
528
  }
613
529
  /**
614
530
  * Calls a function with the specified parameters using a specific client.
615
- * Errors if the function does not return exactly one row.
616
- */
617
- callWithClientOneRow = callbackify(this.callWithClientOneRowAsync);
618
- /**
619
- * Calls a function with the specified parameters using a specific client.
620
- * Errors if the function returns more than one row.
531
+ * Errors if the sproc returns more than one row.
621
532
  */
622
533
  async callWithClientZeroOrOneRowAsync(client, functionName, params) {
623
534
  debug('callWithClientZeroOrOneRow()', 'function:', functionName);
@@ -633,10 +544,11 @@ export class PostgresPool {
633
544
  return result;
634
545
  }
635
546
  /**
636
- * Calls a function with the specified parameters using a specific client.
637
- * Errors if the function returns more than one row.
547
+ * Executes a query with the specified parameters. Returns an array of rows
548
+ * that conform to the given Zod schema.
549
+ *
550
+ * If the query returns a single column, the return value will be a list of column values.
638
551
  */
639
- callWithClientZeroOrOneRow = callbackify(this.callWithClientZeroOrOneRowAsync);
640
552
  async queryRows(sql, paramsOrSchema, maybeModel) {
641
553
  const params = maybeModel === undefined ? {} : paramsOrSchema;
642
554
  const model = maybeModel === undefined ? paramsOrSchema : maybeModel;
@@ -650,6 +562,11 @@ export class PostgresPool {
650
562
  return z.array(model).parse(results.rows);
651
563
  }
652
564
  }
565
+ /**
566
+ * Executes a query with the specified parameters. Returns exactly one row that conforms to the given Zod schema.
567
+ *
568
+ * If the query returns a single column, the return value will be the column value itself.
569
+ */
653
570
  async queryRow(sql, paramsOrSchema, maybeModel) {
654
571
  const params = maybeModel === undefined ? {} : paramsOrSchema;
655
572
  const model = maybeModel === undefined ? paramsOrSchema : maybeModel;
@@ -662,6 +579,12 @@ export class PostgresPool {
662
579
  return model.parse(results.rows[0]);
663
580
  }
664
581
  }
582
+ /**
583
+ * Executes a query with the specified parameters. Returns either null or a
584
+ * single row that conforms to the given Zod schema, and errors otherwise.
585
+ *
586
+ * If the query returns a single column, the return value will be the column value itself.
587
+ */
665
588
  async queryOptionalRow(sql, paramsOrSchema, maybeModel) {
666
589
  const params = maybeModel === undefined ? {} : paramsOrSchema;
667
590
  const model = maybeModel === undefined ? paramsOrSchema : maybeModel;
@@ -677,6 +600,10 @@ export class PostgresPool {
677
600
  return model.parse(results.rows[0]);
678
601
  }
679
602
  }
603
+ /**
604
+ * Calls the given sproc with the specified parameters.
605
+ * Errors if the sproc does not return anything.
606
+ */
680
607
  async callRows(sql, paramsOrSchema, maybeModel) {
681
608
  const params = maybeModel === undefined ? [] : paramsOrSchema;
682
609
  const model = maybeModel === undefined ? paramsOrSchema : maybeModel;
@@ -690,6 +617,10 @@ export class PostgresPool {
690
617
  return z.array(model).parse(results.rows);
691
618
  }
692
619
  }
620
+ /**
621
+ * Calls the given sproc with the specified parameters.
622
+ * Returns exactly one row from the sproc that conforms to the given Zod schema.
623
+ */
693
624
  async callRow(sql, paramsOrSchema, maybeModel) {
694
625
  const params = maybeModel === undefined ? [] : paramsOrSchema;
695
626
  const model = maybeModel === undefined ? paramsOrSchema : maybeModel;
@@ -702,6 +633,10 @@ export class PostgresPool {
702
633
  return model.parse(results.rows[0]);
703
634
  }
704
635
  }
636
+ /**
637
+ * Calls the given sproc with the specified parameters. Returns either null
638
+ * or a single row that conforms to the given Zod schema.
639
+ */
705
640
  async callOptionalRow(sql, paramsOrSchema, maybeModel) {
706
641
  const params = maybeModel === undefined ? [] : paramsOrSchema;
707
642
  const model = maybeModel === undefined ? paramsOrSchema : maybeModel;
@@ -729,22 +664,15 @@ export class PostgresPool {
729
664
  lastQueryMap.set(client, processedSql);
730
665
  return client.query(new Cursor(processedSql, paramsArray));
731
666
  }
732
- /**
733
- * Returns an {@link CursorIterator} that can be used to iterate over the
734
- * results of the query in batches, which is useful for large result sets.
735
- */
736
- async queryCursor(sql, params) {
737
- return this.queryValidatedCursorInternal(sql, params);
738
- }
739
667
  /**
740
668
  * Returns an {@link CursorIterator} that can be used to iterate over the
741
669
  * results of the query in batches, which is useful for large result sets.
742
670
  * Each row will be parsed by the given Zod schema.
743
671
  */
744
- async queryValidatedCursor(sql, params, model) {
745
- return this.queryValidatedCursorInternal(sql, params, model);
672
+ async queryCursor(sql, params, model) {
673
+ return this.queryCursorInternal(sql, params, model);
746
674
  }
747
- async queryValidatedCursorInternal(sql, params, model) {
675
+ async queryCursorInternal(sql, params, model) {
748
676
  const client = await this.getClientAsync();
749
677
  const cursor = await this.queryCursorWithClient(client, sql, params);
750
678
  let iterateCalled = false;
@@ -827,7 +755,7 @@ export class PostgresPool {
827
755
  /**
828
756
  * Get the schema that is currently used for the search path.
829
757
  *
830
- * @return schema in use (may be `null` to indicate no schema)
758
+ * @returns schema in use (may be `null` to indicate no schema)
831
759
  */
832
760
  getSearchSchema() {
833
761
  return this.searchSchema;
@@ -855,10 +783,6 @@ export class PostgresPool {
855
783
  await this.setSearchSchema(schema);
856
784
  return schema;
857
785
  }
858
- /**
859
- * Generate, set, and return a random schema name.
860
- */
861
- setRandomSearchSchema = callbackify(this.setRandomSearchSchemaAsync);
862
786
  /** The number of established connections. */
863
787
  get totalCount() {
864
788
  return this.pool?.totalCount ?? 0;