cry-synced-db-client 0.1.15 → 0.1.16

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.
@@ -7,6 +7,8 @@ export interface Ebus2ProxyServerUpdateNotifierConfig {
7
7
  dbName: string;
8
8
  /** Collections to subscribe to */
9
9
  collections: string[];
10
+ /** API key for ebus-proxy authentication (passed as ?apikey query parameter) */
11
+ ebusProxyApiKey?: string;
10
12
  /** Initial reconnect delay in ms (default: 1000) */
11
13
  reconnectDelayMs?: number;
12
14
  /** Maximum reconnect delay in ms (default: 30000) */
@@ -28,6 +30,7 @@ export declare class Ebus2ProxyServerUpdateNotifier implements I_ServerUpdateNot
28
30
  private wsUrl;
29
31
  private dbName;
30
32
  private collections;
33
+ private ebusProxyApiKey?;
31
34
  private reconnectDelayMs;
32
35
  private maxReconnectDelayMs;
33
36
  private pingIntervalMs;
package/dist/index.js CHANGED
@@ -3872,6 +3872,7 @@ class Ebus2ProxyServerUpdateNotifier {
3872
3872
  wsUrl;
3873
3873
  dbName;
3874
3874
  collections;
3875
+ ebusProxyApiKey;
3875
3876
  reconnectDelayMs;
3876
3877
  maxReconnectDelayMs;
3877
3878
  pingIntervalMs;
@@ -3895,6 +3896,7 @@ class Ebus2ProxyServerUpdateNotifier {
3895
3896
  this.wsUrl = config.wsUrl;
3896
3897
  this.dbName = config.dbName;
3897
3898
  this.collections = config.collections;
3899
+ this.ebusProxyApiKey = config.ebusProxyApiKey;
3898
3900
  this.reconnectDelayMs = config.reconnectDelayMs ?? DEFAULT_RECONNECT_DELAY_MS;
3899
3901
  this.maxReconnectDelayMs = config.maxReconnectDelayMs ?? DEFAULT_MAX_RECONNECT_DELAY_MS;
3900
3902
  this.pingIntervalMs = config.pingIntervalMs ?? DEFAULT_PING_INTERVAL_MS;
@@ -3952,7 +3954,12 @@ class Ebus2ProxyServerUpdateNotifier {
3952
3954
  return;
3953
3955
  }
3954
3956
  try {
3955
- this.ws = new WebSocket(this.wsUrl);
3957
+ let url = this.wsUrl;
3958
+ if (this.ebusProxyApiKey) {
3959
+ const separator = url.includes("?") ? "&" : "?";
3960
+ url = `${url}${separator}apikey=${encodeURIComponent(this.ebusProxyApiKey)}`;
3961
+ }
3962
+ this.ws = new WebSocket(url);
3956
3963
  this.ws.binaryType = "arraybuffer";
3957
3964
  this.ws.onopen = () => {
3958
3965
  this.handleOpen();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cry-synced-db-client",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",