@rebasepro/client 0.20.0 → 0.21.0
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/index.es.js +90 -38
- package/dist/index.es.js.map +1 -1
- package/dist/realtime-channel.d.ts +11 -4
- package/dist/websocket.d.ts +2 -13
- package/package.json +4 -4
|
@@ -23,8 +23,16 @@
|
|
|
23
23
|
* else's roster while still sitting in the document, so `track()` starts a
|
|
24
24
|
* heartbeat and `leave()` stops it.
|
|
25
25
|
*/
|
|
26
|
-
/**
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Presence state keyed by the server's client id.
|
|
28
|
+
*
|
|
29
|
+
* Re-exported rather than re-declared, for the same reason
|
|
30
|
+
* {@link ChannelHistoryEntry} is below: the frames that carry a roster are
|
|
31
|
+
* declared in `@rebasepro/types`, and a second copy of the shape here is a
|
|
32
|
+
* second thing to keep in step with the wire.
|
|
33
|
+
*/
|
|
34
|
+
export type { PresenceState } from "@rebasepro/types";
|
|
35
|
+
import type { ChannelHistoryEntry, ChannelMessage, PresenceState } from "@rebasepro/types";
|
|
28
36
|
export interface PresenceDiff {
|
|
29
37
|
joins: PresenceState;
|
|
30
38
|
leaves: PresenceState;
|
|
@@ -56,7 +64,6 @@ export interface BroadcastEvent {
|
|
|
56
64
|
* drifted `at` to optional, while the server always sends it.
|
|
57
65
|
*/
|
|
58
66
|
export type { ChannelHistoryEntry } from "@rebasepro/types";
|
|
59
|
-
import type { ChannelHistoryEntry } from "@rebasepro/types";
|
|
60
67
|
import { RebaseApiError } from "@rebasepro/types";
|
|
61
68
|
/** The answer to a catch-up request. */
|
|
62
69
|
export interface ChannelHistoryResult {
|
|
@@ -89,7 +96,7 @@ export interface ChannelOptions {
|
|
|
89
96
|
/** The socket operations a channel needs; satisfied by RebaseWebSocketClient. */
|
|
90
97
|
export interface ChannelTransport {
|
|
91
98
|
sendMessage(message: Record<string, unknown>): Promise<unknown>;
|
|
92
|
-
onChannelMessage(channel: string, handler: (message:
|
|
99
|
+
onChannelMessage(channel: string, handler: (message: ChannelMessage) => void): () => void;
|
|
93
100
|
onReconnect(handler: () => void): () => void;
|
|
94
101
|
}
|
|
95
102
|
export declare class RebaseRealtimeChannel {
|
package/dist/websocket.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeleteProps, CollectionConfig, FetchCollectionProps, ListenCollectionProps, FetchOneProps, SaveProps, CollectionUpdateMeta, TableMetadata, BranchInfo } from "@rebasepro/types";
|
|
1
|
+
import { DeleteProps, CollectionConfig, FetchCollectionProps, ListenCollectionProps, FetchOneProps, SaveProps, CollectionUpdateMeta, ChannelMessage, TableMetadata, BranchInfo } from "@rebasepro/types";
|
|
2
2
|
export interface RebaseWebSocketConfig {
|
|
3
3
|
websocketUrl: string;
|
|
4
4
|
/** Optional auth token getter for WebSocket authentication */
|
|
@@ -8,17 +8,6 @@ export interface RebaseWebSocketConfig {
|
|
|
8
8
|
/** Callback to handle unauthorized requests or token expiration (refreshes auth session) */
|
|
9
9
|
onUnauthorized?: () => Promise<boolean>;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Low-level realtime WebSocket client.
|
|
13
|
-
*
|
|
14
|
-
* @internal Not a stable app-facing API. `createRebaseClient()` constructs and
|
|
15
|
-
* manages this internally (exposed as `client.ws`, typed by the minimal
|
|
16
|
-
* `RebaseWebSocket` contract in `@rebasepro/types`). It stays exported from the
|
|
17
|
-
* package root for the same reason it always was — a data-source driver may
|
|
18
|
-
* instantiate it directly — but nothing in this repo does since
|
|
19
|
-
* `@rebasepro/client-postgres` was removed; its surface may change without a
|
|
20
|
-
* major bump.
|
|
21
|
-
*/
|
|
22
11
|
export declare class RebaseWebSocketClient {
|
|
23
12
|
private websocketUrl;
|
|
24
13
|
private ws;
|
|
@@ -49,7 +38,7 @@ export declare class RebaseWebSocketClient {
|
|
|
49
38
|
/** So the "no WebSocket in this environment" warning is said once, not per call. */
|
|
50
39
|
private warnedNoWebSocket;
|
|
51
40
|
/** Subscribe to broadcast/presence frames for one channel. */
|
|
52
|
-
onChannelMessage(channel: string, handler: (message:
|
|
41
|
+
onChannelMessage(channel: string, handler: (message: ChannelMessage) => void): () => void;
|
|
53
42
|
/** Notified after the socket comes back, so channels can re-join. */
|
|
54
43
|
onReconnect(handler: () => void): () => void;
|
|
55
44
|
on(event: "connect" | "disconnect" | "reconnect" | "error", cb: (...args: unknown[]) => void): () => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "HTTP SDK client for the Rebase custom backend",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rebase",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@rebasepro/
|
|
45
|
-
"@rebasepro/
|
|
46
|
-
"@rebasepro/types": "0.
|
|
44
|
+
"@rebasepro/common": "0.21.0",
|
|
45
|
+
"@rebasepro/utils": "0.21.0",
|
|
46
|
+
"@rebasepro/types": "0.21.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@jest/globals": "^30.4.1",
|