@dbcube/core 1.0.55 → 1.0.57
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 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -593,21 +593,32 @@ var Config = class {
|
|
|
593
593
|
// src/lib/Engine.ts
|
|
594
594
|
var import_child_process = require("child_process");
|
|
595
595
|
var import_module = require("module");
|
|
596
|
-
var Engine = class {
|
|
597
|
-
|
|
596
|
+
var Engine = class _Engine {
|
|
597
|
+
static instances = /* @__PURE__ */ new Map();
|
|
598
|
+
name = "";
|
|
598
599
|
config;
|
|
599
600
|
arguments;
|
|
600
601
|
binary = null;
|
|
601
|
-
timeout;
|
|
602
|
+
timeout = 3e4;
|
|
602
603
|
isDaemonConnected = false;
|
|
603
604
|
isConnecting = false;
|
|
604
605
|
constructor(name, timeout = 3e4) {
|
|
606
|
+
if (_Engine.instances.has(name)) {
|
|
607
|
+
return _Engine.instances.get(name);
|
|
608
|
+
}
|
|
605
609
|
this.name = name;
|
|
606
610
|
this.config = this.setConfig(name);
|
|
607
611
|
this.arguments = this.setArguments();
|
|
608
612
|
this.timeout = timeout;
|
|
613
|
+
_Engine.instances.set(name, this);
|
|
609
614
|
this.setupProcessExitHandlers();
|
|
610
615
|
}
|
|
616
|
+
static getInstance(name, timeout = 3e4) {
|
|
617
|
+
if (_Engine.instances.has(name)) {
|
|
618
|
+
return _Engine.instances.get(name);
|
|
619
|
+
}
|
|
620
|
+
return new _Engine(name, timeout);
|
|
621
|
+
}
|
|
611
622
|
async initializeBinary() {
|
|
612
623
|
if (!this.binary) {
|
|
613
624
|
this.binary = await Binary.get();
|