@bitrix24/b24jssdk
Version:
Bitrix24 REST API JavaScript SDK
122 lines (120 loc) • 2.52 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/
*/
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
class ParamsFactory {
static {
__name(this, "ParamsFactory");
}
/**
* Default parameters for regular tariffs
*
* @see Http.#restrictionParams
*/
static getDefault() {
return {
rateLimit: {
burstLimit: 50,
drainRate: 2,
adaptiveEnabled: true
},
operatingLimit: {
windowMs: 6e5,
// 10 min
limitMs: 48e4,
// 480 sec
heavyPercent: 80
},
adaptiveConfig: {
enabled: true,
thresholdPercent: 80,
coefficient: 0.01,
maxDelay: 7e3
},
maxRetries: 3,
retryDelay: 1e3
};
}
/**
* Parameters for the Enterprise plan
*/
static getEnterprise() {
return {
...this.getDefault(),
rateLimit: {
burstLimit: 250,
drainRate: 5,
adaptiveEnabled: true
}
};
}
/**
* Parameters for bulk data processing
*/
static getBatchProcessing() {
return {
...this.getDefault(),
rateLimit: {
burstLimit: 30,
drainRate: 1,
adaptiveEnabled: true
},
operatingLimit: {
windowMs: 6e5,
limitMs: 48e4,
heavyPercent: 50
// Higher threshold for notifications
},
adaptiveConfig: {
enabled: true,
thresholdPercent: 50,
// More threshold
coefficient: 0.015,
// More pause
maxDelay: 1e4
// Max 10 seconds
},
maxRetries: 5
// More attempts
};
}
/**
* Real-time parameters
*/
static getRealtime() {
return {
...this.getDefault(),
adaptiveConfig: {
enabled: false,
// Off
thresholdPercent: 100,
coefficient: 1e-3,
maxDelay: 48e4
},
maxRetries: 1
};
}
/**
* Tariff plan based parameters
*/
static fromTariffPlan(plan) {
switch (plan.toLowerCase()) {
case "enterprise":
return this.getEnterprise();
case "company":
case "start":
case "standard":
case "basic":
default:
return this.getDefault();
}
}
}
export { ParamsFactory };
//# sourceMappingURL=params-factory.mjs.map