@yorkie-js/sdk 0.7.7 → 0.7.9
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 +1 -1
- package/dist/yorkie-js-sdk.d.ts +79 -12
- package/dist/yorkie-js-sdk.es.js +285 -79
- package/dist/yorkie-js-sdk.es.js.map +1 -1
- package/dist/yorkie-js-sdk.js +285 -79
- package/dist/yorkie-js-sdk.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ To get started using Yorkie JavaScript SDK, see: https://yorkie.dev/docs/js-sdk
|
|
|
10
10
|
|
|
11
11
|
## Contributing
|
|
12
12
|
|
|
13
|
-
See [CONTRIBUTING](CONTRIBUTING.md) for details on submitting patches and the contribution workflow.
|
|
13
|
+
See [CONTRIBUTING](../../CONTRIBUTING.md) for details on submitting patches and the contribution workflow.
|
|
14
14
|
|
|
15
15
|
## Contributors ✨
|
|
16
16
|
|
package/dist/yorkie-js-sdk.d.ts
CHANGED
|
@@ -93,20 +93,30 @@ declare interface Attachable {
|
|
|
93
93
|
/**
|
|
94
94
|
* `AttachChannelOptions` are user-settable options used when attaching channels.
|
|
95
95
|
*/
|
|
96
|
-
declare interface AttachChannelOptions {
|
|
96
|
+
export declare interface AttachChannelOptions {
|
|
97
97
|
/**
|
|
98
|
-
* `
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
98
|
+
* `syncMode` selects how the channel keeps presence in sync with the server.
|
|
99
|
+
* Default is `SyncMode.Realtime`.
|
|
100
|
+
* - `SyncMode.Realtime`: open a watch stream and run the heartbeat. Required
|
|
101
|
+
* to receive broadcast events.
|
|
102
|
+
* - `SyncMode.Polling`: heartbeat-only. No watch stream is opened. The
|
|
103
|
+
* heartbeat refreshes TTL and brings the latest sessionCount. Recommended
|
|
104
|
+
* for large channels where broadcast is not needed.
|
|
105
|
+
* - `SyncMode.Manual`: no automatic activity. Caller must invoke `sync()`.
|
|
102
106
|
*/
|
|
103
|
-
|
|
107
|
+
syncMode?: SyncMode;
|
|
108
|
+
/**
|
|
109
|
+
* `channelHeartbeatInterval` overrides the heartbeat interval (ms) for this
|
|
110
|
+
* attachment. If unset, mode-specific defaults apply: Polling=3000,
|
|
111
|
+
* Realtime=30000.
|
|
112
|
+
*/
|
|
113
|
+
channelHeartbeatInterval?: number;
|
|
104
114
|
}
|
|
105
115
|
|
|
106
116
|
/**
|
|
107
117
|
* `AttachOptions` are user-settable options used when attaching documents.
|
|
108
118
|
*/
|
|
109
|
-
declare interface AttachOptions<R, P> {
|
|
119
|
+
export declare interface AttachOptions<R, P> {
|
|
110
120
|
/**
|
|
111
121
|
* `initialRoot` is the initial root of the document. It is used to
|
|
112
122
|
* initialize the document. It is used when the fields are not set in the
|
|
@@ -121,6 +131,11 @@ declare interface AttachOptions<R, P> {
|
|
|
121
131
|
* `syncMode` defines the synchronization mode of the document.
|
|
122
132
|
*/
|
|
123
133
|
syncMode?: SyncMode;
|
|
134
|
+
/**
|
|
135
|
+
* `documentPollInterval` (ms) — only used when `syncMode` is `Polling`.
|
|
136
|
+
* Default: 3000.
|
|
137
|
+
*/
|
|
138
|
+
documentPollInterval?: number;
|
|
124
139
|
/**
|
|
125
140
|
* `schema` is the schema of the document. It is used to validate the
|
|
126
141
|
* document.
|
|
@@ -1039,6 +1054,17 @@ export declare class Client {
|
|
|
1039
1054
|
* `changeSyncMode` changes the synchronization mode of the given document.
|
|
1040
1055
|
*/
|
|
1041
1056
|
changeSyncMode<R, P extends Indexable>(doc: Document_2<R, P>, syncMode: SyncMode): Promise<Document_2<R, P>>;
|
|
1057
|
+
/**
|
|
1058
|
+
* `changeSyncMode` changes the synchronization mode of the given channel.
|
|
1059
|
+
*/
|
|
1060
|
+
changeSyncMode(channel: Channel, syncMode: SyncMode): Promise<Channel>;
|
|
1061
|
+
private changeDocumentSyncMode;
|
|
1062
|
+
/**
|
|
1063
|
+
* `assertValidChannelSyncMode` rejects sync modes that are not valid for
|
|
1064
|
+
* channels. `RealtimePushOnly` and `RealtimeSyncOff` are document-only.
|
|
1065
|
+
*/
|
|
1066
|
+
private assertValidChannelSyncMode;
|
|
1067
|
+
private changeChannelSyncMode;
|
|
1042
1068
|
/**
|
|
1043
1069
|
* `sync` pushes local changes of the attached documents to the server and
|
|
1044
1070
|
* receives changes of the remote replica from the server then apply them to
|
|
@@ -1096,6 +1122,17 @@ export declare class Client {
|
|
|
1096
1122
|
* `restoreRevision` restores the document to the given revision.
|
|
1097
1123
|
*/
|
|
1098
1124
|
restoreRevision<R, P extends Indexable>(doc: Document_2<R, P>, revisionId: string): Promise<void>;
|
|
1125
|
+
/**
|
|
1126
|
+
* `peekChannel` reads the current session count of a channel without
|
|
1127
|
+
* creating a session on the server. Use this when the caller only needs
|
|
1128
|
+
* to display the count (e.g. "N people writing") without contributing to
|
|
1129
|
+
* it and without receiving broadcasts.
|
|
1130
|
+
*
|
|
1131
|
+
* Unlike `attach({ readOnly: true })`, this does not occupy a `Session`
|
|
1132
|
+
* entry on the server, does not generate heartbeat RPCs, and does not
|
|
1133
|
+
* subscribe to channel events. Polling is the caller's responsibility.
|
|
1134
|
+
*/
|
|
1135
|
+
peekChannel(channelKey: string): Promise<number>;
|
|
1099
1136
|
/**
|
|
1100
1137
|
* `broadcast` broadcasts the given payload to the given topic.
|
|
1101
1138
|
*/
|
|
@@ -1997,12 +2034,28 @@ declare class CRDTTree extends CRDTElement implements GCParent {
|
|
|
1997
2034
|
* `edit` edits the tree with the given range and content.
|
|
1998
2035
|
* If the content is undefined, the range will be removed.
|
|
1999
2036
|
*/
|
|
2000
|
-
edit(range: [CRDTTreePos, CRDTTreePos], contents: Array<CRDTTreeNode> | undefined, splitLevel: number, editedAt: TimeTicket, issueTimeTicket: (() => TimeTicket) | undefined, versionVector?: VersionVector): [
|
|
2037
|
+
edit(range: [CRDTTreePos, CRDTTreePos], contents: Array<CRDTTreeNode> | undefined, splitLevel: number, editedAt: TimeTicket, issueTimeTicket: (() => TimeTicket) | undefined, versionVector?: VersionVector): [
|
|
2038
|
+
Array<TreeChange>,
|
|
2039
|
+
Array<GCPair>,
|
|
2040
|
+
DataSize,
|
|
2041
|
+
Array<CRDTTreeNode>,
|
|
2042
|
+
number,
|
|
2043
|
+
number,
|
|
2044
|
+
Set<string>
|
|
2045
|
+
];
|
|
2001
2046
|
/**
|
|
2002
2047
|
* `editT` edits the given range with the given value.
|
|
2003
2048
|
* This method uses indexes instead of a pair of TreePos for testing.
|
|
2004
2049
|
*/
|
|
2005
|
-
editT(range: [number, number], contents: Array<CRDTTreeNode> | undefined, splitLevel: number, editedAt: TimeTicket, issueTimeTicket: () => TimeTicket): [
|
|
2050
|
+
editT(range: [number, number], contents: Array<CRDTTreeNode> | undefined, splitLevel: number, editedAt: TimeTicket, issueTimeTicket: () => TimeTicket): [
|
|
2051
|
+
Array<TreeChange>,
|
|
2052
|
+
Array<GCPair>,
|
|
2053
|
+
DataSize,
|
|
2054
|
+
Array<CRDTTreeNode>,
|
|
2055
|
+
number,
|
|
2056
|
+
number,
|
|
2057
|
+
Set<string>
|
|
2058
|
+
];
|
|
2006
2059
|
/**
|
|
2007
2060
|
* `move` move the given source range to the given target range.
|
|
2008
2061
|
*/
|
|
@@ -3035,7 +3088,12 @@ declare class Document_2<R, P extends Indexable = Indexable> implements Attachab
|
|
|
3035
3088
|
* `applySnapshot` applies the given snapshot into this document.
|
|
3036
3089
|
*/
|
|
3037
3090
|
applySnapshot(serverSeq: bigint, snapshotVector: VersionVector, snapshot?: Uint8Array, clientSeq?: number): void;
|
|
3038
|
-
|
|
3091
|
+
/**
|
|
3092
|
+
* `clearHistory` flushes both undo and redo stacks. This is used
|
|
3093
|
+
* after applying a snapshot or initialRoot so that setup operations
|
|
3094
|
+
* are not reachable via undo.
|
|
3095
|
+
*/
|
|
3096
|
+
clearHistory(): void;
|
|
3039
3097
|
/**
|
|
3040
3098
|
* `applyChanges` applies the given changes into this document.
|
|
3041
3099
|
*/
|
|
@@ -6005,7 +6063,8 @@ declare interface SubscribeFn<T> {
|
|
|
6005
6063
|
}
|
|
6006
6064
|
|
|
6007
6065
|
/**
|
|
6008
|
-
* `SyncMode` defines synchronization modes for the PushPullChanges API
|
|
6066
|
+
* `SyncMode` defines synchronization modes for the PushPullChanges API
|
|
6067
|
+
* (documents) and the RefreshChannel heartbeat (channels).
|
|
6009
6068
|
*/
|
|
6010
6069
|
export declare enum SyncMode {
|
|
6011
6070
|
/**
|
|
@@ -6024,7 +6083,15 @@ export declare enum SyncMode {
|
|
|
6024
6083
|
* `RealtimeSyncOff` mode indicates that changes are not automatically pushed or pulled,
|
|
6025
6084
|
* but the watch stream is kept active.
|
|
6026
6085
|
*/
|
|
6027
|
-
RealtimeSyncOff = "realtime-syncoff"
|
|
6086
|
+
RealtimeSyncOff = "realtime-syncoff",
|
|
6087
|
+
/**
|
|
6088
|
+
* `Polling` mode runs the sync loop without opening a watch stream.
|
|
6089
|
+
* - For Channel: heartbeat refreshes TTL and brings sessionCount.
|
|
6090
|
+
* - For Document: PushPullChanges runs at the polling interval. Remote
|
|
6091
|
+
* changes arrive on the next tick (latency = interval). Not suitable
|
|
6092
|
+
* for collaborative editing — use Realtime for that.
|
|
6093
|
+
*/
|
|
6094
|
+
Polling = "polling"
|
|
6028
6095
|
}
|
|
6029
6096
|
|
|
6030
6097
|
/**
|