@hocuspocus/extension-redis 2.12.0-rc.0 → 2.12.2-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.
@@ -1,4 +1,5 @@
1
- import { type MessageEvent, Event } from 'ws';
1
+ import type { MessageEvent } from 'ws';
2
+ import { Event } from 'ws';
2
3
  import EventEmitter from './EventEmitter.js';
3
4
  import { HocuspocusProvider } from './HocuspocusProvider.js';
4
5
  import { WebSocketStatus, onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatusParameters } from './types.js';
@@ -1,8 +1,9 @@
1
1
  import type { AbstractType, YArrayEvent } from 'yjs';
2
+ import * as Y from 'yjs';
2
3
  import { HocuspocusProvider, HocuspocusProviderConfiguration } from './HocuspocusProvider.js';
3
4
  import { TiptapCollabProviderWebsocket } from './TiptapCollabProviderWebsocket.js';
4
5
  import type { TCollabComment, TCollabThread, THistoryVersion } from './types.js';
5
- export type TiptapCollabProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & (Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'websocketProvider'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'baseUrl'>>);
6
+ export type TiptapCollabProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & (Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'websocketProvider'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'baseUrl'>>) & Pick<AdditionalTiptapCollabProviderConfiguration, 'user'>;
6
7
  export interface AdditionalTiptapCollabProviderConfiguration {
7
8
  /**
8
9
  * A Hocuspocus Cloud App ID, get one here: https://cloud.tiptap.dev
@@ -13,9 +14,11 @@ export interface AdditionalTiptapCollabProviderConfiguration {
13
14
  */
14
15
  baseUrl?: string;
15
16
  websocketProvider?: TiptapCollabProviderWebsocket;
17
+ user?: string;
16
18
  }
17
19
  export declare class TiptapCollabProvider extends HocuspocusProvider {
18
20
  tiptapCollabConfigurationPrefix: string;
21
+ userData?: Y.PermanentUserData;
19
22
  constructor(configuration: TiptapCollabProviderConfiguration);
20
23
  /**
21
24
  * note: this will only work if your server loaded @hocuspocus-pro/extension-history, or if you are on a Tiptap business plan.
@@ -38,6 +38,7 @@ export interface Extension {
38
38
  onConnect?(data: onConnectPayload): Promise<any>;
39
39
  connected?(data: connectedPayload): Promise<any>;
40
40
  onAuthenticate?(data: onAuthenticatePayload): Promise<any>;
41
+ onCreateDocument?(data: onCreateDocumentPayload): Promise<any>;
41
42
  onLoadDocument?(data: onLoadDocumentPayload): Promise<any>;
42
43
  afterLoadDocument?(data: afterLoadDocumentPayload): Promise<any>;
43
44
  beforeHandleMessage?(data: beforeHandleMessagePayload): Promise<any>;
@@ -52,7 +53,7 @@ export interface Extension {
52
53
  afterUnloadDocument?(data: afterUnloadDocumentPayload): Promise<any>;
53
54
  onDestroy?(data: onDestroyPayload): Promise<any>;
54
55
  }
55
- export type HookName = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'connected' | 'onAuthenticate' | 'onLoadDocument' | 'afterLoadDocument' | 'beforeHandleMessage' | 'beforeBroadcastStateless' | 'onStateless' | 'onChange' | 'onStoreDocument' | 'afterStoreDocument' | 'onAwarenessUpdate' | 'onRequest' | 'onDisconnect' | 'afterUnloadDocument' | 'onDestroy';
56
+ export type HookName = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'connected' | 'onAuthenticate' | 'onCreateDocument' | 'onLoadDocument' | 'afterLoadDocument' | 'beforeHandleMessage' | 'beforeBroadcastStateless' | 'onStateless' | 'onChange' | 'onStoreDocument' | 'afterStoreDocument' | 'onAwarenessUpdate' | 'onRequest' | 'onDisconnect' | 'afterUnloadDocument' | 'onDestroy';
56
57
  export type HookPayloadByName = {
57
58
  onConfigure: onConfigurePayload;
58
59
  onListen: onListenPayload;
@@ -60,6 +61,7 @@ export type HookPayloadByName = {
60
61
  onConnect: onConnectPayload;
61
62
  connected: connectedPayload;
62
63
  onAuthenticate: onAuthenticatePayload;
64
+ onCreateDocument: onCreateDocumentPayload;
63
65
  onLoadDocument: onLoadDocumentPayload;
64
66
  afterLoadDocument: afterLoadDocumentPayload;
65
67
  beforeHandleMessage: beforeHandleMessagePayload;
@@ -142,10 +144,20 @@ export interface onAuthenticatePayload {
142
144
  instance: Hocuspocus;
143
145
  requestHeaders: IncomingHttpHeaders;
144
146
  requestParameters: URLSearchParams;
147
+ request: IncomingMessage;
145
148
  socketId: string;
146
149
  token: string;
147
150
  connection: ConnectionConfiguration;
148
151
  }
152
+ export interface onCreateDocumentPayload {
153
+ context: any;
154
+ documentName: string;
155
+ instance: Hocuspocus;
156
+ requestHeaders: IncomingHttpHeaders;
157
+ requestParameters: URLSearchParams;
158
+ socketId: string;
159
+ connection: ConnectionConfiguration;
160
+ }
149
161
  export interface onConnectPayload {
150
162
  context: any;
151
163
  documentName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hocuspocus/extension-redis",
3
- "version": "2.12.0-rc.0",
3
+ "version": "2.12.2-rc.0",
4
4
  "description": "Scale Hocuspocus horizontally with Redis",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
@@ -33,7 +33,7 @@
33
33
  "@types/redlock": "^4.0.3"
34
34
  },
35
35
  "dependencies": {
36
- "@hocuspocus/server": "^2.12.0-rc.0",
36
+ "@hocuspocus/server": "^2.12.2-rc.0",
37
37
  "ioredis": "^4.28.2",
38
38
  "kleur": "^4.1.4",
39
39
  "lodash.debounce": "^4.0.8",