@mikro-orm/pglite 7.1.5-dev.4 → 7.1.5-dev.6
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/PgliteConnection.js +13 -11
- package/package.json +3 -3
package/PgliteConnection.js
CHANGED
|
@@ -40,14 +40,16 @@ export class PgliteConnection extends AbstractSqlConnection {
|
|
|
40
40
|
const dataDir = options.dataDir ?? dbName;
|
|
41
41
|
const parsers = { ...createPostgreSqlTypeParsers(s => array.parse(s)), ...options.parsers };
|
|
42
42
|
this.#ownsPglite = !userPglite;
|
|
43
|
-
// Skip `pglite.close()` (called by kysely's `PGliteDriver.destroy()`)
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
// so the next dialect-construction rebuilds the PGlite instance.
|
|
50
|
-
|
|
43
|
+
// Skip `pglite.close()` (called by kysely's `PGliteDriver.destroy()`) only
|
|
44
|
+
// when the user owns the instance — closing it is their responsibility, and
|
|
45
|
+
// patching `close` on it directly would orphan it (its real `close` would
|
|
46
|
+
// stay neutered after `orm.close()`). Instances we own (in-memory or
|
|
47
|
+
// file/IDB-backed) get really closed so the underlying WASM / file handle /
|
|
48
|
+
// IDB resources are released; we drop our cached promise in `close()` below
|
|
49
|
+
// so the next dialect-construction rebuilds the PGlite instance. In-memory
|
|
50
|
+
// data does not survive `orm.close()`, consistent with other in-memory
|
|
51
|
+
// drivers (e.g. SQLite `:memory:`).
|
|
52
|
+
this.#neuterClose = !this.#ownsPglite;
|
|
51
53
|
if (!this.#pglite) {
|
|
52
54
|
if (userPglite) {
|
|
53
55
|
this.#pglite = typeof userPglite === 'function' ? Promise.resolve(userPglite()) : Promise.resolve(userPglite);
|
|
@@ -88,9 +90,9 @@ export class PgliteConnection extends AbstractSqlConnection {
|
|
|
88
90
|
}
|
|
89
91
|
async close(force) {
|
|
90
92
|
await super.close(force);
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
//
|
|
93
|
+
// Instances we own get really closed by kysely — drop the cached promise so a
|
|
94
|
+
// subsequent reconnect rebuilds a fresh instance (file/IDB backings re-read the
|
|
95
|
+
// persisted data; in-memory starts empty, matching other in-memory drivers).
|
|
94
96
|
if (this.#ownsPglite && !this.#neuterClose) {
|
|
95
97
|
this.#pglite = undefined;
|
|
96
98
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/pglite",
|
|
3
|
-
"version": "7.1.5-dev.
|
|
3
|
+
"version": "7.1.5-dev.6",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@electric-sql/pglite": "0.5.1",
|
|
52
|
-
"@mikro-orm/sql": "7.1.5-dev.
|
|
52
|
+
"@mikro-orm/sql": "7.1.5-dev.6",
|
|
53
53
|
"kysely": "0.29.2",
|
|
54
54
|
"postgres-array": "3.0.4",
|
|
55
55
|
"postgres-date": "2.1.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@mikro-orm/core": "^7.1.4"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@mikro-orm/core": "7.1.5-dev.
|
|
62
|
+
"@mikro-orm/core": "7.1.5-dev.6"
|
|
63
63
|
},
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">= 22.17.0"
|