dzql 0.2.2 → 0.2.3
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 +2 -2
- package/src/client/ws.js +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dzql",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "PostgreSQL-powered framework with zero boilerplate CRUD operations and real-time WebSocket synchronization",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/server/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"test": "bun test",
|
|
25
|
-
"prepublishOnly": "echo '✅ Publishing DZQL v0.2.
|
|
25
|
+
"prepublishOnly": "echo '✅ Publishing DZQL v0.2.3...'"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"jose": "^6.1.0",
|
package/src/client/ws.js
CHANGED
|
@@ -52,6 +52,7 @@ class WebSocketManager {
|
|
|
52
52
|
*
|
|
53
53
|
* @param {Object} [options={}] - Configuration options
|
|
54
54
|
* @param {number} [options.maxReconnectAttempts=5] - Maximum reconnection attempts before giving up
|
|
55
|
+
* @param {string} [options.tokenName='dzql_token'] - Name of the localStorage key for JWT token
|
|
55
56
|
*/
|
|
56
57
|
constructor(options = {}) {
|
|
57
58
|
this.ws = null;
|
|
@@ -62,6 +63,7 @@ class WebSocketManager {
|
|
|
62
63
|
this.subscriptions = new Map(); // subscription_id -> { callback, unsubscribe }
|
|
63
64
|
this.reconnectAttempts = 0;
|
|
64
65
|
this.maxReconnectAttempts = options.maxReconnectAttempts ?? 5;
|
|
66
|
+
this.tokenName = options.tokenName ?? 'dzql_token';
|
|
65
67
|
this.isShuttingDown = false;
|
|
66
68
|
|
|
67
69
|
// DZQL nested proxy API - matches server-side db.api pattern
|
|
@@ -265,7 +267,7 @@ class WebSocketManager {
|
|
|
265
267
|
|
|
266
268
|
// Add JWT token as query parameter if available
|
|
267
269
|
if (typeof localStorage !== 'undefined'){
|
|
268
|
-
const storedToken = localStorage.getItem(
|
|
270
|
+
const storedToken = localStorage.getItem(this.tokenName);
|
|
269
271
|
if (storedToken) {
|
|
270
272
|
wsUrl += `?token=${encodeURIComponent(storedToken)}`;
|
|
271
273
|
}
|