UNPKG

@veltdev/types

Version:

Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.

85 lines (84 loc) 3.06 kB
import { ResolverActions, CommentResolverSaveEvent } from "../../utils/enums"; import { PartialAttachment } from "./attachment-resolver.data.model"; import { BaseMetadata } from "./base-metadata.data.model"; import { CommentAnnotation } from "./comment-annotation.data.model"; import { ResolverConfig, ResolverResponse } from "./resolver.data.model"; export interface CommentAnnotationDataProvider { get?: (request: GetCommentResolverRequest) => Promise<ResolverResponse<Record<string, PartialCommentAnnotation>>>; save?: (request: SaveCommentResolverRequest) => Promise<ResolverResponse<undefined>>; delete?: (request: DeleteCommentResolverRequest) => Promise<ResolverResponse<undefined>>; config?: ResolverConfig; } export interface GetCommentResolverRequest { organizationId: string; commentAnnotationIds?: string[]; documentIds?: string[]; folderId?: string; allDocuments?: boolean; } export interface DeleteCommentResolverRequest { commentAnnotationId: string; metadata?: BaseMetadata; event?: ResolverActions; } export interface SaveCommentResolverRequest { commentAnnotation: { [key: string]: PartialCommentAnnotation; }; /** * The save event. One of the 4 core PII events (`ResolverActions`) or, when the customer * opts in via `ResolverConfig.additionalSaveEvents`, a non-core annotation-level event * (`CommentResolverSaveEvent`). See specs/comment-resolver iteration-2. */ event?: ResolverActions | CommentResolverSaveEvent; metadata?: BaseMetadata; commentId?: string; /** * The comment the action occurred on, resolved from `commentId` against the * payload's `commentAnnotation[*].comments` map. Convenience field so the * customer backend does not have to re-derive the target comment from * `commentId`. Omitted when `commentId` is absent or no matching comment is found. */ targetComment?: PartialComment; } export interface PartialUser { userId: string; } export interface PartialTaggedUserContacts { userId: string; contact?: PartialUser; text?: string; } export interface PartialComment { commentId: string | number; commentHtml?: string; commentText?: string; attachments?: { [attachmentId: number]: PartialAttachment; }; from?: PartialUser; to?: PartialUser[]; taggedUserContacts?: PartialTaggedUserContacts[]; } export interface PartialCommentAnnotationResult { strippedData: { [annotationId: string]: PartialCommentAnnotation; } | null; originalData: CommentAnnotation | null; eventType?: ResolverActions | CommentResolverSaveEvent; } export interface PartialTargetTextRange { text: string; } export interface PartialCommentAnnotation { annotationId: string; metadata?: BaseMetadata; comments: { [commentId: string]: PartialComment; }; from?: PartialUser; assignedTo?: PartialUser; targetTextRange?: PartialTargetTextRange; resolvedByUserId?: string | null; [key: string]: any; }