kern-db 0.5.0 → 0.6.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.
|
@@ -1310,6 +1310,9 @@ var OpenTestTransactions = class {
|
|
|
1310
1310
|
if (current) throw new Error("Cannot run a callback in an open test transaction inside a transaction");
|
|
1311
1311
|
return this.#storage.run(level, callback);
|
|
1312
1312
|
},
|
|
1313
|
+
get isOpen() {
|
|
1314
|
+
return level.state === "open";
|
|
1315
|
+
},
|
|
1313
1316
|
close,
|
|
1314
1317
|
[Symbol.asyncDispose]: close
|
|
1315
1318
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as defineType, s as isType } from "./bytea-DNZ_ftio.mjs";
|
|
2
2
|
import { C as isDriver, S as createStatement, _ as sql, h as param, i as ResultDecodeError, m as identifier, r as NotFoundError } from "./query-FKBN7BMY.mjs";
|
|
3
3
|
import { a as toDriverError, n as QueryError, t as ConnectionError } from "./driver-error-D8D4UQ4F.mjs";
|
|
4
|
-
import { a as TransactionConnectionError, i as isQueryError, o as isOutcomeUnknown, r as isDatabase, t as createDatabase } from "./database-
|
|
4
|
+
import { a as TransactionConnectionError, i as isQueryError, o as isOutcomeUnknown, r as isDatabase, t as createDatabase } from "./database-DITSIc_K.mjs";
|
|
5
5
|
export { ConnectionError, NotFoundError, QueryError, ResultDecodeError, TransactionConnectionError, createDatabase, createStatement, defineType, identifier, isDatabase, isDriver, isOutcomeUnknown, isQueryError, isType, param, sql, toDriverError };
|
package/dist/testing.d.mts
CHANGED
|
@@ -22,6 +22,8 @@ interface OpenedTestTransaction extends AsyncDisposable {
|
|
|
22
22
|
* It rejects without calling `callback` once the test transaction is closed, and inside a transaction.
|
|
23
23
|
*/
|
|
24
24
|
run<T>(callback: () => Promise<T>): Promise<T>;
|
|
25
|
+
/** Whether the test transaction runs callbacks: it is `false` from the start of its closing, such as when a later test transaction in its fixture rolls it back. */
|
|
26
|
+
readonly isOpen: boolean;
|
|
25
27
|
/** Rolls back the test transaction; the later queries of its callbacks fail, and closing it again returns the same closing. */
|
|
26
28
|
close(): Promise<void>;
|
|
27
29
|
}
|
package/dist/testing.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { r as boolean, t as bytea } from "./bytea-DNZ_ftio.mjs";
|
|
|
2
2
|
import { S as createStatement, _ as sql, h as param, m as identifier } from "./query-FKBN7BMY.mjs";
|
|
3
3
|
import { n as QueryError, t as ConnectionError } from "./driver-error-D8D4UQ4F.mjs";
|
|
4
4
|
import { t as array } from "./array-BLt8ZNR5.mjs";
|
|
5
|
-
import { a as TransactionConnectionError, n as getCoordinator, s as pause, t as createDatabase } from "./database-
|
|
5
|
+
import { a as TransactionConnectionError, n as getCoordinator, s as pause, t as createDatabase } from "./database-DITSIc_K.mjs";
|
|
6
6
|
import { _ as interval, a as bigint, b as timestamptz, c as numeric, f as inet, g as date, h as enumOf, m as jsonb, n as char, o as doublePrecision, r as text, s as integer, t as uuid, v as time, y as timestamp } from "./types-Dl2oicjV.mjs";
|
|
7
7
|
import assert from "node:assert/strict";
|
|
8
8
|
// src/test-helpers.ts
|
|
@@ -217,15 +217,18 @@ function describeDriverContract(options, runner) {
|
|
|
217
217
|
const created = await database.execute(createStatement("CREATE TEMP TABLE pg_count_test (id integer) ON COMMIT DROP"));
|
|
218
218
|
const inserted = await database.execute(createStatement("INSERT INTO pg_count_test VALUES (1), (2), (3)"));
|
|
219
219
|
const updated = await database.execute(createStatement("UPDATE pg_count_test SET id = id + 1 WHERE id > 1"));
|
|
220
|
+
const selected = await database.execute(createStatement("SELECT FROM pg_count_test WHERE id > 2"));
|
|
220
221
|
return [
|
|
221
222
|
created.count,
|
|
222
223
|
inserted.count,
|
|
223
|
-
updated.count
|
|
224
|
+
updated.count,
|
|
225
|
+
selected.count
|
|
224
226
|
];
|
|
225
227
|
});
|
|
226
228
|
assert.deepEqual(counts, [
|
|
227
229
|
0,
|
|
228
230
|
3,
|
|
231
|
+
2,
|
|
229
232
|
2
|
|
230
233
|
]);
|
|
231
234
|
});
|