Options
All
  • Public
  • Public/Protected
  • All
Menu

@pdftron/collab-server

Index

Type aliases

CollabServerOptions: { resolvers: UserResolvers; corsOption?: CorsOptions; logLevel?: LogLevels; filterLogsByTag?: LogTags | LogTags[]; logTransports?: winston.transport[]; emailOptions?: CollabServerEmailOptions; verifyPassword?: VerifyPassword; getUserFromToken?: GetUserFromToken; permissions?: UserPermissionSetting; getNow?: TimestampGetter; unknownInviteStrategy?: UnknownInviteStrategy; disableSnapshotAssets?: boolean; permissionCacheSettings?: { ttl?: number; resetAgeOnCheck?: boolean; maxCacheSize?: number }; annotationSyncSettings?: { unknownUserStrategy?: AnnotationSyncUnknownUserStrategy }; disableGraphqlHomepage?: boolean }

Type declaration

  • resolvers: UserResolvers

    The resolvers for the server. See resolvers for more info.

  • Optional corsOption?: CorsOptions

    Cors settings for the server. Accepts anything the 'cors' npm package accepts

  • Optional logLevel?: LogLevels

    Log levels for the server.

    example
    import CollabServer from '@pdftron/collab-server'
    new CollabServer({
    logLevel: CollabServer.LogLevels.ERROR
    })
  • Optional filterLogsByTag?: LogTags | LogTags[]

    If set, only logs with this tag(s) will be displayed

  • Optional logTransports?: winston.transport[]

    Custom winston logging transports

  • Optional emailOptions?: CollabServerEmailOptions

    Email settings. Used to send emails to users on certain events.

  • Optional verifyPassword?: VerifyPassword

    A function to verify a users password. Only used if you use the loginWithPassword API.

  • Optional getUserFromToken?: GetUserFromToken

    A function that accepts an authentication token and returns a user object

  • Optional permissions?: UserPermissionSetting

    Custom permission settings for the server

  • Optional getNow?: TimestampGetter

    A function to get a value that represents "now" in your database.

  • Optional unknownInviteStrategy?: UnknownInviteStrategy

    Which strategy to use when an unknown user is invited to a document.

  • Optional disableSnapshotAssets?: boolean

    Disables the snapshot assets feature.

  • Optional permissionCacheSettings?: { ttl?: number; resetAgeOnCheck?: boolean; maxCacheSize?: number }

    Settings for the internal permissions cache

    • Optional ttl?: number

      The maximum amount of time a permission check result can be maintained in the cache. Must be positive integer in MS. Defaults to one hour

    • Optional resetAgeOnCheck?: boolean

      If true, the TTL time on a cached permission will be reset any time it is accessed. Defaults to false

    • Optional maxCacheSize?: number

      The maximum number of items allowed in the cache. We use a first in first out cache, so when the number of items exceeds the max, the oldest values are pushed out. Defaults to 5000

  • Optional annotationSyncSettings?: { unknownUserStrategy?: AnnotationSyncUnknownUserStrategy }

    Settings for the annotation sync feature

    • Optional unknownUserStrategy?: AnnotationSyncUnknownUserStrategy

      How to handle the situation where the user ID of synced annotation is unknown / does not exist in the database. See the annotation sync feature guide for more info.

      Defaults to overriding the user ID with the current user

  • Optional disableGraphqlHomepage?: boolean

    Set to true to disable the GraphQL home page. The playground will also disable itself if NODE_ENV === 'production'.

XFDFMetadata: { type: string; pageNumber: number; properties: Record<string, string | number>; xfdf: string; color?: string }

Type declaration

  • type: string
  • pageNumber: number
  • properties: Record<string, string | number>
  • xfdf: string
  • Optional color?: string
CollabServerEmailOptions: { emailHandler?: EmailFunction; emailQueueTimer?: number; emailOnAnnotationCreated?: boolean }

Type declaration

  • Optional emailHandler?: EmailFunction
  • Optional emailQueueTimer?: number
  • Optional emailOnAnnotationCreated?: boolean
EmailFunction: (type: Email, data: InviteEmailData | MessageEmailData, context: CustomContext) => Promise<void>

Type declaration

InviteEmailData: { documentName: string; documentId: string; usersInvited: InvitedUserInput[]; sentBy: string; sendTo: string[]; context: CustomContext }

Type declaration

  • documentName: string
  • documentId: string
  • usersInvited: InvitedUserInput[]
  • sentBy: string
  • sendTo: string[]
  • context: CustomContext
MessageEmailData: { messages: Omit<MessageData, "sendTo">[]; sendTo: string }

Type declaration

  • messages: Omit<MessageData, "sendTo">[]
  • sendTo: string
VerifyPassword: (email: string, password: string, context: CustomContext) => Promise<boolean> | boolean

Type declaration

    • (email: string, password: string, context: CustomContext): Promise<boolean> | boolean
    • A function that validates a users email and password.

      For more information on context, see this guide

      Parameters

      • email: string
      • password: string
      • context: CustomContext

      Returns Promise<boolean> | boolean

PermissionSetting: { document: Omit<EntityPermissions, "restore">; annotation: Omit<EntityPermissions, "invite" | "restore">; snapshot: Omit<EntityPermissions, "invite"> }

Type declaration

UserPermissionSetting: { document?: Roles | EntityPermissions; annotation?: Roles | EntityPermissions; snapshot?: Roles | EntityPermissions }

Type declaration

EntityPermissions: { read?: AuthMethod | AuthMethod[]; invite?: AuthMethod | AuthMethod[]; edit?: AuthMethod | AuthMethod[]; delete?: AuthMethod | AuthMethod[]; add?: AuthMethod | AuthMethod[]; restore?: AuthMethod | AuthMethod[] }

Type declaration

AuthMethod: Roles | AuthorizeFunction
AuthorizeFunction: (entity: any, userId: string, context: CustomContext) => Promise<boolean>

Type declaration

    • (entity: any, userId: string, context: CustomContext): Promise<boolean>
    • Parameters

      • entity: any
      • userId: string
      • context: CustomContext

      Returns Promise<boolean>

UnknownInviteCustomStrategy: (email: string) => Promise<null | string>

Type declaration

    • (email: string): Promise<null | string>
    • Parameters

      • email: string

      Returns Promise<null | string>

EmailServiceOptions: { sendGrid: typeof sgMail; emailServiceApiKey: string; emailSender: string; senderName?: string; templateId?: { message: string; invite: string }; getTemplateData?: any }

Type declaration

  • sendGrid: typeof sgMail

    A reference to '@sendgrid/mail'

  • emailServiceApiKey: string

    Your sendgrid API key

  • emailSender: string

    The email address or domain you verified from your email service

  • Optional senderName?: string

    The name of the sender

  • Optional templateId?: { message: string; invite: string }

    Sendgrid template Ids for each email type

    • message: string
    • invite: string
  • getTemplateData?:function

Functions

  • Gets metadata about an XFDF string

    Parameters

    • xfdf: string

    Returns XFDFMetadata[]

Variables

Permissions: { Roles: typeof Roles; Actions: typeof Actions; Entities: typeof Entities } = ...

Type declaration

Generated using TypeDoc