@bitrix24/b24jssdk
Version:
Bitrix24 REST API JavaScript SDK
39 lines (35 loc) • 2.85 kB
JavaScript
/**
* @package @bitrix24/b24jssdk
* @version 3.0.0
* @copyright (c) 2026 Bitrix24
* @license MIT
* @see https://github.com/bitrix24/b24jssdk
* @see https://bitrix24.github.io/b24jssdk/
*/
;
const sdkError = require('../sdk-error.cjs');
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
function cursorStalledError(action, hint) {
return new sdkError.SdkError({
code: "JSSDK_ACTION_CURSOR_STALLED",
description: `${action}: the cursor did not move \u2014 the server answered with the same page again, so this walk can never finish. ${hint} Stopping instead of looping for ever. Note that a streaming helper (fetchList / fetchTail) has already yielded every page it read, including the repeated one, so a consumer that persisted them has to undo that.`,
status: 500
});
}
__name(cursorStalledError, "cursorStalledError");
const CURSOR_STALLED_HINT_LIST = "Check `idKey` \u2014 the id field as the response spells it \u2014 against `cursorIdKey`, the field name the request sorts and filters by. When the two differ, the page condition is written with a name the server does not match, and it is dropped: on `restApi:v2` `tasks.task.list` the response carries a lowercase `id` while the filter accepts an uppercase `ID`, so that walk needs `idKey: 'id', cursorIdKey: 'ID'`. The v3 method spells it lowercase both ways and needs no override.";
const CURSOR_STALLED_HINT_TAIL = "Check `cursorField`: it must name the field the server actually pages by, it must be readable in the response (include it in `select`), and its values must advance from page to page \u2014 a block of rows sharing one value is enough to stall the walk, so prefer a unique field. With `order: 'DESC'`, check `initialValue` too.";
function cursorWentBackwardsError(action, hint) {
return new sdkError.SdkError({
code: "JSSDK_ACTION_CURSOR_WENT_BACKWARDS",
description: `${action}: the cursor moved backwards \u2014 the server answered with a page it had already passed, so this walk can never finish. ${hint} A server that alternates between two pages produces exactly this, and the "did not move" check cannot see it: the value differs from the one just sent, it is simply one the walk had already used. Stopping instead of looping for ever. Note that a streaming helper (fetchList / fetchTail) has already yielded every page it read, so a consumer that persisted them has to undo that.`,
status: 500
});
}
__name(cursorWentBackwardsError, "cursorWentBackwardsError");
exports.CURSOR_STALLED_HINT_LIST = CURSOR_STALLED_HINT_LIST;
exports.CURSOR_STALLED_HINT_TAIL = CURSOR_STALLED_HINT_TAIL;
exports.cursorStalledError = cursorStalledError;
exports.cursorWentBackwardsError = cursorWentBackwardsError;
//# sourceMappingURL=_cursor-stalled.cjs.map