@yorkie-js/sdk 0.7.9 → 0.7.10-rc2
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/yorkie-js-sdk.d.ts +58 -16
- package/dist/yorkie-js-sdk.es.js +181 -125
- package/dist/yorkie-js-sdk.es.js.map +1 -1
- package/dist/yorkie-js-sdk.js +181 -125
- package/dist/yorkie-js-sdk.js.map +1 -1
- package/package.json +2 -2
package/dist/yorkie-js-sdk.d.ts
CHANGED
|
@@ -106,9 +106,10 @@ export declare interface AttachChannelOptions {
|
|
|
106
106
|
*/
|
|
107
107
|
syncMode?: SyncMode;
|
|
108
108
|
/**
|
|
109
|
-
* `channelHeartbeatInterval` overrides the heartbeat interval (ms) for
|
|
110
|
-
* attachment. If unset,
|
|
111
|
-
*
|
|
109
|
+
* `channelHeartbeatInterval` overrides the heartbeat interval (ms) for
|
|
110
|
+
* this attachment. If unset, the client-level default
|
|
111
|
+
* (`ClientOptions.channelHeartbeatInterval`, default 5000 ms) applies
|
|
112
|
+
* to both Realtime and Polling modes.
|
|
112
113
|
*/
|
|
113
114
|
channelHeartbeatInterval?: number;
|
|
114
115
|
}
|
|
@@ -801,6 +802,12 @@ export declare class Channel implements Observable_2<ChannelEvent>, Attachable {
|
|
|
801
802
|
* The callback will be called when an authentication error occurs.
|
|
802
803
|
*/
|
|
803
804
|
subscribe(type: 'auth-error', next: ChannelEventCallbackMap['auth-error']): Unsubscribe;
|
|
805
|
+
/**
|
|
806
|
+
* `subscribe` registers a callback to subscribe to non-recoverable sync
|
|
807
|
+
* (RefreshChannel) errors. Subsequent successful events on the channel
|
|
808
|
+
* imply recovery — there is no separate "recovered" event.
|
|
809
|
+
*/
|
|
810
|
+
subscribe(type: 'sync-error', next: ChannelEventCallbackMap['sync-error']): Unsubscribe;
|
|
804
811
|
/**
|
|
805
812
|
* `subscribe` registers a callback to subscribe to presence events on the channel.
|
|
806
813
|
* The callback will be called when the presence count changes.
|
|
@@ -834,7 +841,7 @@ export declare class Channel implements Observable_2<ChannelEvent>, Attachable {
|
|
|
834
841
|
/**
|
|
835
842
|
* `ChannelEvent` represents an event that occurs in the channel.
|
|
836
843
|
*/
|
|
837
|
-
export declare type ChannelEvent = PresenceEvent_3 | BroadcastEvent | LocalBroadcastEvent | AuthErrorEvent_3;
|
|
844
|
+
export declare type ChannelEvent = PresenceEvent_3 | BroadcastEvent | LocalBroadcastEvent | AuthErrorEvent_3 | SyncErrorEvent;
|
|
838
845
|
|
|
839
846
|
/**
|
|
840
847
|
* `ChannelEventCallbackMap` represents a map of event types to callbacks.
|
|
@@ -843,6 +850,7 @@ declare type ChannelEventCallbackMap = {
|
|
|
843
850
|
broadcast: NextFn<BroadcastEvent>;
|
|
844
851
|
'local-broadcast': NextFn<LocalBroadcastEvent>;
|
|
845
852
|
'auth-error': NextFn<AuthErrorEvent_3>;
|
|
853
|
+
'sync-error': NextFn<SyncErrorEvent>;
|
|
846
854
|
presence: NextFn<PresenceEvent_3>;
|
|
847
855
|
all: NextFn<ChannelEvent>;
|
|
848
856
|
};
|
|
@@ -870,7 +878,15 @@ export declare enum ChannelEventType {
|
|
|
870
878
|
/**
|
|
871
879
|
* `AuthError` means that an authentication error has occurred.
|
|
872
880
|
*/
|
|
873
|
-
AuthError = "auth-error"
|
|
881
|
+
AuthError = "auth-error",
|
|
882
|
+
/**
|
|
883
|
+
* `SyncError` means that a non-recoverable sync (RefreshChannel) error
|
|
884
|
+
* occurred. Subscribers can use this to render an error state in the UI
|
|
885
|
+
* without polling internal SDK state. The SDK still retries via its sync
|
|
886
|
+
* loop, so subsequent successful events (PresenceChanged/Initialized) can
|
|
887
|
+
* be treated as recovery.
|
|
888
|
+
*/
|
|
889
|
+
SyncError = "sync-error"
|
|
874
890
|
}
|
|
875
891
|
|
|
876
892
|
/**
|
|
@@ -1010,8 +1026,9 @@ export declare class Client {
|
|
|
1010
1026
|
*/
|
|
1011
1027
|
attach<R, P extends Indexable>(resource: Document_2<R, P>, opts?: AttachOptions<R, P>): Promise<Document_2<R, P>>;
|
|
1012
1028
|
/**
|
|
1013
|
-
* `attach` attaches the given channel to this client.
|
|
1014
|
-
*
|
|
1029
|
+
* `attach` attaches the given channel to this client. The channel is
|
|
1030
|
+
* registered locally and the server is notified on the next RefreshChannel
|
|
1031
|
+
* heartbeat.
|
|
1015
1032
|
*/
|
|
1016
1033
|
attach(resource: Channel, opts?: AttachChannelOptions): Promise<Channel>;
|
|
1017
1034
|
/**
|
|
@@ -1027,8 +1044,9 @@ export declare class Client {
|
|
|
1027
1044
|
keepalive?: boolean;
|
|
1028
1045
|
}): Promise<Document_2<R, P>>;
|
|
1029
1046
|
/**
|
|
1030
|
-
* `detach` detaches the given channel from this client.
|
|
1031
|
-
*
|
|
1047
|
+
* `detach` detaches the given channel from this client. The detach is a
|
|
1048
|
+
* local cleanup; the server reclaims the session via TTL when heartbeats
|
|
1049
|
+
* stop.
|
|
1032
1050
|
*/
|
|
1033
1051
|
detach(resource: Channel): Promise<Channel>;
|
|
1034
1052
|
/**
|
|
@@ -1041,13 +1059,15 @@ export declare class Client {
|
|
|
1041
1059
|
*/
|
|
1042
1060
|
private detachDocument;
|
|
1043
1061
|
/**
|
|
1044
|
-
* `
|
|
1045
|
-
*
|
|
1062
|
+
* `attachChannel` attaches the given channel to this client. The channel is
|
|
1063
|
+
* registered locally and the server is notified on the next RefreshChannel
|
|
1064
|
+
* heartbeat.
|
|
1046
1065
|
*/
|
|
1047
1066
|
attachChannel(channel: Channel, opts?: AttachChannelOptions): Promise<Channel>;
|
|
1048
1067
|
/**
|
|
1049
|
-
* `detachChannel` detaches the given channel from this client.
|
|
1050
|
-
*
|
|
1068
|
+
* `detachChannel` detaches the given channel from this client. The detach
|
|
1069
|
+
* is a local cleanup; the server reclaims the session via TTL when
|
|
1070
|
+
* heartbeats stop.
|
|
1051
1071
|
*/
|
|
1052
1072
|
detachChannel(channel: Channel): Promise<Channel>;
|
|
1053
1073
|
/**
|
|
@@ -1241,9 +1261,11 @@ export declare interface ClientOptions {
|
|
|
1241
1261
|
*/
|
|
1242
1262
|
reconnectStreamDelay?: number;
|
|
1243
1263
|
/**
|
|
1244
|
-
* `channelHeartbeatInterval` is the interval of the channel heartbeat.
|
|
1245
|
-
* The client sends a heartbeat to
|
|
1246
|
-
* The default value is `
|
|
1264
|
+
* `channelHeartbeatInterval` is the interval of the channel heartbeat (ms).
|
|
1265
|
+
* The client sends a `RefreshChannel` heartbeat to refresh the channel
|
|
1266
|
+
* session TTL. The default value is `5000` (ms) — co-tuned to the server's
|
|
1267
|
+
* `ChannelSessionTTL` (15 s) at TTL/3. Values larger than the server TTL
|
|
1268
|
+
* risk premature session expiry.
|
|
1247
1269
|
*/
|
|
1248
1270
|
channelHeartbeatInterval?: number;
|
|
1249
1271
|
/**
|
|
@@ -6062,6 +6084,26 @@ declare interface SubscribeFn<T> {
|
|
|
6062
6084
|
(observer: Observer<T>): Unsubscribe;
|
|
6063
6085
|
}
|
|
6064
6086
|
|
|
6087
|
+
/**
|
|
6088
|
+
* `SyncErrorEvent` represents a non-recoverable sync (RefreshChannel) error.
|
|
6089
|
+
* It carries the underlying error object so subscribers can inspect codes
|
|
6090
|
+
* (e.g. via `isErrorCode`) without losing the original Error.
|
|
6091
|
+
*/
|
|
6092
|
+
declare interface SyncErrorEvent {
|
|
6093
|
+
/**
|
|
6094
|
+
* `type` is the type of the event.
|
|
6095
|
+
*/
|
|
6096
|
+
type: ChannelEventType.SyncError;
|
|
6097
|
+
/**
|
|
6098
|
+
* `error` is the underlying error thrown by the RPC call.
|
|
6099
|
+
*/
|
|
6100
|
+
error: unknown;
|
|
6101
|
+
/**
|
|
6102
|
+
* `method` is the RPC method that failed (e.g. `RefreshChannel`).
|
|
6103
|
+
*/
|
|
6104
|
+
method: string;
|
|
6105
|
+
}
|
|
6106
|
+
|
|
6065
6107
|
/**
|
|
6066
6108
|
* `SyncMode` defines synchronization modes for the PushPullChanges API
|
|
6067
6109
|
* (documents) and the RefreshChannel heartbeat (channels).
|