@hocuspocus/extension-webhook 2.9.0 → 2.9.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,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 { 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
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 {
@@ -36,4 +40,19 @@ export declare class TiptapCollabProvider extends HocuspocusProvider {
36
40
  isAutoVersioning(): boolean;
37
41
  enableAutoVersioning(): 1;
38
42
  disableAutoVersioning(): 0;
43
+ private getYThreads;
44
+ getThreads<Data, CommentData>(): TCollabThread<Data, CommentData>[];
45
+ private getThreadIndex;
46
+ getThread<Data, CommentData>(id: string): TCollabThread<Data, CommentData> | null;
47
+ private getYThread;
48
+ createThread(data: TCollabThread): TCollabThread | null;
49
+ updateThread(id: TCollabThread['id'], data: Pick<TCollabThread, 'data'>): TCollabThread | null;
50
+ deleteThread(id: TCollabThread['id']): void;
51
+ getThreadComments(threadId: TCollabThread['id']): TCollabComment[] | null;
52
+ getThreadComment(threadId: TCollabThread['id'], commentId: TCollabComment['id']): TCollabComment | null;
53
+ addComment(threadId: TCollabThread['id'], data: TCollabComment): TCollabThread | null;
54
+ updateComment(threadId: TCollabThread['id'], commentId: TCollabComment['id'], data: TCollabComment): TCollabThread | null;
55
+ deleteComment(threadId: TCollabThread['id'], commentId: TCollabComment['id']): TCollabThread | null;
56
+ watchThreads(callback: () => void): void;
57
+ unwatchThreads(callback: () => void): void;
39
58
  }
@@ -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);
@@ -84,6 +84,20 @@ export type StatesArray = {
84
84
  clientId: number;
85
85
  [key: string | number]: any;
86
86
  }[];
87
+ export type TCollabThread<Data = any, CommentData = any> = {
88
+ id: string;
89
+ createdAt: number;
90
+ updatedAt: number;
91
+ comments: TCollabComment<CommentData>[];
92
+ data: Data;
93
+ };
94
+ export type TCollabComment<Data = any> = {
95
+ id: string;
96
+ createdAt: number;
97
+ updatedAt: number;
98
+ data: Data;
99
+ content: any;
100
+ };
87
101
  export type THistoryVersion = {
88
102
  name?: string;
89
103
  version: number;
@@ -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;
@@ -1,2 +1,2 @@
1
- declare const _default: import("vite").UserConfigExport;
1
+ declare const _default: import("vite").UserConfig;
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hocuspocus/extension-webhook",
3
- "version": "2.9.0",
3
+ "version": "2.9.2-rc.0",
4
4
  "description": "hocuspocus webhook extension",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
@@ -30,9 +30,9 @@
30
30
  "dist"
31
31
  ],
32
32
  "dependencies": {
33
- "@hocuspocus/common": "^2.9.0",
34
- "@hocuspocus/server": "^2.9.0",
35
- "@hocuspocus/transformer": "^2.9.0",
33
+ "@hocuspocus/common": "^2.9.2-rc.0",
34
+ "@hocuspocus/server": "^2.9.2-rc.0",
35
+ "@hocuspocus/transformer": "^2.9.2-rc.0",
36
36
  "axios": "^1.6.2"
37
37
  },
38
38
  "peerDependencies": {