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.

164 lines (163 loc) 4.38 kB
import { UserContact } from "./user-contact.data.model"; import { UserPermissionAccessRole } from "./user-resolver.data.model"; export declare class User { /** * Unique user identifier that you use to identify your user. */ userId: string; /** * Your user's full name. * * Default: Random avatar name. */ name?: string; clientUserName?: string; /** * Your user's display picture URL. * * Default: Random avatar image. */ photoUrl?: string; /** * This is required if you want us to send email or slack notifications * to users when they add comments and tag their co-workers. */ email?: string; /** * This will help us show a drop down when a user wants to tag their co-workers in a comment. */ contacts?: UserContact[]; /** * The product plan your user is on. */ plan?: string; /** * It could be a domain name or any identifier you use to cluster a group of users who work together. */ groupId?: string; /** * Original groupId provided by the user. */ clientGroupId?: string; organizationId?: string; clientOrganizationId?: string; /** * Auto generated unique user id that is linked with your app's user ID. * This is needed by us for internal processing. */ userSnippylyId?: string; /** * A random color is assigned to the user for the current session. * This is the color on the avatar border and live cursor, if these features are enabled. */ color?: string; /** * This is the color on the avatar text. */ textColor?: string; /** * User type. * */ type?: string; isAdmin?: boolean; /** * Readonly user */ isReadOnly?: boolean; /** * Anonymous user can only view the comments */ isAnonymous?: boolean; /** * Guest user */ isGuest?: boolean; initial?: string; } export declare class Options { /** * If you want to replace the contacts of the user with the contacts you are sending. * This will replace personal and group contacts of the user. */ replaceContacts?: boolean; /** * If you want to replace the personal contacts of the user with the contacts you are sending. * This will replace personal contacts of the user. */ replacePrivateContacts?: boolean; /** * If you want to replace the group contacts of the user with the contacts you are sending. * This will replace group contacts of the user. */ replaceGroupContacts?: boolean; /** * Pass the auth token of the user. */ authToken?: string; /** * If you want to force re-login the user. */ forceReset?: boolean; } export interface AuthRetryConfig { retryCount?: number; retryDelay?: number; } export interface Context { access: { [key: string]: string | number; }; accessFields?: Array<string>; } export interface VeltAuthProvider { user: User; options?: Options; retryConfig?: AuthRetryConfig; generateToken?: () => Promise<string>; } export declare enum RevokeAccessOnType { DOCUMENT_UNSET = "document_unset", USER_LOGOUT = "user_logout" } export declare enum PermissionSource { SET_DOCUMENTS = "setDocuments", IDENTIFY = "identify", GET_NOTIFICATIONS = "getNotifications", SET_NOTIFICATIONS = "setNotifications" } export interface RevokeAccessOn { type: RevokeAccessOnType; revokeOrganizationAccess?: boolean; } export interface VeltPermissionProvider { retryConfig?: AuthRetryConfig; isContextEnabled?: boolean; revokeAccessOn?: RevokeAccessOn[]; forceRefresh?: boolean; } export declare enum PermissionResourceType { FOLDER = "folder", DOCUMENT = "document", ORGANIZATION = "organization", CONTEXT = "context" } export interface PermissionQuery { userId: string; resource: { id: string; type: PermissionResourceType; source: PermissionSource; organizationId: string; context?: Context; }; } export interface PermissionResult { userId: string; resourceId: string; organizationId: string; type: PermissionResourceType; accessRole?: UserPermissionAccessRole; expiresAt?: number; hasAccess: boolean; }