Skip to main content

Module cursor

Module cursor 

Source
Expand description

Keyset cursors (spec/surface/README.md §1.4): base64url(JSON [parts...]), one encoding for every paged surface — [path, id] for query, [path] for docs_list/docs_tree. Decoding requires exactly arity string parts; anything else is SurfaceError::cursor_invalid naming the surface.

Functions§

base64url_decode
Decode base64 or base64url, padding optional. None on a foreign byte.
base64url_encode
Unpadded base64url of bytes (Node’s Buffer#toString("base64url")).
decode_cursor
Decode a cursor issued by encode_cursor, requiring exactly arity string parts; surface names the caller for the error.
decode_path_cursor
decode_cursor for the keysets whose FIRST part is a document path (query’s [path, id], docs_list/docs_tree’s [path]). Since spec/surface 2.0 the surface speaks the reference form, so an issued cursor’s path is /-rooted; a bare path can only come from a 1.x cursor, whose keyset would sort before every rooted row and silently replay the first page — it is refused with a reason that names the cause.
encode_cursor
Encode a keyset position as an opaque cursor.