@hocuspocus/extension-s3 3.4.1 → 3.4.4
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/packages/common/src/auth.d.ts +2 -1
- package/dist/packages/provider/src/HocuspocusProvider.d.ts +3 -3
- package/dist/packages/provider/src/HocuspocusProviderWebsocket.d.ts +5 -0
- package/dist/packages/provider/src/types.d.ts +2 -1
- package/dist/packages/server/src/Connection.d.ts +7 -3
- package/dist/packages/server/src/MessageReceiver.d.ts +1 -1
- package/package.json +5 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as encoding from "lib0/encoding";
|
|
2
2
|
import * as decoding from "lib0/decoding";
|
|
3
|
+
import type { AuthorizedScope } from "../../provider/src";
|
|
3
4
|
export declare enum AuthMessageType {
|
|
4
5
|
Token = 0,
|
|
5
6
|
PermissionDenied = 1,
|
|
@@ -7,6 +8,6 @@ export declare enum AuthMessageType {
|
|
|
7
8
|
}
|
|
8
9
|
export declare const writeAuthentication: (encoder: encoding.Encoder, auth: string) => void;
|
|
9
10
|
export declare const writePermissionDenied: (encoder: encoding.Encoder, reason: string) => void;
|
|
10
|
-
export declare const writeAuthenticated: (encoder: encoding.Encoder, scope:
|
|
11
|
+
export declare const writeAuthenticated: (encoder: encoding.Encoder, scope: AuthorizedScope) => void;
|
|
11
12
|
export declare const writeTokenSyncRequest: (encoder: encoding.Encoder) => void;
|
|
12
13
|
export declare const readAuthMessage: (decoder: decoding.Decoder, sendToken: () => void, permissionDeniedHandler: (reason: string) => void, authenticatedHandler: (scope: string) => void) => void;
|
|
@@ -4,8 +4,8 @@ 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, onAuthenticatedParameters, onAuthenticationFailedParameters, onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatelessParameters, onStatusParameters, onSyncedParameters, onUnsyncedChangesParameters } from "./types.ts";
|
|
8
|
-
export type HocuspocusProviderConfiguration = Required<Pick<CompleteHocuspocusProviderConfiguration, "name">> & Partial<CompleteHocuspocusProviderConfiguration> & (Required<Pick<CompleteHocuspocusProviderWebsocketConfiguration, "url">> | Required<Pick<CompleteHocuspocusProviderConfiguration, "websocketProvider">>);
|
|
7
|
+
import type { AuthorizedScope, ConstructableOutgoingMessage, onAuthenticatedParameters, onAuthenticationFailedParameters, onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatelessParameters, onStatusParameters, onSyncedParameters, onUnsyncedChangesParameters } from "./types.ts";
|
|
8
|
+
export type HocuspocusProviderConfiguration = Required<Pick<CompleteHocuspocusProviderConfiguration, "name">> & Partial<CompleteHocuspocusProviderConfiguration> & ((Required<Pick<CompleteHocuspocusProviderWebsocketConfiguration, "url">> & Partial<Pick<CompleteHocuspocusProviderWebsocketConfiguration, "preserveTrailingSlash">>) | Required<Pick<CompleteHocuspocusProviderConfiguration, "websocketProvider">>);
|
|
9
9
|
export interface CompleteHocuspocusProviderConfiguration {
|
|
10
10
|
/**
|
|
11
11
|
* The identifier/name of your document
|
|
@@ -60,7 +60,7 @@ export declare class HocuspocusProvider extends EventEmitter {
|
|
|
60
60
|
isSynced: boolean;
|
|
61
61
|
unsyncedChanges: number;
|
|
62
62
|
isAuthenticated: boolean;
|
|
63
|
-
authorizedScope:
|
|
63
|
+
authorizedScope: AuthorizedScope | undefined;
|
|
64
64
|
manageSocket: boolean;
|
|
65
65
|
private _isAttached;
|
|
66
66
|
intervals: any;
|
|
@@ -16,6 +16,11 @@ export interface CompleteHocuspocusProviderWebsocketConfiguration {
|
|
|
16
16
|
* URL of your @hocuspocus/server instance
|
|
17
17
|
*/
|
|
18
18
|
url: string;
|
|
19
|
+
/**
|
|
20
|
+
* By default, trailing slashes are removed from the URL. Set this to true
|
|
21
|
+
* to preserve trailing slashes if your server configuration requires them.
|
|
22
|
+
*/
|
|
23
|
+
preserveTrailingSlash: boolean;
|
|
19
24
|
/**
|
|
20
25
|
* An optional WebSocket polyfill, for example for Node.js
|
|
21
26
|
*/
|
|
@@ -25,6 +25,7 @@ export declare enum WebSocketStatus {
|
|
|
25
25
|
Connected = "connected",
|
|
26
26
|
Disconnected = "disconnected"
|
|
27
27
|
}
|
|
28
|
+
export type AuthorizedScope = "read-write" | "readonly";
|
|
28
29
|
export interface OutgoingMessageInterface {
|
|
29
30
|
encoder: Encoder;
|
|
30
31
|
type?: MessageType;
|
|
@@ -50,7 +51,7 @@ export type onAuthenticationFailedParameters = {
|
|
|
50
51
|
reason: string;
|
|
51
52
|
};
|
|
52
53
|
export type onAuthenticatedParameters = {
|
|
53
|
-
scope:
|
|
54
|
+
scope: AuthorizedScope;
|
|
54
55
|
};
|
|
55
56
|
export type onOpenParameters = {
|
|
56
57
|
event: Event;
|
|
@@ -2,7 +2,7 @@ import type { IncomingMessage as HTTPIncomingMessage } from "node:http";
|
|
|
2
2
|
import { type CloseEvent } from "@hocuspocus/common";
|
|
3
3
|
import type WebSocket from "ws";
|
|
4
4
|
import type Document from "./Document.ts";
|
|
5
|
-
import type { beforeSyncPayload, onStatelessPayload
|
|
5
|
+
import type { beforeSyncPayload, onStatelessPayload } from "./types.ts";
|
|
6
6
|
export declare class Connection {
|
|
7
7
|
webSocket: WebSocket;
|
|
8
8
|
context: any;
|
|
@@ -13,7 +13,9 @@ export declare class Connection {
|
|
|
13
13
|
beforeHandleMessage: (connection: Connection, update: Uint8Array) => Promise<void>;
|
|
14
14
|
beforeSync: (connection: Connection, payload: Pick<beforeSyncPayload, "type" | "payload">) => Promise<void>;
|
|
15
15
|
statelessCallback: (payload: onStatelessPayload) => Promise<void>;
|
|
16
|
-
onTokenSyncCallback: (payload:
|
|
16
|
+
onTokenSyncCallback: (payload: {
|
|
17
|
+
token: string;
|
|
18
|
+
}) => Promise<void>;
|
|
17
19
|
};
|
|
18
20
|
socketId: string;
|
|
19
21
|
readOnly: boolean;
|
|
@@ -40,7 +42,9 @@ export declare class Connection {
|
|
|
40
42
|
/**
|
|
41
43
|
* Set a callback that will be triggered when on token sync message is received
|
|
42
44
|
*/
|
|
43
|
-
onTokenSyncCallback(callback: (payload:
|
|
45
|
+
onTokenSyncCallback(callback: (payload: {
|
|
46
|
+
token: string;
|
|
47
|
+
}) => Promise<void>): Connection;
|
|
44
48
|
/**
|
|
45
49
|
* Send the given message
|
|
46
50
|
*/
|
|
@@ -6,6 +6,6 @@ export declare class MessageReceiver {
|
|
|
6
6
|
defaultTransactionOrigin?: string;
|
|
7
7
|
constructor(message: IncomingMessage, defaultTransactionOrigin?: string);
|
|
8
8
|
apply(document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): void;
|
|
9
|
-
readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean): 0 |
|
|
9
|
+
readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean): 0 | 2 | 1;
|
|
10
10
|
applyQueryAwarenessMessage(document: Document, reply?: (message: Uint8Array) => void): void;
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hocuspocus/extension-s3",
|
|
3
3
|
"description": "a S3-compatible persistence driver for Hocuspocus",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.4",
|
|
5
5
|
"homepage": "https://hocuspocus.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"hocuspocus",
|
|
@@ -30,10 +30,13 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@aws-sdk/client-s3": "^3.0.0",
|
|
33
|
-
"@hocuspocus/extension-database": "^3.4.
|
|
33
|
+
"@hocuspocus/extension-database": "^3.4.4",
|
|
34
34
|
"kleur": "^4.1.4"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"repository": {
|
|
40
|
+
"url": "https://github.com/ueberdosis/hocuspocus"
|
|
38
41
|
}
|
|
39
42
|
}
|