@hocuspocus/extension-sqlite 3.0.6-rc.0 → 3.0.8-rc.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.
|
@@ -4,7 +4,7 @@ import * as Y from 'yjs';
|
|
|
4
4
|
import EventEmitter from './EventEmitter.ts';
|
|
5
5
|
import type { CompleteHocuspocusProviderWebsocketConfiguration } from './HocuspocusProviderWebsocket.ts';
|
|
6
6
|
import { HocuspocusProviderWebsocket } from './HocuspocusProviderWebsocket.ts';
|
|
7
|
-
import type { ConstructableOutgoingMessage, onAuthenticationFailedParameters, onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatelessParameters, onSyncedParameters } from './types.ts';
|
|
7
|
+
import type { ConstructableOutgoingMessage, onAuthenticatedParameters, onAuthenticationFailedParameters, onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatelessParameters, onSyncedParameters, onUnsyncedChangesParameters } from './types.ts';
|
|
8
8
|
export type HocuspocusProviderConfiguration = Required<Pick<CompleteHocuspocusProviderConfiguration, 'name'>> & Partial<CompleteHocuspocusProviderConfiguration> & (Required<Pick<CompleteHocuspocusProviderWebsocketConfiguration, 'url'>> | Required<Pick<CompleteHocuspocusProviderConfiguration, 'websocketProvider'>>);
|
|
9
9
|
export interface CompleteHocuspocusProviderConfiguration {
|
|
10
10
|
/**
|
|
@@ -36,7 +36,7 @@ export interface CompleteHocuspocusProviderConfiguration {
|
|
|
36
36
|
* Force syncing the document in the defined interval.
|
|
37
37
|
*/
|
|
38
38
|
forceSyncInterval: false | number;
|
|
39
|
-
onAuthenticated: () => void;
|
|
39
|
+
onAuthenticated: (data: onAuthenticatedParameters) => void;
|
|
40
40
|
onAuthenticationFailed: (data: onAuthenticationFailedParameters) => void;
|
|
41
41
|
onOpen: (data: onOpenParameters) => void;
|
|
42
42
|
onConnect: () => void;
|
|
@@ -49,6 +49,7 @@ export interface CompleteHocuspocusProviderConfiguration {
|
|
|
49
49
|
onAwarenessUpdate: (data: onAwarenessUpdateParameters) => void;
|
|
50
50
|
onAwarenessChange: (data: onAwarenessChangeParameters) => void;
|
|
51
51
|
onStateless: (data: onStatelessParameters) => void;
|
|
52
|
+
onUnsyncedChanges: (data: onUnsyncedChangesParameters) => void;
|
|
52
53
|
}
|
|
53
54
|
export declare class AwarenessError extends Error {
|
|
54
55
|
code: number;
|
|
@@ -60,7 +61,7 @@ export declare class HocuspocusProvider extends EventEmitter {
|
|
|
60
61
|
isAuthenticated: boolean;
|
|
61
62
|
authorizedScope: string | undefined;
|
|
62
63
|
manageSocket: boolean;
|
|
63
|
-
private
|
|
64
|
+
private _isAttached;
|
|
64
65
|
intervals: any;
|
|
65
66
|
constructor(configuration: HocuspocusProviderConfiguration);
|
|
66
67
|
boundDocumentUpdateHandler: (update: Uint8Array, origin: any) => void;
|
|
@@ -74,6 +75,7 @@ export declare class HocuspocusProvider extends EventEmitter {
|
|
|
74
75
|
forwardDestroy: (e: any) => this;
|
|
75
76
|
setConfiguration(configuration?: Partial<HocuspocusProviderConfiguration>): void;
|
|
76
77
|
get document(): Y.Doc;
|
|
78
|
+
get isAttached(): boolean;
|
|
77
79
|
get awareness(): Awareness | null;
|
|
78
80
|
get hasUnsyncedChanges(): boolean;
|
|
79
81
|
private resetUnsyncedChanges;
|
|
@@ -94,7 +96,7 @@ export declare class HocuspocusProvider extends EventEmitter {
|
|
|
94
96
|
get synced(): boolean;
|
|
95
97
|
set synced(state: boolean);
|
|
96
98
|
receiveStateless(payload: string): void;
|
|
97
|
-
connect(): Promise<
|
|
99
|
+
connect(): Promise<unknown>;
|
|
98
100
|
disconnect(): void;
|
|
99
101
|
onOpen(event: Event): Promise<void>;
|
|
100
102
|
getToken(): Promise<string | null>;
|
|
@@ -95,9 +95,7 @@ export declare class HocuspocusProviderWebsocket extends EventEmitter {
|
|
|
95
95
|
} | null;
|
|
96
96
|
constructor(configuration: HocuspocusProviderWebsocketConfiguration);
|
|
97
97
|
receivedOnOpenPayload?: Event | undefined;
|
|
98
|
-
receivedOnStatusPayload?: onStatusParameters | undefined;
|
|
99
98
|
onOpen(event: Event): Promise<void>;
|
|
100
|
-
onStatus(data: onStatusParameters): Promise<void>;
|
|
101
99
|
attach(provider: HocuspocusProvider): void;
|
|
102
100
|
detach(provider: HocuspocusProvider): void;
|
|
103
101
|
setConfiguration(configuration?: Partial<HocuspocusProviderWebsocketConfiguration>): void;
|
|
@@ -49,6 +49,9 @@ export type ConstructableOutgoingMessage = Constructable<AuthenticationMessage>
|
|
|
49
49
|
export type onAuthenticationFailedParameters = {
|
|
50
50
|
reason: string;
|
|
51
51
|
};
|
|
52
|
+
export type onAuthenticatedParameters = {
|
|
53
|
+
scope: 'read-write' | 'readonly';
|
|
54
|
+
};
|
|
52
55
|
export type onOpenParameters = {
|
|
53
56
|
event: Event;
|
|
54
57
|
};
|
|
@@ -65,6 +68,9 @@ export type onStatusParameters = {
|
|
|
65
68
|
export type onSyncedParameters = {
|
|
66
69
|
state: boolean;
|
|
67
70
|
};
|
|
71
|
+
export type onUnsyncedChangesParameters = {
|
|
72
|
+
number: number;
|
|
73
|
+
};
|
|
68
74
|
export type onDisconnectParameters = {
|
|
69
75
|
event: CloseEvent;
|
|
70
76
|
};
|
|
@@ -84,103 +90,3 @@ export type StatesArray = {
|
|
|
84
90
|
clientId: number;
|
|
85
91
|
[key: string | number]: any;
|
|
86
92
|
}[];
|
|
87
|
-
export type TCollabThread<Data = any, CommentData = any> = {
|
|
88
|
-
id: string;
|
|
89
|
-
createdAt: number;
|
|
90
|
-
updatedAt: number;
|
|
91
|
-
deletedAt: number | null;
|
|
92
|
-
resolvedAt?: string;
|
|
93
|
-
comments: TCollabComment<CommentData>[];
|
|
94
|
-
deletedComments: TCollabComment<CommentData>[];
|
|
95
|
-
data: Data;
|
|
96
|
-
};
|
|
97
|
-
export type TCollabComment<Data = any> = {
|
|
98
|
-
id: string;
|
|
99
|
-
createdAt: string;
|
|
100
|
-
updatedAt: string;
|
|
101
|
-
deletedAt?: string;
|
|
102
|
-
data: Data;
|
|
103
|
-
content: any;
|
|
104
|
-
};
|
|
105
|
-
export type THistoryVersion = {
|
|
106
|
-
name?: string;
|
|
107
|
-
version: number;
|
|
108
|
-
date: number;
|
|
109
|
-
};
|
|
110
|
-
export type THistoryConfiguration = {
|
|
111
|
-
autoVersioning: boolean;
|
|
112
|
-
currentVersion: number;
|
|
113
|
-
stateCaptured: number;
|
|
114
|
-
};
|
|
115
|
-
export type THistoryAction = THistoryDocumentRevertAction | THistoryVersionCreateAction | THistoryVersionPreviewAction;
|
|
116
|
-
export type THistoryDocumentRevertAction = {
|
|
117
|
-
action: 'document.revert';
|
|
118
|
-
/**
|
|
119
|
-
* if changes haven't been persisted to a version yet, we'll create one with the specified name,
|
|
120
|
-
* expect when `false` is passed.
|
|
121
|
-
*/
|
|
122
|
-
currentVersionName?: string | false;
|
|
123
|
-
/**
|
|
124
|
-
* Name of the version that is created after the revert. Pass `false` to avoid generating a new version.
|
|
125
|
-
*/
|
|
126
|
-
newVersionName?: string | false;
|
|
127
|
-
};
|
|
128
|
-
export type THistoryVersionCreateAction = {
|
|
129
|
-
action: 'version.create';
|
|
130
|
-
name?: string;
|
|
131
|
-
};
|
|
132
|
-
export type THistoryVersionPreviewAction = {
|
|
133
|
-
action: 'version.preview';
|
|
134
|
-
version: number;
|
|
135
|
-
};
|
|
136
|
-
export type THistoryEvent = THistoryVersionPreviewEvent | THistoryVersionCreatedEvent | THistoryDocumentRevertedEvent;
|
|
137
|
-
export type THistoryVersionCreatedEvent = {
|
|
138
|
-
event: 'version.created';
|
|
139
|
-
version: number;
|
|
140
|
-
};
|
|
141
|
-
export type THistoryVersionPreviewEvent = {
|
|
142
|
-
event: 'version.preview';
|
|
143
|
-
version: number;
|
|
144
|
-
ydoc: string;
|
|
145
|
-
};
|
|
146
|
-
export type THistoryDocumentRevertedEvent = {
|
|
147
|
-
event: 'document.reverted';
|
|
148
|
-
version: number;
|
|
149
|
-
};
|
|
150
|
-
export type DeleteCommentOptions = {
|
|
151
|
-
/**
|
|
152
|
-
* If `true`, the thread will also be deleted if the deleted comment was the first comment in the thread.
|
|
153
|
-
*/
|
|
154
|
-
deleteThread?: boolean;
|
|
155
|
-
/**
|
|
156
|
-
* If `true`, will remove the content of the deleted comment
|
|
157
|
-
*/
|
|
158
|
-
deleteContent?: boolean;
|
|
159
|
-
};
|
|
160
|
-
export type DeleteThreadOptions = {
|
|
161
|
-
/**
|
|
162
|
-
* If `true`, will remove the comments on the thread,
|
|
163
|
-
* otherwise will only mark the thread as deleted
|
|
164
|
-
* and keep the comments
|
|
165
|
-
* @default false
|
|
166
|
-
*/
|
|
167
|
-
deleteComments?: boolean;
|
|
168
|
-
/**
|
|
169
|
-
* If `true`, will forcefully remove the thread and all comments,
|
|
170
|
-
* otherwise will only mark the thread as deleted
|
|
171
|
-
* and keep the comments
|
|
172
|
-
* @default false
|
|
173
|
-
*/
|
|
174
|
-
force?: boolean;
|
|
175
|
-
};
|
|
176
|
-
/**
|
|
177
|
-
* The type of thread
|
|
178
|
-
*/
|
|
179
|
-
export type ThreadType = 'archived' | 'unarchived';
|
|
180
|
-
export type GetThreadsOptions = {
|
|
181
|
-
/**
|
|
182
|
-
* The types of threads to get
|
|
183
|
-
* @default ['unarchived']
|
|
184
|
-
*/
|
|
185
|
-
types?: Array<ThreadType>;
|
|
186
|
-
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hocuspocus/extension-sqlite",
|
|
3
3
|
"description": "a generic Hocuspocus persistence driver for the sqlite",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.8-rc.0",
|
|
5
5
|
"homepage": "https://hocuspocus.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"hocuspocus",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@hocuspocus/extension-database": "^3.0.
|
|
30
|
+
"@hocuspocus/extension-database": "^3.0.8-rc.0",
|
|
31
31
|
"kleur": "^4.1.4",
|
|
32
32
|
"sqlite3": "^5.1.7"
|
|
33
33
|
},
|