@bitrix24/b24jssdk
Version:
Bitrix24 REST API JavaScript SDK
53 lines (50 loc) • 1.79 kB
JavaScript
/**
* @package @bitrix24/b24jssdk
* @version 2.0.0
* @copyright (c) 2026 Bitrix24
* @license MIT
* @see https://github.com/bitrix24/b24jssdk
* @see https://bitrix24.github.io/b24jssdk/
*/
import { SdkError } from '../core/sdk-error.mjs';
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
function assertPath(path, who) {
if (typeof path !== "string" || path.length === 0) {
throw new SdkError({
code: "JSSDK_BATCH_REF_V3_INVALID_PATH",
description: `${who}: path must be a non-empty dotted string (e.g. "tasks.id").`,
status: 400
});
}
}
__name(assertPath, "assertPath");
const BatchRefV3 = Object.freeze({
/**
* `{ $ref: path }` — substitute a single value from context, e.g.
* `ref('newTask.item.id')`. `add` → id / `update` → bool results are NOT in
* context (reference §8); only `item` (get) and `items` (list/tail) are.
*/
ref(path) {
assertPath(path, "BatchRefV3.ref");
return { $ref: path };
},
/**
* `{ $refArray: path }` — collect one field across the `items[]` of an earlier
* list/tail command, e.g. `refArray('tasks.id')`. The path MUST contain a dot
* (`alias.field`); the server rejects a dot-less path with INVALIDSELECTEXCEPTION.
*/
refArray(path) {
assertPath(path, "BatchRefV3.refArray");
if (!path.includes(".")) {
throw new SdkError({
code: "JSSDK_BATCH_REF_V3_INVALID_REF_ARRAY",
description: `BatchRefV3.refArray: path "${path}" must contain a dot ("alias.field") \u2014 the server collects <field> across the alias's items[].`,
status: 400
});
}
return { $refArray: path };
}
});
export { BatchRefV3 };
//# sourceMappingURL=batch-ref-v3.mjs.map