@dyrected/db-mysql 2.8.2 → 2.9.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/dist/index.cjs +14 -5
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -5
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -56,11 +56,6 @@ var MysqlAdapter = class {
|
|
|
56
56
|
inTransaction = false;
|
|
57
57
|
constructor(config) {
|
|
58
58
|
this.config = config;
|
|
59
|
-
this.ensureInitialized().catch((err) => {
|
|
60
|
-
if (err.code === "EADDRNOTAVAIL" || err.message?.includes("EADDRNOTAVAIL")) {
|
|
61
|
-
this.handleConnectionError(err);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
59
|
}
|
|
65
60
|
handleConnectionError(err) {
|
|
66
61
|
if (err && (err.code === "EADDRNOTAVAIL" || err.message?.includes("EADDRNOTAVAIL"))) {
|
|
@@ -413,6 +408,20 @@ FIX INSTRUCTIONS:
|
|
|
413
408
|
}
|
|
414
409
|
return result;
|
|
415
410
|
}
|
|
411
|
+
async disconnect() {
|
|
412
|
+
if (this.initPromise) {
|
|
413
|
+
try {
|
|
414
|
+
await this.initPromise;
|
|
415
|
+
} catch {
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (this.pool && typeof this.pool.end === "function") {
|
|
419
|
+
await this.pool.end().catch(() => {
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
this.initPromise = null;
|
|
423
|
+
this.pool = null;
|
|
424
|
+
}
|
|
416
425
|
};
|
|
417
426
|
var mysqlAdapter = (config) => new MysqlAdapter(config);
|
|
418
427
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.d.cts
CHANGED
|
@@ -62,6 +62,7 @@ declare class MysqlAdapter implements DatabaseAdapter {
|
|
|
62
62
|
collection: string;
|
|
63
63
|
aggregates: Record<string, any>;
|
|
64
64
|
}): Promise<Record<string, number | null>>;
|
|
65
|
+
disconnect(): Promise<void>;
|
|
65
66
|
}
|
|
66
67
|
declare const mysqlAdapter: (config: MysqlAdapterConfig) => MysqlAdapter;
|
|
67
68
|
|
package/dist/index.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ declare class MysqlAdapter implements DatabaseAdapter {
|
|
|
62
62
|
collection: string;
|
|
63
63
|
aggregates: Record<string, any>;
|
|
64
64
|
}): Promise<Record<string, number | null>>;
|
|
65
|
+
disconnect(): Promise<void>;
|
|
65
66
|
}
|
|
66
67
|
declare const mysqlAdapter: (config: MysqlAdapterConfig) => MysqlAdapter;
|
|
67
68
|
|
package/dist/index.js
CHANGED
|
@@ -21,11 +21,6 @@ var MysqlAdapter = class {
|
|
|
21
21
|
inTransaction = false;
|
|
22
22
|
constructor(config) {
|
|
23
23
|
this.config = config;
|
|
24
|
-
this.ensureInitialized().catch((err) => {
|
|
25
|
-
if (err.code === "EADDRNOTAVAIL" || err.message?.includes("EADDRNOTAVAIL")) {
|
|
26
|
-
this.handleConnectionError(err);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
24
|
}
|
|
30
25
|
handleConnectionError(err) {
|
|
31
26
|
if (err && (err.code === "EADDRNOTAVAIL" || err.message?.includes("EADDRNOTAVAIL"))) {
|
|
@@ -378,6 +373,20 @@ FIX INSTRUCTIONS:
|
|
|
378
373
|
}
|
|
379
374
|
return result;
|
|
380
375
|
}
|
|
376
|
+
async disconnect() {
|
|
377
|
+
if (this.initPromise) {
|
|
378
|
+
try {
|
|
379
|
+
await this.initPromise;
|
|
380
|
+
} catch {
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if (this.pool && typeof this.pool.end === "function") {
|
|
384
|
+
await this.pool.end().catch(() => {
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
this.initPromise = null;
|
|
388
|
+
this.pool = null;
|
|
389
|
+
}
|
|
381
390
|
};
|
|
382
391
|
var mysqlAdapter = (config) => new MysqlAdapter(config);
|
|
383
392
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dyrected/db-mysql",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "MySQL adapter for Dyrected CMS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"mysql2": "^3.22.3",
|
|
21
|
-
"@dyrected/core": "^2.
|
|
21
|
+
"@dyrected/core": "^2.9.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"tsup": "^8.0.0",
|