@bitrix24/b24jssdk
Version:
Bitrix24 REST API JavaScript SDK
70 lines (67 loc) • 1.97 kB
JavaScript
/**
* @package @bitrix24/b24jssdk
* @version 1.1.0
* @copyright (c) 2026 Bitrix24
* @license MIT
* @see https://github.com/bitrix24/b24jssdk
* @see https://bitrix24.github.io/b24jssdk/
*/
import { SdkError } from '../../sdk-error.mjs';
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
class AbstractInteractionBatch {
static {
__name(this, "AbstractInteractionBatch");
}
parallelDefaultValue;
requestId;
restrictionManager;
// @memo this regeneration -> isObjectMode
processingStrategy;
_commands = [];
constructor(options) {
this.parallelDefaultValue = options.parallelDefaultValue;
this.requestId = options.requestId;
this.restrictionManager = options.restrictionManager;
this.processingStrategy = options.processingStrategy;
}
// region Setter Strategy ////
setProcessingStrategy(processingStrategy) {
this.processingStrategy = processingStrategy;
}
// endregion ////
// region Getter ////
get size() {
return this._commands.length;
}
get maxSize() {
return 0;
}
// endregion ////
// region Request ////
addCommands(calls) {
if (!this.processingStrategy) {
throw new SdkError({
code: "JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",
description: "ProcessingStrategy not set",
status: 500
});
}
this._commands = this.processingStrategy.prepareCommands(calls, {
parallelDefaultValue: this.parallelDefaultValue
});
}
getCommandsForCall() {
if (!this.processingStrategy) {
throw new SdkError({
code: "JSSDK_INTERACTION_BATCH_EMPTY_PROCESSING_STRATEGY",
description: "ProcessingStrategy not set",
status: 500
});
}
return this.processingStrategy.buildCommands(this._commands);
}
// endregion ////
}
export { AbstractInteractionBatch };
//# sourceMappingURL=abstract-interaction-batch.mjs.map