@azure/cosmos
Version:
Microsoft Azure Cosmos DB Service Node.js SDK for NOSQL API
26 lines • 1.05 kB
JavaScript
;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseContinuationTokenFields = parseContinuationTokenFields;
/**
* Parses a continuation token string to extract specific fields without full deserialization
* Supports both CompositeQueryContinuationToken and OrderByQueryContinuationToken formats
* @param continuationToken - The continuation token string to parse
* @returns Object containing offset, limit, and hashedLastResult if present
* @internal
*/
function parseContinuationTokenFields(continuationToken) {
try {
const parsed = JSON.parse(continuationToken);
return {
offset: parsed.offset,
limit: parsed.limit,
hashedLastResult: parsed.hashedLastResult,
};
}
catch (error) {
throw new Error(`Failed to parse continuation token: ${error instanceof Error ? error.message : String(error)}`);
}
}
//# sourceMappingURL=ContinuationTokenParser.js.map