Back to Tldraw

Api Report.Api

packages/sync-collaboration/api-report.api.md

5.3.01.6 KB
Original Source

API Report File for "@tldraw/sync-collaboration"

Do not edit this file. It is a report generated by API Extractor.

ts

import { TLComment } from '@tldraw/tlschema';
import { TLCommentReaction } from '@tldraw/tlschema';
import { TLCommentThread } from '@tldraw/tlschema';
import type { TLRecordAuthorizers } from '@tldraw/sync-core';

// @public
export interface CommentAuthorizerOptions<SessionMeta> {
    canComment?(session: {
        isReadonly: boolean;
        meta: SessionMeta;
        sessionId: string;
    }): boolean;
    canModifyComment?(ctx: CommentModificationAuthContext<SessionMeta>): boolean;
    getUserId(session: {
        isReadonly: boolean;
        meta: SessionMeta;
        sessionId: string;
    }): null | string;
}

// @public
export type CommentModification = {
    readonly action: 'delete-comment';
    readonly comment: TLComment;
} | {
    readonly action: 'delete-thread';
    readonly thread: TLCommentThread;
} | {
    readonly action: 'edit-comment';
    readonly comment: TLComment;
};

// @public
export type CommentModificationAuthContext<SessionMeta> = {
    readonly ownerId: string;
    readonly session: {
        isReadonly: boolean;
        meta: SessionMeta;
        sessionId: string;
    };
    readonly userId: null | string;
} & CommentModification;

// @public
export function createCommentAuthorizers<SessionMeta>(opts: CommentAuthorizerOptions<SessionMeta>): TLRecordAuthorizers<TLComment | TLCommentReaction | TLCommentThread, SessionMeta>;

// (No @packageDocumentation comment for this package)