@prairielearn/postgres 1.9.3 → 2.0.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/src/pool.test.ts CHANGED
@@ -14,8 +14,8 @@ import {
14
14
  callOptionalRow,
15
15
  queryCursor,
16
16
  queryValidatedCursor,
17
- } from './default-pool';
18
- import { makePostgresTestUtils } from './test-utils';
17
+ } from './default-pool.js';
18
+ import { makePostgresTestUtils } from './test-utils.js';
19
19
 
20
20
  chai.use(chaiAsPromised);
21
21
  const { assert } = chai;
package/src/pool.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import _ from 'lodash';
2
2
  import pg, { QueryResult } from 'pg';
3
3
  import Cursor from 'pg-cursor';
4
- import debugFactory from 'debug';
4
+ import debugfn from 'debug';
5
5
  import { callbackify } from 'node:util';
6
6
  import { AsyncLocalStorage } from 'node:async_hooks';
7
7
  import { z } from 'zod';
@@ -15,7 +15,7 @@ export interface CursorIterator<T> {
15
15
  stream: (batchSize: number) => NodeJS.ReadWriteStream;
16
16
  }
17
17
 
18
- const debug = debugFactory('@prairielearn/postgres');
18
+ const debug = debugfn('@prairielearn/postgres');
19
19
  const lastQueryMap = new WeakMap<pg.PoolClient, string>();
20
20
  const searchSchemaMap = new WeakMap<pg.PoolClient, string>();
21
21
 
@@ -87,8 +87,8 @@ function paramsToArray(
87
87
  let paramsArray: any[] = [];
88
88
  while ((result = re.exec(remainingSql)) !== null) {
89
89
  const v = result[1];
90
- if (!_(map).has(v)) {
91
- if (!_(params).has(v)) throw new Error(`Missing parameter: ${v}`);
90
+ if (!_.has(map, v)) {
91
+ if (!_.has(params, v)) throw new Error(`Missing parameter: ${v}`);
92
92
  if (_.isArray(params[v])) {
93
93
  map[v] =
94
94
  'ARRAY[' +
package/src/test-utils.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import pg from 'pg';
2
2
 
3
- import * as defaultPool from './default-pool';
3
+ import * as defaultPool from './default-pool.js';
4
4
 
5
5
  const POSTGRES_USER = 'postgres';
6
6
  const POSTGRES_HOST = 'localhost';