@omnibase/core-js 0.7.0 → 0.7.1
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/database/index.cjs +1 -28
- package/dist/database/index.d.cts +3 -3
- package/dist/database/index.d.ts +3 -3
- package/dist/database/index.js +1 -28
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/database/index.cjs
CHANGED
|
@@ -70,7 +70,6 @@ var EventsClient = class {
|
|
|
70
70
|
if (!WS) return;
|
|
71
71
|
this.ws = new WS(this.url);
|
|
72
72
|
this.ws.onopen = () => {
|
|
73
|
-
console.log("\u2705 Connected to database events");
|
|
74
73
|
this.reconnectDelay = 1e3;
|
|
75
74
|
this.subscriptions.forEach((sub) => this.send(sub));
|
|
76
75
|
};
|
|
@@ -80,17 +79,12 @@ var EventsClient = class {
|
|
|
80
79
|
this.handleMessage(msg);
|
|
81
80
|
};
|
|
82
81
|
this.ws.onerror = (error) => {
|
|
83
|
-
console.error("
|
|
82
|
+
console.error("WebSocket error:", error);
|
|
84
83
|
};
|
|
85
84
|
this.ws.onclose = () => {
|
|
86
85
|
if (this.shouldReconnect) {
|
|
87
|
-
console.log(
|
|
88
|
-
`\u26A0\uFE0F Disconnected, reconnecting in ${this.reconnectDelay}ms`
|
|
89
|
-
);
|
|
90
86
|
setTimeout(() => this.connect(), this.reconnectDelay);
|
|
91
87
|
this.reconnectDelay = Math.min(this.reconnectDelay * 2, 3e4);
|
|
92
|
-
} else {
|
|
93
|
-
console.log("Disconnected from database events");
|
|
94
88
|
}
|
|
95
89
|
};
|
|
96
90
|
}
|
|
@@ -185,27 +179,6 @@ var EventsClient = class {
|
|
|
185
179
|
if (listener) {
|
|
186
180
|
listener(msg.data, msg);
|
|
187
181
|
}
|
|
188
|
-
} else if ("status" in msg) {
|
|
189
|
-
if (msg.status === "subscribed") {
|
|
190
|
-
console.log(
|
|
191
|
-
"\u2705 Subscribed to",
|
|
192
|
-
msg.table,
|
|
193
|
-
msg.row_id ? `(row ${msg.row_id})` : "(all rows)"
|
|
194
|
-
);
|
|
195
|
-
} else if (msg.status === "unsubscribed") {
|
|
196
|
-
console.log(
|
|
197
|
-
"Unsubscribed from",
|
|
198
|
-
msg.table,
|
|
199
|
-
msg.row_id ? `(row ${msg.row_id})` : "(all rows)"
|
|
200
|
-
);
|
|
201
|
-
} else if (msg.status === "error") {
|
|
202
|
-
console.error(
|
|
203
|
-
"\u274C Subscription error:",
|
|
204
|
-
msg.error,
|
|
205
|
-
"for table:",
|
|
206
|
-
msg.table
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
182
|
}
|
|
210
183
|
}
|
|
211
184
|
/**
|
|
@@ -116,7 +116,7 @@ declare const createClient: <T = any>(url: string, anonKey: string, getCookie: (
|
|
|
116
116
|
*/
|
|
117
117
|
interface SubscriptionOptions {
|
|
118
118
|
/** Specific row ID to subscribe to (optional) */
|
|
119
|
-
rowId?:
|
|
119
|
+
rowId?: string;
|
|
120
120
|
/** Specific columns to filter updates (optional) */
|
|
121
121
|
columns?: string[];
|
|
122
122
|
/** Callback function triggered on data updates */
|
|
@@ -127,7 +127,7 @@ interface SubscriptionOptions {
|
|
|
127
127
|
*/
|
|
128
128
|
interface Subscription {
|
|
129
129
|
table: string;
|
|
130
|
-
row_id?:
|
|
130
|
+
row_id?: string;
|
|
131
131
|
columns?: string[];
|
|
132
132
|
jwt: string;
|
|
133
133
|
}
|
|
@@ -256,7 +256,7 @@ declare class EventsClient {
|
|
|
256
256
|
* client.unsubscribe('users', 123);
|
|
257
257
|
* ```
|
|
258
258
|
*/
|
|
259
|
-
unsubscribe(table: string, rowId?:
|
|
259
|
+
unsubscribe(table: string, rowId?: string): void;
|
|
260
260
|
/**
|
|
261
261
|
* Send message to WebSocket server
|
|
262
262
|
* @private
|
package/dist/database/index.d.ts
CHANGED
|
@@ -116,7 +116,7 @@ declare const createClient: <T = any>(url: string, anonKey: string, getCookie: (
|
|
|
116
116
|
*/
|
|
117
117
|
interface SubscriptionOptions {
|
|
118
118
|
/** Specific row ID to subscribe to (optional) */
|
|
119
|
-
rowId?:
|
|
119
|
+
rowId?: string;
|
|
120
120
|
/** Specific columns to filter updates (optional) */
|
|
121
121
|
columns?: string[];
|
|
122
122
|
/** Callback function triggered on data updates */
|
|
@@ -127,7 +127,7 @@ interface SubscriptionOptions {
|
|
|
127
127
|
*/
|
|
128
128
|
interface Subscription {
|
|
129
129
|
table: string;
|
|
130
|
-
row_id?:
|
|
130
|
+
row_id?: string;
|
|
131
131
|
columns?: string[];
|
|
132
132
|
jwt: string;
|
|
133
133
|
}
|
|
@@ -256,7 +256,7 @@ declare class EventsClient {
|
|
|
256
256
|
* client.unsubscribe('users', 123);
|
|
257
257
|
* ```
|
|
258
258
|
*/
|
|
259
|
-
unsubscribe(table: string, rowId?:
|
|
259
|
+
unsubscribe(table: string, rowId?: string): void;
|
|
260
260
|
/**
|
|
261
261
|
* Send message to WebSocket server
|
|
262
262
|
* @private
|
package/dist/database/index.js
CHANGED
|
@@ -43,7 +43,6 @@ var EventsClient = class {
|
|
|
43
43
|
if (!WS) return;
|
|
44
44
|
this.ws = new WS(this.url);
|
|
45
45
|
this.ws.onopen = () => {
|
|
46
|
-
console.log("\u2705 Connected to database events");
|
|
47
46
|
this.reconnectDelay = 1e3;
|
|
48
47
|
this.subscriptions.forEach((sub) => this.send(sub));
|
|
49
48
|
};
|
|
@@ -53,17 +52,12 @@ var EventsClient = class {
|
|
|
53
52
|
this.handleMessage(msg);
|
|
54
53
|
};
|
|
55
54
|
this.ws.onerror = (error) => {
|
|
56
|
-
console.error("
|
|
55
|
+
console.error("WebSocket error:", error);
|
|
57
56
|
};
|
|
58
57
|
this.ws.onclose = () => {
|
|
59
58
|
if (this.shouldReconnect) {
|
|
60
|
-
console.log(
|
|
61
|
-
`\u26A0\uFE0F Disconnected, reconnecting in ${this.reconnectDelay}ms`
|
|
62
|
-
);
|
|
63
59
|
setTimeout(() => this.connect(), this.reconnectDelay);
|
|
64
60
|
this.reconnectDelay = Math.min(this.reconnectDelay * 2, 3e4);
|
|
65
|
-
} else {
|
|
66
|
-
console.log("Disconnected from database events");
|
|
67
61
|
}
|
|
68
62
|
};
|
|
69
63
|
}
|
|
@@ -158,27 +152,6 @@ var EventsClient = class {
|
|
|
158
152
|
if (listener) {
|
|
159
153
|
listener(msg.data, msg);
|
|
160
154
|
}
|
|
161
|
-
} else if ("status" in msg) {
|
|
162
|
-
if (msg.status === "subscribed") {
|
|
163
|
-
console.log(
|
|
164
|
-
"\u2705 Subscribed to",
|
|
165
|
-
msg.table,
|
|
166
|
-
msg.row_id ? `(row ${msg.row_id})` : "(all rows)"
|
|
167
|
-
);
|
|
168
|
-
} else if (msg.status === "unsubscribed") {
|
|
169
|
-
console.log(
|
|
170
|
-
"Unsubscribed from",
|
|
171
|
-
msg.table,
|
|
172
|
-
msg.row_id ? `(row ${msg.row_id})` : "(all rows)"
|
|
173
|
-
);
|
|
174
|
-
} else if (msg.status === "error") {
|
|
175
|
-
console.error(
|
|
176
|
-
"\u274C Subscription error:",
|
|
177
|
-
msg.error,
|
|
178
|
-
"for table:",
|
|
179
|
-
msg.table
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
155
|
}
|
|
183
156
|
}
|
|
184
157
|
/**
|
package/dist/index.js
CHANGED