Skip to content

Commit

Permalink
OData $skiptoken: add inline docs (#1217)
Browse files Browse the repository at this point in the history
This should help explain how odata $skiptokens are defined and used in this codebase.
  • Loading branch information
alxndrsn authored Oct 8, 2024
1 parent 1f93aa4 commit 0802210
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/util/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,14 @@ class QueryOptions {
return f(this.args[arg]);
}

// Parse ODK's proprietary $skiptoken format. From OData docs:
//
// > OData services [i.e. odk-central-backend] may use the reserved system
// > query option `$skiptoken` when building next links. Its content is
// > opaque, service-specific, and must only follow the rules for URL query
// > parts.
//
// See: https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html
static parseSkiptoken(token) {
const jsonString = base64ToUtf8(token.substr(2));
return JSON.parse(jsonString);
Expand Down

0 comments on commit 0802210

Please sign in to comment.