@bitrix24/b24jssdk
Version:
Bitrix24 REST API JavaScript SDK
53 lines (50 loc) • 1.99 kB
JavaScript
/**
* @package @bitrix24/b24jssdk
* @version 2.2.0
* @copyright (c) 2026 Bitrix24
* @license MIT
* @see https://github.com/bitrix24/b24jssdk
* @see https://bitrix24.github.io/b24jssdk/
*/
;
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
class AbstractAction {
static {
__name(this, "AbstractAction");
}
_b24;
_logger;
constructor(b24, logger) {
this._b24 = b24;
this._logger = logger;
}
/**
* Warns when an option that belongs inside a nested bag was passed at the top
* level, where it is read by nobody.
*
* The action option types no longer carry an index signature, so a TypeScript
* caller writing an object literal gets a compile error instead. This covers
* everyone else: JavaScript callers, a literal widened through a variable, and
* anything crossing a `JSON.parse` boundary. Without it the call simply
* behaves as though the flag were never set — and a dropped
* `returnAjaxResult` turns a batch where every command succeeded into one that
* reads as wholly failed, because `isSuccess` on a raw payload is `undefined`
* (#426).
*
* @param options the argument as received
* @param nestedKeys names that belong in the nested bag
* @param nestedName the bag they belong in, for the message
*/
_warnMisplacedOptions(options, nestedKeys, nestedName) {
if (!options) return;
const misplaced = nestedKeys.filter((key) => Object.hasOwn(options, key));
if (misplaced.length === 0) return;
this._logger.warning(
`[b24jssdk] ${misplaced.join(", ")} passed at the top level ${misplaced.length === 1 ? "is" : "are"} ignored \u2014 ${misplaced.length === 1 ? "it belongs" : "they belong"} in \`${nestedName}\`. Write \`${nestedName}: { ${misplaced.join(", ")} }\`.`
).catch(() => {
});
}
}
exports.AbstractAction = AbstractAction;
//# sourceMappingURL=abstract-action.cjs.map