UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

77 lines (76 loc) 1.98 kB
export declare enum SESSION { /** * Session ID which is reserved by the JSON CRDT Patch protocol for internal * usage. This session ID cannot be used by users when editing the documents. */ SYSTEM = 0, /** * The only valid session ID for CRDT ran in the server clock mode. */ SERVER = 1, /** * Use this session ID when you want to apply a patch globally, without * attributing it to any specific user. For example, when the initial document * is created, the default patch can be applied on all clients to result in * the same initial state on all clients. * * @todo Rename or alias this to `SCHEMA`. */ GLOBAL = 2, /** * Session ID used for models that are not shared with other users. For * example, when a user is editing a document in a local editor, these * documents could capture local information, like the cursor position, which * is not shared with other users. */ LOCAL = 3, /** Max allowed session ID, they are capped at 53-bits. */ MAX = 9007199254740991 } export declare enum SYSTEM_SESSION_TIME { ORIGIN = 0, UNDEFINED = 1 } export declare enum JsonCrdtDataType { con = 0, val = 1, obj = 2, vec = 3, str = 4, bin = 5, arr = 6 } export declare enum JsonCrdtPatchOpcode { new_con = 0,// 0 new_val = 1,// 1 new_obj = 2,// 2 new_vec = 3,// 3 new_str = 4,// 4 new_bin = 5,// 5 new_arr = 6,// 6 ins_val = 9,// 9 ins_obj = 10,// 10 ins_vec = 11,// 11 ins_str = 12,// 12 ins_bin = 13,// 13 ins_arr = 14,// 14 del = 16,// 16 nop = 17 } export declare enum JsonCrdtPatchOpcodeOverlay { new_con = 0, new_val = 8, new_obj = 16, new_vec = 24, new_str = 32, new_bin = 40, new_arr = 48, ins_val = 72, ins_obj = 80, ins_vec = 88, ins_str = 96, ins_bin = 104, ins_arr = 112, del = 128, nop = 136 }