@azure/cosmos
Version:
Microsoft Azure Cosmos DB Service Node.js SDK for NOSQL API
23 lines • 915 B
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* 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
*/
export 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