@hocuspocus/extension-sqlite
Advanced tools
Comparing version 2.14.0 to 2.15.0
@@ -5,3 +5,3 @@ import type { AbstractType, YArrayEvent } from 'yjs'; | ||
import { TiptapCollabProviderWebsocket } from './TiptapCollabProviderWebsocket.js'; | ||
import type { DeleteCommentOptions, TCollabComment, TCollabThread, THistoryVersion } from './types.js'; | ||
import { type DeleteCommentOptions, type DeleteThreadOptions, type GetThreadsOptions, type TCollabComment, type TCollabThread, type THistoryVersion } from './types.js'; | ||
export type TiptapCollabProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & (Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'websocketProvider'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'baseUrl'>>) & Pick<AdditionalTiptapCollabProviderConfiguration, 'user'> & { | ||
@@ -59,5 +59,6 @@ /** | ||
* Finds all threads in the document and returns them as JSON objects | ||
* @options Options to control the output of the threads (e.g. include deleted threads) | ||
* @returns An array of threads as JSON objects | ||
*/ | ||
getThreads<Data, CommentData>(): TCollabThread<Data, CommentData>[]; | ||
getThreads<Data, CommentData>(options?: GetThreadsOptions): TCollabThread<Data, CommentData>[]; | ||
/** | ||
@@ -86,3 +87,3 @@ * Find the index of a thread by its id | ||
*/ | ||
createThread(data: Omit<TCollabThread, 'id' | 'createdAt' | 'updatedAt' | 'comments' | 'deletedComments'>): TCollabThread; | ||
createThread(data: Omit<TCollabThread, 'id' | 'createdAt' | 'updatedAt' | 'deletedAt' | 'comments' | 'deletedComments'>): TCollabThread; | ||
/** | ||
@@ -98,8 +99,18 @@ * Update a specific thread | ||
/** | ||
* Delete a specific thread and all its comments | ||
* Handle the deletion of a thread. By default, the thread and it's comments are not deleted, but marked as deleted | ||
* via the `deletedAt` property. Forceful deletion can be enabled by setting the `force` option to `true`. | ||
* | ||
* If you only want to delete the comments of a thread, you can set the `deleteComments` option to `true`. | ||
* @param id The thread id | ||
* @returns void | ||
* @param options A set of options that control how the thread is deleted | ||
* @returns The deleted thread or null if the thread is not found | ||
*/ | ||
deleteThread(id: TCollabThread['id']): void; | ||
deleteThread(id: TCollabThread['id'], options?: DeleteThreadOptions): TCollabThread | null | undefined; | ||
/** | ||
* Tries to restore a deleted thread | ||
* @param id The thread id | ||
* @returns The restored thread or null if the thread is not found | ||
*/ | ||
restoreThread(id: TCollabThread['id']): TCollabThread | null; | ||
/** | ||
* Returns comments from a thread, either deleted or not | ||
@@ -106,0 +117,0 @@ * @param threadId The thread id |
@@ -91,2 +91,3 @@ import { Encoder } from 'lib0/encoding'; | ||
updatedAt: number; | ||
deletedAt: number | null; | ||
resolvedAt?: string; | ||
@@ -160,1 +161,28 @@ comments: TCollabComment<CommentData>[]; | ||
}; | ||
export type DeleteThreadOptions = { | ||
/** | ||
* If `true`, will remove the comments on the thread, | ||
* otherwise will only mark the thread as deleted | ||
* and keep the comments | ||
* @default false | ||
*/ | ||
deleteComments?: boolean; | ||
/** | ||
* If `true`, will forcefully remove the thread and all comments, | ||
* otherwise will only mark the thread as deleted | ||
* and keep the comments | ||
* @default false | ||
*/ | ||
force?: boolean; | ||
}; | ||
/** | ||
* The type of thread | ||
*/ | ||
export type ThreadType = 'archived' | 'unarchived'; | ||
export type GetThreadsOptions = { | ||
/** | ||
* The types of threads to get | ||
* @default ['unarchived'] | ||
*/ | ||
types?: Array<ThreadType>; | ||
}; |
{ | ||
"name": "@hocuspocus/extension-sqlite", | ||
"description": "a generic Hocuspocus persistence driver for the sqlite", | ||
"version": "2.14.0", | ||
"version": "2.15.0", | ||
"homepage": "https://hocuspocus.dev", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@hocuspocus/extension-database": "^2.14.0", | ||
"@hocuspocus/extension-database": "^2.15.0", | ||
"kleur": "^4.1.4", | ||
@@ -33,0 +33,0 @@ "sqlite3": "^5.0.11" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91183
2244