dzql 0.6.25 → 0.6.27
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/package.json +1 -1
- package/src/cli/index.ts +7 -2
- package/src/client/ws.ts +12 -0
package/package.json
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -7,9 +7,14 @@ import { generateSubscribableSQL, generateComputeAffectedKeysFunction } from "./
|
|
|
7
7
|
import { generateManifest } from "./codegen/manifest.js";
|
|
8
8
|
import { generateSubscribableStore } from "./codegen/subscribable_store.js";
|
|
9
9
|
import { generateClientSDK } from "./codegen/client.js";
|
|
10
|
-
import { writeFileSync, mkdirSync, copyFileSync, rmSync } from "fs";
|
|
10
|
+
import { writeFileSync, mkdirSync, copyFileSync, rmSync, readFileSync } from "fs";
|
|
11
11
|
import { resolve, dirname } from "path";
|
|
12
12
|
|
|
13
|
+
// Read version from package.json
|
|
14
|
+
const packageJsonPath = resolve(dirname(import.meta.url.replace('file://', '')), '../../package.json');
|
|
15
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
16
|
+
const VERSION = packageJson.version;
|
|
17
|
+
|
|
13
18
|
const args = process.argv.slice(2);
|
|
14
19
|
let command = args[0];
|
|
15
20
|
let input = args[1];
|
|
@@ -32,7 +37,7 @@ if (outputFlagIndex > -1 && args[outputFlagIndex + 1]) {
|
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
async function main() {
|
|
35
|
-
console.log(
|
|
40
|
+
console.log(`DZQL Compiler v${VERSION}`);
|
|
36
41
|
|
|
37
42
|
if (command === "compile") {
|
|
38
43
|
if (!input) {
|
package/src/client/ws.ts
CHANGED
|
@@ -92,6 +92,18 @@ export class WebSocketManager {
|
|
|
92
92
|
this.ws?.close();
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Disconnect the WebSocket connection.
|
|
97
|
+
* Use this when you need to close the connection without logging out.
|
|
98
|
+
*/
|
|
99
|
+
disconnect() {
|
|
100
|
+
this.isShuttingDown = true;
|
|
101
|
+
this.ready = false;
|
|
102
|
+
this.ws?.close();
|
|
103
|
+
this.ws = null;
|
|
104
|
+
this.isShuttingDown = false;
|
|
105
|
+
}
|
|
106
|
+
|
|
95
107
|
connect(url: string | null = null, timeout = 5000): Promise<void> {
|
|
96
108
|
return new Promise((resolve, reject) => {
|
|
97
109
|
this.ready = false;
|