Skip to content

@fabwcie/free-drawing / @types/collaboration

@types/collaboration ​

Type Aliases ​

AccessRequest ​

AccessRequest = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:252

Viewer asking the owner for the right to draw, waiting for its answer

Properties ​

name ​

name: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:256

Name of the user

userId ​

userId: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:254

Id of the user


ChangeAcknowledgement ​

ChangeAcknowledgement = { refused?: unknown; } | null | undefined

Defined in: packages/free-drawing/src/@types/collaboration.ts:102

Answer of the server acknowledging a change: none once received (applied, or refused by REJECTED), refused when it was dropped beyond the rate of messages of the client (not applied, sent again); anything from servers (not trusted)


ChangePart ​

ChangePart = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:91

Part of a change cut into messages small enough for the server

Properties ​

change ​

change: DrawingChange

Defined in: packages/free-drawing/src/@types/collaboration.ts:93

Message to send

ids ​

ids: string[]

Defined in: packages/free-drawing/src/@types/collaboration.ts:95

Ids of its shapes (upsert), marked synced once it is sent


CollaborationMember ​

CollaborationMember = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:49

User of a room (sent by server): owner (created the room) gives or removes the right to draw

Properties ​

canEdit ​

canEdit: boolean

Defined in: packages/free-drawing/src/@types/collaboration.ts:57

Can draw (right given by the owner), else views only

id ​

id: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:51

Id of the user (account id of a logged in user)

invitedBy? ​

optional invitedBy?: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:59

Name of user who shared the link used to join

name ​

name: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:53

Name shown to other users

owner ​

owner: boolean

Defined in: packages/free-drawing/src/@types/collaboration.ts:55

Created the room: gives or removes the right to draw


CollaborationOptions ​

CollaborationOptions = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:9

Collaboration server and data sent on connection (collaboration option of the drawer)

Properties ​

auth? ​

optional auth?: Record<string, unknown> | ((callback) => void)

Defined in: packages/free-drawing/src/@types/collaboration.ts:13

Data read by server on connection (socket.handshake.auth, e.g. token of logged in user), or function giving it on each connection

encrypt? ​

optional encrypt?: boolean

Defined in: packages/free-drawing/src/@types/collaboration.ts:18

End-to-end encryption of new rooms (default true): their key is in the # of their links, the server keeps and relays the drawing without reading it; false creates rooms in clear (server reading drawings)

url? ​

optional url?: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:11

Server url, page origin by default


CollaborationSession ​

CollaborationSession = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:24

Session of a Collaboration: room to join and identity of this user

Properties ​

cipher? ​

optional cipher?: RoomCipher

Defined in: packages/free-drawing/src/@types/collaboration.ts:38

