@hocuspocus/extension-logger 2.1.0-alpha.0 → 2.1.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/hocuspocus-logger.cjs +82 -82
- package/dist/hocuspocus-logger.esm.js +82 -82
- package/dist/packages/common/src/CloseEvents.d.ts +29 -29
- package/dist/packages/common/src/auth.d.ts +6 -6
- package/dist/packages/common/src/awarenessStatesToArray.d.ts +3 -3
- package/dist/packages/common/src/index.d.ts +4 -4
- package/dist/packages/common/src/types.d.ts +10 -10
- package/dist/packages/extension-database/src/Database.d.ts +30 -30
- package/dist/packages/extension-database/src/index.d.ts +1 -1
- package/dist/packages/extension-logger/src/Logger.d.ts +67 -67
- package/dist/packages/extension-logger/src/index.d.ts +1 -1
- package/dist/packages/extension-redis/src/Redis.d.ts +116 -95
- package/dist/packages/extension-redis/src/index.d.ts +1 -1
- package/dist/packages/extension-sqlite/src/SQLite.d.ts +26 -26
- package/dist/packages/extension-sqlite/src/index.d.ts +1 -1
- package/dist/packages/extension-throttle/src/index.d.ts +31 -31
- package/dist/packages/extension-webhook/src/index.d.ts +57 -57
- package/dist/packages/provider/src/EventEmitter.d.ts +9 -9
- package/dist/packages/provider/src/HocuspocusProvider.d.ts +110 -110
- package/dist/packages/provider/src/HocuspocusProviderWebsocket.d.ts +115 -115
- package/dist/packages/provider/src/IncomingMessage.d.ts +16 -16
- package/dist/packages/provider/src/MessageReceiver.d.ts +13 -13
- package/dist/packages/provider/src/MessageSender.d.ts +10 -10
- package/dist/packages/provider/src/OutgoingMessage.d.ts +9 -9
- package/dist/packages/provider/src/OutgoingMessages/AuthenticationMessage.d.ts +7 -7
- package/dist/packages/provider/src/OutgoingMessages/AwarenessMessage.d.ts +8 -8
- package/dist/packages/provider/src/OutgoingMessages/CloseMessage.d.ts +8 -8
- package/dist/packages/provider/src/OutgoingMessages/QueryAwarenessMessage.d.ts +8 -8
- package/dist/packages/provider/src/OutgoingMessages/StatelessMessage.d.ts +7 -7
- package/dist/packages/provider/src/OutgoingMessages/SyncStepOneMessage.d.ts +8 -8
- package/dist/packages/provider/src/OutgoingMessages/SyncStepTwoMessage.d.ts +8 -8
- package/dist/packages/provider/src/OutgoingMessages/UpdateMessage.d.ts +7 -7
- package/dist/packages/provider/src/TiptapCollabProvider.d.ts +11 -11
- package/dist/packages/provider/src/TiptapCollabProviderWebsocket.d.ts +11 -11
- package/dist/packages/provider/src/index.d.ts +5 -5
- package/dist/packages/provider/src/types.d.ts +84 -84
- package/dist/packages/server/src/Connection.d.ts +71 -71
- package/dist/packages/server/src/Debugger.d.ts +14 -14
- package/dist/packages/server/src/DirectConnection.d.ts +13 -0
- package/dist/packages/server/src/Document.d.ts +91 -88
- package/dist/packages/server/src/Hocuspocus.d.ts +111 -108
- package/dist/packages/server/src/IncomingMessage.d.ts +21 -21
- package/dist/packages/server/src/MessageReceiver.d.ts +12 -12
- package/dist/packages/server/src/OutgoingMessage.d.ts +20 -20
- package/dist/packages/server/src/index.d.ts +8 -8
- package/dist/packages/server/src/types.d.ts +266 -264
- package/dist/packages/transformer/src/Prosemirror.d.ts +11 -11
- package/dist/packages/transformer/src/Tiptap.d.ts +10 -10
- package/dist/packages/transformer/src/index.d.ts +3 -3
- package/dist/packages/transformer/src/types.d.ts +5 -5
- package/dist/playground/backend/src/default.d.ts +1 -1
- package/dist/playground/backend/src/express.d.ts +1 -1
- package/dist/playground/backend/src/koa.d.ts +1 -1
- package/dist/playground/backend/src/load-document.d.ts +1 -1
- package/dist/playground/backend/src/redis.d.ts +1 -1
- package/dist/playground/backend/src/slow.d.ts +1 -1
- package/dist/playground/backend/src/tiptapcollab.d.ts +1 -1
- package/dist/playground/backend/src/webhook.d.ts +1 -1
- package/dist/playground/frontend/src/main.d.ts +1 -1
- package/dist/playground/frontend/vite.config.d.ts +2 -2
- package/dist/tests/extension-database/fetch.d.ts +1 -1
- package/dist/tests/extension-logger/onListen.d.ts +1 -1
- package/dist/tests/extension-redis/closeConnections.d.ts +1 -1
- package/dist/tests/extension-redis/getConnectionCount.d.ts +1 -1
- package/dist/tests/extension-redis/getDocumentsCount.d.ts +1 -1
- package/dist/tests/extension-redis/onAwarenessChange.d.ts +1 -1
- package/dist/tests/extension-redis/onChange.d.ts +1 -1
- package/dist/tests/extension-redis/onStateless.d.ts +1 -1
- package/dist/tests/extension-redis/onStoreDocument.d.ts +1 -1
- package/dist/tests/extension-throttle/banning.d.ts +1 -1
- package/dist/tests/extension-throttle/configuration.d.ts +1 -1
- package/dist/tests/provider/observe.d.ts +1 -1
- package/dist/tests/provider/observeDeep.d.ts +1 -1
- package/dist/tests/provider/onAuthenticated.d.ts +1 -1
- package/dist/tests/provider/onAuthenticationFailed.d.ts +1 -1
- package/dist/tests/provider/onAwarenessChange.d.ts +1 -1
- package/dist/tests/provider/onAwarenessUpdate.d.ts +1 -1
- package/dist/tests/provider/onClose.d.ts +1 -1
- package/dist/tests/provider/onConnect.d.ts +1 -1
- package/dist/tests/provider/onDisconnect.d.ts +1 -1
- package/dist/tests/provider/onMessage.d.ts +1 -1
- package/dist/tests/provider/onOpen.d.ts +1 -1
- package/dist/tests/provider/onStateless.d.ts +1 -1
- package/dist/tests/provider/onSynced.d.ts +1 -1
- package/dist/tests/providerwebsocket/configuration.d.ts +1 -1
- package/dist/tests/server/address.d.ts +1 -1
- package/dist/tests/server/afterStoreDocument.d.ts +1 -1
- package/dist/tests/server/beforeBroadcastStateless.d.ts +1 -1
- package/dist/tests/server/beforeHandleMessage.d.ts +1 -1
- package/dist/tests/server/closeConnections.d.ts +1 -1
- package/dist/tests/server/getConnectionsCount.d.ts +1 -1
- package/dist/tests/server/getDocumentsCount.d.ts +1 -1
- package/dist/tests/server/getMessageLogs.d.ts +1 -1
- package/dist/tests/server/listen.d.ts +1 -1
- package/dist/tests/server/onAuthenticate.d.ts +1 -1
- package/dist/tests/server/onAwarenessUpdate.d.ts +1 -1
- package/dist/tests/server/onChange.d.ts +1 -1
- package/dist/tests/server/onClose.d.ts +1 -1
- package/dist/tests/server/onConfigure.d.ts +1 -1
- package/dist/tests/server/onConnect.d.ts +1 -1
- package/dist/tests/server/onDestroy.d.ts +1 -1
- package/dist/tests/server/onDisconnect.d.ts +1 -1
- package/dist/tests/server/onListen.d.ts +1 -1
- package/dist/tests/server/onLoadDocument.d.ts +1 -1
- package/dist/tests/server/onRequest.d.ts +1 -1
- package/dist/tests/server/onStateless.d.ts +1 -1
- package/dist/tests/server/onStoreDocument.d.ts +1 -1
- package/dist/tests/server/onUpgrade.d.ts +1 -1
- package/dist/tests/server/openDirectConnection.d.ts +1 -0
- package/dist/tests/server/requiresAuthentication.d.ts +1 -1
- package/dist/tests/server/websocketError.d.ts +1 -1
- package/dist/tests/transformer/TiptapTransformer.d.ts +1 -1
- package/dist/tests/utils/createDirectory.d.ts +1 -1
- package/dist/tests/utils/flushRedis.d.ts +1 -1
- package/dist/tests/utils/index.d.ts +9 -9
- package/dist/tests/utils/newHocuspocus.d.ts +2 -2
- package/dist/tests/utils/newHocuspocusProvider.d.ts +3 -3
- package/dist/tests/utils/newHocuspocusProviderWebsocket.d.ts +3 -3
- package/dist/tests/utils/randomInteger.d.ts +1 -1
- package/dist/tests/utils/redisConnectionSettings.d.ts +4 -4
- package/dist/tests/utils/removeDirectory.d.ts +1 -1
- package/dist/tests/utils/retryableAssertion.d.ts +2 -2
- package/dist/tests/utils/sleep.d.ts +1 -1
- package/package.json +4 -3
- package/src/index.ts +1 -1
|
@@ -2,88 +2,88 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
class Logger {
|
|
6
|
-
/**
|
|
7
|
-
* Constructor
|
|
8
|
-
*/
|
|
9
|
-
constructor(configuration) {
|
|
10
|
-
this.name = null;
|
|
11
|
-
this.configuration = {
|
|
12
|
-
prefix: null,
|
|
13
|
-
onLoadDocument: true,
|
|
14
|
-
onChange: true,
|
|
15
|
-
onStoreDocument: true,
|
|
16
|
-
onConnect: true,
|
|
17
|
-
onDisconnect: true,
|
|
18
|
-
onUpgrade: true,
|
|
19
|
-
onRequest: true,
|
|
20
|
-
onDestroy: true,
|
|
21
|
-
onConfigure: true,
|
|
22
|
-
log: console.log, // eslint-disable-line
|
|
23
|
-
};
|
|
24
|
-
this.configuration = {
|
|
25
|
-
...this.configuration,
|
|
26
|
-
...configuration,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
async onConfigure(data) {
|
|
30
|
-
this.name = data.instance.configuration.name;
|
|
31
|
-
if (!this.configuration.onConfigure) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (this.configuration.prefix) {
|
|
35
|
-
console.warn('[hocuspocus warn] The Logger \'prefix\' is deprecated. Pass a \'name\' to the Hocuspocus configuration instead.');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
async onLoadDocument(data) {
|
|
39
|
-
if (this.configuration.onLoadDocument) {
|
|
40
|
-
this.log(`Loaded document "${data.documentName}".`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async onChange(data) {
|
|
44
|
-
if (this.configuration.onChange) {
|
|
45
|
-
this.log(`Document "${data.documentName}" changed.`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async onStoreDocument(data) {
|
|
49
|
-
if (this.configuration.onStoreDocument) {
|
|
50
|
-
this.log(`Store "${data.documentName}".`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async onConnect(data) {
|
|
54
|
-
if (this.configuration.onConnect) {
|
|
55
|
-
this.log(`New connection to "${data.documentName}".`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
async onDisconnect(data) {
|
|
59
|
-
if (this.configuration.onDisconnect) {
|
|
60
|
-
this.log(`Connection to "${data.documentName}" closed.`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
async onUpgrade(data) {
|
|
64
|
-
if (this.configuration.onUpgrade) {
|
|
65
|
-
this.log('Upgrading connection …');
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
async onRequest(data) {
|
|
69
|
-
if (this.configuration.onRequest) {
|
|
70
|
-
this.log(`Incoming HTTP Request to ${data.request.url}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
async onDestroy(data) {
|
|
74
|
-
if (this.configuration.onDestroy) {
|
|
75
|
-
this.log('Shut down.');
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
log(message) {
|
|
79
|
-
const date = (new Date()).toISOString();
|
|
80
|
-
let meta = `${date}`;
|
|
81
|
-
if (this.name) {
|
|
82
|
-
meta = `${this.name} ${meta}`;
|
|
83
|
-
}
|
|
84
|
-
message = `[${meta}] ${message}`;
|
|
85
|
-
this.configuration.log(message);
|
|
86
|
-
}
|
|
5
|
+
class Logger {
|
|
6
|
+
/**
|
|
7
|
+
* Constructor
|
|
8
|
+
*/
|
|
9
|
+
constructor(configuration) {
|
|
10
|
+
this.name = null;
|
|
11
|
+
this.configuration = {
|
|
12
|
+
prefix: null,
|
|
13
|
+
onLoadDocument: true,
|
|
14
|
+
onChange: true,
|
|
15
|
+
onStoreDocument: true,
|
|
16
|
+
onConnect: true,
|
|
17
|
+
onDisconnect: true,
|
|
18
|
+
onUpgrade: true,
|
|
19
|
+
onRequest: true,
|
|
20
|
+
onDestroy: true,
|
|
21
|
+
onConfigure: true,
|
|
22
|
+
log: console.log, // eslint-disable-line
|
|
23
|
+
};
|
|
24
|
+
this.configuration = {
|
|
25
|
+
...this.configuration,
|
|
26
|
+
...configuration,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
async onConfigure(data) {
|
|
30
|
+
this.name = data.instance.configuration.name;
|
|
31
|
+
if (!this.configuration.onConfigure) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (this.configuration.prefix) {
|
|
35
|
+
console.warn('[hocuspocus warn] The Logger \'prefix\' is deprecated. Pass a \'name\' to the Hocuspocus configuration instead.');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async onLoadDocument(data) {
|
|
39
|
+
if (this.configuration.onLoadDocument) {
|
|
40
|
+
this.log(`Loaded document "${data.documentName}".`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async onChange(data) {
|
|
44
|
+
if (this.configuration.onChange) {
|
|
45
|
+
this.log(`Document "${data.documentName}" changed.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async onStoreDocument(data) {
|
|
49
|
+
if (this.configuration.onStoreDocument) {
|
|
50
|
+
this.log(`Store "${data.documentName}".`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async onConnect(data) {
|
|
54
|
+
if (this.configuration.onConnect) {
|
|
55
|
+
this.log(`New connection to "${data.documentName}".`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async onDisconnect(data) {
|
|
59
|
+
if (this.configuration.onDisconnect) {
|
|
60
|
+
this.log(`Connection to "${data.documentName}" closed.`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async onUpgrade(data) {
|
|
64
|
+
if (this.configuration.onUpgrade) {
|
|
65
|
+
this.log('Upgrading connection …');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async onRequest(data) {
|
|
69
|
+
if (this.configuration.onRequest) {
|
|
70
|
+
this.log(`Incoming HTTP Request to ${data.request.url}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async onDestroy(data) {
|
|
74
|
+
if (this.configuration.onDestroy) {
|
|
75
|
+
this.log('Shut down.');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
log(message) {
|
|
79
|
+
const date = (new Date()).toISOString();
|
|
80
|
+
let meta = `${date}`;
|
|
81
|
+
if (this.name) {
|
|
82
|
+
meta = `${this.name} ${meta}`;
|
|
83
|
+
}
|
|
84
|
+
message = `[${meta}] ${message}`;
|
|
85
|
+
this.configuration.log(message);
|
|
86
|
+
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
exports.Logger = Logger;
|
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
class Logger {
|
|
2
|
-
/**
|
|
3
|
-
* Constructor
|
|
4
|
-
*/
|
|
5
|
-
constructor(configuration) {
|
|
6
|
-
this.name = null;
|
|
7
|
-
this.configuration = {
|
|
8
|
-
prefix: null,
|
|
9
|
-
onLoadDocument: true,
|
|
10
|
-
onChange: true,
|
|
11
|
-
onStoreDocument: true,
|
|
12
|
-
onConnect: true,
|
|
13
|
-
onDisconnect: true,
|
|
14
|
-
onUpgrade: true,
|
|
15
|
-
onRequest: true,
|
|
16
|
-
onDestroy: true,
|
|
17
|
-
onConfigure: true,
|
|
18
|
-
log: console.log, // eslint-disable-line
|
|
19
|
-
};
|
|
20
|
-
this.configuration = {
|
|
21
|
-
...this.configuration,
|
|
22
|
-
...configuration,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
async onConfigure(data) {
|
|
26
|
-
this.name = data.instance.configuration.name;
|
|
27
|
-
if (!this.configuration.onConfigure) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (this.configuration.prefix) {
|
|
31
|
-
console.warn('[hocuspocus warn] The Logger \'prefix\' is deprecated. Pass a \'name\' to the Hocuspocus configuration instead.');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
async onLoadDocument(data) {
|
|
35
|
-
if (this.configuration.onLoadDocument) {
|
|
36
|
-
this.log(`Loaded document "${data.documentName}".`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
async onChange(data) {
|
|
40
|
-
if (this.configuration.onChange) {
|
|
41
|
-
this.log(`Document "${data.documentName}" changed.`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async onStoreDocument(data) {
|
|
45
|
-
if (this.configuration.onStoreDocument) {
|
|
46
|
-
this.log(`Store "${data.documentName}".`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
async onConnect(data) {
|
|
50
|
-
if (this.configuration.onConnect) {
|
|
51
|
-
this.log(`New connection to "${data.documentName}".`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async onDisconnect(data) {
|
|
55
|
-
if (this.configuration.onDisconnect) {
|
|
56
|
-
this.log(`Connection to "${data.documentName}" closed.`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async onUpgrade(data) {
|
|
60
|
-
if (this.configuration.onUpgrade) {
|
|
61
|
-
this.log('Upgrading connection …');
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async onRequest(data) {
|
|
65
|
-
if (this.configuration.onRequest) {
|
|
66
|
-
this.log(`Incoming HTTP Request to ${data.request.url}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async onDestroy(data) {
|
|
70
|
-
if (this.configuration.onDestroy) {
|
|
71
|
-
this.log('Shut down.');
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
log(message) {
|
|
75
|
-
const date = (new Date()).toISOString();
|
|
76
|
-
let meta = `${date}`;
|
|
77
|
-
if (this.name) {
|
|
78
|
-
meta = `${this.name} ${meta}`;
|
|
79
|
-
}
|
|
80
|
-
message = `[${meta}] ${message}`;
|
|
81
|
-
this.configuration.log(message);
|
|
82
|
-
}
|
|
1
|
+
class Logger {
|
|
2
|
+
/**
|
|
3
|
+
* Constructor
|
|
4
|
+
*/
|
|
5
|
+
constructor(configuration) {
|
|
6
|
+
this.name = null;
|
|
7
|
+
this.configuration = {
|
|
8
|
+
prefix: null,
|
|
9
|
+
onLoadDocument: true,
|
|
10
|
+
onChange: true,
|
|
11
|
+
onStoreDocument: true,
|
|
12
|
+
onConnect: true,
|
|
13
|
+
onDisconnect: true,
|
|
14
|
+
onUpgrade: true,
|
|
15
|
+
onRequest: true,
|
|
16
|
+
onDestroy: true,
|
|
17
|
+
onConfigure: true,
|
|
18
|
+
log: console.log, // eslint-disable-line
|
|
19
|
+
};
|
|
20
|
+
this.configuration = {
|
|
21
|
+
...this.configuration,
|
|
22
|
+
...configuration,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
async onConfigure(data) {
|
|
26
|
+
this.name = data.instance.configuration.name;
|
|
27
|
+
if (!this.configuration.onConfigure) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (this.configuration.prefix) {
|
|
31
|
+
console.warn('[hocuspocus warn] The Logger \'prefix\' is deprecated. Pass a \'name\' to the Hocuspocus configuration instead.');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async onLoadDocument(data) {
|
|
35
|
+
if (this.configuration.onLoadDocument) {
|
|
36
|
+
this.log(`Loaded document "${data.documentName}".`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async onChange(data) {
|
|
40
|
+
if (this.configuration.onChange) {
|
|
41
|
+
this.log(`Document "${data.documentName}" changed.`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async onStoreDocument(data) {
|
|
45
|
+
if (this.configuration.onStoreDocument) {
|
|
46
|
+
this.log(`Store "${data.documentName}".`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async onConnect(data) {
|
|
50
|
+
if (this.configuration.onConnect) {
|
|
51
|
+
this.log(`New connection to "${data.documentName}".`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async onDisconnect(data) {
|
|
55
|
+
if (this.configuration.onDisconnect) {
|
|
56
|
+
this.log(`Connection to "${data.documentName}" closed.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async onUpgrade(data) {
|
|
60
|
+
if (this.configuration.onUpgrade) {
|
|
61
|
+
this.log('Upgrading connection …');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async onRequest(data) {
|
|
65
|
+
if (this.configuration.onRequest) {
|
|
66
|
+
this.log(`Incoming HTTP Request to ${data.request.url}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async onDestroy(data) {
|
|
70
|
+
if (this.configuration.onDestroy) {
|
|
71
|
+
this.log('Shut down.');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
log(message) {
|
|
75
|
+
const date = (new Date()).toISOString();
|
|
76
|
+
let meta = `${date}`;
|
|
77
|
+
if (this.name) {
|
|
78
|
+
meta = `${this.name} ${meta}`;
|
|
79
|
+
}
|
|
80
|
+
message = `[${meta}] ${message}`;
|
|
81
|
+
this.configuration.log(message);
|
|
82
|
+
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
export { Logger };
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
export interface CloseEvent {
|
|
2
|
-
code: number;
|
|
3
|
-
reason: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* The server is terminating the connection because a data frame was received
|
|
7
|
-
* that is too large.
|
|
8
|
-
* See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code
|
|
9
|
-
*/
|
|
10
|
-
export declare const MessageTooBig: CloseEvent;
|
|
11
|
-
/**
|
|
12
|
-
* The server successfully processed the request, asks that the requester reset
|
|
13
|
-
* its document view, and is not returning any content.
|
|
14
|
-
*/
|
|
15
|
-
export declare const ResetConnection: CloseEvent;
|
|
16
|
-
/**
|
|
17
|
-
* Similar to Forbidden, but specifically for use when authentication is required and has
|
|
18
|
-
* failed or has not yet been provided.
|
|
19
|
-
*/
|
|
20
|
-
export declare const Unauthorized: CloseEvent;
|
|
21
|
-
/**
|
|
22
|
-
* The request contained valid data and was understood by the server, but the server
|
|
23
|
-
* is refusing action.
|
|
24
|
-
*/
|
|
25
|
-
export declare const Forbidden: CloseEvent;
|
|
26
|
-
/**
|
|
27
|
-
* The server timed out waiting for the request.
|
|
28
|
-
*/
|
|
29
|
-
export declare const ConnectionTimeout: CloseEvent;
|
|
1
|
+
export interface CloseEvent {
|
|
2
|
+
code: number;
|
|
3
|
+
reason: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The server is terminating the connection because a data frame was received
|
|
7
|
+
* that is too large.
|
|
8
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code
|
|
9
|
+
*/
|
|
10
|
+
export declare const MessageTooBig: CloseEvent;
|
|
11
|
+
/**
|
|
12
|
+
* The server successfully processed the request, asks that the requester reset
|
|
13
|
+
* its document view, and is not returning any content.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ResetConnection: CloseEvent;
|
|
16
|
+
/**
|
|
17
|
+
* Similar to Forbidden, but specifically for use when authentication is required and has
|
|
18
|
+
* failed or has not yet been provided.
|
|
19
|
+
*/
|
|
20
|
+
export declare const Unauthorized: CloseEvent;
|
|
21
|
+
/**
|
|
22
|
+
* The request contained valid data and was understood by the server, but the server
|
|
23
|
+
* is refusing action.
|
|
24
|
+
*/
|
|
25
|
+
export declare const Forbidden: CloseEvent;
|
|
26
|
+
/**
|
|
27
|
+
* The server timed out waiting for the request.
|
|
28
|
+
*/
|
|
29
|
+
export declare const ConnectionTimeout: CloseEvent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as encoding from 'lib0/encoding';
|
|
2
|
-
import * as decoding from 'lib0/decoding';
|
|
3
|
-
export declare const writeAuthentication: (encoder: encoding.Encoder, auth: string) => void;
|
|
4
|
-
export declare const writePermissionDenied: (encoder: encoding.Encoder, reason: string) => void;
|
|
5
|
-
export declare const writeAuthenticated: (encoder: encoding.Encoder) => void;
|
|
6
|
-
export declare const readAuthMessage: (decoder: decoding.Decoder, permissionDeniedHandler: (reason: string) => void, authenticatedHandler: () => void) => void;
|
|
1
|
+
import * as encoding from 'lib0/encoding';
|
|
2
|
+
import * as decoding from 'lib0/decoding';
|
|
3
|
+
export declare const writeAuthentication: (encoder: encoding.Encoder, auth: string) => void;
|
|
4
|
+
export declare const writePermissionDenied: (encoder: encoding.Encoder, reason: string) => void;
|
|
5
|
+
export declare const writeAuthenticated: (encoder: encoding.Encoder, scope: 'readonly' | 'read-write') => void;
|
|
6
|
+
export declare const readAuthMessage: (decoder: decoding.Decoder, permissionDeniedHandler: (reason: string) => void, authenticatedHandler: (scope: string) => void) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const awarenessStatesToArray: (states: Map<number, Record<string, any>>) => {
|
|
2
|
-
clientId: number;
|
|
3
|
-
}[];
|
|
1
|
+
export declare const awarenessStatesToArray: (states: Map<number, Record<string, any>>) => {
|
|
2
|
+
clientId: number;
|
|
3
|
+
}[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './auth';
|
|
2
|
-
export * from './CloseEvents';
|
|
3
|
-
export * from './awarenessStatesToArray';
|
|
4
|
-
export * from './types';
|
|
1
|
+
export * from './auth.js';
|
|
2
|
+
export * from './CloseEvents.js';
|
|
3
|
+
export * from './awarenessStatesToArray.js';
|
|
4
|
+
export * from './types.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State of the WebSocket connection.
|
|
3
|
-
* https://developer.mozilla.org/de/docs/Web/API/WebSocket/readyState
|
|
4
|
-
*/
|
|
5
|
-
export declare enum WsReadyStates {
|
|
6
|
-
Connecting = 0,
|
|
7
|
-
Open = 1,
|
|
8
|
-
Closing = 2,
|
|
9
|
-
Closed = 3
|
|
10
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* State of the WebSocket connection.
|
|
3
|
+
* https://developer.mozilla.org/de/docs/Web/API/WebSocket/readyState
|
|
4
|
+
*/
|
|
5
|
+
export declare enum WsReadyStates {
|
|
6
|
+
Connecting = 0,
|
|
7
|
+
Open = 1,
|
|
8
|
+
Closing = 2,
|
|
9
|
+
Closed = 3
|
|
10
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { Extension, onChangePayload, onLoadDocumentPayload, storePayload, fetchPayload } from '@hocuspocus/server';
|
|
2
|
-
export interface DatabaseConfiguration {
|
|
3
|
-
/**
|
|
4
|
-
* Pass a Promise to retrieve updates from your database. The Promise should resolve to
|
|
5
|
-
* an array of items with Y.js-compatible binary data.
|
|
6
|
-
*/
|
|
7
|
-
fetch: (data: fetchPayload) => Promise<Uint8Array | null>;
|
|
8
|
-
/**
|
|
9
|
-
* Pass a function to store updates in your database.
|
|
10
|
-
*/
|
|
11
|
-
store: (data: storePayload) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare class Database implements Extension {
|
|
14
|
-
/**
|
|
15
|
-
* Default configuration
|
|
16
|
-
*/
|
|
17
|
-
configuration: DatabaseConfiguration;
|
|
18
|
-
/**
|
|
19
|
-
* Constructor
|
|
20
|
-
*/
|
|
21
|
-
constructor(configuration: Partial<DatabaseConfiguration>);
|
|
22
|
-
/**
|
|
23
|
-
* Get stored data from the database.
|
|
24
|
-
*/
|
|
25
|
-
onLoadDocument(data: onLoadDocumentPayload): Promise<any>;
|
|
26
|
-
/**
|
|
27
|
-
* Store new updates in the database.
|
|
28
|
-
*/
|
|
29
|
-
onStoreDocument(data: onChangePayload): Promise<void>;
|
|
30
|
-
}
|
|
1
|
+
import { Extension, onChangePayload, onLoadDocumentPayload, storePayload, fetchPayload } from '@hocuspocus/server';
|
|
2
|
+
export interface DatabaseConfiguration {
|
|
3
|
+
/**
|
|
4
|
+
* Pass a Promise to retrieve updates from your database. The Promise should resolve to
|
|
5
|
+
* an array of items with Y.js-compatible binary data.
|
|
6
|
+
*/
|
|
7
|
+
fetch: (data: fetchPayload) => Promise<Uint8Array | null>;
|
|
8
|
+
/**
|
|
9
|
+
* Pass a function to store updates in your database.
|
|
10
|
+
*/
|
|
11
|
+
store: (data: storePayload) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare class Database implements Extension {
|
|
14
|
+
/**
|
|
15
|
+
* Default configuration
|
|
16
|
+
*/
|
|
17
|
+
configuration: DatabaseConfiguration;
|
|
18
|
+
/**
|
|
19
|
+
* Constructor
|
|
20
|
+
*/
|
|
21
|
+
constructor(configuration: Partial<DatabaseConfiguration>);
|
|
22
|
+
/**
|
|
23
|
+
* Get stored data from the database.
|
|
24
|
+
*/
|
|
25
|
+
onLoadDocument(data: onLoadDocumentPayload): Promise<any>;
|
|
26
|
+
/**
|
|
27
|
+
* Store new updates in the database.
|
|
28
|
+
*/
|
|
29
|
+
onStoreDocument(data: onChangePayload): Promise<void>;
|
|
30
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './Database';
|
|
1
|
+
export * from './Database.js';
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import { Extension, onChangePayload, onConfigurePayload, onConnectPayload, onLoadDocumentPayload, onDestroyPayload, onDisconnectPayload, onRequestPayload, onUpgradePayload } from '@hocuspocus/server';
|
|
2
|
-
export interface LoggerConfiguration {
|
|
3
|
-
/**
|
|
4
|
-
* Prepend all logging message with a string.
|
|
5
|
-
*
|
|
6
|
-
* @deprecated
|
|
7
|
-
*/
|
|
8
|
-
prefix: null | string;
|
|
9
|
-
/**
|
|
10
|
-
* Whether to log something for the `onLoadDocument` hook.
|
|
11
|
-
*/
|
|
12
|
-
onLoadDocument: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Whether to log something for the `onChange` hook.
|
|
15
|
-
*/
|
|
16
|
-
onChange: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Whether to log something for the `onStoreDocument` hook.
|
|
19
|
-
*/
|
|
20
|
-
onStoreDocument: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Whether to log something for the `onConnect` hook.
|
|
23
|
-
*/
|
|
24
|
-
onConnect: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Whether to log something for the `onDisconnect` hook.
|
|
27
|
-
*/
|
|
28
|
-
onDisconnect: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Whether to log something for the `onUpgrade` hook.
|
|
31
|
-
*/
|
|
32
|
-
onUpgrade: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Whether to log something for the `onRequest` hook.
|
|
35
|
-
*/
|
|
36
|
-
onRequest: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Whether to log something for the `onDestroy` hook.
|
|
39
|
-
*/
|
|
40
|
-
onDestroy: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Whether to log something for the `onConfigure` hook.
|
|
43
|
-
*/
|
|
44
|
-
onConfigure: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* A log function, if none is provided output will go to console
|
|
47
|
-
*/
|
|
48
|
-
log: (...args: any[]) => void;
|
|
49
|
-
}
|
|
50
|
-
export declare class Logger implements Extension {
|
|
51
|
-
name: string | null;
|
|
52
|
-
configuration: LoggerConfiguration;
|
|
53
|
-
/**
|
|
54
|
-
* Constructor
|
|
55
|
-
*/
|
|
56
|
-
constructor(configuration?: Partial<LoggerConfiguration>);
|
|
57
|
-
onConfigure(data: onConfigurePayload): Promise<void>;
|
|
58
|
-
onLoadDocument(data: onLoadDocumentPayload): Promise<void>;
|
|
59
|
-
onChange(data: onChangePayload): Promise<void>;
|
|
60
|
-
onStoreDocument(data: onDisconnectPayload): Promise<void>;
|
|
61
|
-
onConnect(data: onConnectPayload): Promise<void>;
|
|
62
|
-
onDisconnect(data: onDisconnectPayload): Promise<void>;
|
|
63
|
-
onUpgrade(data: onUpgradePayload): Promise<void>;
|
|
64
|
-
onRequest(data: onRequestPayload): Promise<void>;
|
|
65
|
-
onDestroy(data: onDestroyPayload): Promise<void>;
|
|
66
|
-
private log;
|
|
67
|
-
}
|
|
1
|
+
import { Extension, onChangePayload, onConfigurePayload, onConnectPayload, onLoadDocumentPayload, onDestroyPayload, onDisconnectPayload, onRequestPayload, onUpgradePayload } from '@hocuspocus/server';
|
|
2
|
+
export interface LoggerConfiguration {
|
|
3
|
+
/**
|
|
4
|
+
* Prepend all logging message with a string.
|
|
5
|
+
*
|
|
6
|
+
* @deprecated
|
|
7
|
+
*/
|
|
8
|
+
prefix: null | string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to log something for the `onLoadDocument` hook.
|
|
11
|
+
*/
|
|
12
|
+
onLoadDocument: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to log something for the `onChange` hook.
|
|
15
|
+
*/
|
|
16
|
+
onChange: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to log something for the `onStoreDocument` hook.
|
|
19
|
+
*/
|
|
20
|
+
onStoreDocument: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to log something for the `onConnect` hook.
|
|
23
|
+
*/
|
|
24
|
+
onConnect: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to log something for the `onDisconnect` hook.
|
|
27
|
+
*/
|
|
28
|
+
onDisconnect: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to log something for the `onUpgrade` hook.
|
|
31
|
+
*/
|
|
32
|
+
onUpgrade: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Whether to log something for the `onRequest` hook.
|
|
35
|
+
*/
|
|
36
|
+
onRequest: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether to log something for the `onDestroy` hook.
|
|
39
|
+
*/
|
|
40
|
+
onDestroy: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to log something for the `onConfigure` hook.
|
|
43
|
+
*/
|
|
44
|
+
onConfigure: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* A log function, if none is provided output will go to console
|
|
47
|
+
*/
|
|
48
|
+
log: (...args: any[]) => void;
|
|
49
|
+
}
|
|
50
|
+
export declare class Logger implements Extension {
|
|
51
|
+
name: string | null;
|
|
52
|
+
configuration: LoggerConfiguration;
|
|
53
|
+
/**
|
|
54
|
+
* Constructor
|
|
55
|
+
*/
|
|
56
|
+
constructor(configuration?: Partial<LoggerConfiguration>);
|
|
57
|
+
onConfigure(data: onConfigurePayload): Promise<void>;
|
|
58
|
+
onLoadDocument(data: onLoadDocumentPayload): Promise<void>;
|
|
59
|
+
onChange(data: onChangePayload): Promise<void>;
|
|
60
|
+
onStoreDocument(data: onDisconnectPayload): Promise<void>;
|
|
61
|
+
onConnect(data: onConnectPayload): Promise<void>;
|
|
62
|
+
onDisconnect(data: onDisconnectPayload): Promise<void>;
|
|
63
|
+
onUpgrade(data: onUpgradePayload): Promise<void>;
|
|
64
|
+
onRequest(data: onRequestPayload): Promise<void>;
|
|
65
|
+
onDestroy(data: onDestroyPayload): Promise<void>;
|
|
66
|
+
private log;
|
|
67
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './Logger';
|
|
1
|
+
export * from './Logger.js';
|