@bitrix24/b24jssdk 0.4.10 → 1.0.1
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/README-AI.md +2 -1
- package/dist/esm/_virtual/_commonjsHelpers.mjs +16 -0
- package/dist/esm/_virtual/_commonjsHelpers.mjs.map +1 -0
- package/dist/esm/_virtual/protobuf.mjs +16 -0
- package/dist/esm/_virtual/protobuf.mjs.map +1 -0
- package/dist/esm/_virtual/protobuf2.mjs +12 -0
- package/dist/esm/_virtual/protobuf2.mjs.map +1 -0
- package/dist/esm/core/abstract-b24.mjs +355 -0
- package/dist/esm/core/abstract-b24.mjs.map +1 -0
- package/dist/esm/core/actions/abstract-action.mjs +24 -0
- package/dist/esm/core/actions/abstract-action.mjs.map +1 -0
- package/dist/esm/core/actions/abstract-batch.mjs +95 -0
- package/dist/esm/core/actions/abstract-batch.mjs.map +1 -0
- package/dist/esm/core/actions/manager.mjs +53 -0
- package/dist/esm/core/actions/manager.mjs.map +1 -0
- package/dist/esm/core/actions/v2/batch-by-chunk.mjs +92 -0
- package/dist/esm/core/actions/v2/batch-by-chunk.mjs.map +1 -0
- package/dist/esm/core/actions/v2/batch.mjs +126 -0
- package/dist/esm/core/actions/v2/batch.mjs.map +1 -0
- package/dist/esm/core/actions/v2/call-list.mjs +131 -0
- package/dist/esm/core/actions/v2/call-list.mjs.map +1 -0
- package/dist/esm/core/actions/v2/call.mjs +68 -0
- package/dist/esm/core/actions/v2/call.mjs.map +1 -0
- package/dist/esm/core/actions/v2/fetch-list.mjs +132 -0
- package/dist/esm/core/actions/v2/fetch-list.mjs.map +1 -0
- package/dist/esm/core/actions/v2/manager-v2.mjs +74 -0
- package/dist/esm/core/actions/v2/manager-v2.mjs.map +1 -0
- package/dist/esm/core/actions/v3/batch-by-chunk.mjs +91 -0
- package/dist/esm/core/actions/v3/batch-by-chunk.mjs.map +1 -0
- package/dist/esm/core/actions/v3/batch.mjs +129 -0
- package/dist/esm/core/actions/v3/batch.mjs.map +1 -0
- package/dist/esm/core/actions/v3/call-list.mjs +127 -0
- package/dist/esm/core/actions/v3/call-list.mjs.map +1 -0
- package/dist/esm/core/actions/v3/call.mjs +58 -0
- package/dist/esm/core/actions/v3/call.mjs.map +1 -0
- package/dist/esm/core/actions/v3/fetch-list.mjs +125 -0
- package/dist/esm/core/actions/v3/fetch-list.mjs.map +1 -0
- package/dist/esm/core/actions/v3/manager-v3.mjs +74 -0
- package/dist/esm/core/actions/v3/manager-v3.mjs.map +1 -0
- package/dist/esm/core/http/abstract-http.mjs +563 -0
- package/dist/esm/core/http/abstract-http.mjs.map +1 -0
- package/dist/esm/core/http/ajax-error.mjs +107 -0
- package/dist/esm/core/http/ajax-error.mjs.map +1 -0
- package/dist/esm/core/http/ajax-result.mjs +176 -0
- package/dist/esm/core/http/ajax-result.mjs.map +1 -0
- package/dist/esm/core/http/limiters/adaptive-delayer.mjs +135 -0
- package/dist/esm/core/http/limiters/adaptive-delayer.mjs.map +1 -0
- package/dist/esm/core/http/limiters/manager.mjs +308 -0
- package/dist/esm/core/http/limiters/manager.mjs.map +1 -0
- package/dist/esm/core/http/limiters/operating-limiter.mjs +171 -0
- package/dist/esm/core/http/limiters/operating-limiter.mjs.map +1 -0
- package/dist/esm/core/http/limiters/params-factory.mjs +121 -0
- package/dist/esm/core/http/limiters/params-factory.mjs.map +1 -0
- package/dist/esm/core/http/limiters/rate-limiter.mjs +402 -0
- package/dist/esm/core/http/limiters/rate-limiter.mjs.map +1 -0
- package/dist/esm/core/http/v2.mjs +100 -0
- package/dist/esm/core/http/v2.mjs.map +1 -0
- package/dist/esm/core/http/v3.mjs +94 -0
- package/dist/esm/core/http/v3.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/abstract-interaction-batch.mjs +69 -0
- package/dist/esm/core/interaction/batch/abstract-interaction-batch.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/parse-row.mjs +67 -0
- package/dist/esm/core/interaction/batch/parse-row.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/interface-strategy.mjs +42 -0
- package/dist/esm/core/interaction/batch/processing/interface-strategy.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs +121 -0
- package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/v2/as-array.mjs +32 -0
- package/dist/esm/core/interaction/batch/processing/v2/as-array.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/v2/as-object.mjs +32 -0
- package/dist/esm/core/interaction/batch/processing/v2/as-object.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs +118 -0
- package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/v3/as-array.mjs +32 -0
- package/dist/esm/core/interaction/batch/processing/v3/as-array.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/processing/v3/as-object.mjs +32 -0
- package/dist/esm/core/interaction/batch/processing/v3/as-object.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/v2.mjs +44 -0
- package/dist/esm/core/interaction/batch/v2.mjs.map +1 -0
- package/dist/esm/core/interaction/batch/v3.mjs +42 -0
- package/dist/esm/core/interaction/batch/v3.mjs.map +1 -0
- package/dist/esm/core/language/list.mjs +56 -0
- package/dist/esm/core/language/list.mjs.map +1 -0
- package/dist/esm/core/request-id-generator.mjs +42 -0
- package/dist/esm/core/request-id-generator.mjs.map +1 -0
- package/dist/esm/core/result.mjs +101 -0
- package/dist/esm/core/result.mjs.map +1 -0
- package/dist/esm/core/sdk-error.mjs +83 -0
- package/dist/esm/core/sdk-error.mjs.map +1 -0
- package/dist/esm/core/tools/abstract-tool.mjs +24 -0
- package/dist/esm/core/tools/abstract-tool.mjs.map +1 -0
- package/dist/esm/core/tools/healthcheck.mjs +48 -0
- package/dist/esm/core/tools/healthcheck.mjs.map +1 -0
- package/dist/esm/core/tools/manager.mjs +50 -0
- package/dist/esm/core/tools/manager.mjs.map +1 -0
- package/dist/esm/core/tools/ping.mjs +56 -0
- package/dist/esm/core/tools/ping.mjs.map +1 -0
- package/dist/esm/core/version-manager.mjs +116 -0
- package/dist/esm/core/version-manager.mjs.map +1 -0
- package/dist/esm/frame/auth.mjs +98 -0
- package/dist/esm/frame/auth.mjs.map +1 -0
- package/dist/esm/frame/b24.mjs +170 -0
- package/dist/esm/frame/b24.mjs.map +1 -0
- package/dist/esm/frame/dialog.mjs +78 -0
- package/dist/esm/frame/dialog.mjs.map +1 -0
- package/dist/esm/frame/frame.mjs +101 -0
- package/dist/esm/frame/frame.mjs.map +1 -0
- package/dist/esm/frame/message/commands.mjs +37 -0
- package/dist/esm/frame/message/commands.mjs.map +1 -0
- package/dist/esm/frame/message/controller.mjs +177 -0
- package/dist/esm/frame/message/controller.mjs.map +1 -0
- package/dist/esm/frame/options.mjs +106 -0
- package/dist/esm/frame/options.mjs.map +1 -0
- package/dist/esm/frame/parent.mjs +250 -0
- package/dist/esm/frame/parent.mjs.map +1 -0
- package/dist/esm/frame/placement.mjs +131 -0
- package/dist/esm/frame/placement.mjs.map +1 -0
- package/dist/esm/frame/slider.mjs +156 -0
- package/dist/esm/frame/slider.mjs.map +1 -0
- package/dist/esm/helper/abstract-helper.mjs +52 -0
- package/dist/esm/helper/abstract-helper.mjs.map +1 -0
- package/dist/esm/helper/app-manager.mjs +37 -0
- package/dist/esm/helper/app-manager.mjs.map +1 -0
- package/dist/esm/helper/currency-manager.mjs +207 -0
- package/dist/esm/helper/currency-manager.mjs.map +1 -0
- package/dist/esm/helper/helper-manager.mjs +388 -0
- package/dist/esm/helper/helper-manager.mjs.map +1 -0
- package/dist/esm/helper/license-manager.mjs +50 -0
- package/dist/esm/helper/license-manager.mjs.map +1 -0
- package/dist/esm/helper/options-manager.mjs +196 -0
- package/dist/esm/helper/options-manager.mjs.map +1 -0
- package/dist/esm/helper/payment-manager.mjs +33 -0
- package/dist/esm/helper/payment-manager.mjs.map +1 -0
- package/dist/esm/helper/profile-manager.mjs +33 -0
- package/dist/esm/helper/profile-manager.mjs.map +1 -0
- package/dist/esm/helper/use-b24-helper.mjs +84 -0
- package/dist/esm/helper/use-b24-helper.mjs.map +1 -0
- package/dist/esm/hook/auth.mjs +77 -0
- package/dist/esm/hook/auth.mjs.map +1 -0
- package/dist/esm/hook/b24.mjs +115 -0
- package/dist/esm/hook/b24.mjs.map +1 -0
- package/dist/esm/index.d.mts +2757 -525
- package/dist/esm/index.d.ts +2757 -525
- package/dist/esm/index.mjs +70 -14111
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/loader-b24frame.mjs +101 -0
- package/dist/esm/loader-b24frame.mjs.map +1 -0
- package/dist/esm/logger/abstract-logger.mjs +69 -0
- package/dist/esm/logger/abstract-logger.mjs.map +1 -0
- package/dist/esm/logger/browser.mjs +162 -0
- package/dist/esm/logger/browser.mjs.map +1 -0
- package/dist/esm/logger/formatter/abstract-formatter.mjs +34 -0
- package/dist/esm/logger/formatter/abstract-formatter.mjs.map +1 -0
- package/dist/esm/logger/formatter/json-formatter.mjs +34 -0
- package/dist/esm/logger/formatter/json-formatter.mjs.map +1 -0
- package/dist/esm/logger/formatter/line-formatter.mjs +41 -0
- package/dist/esm/logger/formatter/line-formatter.mjs.map +1 -0
- package/dist/esm/logger/formatter/telegram-formatter.mjs +103 -0
- package/dist/esm/logger/formatter/telegram-formatter.mjs.map +1 -0
- package/dist/esm/logger/handler/abstract-handler.mjs +39 -0
- package/dist/esm/logger/handler/abstract-handler.mjs.map +1 -0
- package/dist/esm/logger/handler/consola-adapter.mjs +62 -0
- package/dist/esm/logger/handler/consola-adapter.mjs.map +1 -0
- package/dist/esm/logger/handler/console-handler.mjs +98 -0
- package/dist/esm/logger/handler/console-handler.mjs.map +1 -0
- package/dist/esm/logger/handler/console-v2-handler.mjs +51 -0
- package/dist/esm/logger/handler/console-v2-handler.mjs.map +1 -0
- package/dist/esm/logger/handler/memory-handler.mjs +48 -0
- package/dist/esm/logger/handler/memory-handler.mjs.map +1 -0
- package/dist/esm/logger/handler/stream-handler.mjs +73 -0
- package/dist/esm/logger/handler/stream-handler.mjs.map +1 -0
- package/dist/esm/logger/handler/telegram-handler.mjs +157 -0
- package/dist/esm/logger/handler/telegram-handler.mjs.map +1 -0
- package/dist/esm/logger/handler/winston-adapter.mjs +57 -0
- package/dist/esm/logger/handler/winston-adapter.mjs.map +1 -0
- package/dist/esm/logger/logger-factory.mjs +67 -0
- package/dist/esm/logger/logger-factory.mjs.map +1 -0
- package/dist/esm/logger/logger.mjs +76 -0
- package/dist/esm/logger/logger.mjs.map +1 -0
- package/dist/esm/logger/null-logger.mjs +32 -0
- package/dist/esm/logger/null-logger.mjs.map +1 -0
- package/dist/esm/logger/processor/memory-usage-processor.mjs +20 -0
- package/dist/esm/logger/processor/memory-usage-processor.mjs.map +1 -0
- package/dist/esm/logger/processor/pid-processor.mjs +20 -0
- package/dist/esm/logger/processor/pid-processor.mjs.map +1 -0
- package/dist/esm/oauth/auth.mjs +211 -0
- package/dist/esm/oauth/auth.mjs.map +1 -0
- package/dist/esm/oauth/b24.mjs +117 -0
- package/dist/esm/oauth/b24.mjs.map +1 -0
- package/dist/esm/oauth/refresh-token-error.mjs +20 -0
- package/dist/esm/oauth/refresh-token-error.mjs.map +1 -0
- package/dist/esm/pullClient/abstract-connector.mjs +78 -0
- package/dist/esm/pullClient/abstract-connector.mjs.map +1 -0
- package/dist/esm/pullClient/channel-manager.mjs +89 -0
- package/dist/esm/pullClient/channel-manager.mjs.map +1 -0
- package/dist/esm/pullClient/client.mjs +2064 -0
- package/dist/esm/pullClient/client.mjs.map +1 -0
- package/dist/esm/pullClient/errors.mjs +31 -0
- package/dist/esm/pullClient/errors.mjs.map +1 -0
- package/dist/esm/pullClient/json-rpc.mjs +210 -0
- package/dist/esm/pullClient/json-rpc.mjs.map +1 -0
- package/dist/esm/pullClient/long-polling-connector.mjs +157 -0
- package/dist/esm/pullClient/long-polling-connector.mjs.map +1 -0
- package/dist/esm/pullClient/protobuf/index.mjs +17 -0
- package/dist/esm/pullClient/protobuf/index.mjs.map +1 -0
- package/dist/esm/pullClient/protobuf/model.mjs +1058 -0
- package/dist/esm/pullClient/protobuf/model.mjs.map +1 -0
- package/dist/esm/pullClient/protobuf/protobuf.mjs +4653 -0
- package/dist/esm/pullClient/protobuf/protobuf.mjs.map +1 -0
- package/dist/esm/pullClient/shared-config.mjs +133 -0
- package/dist/esm/pullClient/shared-config.mjs.map +1 -0
- package/dist/esm/pullClient/storage-manager.mjs +72 -0
- package/dist/esm/pullClient/storage-manager.mjs.map +1 -0
- package/dist/esm/pullClient/web-socket-connector.mjs +129 -0
- package/dist/esm/pullClient/web-socket-connector.mjs.map +1 -0
- package/dist/esm/tools/browser.mjs +154 -0
- package/dist/esm/tools/browser.mjs.map +1 -0
- package/dist/esm/tools/environment.mjs +29 -0
- package/dist/esm/tools/environment.mjs.map +1 -0
- package/dist/esm/tools/formatters/iban.mjs +304 -0
- package/dist/esm/tools/formatters/iban.mjs.map +1 -0
- package/dist/esm/tools/formatters/numbers.mjs +64 -0
- package/dist/esm/tools/formatters/numbers.mjs.map +1 -0
- package/dist/esm/tools/index.mjs +37 -0
- package/dist/esm/tools/index.mjs.map +1 -0
- package/dist/esm/tools/scroll-size.mjs +25 -0
- package/dist/esm/tools/scroll-size.mjs.map +1 -0
- package/dist/esm/tools/text.mjs +208 -0
- package/dist/esm/tools/text.mjs.map +1 -0
- package/dist/esm/tools/type.mjs +337 -0
- package/dist/esm/tools/type.mjs.map +1 -0
- package/dist/esm/tools/use-formatters.mjs +460 -0
- package/dist/esm/tools/use-formatters.mjs.map +1 -0
- package/dist/esm/tools/uuidv7.mjs +54 -0
- package/dist/esm/tools/uuidv7.mjs.map +1 -0
- package/dist/esm/types/b24-helper.mjs +56 -0
- package/dist/esm/types/b24-helper.mjs.map +1 -0
- package/dist/esm/types/b24.mjs +16 -0
- package/dist/esm/types/b24.mjs.map +1 -0
- package/dist/esm/types/bizproc/index.mjs +187 -0
- package/dist/esm/types/bizproc/index.mjs.map +1 -0
- package/dist/esm/types/catalog/index.mjs +35 -0
- package/dist/esm/types/catalog/index.mjs.map +1 -0
- package/dist/esm/types/common.mjs +31 -0
- package/dist/esm/types/common.mjs.map +1 -0
- package/dist/esm/types/crm/entity-type.mjs +57 -0
- package/dist/esm/types/crm/entity-type.mjs.map +1 -0
- package/dist/esm/types/crm/productrow.mjs +17 -0
- package/dist/esm/types/crm/productrow.mjs.map +1 -0
- package/dist/esm/types/logger.mjs +22 -0
- package/dist/esm/types/logger.mjs.map +1 -0
- package/dist/esm/types/pull.mjs +83 -0
- package/dist/esm/types/pull.mjs.map +1 -0
- package/dist/umd/index.js +31216 -26905
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +63 -40
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +36 -31
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,5 +1,503 @@
|
|
|
1
|
+
import { Writable } from 'node:stream';
|
|
1
2
|
import { DateTimeOptions, DateTime } from 'luxon';
|
|
3
|
+
import { AxiosInstance, AxiosError } from 'axios';
|
|
2
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Log levels in ascending order of severity.
|
|
7
|
+
*
|
|
8
|
+
* Levels allow filtering messages: when a specific level is set,
|
|
9
|
+
* messages of that level and all higher levels will be logged.
|
|
10
|
+
*/
|
|
11
|
+
declare enum LogLevel {
|
|
12
|
+
/**
|
|
13
|
+
* Detailed debug information for developers.
|
|
14
|
+
* Default level in development environment.
|
|
15
|
+
*/
|
|
16
|
+
DEBUG = 0,
|
|
17
|
+
/**
|
|
18
|
+
* Informational messages about normal application operation.
|
|
19
|
+
* Used for tracking business logic.
|
|
20
|
+
*/
|
|
21
|
+
INFO = 1,
|
|
22
|
+
/**
|
|
23
|
+
* Important but non-critical events.
|
|
24
|
+
* Examples: successful request processing, configuration changes.
|
|
25
|
+
*/
|
|
26
|
+
NOTICE = 2,
|
|
27
|
+
/**
|
|
28
|
+
* Warnings about potential problems.
|
|
29
|
+
* Application continues to run but attention is required.
|
|
30
|
+
*/
|
|
31
|
+
WARNING = 3,
|
|
32
|
+
/**
|
|
33
|
+
* Runtime errors requiring intervention.
|
|
34
|
+
* Some functionality is unavailable but the application is running.
|
|
35
|
+
*/
|
|
36
|
+
ERROR = 4,
|
|
37
|
+
/**
|
|
38
|
+
* Critical errors disrupting component operation.
|
|
39
|
+
* Require immediate intervention during working hours.
|
|
40
|
+
*/
|
|
41
|
+
CRITICAL = 5,
|
|
42
|
+
/**
|
|
43
|
+
* Serious problems requiring immediate resolution.
|
|
44
|
+
* Examples: database unavailable, disk space exhausted.
|
|
45
|
+
*/
|
|
46
|
+
ALERT = 6,
|
|
47
|
+
/**
|
|
48
|
+
* System is unusable, requires urgent intervention.
|
|
49
|
+
* Highest severity level.
|
|
50
|
+
*/
|
|
51
|
+
EMERGENCY = 7
|
|
52
|
+
}
|
|
53
|
+
type LogLevelName = keyof typeof LogLevel;
|
|
54
|
+
interface LogRecord {
|
|
55
|
+
channel: string;
|
|
56
|
+
level: LogLevel;
|
|
57
|
+
levelName: LogLevelName;
|
|
58
|
+
message: string;
|
|
59
|
+
context: Record<string, any>;
|
|
60
|
+
extra: Record<string, any>;
|
|
61
|
+
timestamp: Date;
|
|
62
|
+
}
|
|
63
|
+
interface Formatter {
|
|
64
|
+
format(record: LogRecord): any;
|
|
65
|
+
}
|
|
66
|
+
interface HandlerOptions {
|
|
67
|
+
bubble?: boolean;
|
|
68
|
+
[key: string]: any;
|
|
69
|
+
}
|
|
70
|
+
interface Handler {
|
|
71
|
+
/**
|
|
72
|
+
* Handles a log record.
|
|
73
|
+
*
|
|
74
|
+
* @param {LogRecord} record - Log record to handle.
|
|
75
|
+
* @returns {boolean}
|
|
76
|
+
*/
|
|
77
|
+
handle(record: LogRecord): Promise<boolean>;
|
|
78
|
+
isHandling(level: LogLevel): boolean;
|
|
79
|
+
shouldBubble(): boolean;
|
|
80
|
+
setFormatter(formatter: Formatter): void;
|
|
81
|
+
getFormatter(): Formatter | null;
|
|
82
|
+
}
|
|
83
|
+
type Processor = (record: LogRecord) => LogRecord;
|
|
84
|
+
interface LoggerInterface {
|
|
85
|
+
/**
|
|
86
|
+
* Logs with an arbitrary level.
|
|
87
|
+
*/
|
|
88
|
+
log(level: LogLevel, message: string, context?: Record<string, any>): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Detailed debug information.
|
|
91
|
+
*/
|
|
92
|
+
debug(message: string, context?: Record<string, any>): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Interesting events.
|
|
95
|
+
*
|
|
96
|
+
* Example: User logs in, SQL logs.
|
|
97
|
+
*/
|
|
98
|
+
info(message: string, context?: Record<string, any>): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Normal but significant events.
|
|
101
|
+
*/
|
|
102
|
+
notice(message: string, context?: Record<string, any>): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Exceptional occurrences that are not errors.
|
|
105
|
+
*
|
|
106
|
+
* Example: Use of deprecated APIs, poor use of an API, undesirable things
|
|
107
|
+
* that are not necessarily wrong.
|
|
108
|
+
*/
|
|
109
|
+
warning(message: string, context?: Record<string, any>): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Runtime errors that do not require immediate action but should typically
|
|
112
|
+
* be logged and monitored.
|
|
113
|
+
*/
|
|
114
|
+
error(message: string, context?: Record<string, any>): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Critical conditions
|
|
117
|
+
*
|
|
118
|
+
* Example: Application component unavailable, unexpected exception
|
|
119
|
+
*/
|
|
120
|
+
critical(message: string, context?: Record<string, any>): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Action must be taken immediately.
|
|
123
|
+
*
|
|
124
|
+
* Example: Entire website down, database unavailable, etc. This should
|
|
125
|
+
* trigger the SMS alerts and wake you up.
|
|
126
|
+
*/
|
|
127
|
+
alert(message: string, context?: Record<string, any>): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* System is unusable.
|
|
130
|
+
*/
|
|
131
|
+
emergency(message: string, context?: Record<string, any>): Promise<void>;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Support date format:
|
|
136
|
+
* - `YYYY` - Full year (e.g., 2024)
|
|
137
|
+
* - `YY` - Two-digit year (e.g., 24)
|
|
138
|
+
* - `MMMM` - Full month name (e.g., "January")
|
|
139
|
+
* - `MMM` - Abbreviated month name (e.g., "Jan")
|
|
140
|
+
* - `MM` - Month with leading zero (01-12)
|
|
141
|
+
* - `M` - Month without leading zero (1-12)
|
|
142
|
+
* - `DD` - Day of month with leading zero (01-31)
|
|
143
|
+
* - `D` - Day of month without leading zero (1-31)
|
|
144
|
+
* - `HH` - Hour (24-hour) with leading zero (00-23)
|
|
145
|
+
* - `H` - Hour (24-hour) without leading zero (0-23)
|
|
146
|
+
* - `hh` - Hour (12-hour) with leading zero (00-11)
|
|
147
|
+
* - `h` - Hour (12-hour) without leading zero (0-11)
|
|
148
|
+
* - `mm` - Minutes with leading zero (00-59)
|
|
149
|
+
* - `m` - Minutes without leading zero (0-59)
|
|
150
|
+
* - `ss` - Seconds with leading zero (00-59)
|
|
151
|
+
* - `s` - Seconds without leading zero (0-59)
|
|
152
|
+
* - `SSS` - Milliseconds (000-999)
|
|
153
|
+
* - `a` - AM/PM lowercase (am/pm)
|
|
154
|
+
* - `A` - AM/PM uppercase (AM/PM)
|
|
155
|
+
* - `ZZZ` - Timezone (e.g., UTC)
|
|
156
|
+
* - `ZZ` - Timezone offset (e.g., +03:00)
|
|
157
|
+
*/
|
|
158
|
+
declare abstract class AbstractFormatter implements Formatter {
|
|
159
|
+
protected dateFormat: string;
|
|
160
|
+
constructor(dateFormat?: string);
|
|
161
|
+
abstract format(record: LogRecord): string;
|
|
162
|
+
protected _formatTimestamp(date: Date): string;
|
|
163
|
+
protected _formatDate(date: Date): string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* JsonFormatter
|
|
168
|
+
*
|
|
169
|
+
* @inheritDoc
|
|
170
|
+
*/
|
|
171
|
+
declare class JsonFormatter extends AbstractFormatter implements Formatter {
|
|
172
|
+
constructor(dateFormat?: string);
|
|
173
|
+
format(record: LogRecord): string;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* LineFormatter
|
|
178
|
+
*
|
|
179
|
+
* @inheritDoc
|
|
180
|
+
*/
|
|
181
|
+
declare class LineFormatter extends AbstractFormatter implements Formatter {
|
|
182
|
+
protected formatString: string;
|
|
183
|
+
constructor(formatString?: string, dateFormat?: string);
|
|
184
|
+
format(record: LogRecord): string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* TelegramFormatter
|
|
189
|
+
*
|
|
190
|
+
* Formats a log entry for sending to Telegram.
|
|
191
|
+
* Supports HTML markup with escaped special characters.
|
|
192
|
+
*
|
|
193
|
+
* @link https://core.telegram.org/bots/api#html-style
|
|
194
|
+
*/
|
|
195
|
+
declare class TelegramFormatter extends AbstractFormatter implements Formatter {
|
|
196
|
+
private useHtml;
|
|
197
|
+
private maxMessageLength;
|
|
198
|
+
constructor(useHtml?: boolean, dateFormat?: string, maxMessageLength?: number);
|
|
199
|
+
format(record: LogRecord): string;
|
|
200
|
+
protected _formatBaseMessage(record: LogRecord): string;
|
|
201
|
+
protected _formatAdditionalInfo(record: LogRecord): string;
|
|
202
|
+
protected _escapeHtml(text: string): string;
|
|
203
|
+
protected _escapeMarkdownV2(text: string): string;
|
|
204
|
+
/**
|
|
205
|
+
* Set the use of HTML markup
|
|
206
|
+
*/
|
|
207
|
+
setUseHtml(useHtml: boolean): this;
|
|
208
|
+
/**
|
|
209
|
+
* // Set the maximum message length
|
|
210
|
+
*/
|
|
211
|
+
setMaxMessageLength(maxLength: number): this;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
declare const pidProcessor: Processor;
|
|
215
|
+
|
|
216
|
+
declare const memoryUsageProcessor: Processor;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Abstract Handler
|
|
220
|
+
*/
|
|
221
|
+
declare abstract class AbstractHandler implements Handler {
|
|
222
|
+
protected level: LogLevel;
|
|
223
|
+
protected formatter: Formatter | null;
|
|
224
|
+
protected bubble: boolean;
|
|
225
|
+
constructor(level?: LogLevel, bubble?: boolean);
|
|
226
|
+
isHandling(level: LogLevel): boolean;
|
|
227
|
+
shouldBubble(): boolean;
|
|
228
|
+
setFormatter(formatter: Formatter): void;
|
|
229
|
+
getFormatter(): Formatter | null;
|
|
230
|
+
/**
|
|
231
|
+
* @inheritDoc
|
|
232
|
+
*/
|
|
233
|
+
abstract handle(record: LogRecord): Promise<boolean>;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
interface ConsoleHandlerOptions extends HandlerOptions {
|
|
237
|
+
useStyles?: boolean;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Console Handler
|
|
241
|
+
*/
|
|
242
|
+
declare class ConsoleHandler extends AbstractHandler implements Handler {
|
|
243
|
+
protected _styles: Map<LogLevel, string[]>;
|
|
244
|
+
protected readonly _useStyles: boolean;
|
|
245
|
+
constructor(level?: LogLevel, options?: ConsoleHandlerOptions);
|
|
246
|
+
protected _initStyles(): void;
|
|
247
|
+
/**
|
|
248
|
+
* @inheritDoc
|
|
249
|
+
*/
|
|
250
|
+
handle(record: LogRecord): Promise<boolean>;
|
|
251
|
+
protected _getConsoleMethod(level: LogLevel): 'log' | 'info' | 'warn' | 'error' | 'trace';
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Console Handler V2
|
|
256
|
+
*/
|
|
257
|
+
declare class ConsoleV2Handler extends ConsoleHandler implements Handler {
|
|
258
|
+
constructor(level?: LogLevel, options?: ConsoleHandlerOptions);
|
|
259
|
+
/**
|
|
260
|
+
* @inheritDoc
|
|
261
|
+
*/
|
|
262
|
+
handle(record: LogRecord): Promise<boolean>;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
interface MemoryHandlerOptions extends HandlerOptions {
|
|
266
|
+
limit?: number;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Memory Handler
|
|
270
|
+
*/
|
|
271
|
+
declare class MemoryHandler extends AbstractHandler implements Handler {
|
|
272
|
+
private records;
|
|
273
|
+
private readonly limit;
|
|
274
|
+
constructor(level?: LogLevel, options?: MemoryHandlerOptions);
|
|
275
|
+
/**
|
|
276
|
+
* @inheritDoc
|
|
277
|
+
*/
|
|
278
|
+
handle(record: LogRecord): Promise<boolean>;
|
|
279
|
+
getRecords(): LogRecord[];
|
|
280
|
+
clear(): void;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
interface StreamHandlerOptions extends HandlerOptions {
|
|
284
|
+
stream: Writable;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Stream Handler
|
|
288
|
+
*
|
|
289
|
+
* Node.js stream handler for writing logs to streams.
|
|
290
|
+
*/
|
|
291
|
+
declare class StreamHandler extends AbstractHandler implements Handler {
|
|
292
|
+
/**
|
|
293
|
+
* Stream for writing logs.
|
|
294
|
+
* @private
|
|
295
|
+
*/
|
|
296
|
+
private stream;
|
|
297
|
+
/**
|
|
298
|
+
* Creates a StreamHandler instance.
|
|
299
|
+
*
|
|
300
|
+
* @param {LogLevel} level - Minimum log level.
|
|
301
|
+
* @param options
|
|
302
|
+
* - `stream: Writable` - Stream to write to (e.g., `process.stdout`, `process.stderr`, `fs.WriteStream`)
|
|
303
|
+
* - `bubble?: boolean` - Determines whether the handler should bubble the record to the next handler.
|
|
304
|
+
*/
|
|
305
|
+
constructor(level: LogLevel | undefined, options: StreamHandlerOptions);
|
|
306
|
+
/**
|
|
307
|
+
* @inheritDoc
|
|
308
|
+
*/
|
|
309
|
+
handle(record: LogRecord): Promise<boolean>;
|
|
310
|
+
/**
|
|
311
|
+
* Closes the stream (if supported).
|
|
312
|
+
*
|
|
313
|
+
* @returns {Promise<void>}
|
|
314
|
+
*/
|
|
315
|
+
close(): Promise<void>;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
interface ConsolaAdapterOptions extends HandlerOptions {
|
|
319
|
+
consolaInstance: any;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Adapter for Consola
|
|
323
|
+
*
|
|
324
|
+
* @memo Consola has its own formatter
|
|
325
|
+
* @link https://github.com/unjs/consola
|
|
326
|
+
*/
|
|
327
|
+
declare class ConsolaAdapter extends AbstractHandler implements Handler {
|
|
328
|
+
private consolaInstance;
|
|
329
|
+
constructor(level: LogLevel | undefined, options: ConsolaAdapterOptions);
|
|
330
|
+
setFormatter(_formatter: Formatter): void;
|
|
331
|
+
getFormatter(): Formatter | null;
|
|
332
|
+
handle(record: LogRecord): Promise<boolean>;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
interface WinstonAdapterOptions extends HandlerOptions {
|
|
336
|
+
winstonLogger: any;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Adapter for Winston
|
|
340
|
+
*
|
|
341
|
+
* @memo Winston has its own formatter
|
|
342
|
+
* @link https://github.com/winstonjs/winston
|
|
343
|
+
*/
|
|
344
|
+
declare class WinstonAdapter extends AbstractHandler implements Handler {
|
|
345
|
+
private winstonLogger;
|
|
346
|
+
constructor(level: LogLevel | undefined, options: WinstonAdapterOptions);
|
|
347
|
+
setFormatter(_formatter: Formatter): void;
|
|
348
|
+
getFormatter(): Formatter | null;
|
|
349
|
+
handle(record: LogRecord): Promise<boolean>;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Define the environment
|
|
354
|
+
*/
|
|
355
|
+
declare enum Environment {
|
|
356
|
+
UNKNOWN = "unknown",
|
|
357
|
+
BROWSE = "browser",
|
|
358
|
+
NODE = "node"
|
|
359
|
+
}
|
|
360
|
+
declare function getEnvironment(): Environment;
|
|
361
|
+
|
|
362
|
+
interface TelegramHandlerOptions extends HandlerOptions {
|
|
363
|
+
botToken: string;
|
|
364
|
+
chatId: string | number;
|
|
365
|
+
parseMode?: 'HTML' | 'Markdown' | 'MarkdownV2';
|
|
366
|
+
disableNotification?: boolean;
|
|
367
|
+
disableWebPagePreview?: boolean;
|
|
368
|
+
useStyles?: boolean;
|
|
369
|
+
warnInBrowser?: boolean;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Telegram Handler
|
|
373
|
+
*
|
|
374
|
+
* Sends logs to Telegram chat.
|
|
375
|
+
* The browser displays a warning in the console.
|
|
376
|
+
* In Node.js, sends a message via the Telegram Bot API.
|
|
377
|
+
*/
|
|
378
|
+
declare class TelegramHandler extends AbstractHandler implements Handler {
|
|
379
|
+
protected botToken: string;
|
|
380
|
+
protected chatId: string | number;
|
|
381
|
+
protected parseMode: 'HTML' | 'Markdown' | 'MarkdownV2';
|
|
382
|
+
protected disableNotification: boolean;
|
|
383
|
+
protected disableWebPagePreview: boolean;
|
|
384
|
+
protected readonly environment: Environment;
|
|
385
|
+
protected warnInBrowser: boolean;
|
|
386
|
+
constructor(level: LogLevel | undefined, options: TelegramHandlerOptions);
|
|
387
|
+
/**
|
|
388
|
+
* @inheritDoc
|
|
389
|
+
*/
|
|
390
|
+
handle(record: LogRecord): Promise<boolean>;
|
|
391
|
+
/**
|
|
392
|
+
* Processing in the browser
|
|
393
|
+
*/
|
|
394
|
+
protected _handleInBrowser(_message: string, record: LogRecord): Promise<boolean>;
|
|
395
|
+
/**
|
|
396
|
+
* Processing in Node.js
|
|
397
|
+
*/
|
|
398
|
+
protected _handleInNode(message: string, _record: LogRecord): Promise<boolean>;
|
|
399
|
+
/**
|
|
400
|
+
* Fallback processing for unknown environments
|
|
401
|
+
*/
|
|
402
|
+
protected _handleFallback(message: string): Promise<boolean>;
|
|
403
|
+
updateSettings(options: Partial<TelegramHandlerOptions>): this;
|
|
404
|
+
/**
|
|
405
|
+
* Get current environment
|
|
406
|
+
*/
|
|
407
|
+
getEnvironment(): Environment;
|
|
408
|
+
/**
|
|
409
|
+
* Check if the Telegram API is available
|
|
410
|
+
*/
|
|
411
|
+
testConnection(): Promise<boolean>;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
declare abstract class AbstractLogger implements LoggerInterface {
|
|
415
|
+
/**
|
|
416
|
+
* @inheritDoc
|
|
417
|
+
*/
|
|
418
|
+
abstract log(_level: LogLevel, _message: string, _context?: Record<string, any>): Promise<void>;
|
|
419
|
+
/**
|
|
420
|
+
* @inheritDoc
|
|
421
|
+
*/
|
|
422
|
+
debug(message: string, context?: Record<string, any>): Promise<void>;
|
|
423
|
+
/**
|
|
424
|
+
* @inheritDoc
|
|
425
|
+
*/
|
|
426
|
+
info(message: string, context?: Record<string, any>): Promise<void>;
|
|
427
|
+
/**
|
|
428
|
+
* @inheritDoc
|
|
429
|
+
*/
|
|
430
|
+
notice(message: string, context?: Record<string, any>): Promise<void>;
|
|
431
|
+
/**
|
|
432
|
+
* @inheritDoc
|
|
433
|
+
*/
|
|
434
|
+
warning(message: string, context?: Record<string, any>): Promise<void>;
|
|
435
|
+
/**
|
|
436
|
+
* @inheritDoc
|
|
437
|
+
*/
|
|
438
|
+
error(message: string, context: Record<string, any>): Promise<void>;
|
|
439
|
+
/**
|
|
440
|
+
* @inheritDoc
|
|
441
|
+
*/
|
|
442
|
+
critical(message: string, context?: Record<string, any>): Promise<void>;
|
|
443
|
+
/**
|
|
444
|
+
* @inheritDoc
|
|
445
|
+
*/
|
|
446
|
+
alert(message: string, context?: Record<string, any>): Promise<void>;
|
|
447
|
+
/**
|
|
448
|
+
* @inheritDoc
|
|
449
|
+
*/
|
|
450
|
+
emergency(message: string, context?: Record<string, any>): Promise<void>;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* This Logger can be used to avoid conditional log calls.
|
|
455
|
+
*
|
|
456
|
+
* Logging should always be optional, and if no logger is provided to your
|
|
457
|
+
* library creating a NullLogger instance to have something to throw logs at
|
|
458
|
+
* is a good way to avoid littering your code with `if (this.logger) { }`
|
|
459
|
+
* blocks.
|
|
460
|
+
*/
|
|
461
|
+
declare class NullLogger extends AbstractLogger implements LoggerInterface {
|
|
462
|
+
static create(): NullLogger;
|
|
463
|
+
/**
|
|
464
|
+
* @inheritDoc
|
|
465
|
+
*/
|
|
466
|
+
log(_level: LogLevel, _message: string, _context?: Record<string, any>): Promise<void>;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* A logger created according to the principles of `Monolog`
|
|
471
|
+
*
|
|
472
|
+
* @link https://github.com/Seldaek/monolog
|
|
473
|
+
*/
|
|
474
|
+
declare class Logger extends AbstractLogger implements LoggerInterface {
|
|
475
|
+
private readonly channel;
|
|
476
|
+
private handlers;
|
|
477
|
+
private processors;
|
|
478
|
+
constructor(channel: string);
|
|
479
|
+
static create(channel: string): Logger;
|
|
480
|
+
pushHandler(handler: Handler): this;
|
|
481
|
+
popHandler(): Handler | null;
|
|
482
|
+
setHandlers(handlers: Handler[]): this;
|
|
483
|
+
pushProcessor(processor: Processor): this;
|
|
484
|
+
/**
|
|
485
|
+
* @inheritDoc
|
|
486
|
+
*/
|
|
487
|
+
log(level: LogLevel, message: string, context?: Record<string, any>): Promise<void>;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
declare class LoggerFactory {
|
|
491
|
+
static createNullLogger(): LoggerInterface;
|
|
492
|
+
static createForBrowser(channel: string, isDevMode?: boolean): LoggerInterface;
|
|
493
|
+
static createForBrowserDevelopment(channel: string, level?: LogLevel): LoggerInterface;
|
|
494
|
+
static createForBrowserProduction(channel: string, level?: LogLevel): LoggerInterface;
|
|
495
|
+
static forcedLog(logger: LoggerInterface, action: 'debug' | 'info' | 'notice' | 'warning' | 'error' | 'critical' | 'alert' | 'emergency', message: string, context: Record<string, any>): Promise<void>;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* @deprecate This enum is deprecated and will be removed in version `2.0.0`
|
|
500
|
+
*/
|
|
3
501
|
declare enum LoggerType {
|
|
4
502
|
desktop = "desktop",
|
|
5
503
|
log = "log",
|
|
@@ -8,20 +506,69 @@ declare enum LoggerType {
|
|
|
8
506
|
error = "error",
|
|
9
507
|
trace = "trace"
|
|
10
508
|
}
|
|
11
|
-
|
|
509
|
+
/**
|
|
510
|
+
* LoggerBrowser
|
|
511
|
+
*
|
|
512
|
+
* @deprecate This class is deprecated and will be removed in version `2.0.0`
|
|
513
|
+
* - use {@link Logger `Logger`}
|
|
514
|
+
*
|
|
515
|
+
* @removed 2.0.0
|
|
516
|
+
*/
|
|
517
|
+
declare class LoggerBrowser implements LoggerInterface {
|
|
12
518
|
#private;
|
|
519
|
+
/**
|
|
520
|
+
* Create a LoggerBrowser instance
|
|
521
|
+
*
|
|
522
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
523
|
+
*
|
|
524
|
+
* @removed 2.0.0
|
|
525
|
+
*/
|
|
13
526
|
static build(title: string, isDevelopment?: boolean): LoggerBrowser;
|
|
14
527
|
private constructor();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
528
|
+
/**
|
|
529
|
+
* Set config
|
|
530
|
+
*
|
|
531
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
532
|
+
*
|
|
533
|
+
* @removed 2.0.0
|
|
534
|
+
*/
|
|
535
|
+
setConfig(_types: Record<string | LoggerType, boolean>): void;
|
|
536
|
+
/**
|
|
537
|
+
* Set enable
|
|
538
|
+
*
|
|
539
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
540
|
+
*
|
|
541
|
+
* @removed 2.0.0
|
|
542
|
+
*/
|
|
543
|
+
enable(_type: LoggerType): boolean;
|
|
544
|
+
/**
|
|
545
|
+
* Set disable
|
|
546
|
+
*
|
|
547
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
548
|
+
*
|
|
549
|
+
* @removed 2.0.0
|
|
550
|
+
*/
|
|
551
|
+
disable(_type: LoggerType): boolean;
|
|
552
|
+
/**
|
|
553
|
+
* Test is enable
|
|
554
|
+
*
|
|
555
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
556
|
+
*
|
|
557
|
+
* @removed 2.0.0
|
|
558
|
+
*/
|
|
559
|
+
isEnabled(_type: LoggerType): boolean;
|
|
560
|
+
desktop(...params: any[]): Promise<void>;
|
|
561
|
+
log(...params: any[]): Promise<void>;
|
|
562
|
+
info(...params: any[]): Promise<void>;
|
|
563
|
+
warn(...params: any[]): Promise<void>;
|
|
564
|
+
error(...params: any[]): Promise<void>;
|
|
565
|
+
trace(...params: any[]): Promise<void>;
|
|
566
|
+
debug(...params: any[]): Promise<void>;
|
|
567
|
+
notice(...params: any[]): Promise<void>;
|
|
568
|
+
warning(...params: any[]): Promise<void>;
|
|
569
|
+
critical(...params: any[]): Promise<void>;
|
|
570
|
+
alert(...params: any[]): Promise<void>;
|
|
571
|
+
emergency(...params: any[]): Promise<void>;
|
|
25
572
|
}
|
|
26
573
|
|
|
27
574
|
/**
|
|
@@ -120,7 +667,7 @@ declare class TypeManager {
|
|
|
120
667
|
/**
|
|
121
668
|
* Returns true if a value is not an empty string
|
|
122
669
|
* @param value
|
|
123
|
-
* @returns {boolean}
|
|
670
|
+
* @returns {boolean} Returns true if a value is not an empty string
|
|
124
671
|
*/
|
|
125
672
|
isStringFilled(value: any): value is string;
|
|
126
673
|
/**
|
|
@@ -190,7 +737,7 @@ declare class TypeManager {
|
|
|
190
737
|
/**
|
|
191
738
|
* Returns true if a value is an array, and it has at least one element
|
|
192
739
|
* @param value
|
|
193
|
-
* @returns {boolean}
|
|
740
|
+
* @returns {boolean} Returns true if a value is an array, and it has at least one element
|
|
194
741
|
*/
|
|
195
742
|
isArrayFilled(value: any): value is any[];
|
|
196
743
|
/**
|
|
@@ -369,11 +916,16 @@ declare class TextManager {
|
|
|
369
916
|
* @param {string} dateString
|
|
370
917
|
* @param {string} template
|
|
371
918
|
* @param opts
|
|
372
|
-
* @returns {DateTime}
|
|
919
|
+
* @returns {DateTime} Convert string to DateTime from ISO 8601 or self template
|
|
373
920
|
*
|
|
374
921
|
* @link https://moment.github.io/luxon/#/parsing?id=parsing-technical-formats
|
|
375
922
|
*/
|
|
376
923
|
toDateTime(dateString: string, template?: string, opts?: DateTimeOptions): DateTime;
|
|
924
|
+
/**
|
|
925
|
+
* Convert Date to Bitrix24 REST API FORMAT Y-m-d\TH:i:sP
|
|
926
|
+
* @param date
|
|
927
|
+
*/
|
|
928
|
+
toB24Format(date: string | DateTime | Date): string;
|
|
377
929
|
getDateForLog(): string;
|
|
378
930
|
buildQueryString(params: any): string;
|
|
379
931
|
}
|
|
@@ -435,7 +987,7 @@ interface IResult<T = any> {
|
|
|
435
987
|
*
|
|
436
988
|
* @returns The data stored in the result, if any.
|
|
437
989
|
*/
|
|
438
|
-
getData: () => T | null;
|
|
990
|
+
getData: () => T | null | undefined;
|
|
439
991
|
/**
|
|
440
992
|
* Adds an error message or Error object to the result.
|
|
441
993
|
* @param error The error message or Error object to be added.
|
|
@@ -481,12 +1033,12 @@ interface IResult<T = any> {
|
|
|
481
1033
|
*/
|
|
482
1034
|
declare class Result<T = any> implements IResult<T> {
|
|
483
1035
|
protected _errors: Map<string, Error>;
|
|
484
|
-
protected _data: T | null;
|
|
1036
|
+
protected _data: T | null | undefined;
|
|
485
1037
|
constructor(data?: T);
|
|
486
1038
|
get isSuccess(): boolean;
|
|
487
1039
|
get errors(): Map<string, Error>;
|
|
488
|
-
setData(data: T | null): Result<T>;
|
|
489
|
-
getData(): T | null;
|
|
1040
|
+
setData(data: T | null | undefined): Result<T>;
|
|
1041
|
+
getData(): T | null | undefined;
|
|
490
1042
|
addError(error: Error | string, key?: string): Result<T>;
|
|
491
1043
|
addErrors(errors: (Error | string)[]): Result<T>;
|
|
492
1044
|
getErrors(): IterableIterator<Error>;
|
|
@@ -510,128 +1062,6 @@ declare class Result<T = any> implements IResult<T> {
|
|
|
510
1062
|
static fail<U>(error: Error | string, key?: string): Result<U>;
|
|
511
1063
|
}
|
|
512
1064
|
|
|
513
|
-
type PayloadTime = {
|
|
514
|
-
readonly start: number;
|
|
515
|
-
readonly finish: number;
|
|
516
|
-
readonly duration: number;
|
|
517
|
-
readonly processing: number;
|
|
518
|
-
readonly date_start: string;
|
|
519
|
-
readonly date_finish: string;
|
|
520
|
-
};
|
|
521
|
-
type GetPayload<P> = {
|
|
522
|
-
readonly result: P;
|
|
523
|
-
readonly time: PayloadTime;
|
|
524
|
-
};
|
|
525
|
-
type ListPayload<P> = {
|
|
526
|
-
readonly result: any | P[];
|
|
527
|
-
readonly error?: string;
|
|
528
|
-
readonly total: number;
|
|
529
|
-
readonly next?: number;
|
|
530
|
-
readonly time: PayloadTime;
|
|
531
|
-
};
|
|
532
|
-
type BatchPayload<C> = {
|
|
533
|
-
readonly result: {
|
|
534
|
-
readonly result: {
|
|
535
|
-
readonly [P in keyof C]?: C[P];
|
|
536
|
-
} | ReadonlyArray<C[keyof C]>;
|
|
537
|
-
readonly result_error: {
|
|
538
|
-
readonly [P in keyof C]?: string;
|
|
539
|
-
} | readonly string[];
|
|
540
|
-
readonly result_total: {
|
|
541
|
-
readonly [P in keyof C]?: number;
|
|
542
|
-
} | readonly number[];
|
|
543
|
-
readonly result_next: {
|
|
544
|
-
readonly [P in keyof C]?: number;
|
|
545
|
-
} | readonly number[];
|
|
546
|
-
readonly result_time: {
|
|
547
|
-
readonly [P in keyof C]?: PayloadTime;
|
|
548
|
-
} | readonly PayloadTime[];
|
|
549
|
-
};
|
|
550
|
-
readonly time: PayloadTime;
|
|
551
|
-
};
|
|
552
|
-
type Payload<P> = GetPayload<P> | ListPayload<P> | BatchPayload<P>;
|
|
553
|
-
|
|
554
|
-
type AjaxQuery = Readonly<{
|
|
555
|
-
method: string;
|
|
556
|
-
params: Readonly<object>;
|
|
557
|
-
start: number;
|
|
558
|
-
}>;
|
|
559
|
-
type AjaxResultParams<T = unknown> = Readonly<{
|
|
560
|
-
error?: string | {
|
|
561
|
-
error: string;
|
|
562
|
-
error_description?: string;
|
|
563
|
-
};
|
|
564
|
-
error_description?: string;
|
|
565
|
-
result: T;
|
|
566
|
-
next?: NumberString;
|
|
567
|
-
total?: NumberString;
|
|
568
|
-
time: PayloadTime;
|
|
569
|
-
}>;
|
|
570
|
-
type AjaxResultOptions<T> = Readonly<{
|
|
571
|
-
answer: AjaxResultParams<T>;
|
|
572
|
-
query: AjaxQuery;
|
|
573
|
-
status: number;
|
|
574
|
-
}>;
|
|
575
|
-
/**
|
|
576
|
-
* Result of request to Rest Api
|
|
577
|
-
*/
|
|
578
|
-
declare class AjaxResult<T = unknown> extends Result<Payload<T>> implements IResult<Payload<T>> {
|
|
579
|
-
#private;
|
|
580
|
-
private readonly _status;
|
|
581
|
-
private readonly _query;
|
|
582
|
-
protected _data: AjaxResultParams<T>;
|
|
583
|
-
constructor(options: AjaxResultOptions<T>);
|
|
584
|
-
getData(): Payload<T>;
|
|
585
|
-
/**
|
|
586
|
-
* Alias for isMore
|
|
587
|
-
*/
|
|
588
|
-
hasMore(): boolean;
|
|
589
|
-
isMore(): boolean;
|
|
590
|
-
getTotal(): number;
|
|
591
|
-
getStatus(): number;
|
|
592
|
-
getQuery(): Readonly<AjaxQuery>;
|
|
593
|
-
/**
|
|
594
|
-
* Alias for getNext
|
|
595
|
-
* @param http
|
|
596
|
-
*/
|
|
597
|
-
fetchNext(http: TypeHttp): Promise<AjaxResult<T> | null>;
|
|
598
|
-
getNext(http: TypeHttp): Promise<AjaxResult<T> | false>;
|
|
599
|
-
setData(): never;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
type TypeHttp = {
|
|
603
|
-
setLogger(logger: LoggerBrowser): void;
|
|
604
|
-
getLogger(): LoggerBrowser;
|
|
605
|
-
batch(calls: any[] | object, isHaltOnError: boolean, returnAjaxResult: boolean): Promise<Result>;
|
|
606
|
-
call(method: string, params: object, start: number): Promise<AjaxResult>;
|
|
607
|
-
setRestrictionManagerParams(params: TypeRestrictionManagerParams): void;
|
|
608
|
-
getRestrictionManagerParams(): TypeRestrictionManagerParams;
|
|
609
|
-
setLogTag(logTag?: string): void;
|
|
610
|
-
clearLogTag(): void;
|
|
611
|
-
/**
|
|
612
|
-
* On|Off warning about client-side query execution
|
|
613
|
-
* @param {boolean} value
|
|
614
|
-
* @param {string} message
|
|
615
|
-
*/
|
|
616
|
-
setClientSideWarning(value: boolean, message: string): void;
|
|
617
|
-
};
|
|
618
|
-
interface IRequestIdGenerator {
|
|
619
|
-
getRequestId(): string;
|
|
620
|
-
getHeaderFieldName(): string;
|
|
621
|
-
getQueryStringParameterName(): string;
|
|
622
|
-
getQueryStringSdkParameterName(): string;
|
|
623
|
-
}
|
|
624
|
-
type TypeRestrictionManagerParams = {
|
|
625
|
-
sleep: number;
|
|
626
|
-
speed: number;
|
|
627
|
-
amount: number;
|
|
628
|
-
};
|
|
629
|
-
declare const RestrictionManagerParamsBase: TypeRestrictionManagerParams;
|
|
630
|
-
/**
|
|
631
|
-
* @todo Need test
|
|
632
|
-
*/
|
|
633
|
-
declare const RestrictionManagerParamsForEnterprise: TypeRestrictionManagerParams;
|
|
634
|
-
|
|
635
1065
|
/**
|
|
636
1066
|
* Special cases of data passed to handlers
|
|
637
1067
|
* @todo add docs
|
|
@@ -798,232 +1228,1501 @@ declare enum TypeOption {
|
|
|
798
1228
|
StringVal = "string"
|
|
799
1229
|
}
|
|
800
1230
|
|
|
801
|
-
type TypeDescriptionError = {
|
|
802
|
-
readonly error: 'invalid_token' | 'expired_token' | string;
|
|
803
|
-
readonly error_description: string;
|
|
804
|
-
};
|
|
805
|
-
/**
|
|
806
|
-
* Parameters for hook
|
|
807
|
-
*/
|
|
808
|
-
type B24HookParams = {
|
|
809
|
-
/**
|
|
810
|
-
* https://your-bitrix-portal.bitrix24.com
|
|
811
|
-
*/
|
|
812
|
-
b24Url: string;
|
|
813
|
-
userId: number;
|
|
814
|
-
secret: string;
|
|
815
|
-
};
|
|
816
1231
|
/**
|
|
817
|
-
*
|
|
1232
|
+
* @todo docs
|
|
818
1233
|
*/
|
|
819
|
-
type B24FrameQueryParams = {
|
|
820
|
-
DOMAIN: string | null | undefined;
|
|
821
|
-
PROTOCOL: boolean | null | undefined;
|
|
822
|
-
LANG: string | null | undefined;
|
|
823
|
-
APP_SID: string | null | undefined;
|
|
824
|
-
};
|
|
825
1234
|
/**
|
|
826
|
-
*
|
|
1235
|
+
* Settings for operating limiting
|
|
827
1236
|
*/
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
1237
|
+
interface OperatingLimitConfig {
|
|
1238
|
+
/**
|
|
1239
|
+
* Operating limit time period in milliseconds
|
|
1240
|
+
* Default: 10 minutes (600_000 ms)
|
|
1241
|
+
*/
|
|
1242
|
+
windowMs: number;
|
|
1243
|
+
/**
|
|
1244
|
+
* Maximum total execution time (operating) in milliseconds
|
|
1245
|
+
* Default: 480 seconds (480_000 ms)
|
|
1246
|
+
* When calculating the operating limit, we will use 5 seconds less
|
|
1247
|
+
* @see Http.getTimeToFree
|
|
1248
|
+
*/
|
|
1249
|
+
limitMs: number;
|
|
1250
|
+
/**
|
|
1251
|
+
* Threshold for notifications about heavy queries (%)
|
|
1252
|
+
*/
|
|
1253
|
+
heavyPercent: number;
|
|
1254
|
+
}
|
|
832
1255
|
/**
|
|
833
|
-
*
|
|
834
|
-
* @memo We get from b24 event this data
|
|
1256
|
+
* Adaptive pause settings
|
|
835
1257
|
*/
|
|
836
|
-
interface
|
|
1258
|
+
interface AdaptiveConfig {
|
|
837
1259
|
/**
|
|
838
|
-
*
|
|
1260
|
+
* Threshold for heavy queries (%)
|
|
1261
|
+
* Default: 80% - this means that `operating >= 384`
|
|
1262
|
+
* Specifies what % of `operatingLimit.limitMs` in `operating` should pause.
|
|
839
1263
|
*/
|
|
840
|
-
|
|
1264
|
+
thresholdPercent: number;
|
|
841
1265
|
/**
|
|
842
|
-
*
|
|
1266
|
+
* Pause multiplier
|
|
1267
|
+
* Default: 0.01 - 0.002 will result in a 1.2-second pause with increasing load
|
|
1268
|
+
* If: operating_reset_at > Date.now()
|
|
1269
|
+
* Then: Pause = (operating_reset_at - Date.now()) * coefficient
|
|
1270
|
+
* Otherwise: Pause = 7_000
|
|
1271
|
+
* There's no point in specifying a value close to 1, as this will create unnecessary delays.
|
|
1272
|
+
* In other words: if coefficient === 1, the pause will last until the blocking is unblocked, and our code hasn't yet reached the limits.
|
|
1273
|
+
* It's important to understand that the goal of adaptive blocking is to smoothly reduce the 'operating' of heavy queries.
|
|
843
1274
|
*/
|
|
844
|
-
|
|
1275
|
+
coefficient: number;
|
|
845
1276
|
/**
|
|
846
|
-
*
|
|
1277
|
+
* Maximum pause (ms)
|
|
1278
|
+
* Default: 7_000 ms
|
|
1279
|
+
* Limits the maximum estimated pause time
|
|
847
1280
|
*/
|
|
848
|
-
|
|
1281
|
+
maxDelay: number;
|
|
849
1282
|
/**
|
|
850
|
-
*
|
|
1283
|
+
* Whether adaptive pause is enabled
|
|
1284
|
+
* Default: true
|
|
851
1285
|
*/
|
|
852
|
-
|
|
1286
|
+
enabled: boolean;
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* Rate limiting settings (Leaky Bucket)
|
|
1290
|
+
*/
|
|
1291
|
+
interface RateLimitConfig {
|
|
853
1292
|
/**
|
|
854
|
-
*
|
|
1293
|
+
* X - limit before blocking (bucket capacity)
|
|
1294
|
+
* For standard plans: 50
|
|
1295
|
+
* For Enterprise: 250
|
|
855
1296
|
*/
|
|
856
|
-
|
|
1297
|
+
burstLimit: number;
|
|
857
1298
|
/**
|
|
858
|
-
*
|
|
1299
|
+
* Y - leak rate (requests per second)
|
|
1300
|
+
* For standard plans: 2
|
|
1301
|
+
* For Enterprise: 5
|
|
859
1302
|
*/
|
|
860
|
-
|
|
1303
|
+
drainRate: number;
|
|
861
1304
|
/**
|
|
862
|
-
*
|
|
1305
|
+
* Whether adaptive control is enabled
|
|
1306
|
+
* Default: true
|
|
863
1307
|
*/
|
|
864
|
-
|
|
1308
|
+
adaptiveEnabled: boolean;
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Parameters for managing all types of restrictions
|
|
1312
|
+
*/
|
|
1313
|
+
interface RestrictionParams {
|
|
1314
|
+
rateLimit?: RateLimitConfig;
|
|
1315
|
+
operatingLimit?: OperatingLimitConfig;
|
|
1316
|
+
adaptiveConfig?: AdaptiveConfig;
|
|
865
1317
|
/**
|
|
866
|
-
*
|
|
1318
|
+
* Maximum number of retries
|
|
1319
|
+
* Default: 3
|
|
867
1320
|
*/
|
|
868
|
-
|
|
1321
|
+
maxRetries?: number;
|
|
869
1322
|
/**
|
|
870
|
-
*
|
|
1323
|
+
* Base delay between retries (ms)
|
|
1324
|
+
* Default: 1_000
|
|
871
1325
|
*/
|
|
872
|
-
|
|
1326
|
+
retryDelay?: number;
|
|
1327
|
+
}
|
|
1328
|
+
/**
|
|
1329
|
+
* Limiter operation statistics
|
|
1330
|
+
*/
|
|
1331
|
+
interface RestrictionManagerStats {
|
|
1332
|
+
/** Retries */
|
|
1333
|
+
retries: number;
|
|
1334
|
+
/** Consecutive errors */
|
|
1335
|
+
consecutiveErrors: number;
|
|
1336
|
+
/** Limit hits */
|
|
1337
|
+
limitHits: number;
|
|
1338
|
+
/** Current number of tokens */
|
|
1339
|
+
tokens: number;
|
|
1340
|
+
/** Adaptive delays */
|
|
1341
|
+
adaptiveDelays: number;
|
|
1342
|
+
/** Total time of adaptive delays */
|
|
1343
|
+
totalAdaptiveDelay: number;
|
|
1344
|
+
/** Heavy requests */
|
|
1345
|
+
heavyRequestCount: number;
|
|
1346
|
+
/** Method statistics in seconds */
|
|
1347
|
+
operatingStats: {
|
|
1348
|
+
[method: string]: number;
|
|
1349
|
+
};
|
|
1350
|
+
}
|
|
1351
|
+
interface ILimiter {
|
|
1352
|
+
getTitle(): string;
|
|
1353
|
+
setConfig(config: any): Promise<void>;
|
|
1354
|
+
setLogger(logger: LoggerInterface): void;
|
|
1355
|
+
getLogger(): LoggerInterface;
|
|
1356
|
+
canProceed(requestId: string, method: string, params?: any): Promise<boolean>;
|
|
1357
|
+
waitIfNeeded(requestId: string, method: string, params?: any): Promise<number>;
|
|
1358
|
+
updateStats(requestId: string, method: string, data: any): Promise<void>;
|
|
1359
|
+
reset(): Promise<void>;
|
|
1360
|
+
getStats(): Record<string, any>;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
/**
|
|
1364
|
+
* Abstract Class for working with actions
|
|
1365
|
+
*/
|
|
1366
|
+
type ActionOptions = {
|
|
1367
|
+
[key: string]: any;
|
|
1368
|
+
};
|
|
1369
|
+
declare abstract class AbstractAction {
|
|
1370
|
+
protected _b24: TypeB24;
|
|
1371
|
+
protected _logger: LoggerInterface;
|
|
1372
|
+
constructor(b24: TypeB24, logger: LoggerInterface);
|
|
1373
|
+
abstract make(options?: ActionOptions): AsyncGenerator | Promise<unknown>;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
type ActionCallV2 = ActionOptions & {
|
|
1377
|
+
method: string;
|
|
1378
|
+
params?: TypeCallParams;
|
|
1379
|
+
requestId?: string;
|
|
1380
|
+
};
|
|
1381
|
+
/**
|
|
1382
|
+
* Calls the Bitrix24 REST API method `restApi:v2`
|
|
1383
|
+
*
|
|
1384
|
+
* @todo add docs
|
|
1385
|
+
*/
|
|
1386
|
+
declare class CallV2 extends AbstractAction {
|
|
873
1387
|
/**
|
|
874
|
-
*
|
|
1388
|
+
* Calls the Bitrix24 REST API method.
|
|
1389
|
+
*
|
|
1390
|
+
* @template T - The expected data type in the response (default is `unknown`).
|
|
1391
|
+
*
|
|
1392
|
+
* @param {ActionCallV2} options - parameters for executing the request.
|
|
1393
|
+
* - `method: string` - REST API method name (eg: `crm.item.get`)
|
|
1394
|
+
* - `params?: TypeCallParams` - Parameters for calling the method.
|
|
1395
|
+
* - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.
|
|
1396
|
+
*
|
|
1397
|
+
* @returns {Promise<AjaxResult<T>>} A promise that resolves to the result of an REST API call.
|
|
1398
|
+
*
|
|
1399
|
+
* @example
|
|
1400
|
+
* import { EnumCrmEntityTypeId } from '@bitrix24/b24jssdk'
|
|
1401
|
+
*
|
|
1402
|
+
* interface CrmItem { id: number, name: string, lastName: string }
|
|
1403
|
+
* const response = await b24.actions.v2.call.make<{ item: CrmItem }>({
|
|
1404
|
+
* method: 'crm.item.get',
|
|
1405
|
+
* params: {
|
|
1406
|
+
* entityTypeId: EnumCrmEntityTypeId.contact,
|
|
1407
|
+
* id: 123
|
|
1408
|
+
* },
|
|
1409
|
+
* requestId: 'item-123'
|
|
1410
|
+
* })
|
|
1411
|
+
* if (!response.isSuccess) {
|
|
1412
|
+
* throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
|
|
1413
|
+
* }
|
|
1414
|
+
* console.log(response.getData().result.item.name)
|
|
1415
|
+
*/
|
|
1416
|
+
make<T = unknown>(options: ActionCallV2): Promise<AjaxResult<T>>;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
type ActionCallListV2 = ActionOptions & {
|
|
1420
|
+
method: string;
|
|
1421
|
+
params?: Omit<TypeCallParams, 'start'>;
|
|
1422
|
+
idKey?: string;
|
|
1423
|
+
customKeyForResult?: string;
|
|
1424
|
+
requestId?: string;
|
|
1425
|
+
};
|
|
1426
|
+
/**
|
|
1427
|
+
* Fast data retrieval without counting the total number of records. `restApi:v2`
|
|
1428
|
+
*
|
|
1429
|
+
* @todo add docs
|
|
1430
|
+
*/
|
|
1431
|
+
declare class CallListV2 extends AbstractAction {
|
|
1432
|
+
/**
|
|
1433
|
+
* Fast data retrieval without counting the total number of records.
|
|
1434
|
+
*
|
|
1435
|
+
* @template T - The type of the elements of the returned array (default is `unknown`).
|
|
1436
|
+
*
|
|
1437
|
+
* @param {ActionCallListV2} options - parameters for executing the request.
|
|
1438
|
+
* - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
|
|
1439
|
+
* - `params?: Omit<TypeCallParams, 'start'>` - Request parameters, excluding the `start` parameter,
|
|
1440
|
+
* since the method is designed to obtain all data in one call.
|
|
1441
|
+
* Note: Use `filter`, `order`, and `select` to control the selection.
|
|
1442
|
+
* - `idKey?: string` - The name of the field containing the unique identifier of the element.
|
|
1443
|
+
* Default is 'ID' (uppercase). Alternatively, it can be 'id' (lowercase).
|
|
1444
|
+
* or another field, depending on the REST API data structure.
|
|
1445
|
+
* - `customKeyForResult?: string` - A custom key indicating that the response REST API will be
|
|
1446
|
+
* grouped by this field.
|
|
1447
|
+
* Example: `items` to group a list of CRM items.
|
|
1448
|
+
* - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.
|
|
1449
|
+
*
|
|
1450
|
+
* @returns {Promise<Result<T[]>>} A promise that resolves to the result of an REST API call.
|
|
1451
|
+
*
|
|
1452
|
+
* @example
|
|
1453
|
+
* import { EnumCrmEntityTypeId, Text } from '@bitrix24/b24jssdk'
|
|
1454
|
+
*
|
|
1455
|
+
* interface CrmItem { id: number, title: string }
|
|
1456
|
+
* const sixMonthAgo = new Date()
|
|
1457
|
+
* sixMonthAgo.setMonth((new Date()).getMonth() - 6)
|
|
1458
|
+
* sixMonthAgo.setHours(0, 0, 0)
|
|
1459
|
+
* const response = await b24.actions.v2.callList.make<CrmItem>({
|
|
1460
|
+
* method: 'crm.item.list',
|
|
1461
|
+
* params: {
|
|
1462
|
+
* entityTypeId: EnumCrmEntityTypeId.company,
|
|
1463
|
+
* filter: {
|
|
1464
|
+
* '=%title': 'A%',
|
|
1465
|
+
* '>=createdTime': Text.toB24Format(sixMonthAgo) // created at least 6 months ago
|
|
1466
|
+
* },
|
|
1467
|
+
* select: ['id', 'title']
|
|
1468
|
+
* },
|
|
1469
|
+
* idKey: 'id',
|
|
1470
|
+
* customKeyForResult: 'items',
|
|
1471
|
+
* requestId: 'list-123'
|
|
1472
|
+
* })
|
|
1473
|
+
* if (!response.isSuccess) {
|
|
1474
|
+
* throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
|
|
1475
|
+
* }
|
|
1476
|
+
* const list = response.getData()
|
|
1477
|
+
* console.log(`Result: ${list?.length}`) // Number of items received
|
|
1478
|
+
*/
|
|
1479
|
+
make<T = unknown>(options: ActionCallListV2): Promise<Result<T[]>>;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
type ActionFetchListV2 = ActionOptions & {
|
|
1483
|
+
method: string;
|
|
1484
|
+
params?: Omit<TypeCallParams, 'start'>;
|
|
1485
|
+
idKey?: string;
|
|
1486
|
+
customKeyForResult?: string;
|
|
1487
|
+
requestId?: string;
|
|
1488
|
+
};
|
|
1489
|
+
/**
|
|
1490
|
+
* Calls a REST API list method and returns an async generator for efficient large data retrieval. `restApi:v2`
|
|
1491
|
+
*
|
|
1492
|
+
* @todo add docs
|
|
1493
|
+
*/
|
|
1494
|
+
declare class FetchListV2 extends AbstractAction {
|
|
1495
|
+
/**
|
|
1496
|
+
* Calls a REST API list method and returns an async generator for efficient large data retrieval.
|
|
1497
|
+
* Implements the fast algorithm for iterating over large datasets without loading all data into memory at once.
|
|
1498
|
+
*
|
|
1499
|
+
* @template T - The type of items in the returned arrays (default is `unknown`).
|
|
1500
|
+
*
|
|
1501
|
+
* @param {ActionFetchListV2} options - parameters for executing the request.
|
|
1502
|
+
* - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
|
|
1503
|
+
* - `params?: Omit<TypeCallParams, 'start'>` - Request parameters, excluding the `start` parameter,
|
|
1504
|
+
* since the method is designed to obtain all data in one call.
|
|
1505
|
+
* Note: Use `filter`, `order`, and `select` to control the selection.
|
|
1506
|
+
* - `idKey?: string` - The name of the field containing the unique identifier of the element.
|
|
1507
|
+
* Default is 'ID' (uppercase). Alternatively, it can be 'id' (lowercase).
|
|
1508
|
+
* or another field, depending on the REST API data structure.
|
|
1509
|
+
* - `customKeyForResult?: string` - A custom key indicating that the response REST API will be
|
|
1510
|
+
* grouped by this field.
|
|
1511
|
+
* Example: `items` to group a list of CRM items.
|
|
1512
|
+
* - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.
|
|
1513
|
+
*
|
|
1514
|
+
* @returns {AsyncGenerator<T[]>} An async generator that yields chunks of data as arrays of type `T`.
|
|
1515
|
+
* Each iteration returns the next page/batch of results until all data is fetched.
|
|
1516
|
+
*
|
|
1517
|
+
* @example
|
|
1518
|
+
* import { EnumCrmEntityTypeId, Text } from '@bitrix24/b24jssdk'
|
|
1519
|
+
*
|
|
1520
|
+
* interface CrmItem { id: number, title: string }
|
|
1521
|
+
* const sixMonthAgo = new Date()
|
|
1522
|
+
* sixMonthAgo.setMonth((new Date()).getMonth() - 6)
|
|
1523
|
+
* sixMonthAgo.setHours(0, 0, 0)
|
|
1524
|
+
* const generator = b24.actions.v2.fetchList.make<CrmItem>({
|
|
1525
|
+
* method: 'crm.item.list',
|
|
1526
|
+
* params: {
|
|
1527
|
+
* entityTypeId: EnumCrmEntityTypeId.company,
|
|
1528
|
+
* filter: {
|
|
1529
|
+
* '=%title': 'A%',
|
|
1530
|
+
* '>=createdTime': Text.toB24Format(sixMonthAgo) // created at least 6 months ago
|
|
1531
|
+
* },
|
|
1532
|
+
* select: ['id', 'title']
|
|
1533
|
+
* },
|
|
1534
|
+
* idKey: 'id',
|
|
1535
|
+
* customKeyForResult: 'items',
|
|
1536
|
+
* requestId: 'list-123'
|
|
1537
|
+
* })
|
|
1538
|
+
*
|
|
1539
|
+
* for await (const chunk of generator) {
|
|
1540
|
+
* // Process chunk (e.g., save to database, analyze, etc.)
|
|
1541
|
+
* console.log(`Processing ${chunk.length} items`)
|
|
1542
|
+
* }
|
|
1543
|
+
*
|
|
1544
|
+
* @see {@link https://apidocs.bitrix24.com/settings/performance/huge-data.html Bitrix24: Fast algorithm for large data}
|
|
875
1545
|
*/
|
|
876
|
-
|
|
1546
|
+
make<T = unknown>(options: ActionFetchListV2): AsyncGenerator<T[]>;
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
declare abstract class AbstractBatch extends AbstractAction {
|
|
1550
|
+
protected _addBatchErrorsIfAny(response: Result<ICallBatchResult<any>>, result: Result): void;
|
|
1551
|
+
protected _processBatchResponse<T>(response: Result<ICallBatchResult<T>>, calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal, options: IB24BatchOptions): CallBatchResult<T>;
|
|
1552
|
+
protected _createBatchResultWithAjax<T>(response: Result<ICallBatchResult<T>>, isArrayCall: boolean): CallBatchResult<T>;
|
|
1553
|
+
protected _createBatchArrayResult<T>(response: Result<ICallBatchResult<T>>): Result<AjaxResult<T>[]>;
|
|
1554
|
+
protected _createBatchObjectResult<T>(response: Result<ICallBatchResult<T>>): Result<Record<string | number, AjaxResult<T>>>;
|
|
1555
|
+
protected _createBatchResultSimple<T>(response: Result<ICallBatchResult<T>>, isArrayCall: boolean): CallBatchResult<T>;
|
|
1556
|
+
protected _extractBatchSimpleData<T>(response: Result<ICallBatchResult<T>>, isArrayCall: boolean): T;
|
|
1557
|
+
chunkArray<T = unknown>(array: Array<T>, chunkSize?: number): T[][];
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
type ActionBatchV2 = ActionOptions & {
|
|
1561
|
+
calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal;
|
|
1562
|
+
options?: IB24BatchOptions;
|
|
1563
|
+
};
|
|
1564
|
+
/**
|
|
1565
|
+
* Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50. `restApi:v2`
|
|
1566
|
+
* Allows you to execute multiple requests in a single API call, significantly improving performance.
|
|
1567
|
+
*
|
|
1568
|
+
* @todo add docs
|
|
1569
|
+
*/
|
|
1570
|
+
declare class BatchV2 extends AbstractBatch {
|
|
877
1571
|
/**
|
|
878
|
-
*
|
|
1572
|
+
* Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50.
|
|
1573
|
+
* Allows you to execute multiple requests in a single API call, significantly improving performance.
|
|
1574
|
+
*
|
|
1575
|
+
* @template T - The data type returned by batch query commands (default is `unknown`)
|
|
1576
|
+
*
|
|
1577
|
+
* @param {ActionBatchV2} options - parameters for executing the request.
|
|
1578
|
+
* - `calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal` - Commands to execute in a batch.
|
|
1579
|
+
* Supports several formats:
|
|
1580
|
+
* 1. Array of tuples: `[['method1', params1], ['method2', params2], ...]`
|
|
1581
|
+
* 2. Array of objects: `[{ method: 'method1', params: params1 }, { method: 'method2', params: params2 }, ...]`
|
|
1582
|
+
* 3. An object with named commands: `{ cmd1: { method: 'method1', params: params1 }, cmd2: ['method2', params2], ...}`
|
|
1583
|
+
* - `options?: IB24BatchOptions` - Additional options for executing a batch request.
|
|
1584
|
+
* - `isHaltOnError?: boolean` - Whether to stop execution on the first error (default: true)
|
|
1585
|
+
* - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)
|
|
1586
|
+
* - `returnAjaxResult?: boolean` - Whether to return an AjaxResult object instead of data (default: false)
|
|
1587
|
+
*
|
|
1588
|
+
* @returns {Promise<CallBatchResult<T>>} A promise that is resolved by the result of executing a batch request:
|
|
1589
|
+
* - On success: a `Result` object with the command execution results
|
|
1590
|
+
* - The structure of the results depends on the format of the `calls` input data:
|
|
1591
|
+
* - For an array of commands, an array of results in the same order
|
|
1592
|
+
* - For named commands, an object with keys corresponding to the command names
|
|
1593
|
+
*
|
|
1594
|
+
* @example
|
|
1595
|
+
* import { EnumCrmEntityTypeId } from '@bitrix24/b24jssdk'
|
|
1596
|
+
*
|
|
1597
|
+
* interface Contact { id: number, name: string }
|
|
1598
|
+
* const response = await b24.actions.v2.batch.make<{ item: Contact }>({
|
|
1599
|
+
* calls: [
|
|
1600
|
+
* ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: 1 }],
|
|
1601
|
+
* ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: 2 }],
|
|
1602
|
+
* ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: 3 }]
|
|
1603
|
+
* ],
|
|
1604
|
+
* options: {
|
|
1605
|
+
* isHaltOnError: true,
|
|
1606
|
+
* returnAjaxResult: true,
|
|
1607
|
+
* requestId: 'batch-123'
|
|
1608
|
+
* }
|
|
1609
|
+
* })
|
|
1610
|
+
* if (!response.isSuccess) {
|
|
1611
|
+
* throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
|
|
1612
|
+
* }
|
|
1613
|
+
*
|
|
1614
|
+
* const resultData = (response as Result<AjaxResult<{ item: Contact }>[]>).getData()
|
|
1615
|
+
* resultData.forEach((resultRow, index) => {
|
|
1616
|
+
* if (resultRow.isSuccess) {
|
|
1617
|
+
* console.log(`Item ${index + 1}:`, resultRow.getData().result.item)
|
|
1618
|
+
* }
|
|
1619
|
+
* })
|
|
1620
|
+
*
|
|
1621
|
+
* @example
|
|
1622
|
+
* import { EnumCrmEntityTypeId } from '@bitrix24/b24jssdk'
|
|
1623
|
+
*
|
|
1624
|
+
* const response = await b24.actions.v2.batch.make({
|
|
1625
|
+
* calls: [
|
|
1626
|
+
* { method: 'crm.item.get', params: { entityTypeId: EnumCrmEntityTypeId.contact, id: 1 } },
|
|
1627
|
+
* { method: 'crm.item.get', params: { entityTypeId: EnumCrmEntityTypeId.contact, id: 2 } }
|
|
1628
|
+
* ],
|
|
1629
|
+
* options: {
|
|
1630
|
+
* isHaltOnError: true,
|
|
1631
|
+
* returnAjaxResult: true,
|
|
1632
|
+
* requestId: 'batch-123'
|
|
1633
|
+
* }
|
|
1634
|
+
* })
|
|
1635
|
+
* if (!response.isSuccess) {
|
|
1636
|
+
* throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
|
|
1637
|
+
* }
|
|
1638
|
+
*
|
|
1639
|
+
* @example
|
|
1640
|
+
* import { EnumCrmEntityTypeId } from '@bitrix24/b24jssdk'
|
|
1641
|
+
*
|
|
1642
|
+
* interface Contact { id: number, name: string }
|
|
1643
|
+
* interface Deal { id: number, title: string }
|
|
1644
|
+
* const response = await b24.actions.v2.batch.make<{ item: Contact } | { item: Deal }>({
|
|
1645
|
+
* calls: {
|
|
1646
|
+
* Contact: { method: 'crm.item.get', params: { entityTypeId: EnumCrmEntityTypeId.contact, id: 1 } },
|
|
1647
|
+
* Deal: ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.deal, id: 2 }]
|
|
1648
|
+
* },
|
|
1649
|
+
* options: {
|
|
1650
|
+
* isHaltOnError: true,
|
|
1651
|
+
* returnAjaxResult: true,
|
|
1652
|
+
* requestId: 'batch-123'
|
|
1653
|
+
* }
|
|
1654
|
+
* })
|
|
1655
|
+
* if (!response.isSuccess) {
|
|
1656
|
+
* throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
|
|
1657
|
+
* }
|
|
1658
|
+
*
|
|
1659
|
+
* const results = response.getData() as Record<string, AjaxResult<{ item: Contact } | { item: Deal }>>
|
|
1660
|
+
* console.log('Contact:', results.Contact.getData().result.item as Contact)
|
|
1661
|
+
* console.log('Deal:', results.Deal.getData().result.item as Deal)
|
|
1662
|
+
*
|
|
1663
|
+
* @warning The maximum number of commands in one batch request is 50.
|
|
1664
|
+
* @note A batch request executes faster than sequential single calls,
|
|
1665
|
+
* but if one command fails, the entire batch may fail
|
|
1666
|
+
* (depending on API settings and options).
|
|
879
1667
|
*/
|
|
880
|
-
|
|
1668
|
+
make<T = unknown>(options: ActionBatchV2): Promise<CallBatchResult<T>>;
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
type ActionBatchByChunkV2 = ActionOptions & {
|
|
1672
|
+
calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal;
|
|
1673
|
+
options?: Omit<IB24BatchOptions, 'returnAjaxResult'>;
|
|
1674
|
+
};
|
|
1675
|
+
/**
|
|
1676
|
+
* Executes a batch request with automatic chunking for any number of commands. `restApi:v2`
|
|
1677
|
+
*
|
|
1678
|
+
* @todo add docs
|
|
1679
|
+
*/
|
|
1680
|
+
declare class BatchByChunkV2 extends AbstractBatch {
|
|
1681
|
+
/**
|
|
1682
|
+
* Executes a batch request with automatic chunking for any number of commands.
|
|
1683
|
+
* Unlike `BatchV2`, which is limited to 50 commands, this method automatically splits
|
|
1684
|
+
* a large set of commands into multiple batches and executes them sequentially.
|
|
1685
|
+
*
|
|
1686
|
+
* @template T - The data type returned by commands (default: `unknown`)
|
|
1687
|
+
*
|
|
1688
|
+
* @param {ActionBatchByChunkV2} options - parameters for executing the request.
|
|
1689
|
+
* - `calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal` - Commands to execute in a batch.
|
|
1690
|
+
* Supports several formats:
|
|
1691
|
+
* 1. Array of tuples: `[['method1', params1], ['method2', params2], ...]`
|
|
1692
|
+
* 2. Array of objects: `[{ method: 'method1', params: params1 }, { method: 'method2', params: params2 }, ...]`
|
|
1693
|
+
* - Note: Named commands are not supported as they are difficult to process when chunking.
|
|
1694
|
+
* - `options?: Omit<IB24BatchOptions, 'returnAjaxResult'>` - Additional options for executing a batch request.
|
|
1695
|
+
* - `isHaltOnError?: boolean` - Whether to stop execution on the first error (default: true)
|
|
1696
|
+
* - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)
|
|
1697
|
+
*
|
|
1698
|
+
* @returns {Promise<Result<T[]>>} A promise that is resolved by the result of executing all commands.
|
|
1699
|
+
*
|
|
1700
|
+
* @example
|
|
1701
|
+
* import { EnumCrmEntityTypeId, Text } from '@bitrix24/b24jssdk'
|
|
1702
|
+
*
|
|
1703
|
+
* interface Contact { id: number, name: string }
|
|
1704
|
+
* const commands = Array.from({ length: 150 }, (_, i) =>
|
|
1705
|
+
* ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: i + 1 }]
|
|
1706
|
+
* )
|
|
1707
|
+
*
|
|
1708
|
+
* const response = await b24.actions.v2.batchByChunk.make<{ item: Contact }>({
|
|
1709
|
+
* calls: commands,
|
|
1710
|
+
* options: {
|
|
1711
|
+
* isHaltOnError: false,
|
|
1712
|
+
* requestId: 'batch-by-chunk-123'
|
|
1713
|
+
* }
|
|
1714
|
+
* })
|
|
1715
|
+
* if (!response.isSuccess) {
|
|
1716
|
+
* throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
|
|
1717
|
+
* }
|
|
1718
|
+
*
|
|
1719
|
+
* const resultData = response.getData()
|
|
1720
|
+
* const items: Contact[] = []
|
|
1721
|
+
* resultData.forEach((chunkRow) => {
|
|
1722
|
+
* items.push(chunkRow.item)
|
|
1723
|
+
* })
|
|
1724
|
+
* console.log(`Successfully retrieved ${items.length} items`)
|
|
1725
|
+
*
|
|
1726
|
+
* @tip For very large command sets, consider using server-side task queues instead of bulk batch requests.
|
|
1727
|
+
*/
|
|
1728
|
+
make<T = unknown>(options: ActionBatchByChunkV2): Promise<Result<T[]>>;
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
/**
|
|
1732
|
+
* Some actions for TypeB24 by Api:v2
|
|
1733
|
+
*/
|
|
1734
|
+
declare class ActionsManagerV2 {
|
|
1735
|
+
protected _b24: TypeB24;
|
|
1736
|
+
protected _logger: LoggerInterface;
|
|
1737
|
+
protected _mapActions: Map<symbol, AbstractAction>;
|
|
1738
|
+
constructor(b24: TypeB24);
|
|
1739
|
+
setLogger(logger: LoggerInterface): void;
|
|
1740
|
+
getLogger(): LoggerInterface;
|
|
1741
|
+
get call(): CallV2;
|
|
1742
|
+
get callList(): CallListV2;
|
|
1743
|
+
get fetchList(): FetchListV2;
|
|
1744
|
+
get batch(): BatchV2;
|
|
1745
|
+
get batchByChunk(): BatchByChunkV2;
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
type ActionCallV3 = ActionOptions & {
|
|
1749
|
+
method: string;
|
|
1750
|
+
params?: TypeCallParams;
|
|
1751
|
+
requestId?: string;
|
|
1752
|
+
};
|
|
1753
|
+
/**
|
|
1754
|
+
* Calls the Bitrix24 REST API method `restApi:v3`
|
|
1755
|
+
*
|
|
1756
|
+
* @todo add docs
|
|
1757
|
+
*/
|
|
1758
|
+
declare class CallV3 extends AbstractAction {
|
|
1759
|
+
/**
|
|
1760
|
+
* Calls the Bitrix24 REST API method.
|
|
1761
|
+
*
|
|
1762
|
+
* @template T - The expected data type in the response (default is `unknown`).
|
|
1763
|
+
*
|
|
1764
|
+
* @param {ActionCallV3} options - parameters for executing the request.
|
|
1765
|
+
* - `method: string` - REST API method name (eg: `crm.item.get`)
|
|
1766
|
+
* - `params?: TypeCallParams` - Parameters for calling the method.
|
|
1767
|
+
* - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.
|
|
1768
|
+
*
|
|
1769
|
+
* @returns {Promise<AjaxResult<T>>} A promise that resolves to the result of an REST API call.
|
|
1770
|
+
*
|
|
1771
|
+
* @example
|
|
1772
|
+
* interface TaskItem { id: number, title: string }
|
|
1773
|
+
* const response = await b24.actions.v3.call.make<{ item: TaskItem }>({
|
|
1774
|
+
* method: 'tasks.task.get',
|
|
1775
|
+
* params: { id: 123, select: ['id', 'title'] },
|
|
1776
|
+
* requestId: 'task-123'
|
|
1777
|
+
* })
|
|
1778
|
+
* if (!response.isSuccess) {
|
|
1779
|
+
* throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
|
|
1780
|
+
* }
|
|
1781
|
+
* console.log(response.getData().result.item.title)
|
|
1782
|
+
*/
|
|
1783
|
+
make<T = unknown>(options: ActionCallV3): Promise<AjaxResult<T>>;
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
type ActionCallListV3 = ActionOptions & {
|
|
1787
|
+
method: string;
|
|
1788
|
+
params?: Omit<TypeCallParams, 'pagination'>;
|
|
1789
|
+
idKey?: string;
|
|
1790
|
+
customKeyForResult: string;
|
|
1791
|
+
requestId?: string;
|
|
1792
|
+
limit?: number;
|
|
1793
|
+
};
|
|
1794
|
+
/**
|
|
1795
|
+
* Fast data retrieval without counting the total number of records. `restApi:v3`
|
|
1796
|
+
*
|
|
1797
|
+
* @todo add docs
|
|
1798
|
+
*/
|
|
1799
|
+
declare class CallListV3 extends AbstractAction {
|
|
1800
|
+
/**
|
|
1801
|
+
* Fast data retrieval without counting the total number of records.
|
|
1802
|
+
*
|
|
1803
|
+
* @template T - The type of the elements of the returned array (default is `unknown`).
|
|
1804
|
+
*
|
|
1805
|
+
* @param {ActionCallListV3} options - parameters for executing the request.
|
|
1806
|
+
* - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
|
|
1807
|
+
* - `params?: Omit<TypeCallParams, 'pagination'>` - Request parameters, excluding the `pagination` parameter,
|
|
1808
|
+
* since the method is designed to obtain all data in one call.
|
|
1809
|
+
* Note: Use `filter`, `order`, and `select` to control the selection.
|
|
1810
|
+
* - `idKey?: string` - The name of the field containing the unique identifier of the element.
|
|
1811
|
+
* Default is 'id'. Alternatively, it can be another field, depending on the REST API data structure.
|
|
1812
|
+
* - `customKeyForResult: string` - A custom key indicating that the response REST API will be
|
|
1813
|
+
* grouped by this field.
|
|
1814
|
+
* Example: `items` to group a list of CRM items.
|
|
1815
|
+
* - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.
|
|
1816
|
+
* - `limit?: number` - How many records to retrieve at a time. Default is `50`. Maximum is `1000`.
|
|
1817
|
+
*
|
|
1818
|
+
* @returns {Promise<Result<T[]>>} A promise that resolves to the result of an REST API call.
|
|
1819
|
+
*
|
|
1820
|
+
* @example
|
|
1821
|
+
* import { Text } from '@bitrix24/b24jssdk'
|
|
1822
|
+
*
|
|
1823
|
+
* interface MainEventLogItem { id: number, userId: number }
|
|
1824
|
+
* const sixMonthAgo = new Date()
|
|
1825
|
+
* sixMonthAgo.setMonth((new Date()).getMonth() - 6)
|
|
1826
|
+
* sixMonthAgo.setHours(0, 0, 0)
|
|
1827
|
+
* const response = await b24.actions.v3.callList.make<MainEventLogItem>({
|
|
1828
|
+
* method: 'main.eventlog.list',
|
|
1829
|
+
* params: {
|
|
1830
|
+
* filter: [
|
|
1831
|
+
* ['timestampX', '>=', Text.toB24Format(sixMonthAgo)] // created at least 6 months ago
|
|
1832
|
+
* ],
|
|
1833
|
+
* select: ['id', 'userId']
|
|
1834
|
+
* },
|
|
1835
|
+
* idKey: 'id',
|
|
1836
|
+
* customKeyForResult: 'items',
|
|
1837
|
+
* requestId: 'eventlog-123',
|
|
1838
|
+
* limit: 60
|
|
1839
|
+
* })
|
|
1840
|
+
* if (!response.isSuccess) {
|
|
1841
|
+
* throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
|
|
1842
|
+
* }
|
|
1843
|
+
* const list = response.getData()
|
|
1844
|
+
* console.log(`Result: ${list?.length}`) // Number of items received
|
|
1845
|
+
*/
|
|
1846
|
+
make<T = unknown>(options: ActionCallListV3): Promise<Result<T[]>>;
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
type ActionFetchListV3 = ActionOptions & {
|
|
1850
|
+
method: string;
|
|
1851
|
+
params?: Omit<TypeCallParams, 'pagination'>;
|
|
1852
|
+
idKey?: string;
|
|
1853
|
+
customKeyForResult: string;
|
|
1854
|
+
requestId?: string;
|
|
1855
|
+
limit?: number;
|
|
1856
|
+
};
|
|
1857
|
+
/**
|
|
1858
|
+
* Calls a REST API list method and returns an async generator for efficient large data retrieval. `restApi:v3`
|
|
1859
|
+
*
|
|
1860
|
+
* @todo add docs
|
|
1861
|
+
*/
|
|
1862
|
+
declare class FetchListV3 extends AbstractAction {
|
|
1863
|
+
/**
|
|
1864
|
+
* Calls a REST API list method and returns an async generator for efficient large data retrieval.
|
|
1865
|
+
* Implements the fast algorithm for iterating over large datasets without loading all data into memory at once.
|
|
1866
|
+
*
|
|
1867
|
+
* @template T - The type of items in the returned arrays (default is `unknown`).
|
|
1868
|
+
*
|
|
1869
|
+
* @param {ActionFetchListV3} options - parameters for executing the request.
|
|
1870
|
+
* - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
|
|
1871
|
+
* - `params?: Omit<TypeCallParams, 'pagination'>` - Request parameters, excluding the `pagination` parameter,
|
|
1872
|
+
* since the method is designed to obtain all data in one call.
|
|
1873
|
+
* Note: Use `filter`, `order`, and `select` to control the selection.
|
|
1874
|
+
* - `idKey?: string` - The name of the field containing the unique identifier of the element.
|
|
1875
|
+
* Default is 'id'. Alternatively, it can be another field, depending on the REST API data structure.
|
|
1876
|
+
* - `customKeyForResult: string` - A custom key indicating that the response REST API will be
|
|
1877
|
+
* grouped by this field.
|
|
1878
|
+
* Example: `items` to group a list of CRM items.
|
|
1879
|
+
* - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.
|
|
1880
|
+
* - `limit?: number` - How many records to retrieve at a time. Default is `50`. Maximum is `1000`.
|
|
1881
|
+
*
|
|
1882
|
+
* @returns {AsyncGenerator<T[]>} An async generator that yields chunks of data as arrays of type `T`.
|
|
1883
|
+
* Each iteration returns the next page/batch of results until all data is fetched.
|
|
1884
|
+
*
|
|
1885
|
+
* @example
|
|
1886
|
+
* import { Text } from '@bitrix24/b24jssdk'
|
|
1887
|
+
*
|
|
1888
|
+
* interface MainEventLogItem { id: number, userId: number }
|
|
1889
|
+
* const sixMonthAgo = new Date()
|
|
1890
|
+
* sixMonthAgo.setMonth((new Date()).getMonth() - 6)
|
|
1891
|
+
* sixMonthAgo.setHours(0, 0, 0)
|
|
1892
|
+
* const generator = b24.actions.v3.fetchList.make<MainEventLogItem>({
|
|
1893
|
+
* method: 'main.eventlog.list',
|
|
1894
|
+
* params: {
|
|
1895
|
+
* filter: [
|
|
1896
|
+
* ['timestampX', '>=', Text.toB24Format(sixMonthAgo)] // created at least 6 months ago
|
|
1897
|
+
* ],
|
|
1898
|
+
* select: ['id', 'userId']
|
|
1899
|
+
* },
|
|
1900
|
+
* idKey: 'id',
|
|
1901
|
+
* customKeyForResult: 'items',
|
|
1902
|
+
* requestId: 'eventlog-123',
|
|
1903
|
+
* limit: 60
|
|
1904
|
+
* })
|
|
1905
|
+
* for await (const chunk of generator) {
|
|
1906
|
+
* // Process chunk (e.g., save to database, analyze, etc.)
|
|
1907
|
+
* console.log(`Processing ${chunk.length} items`)
|
|
1908
|
+
* }
|
|
1909
|
+
*/
|
|
1910
|
+
make<T = unknown>(options: ActionFetchListV3): AsyncGenerator<T[]>;
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
type ActionBatchV3 = ActionOptions & {
|
|
1914
|
+
calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal;
|
|
1915
|
+
options?: IB24BatchOptions;
|
|
1916
|
+
};
|
|
1917
|
+
/**
|
|
1918
|
+
* Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50. `restApi:v3`
|
|
1919
|
+
* Allows you to execute multiple requests in a single API call, significantly improving performance.
|
|
1920
|
+
*
|
|
1921
|
+
* @todo add docs
|
|
1922
|
+
*/
|
|
1923
|
+
declare class BatchV3 extends AbstractBatch {
|
|
1924
|
+
/**
|
|
1925
|
+
* Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50.
|
|
1926
|
+
* Allows you to execute multiple requests in a single API call, significantly improving performance.
|
|
1927
|
+
*
|
|
1928
|
+
* @template T - The data type returned by batch query commands (default is `unknown`)
|
|
1929
|
+
*
|
|
1930
|
+
* @param {ActionBatchV3} options - parameters for executing the request.
|
|
1931
|
+
* - `calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal` - Commands to execute in a batch.
|
|
1932
|
+
* Supports several formats:
|
|
1933
|
+
* 1. Array of tuples: `[['method1', params1], ['method2', params2], ...]`
|
|
1934
|
+
* 2. Array of objects: `[{ method: 'method1', params: params1 }, { method: 'method2', params: params2 }, ...]`
|
|
1935
|
+
* 3. An object with named commands: `{ cmd1: { method: 'method1', params: params1 }, cmd2: ['method2', params2], ...}`
|
|
1936
|
+
* - `options?: IB24BatchOptions` - Additional options for executing a batch request.
|
|
1937
|
+
* - `isHaltOnError?: boolean` - Whether to stop execution on the first error (default: true)
|
|
1938
|
+
* - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)
|
|
1939
|
+
* - `returnAjaxResult?: boolean` - Whether to return an AjaxResult object instead of data (default: false)
|
|
1940
|
+
*
|
|
1941
|
+
* @returns {Promise<CallBatchResult<T>>} A promise that is resolved by the result of executing a batch request:
|
|
1942
|
+
* - On success: a `Result` object with the command execution results
|
|
1943
|
+
* - The structure of the results depends on the format of the `calls` input data:
|
|
1944
|
+
* - For an array of commands, an array of results in the same order
|
|
1945
|
+
* - For named commands, an object with keys corresponding to the command names
|
|
1946
|
+
*
|
|
1947
|
+
* @example
|
|
1948
|
+
* interface TaskItem { id: number, title: string }
|
|
1949
|
+
* const response = await b24.actions.v3.batch.make<{ item: TaskItem }>({
|
|
1950
|
+
* calls: [
|
|
1951
|
+
* ['tasks.task.get', { id: 1, select: ['id', 'title'] }],
|
|
1952
|
+
* ['tasks.task.get', { id: 2, select: ['id', 'title'] }],
|
|
1953
|
+
* ['tasks.task.get', { id: 3, select: ['id', 'title'] }]
|
|
1954
|
+
* ],
|
|
1955
|
+
* options: {
|
|
1956
|
+
* isHaltOnError: true,
|
|
1957
|
+
* returnAjaxResult: true,
|
|
1958
|
+
* requestId: 'batch-123'
|
|
1959
|
+
* }
|
|
1960
|
+
* })
|
|
1961
|
+
* if (!response.isSuccess) {
|
|
1962
|
+
* throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
|
|
1963
|
+
* }
|
|
1964
|
+
*
|
|
1965
|
+
* const resultData = (response as Result<AjaxResult<{ item: TaskItem }>[]>).getData()
|
|
1966
|
+
* resultData.forEach((resultRow, index) => {
|
|
1967
|
+
* if (resultRow.isSuccess) {
|
|
1968
|
+
* console.log(`Item ${index + 1}:`, resultRow.getData().result.item)
|
|
1969
|
+
* }
|
|
1970
|
+
* })
|
|
1971
|
+
*
|
|
1972
|
+
* @example
|
|
1973
|
+
* const response = await b24.actions.v3.batch.make({
|
|
1974
|
+
* calls: [
|
|
1975
|
+
* { method: 'tasks.task.get', params: { id: 1, select: ['id', 'title'] } },
|
|
1976
|
+
* { method: 'tasks.task.get', params: { id: 2, select: ['id', 'title'] } }
|
|
1977
|
+
* ],
|
|
1978
|
+
* options: {
|
|
1979
|
+
* isHaltOnError: true,
|
|
1980
|
+
* returnAjaxResult: true,
|
|
1981
|
+
* requestId: 'batch-123'
|
|
1982
|
+
* }
|
|
1983
|
+
* })
|
|
1984
|
+
* if (!response.isSuccess) {
|
|
1985
|
+
* throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
|
|
1986
|
+
* }
|
|
1987
|
+
*
|
|
1988
|
+
* @example
|
|
1989
|
+
* interface TaskItem { id: number, title: string }
|
|
1990
|
+
* interface MainEventLogItem { id: number, userId: number }
|
|
1991
|
+
* const response = await b24.actions.v3.batch.make<{ item: TaskItem } | { items: MainEventLogItem[] }>({
|
|
1992
|
+
* calls: {
|
|
1993
|
+
* Task: { method: 'tasks.task.get', params: { id: 1, select: ['id', 'title'] } },
|
|
1994
|
+
* MainEventLog: ['main.eventlog.list', { select: ['id', 'userId'], pagination: { limit: 5 } }]
|
|
1995
|
+
* },
|
|
1996
|
+
* options: {
|
|
1997
|
+
* isHaltOnError: true,
|
|
1998
|
+
* returnAjaxResult: true,
|
|
1999
|
+
* requestId: 'batch-123'
|
|
2000
|
+
* }
|
|
2001
|
+
* })
|
|
2002
|
+
* if (!response.isSuccess) {
|
|
2003
|
+
* throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
|
|
2004
|
+
* }
|
|
2005
|
+
*
|
|
2006
|
+
* const results = response.getData() as Record<string, AjaxResult<{ item: TaskItem } | { items: MainEventLogItem[] }>>
|
|
2007
|
+
* console.log('Task:', results.Task.getData().result.item as TaskItem)
|
|
2008
|
+
* console.log('MainEventLog:', results.MainEventLog.getData().result.items as MainEventLogItem[])
|
|
2009
|
+
*
|
|
2010
|
+
* @warning The maximum number of commands in one batch request is 50.
|
|
2011
|
+
* @note A batch request executes faster than sequential single calls,
|
|
2012
|
+
* but if one command fails, the entire batch may fail
|
|
2013
|
+
* (depending on API settings and options).
|
|
2014
|
+
*/
|
|
2015
|
+
make<T = unknown>(options: ActionBatchV3): Promise<CallBatchResult<T>>;
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
type ActionBatchByChunkV3 = ActionOptions & {
|
|
2019
|
+
calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal;
|
|
2020
|
+
options?: Omit<IB24BatchOptions, 'returnAjaxResult'>;
|
|
2021
|
+
};
|
|
2022
|
+
/**
|
|
2023
|
+
* Executes a batch request with automatic chunking for any number of commands. `restApi:v3`
|
|
2024
|
+
*
|
|
2025
|
+
* @todo add docs
|
|
2026
|
+
* @todo test self
|
|
2027
|
+
* @todo test example
|
|
2028
|
+
*/
|
|
2029
|
+
declare class BatchByChunkV3 extends AbstractBatch {
|
|
2030
|
+
/**
|
|
2031
|
+
* Executes a batch request with automatic chunking for any number of commands.
|
|
2032
|
+
* Unlike `BatchV3`, which is limited to 50 commands, this method automatically splits
|
|
2033
|
+
* a large set of commands into multiple batches and executes them sequentially.
|
|
2034
|
+
*
|
|
2035
|
+
* @template T - The data type returned by commands (default: `unknown`)
|
|
2036
|
+
*
|
|
2037
|
+
* @param {ActionBatchByChunkV3} options - parameters for executing the request.
|
|
2038
|
+
* - `calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal` - Commands to execute in a batch.
|
|
2039
|
+
* Supports several formats:
|
|
2040
|
+
* 1. Array of tuples: `[['method1', params1], ['method2', params2], ...]`
|
|
2041
|
+
* 2. Array of objects: `[{ method: 'method1', params: params1 }, { method: 'method2', params: params2 }, ...]`
|
|
2042
|
+
* - Note: Named commands are not supported as they are difficult to process when chunking.
|
|
2043
|
+
* - `options?: Omit<IB24BatchOptions, 'returnAjaxResult'>` - Additional options for executing a batch request.
|
|
2044
|
+
* - `isHaltOnError?: boolean` - Whether to stop execution on the first error (default: true)
|
|
2045
|
+
* - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)
|
|
2046
|
+
*
|
|
2047
|
+
* @returns {Promise<Result<T[]>>} A promise that is resolved by the result of executing all commands.
|
|
2048
|
+
*
|
|
2049
|
+
* @example
|
|
2050
|
+
* interface TaskItem { id: number, title: string }
|
|
2051
|
+
* const commands: BatchCommandsArrayUniversal = Array.from({ length: 150 }, (_, i) =>
|
|
2052
|
+
* ['tasks.task.get', { id: i + 1, select: ['id', 'title'] }]
|
|
2053
|
+
* )
|
|
2054
|
+
*
|
|
2055
|
+
* const response = await b24.actions.v3.batchByChunk.make<{ item: TaskItem }>({
|
|
2056
|
+
* calls: commands,
|
|
2057
|
+
* options: {
|
|
2058
|
+
* isHaltOnError: false,
|
|
2059
|
+
* requestId: 'batch-by-chunk-123'
|
|
2060
|
+
* }
|
|
2061
|
+
* })
|
|
2062
|
+
*
|
|
2063
|
+
* if (!response.isSuccess) {
|
|
2064
|
+
* throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
|
|
2065
|
+
* }
|
|
2066
|
+
*
|
|
2067
|
+
* const resultData = response.getData()
|
|
2068
|
+
* const items: TaskItem[] = []
|
|
2069
|
+
* resultData.forEach((chunkRow) => {
|
|
2070
|
+
* items.push(chunkRow.item)
|
|
2071
|
+
* })
|
|
2072
|
+
* console.log(`Successfully retrieved ${items.length} items`)
|
|
2073
|
+
*
|
|
2074
|
+
* @tip For very large command sets, consider using server-side task queues instead of bulk batch requests.
|
|
2075
|
+
*/
|
|
2076
|
+
make<T = unknown>(options: ActionBatchByChunkV3): Promise<Result<T[]>>;
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
/**
|
|
2080
|
+
* Some actions for TypeB24 by Api:v3
|
|
2081
|
+
*/
|
|
2082
|
+
declare class ActionsManagerV3 {
|
|
2083
|
+
protected _b24: TypeB24;
|
|
2084
|
+
protected _logger: LoggerInterface;
|
|
2085
|
+
protected _mapActions: Map<symbol, AbstractAction>;
|
|
2086
|
+
constructor(b24: TypeB24);
|
|
2087
|
+
setLogger(logger: LoggerInterface): void;
|
|
2088
|
+
getLogger(): LoggerInterface;
|
|
2089
|
+
get call(): CallV3;
|
|
2090
|
+
get callList(): CallListV3;
|
|
2091
|
+
get fetchList(): FetchListV3;
|
|
2092
|
+
get batch(): BatchV3;
|
|
2093
|
+
get batchByChunk(): BatchByChunkV3;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
/**
|
|
2097
|
+
* Some actions for TypeB24
|
|
2098
|
+
*/
|
|
2099
|
+
declare class ActionsManager {
|
|
2100
|
+
protected _b24: TypeB24;
|
|
2101
|
+
protected _logger: LoggerInterface;
|
|
2102
|
+
protected _mapActions: Map<symbol, any>;
|
|
2103
|
+
constructor(b24: TypeB24);
|
|
2104
|
+
setLogger(logger: LoggerInterface): void;
|
|
2105
|
+
getLogger(): LoggerInterface;
|
|
2106
|
+
get v2(): ActionsManagerV2;
|
|
2107
|
+
get v3(): ActionsManagerV3;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
/**
|
|
2111
|
+
* Abstract Class for working with tools
|
|
2112
|
+
*/
|
|
2113
|
+
type ToolOptions = {
|
|
2114
|
+
[key: string]: any;
|
|
2115
|
+
};
|
|
2116
|
+
declare abstract class AbstractTool {
|
|
2117
|
+
protected _b24: TypeB24;
|
|
2118
|
+
protected _logger: LoggerInterface;
|
|
2119
|
+
constructor(b24: TypeB24, logger: LoggerInterface);
|
|
2120
|
+
abstract make(options?: ToolOptions): Promise<unknown>;
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
/**
|
|
2124
|
+
* Ping `restApi:v2`
|
|
2125
|
+
*
|
|
2126
|
+
* @todo use apiVer3
|
|
2127
|
+
*/
|
|
2128
|
+
declare class Ping extends AbstractTool {
|
|
2129
|
+
/**
|
|
2130
|
+
* Measures the response speed of the Bitrix24 REST API.
|
|
2131
|
+
* Performs a test request and returns the response time in milliseconds.
|
|
2132
|
+
* Useful for performance monitoring and diagnosing latency issues.
|
|
2133
|
+
*
|
|
2134
|
+
* @note The method uses a minimal API request (`server.time`) to check availability.
|
|
2135
|
+
* Does not overload the server with large amounts of data.
|
|
2136
|
+
*
|
|
2137
|
+
* @warning Response time may vary depending on server load, network conditions
|
|
2138
|
+
* and HTTP client settings (timeouts, retries).
|
|
2139
|
+
*
|
|
2140
|
+
* @tip For consistent results, it is recommended to perform multiple measurements
|
|
2141
|
+
* and use the median value.
|
|
2142
|
+
*
|
|
2143
|
+
* @param options Some options for executing
|
|
2144
|
+
* - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)
|
|
2145
|
+
*
|
|
2146
|
+
* @returns {Promise<number>} Promise that resolves to a response time in milliseconds:
|
|
2147
|
+
* - Positive number: time from sending the request to receiving the response
|
|
2148
|
+
* - In case of an error or timeout: `-1`
|
|
2149
|
+
*
|
|
2150
|
+
* @see {@link HealthCheck} To check API availability
|
|
2151
|
+
*/
|
|
2152
|
+
make(options?: ToolOptions & {
|
|
2153
|
+
requestId?: string;
|
|
2154
|
+
}): Promise<number>;
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
/**
|
|
2158
|
+
* HealthCheck `restApi:v2`
|
|
2159
|
+
*
|
|
2160
|
+
* @todo use apiVer3
|
|
2161
|
+
*/
|
|
2162
|
+
declare class HealthCheck extends AbstractTool {
|
|
2163
|
+
/**
|
|
2164
|
+
* Checks the availability of the Bitrix24 REST API.
|
|
2165
|
+
* Performs a simple request to the API to verify the service is operational and that the required access rights are present.
|
|
2166
|
+
*
|
|
2167
|
+
* @note The method uses a minimal API request (`server.time`) to check availability.
|
|
2168
|
+
* Does not overload the server with large amounts of data.
|
|
2169
|
+
*
|
|
2170
|
+
* @param options Some options for executing
|
|
2171
|
+
* - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)
|
|
2172
|
+
*
|
|
2173
|
+
* @returns {Promise<false>} Promise that resolves to a Boolean value:
|
|
2174
|
+
* - `true`: the API is available and responding
|
|
2175
|
+
* - `false`: the API is unavailable, an error occurred, or the required access rights are missing
|
|
2176
|
+
*
|
|
2177
|
+
* @see {@link Ping} To measure API response speed
|
|
2178
|
+
*/
|
|
2179
|
+
make(options?: ToolOptions & {
|
|
2180
|
+
requestId?: string;
|
|
2181
|
+
}): Promise<boolean>;
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
/**
|
|
2185
|
+
* Some tools for TypeB24
|
|
2186
|
+
* @todo add docs
|
|
2187
|
+
*/
|
|
2188
|
+
declare class ToolsManager {
|
|
2189
|
+
protected _b24: TypeB24;
|
|
2190
|
+
protected _logger: LoggerInterface;
|
|
2191
|
+
protected _mapTools: Map<symbol, AbstractTool>;
|
|
2192
|
+
constructor(b24: TypeB24);
|
|
2193
|
+
setLogger(logger: LoggerInterface): void;
|
|
2194
|
+
getLogger(): LoggerInterface;
|
|
2195
|
+
get ping(): Ping;
|
|
2196
|
+
get healthCheck(): HealthCheck;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
/**
|
|
2200
|
+
* @todo docs
|
|
2201
|
+
*/
|
|
2202
|
+
declare enum ApiVersion {
|
|
2203
|
+
v3 = "v3",
|
|
2204
|
+
v2 = "v2"
|
|
2205
|
+
}
|
|
2206
|
+
/**
|
|
2207
|
+
* Options for batch calls
|
|
2208
|
+
*/
|
|
2209
|
+
interface IB24BatchOptions extends ICallBatchOptions {
|
|
2210
|
+
/**
|
|
2211
|
+
* Api Version
|
|
2212
|
+
* If the option is empty, then automatic detection is performed using the specified methods.
|
|
2213
|
+
*/
|
|
2214
|
+
apiVersion?: ApiVersion;
|
|
2215
|
+
/**
|
|
2216
|
+
* Whether to return an AjaxResult object instead of data
|
|
2217
|
+
* @default false
|
|
2218
|
+
*/
|
|
2219
|
+
returnAjaxResult?: boolean;
|
|
2220
|
+
}
|
|
2221
|
+
type CallBatchResult<T> = Result<Record<string | number, AjaxResult<T>>> | Result<AjaxResult<T>[]> | Result<T>;
|
|
2222
|
+
type TypeB24 = {
|
|
2223
|
+
/**
|
|
2224
|
+
* @see {https://bitrix24.github.io/b24jssdk/docs/hook/ Js SDK documentation}
|
|
2225
|
+
* @see {https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-functions/bx24-init.html Bitrix24 REST API documentation}
|
|
2226
|
+
*/
|
|
2227
|
+
readonly isInit: boolean;
|
|
2228
|
+
init(): Promise<void>;
|
|
2229
|
+
destroy(): void;
|
|
2230
|
+
getLogger(): LoggerInterface;
|
|
2231
|
+
setLogger(logger: LoggerInterface): void;
|
|
2232
|
+
/**
|
|
2233
|
+
* Returns the AuthActions interface for handling authorization.
|
|
2234
|
+
*/
|
|
2235
|
+
get auth(): AuthActions;
|
|
2236
|
+
/**
|
|
2237
|
+
* Returns the ActionsManager interface for working with Bitrix24 methods. Dependent on the REST API version.
|
|
2238
|
+
*/
|
|
2239
|
+
get actions(): ActionsManager;
|
|
2240
|
+
/**
|
|
2241
|
+
* Returns the ToolsManager interface for access to Bitrix24 utilities independent of the REST API version.
|
|
2242
|
+
*/
|
|
2243
|
+
get tools(): ToolsManager;
|
|
2244
|
+
/**
|
|
2245
|
+
* Sets the restriction parameters
|
|
2246
|
+
*/
|
|
2247
|
+
setRestrictionManagerParams(params: RestrictionParams): Promise<void>;
|
|
2248
|
+
/**
|
|
2249
|
+
* Get the account address Bitrix24 ( `https://your_domain.bitrix24.com` )
|
|
2250
|
+
*/
|
|
2251
|
+
getTargetOrigin(): string;
|
|
2252
|
+
/**
|
|
2253
|
+
* Get the account address Bitrix24 with path
|
|
2254
|
+
* - `restApi:v3` `https://your_domain.bitrix24.com/rest/api/`
|
|
2255
|
+
* - `restApi:v2` `https://your_domain.bitrix24.com/rest/`
|
|
2256
|
+
*/
|
|
2257
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
2258
|
+
/**
|
|
2259
|
+
* Calls the Bitrix24 REST API method.
|
|
2260
|
+
*
|
|
2261
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
2262
|
+
* - for `restApi:v3` use {@link CallV3.make `b24.actions.v3.call.make(options)`}
|
|
2263
|
+
* - for `restApi:v2` use {@link CallV2.make `b24.actions.v2.call.make(options)`}
|
|
2264
|
+
*
|
|
2265
|
+
* @removed 2.0.0
|
|
2266
|
+
*/
|
|
2267
|
+
callMethod(method: string, params?: object, start?: number): Promise<AjaxResult>;
|
|
2268
|
+
/**
|
|
2269
|
+
* Calls a Bitrix24 REST API list method to retrieve all data.
|
|
2270
|
+
*
|
|
2271
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
2272
|
+
* - for `restApi:v3` use {@link CallListV3.make `b24.actions.v3.callList.make(options)`}
|
|
2273
|
+
* - for `restApi:v2` use {@link CallListV2.make `b24.actions.v2.callList.make(options)`}
|
|
2274
|
+
*
|
|
2275
|
+
* @removed 2.0.0
|
|
2276
|
+
*/
|
|
2277
|
+
callListMethod(method: string, params?: object, progress?: null | ((progress: number) => void), customKeyForResult?: string | null): Promise<Result>;
|
|
2278
|
+
/**
|
|
2279
|
+
* Calls a Bitrix24 REST API list method and returns an async generator.
|
|
2280
|
+
*
|
|
2281
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
2282
|
+
* - for `restApi:v3` use {@link FetchListV3.make `b24.actions.v3.fetchList.make(options)`}
|
|
2283
|
+
* - for `restApi:v2` use {@link FetchListV2.make `b24.actions.v2.fetchList.make(options)`}
|
|
2284
|
+
*
|
|
2285
|
+
* @removed 2.0.0
|
|
2286
|
+
*/
|
|
2287
|
+
fetchListMethod(method: string, params?: any, idKey?: string, customKeyForResult?: string | null): AsyncGenerator<any[]>;
|
|
2288
|
+
/**
|
|
2289
|
+
* Executes a batch request to the Bitrix24 REST API
|
|
2290
|
+
*
|
|
2291
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
2292
|
+
* - for `restApi:v3` use {@link BatchV3.make `b24.actions.v3.batch.make(options)`}
|
|
2293
|
+
* - for `restApi:v2` use {@link BatchV2.make `b24.actions.v2.batch.make(options)`}
|
|
2294
|
+
*
|
|
2295
|
+
* @removed 2.0.0
|
|
2296
|
+
*/
|
|
2297
|
+
callBatch(calls: Array<any> | object, isHaltOnError?: boolean, returnAjaxResult?: boolean): Promise<Result>;
|
|
2298
|
+
/**
|
|
2299
|
+
* Executes a batch request to the Bitrix24 REST API with automatic chunking for any number of commands.
|
|
2300
|
+
*
|
|
2301
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
2302
|
+
* - for `restApi:v3` use {@link BatchByChunkV3.make `b24.actions.v3.batchByChunk.make(options)`}
|
|
2303
|
+
* - for `restApi:v2` use {@link BatchByChunkV2.make `b24.actions.v2.batchByChunk.make(options)`}
|
|
2304
|
+
*
|
|
2305
|
+
* @removed 2.0.0
|
|
2306
|
+
*/
|
|
2307
|
+
callBatchByChunk(calls: Array<any>, isHaltOnError: boolean): Promise<Result>;
|
|
2308
|
+
/**
|
|
2309
|
+
* Returns the HTTP client to perform the request.
|
|
2310
|
+
*/
|
|
2311
|
+
getHttpClient(version: ApiVersion): TypeHttp;
|
|
2312
|
+
/**
|
|
2313
|
+
* Set HTTP client
|
|
2314
|
+
*/
|
|
2315
|
+
setHttpClient(version: ApiVersion, client: TypeHttp): void;
|
|
2316
|
+
};
|
|
2317
|
+
|
|
2318
|
+
/**
|
|
2319
|
+
* @link https://apidocs.bitrix24.com/api-reference/rest-v3/index.html#structure-of-an-unsuccessful-response
|
|
2320
|
+
*
|
|
2321
|
+
* @todo ! move to packages/jssdk/src/types/payloads.ts
|
|
2322
|
+
*/
|
|
2323
|
+
type TypeDescriptionErrorV3 = {
|
|
2324
|
+
readonly error: {
|
|
2325
|
+
code: string;
|
|
2326
|
+
message: string;
|
|
2327
|
+
validation?: {
|
|
2328
|
+
message?: string;
|
|
2329
|
+
field?: string;
|
|
2330
|
+
[key: string]: any;
|
|
2331
|
+
}[];
|
|
2332
|
+
};
|
|
2333
|
+
};
|
|
2334
|
+
type TypeDescriptionError = {
|
|
2335
|
+
readonly error: 'invalid_token' | 'expired_token' | string;
|
|
2336
|
+
readonly error_description?: string;
|
|
2337
|
+
};
|
|
2338
|
+
/**
|
|
2339
|
+
* Parameters for hook
|
|
2340
|
+
*/
|
|
2341
|
+
type B24HookParams = {
|
|
2342
|
+
/**
|
|
2343
|
+
* https://your-bitrix-portal.bitrix24.com
|
|
2344
|
+
*/
|
|
2345
|
+
b24Url: string;
|
|
2346
|
+
userId: number;
|
|
2347
|
+
secret: string;
|
|
2348
|
+
};
|
|
2349
|
+
/**
|
|
2350
|
+
* Parameters passed in the GET request from the B24 parent window to the application
|
|
2351
|
+
*/
|
|
2352
|
+
type B24FrameQueryParams = {
|
|
2353
|
+
DOMAIN: string | null | undefined;
|
|
2354
|
+
PROTOCOL: boolean | null | undefined;
|
|
2355
|
+
LANG: string | null | undefined;
|
|
2356
|
+
APP_SID: string | null | undefined;
|
|
2357
|
+
};
|
|
2358
|
+
/**
|
|
2359
|
+
* Parameters for application for OAuth
|
|
2360
|
+
*/
|
|
2361
|
+
type B24OAuthSecret = {
|
|
2362
|
+
clientId: string;
|
|
2363
|
+
clientSecret: string;
|
|
2364
|
+
};
|
|
2365
|
+
/**
|
|
2366
|
+
* Parameters for OAuth
|
|
2367
|
+
* @memo We get from b24 event this data
|
|
2368
|
+
*/
|
|
2369
|
+
interface B24OAuthParams {
|
|
2370
|
+
/**
|
|
2371
|
+
* @example '1xxxxx1694'
|
|
2372
|
+
*/
|
|
2373
|
+
applicationToken: string;
|
|
2374
|
+
/**
|
|
2375
|
+
* @example 1
|
|
2376
|
+
*/
|
|
2377
|
+
userId: number;
|
|
2378
|
+
/**
|
|
2379
|
+
* @example '3xx2030386cyy1b'
|
|
2380
|
+
*/
|
|
2381
|
+
memberId: string;
|
|
2382
|
+
/**
|
|
2383
|
+
* @example '1xxxxx1694'
|
|
2384
|
+
*/
|
|
2385
|
+
accessToken: string;
|
|
2386
|
+
/**
|
|
2387
|
+
* @example '0xxxx4e000011e700000001000000260dc83b47c40e9b5fd501093674c4f5'
|
|
2388
|
+
*/
|
|
2389
|
+
refreshToken: string;
|
|
2390
|
+
/**
|
|
2391
|
+
* @example 1745997853
|
|
2392
|
+
*/
|
|
2393
|
+
expires: number;
|
|
2394
|
+
/**
|
|
2395
|
+
* @example 3600
|
|
2396
|
+
*/
|
|
2397
|
+
expiresIn: number;
|
|
2398
|
+
/**
|
|
2399
|
+
* @example 'crm,catalog,bizproc,placement,user_brief'
|
|
2400
|
+
*/
|
|
2401
|
+
scope: string;
|
|
2402
|
+
/**
|
|
2403
|
+
* @example 'xxx.bitrix24.com'
|
|
2404
|
+
*/
|
|
2405
|
+
domain: string;
|
|
2406
|
+
/**
|
|
2407
|
+
* @example 'https://xxx.bitrix24.com/rest/'
|
|
2408
|
+
*/
|
|
2409
|
+
clientEndpoint: string;
|
|
2410
|
+
/**
|
|
2411
|
+
* @example 'https://oauth.bitrix.info/rest/'
|
|
2412
|
+
*/
|
|
2413
|
+
serverEndpoint: string;
|
|
2414
|
+
/**
|
|
2415
|
+
* @example 'L'
|
|
2416
|
+
*/
|
|
2417
|
+
status: typeof EnumAppStatus[keyof typeof EnumAppStatus];
|
|
2418
|
+
issuer?: 'request' | 'store' | string;
|
|
2419
|
+
}
|
|
2420
|
+
type HandlerRefreshAuth = Pick<HandlerAuthParams, 'access_token' | 'refresh_token' | 'expires' | 'expires_in' | 'client_endpoint' | 'server_endpoint' | 'member_id' | 'scope' | 'status' | 'domain'>;
|
|
2421
|
+
/**
|
|
2422
|
+
* Callback called when OAuth authorization is updated
|
|
2423
|
+
*/
|
|
2424
|
+
type CallbackRefreshAuth = (params: {
|
|
2425
|
+
authData: AuthData;
|
|
2426
|
+
b24OAuthParams: B24OAuthParams;
|
|
2427
|
+
}) => Promise<void>;
|
|
2428
|
+
/**
|
|
2429
|
+
* Use for custom get new refresh token for OAuth
|
|
2430
|
+
*/
|
|
2431
|
+
type CustomRefreshAuth = () => Promise<HandlerRefreshAuth>;
|
|
2432
|
+
/**
|
|
2433
|
+
* Parameters passed from the parent window when calling refreshAuth
|
|
2434
|
+
*/
|
|
2435
|
+
type RefreshAuthData = {
|
|
2436
|
+
AUTH_ID: string;
|
|
2437
|
+
REFRESH_ID: string;
|
|
2438
|
+
AUTH_EXPIRES: NumberString;
|
|
2439
|
+
};
|
|
2440
|
+
/**
|
|
2441
|
+
* Parameters passed from the parent window when calling getInitData
|
|
2442
|
+
*/
|
|
2443
|
+
type MessageInitData = RefreshAuthData & {
|
|
2444
|
+
DOMAIN: string;
|
|
2445
|
+
PROTOCOL: string;
|
|
2446
|
+
PATH: string;
|
|
2447
|
+
LANG: string;
|
|
2448
|
+
MEMBER_ID: string;
|
|
2449
|
+
IS_ADMIN: boolean;
|
|
2450
|
+
APP_OPTIONS: Record<string, any>;
|
|
2451
|
+
USER_OPTIONS: Record<string, any>;
|
|
2452
|
+
PLACEMENT: string;
|
|
2453
|
+
PLACEMENT_OPTIONS: Record<string, any>;
|
|
2454
|
+
INSTALL: boolean;
|
|
2455
|
+
FIRST_RUN: boolean;
|
|
2456
|
+
};
|
|
2457
|
+
/**
|
|
2458
|
+
* Parameters for OAuth authorization
|
|
2459
|
+
*/
|
|
2460
|
+
type AuthData = {
|
|
2461
|
+
access_token: string;
|
|
2462
|
+
refresh_token: string;
|
|
2463
|
+
expires: number;
|
|
2464
|
+
expires_in: number;
|
|
2465
|
+
domain: string;
|
|
2466
|
+
member_id: string;
|
|
2467
|
+
[key: string]: any;
|
|
2468
|
+
};
|
|
2469
|
+
/**
|
|
2470
|
+
* Interface for updating authorization
|
|
2471
|
+
*/
|
|
2472
|
+
interface AuthActions {
|
|
2473
|
+
getAuthData: () => false | AuthData;
|
|
2474
|
+
refreshAuth: () => Promise<AuthData>;
|
|
2475
|
+
getUniq: (prefix: string) => string;
|
|
2476
|
+
isAdmin: boolean;
|
|
2477
|
+
/**
|
|
2478
|
+
* Get the account address BX24 ( `https://your_domain.bitrix24.com` )
|
|
2479
|
+
*/
|
|
2480
|
+
getTargetOrigin(): string;
|
|
2481
|
+
/**
|
|
2482
|
+
* Get the account address BX24 with path
|
|
2483
|
+
* - ver2 `https://your_domain.bitrix24.com/rest/`
|
|
2484
|
+
* - ver3` https://your_domain.bitrix24.com/rest/api/`
|
|
2485
|
+
*/
|
|
2486
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2489
|
+
type PayloadTime = {
|
|
2490
|
+
readonly start: number;
|
|
2491
|
+
readonly finish: number;
|
|
2492
|
+
readonly duration: number;
|
|
2493
|
+
readonly processing: number;
|
|
2494
|
+
readonly date_start: ISODate;
|
|
2495
|
+
readonly date_finish: ISODate;
|
|
2496
|
+
/**
|
|
2497
|
+
* timestamp - when part of the limit for this method will be released.
|
|
2498
|
+
*/
|
|
2499
|
+
readonly operating_reset_at: number;
|
|
2500
|
+
/**
|
|
2501
|
+
* indicates the execution time of a request to a specific method.
|
|
2502
|
+
*/
|
|
2503
|
+
readonly operating: number;
|
|
2504
|
+
};
|
|
2505
|
+
type GetPayload<P> = {
|
|
2506
|
+
readonly result: P;
|
|
2507
|
+
readonly time: PayloadTime;
|
|
2508
|
+
};
|
|
2509
|
+
type ListPayload<P> = {
|
|
2510
|
+
readonly result: any | P[];
|
|
2511
|
+
readonly total: number;
|
|
2512
|
+
readonly next?: number;
|
|
2513
|
+
readonly time: PayloadTime;
|
|
2514
|
+
};
|
|
2515
|
+
type BatchPayloadResult<C> = {
|
|
2516
|
+
readonly result: {
|
|
2517
|
+
readonly [P in keyof C]?: C[P];
|
|
2518
|
+
} | ReadonlyArray<C[keyof C]>;
|
|
2519
|
+
readonly result_error: {
|
|
2520
|
+
readonly [P in keyof C]?: string;
|
|
2521
|
+
} | readonly string[];
|
|
2522
|
+
readonly result_total: {
|
|
2523
|
+
readonly [P in keyof C]?: number;
|
|
2524
|
+
} | readonly number[];
|
|
2525
|
+
readonly result_next: {
|
|
2526
|
+
readonly [P in keyof C]?: number;
|
|
2527
|
+
} | readonly number[];
|
|
2528
|
+
readonly result_time: {
|
|
2529
|
+
readonly [P in keyof C]?: PayloadTime;
|
|
2530
|
+
} | readonly PayloadTime[];
|
|
2531
|
+
};
|
|
2532
|
+
type BatchPayload<C> = {
|
|
2533
|
+
readonly result: BatchPayloadResult<C>;
|
|
2534
|
+
readonly time: PayloadTime;
|
|
2535
|
+
};
|
|
2536
|
+
type Payload<P> = TypeDescriptionErrorV3 | TypeDescriptionError | GetPayload<P> | ListPayload<P> | BatchPayload<P>;
|
|
2537
|
+
type SuccessPayload<P> = Exclude<Payload<P>, TypeDescriptionErrorV3 | TypeDescriptionError>;
|
|
2538
|
+
|
|
2539
|
+
type AjaxQuery = Readonly<{
|
|
2540
|
+
method: string;
|
|
2541
|
+
params: TypeCallParams;
|
|
2542
|
+
requestId: string;
|
|
2543
|
+
}>;
|
|
2544
|
+
type AjaxResultOptions<T> = Readonly<{
|
|
2545
|
+
answer: Payload<T>;
|
|
2546
|
+
query: AjaxQuery;
|
|
2547
|
+
status: number;
|
|
2548
|
+
}>;
|
|
2549
|
+
/**
|
|
2550
|
+
* Result of request to Rest Api
|
|
2551
|
+
*
|
|
2552
|
+
* @todo docs
|
|
2553
|
+
*/
|
|
2554
|
+
declare class AjaxResult<T = unknown> extends Result<Payload<T>> implements IResult<Payload<T>> {
|
|
2555
|
+
#private;
|
|
2556
|
+
private readonly _status;
|
|
2557
|
+
private readonly _query;
|
|
2558
|
+
protected _data: Payload<T> | null | undefined;
|
|
2559
|
+
constructor(options: AjaxResultOptions<T>);
|
|
2560
|
+
get isSuccess(): boolean;
|
|
2561
|
+
getData(): undefined | SuccessPayload<T>;
|
|
2562
|
+
/**
|
|
2563
|
+
* Alias for isMore
|
|
2564
|
+
*/
|
|
2565
|
+
hasMore(): boolean;
|
|
2566
|
+
isMore(): boolean;
|
|
2567
|
+
getTotal(): number;
|
|
2568
|
+
getStatus(): number;
|
|
2569
|
+
getQuery(): Readonly<AjaxQuery>;
|
|
881
2570
|
/**
|
|
882
|
-
*
|
|
2571
|
+
* Alias for getNext
|
|
2572
|
+
* @param http
|
|
2573
|
+
*
|
|
2574
|
+
* @todo !fix api version
|
|
883
2575
|
*/
|
|
884
|
-
|
|
885
|
-
|
|
2576
|
+
fetchNext(http: TypeHttp): Promise<AjaxResult<T> | null>;
|
|
2577
|
+
getNext(http: TypeHttp): Promise<AjaxResult<T> | false>;
|
|
2578
|
+
setData(): never;
|
|
886
2579
|
}
|
|
887
|
-
|
|
2580
|
+
|
|
888
2581
|
/**
|
|
889
|
-
*
|
|
2582
|
+
* @todo fix docs
|
|
890
2583
|
*/
|
|
891
|
-
type
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
2584
|
+
type TypeCallParams = {
|
|
2585
|
+
order?: Record<string, 'ASC' | 'DESC' | 'asc' | 'desc' | string>;
|
|
2586
|
+
filter?: any;
|
|
2587
|
+
select?: string[];
|
|
2588
|
+
params?: any;
|
|
2589
|
+
/**
|
|
2590
|
+
* Used only in Api:V2
|
|
2591
|
+
*/
|
|
2592
|
+
start?: number;
|
|
2593
|
+
/**
|
|
2594
|
+
* Used only in Api:V3
|
|
2595
|
+
*/
|
|
2596
|
+
pagination?: {
|
|
2597
|
+
limit?: number;
|
|
2598
|
+
/**
|
|
2599
|
+
* Minimum 1
|
|
2600
|
+
*/
|
|
2601
|
+
page?: number;
|
|
2602
|
+
/**
|
|
2603
|
+
* You need to use either `page` or `offset`. There's no point in using both.
|
|
2604
|
+
*/
|
|
2605
|
+
offset?: number;
|
|
2606
|
+
};
|
|
2607
|
+
/**
|
|
2608
|
+
* Used only in Api:V3
|
|
2609
|
+
*/
|
|
2610
|
+
cursor?: {
|
|
2611
|
+
field: string;
|
|
2612
|
+
value: number;
|
|
2613
|
+
order: 'ASC' | 'DESC' | 'asc' | 'desc' | string;
|
|
2614
|
+
};
|
|
2615
|
+
[key: string]: any;
|
|
2616
|
+
};
|
|
895
2617
|
/**
|
|
896
|
-
*
|
|
2618
|
+
* Options for batch calls
|
|
897
2619
|
*/
|
|
898
|
-
|
|
2620
|
+
interface ICallBatchOptions {
|
|
2621
|
+
/**
|
|
2622
|
+
* Whether to stop execution on the first error
|
|
2623
|
+
* @default true
|
|
2624
|
+
*/
|
|
2625
|
+
isHaltOnError?: boolean;
|
|
2626
|
+
/**
|
|
2627
|
+
* Unique request identifier for tracking. Used for query deduplication and debugging.
|
|
2628
|
+
*/
|
|
2629
|
+
requestId?: string;
|
|
2630
|
+
}
|
|
899
2631
|
/**
|
|
900
|
-
*
|
|
2632
|
+
* Result of the batch call
|
|
901
2633
|
*/
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
2634
|
+
interface ICallBatchResult<T = unknown> {
|
|
2635
|
+
result?: Map<string | number, AjaxResult<T>>;
|
|
2636
|
+
time?: PayloadTime;
|
|
2637
|
+
}
|
|
2638
|
+
type BatchCommandV3 = {
|
|
2639
|
+
method: string;
|
|
2640
|
+
query?: Record<string, unknown>;
|
|
2641
|
+
as?: string;
|
|
2642
|
+
parallel?: boolean;
|
|
906
2643
|
};
|
|
2644
|
+
type CommandTuple<M extends string = string, P = undefined | TypeCallParams> = [M, P?];
|
|
907
2645
|
/**
|
|
908
|
-
*
|
|
2646
|
+
* @todo add docs - api v3 only use this ??
|
|
909
2647
|
*/
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
INSTALL: boolean;
|
|
922
|
-
FIRST_RUN: boolean;
|
|
923
|
-
};
|
|
2648
|
+
interface CommandObject<M extends string = string, P = undefined | TypeCallParams> {
|
|
2649
|
+
method: M;
|
|
2650
|
+
params?: P;
|
|
2651
|
+
as?: string;
|
|
2652
|
+
parallel?: boolean;
|
|
2653
|
+
}
|
|
2654
|
+
type CommandUniversal<M extends string = string, P = undefined | TypeCallParams> = CommandTuple<M, P> | CommandObject<M, P>;
|
|
2655
|
+
type BatchCommandsArrayUniversal<M extends string = string, P = undefined | TypeCallParams> = CommandTuple<M, P>[];
|
|
2656
|
+
type BatchCommandsObjectUniversal<M extends string = string, P = undefined | TypeCallParams> = CommandObject<M, P>[];
|
|
2657
|
+
type BatchNamedCommandsUniversal<K extends string | number | symbol = string, M extends string = string, P = undefined | TypeCallParams> = Record<K, CommandObject<M, P> | CommandTuple<M, P>>;
|
|
2658
|
+
type BatchCommandsUniversal<M extends string = string, P = undefined | TypeCallParams> = CommandUniversal<M, P>[];
|
|
924
2659
|
/**
|
|
925
|
-
*
|
|
2660
|
+
* Interface for Request id generator
|
|
926
2661
|
*/
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
};
|
|
2662
|
+
interface IRequestIdGenerator {
|
|
2663
|
+
getRequestId(): string;
|
|
2664
|
+
getHeaderFieldName(): string;
|
|
2665
|
+
getQueryStringParameterName(): string;
|
|
2666
|
+
getQueryStringSdkParameterName(): string;
|
|
2667
|
+
}
|
|
934
2668
|
/**
|
|
935
|
-
* Interface for
|
|
2669
|
+
* Interface for HTTP client
|
|
936
2670
|
*/
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
type TypeB24 = {
|
|
945
|
-
/**
|
|
946
|
-
* @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/system-functions/bx24-init.html
|
|
947
|
-
*/
|
|
948
|
-
readonly isInit: boolean;
|
|
949
|
-
init(): Promise<void>;
|
|
950
|
-
destroy(): void;
|
|
951
|
-
getLogger(): LoggerBrowser;
|
|
952
|
-
setLogger(logger: LoggerBrowser): void;
|
|
953
|
-
get auth(): AuthActions;
|
|
954
|
-
/**
|
|
955
|
-
* Get the account address BX24 ( https://name.bitrix24.com )
|
|
956
|
-
*/
|
|
957
|
-
getTargetOrigin(): string;
|
|
2671
|
+
type TypeHttp = {
|
|
2672
|
+
apiVersion: ApiVersion;
|
|
2673
|
+
ajaxClient: AxiosInstance | any;
|
|
2674
|
+
setLogger(logger: LoggerInterface): void;
|
|
2675
|
+
getLogger(): LoggerInterface;
|
|
958
2676
|
/**
|
|
959
|
-
*
|
|
2677
|
+
* Executing batch queries
|
|
960
2678
|
*/
|
|
961
|
-
|
|
2679
|
+
batch<T = unknown>(calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal, options?: ICallBatchOptions): Promise<Result<ICallBatchResult<T>>>;
|
|
962
2680
|
/**
|
|
963
|
-
*
|
|
964
|
-
*
|
|
965
|
-
* @param
|
|
966
|
-
* @param
|
|
967
|
-
* @
|
|
968
|
-
*
|
|
969
|
-
* @return {Promise}
|
|
970
|
-
*
|
|
971
|
-
* @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/how-to-call-rest-methods/bx24-call-method.html
|
|
2681
|
+
* Calling the RestApi function
|
|
2682
|
+
* @param method - REST API method name
|
|
2683
|
+
* @param params - Parameters for the method.
|
|
2684
|
+
* @param requestId - Request id
|
|
2685
|
+
* @returns Promise with AjaxResult
|
|
972
2686
|
*/
|
|
973
|
-
|
|
2687
|
+
call<T = unknown>(method: string, params: TypeCallParams, requestId?: string): Promise<AjaxResult<T>>;
|
|
974
2688
|
/**
|
|
975
|
-
*
|
|
976
|
-
*
|
|
977
|
-
* @param {string} method Query method
|
|
978
|
-
* @param {object} params Request parameters
|
|
979
|
-
* @param {null|((progress: number) => void)} progress Processing steps
|
|
980
|
-
* @param {string} customKeyForResult Custom field indicating that the result will be a grouping key
|
|
981
|
-
* @return {Promise}
|
|
2689
|
+
* Sets the restriction parameters
|
|
982
2690
|
*/
|
|
983
|
-
|
|
2691
|
+
setRestrictionManagerParams(params: RestrictionParams): Promise<void>;
|
|
984
2692
|
/**
|
|
985
|
-
*
|
|
986
|
-
* Implements the fast algorithm described in {@see https://apidocs.bitrix24.com/api-reference/performance/huge-data.html}
|
|
987
|
-
*
|
|
988
|
-
* @param {string} method Query method
|
|
989
|
-
* @param {object} params Request parameters
|
|
990
|
-
* @param {string} idKey Entity ID field name ('ID' || 'id')
|
|
991
|
-
* @param {string} customKeyForResult Custom field indicating that the result will be a grouping key
|
|
992
|
-
*
|
|
993
|
-
* @return {AsyncGenerator} Generator
|
|
2693
|
+
* Returns the current constraint settings
|
|
994
2694
|
*/
|
|
995
|
-
|
|
2695
|
+
getRestrictionManagerParams(): RestrictionParams;
|
|
996
2696
|
/**
|
|
997
|
-
*
|
|
998
|
-
*
|
|
999
|
-
* @param {array|object} calls Request packet
|
|
1000
|
-
* calls = [[method,params],[method,params]]
|
|
1001
|
-
* calls = [{method:method,params:params},[method,params]]
|
|
1002
|
-
* calls = {call_id:[method,params],...}
|
|
1003
|
-
* @param {boolean} isHaltOnError Abort package execution when an error occurs
|
|
1004
|
-
* @param {boolean} returnAjaxResult Return `Record<string | number, AjaxResult> | AjaxResult[]` in response
|
|
1005
|
-
*
|
|
1006
|
-
* @return {Promise} Promise
|
|
1007
|
-
*
|
|
1008
|
-
* @see https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/how-to-call-rest-methods/bx24-call-batch.html
|
|
2697
|
+
* Returns job statistics
|
|
1009
2698
|
*/
|
|
1010
|
-
|
|
2699
|
+
getStats(): RestrictionManagerStats & {
|
|
2700
|
+
adaptiveDelayAvg: number;
|
|
2701
|
+
errorCounts: Record<string, number>;
|
|
2702
|
+
totalRequests: number;
|
|
2703
|
+
successfulRequests: number;
|
|
2704
|
+
failedRequests: number;
|
|
2705
|
+
totalDuration: number;
|
|
2706
|
+
byMethod: Map<string, {
|
|
2707
|
+
count: number;
|
|
2708
|
+
totalDuration: number;
|
|
2709
|
+
}>;
|
|
2710
|
+
lastErrors: {
|
|
2711
|
+
method: string;
|
|
2712
|
+
error: string;
|
|
2713
|
+
timestamp: number;
|
|
2714
|
+
}[];
|
|
2715
|
+
};
|
|
1011
2716
|
/**
|
|
1012
|
-
*
|
|
1013
|
-
*
|
|
1014
|
-
* @param {array} calls Request packet
|
|
1015
|
-
* calls = [[method,params],[method,params]]
|
|
1016
|
-
* @param {boolean} isHaltOnError Abort package execution when an error occurs
|
|
1017
|
-
*
|
|
1018
|
-
* @return {Promise} Promise
|
|
1019
|
-
*
|
|
1020
|
-
* @see https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/how-to-call-rest-methods/bx24-call-batch.html
|
|
2717
|
+
* Resets limiters and statistics
|
|
1021
2718
|
*/
|
|
1022
|
-
|
|
2719
|
+
reset(): Promise<void>;
|
|
1023
2720
|
/**
|
|
1024
|
-
*
|
|
2721
|
+
* On|Off warning about client-side query execution
|
|
2722
|
+
* @param {boolean} value
|
|
2723
|
+
* @param {string} message
|
|
1025
2724
|
*/
|
|
1026
|
-
|
|
2725
|
+
setClientSideWarning(value: boolean, message: string): void;
|
|
1027
2726
|
};
|
|
1028
2727
|
|
|
1029
2728
|
/**
|
|
@@ -1431,28 +3130,27 @@ interface IPlacementUF {
|
|
|
1431
3130
|
* It is worth remembering that there will be 1-2 languages for the B24.Box
|
|
1432
3131
|
*/
|
|
1433
3132
|
declare enum B24LangList {
|
|
1434
|
-
|
|
3133
|
+
ru = "ru",
|
|
3134
|
+
id = "id",
|
|
3135
|
+
ms = "ms",
|
|
1435
3136
|
de = "de",
|
|
3137
|
+
en = "en",
|
|
1436
3138
|
la = "la",
|
|
1437
|
-
br = "br",
|
|
1438
3139
|
fr = "fr",
|
|
3140
|
+
in = "in",
|
|
1439
3141
|
it = "it",
|
|
1440
3142
|
pl = "pl",
|
|
1441
|
-
|
|
1442
|
-
|
|
3143
|
+
br = "br",
|
|
3144
|
+
vn = "vn",
|
|
1443
3145
|
tr = "tr",
|
|
3146
|
+
kz = "kz",
|
|
3147
|
+
ua = "ua",
|
|
3148
|
+
ar = "ar",
|
|
3149
|
+
th = "th",
|
|
1444
3150
|
sc = "sc",
|
|
1445
3151
|
tc = "tc",
|
|
1446
|
-
ja = "ja"
|
|
1447
|
-
vn = "vn",
|
|
1448
|
-
id = "id",
|
|
1449
|
-
ms = "ms",
|
|
1450
|
-
th = "th",
|
|
1451
|
-
ar = "ar"
|
|
3152
|
+
ja = "ja"
|
|
1452
3153
|
}
|
|
1453
|
-
/**
|
|
1454
|
-
* @todo add docs
|
|
1455
|
-
*/
|
|
1456
3154
|
declare const B24LocaleMap: Record<B24LangList, string>;
|
|
1457
3155
|
|
|
1458
3156
|
/**
|
|
@@ -1626,7 +3324,7 @@ declare enum ConnectionType {
|
|
|
1626
3324
|
LongPolling = "longPolling"
|
|
1627
3325
|
}
|
|
1628
3326
|
type TypeConnector = {
|
|
1629
|
-
setLogger(logger:
|
|
3327
|
+
setLogger(logger: LoggerInterface): void;
|
|
1630
3328
|
destroy(): void;
|
|
1631
3329
|
connect(): void;
|
|
1632
3330
|
disconnect(code: number, reason: string): void;
|
|
@@ -1666,8 +3364,8 @@ type StorageManagerParams = {
|
|
|
1666
3364
|
siteId?: string;
|
|
1667
3365
|
};
|
|
1668
3366
|
type TypeStorageManager = {
|
|
1669
|
-
setLogger(logger:
|
|
1670
|
-
getLogger():
|
|
3367
|
+
setLogger(logger: LoggerInterface): void;
|
|
3368
|
+
getLogger(): LoggerInterface;
|
|
1671
3369
|
set(name: string, value: any): void;
|
|
1672
3370
|
get(name: string, defaultValue: any): any;
|
|
1673
3371
|
remove(name: string): void;
|
|
@@ -1916,6 +3614,48 @@ type TypePullClientMessageBatch = {
|
|
|
1916
3614
|
expiry?: number;
|
|
1917
3615
|
};
|
|
1918
3616
|
|
|
3617
|
+
type SdkErrorDetails = {
|
|
3618
|
+
code: string;
|
|
3619
|
+
description?: string;
|
|
3620
|
+
status: number;
|
|
3621
|
+
originalError?: unknown;
|
|
3622
|
+
};
|
|
3623
|
+
/**
|
|
3624
|
+
* Error in Sdk
|
|
3625
|
+
*/
|
|
3626
|
+
declare class SdkError extends Error {
|
|
3627
|
+
readonly code: string;
|
|
3628
|
+
protected _status: number;
|
|
3629
|
+
readonly timestamp: Date;
|
|
3630
|
+
readonly originalError?: unknown;
|
|
3631
|
+
constructor(params: SdkErrorDetails);
|
|
3632
|
+
get status(): number;
|
|
3633
|
+
/**
|
|
3634
|
+
* Creates SdkError from exception
|
|
3635
|
+
*/
|
|
3636
|
+
static fromException(error: unknown, context?: {
|
|
3637
|
+
code?: string;
|
|
3638
|
+
status?: number;
|
|
3639
|
+
}): SdkError;
|
|
3640
|
+
/**
|
|
3641
|
+
* Serializes error for logging and debugging
|
|
3642
|
+
*/
|
|
3643
|
+
toJSON(): {
|
|
3644
|
+
name: string;
|
|
3645
|
+
code: string;
|
|
3646
|
+
message: string;
|
|
3647
|
+
status: number;
|
|
3648
|
+
timestamp: string;
|
|
3649
|
+
stack: string | undefined;
|
|
3650
|
+
};
|
|
3651
|
+
/**
|
|
3652
|
+
* Formats error information for human-readable output
|
|
3653
|
+
*/
|
|
3654
|
+
toString(): string;
|
|
3655
|
+
protected static formatErrorMessage(params: SdkErrorDetails): string;
|
|
3656
|
+
protected cleanErrorStack(): void;
|
|
3657
|
+
}
|
|
3658
|
+
|
|
1919
3659
|
type AnswerError = {
|
|
1920
3660
|
error: string;
|
|
1921
3661
|
errorDescription: string;
|
|
@@ -1925,88 +3665,320 @@ type AjaxErrorParams = {
|
|
|
1925
3665
|
answerError: AnswerError;
|
|
1926
3666
|
cause?: Error;
|
|
1927
3667
|
};
|
|
1928
|
-
type
|
|
1929
|
-
|
|
1930
|
-
description?: string;
|
|
1931
|
-
status: number;
|
|
1932
|
-
requestInfo?: {
|
|
1933
|
-
method?: string;
|
|
3668
|
+
type AjaxErrorDetails = SdkErrorDetails & {
|
|
3669
|
+
requestInfo?: Partial<AjaxQuery> & {
|
|
1934
3670
|
url?: string;
|
|
1935
|
-
params?: Record<string, unknown> | unknown;
|
|
1936
3671
|
};
|
|
1937
|
-
|
|
1938
|
-
|
|
3672
|
+
};
|
|
3673
|
+
/**
|
|
3674
|
+
* Error requesting RestApi
|
|
3675
|
+
*/
|
|
3676
|
+
declare class AjaxError extends SdkError {
|
|
3677
|
+
readonly requestInfo?: AjaxErrorDetails['requestInfo'];
|
|
3678
|
+
constructor(params: AjaxErrorDetails);
|
|
3679
|
+
/**
|
|
3680
|
+
* Creates AjaxError from HTTP response
|
|
3681
|
+
* @todo add support v3
|
|
3682
|
+
*/
|
|
3683
|
+
static fromResponse(response: {
|
|
3684
|
+
status: number;
|
|
3685
|
+
data?: {
|
|
3686
|
+
error?: string;
|
|
3687
|
+
error_description?: string;
|
|
3688
|
+
};
|
|
3689
|
+
config?: AjaxErrorDetails['requestInfo'];
|
|
3690
|
+
}): AjaxError;
|
|
3691
|
+
/**
|
|
3692
|
+
* @inheritDoc
|
|
3693
|
+
*/
|
|
3694
|
+
static fromException(error: unknown, context?: {
|
|
3695
|
+
code?: string;
|
|
3696
|
+
status?: number;
|
|
3697
|
+
requestInfo?: AjaxErrorDetails['requestInfo'];
|
|
3698
|
+
}): AjaxError;
|
|
3699
|
+
/**
|
|
3700
|
+
* @inheritDoc
|
|
3701
|
+
*/
|
|
3702
|
+
toJSON(): {
|
|
3703
|
+
name: string;
|
|
3704
|
+
code: string;
|
|
3705
|
+
message: string;
|
|
3706
|
+
status: number;
|
|
3707
|
+
timestamp: string;
|
|
3708
|
+
requestInfo: (Partial<Readonly<{
|
|
3709
|
+
method: string;
|
|
3710
|
+
params: TypeCallParams;
|
|
3711
|
+
requestId: string;
|
|
3712
|
+
}>> & {
|
|
3713
|
+
url?: string;
|
|
3714
|
+
}) | undefined;
|
|
3715
|
+
stack: string | undefined;
|
|
3716
|
+
};
|
|
3717
|
+
/**
|
|
3718
|
+
* @inheritDoc
|
|
3719
|
+
*/
|
|
3720
|
+
toString(): string;
|
|
3721
|
+
/**
|
|
3722
|
+
* @inheritDoc
|
|
3723
|
+
*/
|
|
3724
|
+
protected static formatErrorMessage(params: AjaxErrorDetails): string;
|
|
3725
|
+
/**
|
|
3726
|
+
* @inheritDoc
|
|
3727
|
+
*/
|
|
3728
|
+
protected cleanErrorStack(): void;
|
|
3729
|
+
}
|
|
3730
|
+
|
|
3731
|
+
/**
|
|
3732
|
+
* Factory for creating constraint parameters
|
|
3733
|
+
*/
|
|
3734
|
+
declare class ParamsFactory {
|
|
3735
|
+
/**
|
|
3736
|
+
* Default parameters for regular tariffs
|
|
3737
|
+
*
|
|
3738
|
+
* @see Http.#restrictionParams
|
|
3739
|
+
*/
|
|
3740
|
+
static getDefault(): RestrictionParams;
|
|
3741
|
+
/**
|
|
3742
|
+
* Parameters for the Enterprise plan
|
|
3743
|
+
*/
|
|
3744
|
+
static getEnterprise(): RestrictionParams;
|
|
3745
|
+
/**
|
|
3746
|
+
* Parameters for bulk data processing
|
|
3747
|
+
*/
|
|
3748
|
+
static getBatchProcessing(): RestrictionParams;
|
|
3749
|
+
/**
|
|
3750
|
+
* Real-time parameters
|
|
3751
|
+
*/
|
|
3752
|
+
static getRealtime(): RestrictionParams;
|
|
3753
|
+
/**
|
|
3754
|
+
* Tariff plan based parameters
|
|
3755
|
+
*/
|
|
3756
|
+
static fromTariffPlan(plan: string): RestrictionParams;
|
|
3757
|
+
}
|
|
3758
|
+
|
|
3759
|
+
/**
|
|
3760
|
+
* Rate limiting (Leaky Bucket) with adaptive control
|
|
3761
|
+
*/
|
|
3762
|
+
declare class RateLimiter implements ILimiter {
|
|
3763
|
+
#private;
|
|
3764
|
+
private _logger;
|
|
3765
|
+
constructor(config: RateLimitConfig);
|
|
3766
|
+
getTitle(): string;
|
|
3767
|
+
setLogger(logger: LoggerInterface): void;
|
|
3768
|
+
getLogger(): LoggerInterface;
|
|
3769
|
+
/**
|
|
3770
|
+
* @inheritDoc
|
|
3771
|
+
*/
|
|
3772
|
+
canProceed(requestId: string, _method: string, _params?: any): Promise<boolean>;
|
|
3773
|
+
/**
|
|
3774
|
+
* @inheritDoc
|
|
3775
|
+
*/
|
|
3776
|
+
waitIfNeeded(requestId: string, _method: string, _params?: any): Promise<number>;
|
|
3777
|
+
/**
|
|
3778
|
+
* Error handler.
|
|
3779
|
+
* If there are a lot of errors, we'll lower the limits.
|
|
3780
|
+
*/
|
|
3781
|
+
handleExceeded(requestId: string): Promise<number>;
|
|
3782
|
+
/**
|
|
3783
|
+
* Successful request handler.
|
|
3784
|
+
* If everything is OK, we'll restore the limits.
|
|
3785
|
+
*/
|
|
3786
|
+
updateStats(requestId: string, method: string, _data: any): Promise<void>;
|
|
3787
|
+
/**
|
|
3788
|
+
* @inheritDoc
|
|
3789
|
+
*/
|
|
3790
|
+
reset(): Promise<void>;
|
|
3791
|
+
/**
|
|
3792
|
+
* @inheritDoc
|
|
3793
|
+
*/
|
|
3794
|
+
getStats(): {
|
|
3795
|
+
tokens: number;
|
|
3796
|
+
burstLimit: number;
|
|
3797
|
+
originalBurstLimit: number;
|
|
3798
|
+
drainRate: number;
|
|
3799
|
+
originalDrainRate: number;
|
|
3800
|
+
refillIntervalMs: number;
|
|
3801
|
+
lastRefill: number;
|
|
3802
|
+
pendingRequests: number;
|
|
3803
|
+
recentErrors: number;
|
|
3804
|
+
recentSuccesses: number;
|
|
3805
|
+
};
|
|
3806
|
+
/**
|
|
3807
|
+
* @inheritDoc
|
|
3808
|
+
*/
|
|
3809
|
+
setConfig(config: RateLimitConfig): Promise<void>;
|
|
3810
|
+
}
|
|
3811
|
+
|
|
3812
|
+
interface OperatingStats {
|
|
3813
|
+
operating: number;
|
|
3814
|
+
/**
|
|
3815
|
+
* reset time (timestamp in ms)
|
|
3816
|
+
*/
|
|
3817
|
+
operating_reset_at: number;
|
|
3818
|
+
lastUpdated: number;
|
|
3819
|
+
}
|
|
3820
|
+
/**
|
|
3821
|
+
* Operating limiting
|
|
3822
|
+
*
|
|
3823
|
+
* @todo docs
|
|
3824
|
+
*/
|
|
3825
|
+
declare class OperatingLimiter implements ILimiter {
|
|
3826
|
+
#private;
|
|
3827
|
+
private _logger;
|
|
3828
|
+
getTitle(): string;
|
|
3829
|
+
constructor(config: OperatingLimitConfig);
|
|
3830
|
+
setLogger(logger: LoggerInterface): void;
|
|
3831
|
+
getLogger(): LoggerInterface;
|
|
3832
|
+
get limitMs(): number;
|
|
3833
|
+
getMethodStat(method: string): undefined | OperatingStats;
|
|
3834
|
+
canProceed(requestId: string, method: string, params?: any): Promise<boolean>;
|
|
3835
|
+
waitIfNeeded(requestId: string, method: string, params?: any): Promise<number>;
|
|
3836
|
+
/**
|
|
3837
|
+
* Returns the time until the method's operating limit is released (in ms)
|
|
3838
|
+
* The analysis is based on the previous function call.
|
|
3839
|
+
* It's important to understand that we're talking about locks of up to 10 minutes.
|
|
3840
|
+
* This is a fairly strict lock based on the limit:
|
|
3841
|
+
* - not reached - no lock
|
|
3842
|
+
* - reached - lock until the unlock time + 1 second
|
|
3843
|
+
*/
|
|
3844
|
+
getTimeToFree(requestId: string, method: string, params?: any, _error?: any): Promise<number>;
|
|
3845
|
+
/**
|
|
3846
|
+
* Updates operating time statistics for the method
|
|
3847
|
+
*/
|
|
3848
|
+
updateStats(requestId: string, method: string, data: PayloadTime): Promise<void>;
|
|
3849
|
+
reset(): Promise<void>;
|
|
3850
|
+
getStats(): {
|
|
3851
|
+
heavyRequestCount: number;
|
|
3852
|
+
operatingStats: {
|
|
3853
|
+
[method: string]: number;
|
|
3854
|
+
};
|
|
3855
|
+
};
|
|
3856
|
+
setConfig(config: OperatingLimitConfig): Promise<void>;
|
|
3857
|
+
}
|
|
3858
|
+
|
|
1939
3859
|
/**
|
|
1940
|
-
*
|
|
3860
|
+
* Adaptive delayer
|
|
3861
|
+
*
|
|
3862
|
+
* @todo docs
|
|
1941
3863
|
*/
|
|
1942
|
-
declare class
|
|
1943
|
-
|
|
1944
|
-
private
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
3864
|
+
declare class AdaptiveDelayer implements ILimiter {
|
|
3865
|
+
#private;
|
|
3866
|
+
private _logger;
|
|
3867
|
+
getTitle(): string;
|
|
3868
|
+
constructor(config: AdaptiveConfig, operatingLimiter: OperatingLimiter);
|
|
3869
|
+
setLogger(logger: LoggerInterface): void;
|
|
3870
|
+
getLogger(): LoggerInterface;
|
|
3871
|
+
canProceed(_requestId: string, _method: string, _params?: any): Promise<boolean>;
|
|
3872
|
+
/**
|
|
3873
|
+
* Returns an adaptive delay based on previous experience
|
|
3874
|
+
*/
|
|
3875
|
+
waitIfNeeded(requestId: string, method: string, params?: any): Promise<number>;
|
|
3876
|
+
updateStats(_requestId: string, _method: string, _data: any): Promise<void>;
|
|
3877
|
+
reset(): Promise<void>;
|
|
3878
|
+
getStats(): {
|
|
3879
|
+
adaptiveDelays: number;
|
|
3880
|
+
totalAdaptiveDelay: number;
|
|
3881
|
+
adaptiveDelayAvg: number;
|
|
3882
|
+
};
|
|
3883
|
+
setConfig(config: AdaptiveConfig): Promise<void>;
|
|
3884
|
+
incrementAdaptiveDelays(): void;
|
|
3885
|
+
}
|
|
3886
|
+
|
|
3887
|
+
/**
|
|
3888
|
+
* Delay Management Manager
|
|
3889
|
+
*
|
|
3890
|
+
* @todo docs
|
|
3891
|
+
*/
|
|
3892
|
+
declare class RestrictionManager {
|
|
3893
|
+
#private;
|
|
3894
|
+
private _logger;
|
|
3895
|
+
constructor(params: RestrictionParams);
|
|
3896
|
+
setLogger(logger: LoggerInterface): void;
|
|
3897
|
+
getLogger(): LoggerInterface;
|
|
3898
|
+
applyOperatingLimits(requestId: string, method: string, params?: any): Promise<void>;
|
|
1949
3899
|
/**
|
|
1950
|
-
*
|
|
3900
|
+
* Checks and waits for the rate limit
|
|
3901
|
+
* The loop is needed for parallel requests (Promise.all())
|
|
1951
3902
|
*/
|
|
1952
|
-
|
|
1953
|
-
|
|
3903
|
+
checkRateLimit(requestId: string, method: string): Promise<void>;
|
|
3904
|
+
updateStats(requestId: string, method: string, timeData: any): Promise<void>;
|
|
3905
|
+
handleError(requestId: string, method: string, params: any, error: any, attempt: number): Promise<number>;
|
|
1954
3906
|
/**
|
|
1955
|
-
*
|
|
3907
|
+
* These exceptions will be thrown
|
|
1956
3908
|
*/
|
|
1957
|
-
|
|
3909
|
+
get exceptionCodeForHard(): string[];
|
|
1958
3910
|
/**
|
|
1959
|
-
*
|
|
3911
|
+
* These exceptions will be thrown into `AjaxResult` as `AjaxError`
|
|
1960
3912
|
*/
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
error_description?: string;
|
|
1966
|
-
};
|
|
1967
|
-
config?: {
|
|
1968
|
-
method?: string;
|
|
1969
|
-
url?: string;
|
|
1970
|
-
params?: unknown;
|
|
1971
|
-
};
|
|
1972
|
-
}): AjaxError;
|
|
3913
|
+
get exceptionCodeForSoft(): string[];
|
|
3914
|
+
incrementError(method: string): void;
|
|
3915
|
+
resetErrors(method: string): void;
|
|
3916
|
+
incrementStats(stat: keyof Pick<RestrictionManagerStats, 'retries' | 'consecutiveErrors' | 'limitHits'>): void;
|
|
1973
3917
|
/**
|
|
1974
|
-
*
|
|
3918
|
+
* Returns job statistics
|
|
1975
3919
|
*/
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
}): AjaxError;
|
|
3920
|
+
getStats(): RestrictionManagerStats & {
|
|
3921
|
+
adaptiveDelayAvg: number;
|
|
3922
|
+
errorCounts: Record<string, number>;
|
|
3923
|
+
};
|
|
1981
3924
|
/**
|
|
1982
|
-
*
|
|
3925
|
+
* Resets limiters and statistics
|
|
1983
3926
|
*/
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
message: string;
|
|
1988
|
-
status: number;
|
|
1989
|
-
timestamp: string;
|
|
1990
|
-
requestInfo: {
|
|
1991
|
-
method?: string;
|
|
1992
|
-
url?: string;
|
|
1993
|
-
params?: Record<string, unknown> | unknown;
|
|
1994
|
-
} | undefined;
|
|
1995
|
-
stack: string | undefined;
|
|
1996
|
-
};
|
|
3927
|
+
reset(): Promise<void>;
|
|
3928
|
+
setConfig(params: RestrictionParams): Promise<void>;
|
|
3929
|
+
getParams(): RestrictionParams;
|
|
1997
3930
|
/**
|
|
1998
|
-
*
|
|
3931
|
+
* Public access to the delay function
|
|
1999
3932
|
*/
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
3933
|
+
waiteDelay(ms: number): Promise<void>;
|
|
3934
|
+
}
|
|
3935
|
+
|
|
3936
|
+
/**
|
|
3937
|
+
* @todo add docs ??
|
|
3938
|
+
*/
|
|
3939
|
+
declare class VersionManager {
|
|
3940
|
+
#private;
|
|
3941
|
+
constructor();
|
|
3942
|
+
static create(): VersionManager;
|
|
3943
|
+
/**
|
|
3944
|
+
* List of supported API versions
|
|
3945
|
+
* The highest version must be first
|
|
3946
|
+
*/
|
|
3947
|
+
getAllApiVersions(): ApiVersion[];
|
|
3948
|
+
isSupport(version: ApiVersion, method: string): boolean;
|
|
3949
|
+
/**
|
|
3950
|
+
* Automatically obtain the API version
|
|
3951
|
+
*/
|
|
3952
|
+
automaticallyObtainApiVersion(method: string): ApiVersion;
|
|
3953
|
+
/**
|
|
3954
|
+
* Automatically obtain the API version for Batch
|
|
3955
|
+
*
|
|
3956
|
+
* @todo test methods
|
|
3957
|
+
* `[['crm.item.get', { entityTypeId: 3, id: 1 }]]`
|
|
3958
|
+
* `[{ method: 'crm.item.get', params: { entityTypeId: 3, id: 1 } }]`
|
|
3959
|
+
* `{ cmd1: { method: 'crm.item.get', params: { entityTypeId: 3, id: 1 } }, cmd2: ['crm.item.get', { entityTypeId: 2, id: 2 }] }`
|
|
3960
|
+
*/
|
|
3961
|
+
automaticallyObtainApiVersionForBatch(calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal): ApiVersion;
|
|
2003
3962
|
}
|
|
3963
|
+
declare const versionManager: VersionManager;
|
|
2004
3964
|
|
|
3965
|
+
/**
|
|
3966
|
+
* @todo docs
|
|
3967
|
+
*/
|
|
2005
3968
|
declare abstract class AbstractB24 implements TypeB24 {
|
|
3969
|
+
/**
|
|
3970
|
+
* Maximum length for batch response.
|
|
3971
|
+
*
|
|
3972
|
+
* @deprecated This const is deprecated and will be removed in version `2.0.0`
|
|
3973
|
+
* @removed 2.0.0
|
|
3974
|
+
*/
|
|
2006
3975
|
static readonly batchSize = 50;
|
|
2007
3976
|
protected _isInit: boolean;
|
|
2008
|
-
protected
|
|
2009
|
-
protected
|
|
3977
|
+
protected _httpV2: null | TypeHttp;
|
|
3978
|
+
protected _httpV3: null | TypeHttp;
|
|
3979
|
+
protected _logger: LoggerInterface;
|
|
3980
|
+
protected _actionsManager: ActionsManager;
|
|
3981
|
+
protected _toolsManager: ToolsManager;
|
|
2010
3982
|
protected constructor();
|
|
2011
3983
|
/**
|
|
2012
3984
|
* @inheritDoc
|
|
@@ -2014,9 +3986,9 @@ declare abstract class AbstractB24 implements TypeB24 {
|
|
|
2014
3986
|
get isInit(): boolean;
|
|
2015
3987
|
init(): Promise<void>;
|
|
2016
3988
|
destroy(): void;
|
|
2017
|
-
setLogger(logger: LoggerBrowser): void;
|
|
2018
|
-
getLogger(): LoggerBrowser;
|
|
2019
3989
|
abstract get auth(): AuthActions;
|
|
3990
|
+
get actions(): ActionsManager;
|
|
3991
|
+
get tools(): ToolsManager;
|
|
2020
3992
|
/**
|
|
2021
3993
|
* @inheritDoc
|
|
2022
3994
|
*/
|
|
@@ -2024,32 +3996,76 @@ declare abstract class AbstractB24 implements TypeB24 {
|
|
|
2024
3996
|
/**
|
|
2025
3997
|
* @inheritDoc
|
|
2026
3998
|
*/
|
|
2027
|
-
abstract getTargetOriginWithPath(): string
|
|
3999
|
+
abstract getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
2028
4000
|
/**
|
|
2029
|
-
*
|
|
4001
|
+
* Calls the Bitrix24 REST API method.
|
|
4002
|
+
*
|
|
4003
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
4004
|
+
* - for `restApi:v3` use {@link CallV3.make `b24.actions.v3.call.make(options)`}
|
|
4005
|
+
* - for `restApi:v2` use {@link CallV2.make `b24.actions.v2.call.make(options)`}
|
|
4006
|
+
*
|
|
4007
|
+
* @removed 2.0.0
|
|
4008
|
+
* @memo Only for `restApi:v2`
|
|
2030
4009
|
*/
|
|
2031
4010
|
callMethod(method: string, params?: object, start?: number): Promise<AjaxResult>;
|
|
2032
4011
|
/**
|
|
2033
|
-
*
|
|
4012
|
+
* Calls a Bitrix24 REST API list method to retrieve all data.
|
|
4013
|
+
*
|
|
4014
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
4015
|
+
* - for `restApi:v3` use {@link CallListV3.make `b24.actions.v3.callList.make(options)`}
|
|
4016
|
+
* - for `restApi:v2` use {@link CallListV2.make `b24.actions.v2.callList.make(options)`}
|
|
4017
|
+
*
|
|
4018
|
+
* @removed 2.0.0
|
|
4019
|
+
* @memo Only for `restApi:v2`
|
|
2034
4020
|
*/
|
|
2035
|
-
callListMethod(method: string, params?: object, progress?: null | ((progress: number) => void), customKeyForResult?:
|
|
4021
|
+
callListMethod(method: string, params?: object, progress?: null | ((progress: number) => void), customKeyForResult?: string | null): Promise<Result>;
|
|
2036
4022
|
/**
|
|
2037
|
-
*
|
|
4023
|
+
* Calls a Bitrix24 REST API list method and returns an async generator.
|
|
4024
|
+
*
|
|
4025
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
4026
|
+
* - for `restApi:v3` use {@link FetchListV3.make `b24.actions.v3.fetchList.make(options)`}
|
|
4027
|
+
* - for `restApi:v2` use {@link FetchListV2.make `b24.actions.v2.fetchList.make(options)`}
|
|
4028
|
+
*
|
|
4029
|
+
* @removed 2.0.0
|
|
4030
|
+
* @memo Only for `restApi:v2`
|
|
2038
4031
|
*/
|
|
2039
|
-
fetchListMethod(method: string, params?: any, idKey?: string, customKeyForResult?:
|
|
4032
|
+
fetchListMethod(method: string, params?: any, idKey?: string, customKeyForResult?: string | null): AsyncGenerator<any[]>;
|
|
2040
4033
|
/**
|
|
2041
|
-
*
|
|
4034
|
+
* Executes a batch request to the Bitrix24 REST API.
|
|
4035
|
+
*
|
|
4036
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
4037
|
+
* - for `restApi:v3` use {@link BatchV3.make `b24.actions.v3.batch.make(options)`}
|
|
4038
|
+
* - for `restApi:v2` use {@link BatchV2.make `b24.actions.v2.batch.make(options)`}
|
|
4039
|
+
*
|
|
4040
|
+
* @removed 2.0.0
|
|
4041
|
+
* @memo Only for `restApi:v2`
|
|
2042
4042
|
*/
|
|
2043
4043
|
callBatch(calls: Array<any> | object, isHaltOnError?: boolean, returnAjaxResult?: boolean): Promise<Result>;
|
|
2044
|
-
|
|
4044
|
+
/**
|
|
4045
|
+
* Executes a batch request to the Bitrix24 REST API with automatic chunking for any number of commands.
|
|
4046
|
+
*
|
|
4047
|
+
* @deprecated This method is deprecated and will be removed in version `2.0.0`
|
|
4048
|
+
* - for `restApi:v3` use {@link BatchByChunkV3.make `b24.actions.v3.batchByChunk.make(options)`}
|
|
4049
|
+
* - for `restApi:v2` use {@link BatchByChunkV2.make `b24.actions.v2.batchByChunk.make(options)`}
|
|
4050
|
+
*
|
|
4051
|
+
* @removed 2.0.0
|
|
4052
|
+
* @memo Only for `restApi:v2`
|
|
4053
|
+
*/
|
|
4054
|
+
callBatchByChunk(calls: Array<any>, isHaltOnError: boolean): Promise<Result>;
|
|
4055
|
+
/**
|
|
4056
|
+
* @inheritDoc
|
|
4057
|
+
*/
|
|
4058
|
+
getHttpClient(version: ApiVersion): TypeHttp;
|
|
2045
4059
|
/**
|
|
2046
4060
|
* @inheritDoc
|
|
2047
4061
|
*/
|
|
2048
|
-
|
|
4062
|
+
setHttpClient(version: ApiVersion, client: TypeHttp): void;
|
|
4063
|
+
setLogger(logger: LoggerInterface): void;
|
|
4064
|
+
getLogger(): LoggerInterface;
|
|
2049
4065
|
/**
|
|
2050
4066
|
* @inheritDoc
|
|
2051
4067
|
*/
|
|
2052
|
-
|
|
4068
|
+
setRestrictionManagerParams(params: RestrictionParams): Promise<void>;
|
|
2053
4069
|
/**
|
|
2054
4070
|
* Returns settings for http connection
|
|
2055
4071
|
* @protected
|
|
@@ -2062,6 +4078,184 @@ declare abstract class AbstractB24 implements TypeB24 {
|
|
|
2062
4078
|
protected _ensureInitialized(): void;
|
|
2063
4079
|
}
|
|
2064
4080
|
|
|
4081
|
+
declare class RequestIdGenerator implements IRequestIdGenerator {
|
|
4082
|
+
getQueryStringParameterName(): string;
|
|
4083
|
+
getQueryStringSdkParameterName(): string;
|
|
4084
|
+
getQueryStringSdkTypeParameterName(): string;
|
|
4085
|
+
private generate;
|
|
4086
|
+
getRequestId(): string;
|
|
4087
|
+
getHeaderFieldName(): string;
|
|
4088
|
+
}
|
|
4089
|
+
|
|
4090
|
+
type AjaxResponse<T = unknown> = {
|
|
4091
|
+
status: number;
|
|
4092
|
+
payload: SuccessPayload<T>;
|
|
4093
|
+
};
|
|
4094
|
+
type TypePrepareParams = TypeCallParams & {
|
|
4095
|
+
data?: Record<string, any>;
|
|
4096
|
+
auth?: string;
|
|
4097
|
+
};
|
|
4098
|
+
/**
|
|
4099
|
+
* Abstract Class for working with RestApi requests via http
|
|
4100
|
+
*
|
|
4101
|
+
* @link https://bitrix24.github.io/b24jssdk/
|
|
4102
|
+
*
|
|
4103
|
+
* @todo docs
|
|
4104
|
+
*/
|
|
4105
|
+
declare abstract class AbstractHttp implements TypeHttp {
|
|
4106
|
+
protected _clientAxios: AxiosInstance;
|
|
4107
|
+
protected _authActions: AuthActions;
|
|
4108
|
+
protected _requestIdGenerator: RequestIdGenerator;
|
|
4109
|
+
protected _restrictionManager: RestrictionManager;
|
|
4110
|
+
protected _logger: LoggerInterface;
|
|
4111
|
+
protected _isClientSideWarning: boolean;
|
|
4112
|
+
protected _clientSideWarningMessage: string;
|
|
4113
|
+
protected _version: ApiVersion;
|
|
4114
|
+
protected _metrics: {
|
|
4115
|
+
totalRequests: number;
|
|
4116
|
+
successfulRequests: number;
|
|
4117
|
+
failedRequests: number;
|
|
4118
|
+
totalDuration: number;
|
|
4119
|
+
byMethod: Map<string, {
|
|
4120
|
+
count: number;
|
|
4121
|
+
totalDuration: number;
|
|
4122
|
+
}>;
|
|
4123
|
+
lastErrors: Array<{
|
|
4124
|
+
method: string;
|
|
4125
|
+
error: string;
|
|
4126
|
+
timestamp: number;
|
|
4127
|
+
}>;
|
|
4128
|
+
};
|
|
4129
|
+
constructor(authActions: AuthActions, options?: null | object, restrictionParams?: Partial<RestrictionParams>);
|
|
4130
|
+
get apiVersion(): ApiVersion;
|
|
4131
|
+
get ajaxClient(): AxiosInstance;
|
|
4132
|
+
setLogger(logger: LoggerInterface): void;
|
|
4133
|
+
getLogger(): LoggerInterface;
|
|
4134
|
+
setRestrictionManagerParams(params: RestrictionParams): Promise<void>;
|
|
4135
|
+
getRestrictionManagerParams(): RestrictionParams;
|
|
4136
|
+
/**
|
|
4137
|
+
* @inheritDoc
|
|
4138
|
+
*/
|
|
4139
|
+
getStats(): RestrictionManagerStats & {
|
|
4140
|
+
adaptiveDelayAvg: number;
|
|
4141
|
+
errorCounts: Record<string, number>;
|
|
4142
|
+
totalRequests: number;
|
|
4143
|
+
successfulRequests: number;
|
|
4144
|
+
failedRequests: number;
|
|
4145
|
+
totalDuration: number;
|
|
4146
|
+
byMethod: Map<string, {
|
|
4147
|
+
count: number;
|
|
4148
|
+
totalDuration: number;
|
|
4149
|
+
}>;
|
|
4150
|
+
lastErrors: {
|
|
4151
|
+
method: string;
|
|
4152
|
+
error: string;
|
|
4153
|
+
timestamp: number;
|
|
4154
|
+
}[];
|
|
4155
|
+
};
|
|
4156
|
+
/**
|
|
4157
|
+
* @inheritDoc
|
|
4158
|
+
*/
|
|
4159
|
+
reset(): Promise<void>;
|
|
4160
|
+
protected _updateMetrics(method: string, isSuccess: boolean, duration: number, error?: unknown): void;
|
|
4161
|
+
abstract batch<T = unknown>(calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal, options?: ICallBatchOptions): Promise<Result<ICallBatchResult<T>>>;
|
|
4162
|
+
protected _validateParams(requestId: string, method: string, params: TypeCallParams): void;
|
|
4163
|
+
/**
|
|
4164
|
+
* Calling the RestApi function
|
|
4165
|
+
* @param method - REST API method name
|
|
4166
|
+
* @param params - Parameters for the method.
|
|
4167
|
+
* @param requestId - Request id
|
|
4168
|
+
* @returns Promise with AjaxResult
|
|
4169
|
+
*/
|
|
4170
|
+
call<T = unknown>(method: string, params: TypeCallParams, requestId?: string): Promise<AjaxResult<T>>;
|
|
4171
|
+
protected _convertToAjaxError(requestId: string, error: unknown, method: string, params: TypeCallParams): AjaxError;
|
|
4172
|
+
protected _convertAxiosErrorToAjaxError(requestId: string, axiosError: AxiosError, method: string, params: TypeCallParams): AjaxError;
|
|
4173
|
+
protected _convertUnknownErrorToAjaxError(requestId: string, error: unknown, method: string, params: TypeCallParams): AjaxError;
|
|
4174
|
+
/**
|
|
4175
|
+
* Performs a single call with
|
|
4176
|
+
* - 401 error handling
|
|
4177
|
+
* - rate limit check
|
|
4178
|
+
* - updating operating statistics
|
|
4179
|
+
*/
|
|
4180
|
+
protected _executeSingleCall<T = unknown>(requestId: string, method: string, params: TypeCallParams): Promise<AjaxResult<T>>;
|
|
4181
|
+
protected _ensureAuth(requestId: string): Promise<AuthData>;
|
|
4182
|
+
protected _makeRequestWithAuthRetry<T>(requestId: string, method: string, params: TypeCallParams, authData: AuthData): Promise<AjaxResponse<T>>;
|
|
4183
|
+
protected _makeAxiosRequest<T>(requestId: string, method: string, params: TypeCallParams, authData: AuthData): Promise<AjaxResponse<T>>;
|
|
4184
|
+
protected _isAuthError(error: unknown): boolean;
|
|
4185
|
+
protected _createAjaxResultFromResponse<T>(response: AjaxResponse<T>, requestId: string, method: string, params: TypeCallParams): Promise<AjaxResult<T>>;
|
|
4186
|
+
/**
|
|
4187
|
+
* This works in conjunction with the AbstractHttp._convertAxiosErrorToAjaxError function
|
|
4188
|
+
*/
|
|
4189
|
+
protected _createAjaxResultWithErrorFromResponse<T>(ajaxError: AjaxError, requestId: string, method: string, params: TypeCallParams): AjaxResult<T>;
|
|
4190
|
+
/**
|
|
4191
|
+
* Makes the function name safe and adds JSON format
|
|
4192
|
+
*/
|
|
4193
|
+
protected abstract _prepareMethod(requestId: string, method: string, baseUrl: string): string;
|
|
4194
|
+
/**
|
|
4195
|
+
* Processes function parameters and adds authorization
|
|
4196
|
+
*/
|
|
4197
|
+
protected _prepareParams(authData: AuthData, params: TypeCallParams): TypePrepareParams;
|
|
4198
|
+
/**
|
|
4199
|
+
* @inheritDoc
|
|
4200
|
+
*/
|
|
4201
|
+
setClientSideWarning(value: boolean, message: string): void;
|
|
4202
|
+
/**
|
|
4203
|
+
* Tests whether the code is executed on the client side
|
|
4204
|
+
* @return {boolean}
|
|
4205
|
+
* @protected
|
|
4206
|
+
*/
|
|
4207
|
+
protected isServerSide(): boolean;
|
|
4208
|
+
/**
|
|
4209
|
+
* Get the BX24 account address with the path based on the API version
|
|
4210
|
+
*/
|
|
4211
|
+
getBaseUrl(): string;
|
|
4212
|
+
protected _sanitizeParams(params: TypeCallParams): Record<string, unknown>;
|
|
4213
|
+
protected _logRequest(requestId: string, method: string, params: TypeCallParams): void;
|
|
4214
|
+
protected _logAttempt(requestId: string, method: string, attempt: number, maxRetries: number): void;
|
|
4215
|
+
protected _logRefreshingAuthToken(requestId: string): void;
|
|
4216
|
+
protected _logAuthErrorDetected(requestId: string): void;
|
|
4217
|
+
protected _logSuccessfulRequest(requestId: string, method: string, duration: number): void;
|
|
4218
|
+
protected _logFailedRequest(requestId: string, method: string, attempt: number, maxRetries: number, error: AjaxError): void;
|
|
4219
|
+
protected _logAttemptRetryWaiteDelay(requestId: string, method: string, wait: number, attempt: number, maxRetries: number): void;
|
|
4220
|
+
protected _logAllAttemptsExhausted(requestId: string, method: string, attempt: number, maxRetries: number): void;
|
|
4221
|
+
protected _logBatchStart(requestId: string, calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal, options: ICallBatchOptions): void;
|
|
4222
|
+
protected _logBatchCompletion(requestId: string, total: number, errors: number): void;
|
|
4223
|
+
protected _checkClientSideWarning(requestId: string): void;
|
|
4224
|
+
}
|
|
4225
|
+
|
|
4226
|
+
/**
|
|
4227
|
+
* Class for working with RestApi v2 requests via http
|
|
4228
|
+
*
|
|
4229
|
+
* @link https://bitrix24.github.io/b24jssdk/
|
|
4230
|
+
*
|
|
4231
|
+
* @todo docs
|
|
4232
|
+
*/
|
|
4233
|
+
declare class HttpV2 extends AbstractHttp implements TypeHttp {
|
|
4234
|
+
constructor(authActions: AuthActions, options?: null | object, restrictionParams?: Partial<RestrictionParams>);
|
|
4235
|
+
batch<T = unknown>(calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal, options?: ICallBatchOptions): Promise<Result<ICallBatchResult<T>>>;
|
|
4236
|
+
/**
|
|
4237
|
+
* @inheritDoc
|
|
4238
|
+
*/
|
|
4239
|
+
protected _prepareMethod(requestId: string, method: string, baseUrl: string): string;
|
|
4240
|
+
}
|
|
4241
|
+
|
|
4242
|
+
/**
|
|
4243
|
+
* Class for working with RestApi v3 requests via http
|
|
4244
|
+
*
|
|
4245
|
+
* @link https://bitrix24.github.io/b24jssdk/
|
|
4246
|
+
* @link https://apidocs.bitrix24.com/api-reference/rest-v3/index.html
|
|
4247
|
+
*
|
|
4248
|
+
* @todo docs
|
|
4249
|
+
*/
|
|
4250
|
+
declare class HttpV3 extends AbstractHttp implements TypeHttp {
|
|
4251
|
+
constructor(authActions: AuthActions, options?: null | object, restrictionParams?: Partial<RestrictionParams>);
|
|
4252
|
+
batch<T = unknown>(calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal, options?: ICallBatchOptions): Promise<Result<ICallBatchResult<T>>>;
|
|
4253
|
+
/**
|
|
4254
|
+
* @inheritDoc
|
|
4255
|
+
*/
|
|
4256
|
+
protected _prepareMethod(requestId: string, method: string, baseUrl: string): string;
|
|
4257
|
+
}
|
|
4258
|
+
|
|
2065
4259
|
declare class FormatterNumbers {
|
|
2066
4260
|
private static isInternalConstructing;
|
|
2067
4261
|
private static instance;
|
|
@@ -2097,7 +4291,7 @@ declare class IbanSpecification {
|
|
|
2097
4291
|
/**
|
|
2098
4292
|
* Check if the passed iban is valid, according to this specification.
|
|
2099
4293
|
*
|
|
2100
|
-
* @param {
|
|
4294
|
+
* @param {string} iban the iban to validate
|
|
2101
4295
|
* @returns {boolean} true if valid, false otherwise
|
|
2102
4296
|
*/
|
|
2103
4297
|
isValid(iban: string): boolean;
|
|
@@ -2155,7 +4349,7 @@ declare class IbanSpecification {
|
|
|
2155
4349
|
* Calculates MOD 97 10 of the passed IBAN as specified in ISO7064.
|
|
2156
4350
|
*
|
|
2157
4351
|
* @param iban
|
|
2158
|
-
* @returns {number}
|
|
4352
|
+
* @returns {number} MOD
|
|
2159
4353
|
*/
|
|
2160
4354
|
private _iso7064Mod9710;
|
|
2161
4355
|
}
|
|
@@ -2172,7 +4366,7 @@ declare class FormatterIban {
|
|
|
2172
4366
|
/**
|
|
2173
4367
|
* Check if an IBAN is valid.
|
|
2174
4368
|
*
|
|
2175
|
-
* @param {
|
|
4369
|
+
* @param {string} iban the IBAN to validate.
|
|
2176
4370
|
* @returns {boolean} true if the passed IBAN is valid, false otherwise
|
|
2177
4371
|
*/
|
|
2178
4372
|
isValid(iban: string): boolean;
|
|
@@ -2182,8 +4376,8 @@ declare class FormatterIban {
|
|
|
2182
4376
|
* Convert an IBAN to a BBAN.
|
|
2183
4377
|
*
|
|
2184
4378
|
* @param iban
|
|
2185
|
-
* @param {
|
|
2186
|
-
* @returns {string|*}
|
|
4379
|
+
* @param {string} [separator] the separator to use between the blocks of the BBAN, defaults to ' '
|
|
4380
|
+
* @returns {string|*} Convert an IBAN to a BBAN.
|
|
2187
4381
|
*/
|
|
2188
4382
|
toBBAN(iban: string, separator?: string): string;
|
|
2189
4383
|
/**
|
|
@@ -2213,26 +4407,38 @@ declare const useFormatter: () => {
|
|
|
2213
4407
|
/**
|
|
2214
4408
|
* B24.Hook Manager.
|
|
2215
4409
|
*
|
|
2216
|
-
* @link https://
|
|
4410
|
+
* @link https://bitrix24.github.io/b24jssdk/docs/hook/
|
|
4411
|
+
*
|
|
4412
|
+
* @todo docs
|
|
2217
4413
|
*/
|
|
2218
4414
|
declare class B24Hook extends AbstractB24 implements TypeB24 {
|
|
2219
4415
|
#private;
|
|
2220
|
-
constructor(b24HookParams: B24HookParams
|
|
2221
|
-
|
|
4416
|
+
constructor(b24HookParams: B24HookParams, options?: {
|
|
4417
|
+
restrictionParams?: Partial<RestrictionParams>;
|
|
4418
|
+
});
|
|
2222
4419
|
get auth(): AuthActions;
|
|
2223
4420
|
/**
|
|
2224
4421
|
* Disables warning about client-side query execution
|
|
2225
4422
|
*/
|
|
2226
4423
|
offClientSideWarning(): void;
|
|
2227
4424
|
/**
|
|
2228
|
-
*
|
|
4425
|
+
* @inheritDoc
|
|
2229
4426
|
*/
|
|
2230
4427
|
getTargetOrigin(): string;
|
|
2231
4428
|
/**
|
|
2232
|
-
*
|
|
4429
|
+
* @inheritDoc
|
|
4430
|
+
*/
|
|
4431
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
4432
|
+
/**
|
|
4433
|
+
* Init Webhook from url
|
|
4434
|
+
* - ver2 `https://your_domain.bitrix24.com/rest/{id}/{webhook}`
|
|
4435
|
+
* - ver3 `https://your_domain.bitrix24.com/rest/api/{id}/{webhook}`
|
|
4436
|
+
*
|
|
4437
|
+
* @todo docs
|
|
2233
4438
|
*/
|
|
2234
|
-
|
|
2235
|
-
|
|
4439
|
+
static fromWebhookUrl(url: string, options?: {
|
|
4440
|
+
restrictionParams?: Partial<RestrictionParams>;
|
|
4441
|
+
}): B24Hook;
|
|
2236
4442
|
}
|
|
2237
4443
|
|
|
2238
4444
|
/**
|
|
@@ -2248,13 +4454,15 @@ declare class AuthHookManager implements AuthActions {
|
|
|
2248
4454
|
refreshAuth(): Promise<AuthData>;
|
|
2249
4455
|
getUniq(prefix: string): string;
|
|
2250
4456
|
/**
|
|
2251
|
-
*
|
|
4457
|
+
* @inheritDoc
|
|
2252
4458
|
*/
|
|
2253
4459
|
getTargetOrigin(): string;
|
|
2254
4460
|
/**
|
|
2255
|
-
* Get the account address BX24 with
|
|
4461
|
+
* Get the account address BX24 with path
|
|
4462
|
+
* - ver2 `https://your_domain.bitrix24.com/rest/{id}/{webhook}`
|
|
4463
|
+
* - ver3` https://your_domain.bitrix24.com/rest/api/{id}/{webhook}`
|
|
2256
4464
|
*/
|
|
2257
|
-
getTargetOriginWithPath(): string
|
|
4465
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
2258
4466
|
/**
|
|
2259
4467
|
* We believe that hooks are created only by the admin
|
|
2260
4468
|
*/
|
|
@@ -2285,6 +4493,9 @@ declare enum MessageCommands {
|
|
|
2285
4493
|
selectUser = "selectUser",
|
|
2286
4494
|
selectAccess = "selectAccess",
|
|
2287
4495
|
selectCRM = "selectCRM",
|
|
4496
|
+
/**
|
|
4497
|
+
* @memo this not work. Need test
|
|
4498
|
+
*/
|
|
2288
4499
|
showAppForm = "showAppForm",
|
|
2289
4500
|
getInterface = "getInterface",
|
|
2290
4501
|
placementBindEvent = "placementBindEvent"
|
|
@@ -2306,18 +4517,20 @@ declare class AppFrame {
|
|
|
2306
4517
|
*/
|
|
2307
4518
|
getAppSid(): string;
|
|
2308
4519
|
/**
|
|
2309
|
-
* Get the account address BX24 (https://
|
|
4520
|
+
* Get the account address BX24 (https://your_domain.bitrix24.com)
|
|
2310
4521
|
*/
|
|
2311
4522
|
getTargetOrigin(): string;
|
|
2312
4523
|
/**
|
|
2313
|
-
* Get the account address BX24 with
|
|
4524
|
+
* Get the account address BX24 with path
|
|
4525
|
+
* - ver2 `https://your_domain.bitrix24.com/rest/`
|
|
4526
|
+
* - ver3` https://your_domain.bitrix24.com/rest/api/`
|
|
2314
4527
|
*/
|
|
2315
|
-
getTargetOriginWithPath(): string
|
|
4528
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
2316
4529
|
/**
|
|
2317
4530
|
* Returns the localization of the B24 interface
|
|
2318
|
-
* @return {B24LangList} - default B24LangList.en
|
|
4531
|
+
* @return {B24LangList} - default `B24LangList.en`
|
|
2319
4532
|
*
|
|
2320
|
-
* @link https://apidocs.bitrix24.com/
|
|
4533
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-get-lang.html
|
|
2321
4534
|
*/
|
|
2322
4535
|
getLang(): B24LangList;
|
|
2323
4536
|
}
|
|
@@ -2341,11 +4554,11 @@ interface SendParams {
|
|
|
2341
4554
|
*/
|
|
2342
4555
|
declare class MessageManager {
|
|
2343
4556
|
#private;
|
|
2344
|
-
protected _logger:
|
|
4557
|
+
protected _logger: LoggerInterface;
|
|
2345
4558
|
private readonly runCallbackHandler;
|
|
2346
4559
|
constructor(appFrame: AppFrame);
|
|
2347
|
-
setLogger(logger:
|
|
2348
|
-
getLogger():
|
|
4560
|
+
setLogger(logger: LoggerInterface): void;
|
|
4561
|
+
getLogger(): LoggerInterface;
|
|
2349
4562
|
/**
|
|
2350
4563
|
* Subscribe to the onMessage event of the parent window
|
|
2351
4564
|
*/
|
|
@@ -2374,7 +4587,7 @@ declare class MessageManager {
|
|
|
2374
4587
|
/**
|
|
2375
4588
|
* Parent window manager
|
|
2376
4589
|
*
|
|
2377
|
-
* @link https://apidocs.bitrix24.com/
|
|
4590
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/
|
|
2378
4591
|
*/
|
|
2379
4592
|
declare class ParentManager {
|
|
2380
4593
|
#private;
|
|
@@ -2384,7 +4597,7 @@ declare class ParentManager {
|
|
|
2384
4597
|
*
|
|
2385
4598
|
* @return {Promise<void>}
|
|
2386
4599
|
*
|
|
2387
|
-
* @link https://apidocs.bitrix24.com/
|
|
4600
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-close-application.html
|
|
2388
4601
|
*/
|
|
2389
4602
|
closeApplication(): Promise<void>;
|
|
2390
4603
|
/**
|
|
@@ -2392,7 +4605,7 @@ declare class ParentManager {
|
|
|
2392
4605
|
*
|
|
2393
4606
|
* @return {Promise<void>}
|
|
2394
4607
|
*
|
|
2395
|
-
* @link https://apidocs.bitrix24.com/
|
|
4608
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-fit-window.html
|
|
2396
4609
|
*
|
|
2397
4610
|
* @memo in certain situations it may not be executed (placement of the main window after installing the application), in this case isSafely mode will work
|
|
2398
4611
|
*/
|
|
@@ -2405,7 +4618,7 @@ declare class ParentManager {
|
|
|
2405
4618
|
*
|
|
2406
4619
|
* @return {Promise<void>}
|
|
2407
4620
|
*
|
|
2408
|
-
* @link https://apidocs.bitrix24.com/
|
|
4621
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-resize-window.html
|
|
2409
4622
|
*
|
|
2410
4623
|
* @memo in certain situations it may not be executed, in this case isSafely mode will be triggered
|
|
2411
4624
|
*/
|
|
@@ -2426,7 +4639,7 @@ declare class ParentManager {
|
|
|
2426
4639
|
*
|
|
2427
4640
|
* @return {Promise<{scrollWidth: number; scrollHeight: number}>}
|
|
2428
4641
|
*
|
|
2429
|
-
* @link https://apidocs.bitrix24.com/
|
|
4642
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-get-scroll-size.html
|
|
2430
4643
|
*/
|
|
2431
4644
|
getScrollSize(): {
|
|
2432
4645
|
scrollWidth: number;
|
|
@@ -2438,7 +4651,7 @@ declare class ParentManager {
|
|
|
2438
4651
|
* @param {number} scroll should specify the vertical scrollbar position (0 - scroll to the very top)
|
|
2439
4652
|
* @return {Promise<void>}
|
|
2440
4653
|
*
|
|
2441
|
-
* @link https://apidocs.bitrix24.com/
|
|
4654
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-scroll-parent-window.html
|
|
2442
4655
|
*/
|
|
2443
4656
|
scrollParentWindow(scroll: number): Promise<void>;
|
|
2444
4657
|
/**
|
|
@@ -2446,7 +4659,7 @@ declare class ParentManager {
|
|
|
2446
4659
|
*
|
|
2447
4660
|
* @return {Promise<void>}
|
|
2448
4661
|
*
|
|
2449
|
-
* @link https://apidocs.bitrix24.com/
|
|
4662
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-reload-window.html
|
|
2450
4663
|
*/
|
|
2451
4664
|
reloadWindow(): Promise<void>;
|
|
2452
4665
|
/**
|
|
@@ -2456,7 +4669,7 @@ declare class ParentManager {
|
|
|
2456
4669
|
*
|
|
2457
4670
|
* @return {Promise<void>}
|
|
2458
4671
|
*
|
|
2459
|
-
* @link https://apidocs.bitrix24.com/
|
|
4672
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-set-title.html
|
|
2460
4673
|
*/
|
|
2461
4674
|
setTitle(title: string): Promise<void>;
|
|
2462
4675
|
/**
|
|
@@ -2467,7 +4680,7 @@ declare class ParentManager {
|
|
|
2467
4680
|
*
|
|
2468
4681
|
* @return {Promise<void>}
|
|
2469
4682
|
*
|
|
2470
|
-
* @link https://apidocs.bitrix24.com/
|
|
4683
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-call-to.html
|
|
2471
4684
|
*/
|
|
2472
4685
|
imCallTo(userId: number, isVideo?: boolean): Promise<void>;
|
|
2473
4686
|
/**
|
|
@@ -2477,7 +4690,7 @@ declare class ParentManager {
|
|
|
2477
4690
|
*
|
|
2478
4691
|
* @return {Promise<void>}
|
|
2479
4692
|
*
|
|
2480
|
-
* @link https://apidocs.bitrix24.com/
|
|
4693
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-phone-to.html
|
|
2481
4694
|
*/
|
|
2482
4695
|
imPhoneTo(phone: string): Promise<void>;
|
|
2483
4696
|
/**
|
|
@@ -2493,7 +4706,7 @@ declare class ParentManager {
|
|
|
2493
4706
|
*
|
|
2494
4707
|
* @return {Promise<void>}
|
|
2495
4708
|
*
|
|
2496
|
-
* @link https://apidocs.bitrix24.com/
|
|
4709
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-open-messenger.html
|
|
2497
4710
|
* @link https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=93&LESSON_ID=20152&LESSON_PATH=7657.7883.8025.20150.20152
|
|
2498
4711
|
*
|
|
2499
4712
|
*/
|
|
@@ -2509,7 +4722,7 @@ declare class ParentManager {
|
|
|
2509
4722
|
*
|
|
2510
4723
|
* @return {Promise<void>}
|
|
2511
4724
|
*
|
|
2512
|
-
* @link https://apidocs.bitrix24.com/
|
|
4725
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-open-history.html
|
|
2513
4726
|
*/
|
|
2514
4727
|
imOpenHistory(dialogId: number | `chat${number}` | `imol|${number}`): Promise<void>;
|
|
2515
4728
|
}
|
|
@@ -2517,7 +4730,7 @@ declare class ParentManager {
|
|
|
2517
4730
|
/**
|
|
2518
4731
|
* Manager for working with application settings via communication with the parent window
|
|
2519
4732
|
*
|
|
2520
|
-
* @link https://apidocs.bitrix24.com/
|
|
4733
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/index.html
|
|
2521
4734
|
*/
|
|
2522
4735
|
declare class OptionsManager$1 {
|
|
2523
4736
|
#private;
|
|
@@ -2530,25 +4743,25 @@ declare class OptionsManager$1 {
|
|
|
2530
4743
|
/**
|
|
2531
4744
|
* Getting application option
|
|
2532
4745
|
*
|
|
2533
|
-
* @link https://apidocs.bitrix24.com/
|
|
4746
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/bx24-app-option-get.html
|
|
2534
4747
|
*/
|
|
2535
4748
|
appGet(option: string): any;
|
|
2536
4749
|
/**
|
|
2537
4750
|
* Updates application data through the parent window
|
|
2538
4751
|
*
|
|
2539
|
-
* @link https://apidocs.bitrix24.com/
|
|
4752
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/bx24-app-option-set.html
|
|
2540
4753
|
*/
|
|
2541
4754
|
appSet(option: string, value: any): Promise<void>;
|
|
2542
4755
|
/**
|
|
2543
4756
|
* Getting user option
|
|
2544
4757
|
*
|
|
2545
|
-
* @link https://apidocs.bitrix24.com/
|
|
4758
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/bx24-user-option-get.html
|
|
2546
4759
|
*/
|
|
2547
4760
|
userGet(option: string): any;
|
|
2548
4761
|
/**
|
|
2549
4762
|
* Updates user data through the parent window
|
|
2550
4763
|
*
|
|
2551
|
-
* @link https://apidocs.bitrix24.com/
|
|
4764
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/bx24-user-option-set.html
|
|
2552
4765
|
*/
|
|
2553
4766
|
userSet(option: string, value: any): Promise<void>;
|
|
2554
4767
|
}
|
|
@@ -2649,7 +4862,7 @@ type SelectedCRM = {
|
|
|
2649
4862
|
/**
|
|
2650
4863
|
* Select dialog manager
|
|
2651
4864
|
*
|
|
2652
|
-
* @link https://apidocs.bitrix24.com/
|
|
4865
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/index.html
|
|
2653
4866
|
*/
|
|
2654
4867
|
declare class DialogManager {
|
|
2655
4868
|
#private;
|
|
@@ -2660,7 +4873,7 @@ declare class DialogManager {
|
|
|
2660
4873
|
*
|
|
2661
4874
|
* @return {Promise<null|SelectedUser>}
|
|
2662
4875
|
*
|
|
2663
|
-
* @link https://apidocs.bitrix24.com/
|
|
4876
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-user.html
|
|
2664
4877
|
*/
|
|
2665
4878
|
selectUser(): Promise<null | SelectedUser>;
|
|
2666
4879
|
/**
|
|
@@ -2669,27 +4882,25 @@ declare class DialogManager {
|
|
|
2669
4882
|
*
|
|
2670
4883
|
* @return {Promise<SelectedUser[]>}
|
|
2671
4884
|
*
|
|
2672
|
-
* @link https://apidocs.bitrix24.com/
|
|
4885
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-users.html
|
|
2673
4886
|
*/
|
|
2674
4887
|
selectUsers(): Promise<SelectedUser[]>;
|
|
2675
4888
|
/**
|
|
2676
|
-
* @deprecated
|
|
2677
4889
|
* Method displays a standard access permission selection dialog
|
|
2678
4890
|
*
|
|
2679
4891
|
* @param {string[]} blockedAccessPermissions
|
|
2680
4892
|
* @return {Promise<SelectedAccess[]>}
|
|
2681
4893
|
*
|
|
2682
|
-
* @link https://apidocs.bitrix24.com/
|
|
4894
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-access.html
|
|
2683
4895
|
*/
|
|
2684
4896
|
selectAccess(blockedAccessPermissions?: string[]): Promise<SelectedAccess[]>;
|
|
2685
4897
|
/**
|
|
2686
|
-
* @deprecated
|
|
2687
4898
|
* Method invokes the system dialog for selecting a CRM entity
|
|
2688
4899
|
*
|
|
2689
4900
|
* @param {SelectCRMParams} params
|
|
2690
4901
|
* @return {Promise<SelectedCRM>}
|
|
2691
4902
|
*
|
|
2692
|
-
* @link https://apidocs.bitrix24.com/
|
|
4903
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-crm.html
|
|
2693
4904
|
*/
|
|
2694
4905
|
selectCRM(params?: SelectCRMParams): Promise<SelectedCRM>;
|
|
2695
4906
|
}
|
|
@@ -2711,7 +4922,7 @@ declare class SliderManager {
|
|
|
2711
4922
|
/**
|
|
2712
4923
|
* When the method is called, a pop-up window with the application frame will be opened.
|
|
2713
4924
|
*
|
|
2714
|
-
* @link https://apidocs.bitrix24.com/
|
|
4925
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-application.html
|
|
2715
4926
|
*/
|
|
2716
4927
|
openSliderAppPage(params?: any): Promise<any>;
|
|
2717
4928
|
/**
|
|
@@ -2719,7 +4930,7 @@ declare class SliderManager {
|
|
|
2719
4930
|
*
|
|
2720
4931
|
* @return {Promise<void>}
|
|
2721
4932
|
*
|
|
2722
|
-
* @link https://apidocs.bitrix24.com/
|
|
4933
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-close-application.html
|
|
2723
4934
|
*/
|
|
2724
4935
|
closeSliderAppPage(): Promise<void>;
|
|
2725
4936
|
/**
|
|
@@ -2728,22 +4939,16 @@ declare class SliderManager {
|
|
|
2728
4939
|
* @param {number} width - Number in the range from 1640 to 1200, from 1200 to 950, from 950 to 900, from 900 ...
|
|
2729
4940
|
* @return {Promise<StatusClose>}
|
|
2730
4941
|
*
|
|
2731
|
-
* @link https://apidocs.bitrix24.com/
|
|
4942
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-path.html
|
|
2732
4943
|
* @memo /^\/(crm\/(deal|lead|contact|company|type)|marketplace|company\/personal\/user\/[0-9]+|workgroups\/group\/[0-9]+)\//
|
|
2733
4944
|
*/
|
|
2734
4945
|
openPath(url: URL, width?: number): Promise<StatusClose>;
|
|
2735
|
-
/**
|
|
2736
|
-
* @deprecated
|
|
2737
|
-
* @param params
|
|
2738
|
-
*/
|
|
2739
|
-
showAppForm(params: any): Promise<void>;
|
|
2740
4946
|
}
|
|
2741
4947
|
|
|
2742
4948
|
/**
|
|
2743
4949
|
* Placement Manager
|
|
2744
4950
|
*
|
|
2745
4951
|
* @see https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/index.html
|
|
2746
|
-
* @see https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=99&CHAPTER_ID=02535&LESSON_PATH=8771.5380.2535
|
|
2747
4952
|
*/
|
|
2748
4953
|
declare class PlacementManager {
|
|
2749
4954
|
#private;
|
|
@@ -2753,7 +4958,12 @@ declare class PlacementManager {
|
|
|
2753
4958
|
* @param data
|
|
2754
4959
|
*/
|
|
2755
4960
|
initData(data: MessageInitData): PlacementManager;
|
|
4961
|
+
/**
|
|
4962
|
+
* Symlink on `placement`
|
|
4963
|
+
* For backward compatibility
|
|
4964
|
+
*/
|
|
2756
4965
|
get title(): string;
|
|
4966
|
+
get placement(): string;
|
|
2757
4967
|
get isDefault(): boolean;
|
|
2758
4968
|
get options(): any;
|
|
2759
4969
|
get isSliderMode(): boolean;
|
|
@@ -2799,12 +5009,17 @@ declare class PlacementManager {
|
|
|
2799
5009
|
* B24 Manager. Replacement api.bitrix24.com
|
|
2800
5010
|
*
|
|
2801
5011
|
* @link https://api.bitrix24.com/api/v1/
|
|
5012
|
+
* @link https://bitrix24.github.io/b24jssdk/docs/frame/
|
|
2802
5013
|
* @see /bitrix/js/rest/applayout.js
|
|
5014
|
+
*
|
|
5015
|
+
* @todo add docs
|
|
2803
5016
|
*/
|
|
2804
5017
|
declare class B24Frame extends AbstractB24 implements TypeB24 {
|
|
2805
5018
|
#private;
|
|
2806
|
-
constructor(queryParams: B24FrameQueryParams
|
|
2807
|
-
|
|
5019
|
+
constructor(queryParams: B24FrameQueryParams, options?: {
|
|
5020
|
+
restrictionParams?: Partial<RestrictionParams>;
|
|
5021
|
+
});
|
|
5022
|
+
setLogger(logger: LoggerInterface): void;
|
|
2808
5023
|
get isFirstRun(): boolean;
|
|
2809
5024
|
get isInstallMode(): boolean;
|
|
2810
5025
|
get parent(): ParentManager;
|
|
@@ -2822,17 +5037,17 @@ declare class B24Frame extends AbstractB24 implements TypeB24 {
|
|
|
2822
5037
|
/**
|
|
2823
5038
|
* Signals that the installer or application setup has finished running.
|
|
2824
5039
|
*
|
|
2825
|
-
* @link https://apidocs.bitrix24.com/
|
|
5040
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-functions/bx24-install-finish.html
|
|
2826
5041
|
*/
|
|
2827
5042
|
installFinish(): Promise<any>;
|
|
2828
5043
|
/**
|
|
2829
|
-
*
|
|
5044
|
+
* @inheritDoc
|
|
2830
5045
|
*/
|
|
2831
5046
|
getTargetOrigin(): string;
|
|
2832
5047
|
/**
|
|
2833
|
-
*
|
|
5048
|
+
* @inheritDoc
|
|
2834
5049
|
*/
|
|
2835
|
-
getTargetOriginWithPath(): string
|
|
5050
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
2836
5051
|
/**
|
|
2837
5052
|
* Returns the sid of the application relative to the parent window like this `9c33468728e1d2c8c97562475edfd96`
|
|
2838
5053
|
*/
|
|
@@ -2840,7 +5055,7 @@ declare class B24Frame extends AbstractB24 implements TypeB24 {
|
|
|
2840
5055
|
/**
|
|
2841
5056
|
* Returns the localization of the B24 interface
|
|
2842
5057
|
*
|
|
2843
|
-
* @link https://apidocs.bitrix24.com/
|
|
5058
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-get-lang.html
|
|
2844
5059
|
*/
|
|
2845
5060
|
getLang(): B24LangList;
|
|
2846
5061
|
}
|
|
@@ -2859,39 +5074,92 @@ declare class AuthManager implements AuthActions {
|
|
|
2859
5074
|
/**
|
|
2860
5075
|
* Returns authorization data
|
|
2861
5076
|
*
|
|
2862
|
-
* @link https://apidocs.bitrix24.com/
|
|
5077
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-functions/bx24-get-auth.html
|
|
2863
5078
|
*/
|
|
2864
5079
|
getAuthData(): false | AuthData;
|
|
2865
5080
|
/**
|
|
2866
5081
|
* Updates authorization data through the parent window
|
|
2867
5082
|
*
|
|
2868
|
-
* @link https://apidocs.bitrix24.com/
|
|
5083
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-functions/bx24-refresh-auth.html
|
|
2869
5084
|
*/
|
|
2870
5085
|
refreshAuth(): Promise<AuthData>;
|
|
2871
5086
|
getUniq(prefix: string): string;
|
|
2872
5087
|
/**
|
|
2873
5088
|
* Determines whether the current user has administrator rights
|
|
2874
5089
|
*
|
|
2875
|
-
* @link https://apidocs.bitrix24.com/
|
|
5090
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-is-admin.html
|
|
2876
5091
|
*/
|
|
2877
5092
|
get isAdmin(): boolean;
|
|
5093
|
+
/**
|
|
5094
|
+
* @inheritDoc
|
|
5095
|
+
*/
|
|
5096
|
+
getTargetOrigin(): string;
|
|
5097
|
+
/**
|
|
5098
|
+
* @inheritDoc
|
|
5099
|
+
*/
|
|
5100
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
5101
|
+
}
|
|
5102
|
+
|
|
5103
|
+
declare class RefreshTokenError extends SdkError {
|
|
2878
5104
|
}
|
|
2879
5105
|
|
|
2880
5106
|
/**
|
|
2881
|
-
*
|
|
2882
|
-
* @todo add docs
|
|
5107
|
+
* OAuth Authorization Manager
|
|
2883
5108
|
*
|
|
2884
|
-
* @link https://apidocs.bitrix24.com/
|
|
5109
|
+
* @link https://apidocs.bitrix24.com/settings/oauth/index.html
|
|
5110
|
+
* @link https://bitrix24.github.io/b24jssdk/docs/oauth/
|
|
2885
5111
|
*/
|
|
5112
|
+
declare class AuthOAuthManager implements AuthActions {
|
|
5113
|
+
#private;
|
|
5114
|
+
constructor(b24OAuthParams: B24OAuthParams, oAuthSecret: B24OAuthSecret);
|
|
5115
|
+
/**
|
|
5116
|
+
* Returns authorization data
|
|
5117
|
+
* @see Http.#prepareParams
|
|
5118
|
+
*/
|
|
5119
|
+
getAuthData(): false | AuthData;
|
|
5120
|
+
/**
|
|
5121
|
+
* Updates authorization data
|
|
5122
|
+
*/
|
|
5123
|
+
refreshAuth(): Promise<AuthData>;
|
|
5124
|
+
setCallbackRefreshAuth(cb: CallbackRefreshAuth): void;
|
|
5125
|
+
removeCallbackRefreshAuth(): void;
|
|
5126
|
+
setCustomRefreshAuth(cb: CustomRefreshAuth): void;
|
|
5127
|
+
removeCustomRefreshAuth(): void;
|
|
5128
|
+
getUniq(prefix: string): string;
|
|
5129
|
+
/**
|
|
5130
|
+
* @inheritDoc
|
|
5131
|
+
*/
|
|
5132
|
+
getTargetOrigin(): string;
|
|
5133
|
+
/**
|
|
5134
|
+
* @inheritDoc
|
|
5135
|
+
*/
|
|
5136
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
5137
|
+
/**
|
|
5138
|
+
* Determines whether the current user has administrator rights
|
|
5139
|
+
*/
|
|
5140
|
+
get isAdmin(): boolean;
|
|
5141
|
+
initIsAdmin(http: TypeHttp, requestId?: string): Promise<void>;
|
|
5142
|
+
}
|
|
2886
5143
|
|
|
5144
|
+
/**
|
|
5145
|
+
* B24.OAuth Manager
|
|
5146
|
+
*
|
|
5147
|
+
* @link https://apidocs.bitrix24.com/settings/oauth/index.html
|
|
5148
|
+
* @link https://bitrix24.github.io/b24jssdk/docs/oauth/
|
|
5149
|
+
*
|
|
5150
|
+
* @todo add docs
|
|
5151
|
+
*/
|
|
2887
5152
|
declare class B24OAuth extends AbstractB24 implements TypeB24 {
|
|
2888
5153
|
#private;
|
|
2889
|
-
constructor(authOptions: B24OAuthParams, oAuthSecret: B24OAuthSecret
|
|
2890
|
-
|
|
5154
|
+
constructor(authOptions: B24OAuthParams, oAuthSecret: B24OAuthSecret, options?: {
|
|
5155
|
+
restrictionParams?: Partial<RestrictionParams>;
|
|
5156
|
+
});
|
|
2891
5157
|
/**
|
|
2892
5158
|
* Used to initialize information about the current user.
|
|
5159
|
+
*
|
|
5160
|
+
* @todo test this
|
|
2893
5161
|
*/
|
|
2894
|
-
initIsAdmin(): Promise<void>;
|
|
5162
|
+
initIsAdmin(requestId?: string): Promise<void>;
|
|
2895
5163
|
/**
|
|
2896
5164
|
* Sets an asynchronous Callback to receive updated authorization data
|
|
2897
5165
|
* @param cb
|
|
@@ -2916,59 +5184,26 @@ declare class B24OAuth extends AbstractB24 implements TypeB24 {
|
|
|
2916
5184
|
offClientSideWarning(): void;
|
|
2917
5185
|
get auth(): AuthActions;
|
|
2918
5186
|
/**
|
|
2919
|
-
*
|
|
2920
|
-
*/
|
|
2921
|
-
getTargetOrigin(): string;
|
|
2922
|
-
/**
|
|
2923
|
-
* Get the account address BX24 with Path ( https://name.bitrix24.com/rest/1/xxxxx )
|
|
2924
|
-
*/
|
|
2925
|
-
getTargetOriginWithPath(): string;
|
|
2926
|
-
}
|
|
2927
|
-
|
|
2928
|
-
declare class AuthOAuthManager implements AuthActions {
|
|
2929
|
-
#private;
|
|
2930
|
-
constructor(b24OAuthParams: B24OAuthParams, oAuthSecret: B24OAuthSecret);
|
|
2931
|
-
/**
|
|
2932
|
-
* Returns authorization data
|
|
2933
|
-
* @see Http.#prepareParams
|
|
2934
|
-
*/
|
|
2935
|
-
getAuthData(): false | AuthData;
|
|
2936
|
-
/**
|
|
2937
|
-
* Updates authorization data
|
|
2938
|
-
*/
|
|
2939
|
-
refreshAuth(): Promise<AuthData>;
|
|
2940
|
-
setCallbackRefreshAuth(cb: CallbackRefreshAuth): void;
|
|
2941
|
-
removeCallbackRefreshAuth(): void;
|
|
2942
|
-
setCustomRefreshAuth(cb: CustomRefreshAuth): void;
|
|
2943
|
-
removeCustomRefreshAuth(): void;
|
|
2944
|
-
getUniq(prefix: string): string;
|
|
2945
|
-
/**
|
|
2946
|
-
* Get the account address BX24 ( https://name.bitrix24.com )
|
|
5187
|
+
* @inheritDoc
|
|
2947
5188
|
*/
|
|
2948
5189
|
getTargetOrigin(): string;
|
|
2949
5190
|
/**
|
|
2950
|
-
*
|
|
2951
|
-
*/
|
|
2952
|
-
getTargetOriginWithPath(): string;
|
|
2953
|
-
/**
|
|
2954
|
-
* Determines whether the current user has administrator rights
|
|
5191
|
+
* @inheritDoc
|
|
2955
5192
|
*/
|
|
2956
|
-
|
|
2957
|
-
initIsAdmin(http: TypeHttp): Promise<void>;
|
|
5193
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
2958
5194
|
}
|
|
2959
5195
|
|
|
2960
5196
|
declare abstract class AbstractHelper {
|
|
2961
5197
|
protected _b24: TypeB24;
|
|
2962
|
-
protected _logger: null | LoggerBrowser;
|
|
2963
5198
|
protected _data: any;
|
|
5199
|
+
protected _logger: LoggerInterface;
|
|
2964
5200
|
constructor(b24: TypeB24);
|
|
2965
|
-
setLogger(logger:
|
|
2966
|
-
getLogger():
|
|
5201
|
+
setLogger(logger: LoggerInterface): void;
|
|
5202
|
+
getLogger(): LoggerInterface;
|
|
2967
5203
|
/**
|
|
2968
5204
|
* Initializes the data received
|
|
2969
|
-
* @param data
|
|
2970
5205
|
*/
|
|
2971
|
-
initData(
|
|
5206
|
+
initData(_data: any): Promise<void>;
|
|
2972
5207
|
abstract get data(): any;
|
|
2973
5208
|
}
|
|
2974
5209
|
|
|
@@ -3011,7 +5246,7 @@ declare class LicenseManager extends AbstractHelper {
|
|
|
3011
5246
|
* Set RestrictionManager params by license
|
|
3012
5247
|
* @link https://apidocs.bitrix24.com/api-reference/common/system/app-info.html
|
|
3013
5248
|
*/
|
|
3014
|
-
makeRestrictionManagerParams(): void
|
|
5249
|
+
makeRestrictionManagerParams(): Promise<void>;
|
|
3015
5250
|
}
|
|
3016
5251
|
|
|
3017
5252
|
type CurrencyFormatInit = {
|
|
@@ -3097,7 +5332,6 @@ declare class OptionsManager extends AbstractHelper {
|
|
|
3097
5332
|
*/
|
|
3098
5333
|
declare class B24HelperManager {
|
|
3099
5334
|
private readonly _b24;
|
|
3100
|
-
protected _logger: null | LoggerBrowser;
|
|
3101
5335
|
private _isInit;
|
|
3102
5336
|
private _profile;
|
|
3103
5337
|
private _app;
|
|
@@ -3109,9 +5343,10 @@ declare class B24HelperManager {
|
|
|
3109
5343
|
private _b24PullClient;
|
|
3110
5344
|
private _pullClientUnSubscribe;
|
|
3111
5345
|
private _pullClientModuleId;
|
|
5346
|
+
protected _logger: LoggerInterface;
|
|
3112
5347
|
constructor(b24: TypeB24);
|
|
3113
|
-
setLogger(logger:
|
|
3114
|
-
getLogger():
|
|
5348
|
+
setLogger(logger: LoggerInterface): void;
|
|
5349
|
+
getLogger(): LoggerInterface;
|
|
3115
5350
|
destroy(): void;
|
|
3116
5351
|
loadData(dataTypes?: LoadDataType[]): Promise<void>;
|
|
3117
5352
|
private parseUserData;
|
|
@@ -3123,7 +5358,7 @@ declare class B24HelperManager {
|
|
|
3123
5358
|
get isInit(): boolean;
|
|
3124
5359
|
get forB24Form(): TypeB24Form;
|
|
3125
5360
|
/**
|
|
3126
|
-
* Get the account address BX24 (https://
|
|
5361
|
+
* Get the account address BX24 (https://your_domain.bitrix24.com)
|
|
3127
5362
|
*/
|
|
3128
5363
|
get hostName(): string;
|
|
3129
5364
|
get profileInfo(): ProfileManager;
|
|
@@ -3164,9 +5399,6 @@ declare const useB24Helper: () => {
|
|
|
3164
5399
|
startPullClient: () => void;
|
|
3165
5400
|
};
|
|
3166
5401
|
|
|
3167
|
-
/**
|
|
3168
|
-
* @todo fix logic for _loggingEnabled
|
|
3169
|
-
*/
|
|
3170
5402
|
declare class PullClient implements ConnectorParent {
|
|
3171
5403
|
private _logger;
|
|
3172
5404
|
private _restClient;
|
|
@@ -3219,8 +5451,8 @@ declare class PullClient implements ConnectorParent {
|
|
|
3219
5451
|
* @param params
|
|
3220
5452
|
*/
|
|
3221
5453
|
constructor(params: TypePullClientParams);
|
|
3222
|
-
setLogger(logger:
|
|
3223
|
-
getLogger():
|
|
5454
|
+
setLogger(logger: LoggerInterface): void;
|
|
5455
|
+
getLogger(): LoggerInterface;
|
|
3224
5456
|
destroy(): void;
|
|
3225
5457
|
private init;
|
|
3226
5458
|
get connector(): null | TypeConnector;
|
|
@@ -3390,9 +5622,6 @@ declare class PullClient implements ConnectorParent {
|
|
|
3390
5622
|
*/
|
|
3391
5623
|
private emitUserStatusChange;
|
|
3392
5624
|
private restoreUserStatusSubscription;
|
|
3393
|
-
/**
|
|
3394
|
-
* @param logTag
|
|
3395
|
-
*/
|
|
3396
5625
|
private loadConfig;
|
|
3397
5626
|
/**
|
|
3398
5627
|
* @param config
|
|
@@ -3563,7 +5792,10 @@ declare class PullClient implements ConnectorParent {
|
|
|
3563
5792
|
private onCustomEvent;
|
|
3564
5793
|
}
|
|
3565
5794
|
|
|
3566
|
-
declare function initializeB24Frame(
|
|
5795
|
+
declare function initializeB24Frame(options?: {
|
|
5796
|
+
version?: ApiVersion;
|
|
5797
|
+
restrictionParams?: Partial<RestrictionParams>;
|
|
5798
|
+
}): Promise<B24Frame>;
|
|
3567
5799
|
|
|
3568
|
-
export { AbstractB24, AjaxError, AjaxResult, AppFrame, AuthHookManager, AuthManager, AuthOAuthManager, B24Frame, B24Hook, B24LangList, B24LocaleMap, B24OAuth, PullClient as B24PullClientManager, Browser, CatalogProductImageType, CatalogProductType, CatalogRoundingRuleType, CloseReasons, ConnectionType, DataType, DialogManager, EnumAppStatus, EnumBitrix24Edition, EnumBizprocBaseType, EnumBizprocDocumentType, EnumCrmEntityType, EnumCrmEntityTypeId, EnumCrmEntityTypeShort, ListRpcError, LoadDataType, LoggerBrowser, LoggerType, LsKeys, MessageCommands, MessageManager, OptionsManager$1 as OptionsManager, ParentManager, PlacementManager, ProductRowDiscountTypeId, PullStatus,
|
|
3569
|
-
export type { ActivityConfig, ActivityHandlerParams, ActivityOrRobotConfig, ActivityProperty, ActivityPropertyType, AjaxErrorParams, AjaxQuery,
|
|
5800
|
+
export { AbstractB24, AbstractLogger, AdaptiveDelayer, AjaxError, AjaxResult, ApiVersion, AppFrame, AuthHookManager, AuthManager, AuthOAuthManager, B24Frame, B24Hook, B24LangList, B24LocaleMap, B24OAuth, PullClient as B24PullClientManager, Browser, CatalogProductImageType, CatalogProductType, CatalogRoundingRuleType, CloseReasons, ConnectionType, ConsolaAdapter, ConsoleHandler, ConsoleV2Handler, DataType, DialogManager, EnumAppStatus, EnumBitrix24Edition, EnumBizprocBaseType, EnumBizprocDocumentType, EnumCrmEntityType, EnumCrmEntityTypeId, EnumCrmEntityTypeShort, Environment, HttpV2, HttpV3, JsonFormatter, LineFormatter, ListRpcError, LoadDataType, LogLevel, Logger, LoggerBrowser, LoggerFactory, LoggerType, LsKeys, MemoryHandler, MessageCommands, MessageManager, NullLogger, OperatingLimiter, OptionsManager$1 as OptionsManager, ParamsFactory, ParentManager, PlacementManager, ProductRowDiscountTypeId, PullStatus, RateLimiter, RefreshTokenError, RestrictionManager, Result, RpcMethod, SdkError, SenderType, ServerMode, SliderManager, StatusDescriptions, StreamHandler, SubscriptionType, SystemCommands, TelegramFormatter, TelegramHandler, Text$1 as Text, Type, TypeOption, TypeSpecificUrl, WinstonAdapter, convertBizprocDocumentTypeToCrmEntityTypeId, getDocumentId, getDocumentType, getDocumentTypeForFilter, getEnumCrmEntityTypeShort, getEnumValue, getEnvironment, initializeB24Frame, isArrayOfArray, memoryUsageProcessor, omit, pick, pidProcessor, useB24Helper, useFormatter, versionManager };
|
|
5801
|
+
export type { ActivityConfig, ActivityHandlerParams, ActivityOrRobotConfig, ActivityProperty, ActivityPropertyType, AdaptiveConfig, AjaxErrorParams, AjaxQuery, AnswerError, AuthActions, AuthData, B24FrameQueryParams, B24HookParams, B24OAuthParams, B24OAuthSecret, BatchCommandV3, BatchCommandsArrayUniversal, BatchCommandsObjectUniversal, BatchCommandsUniversal, BatchNamedCommandsUniversal, BatchPayload, BatchPayloadResult, BoolString, CallBatchResult, CallbackRefreshAuth, CatalogCatalog, CatalogExtra, CatalogLanguage, CatalogMeasure, CatalogPriceType, CatalogPriceTypeLang, CatalogProduct, CatalogProductImage, CatalogProductOffer, CatalogProductService, CatalogProductSku, CatalogRatio, CatalogRoundingRule, CatalogSection, CatalogStore, CatalogVat, CommandHandlerFunctionV1, CommandHandlerFunctionV2, CommandObject, CommandTuple, CommandUniversal, ConnectorCallbacks, ConnectorConfig, ConnectorParent, ConsolaAdapterOptions, ConsoleHandlerOptions, CrmItemDelivery, CrmItemPayment, CrmItemProductRow, Currency, CurrencyFormat, CustomRefreshAuth, EventHandlerParams, EventOnAppInstallHandlerParams, EventOnAppUnInstallHandlerParams, Fields, Formatter, GenderString, GetPayload, Handler, HandlerAuthParams, HandlerOptions, HandlerRefreshAuth, IB24BatchOptions, ICallBatchOptions, ICallBatchResult, ILimiter, IPlacementUF, IRequestIdGenerator, IResult, ISODate, JsonRpcRequest, ListPayload, LogLevelName, LogRecord, LoggerInterface, MemoryHandlerOptions, MessageInitData, MultiField, MultiFieldArray, NumberString, OperatingLimitConfig, Payload, PayloadOAuthToken, PayloadTime, PlacementViewMode, Processor, RateLimitConfig, RefreshAuthData, RestrictionManagerStats, RestrictionParams, RpcCommand, RpcCommandResult, RpcError, RpcRequest, SdkErrorDetails, SelectCRMParams, SelectCRMParamsEntityType, SelectCRMParamsValue, SelectedAccess, SelectedCRM, SelectedCRMEntity, SelectedUser, SendParams, SharedConfigCallbacks, SharedConfigParams, StatusClose, StorageManagerParams, StreamHandlerOptions, SuccessPayload, TelegramHandlerOptions, TextType, TypeApp, TypeB24, TypeB24Form, TypeCallParams, TypeChanel, TypeChannelManagerParams, TypeConnector, TypeDescriptionError, TypeDescriptionErrorV3, TypeEnumAppStatus, TypeHttp, TypeJsonRpcConfig, TypeLicense, TypePayment, TypePublicIdDescriptor, TypePullClientConfig, TypePullClientEmitConfig, TypePullClientMessageBatch, TypePullClientMessageBody, TypePullClientParams, TypePullClientSession, TypePullMessage, TypeRpcResponseAwaiters, TypeSessionEvent, TypeStorageManager, TypeSubscriptionCommandHandler, TypeSubscriptionOptions, TypeUser, UserBasic, UserBrief, UserFieldType, UserStatusCallback, WinstonAdapterOptions };
|