@prairielearn/postgres 1.7.9 → 1.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.
- package/CHANGELOG.md +6 -0
- package/dist/default-pool.d.ts +26 -26
- package/dist/default-pool.js.map +1 -1
- package/package.json +1 -1
- package/src/default-pool.ts +2 -2
package/CHANGELOG.md
CHANGED
package/dist/default-pool.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { PostgresPool } from './pool';
|
|
2
|
+
import { PostgresPool, type CursorIterator, type QueryParams } from './pool';
|
|
3
3
|
declare const defaultPool: PostgresPool;
|
|
4
|
-
export { defaultPool };
|
|
4
|
+
export { defaultPool, type CursorIterator, type QueryParams };
|
|
5
5
|
export declare const init: (arg1: import("pg").PoolConfig, arg2: (error: Error, client: import("pg").PoolClient) => void, callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
6
6
|
export declare const initAsync: (pgConfig: import("pg").PoolConfig, idleErrorHandler: (error: Error, client: import("pg").PoolClient) => void) => Promise<void>;
|
|
7
7
|
export declare const close: (callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
8
8
|
export declare const closeAsync: () => Promise<void>;
|
|
9
9
|
export declare const getClientAsync: () => Promise<import("pg").PoolClient>;
|
|
10
10
|
export declare const getClient: (callback: (error: Error | null, client?: import("pg").PoolClient | undefined, done?: (() => void) | undefined) => void) => void;
|
|
11
|
-
export declare const queryWithClient: (arg1: import("pg").PoolClient, arg2: string, arg3:
|
|
12
|
-
export declare const queryWithClientAsync: (client: import("pg").PoolClient, sql: string, params:
|
|
13
|
-
export declare const queryWithClientOneRow: (arg1: import("pg").PoolClient, arg2: string, arg3:
|
|
14
|
-
export declare const queryWithClientOneRowAsync: (client: import("pg").PoolClient, sql: string, params:
|
|
15
|
-
export declare const queryWithClientZeroOrOneRow: (arg1: import("pg").PoolClient, arg2: string, arg3:
|
|
16
|
-
export declare const queryWithClientZeroOrOneRowAsync: (client: import("pg").PoolClient, sql: string, params:
|
|
11
|
+
export declare const queryWithClient: (arg1: import("pg").PoolClient, arg2: string, arg3: QueryParams, callback: (err: NodeJS.ErrnoException | null, result: import("pg").QueryResult<any>) => void) => void;
|
|
12
|
+
export declare const queryWithClientAsync: (client: import("pg").PoolClient, sql: string, params: QueryParams) => Promise<import("pg").QueryResult<any>>;
|
|
13
|
+
export declare const queryWithClientOneRow: (arg1: import("pg").PoolClient, arg2: string, arg3: QueryParams, callback: (err: NodeJS.ErrnoException | null, result: import("pg").QueryResult<any>) => void) => void;
|
|
14
|
+
export declare const queryWithClientOneRowAsync: (client: import("pg").PoolClient, sql: string, params: QueryParams) => Promise<import("pg").QueryResult<any>>;
|
|
15
|
+
export declare const queryWithClientZeroOrOneRow: (arg1: import("pg").PoolClient, arg2: string, arg3: QueryParams, callback: (err: NodeJS.ErrnoException | null, result: import("pg").QueryResult<any>) => void) => void;
|
|
16
|
+
export declare const queryWithClientZeroOrOneRowAsync: (client: import("pg").PoolClient, sql: string, params: QueryParams) => Promise<import("pg").QueryResult<any>>;
|
|
17
17
|
export declare const rollbackWithClientAsync: (client: import("pg").PoolClient) => Promise<void>;
|
|
18
18
|
export declare const rollbackWithClient: (client: import("pg").PoolClient, _done: (release?: any) => void, callback: (err: Error | null) => void) => void;
|
|
19
19
|
export declare const beginTransactionAsync: () => Promise<import("pg").PoolClient>;
|
|
20
20
|
export declare const endTransactionAsync: (client: import("pg").PoolClient, err: Error | null | undefined) => Promise<void>;
|
|
21
21
|
export declare const endTransaction: (client: import("pg").PoolClient, _done: (rollback?: any) => void, err: Error | null | undefined, callback: (error: Error | null) => void) => void;
|
|
22
22
|
export declare const runInTransactionAsync: <T>(fn: (client: import("pg").PoolClient) => Promise<T>) => Promise<T>;
|
|
23
|
-
export declare const query: (arg1: string, arg2:
|
|
24
|
-
export declare const queryAsync: (sql: string, params:
|
|
25
|
-
export declare const queryOneRow: (arg1: string, arg2:
|
|
26
|
-
export declare const queryOneRowAsync: (sql: string, params:
|
|
27
|
-
export declare const queryZeroOrOneRow: (arg1: string, arg2:
|
|
28
|
-
export declare const queryZeroOrOneRowAsync: (sql: string, params:
|
|
23
|
+
export declare const query: (arg1: string, arg2: QueryParams, callback: (err: NodeJS.ErrnoException | null, result: import("pg").QueryResult<any>) => void) => void;
|
|
24
|
+
export declare const queryAsync: (sql: string, params: QueryParams) => Promise<import("pg").QueryResult<any>>;
|
|
25
|
+
export declare const queryOneRow: (arg1: string, arg2: QueryParams, callback: (err: NodeJS.ErrnoException | null, result: import("pg").QueryResult<any>) => void) => void;
|
|
26
|
+
export declare const queryOneRowAsync: (sql: string, params: QueryParams) => Promise<import("pg").QueryResult<any>>;
|
|
27
|
+
export declare const queryZeroOrOneRow: (arg1: string, arg2: QueryParams, callback: (err: NodeJS.ErrnoException | null, result: import("pg").QueryResult<any>) => void) => void;
|
|
28
|
+
export declare const queryZeroOrOneRowAsync: (sql: string, params: QueryParams) => Promise<import("pg").QueryResult<any>>;
|
|
29
29
|
export declare const call: (arg1: string, arg2: any[], callback: (err: NodeJS.ErrnoException | null, result: import("pg").QueryResult<any>) => void) => void;
|
|
30
30
|
export declare const callAsync: (functionName: string, params: any[]) => Promise<import("pg").QueryResult<any>>;
|
|
31
31
|
export declare const callOneRow: (arg1: string, arg2: any[], callback: (err: NodeJS.ErrnoException | null, result: import("pg").QueryResult<any>) => void) => void;
|
|
@@ -38,30 +38,30 @@ export declare const callWithClientOneRow: (arg1: import("pg").PoolClient, arg2:
|
|
|
38
38
|
export declare const callWithClientOneRowAsync: (client: import("pg").PoolClient, functionName: string, params: any[]) => Promise<import("pg").QueryResult<any>>;
|
|
39
39
|
export declare const callWithClientZeroOrOneRow: (arg1: import("pg").PoolClient, arg2: string, arg3: any[], callback: (err: NodeJS.ErrnoException | null, result: import("pg").QueryResult<any>) => void) => void;
|
|
40
40
|
export declare const callWithClientZeroOrOneRowAsync: (client: import("pg").PoolClient, functionName: string, params: any[]) => Promise<import("pg").QueryResult<any>>;
|
|
41
|
-
export declare const queryValidatedRows: <Model extends import("zod").ZodTypeAny>(query: string, params:
|
|
42
|
-
export declare const queryValidatedOneRow: <Model extends import("zod").ZodTypeAny>(query: string, params:
|
|
43
|
-
export declare const queryValidatedZeroOrOneRow: <Model extends import("zod").ZodTypeAny>(query: string, params:
|
|
44
|
-
export declare const queryValidatedSingleColumnRows: <Model extends import("zod").ZodTypeAny>(query: string, params:
|
|
45
|
-
export declare const queryValidatedSingleColumnOneRow: <Model extends import("zod").ZodTypeAny>(query: string, params:
|
|
46
|
-
export declare const queryValidatedSingleColumnZeroOrOneRow: <Model extends import("zod").ZodTypeAny>(query: string, params:
|
|
41
|
+
export declare const queryValidatedRows: <Model extends import("zod").ZodTypeAny>(query: string, params: QueryParams, model: Model) => Promise<import("zod").TypeOf<Model>[]>;
|
|
42
|
+
export declare const queryValidatedOneRow: <Model extends import("zod").ZodTypeAny>(query: string, params: QueryParams, model: Model) => Promise<import("zod").TypeOf<Model>>;
|
|
43
|
+
export declare const queryValidatedZeroOrOneRow: <Model extends import("zod").ZodTypeAny>(query: string, params: QueryParams, model: Model) => Promise<import("zod").TypeOf<Model> | null>;
|
|
44
|
+
export declare const queryValidatedSingleColumnRows: <Model extends import("zod").ZodTypeAny>(query: string, params: QueryParams, model: Model) => Promise<import("zod").TypeOf<Model>[]>;
|
|
45
|
+
export declare const queryValidatedSingleColumnOneRow: <Model extends import("zod").ZodTypeAny>(query: string, params: QueryParams, model: Model) => Promise<import("zod").TypeOf<Model>>;
|
|
46
|
+
export declare const queryValidatedSingleColumnZeroOrOneRow: <Model extends import("zod").ZodTypeAny>(query: string, params: QueryParams, model: Model) => Promise<import("zod").TypeOf<Model> | null>;
|
|
47
47
|
export declare const callValidatedRows: <Model extends import("zod").ZodTypeAny>(sprocName: string, params: any[], model: Model) => Promise<import("zod").TypeOf<Model>[]>;
|
|
48
48
|
export declare const callValidatedOneRow: <Model extends import("zod").ZodTypeAny>(sprocName: string, params: any[], model: Model) => Promise<import("zod").TypeOf<Model>>;
|
|
49
49
|
export declare const callValidatedZeroOrOneRow: <Model extends import("zod").ZodTypeAny>(sprocName: string, params: any[], model: Model) => Promise<import("zod").TypeOf<Model> | null>;
|
|
50
50
|
export declare const queryRows: {
|
|
51
51
|
<Model extends import("zod").ZodTypeAny>(sql: string, model: Model): Promise<import("zod").TypeOf<Model>[]>;
|
|
52
|
-
<Model_1 extends import("zod").ZodTypeAny>(sql: string, params:
|
|
52
|
+
<Model_1 extends import("zod").ZodTypeAny>(sql: string, params: QueryParams, model: Model_1): Promise<import("zod").TypeOf<Model_1>[]>;
|
|
53
53
|
};
|
|
54
54
|
export declare const queryRow: {
|
|
55
55
|
<Model extends import("zod").ZodTypeAny>(sql: string, model: Model): Promise<import("zod").TypeOf<Model>>;
|
|
56
|
-
<Model_1 extends import("zod").ZodTypeAny>(sql: string, params:
|
|
56
|
+
<Model_1 extends import("zod").ZodTypeAny>(sql: string, params: QueryParams, model: Model_1): Promise<import("zod").TypeOf<Model_1>>;
|
|
57
57
|
};
|
|
58
58
|
export declare const queryOptionalRow: {
|
|
59
59
|
<Model extends import("zod").ZodTypeAny>(sql: string, model: Model): Promise<import("zod").TypeOf<Model> | null>;
|
|
60
|
-
<Model_1 extends import("zod").ZodTypeAny>(sql: string, params:
|
|
60
|
+
<Model_1 extends import("zod").ZodTypeAny>(sql: string, params: QueryParams, model: Model_1): Promise<import("zod").TypeOf<Model_1> | null>;
|
|
61
61
|
};
|
|
62
|
-
export declare const queryCursorWithClient: (client: import("pg").PoolClient, sql: string, params:
|
|
63
|
-
export declare const queryCursor: <Model extends import("zod").ZodTypeAny>(sql: string, params:
|
|
64
|
-
export declare const queryValidatedCursor: <Model extends import("zod").ZodTypeAny>(sql: string, params:
|
|
62
|
+
export declare const queryCursorWithClient: (client: import("pg").PoolClient, sql: string, params: QueryParams) => Promise<import("pg-cursor")<any>>;
|
|
63
|
+
export declare const queryCursor: <Model extends import("zod").ZodTypeAny>(sql: string, params: QueryParams) => Promise<CursorIterator<import("zod").TypeOf<Model>>>;
|
|
64
|
+
export declare const queryValidatedCursor: <Model extends import("zod").ZodTypeAny>(sql: string, params: QueryParams, model: Model) => Promise<CursorIterator<import("zod").TypeOf<Model>>>;
|
|
65
65
|
export declare const setSearchSchema: (schema: string) => Promise<void>;
|
|
66
66
|
export declare const getSearchSchema: () => string | null;
|
|
67
67
|
export declare const setRandomSearchSchema: (arg1: string, callback: (err: NodeJS.ErrnoException, result: string) => void) => void;
|
package/dist/default-pool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-pool.js","sourceRoot":"","sources":["../src/default-pool.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"default-pool.js","sourceRoot":"","sources":["../src/default-pool.ts"],"names":[],"mappings":";;;;AAAA,iCAA6E;AAE7E,MAAM,WAAW,GAAG,IAAI,mBAAY,EAAE,CAAC;AAC9B,kCAAW;AAEpB,2EAA2E;AAC3E,6EAA6E;AAC7E,sDAAsD;AACtD,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,sEAAsE;AACzD,QAAA,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC1C,QAAA,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACpD,QAAA,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC5C,QAAA,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACtD,QAAA,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC9D,QAAA,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACpD,QAAA,eAAe,GAAG,WAAW,CAAC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AC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAChE,QAAA,eAAe,GAAG,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAChE,QAAA,qBAAqB,GAAG,WAAW,CAAC,qBAAqB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC5E,QAAA,0BAA0B,GAAG,WAAW,CAAC,0BAA0B,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/default-pool.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PostgresPool } from './pool';
|
|
1
|
+
import { PostgresPool, type CursorIterator, type QueryParams } from './pool';
|
|
2
2
|
|
|
3
3
|
const defaultPool = new PostgresPool();
|
|
4
|
-
export { defaultPool };
|
|
4
|
+
export { defaultPool, type CursorIterator, type QueryParams };
|
|
5
5
|
|
|
6
6
|
// We re-expose all functions from the default pool here to account for the
|
|
7
7
|
// default case of a shared global pool of clients. If someone want to create
|