@bitrix24/b24jssdk 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/index.cjs +59 -2
- package/dist/commonjs/index.cjs.map +1 -1
- package/dist/commonjs/index.d.cts +10 -0
- package/dist/commonjs/index.d.mts +10 -0
- package/dist/commonjs/index.d.ts +10 -0
- package/dist/esm/index.d.mts +10 -0
- package/dist/esm/index.d.ts +10 -0
- package/dist/esm/index.mjs +59 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/umd/index.js +60 -3
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +14 -14
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +1 -1
package/dist/umd/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @version @bitrix24/b24jssdk v0.1.
|
|
2
|
+
* @version @bitrix24/b24jssdk v0.1.5
|
|
3
3
|
* @copyright (c) 2024 Bitrix24
|
|
4
4
|
* @licence MIT
|
|
5
5
|
* @links https://github.com/bitrix24/b24jssdk - GitHub
|
|
@@ -10761,7 +10761,7 @@
|
|
|
10761
10761
|
}
|
|
10762
10762
|
}
|
|
10763
10763
|
|
|
10764
|
-
return (
|
|
10764
|
+
return (0, JSON.stringify)(rawValue);
|
|
10765
10765
|
}
|
|
10766
10766
|
|
|
10767
10767
|
const defaults$2 = {
|
|
@@ -14035,7 +14035,10 @@
|
|
|
14035
14035
|
#restrictionManager;
|
|
14036
14036
|
#requestIdGenerator;
|
|
14037
14037
|
_logger = null;
|
|
14038
|
+
_loggerSystem = null;
|
|
14038
14039
|
#logTag = "";
|
|
14040
|
+
#isClientSideWarning = false;
|
|
14041
|
+
#clientSideWarningMessage = "";
|
|
14039
14042
|
constructor(baseURL, authActions, options) {
|
|
14040
14043
|
this.#clientAxios = axios.create({
|
|
14041
14044
|
baseURL,
|
|
@@ -14045,6 +14048,7 @@
|
|
|
14045
14048
|
this.#restrictionManager = new RestrictionManager();
|
|
14046
14049
|
this.#requestIdGenerator = new DefaultRequestIdGenerator();
|
|
14047
14050
|
}
|
|
14051
|
+
// region Logger ////
|
|
14048
14052
|
setLogger(logger) {
|
|
14049
14053
|
this._logger = logger;
|
|
14050
14054
|
this.#restrictionManager.setLogger(this.getLogger());
|
|
@@ -14063,18 +14067,38 @@
|
|
|
14063
14067
|
}
|
|
14064
14068
|
return this._logger;
|
|
14065
14069
|
}
|
|
14070
|
+
getSystemLogger() {
|
|
14071
|
+
if (null === this._loggerSystem) {
|
|
14072
|
+
this._loggerSystem = LoggerBrowser.build(`SystemLogger`);
|
|
14073
|
+
this._loggerSystem.setConfig({
|
|
14074
|
+
[LoggerType.desktop]: false,
|
|
14075
|
+
[LoggerType.log]: false,
|
|
14076
|
+
[LoggerType.info]: true,
|
|
14077
|
+
[LoggerType.warn]: true,
|
|
14078
|
+
[LoggerType.error]: true,
|
|
14079
|
+
[LoggerType.trace]: false
|
|
14080
|
+
});
|
|
14081
|
+
}
|
|
14082
|
+
return this._loggerSystem;
|
|
14083
|
+
}
|
|
14084
|
+
// endregion ////
|
|
14085
|
+
// region RestrictionManager ////
|
|
14066
14086
|
setRestrictionManagerParams(params) {
|
|
14067
14087
|
this.#restrictionManager.params = params;
|
|
14068
14088
|
}
|
|
14069
14089
|
getRestrictionManagerParams() {
|
|
14070
14090
|
return this.#restrictionManager.params;
|
|
14071
14091
|
}
|
|
14092
|
+
// endregion ////
|
|
14093
|
+
// region LogTag ////
|
|
14072
14094
|
setLogTag(logTag) {
|
|
14073
14095
|
this.#logTag = logTag;
|
|
14074
14096
|
}
|
|
14075
14097
|
clearLogTag() {
|
|
14076
14098
|
this.#logTag = "";
|
|
14077
14099
|
}
|
|
14100
|
+
// endregion ////
|
|
14101
|
+
// region Actions Call ////
|
|
14078
14102
|
async batch(calls, isHaltOnError = true) {
|
|
14079
14103
|
const isArrayMode = Array.isArray(calls);
|
|
14080
14104
|
const cmd = isArrayMode ? [] : {};
|
|
@@ -14216,6 +14240,9 @@
|
|
|
14216
14240
|
authData = await this.#authActions.refreshAuth();
|
|
14217
14241
|
}
|
|
14218
14242
|
await this.#restrictionManager.check();
|
|
14243
|
+
if (this.#isClientSideWarning && !this.isServerSide() && Type.isStringFilled(this.#clientSideWarningMessage)) {
|
|
14244
|
+
this.getSystemLogger().warn(this.#clientSideWarningMessage);
|
|
14245
|
+
}
|
|
14219
14246
|
return this.#clientAxios.post(
|
|
14220
14247
|
this.#prepareMethod(method),
|
|
14221
14248
|
this.#prepareParams(authData, params, start)
|
|
@@ -14299,6 +14326,8 @@
|
|
|
14299
14326
|
return Promise.resolve(result);
|
|
14300
14327
|
});
|
|
14301
14328
|
}
|
|
14329
|
+
// endregion ////
|
|
14330
|
+
// region Prepare ////
|
|
14302
14331
|
/**
|
|
14303
14332
|
* Processes function parameters and adds authorization
|
|
14304
14333
|
*
|
|
@@ -14314,7 +14343,7 @@
|
|
|
14314
14343
|
result.logTag = this.#logTag;
|
|
14315
14344
|
}
|
|
14316
14345
|
result[this.#requestIdGenerator.getQueryStringParameterName()] = this.#requestIdGenerator.getRequestId();
|
|
14317
|
-
result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.1.
|
|
14346
|
+
result[this.#requestIdGenerator.getQueryStringSdkParameterName()] = "0.1.5";
|
|
14318
14347
|
if (!!result.data && !!result.data.start) {
|
|
14319
14348
|
delete result.data.start;
|
|
14320
14349
|
}
|
|
@@ -14333,6 +14362,24 @@
|
|
|
14333
14362
|
#prepareMethod(method) {
|
|
14334
14363
|
return `${encodeURIComponent(method)}.json`;
|
|
14335
14364
|
}
|
|
14365
|
+
/**
|
|
14366
|
+
* @inheritDoc
|
|
14367
|
+
*/
|
|
14368
|
+
setClientSideWarning(value, message) {
|
|
14369
|
+
this.#isClientSideWarning = value;
|
|
14370
|
+
this.#clientSideWarningMessage = message;
|
|
14371
|
+
}
|
|
14372
|
+
// endregion ////
|
|
14373
|
+
// region Tools ////
|
|
14374
|
+
/**
|
|
14375
|
+
* Tests whether the code is executed on the client side
|
|
14376
|
+
* @return {boolean}
|
|
14377
|
+
* @protected
|
|
14378
|
+
*/
|
|
14379
|
+
isServerSide() {
|
|
14380
|
+
return Type.isUndefined(window);
|
|
14381
|
+
}
|
|
14382
|
+
// endregion ////
|
|
14336
14383
|
}
|
|
14337
14384
|
|
|
14338
14385
|
class AbstractB24 {
|
|
@@ -15387,6 +15434,10 @@
|
|
|
15387
15434
|
this.#authHookManager,
|
|
15388
15435
|
this._getHttpOptions()
|
|
15389
15436
|
);
|
|
15437
|
+
this._http.setClientSideWarning(
|
|
15438
|
+
true,
|
|
15439
|
+
"It is not safe to use hook requests on the client side"
|
|
15440
|
+
);
|
|
15390
15441
|
this._isInit = true;
|
|
15391
15442
|
}
|
|
15392
15443
|
setLogger(logger) {
|
|
@@ -15397,6 +15448,12 @@
|
|
|
15397
15448
|
return this.#authHookManager;
|
|
15398
15449
|
}
|
|
15399
15450
|
// region Core ////
|
|
15451
|
+
/**
|
|
15452
|
+
* Disables warning about client-side query execution
|
|
15453
|
+
*/
|
|
15454
|
+
offClientSideWarning() {
|
|
15455
|
+
this.getHttpClient().setClientSideWarning(false, "");
|
|
15456
|
+
}
|
|
15400
15457
|
// endregion ////
|
|
15401
15458
|
// region Get ////
|
|
15402
15459
|
/**
|