@motiadev/stream-client-browser 0.11.0-beta.155-832951 → 0.11.1-beta.155

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/README.md CHANGED
@@ -27,10 +27,7 @@ npm install @motiadev/stream-client-browser
27
27
  ```typescript
28
28
  import { Stream } from '@motiadev/stream-client-browser'
29
29
 
30
- const token = window.sessionStorage.getItem('motia.streamToken') ?? undefined
31
- const protocols = token ? ['Authorization', token] : undefined
32
-
33
- const stream = new Stream('wss://your-stream-server', { protocols })
30
+ const stream = new Stream('wss://your-stream-server')
34
31
  ```
35
32
 
36
33
  ### 2. Subscribing to an Item Stream
@@ -72,10 +69,10 @@ stream.close()
72
69
 
73
70
  ### `Stream`
74
71
 
75
- - **constructor(address: string, options?: { protocols?: string | string[] })**
72
+ - **constructor(address: string, onReady: () => void)**
76
73
 
77
74
  - Establishes a WebSocket connection to the given address.
78
- - Passes any `protocols` directly to the underlying `WebSocket` constructor (useful for sending `Sec-WebSocket-Protocol: Authorization,<token>`).
75
+ - Calls `onReady` when the connection is open.
79
76
 
80
77
  - **subscribeItem<T>(streamName: string, id: string): StreamItemSubscription<T>**
81
78
 
@@ -164,10 +161,7 @@ All types are exported from `stream.types.ts` for advanced usage and type safety
164
161
  ```typescript
165
162
  import { Stream } from '@motiadev/stream-client-browser'
166
163
 
167
- const token = window.sessionStorage.getItem('motia.streamToken') ?? undefined
168
- const protocols = token ? ['Authorization', token] : undefined
169
-
170
- const stream = new Stream('wss://example.com', { protocols })
164
+ const stream = new Stream('wss://example.com')
171
165
  const userSub = stream.subscribeItem<{ id: string; name: string }>('users', 'user-1')
172
166
 
173
167
  userSub.addChangeListener((user) => {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,2 @@
1
1
  export { StreamGroupSubscription, StreamItemSubscription, StreamSubscription } from '@motiadev/stream-client';
2
- export type { BrowserStreamOptions } from './src/stream';
3
2
  export { Stream } from './src/stream';
4
- //# sourceMappingURL=index.d.ts.map
@@ -5,7 +5,7 @@ export declare class StreamSocketAdapter implements SocketAdapter {
5
5
  private onMessageListeners;
6
6
  private onOpenListeners;
7
7
  private onCloseListeners;
8
- constructor(address: string, protocols?: string | string[] | undefined);
8
+ constructor(address: string);
9
9
  connect(): void;
10
10
  send(message: string): void;
11
11
  onMessage(callback: (message: string) => void): void;
@@ -14,4 +14,3 @@ export declare class StreamSocketAdapter implements SocketAdapter {
14
14
  close(): void;
15
15
  isOpen(): boolean;
16
16
  }
17
- //# sourceMappingURL=stream-adapter.d.ts.map
@@ -1,10 +1,10 @@
1
1
  export class StreamSocketAdapter {
2
- constructor(address, protocols) {
2
+ constructor(address) {
3
3
  this.address = address;
4
4
  this.onMessageListeners = [];
5
5
  this.onOpenListeners = [];
6
6
  this.onCloseListeners = [];
7
- this.ws = new WebSocket(this.address, protocols);
7
+ this.ws = new WebSocket(this.address);
8
8
  }
9
9
  connect() { }
10
10
  send(message) {
@@ -1,8 +1,4 @@
1
1
  import { Stream as StreamClient } from '@motiadev/stream-client';
2
- export type BrowserStreamOptions = {
3
- protocols?: string | string[] | undefined;
4
- };
5
2
  export declare class Stream extends StreamClient {
6
- constructor(address: string, options?: BrowserStreamOptions);
3
+ constructor(address: string);
7
4
  }
8
- //# sourceMappingURL=stream.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { Stream as StreamClient } from '@motiadev/stream-client';
2
2
  import { StreamSocketAdapter } from './stream-adapter';
3
3
  export class Stream extends StreamClient {
4
- constructor(address, options) {
5
- super(() => new StreamSocketAdapter(address, options?.protocols));
4
+ constructor(address) {
5
+ super(() => new StreamSocketAdapter(address));
6
6
  }
7
7
  }
package/index.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export { StreamGroupSubscription, StreamItemSubscription, StreamSubscription } from '@motiadev/stream-client'
2
- export type { BrowserStreamOptions } from './src/stream'
3
2
  export { Stream } from './src/stream'
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@motiadev/stream-client-browser",
3
3
  "description": "Motia Stream Client Package – Responsible for managing streams of data.",
4
- "version": "0.11.0-beta.155-832951",
4
+ "version": "0.11.1-beta.155",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "dependencies": {
9
9
  "uuid": "^11.1.0",
10
- "@motiadev/stream-client": "0.11.0-beta.155-832951"
10
+ "@motiadev/stream-client": "0.11.1-beta.155"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/jest": "^29.5.14",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC7G,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-adapter.d.ts","sourceRoot":"","sources":["../../src/stream-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAE5D,qBAAa,mBAAoB,YAAW,aAAa;IAQrD,OAAO,CAAC,OAAO;IAPjB,OAAO,CAAC,EAAE,CAAW;IAErB,OAAO,CAAC,kBAAkB,CAAkD;IAC5E,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,gBAAgB,CAAqB;gBAGnC,OAAO,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;IAK3C,OAAO,IAAI,IAAI;IAEf,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,SAAS,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAOpD,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAKlC,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAKnC,KAAK,IAAI,IAAI;IAOb,MAAM,IAAI,OAAO;CAGlB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAGhE,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;CAC1C,CAAA;AAED,qBAAa,MAAO,SAAQ,YAAY;gBAC1B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB;CAG5D"}