# Changelog ## [Unreleased] ### Added * **types:** new exported request-side filter/params types — `TypeFilterV2` (the `restApi:v2` prefix-operator object), `TypeFilterV3` (the `restApi:v3` array of triples / `FilterV3` builder groups), and the per-version `TypeCallParamsV2` / `TypeCallParamsV3`. The v2/v3 `call` / `callList` / `fetchList` / `callTail` / `fetchTail` / `aggregate` action options now type their `filter`, so a wrong-dialect filter is flagged in the IDE. Backward compatible — the permissive index signature is retained and v3 still accepts a v2-style object filter (#153). ### Changed * **types:** `TypeHttp.ajaxClient` is now `AxiosInstance` instead of `AxiosInstance | any` (the union erased the type) (#153). ### Docs * Filled the `@todo docs` JSDoc placeholders across the public surface — actions (v2/v3), the HTTP transports, `AjaxResult`, the limiter stack, the `B24Hook` / `B24Frame` / `B24OAuth` entry points, tools, and public types (#154). ### Deprecations * The legacy REST surface — the `AbstractB24` shortcuts (`callMethod`, `callListMethod`, `fetchListMethod`, `callBatch`, `callBatchByChunk`) and the `batchSize` const, the `AjaxResult` paging helpers (`isMore` / `hasMore` / `getNext` / `fetchNext` / `getTotal`), and `LoggerBrowser` / `LoggerType` — remains available in `2.x` (it works and emits a runtime deprecation warning) and is **scheduled for removal in `3.0.0`** (was previously mislabelled for `2.0.0`). Migrate to `b24.actions.v{2,3}.*.make(...)`, the list helpers, and `LoggerFactory` — see the [v2 → v3 migration guide](https://bitrix24.github.io/b24jssdk/docs/getting-started/migration/v3/). Tracked in #277. ## [2.0.0](https://github.com/bitrix24/b24jssdk/compare/v1.3.0...v2.0.0) (2026-06-27) ### ⚠ BREAKING CHANGES * **v3:** `actions.v3.call` / `actions.v3.batch` no longer pre-flight-throw `JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3` for methods that were not on the (now-removed) hardcoded v3 allowlist. An unknown v3 method now comes back as a `METHODNOTFOUNDEXCEPTION` **soft error** on the `AjaxResult` (`response.isSuccess === false`) instead of a thrown `SdkError`. Code that caught that `SdkError` must switch to checking `response.isSuccess` / `response.getErrorMessages()`. * **v3:** `versionManager.isSupport()` now always returns `true`, and `automaticallyObtainApiVersion()` / `automaticallyObtainApiVersionForBatch()` now always return `v2` (version auto-detection no longer routes to v3 — v3 is opt-in only via the explicit `actions.v3.*` surface). `actions.v2.call` no longer logs the `JSSDK_CORE_METHOD_AVAILABLE_IN_API_V3` migration warning. * **batch:** an **array-mode** batch (`actions.v{2,3}.batch.make([...])`) now keys each per-command error by its **numeric position** (`'0'`, `'1'`, …) in `Result.getErrorsByKey()` / `getErrorMessagesByKey()`, instead of a random UUID — so you can tell *which* command failed, matching object/named-command mode. This surfaces on the **v2** path, which reports per-command errors (`result_error`); v3 batch is all-or-nothing (a failure becomes a single envelope soft error), so the v3 strategy is aligned for symmetry but has no per-index error to key today. Behaviour change: code that read the old UUID keys from an array batch now sees position strings (unlikely to be relied on — the old keys were random). Object/named batches (keyed by label), the envelope-level `base-error` key, and `addErrors()` (UUID) are unchanged (#255) ### Features * **batch:** new `BatchRefV3` helper (`ref` / `refArray`) for the v3 batch `$ref` / `$refArray` cross-command substitution markers (reference §8). The server performs the substitution; the helper builds the marker objects to drop into a later command's `params`/`query` (validated client-side — `refArray` requires a dotted `alias.field` path). Reference an earlier command by its `as` alias. Verified live: a `tasks.task.list as tasks` step followed by a `filter: [['id', 'in', BatchRefV3.refArray('tasks.id')]]` step had the server substitute the collected ids. `import { BatchRefV3 } from '@bitrix24/b24jssdk'` * **v3:** new `actions.v3.aggregate` action for the v3 `aggregate` action (reference §7): pass a `select` of `sum`/`avg`/`min`/`max`/`count`/`countDistinct` (list form `['amount']` or alias map `{ amount: 'totalAmount' }`) plus an optional `filter`; it returns the response buckets (`{ sum: { amount: 12345 }, count: { id: 87 } }`, keyed by function then field). Validates the function set client-side. Call it via `$b24.actions.v3.aggregate.make(...)`, and pair `FilterV3` to build the `filter`. **`@experimental`** — spec-based, not yet verified against a live portal, as no module on the reference test portal exposes an `*.aggregate` endpoint; the wire shape may change once verified. * **filter:** new `FilterV3` typed builder for the REST API v3 filter grammar (array-of-triples with AND/OR/NOT groups, §3). Exposes `eq`/`ne`/`gt`/`ge`/`lt`/`le`/`in`/`between` leaf helpers, `and`/`or`/`not` combinators, and `build(...)` to assemble the top-level (AND-joined) `params.filter` array — skipping falsy nodes so conditionals inline cleanly. Validates the operator set and the `in`/node shapes on the client (a bad operator or a malformed `build()` node fails fast instead of as a server `UNKNOWNFILTEROPERATOREXCEPTION`; the `between` signature makes a malformed range unrepresentable). Verified live against a v3 portal. `import { FilterV3 } from '@bitrix24/b24jssdk'` * **v3:** the SDK no longer keeps a hardcoded v3 method allowlist (`version-manager` `#supportMethods`). `actions.v3.call` / `actions.v3.batch` now send any method to the v3 endpoint and the server validates it — an unknown v3 method comes back as a `METHODNOTFOUNDEXCEPTION` **soft error** on the `AjaxResult` instead of the SDK pre-flight-throwing `JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3`. The portal's OpenAPI (`rest.documentation.openapi`) exposed far more v3 methods than the static list (e.g. `note.*`, `rest.application.*`), and the list both lagged the server and blocked valid methods. Behaviour changes: `actions.v3.*` no longer throws for off-list methods; `actions.v2.call` no longer logs the `JSSDK_CORE_METHOD_AVAILABLE_IN_API_V3` migration warning; `versionManager.isSupport()` always returns `true` and `automaticallyObtainApiVersion()` defaults to v2 (v3 is opt-in via the explicit `actions.v3.*` surface). `AjaxResult.getNext()` still throws `JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3` for v3 clients — it cannot page a v3 envelope; use `callList` / `fetchList` instead. * **v3:** new `actions.v3.fetchTail` / `actions.v3.callTail` helpers drive the native v3 `tail` (keyset cursor) action with its `cursor: { field, value, order, limit }` parameter, instead of emulating a cursor on top of `list` by injecting a `[field, '>', n]` filter. `fetchTail` streams pages (async generator); `callTail` returns every record as one array. The cursor field is auto-added to `select` and must not appear in `filter` (the helper warns). Same page-cap-tolerant stop as the list helpers (#253) * **v3:** `tasks.task.list` is now routed through `actions.v3.*` (`call` / `callList` / `fetchList` / `batch`) instead of falling back to v2. On v3 it is a standard all-lowercase list method, so with the list helpers use `idKey: 'id'` (the default) and `customKeyForResult: 'items'` — no `cursorIdKey` override (that is only needed on the v2 endpoint, which sorts by `ID` but returns `id`). A `list tasks` CLI playground command demonstrates the v3 fetch. Verified end-to-end against a live portal (#253) * **package:** add CommonJS support so the package can be consumed with `require('@bitrix24/b24jssdk')` (and from `tsx`-driven Node projects), in addition to ESM and UMD — previously a CommonJS / non-`import` resolver failed with `ERR_PACKAGE_PATH_NOT_EXPORTED`. `exports` now carries `require`/`default` conditions (with CJS-flavored `.d.cts` types), the build emits `dist/umd/package.json` (`{"type":"commonjs"}`) and `dist/umd/index.d.cts`, and `main` points at the UMD/CJS entry while `module` stays on ESM. ESM remains the recommended entry point; the CommonJS path resolves to the UMD bundle, which inlines its dependencies (a dedicated CJS build with external deps is planned). Verified end-to-end (`require`, `import`, `tsx`, TypeScript `node16`/`nodenext`/`bundler`, `publint`, `@arethetypeswrong/cli`) (#256) * **build:** ship a **first-class CommonJS build** (`dist/cjs/*.cjs` + `index.d.cts`) with dependencies kept **external** (`require('axios')` / `'luxon'` / `'qs-esm'`), and point the `require` / `main` entry at it instead of the UMD bundle. Previously `require('@bitrix24/b24jssdk')` resolved to the browser UMD bundle, which **inlines** its dependencies (~1.1 MB) and ships a single flat module; the new CJS build mirrors the ESM module structure, dedupes deps against the consumer's own `axios`/`luxon`, and is far smaller (~9 KB entry). The UMD bundle stays the browser `