Files
Tom Moor d29bd1c788 feat: Flatten collaborative state of large documents
Replace edit history in large collaborative state with fresh state once a
document is idle with no open sessions, and when state is over the maximum
length on save. Each replacement increments a state generation that is part of
the collaboration room name, so old state never merges into the new state.
2026-11-13 22:52:37 -05:00

72 lines
1.7 KiB
TypeScript

/**
* The server is terminating the connection because a data frame was received
* that is too large.
* See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code
*/
export const DocumentTooLarge = {
code: 1009,
reason: "Document Too Large",
};
/**
* Similar to AuthorizationFailed, but specifically for use when authentication is required and has
* failed or has not yet been provided.
*/
export const AuthenticationFailed = {
code: 4401,
reason: "Authentication Failed",
};
/**
* The request contained valid data and was understood by the server, but the server
* is refusing action.
*/
export const AuthorizationFailed = {
code: 4403,
reason: "Authorization Failed",
};
/**
* The access the user was granted may have changed and must be established
* again. The client is expected to reconnect, at which point it is either
* authorized as normal or refused with `AuthorizationFailed`.
*/
export const AuthorizationChanged = {
code: 4205,
reason: "Authorization Changed",
};
/**
* The server is refusing to process the request because there are too many connections
* to the given document.
*/
export const TooManyConnections = {
code: 4503,
reason: "Too Many Connections",
};
/**
* The client must update their editor to continue collaborating.
*/
export const EditorUpdateError = {
code: 4999,
reason: "Editor Update Required",
};
/**
* The server timed out waiting for the request.
*/
export const ConnectionTimeout = {
code: 4408,
reason: "Connection Timeout",
};
/**
* The collaborative state of the document was replaced. The client must
* discard its local copy and connect to the new state generation.
*/
export const DocumentReset = {
code: 4409,
reason: "Document Reset",
};