@hocuspocus/provider 2.9.0-rc.0 → 2.9.1-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,13 +1,17 @@
1
1
  import type { AbstractType, YArrayEvent } from 'yjs';
2
2
  import { HocuspocusProvider, HocuspocusProviderConfiguration } from './HocuspocusProvider.js';
3
3
  import { TiptapCollabProviderWebsocket } from './TiptapCollabProviderWebsocket.js';
4
- import type { THistoryVersion } from './types';
5
- export type TiptapCollabProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & (Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'websocketProvider'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>>);
4
+ import type { 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
6
  export interface AdditionalTiptapCollabProviderConfiguration {
7
7
  /**
8
8
  * A Hocuspocus Cloud App ID, get one here: https://cloud.tiptap.dev
9
9
  */
10
10
  appId?: string;
11
+ /**
12
+ * If you are using the on-premise version of TiptapCollab, put your baseUrl here (e.g. https://collab.yourdomain.com)
13
+ */
14
+ baseUrl?: string;
11
15
  websocketProvider?: TiptapCollabProviderWebsocket;
12
16
  }
13
17
  export declare class TiptapCollabProvider extends HocuspocusProvider {
@@ -4,7 +4,11 @@ export interface AdditionalTiptapCollabProviderWebsocketConfiguration {
4
4
  /**
5
5
  * A Hocuspocus Cloud App ID, get one here: https://cloud.tiptap.dev
6
6
  */
7
- appId: string;
7
+ appId?: string;
8
+ /**
9
+ * If you are using the on-premise version of TiptapCollab, put your baseUrl here (e.g. https://collab.yourdomain.com)
10
+ */
11
+ baseUrl?: string;
8
12
  }
9
13
  export declare class TiptapCollabProviderWebsocket extends HocuspocusProviderWebsocket {
10
14
  constructor(configuration: TiptapCollabProviderWebsocketConfiguration);
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { IncomingMessage } from 'http';
3
3
  import WebSocket, { AddressInfo } from 'ws';
4
- import { Server as HocuspocusServer } from './Server';
4
+ import { Server as HocuspocusServer } from './Server.js';
5
5
  import { Debugger } from './Debugger.js';
6
6
  import { DirectConnection } from './DirectConnection.js';
7
7
  import Document from './Document.js';
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { IncomingMessage, Server as HTTPServer, ServerResponse } from 'http';
3
3
  import { WebSocketServer } from 'ws';
4
- import { Hocuspocus } from './Hocuspocus';
4
+ import { Hocuspocus } from './Hocuspocus.js';
5
5
  export declare class Server {
6
6
  httpServer: HTTPServer;
7
7
  webSocketServer: WebSocketServer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hocuspocus/provider",
3
- "version": "2.9.0-rc.0",
3
+ "version": "2.9.1-rc.0",
4
4
  "description": "hocuspocus provider",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
@@ -29,7 +29,7 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@hocuspocus/common": "^2.9.0-rc.0",
32
+ "@hocuspocus/common": "^2.9.1-rc.0",
33
33
  "@lifeomic/attempt": "^3.0.2",
34
34
  "lib0": "^0.2.87",
35
35
  "ws": "^8.14.2"
@@ -5,13 +5,14 @@ import {
5
5
  } from './HocuspocusProvider.js'
6
6
 
7
7
  import { TiptapCollabProviderWebsocket } from './TiptapCollabProviderWebsocket.js'
8
- import type { THistoryVersion } from './types'
8
+ import type { THistoryVersion } from './types.js'
9
9
 
10
10
  export type TiptapCollabProviderConfiguration =
11
11
  Required<Pick<HocuspocusProviderConfiguration, 'name'>> &
12
12
  Partial<HocuspocusProviderConfiguration> &
13
13
  (Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'websocketProvider'>> |
14
- Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>>)
14
+ Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>>|
15
+ Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'baseUrl'>>)
15
16
 
16
17
  export interface AdditionalTiptapCollabProviderConfiguration {
17
18
  /**
@@ -19,6 +20,11 @@ export interface AdditionalTiptapCollabProviderConfiguration {
19
20
  */
20
21
  appId?: string,
21
22
 
23
+ /**
24
+ * If you are using the on-premise version of TiptapCollab, put your baseUrl here (e.g. https://collab.yourdomain.com)
25
+ */
26
+ baseUrl?: string
27
+
22
28
  websocketProvider?: TiptapCollabProviderWebsocket
23
29
  }
24
30
 
@@ -27,7 +33,7 @@ export class TiptapCollabProvider extends HocuspocusProvider {
27
33
 
28
34
  constructor(configuration: TiptapCollabProviderConfiguration) {
29
35
  if (!configuration.websocketProvider) {
30
- configuration.websocketProvider = new TiptapCollabProviderWebsocket({ appId: (configuration as Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>>).appId })
36
+ configuration.websocketProvider = new TiptapCollabProviderWebsocket({ appId: (configuration as Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>>).appId, baseUrl: (configuration as Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'baseUrl'>>).baseUrl })
31
37
  }
32
38
 
33
39
  if (!configuration.token) {
@@ -11,11 +11,16 @@ export interface AdditionalTiptapCollabProviderWebsocketConfiguration {
11
11
  /**
12
12
  * A Hocuspocus Cloud App ID, get one here: https://cloud.tiptap.dev
13
13
  */
14
- appId: string,
14
+ appId?: string,
15
+
16
+ /**
17
+ * If you are using the on-premise version of TiptapCollab, put your baseUrl here (e.g. https://collab.yourdomain.com)
18
+ */
19
+ baseUrl?: string
15
20
  }
16
21
 
17
22
  export class TiptapCollabProviderWebsocket extends HocuspocusProviderWebsocket {
18
23
  constructor(configuration: TiptapCollabProviderWebsocketConfiguration) {
19
- super({ ...configuration as HocuspocusProviderWebsocketConfiguration, url: `wss://${configuration.appId}.collab.tiptap.cloud` })
24
+ super({ ...configuration as HocuspocusProviderWebsocketConfiguration, url: configuration.baseUrl ?? `wss://${configuration.appId}.collab.tiptap.cloud` })
20
25
  }
21
26
  }