Encryption with the key of an encrypted room (#key= of its links), none for a room in clear

invitedBy? ​

optional invitedBy?: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:36

Id of user who shared the link used to join

name ​

name: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:28

Name shown to other users

ownerKey? ​

optional ownerKey?: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:34

Secret of owner of the room, given when the room is created

room ​

room: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:26

Id of the room (#room= of links)

userId? ​

optional userId?: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:30

User id, kept between sessions (rights)

userKey? ​

optional userKey?: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:32

Secret of the browser of the user, sent with its id: the server gives this id to this browser only


CollaborationSocket ​

CollaborationSocket = Pick<Socket, "on" | "once" | "emit" | "disconnect" | "volatile">

Defined in: packages/free-drawing/src/@types/collaboration.ts:44

Part of a socket.io client socket used by collaboration (connected by the drawer, replaced by fakes in tests)


DecryptedChange ​

DecryptedChange = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:166

Change of an encrypted room once decrypted

Properties ​

change ​

change: DrawingChange

Defined in: packages/free-drawing/src/@types/collaboration.ts:168

Change as in a room in clear, without the parts not decrypted

failed ​

failed: number

Defined in: packages/free-drawing/src/@types/collaboration.ts:170

Parts not decrypted (shapes, files, background): encrypted with another key, or changed


DrawingChange ​

DrawingChange = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:67

Drawing change sent to other clients: shapes added or updated (konva JSON), ids of removed shapes, order: ids of all shapes from bottom to top when stacking order changed, live: preview of shapes being drawn or moved (final change follows)

Properties ​

background? ​

optional background?: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:85

Background color of the drawing, when changed (whole drawing: background of the room, none before a user sends it)

files? ​

optional files?: DrawingFiles

Defined in: packages/free-drawing/src/@types/collaboration.ts:87

Image files not sent yet, used by the shapes (whole drawing: files of the room)

full? ​

optional full?: boolean

Defined in: packages/free-drawing/src/@types/collaboration.ts:77

Whole drawing of the room, sent by the server to a joining user (also empty)

kept? ​

optional kept?: boolean

Defined in: packages/free-drawing/src/@types/collaboration.ts:83

Whole drawing kept by the room since users sent a final change: an empty one was emptied by them; false for a room without drawing (new, last user gone, server restarted; previews of shapes being drawn only), none from servers of previous versions (an empty room has no drawing): joining users send theirs

live? ​

optional live?: boolean

Defined in: packages/free-drawing/src/@types/collaboration.ts:75

Preview of shapes being drawn or moved: applied without history, the final change follows

order? ​

optional order?: string[]

Defined in: packages/free-drawing/src/@types/collaboration.ts:73

Ids of all shapes from bottom to top, only when stacking order changed

remove ​

remove: string[]

Defined in: packages/free-drawing/src/@types/collaboration.ts:71

Ids of removed shapes

upsert ​

upsert: string[]

Defined in: packages/free-drawing/src/@types/collaboration.ts:69

Shapes added or updated: konva JSON of top nodes (groups with their shapes)


EncryptedChange ​

EncryptedChange = Omit<DrawingChange, "upsert" | "background" | "files"> & object

Defined in: packages/free-drawing/src/@types/collaboration.ts:156

Drawing change of an encrypted room (CHANGE): ids of shapes and flags in clear, shapes, image files and background encrypted

Type Declaration

background?

optional background?: string

Background color, encrypted

files?

optional files?: Record<string, string>

Image files, each one encrypted with its id, under a random id (the server can't tell which image it is)

upsert

upsert: EncryptedShape[]

Shapes added or updated, encrypted


EncryptedMessage ​

EncryptedMessage = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:174

Pointer position or view of an encrypted room (POINTER, VIEW): its JSON encrypted

Properties ​

data ​

data: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:176

JSON of the message, encrypted


EncryptedShape ​

EncryptedShape = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:140

Shape of an encrypted room: id in clear (the server keeps the drawing shape by shape), konva JSON encrypted

Properties ​

data ​

data: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:144

Konva JSON of the shape, encrypted (see RoomCipher.encrypt)

files? ​

optional files?: string[]

Defined in: packages/free-drawing/src/@types/collaboration.ts:149

Ids of the image files it uses, as sent in the room (RoomCipher.fileId): the server releases the files of no shape (none from previous versions)

id ​

id: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:142

Id of the shape


JoinedMessage ​

JoinedMessage = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:200

Room joined (JOINED, sent by the server to the joining user), checked on reception

Properties ​

acknowledges? ​

optional acknowledges?: unknown

Defined in: packages/free-drawing/src/@types/collaboration.ts:204

Server acknowledging changes (servers of previous versions: missing)

userId? ​

optional userId?: unknown

Defined in: packages/free-drawing/src/@types/collaboration.ts:202

Id given to this user (account of a logged in user)


PointerPosition ​

PointerPosition = Vector2d & object

Defined in: packages/free-drawing/src/@types/collaboration.ts:182

Position of a pointer in the drawing, sent to other users with the laser while it is pressed

Type Declaration

laser?

optional laser?: boolean

Laser pressed: trail of the color of the user follows the pointer


PresentedView ​

PresentedView = ViewArea & object

Defined in: packages/free-drawing/src/@types/collaboration.ts:246

View presented by the owner (VIEW): area of its view, or of the slide (frame) it shows during a slideshow, which other users see alone (around it masked)

Type Declaration

slide?

optional slide?: boolean

Area of a slide: a frame presented, shown alone


RejectedMessage ​

RejectedMessage = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:216

Message of this user refused by the server (REJECTED), checked on reception

Properties ​

event? ​

optional event?: unknown

Defined in: packages/free-drawing/src/@types/collaboration.ts:218

Event of the refused message (JOIN, CHANGE)

reason? ​

optional reason?: unknown

Defined in: packages/free-drawing/src/@types/collaboration.ts:223

full: room full, too-big: drawing too big, right: change of a user without right to draw, key: key of the encrypted room missing or wrong

remove? ​

optional remove?: unknown

Defined in: packages/free-drawing/src/@types/collaboration.ts:227

Refused change: ids of its removed shapes

upsert? ​

optional upsert?: unknown

Defined in: packages/free-drawing/src/@types/collaboration.ts:225

Refused change: ids of its shapes added or updated (servers of previous versions: none)


RemotePointer ​

RemotePointer = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:188

Pointer of another user: position in drawing (null out of drawer), laser used

Properties ​

data? ​

optional data?: unknown

Defined in: packages/free-drawing/src/@types/collaboration.ts:196

Position encrypted (PointerPosition or null), in an encrypted room

id ​

id: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:190

Id of the user, identifies their cursor and laser trail

name? ​

optional name?: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:192

Name shown in their cursor (anonymous when empty)

position? ​

optional position?: PointerPosition | null

Defined in: packages/free-drawing/src/@types/collaboration.ts:194

Position in drawing, null when the pointer left the drawer (cursor hidden); missing in an encrypted room


RequestMessage ​

RequestMessage = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:263

Request of the right to draw (REQUEST): sent by the server to the owner (user asking), to the user when it is refused; checked on reception

Properties ​

accepted? ​

optional accepted?: unknown

Defined in: packages/free-drawing/src/@types/collaboration.ts:269

Answer of the owner: false when refused

name? ​

optional name?: unknown

Defined in: packages/free-drawing/src/@types/collaboration.ts:267

Name of the user asking

userId? ​

optional userId?: unknown

Defined in: packages/free-drawing/src/@types/collaboration.ts:265

Id of the user asking


RoomMessage ​

RoomMessage = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:208

Settings of the room (ROOM, sent by the server on join and change), checked on reception

Properties ​

encrypted? ​

optional encrypted?: unknown

Defined in: packages/free-drawing/src/@types/collaboration.ts:212

The room is encrypted end to end (servers of previous versions: none)

newUsersCanEdit? ​

optional newUsersCanEdit?: unknown

Defined in: packages/free-drawing/src/@types/collaboration.ts:210

Users coming for the first time can draw, else they view only


ShapeMerge ​

ShapeMerge = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:126

Group or frame changed here and by another user (collaboration): changes of both merged, see mergeState

Properties ​

base ​

base: ShapeState

Defined in: packages/free-drawing/src/@types/collaboration.ts:134

State known by the room before both changes

local ​

local: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:132

JSON of the shape here before the merge

state ​

state: ShapeState

Defined in: packages/free-drawing/src/@types/collaboration.ts:128

State applied: the change of this user over the one of the other user

synced ​

synced: string

Defined in: packages/free-drawing/src/@types/collaboration.ts:130

JSON known by the room once applied: the merge is sent next unless the room has it

theirs ​

theirs: ShapeState

Defined in: packages/free-drawing/src/@types/collaboration.ts:136

State of the other user (checked)


UnconfirmedPart ​

UnconfirmedPart = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:108

Part of a change sent, not acknowledged by the server yet: what it made known by the room, unsynced when the connection is lost (sent again once joined)

Properties ​

at ​

at: number

Defined in: packages/free-drawing/src/@types/collaboration.ts:120

Time it was sent (ms)

background ​

background: boolean

Defined in: packages/free-drawing/src/@types/collaboration.ts:116

Background color sent

before ​

before: Map<string, string>

Defined in: packages/free-drawing/src/@types/collaboration.ts:122

JSON known by the room before it of its shapes, by id: groups and frames changed meanwhile by others are merged

files ​

files: string[]

Defined in: packages/free-drawing/src/@types/collaboration.ts:114

Ids of its image files

order ​

order: boolean

Defined in: packages/free-drawing/src/@types/collaboration.ts:118

Stacking order sent

remove ​

remove: string[]

Defined in: packages/free-drawing/src/@types/collaboration.ts:112

Ids of its removed shapes

upsert ​

upsert: string[]

Defined in: packages/free-drawing/src/@types/collaboration.ts:110

Ids of its shapes added or updated


ViewArea ​

ViewArea = object

Defined in: packages/free-drawing/src/@types/collaboration.ts:231

Area of the drawing, in drawing coordinates: view presented by the owner (VIEW), see Drawer.getViewArea

Properties ​

height ​

height: number

Defined in: packages/free-drawing/src/@types/collaboration.ts:239

Height of the area

width ​

width: number

Defined in: packages/free-drawing/src/@types/collaboration.ts:237

Width of the area

x ​

x: number

Defined in: packages/free-drawing/src/@types/collaboration.ts:233

Left of the area

y ​

y: number

Defined in: packages/free-drawing/src/@types/collaboration.ts:235

Top of the area