@bitrix24/b24jssdk 0.5.1 → 1.0.2
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 +309 -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 +178 -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 +253 -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 +2768 -534
- package/dist/esm/index.d.ts +2768 -534
- package/dist/esm/index.mjs +70 -14118
- 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 +31312 -26912
- 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 +34 -29
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,233 +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
1231
|
/**
|
|
806
|
-
*
|
|
1232
|
+
* @todo docs
|
|
807
1233
|
*/
|
|
808
|
-
type B24HookParams = {
|
|
809
|
-
/**
|
|
810
|
-
* https://your-bitrix-portal.bitrix24.com
|
|
811
|
-
*/
|
|
812
|
-
b24Url: string;
|
|
813
|
-
userId: number;
|
|
814
|
-
secret: string;
|
|
815
|
-
};
|
|
816
1234
|
/**
|
|
817
|
-
*
|
|
1235
|
+
* Settings for operating limiting
|
|
818
1236
|
*/
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
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
|
+
}
|
|
825
1255
|
/**
|
|
826
|
-
*
|
|
1256
|
+
* Adaptive pause settings
|
|
827
1257
|
*/
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
1258
|
+
interface AdaptiveConfig {
|
|
1259
|
+
/**
|
|
1260
|
+
* Threshold for heavy queries (%)
|
|
1261
|
+
* Default: 80% - this means that `operating >= 384`
|
|
1262
|
+
* Specifies what % of `operatingLimit.limitMs` in `operating` should pause.
|
|
1263
|
+
*/
|
|
1264
|
+
thresholdPercent: number;
|
|
1265
|
+
/**
|
|
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.
|
|
1274
|
+
*/
|
|
1275
|
+
coefficient: number;
|
|
1276
|
+
/**
|
|
1277
|
+
* Maximum pause (ms)
|
|
1278
|
+
* Default: 7_000 ms
|
|
1279
|
+
* Limits the maximum estimated pause time
|
|
1280
|
+
*/
|
|
1281
|
+
maxDelay: number;
|
|
1282
|
+
/**
|
|
1283
|
+
* Whether adaptive pause is enabled
|
|
1284
|
+
* Default: true
|
|
1285
|
+
*/
|
|
1286
|
+
enabled: boolean;
|
|
1287
|
+
}
|
|
832
1288
|
/**
|
|
833
|
-
*
|
|
834
|
-
* @memo We get from b24 event this data
|
|
1289
|
+
* Rate limiting settings (Leaky Bucket)
|
|
835
1290
|
*/
|
|
836
|
-
interface
|
|
1291
|
+
interface RateLimitConfig {
|
|
837
1292
|
/**
|
|
838
|
-
*
|
|
1293
|
+
* X - limit before blocking (bucket capacity)
|
|
1294
|
+
* For standard plans: 50
|
|
1295
|
+
* For Enterprise: 250
|
|
839
1296
|
*/
|
|
840
|
-
|
|
1297
|
+
burstLimit: number;
|
|
841
1298
|
/**
|
|
842
|
-
*
|
|
1299
|
+
* Y - leak rate (requests per second)
|
|
1300
|
+
* For standard plans: 2
|
|
1301
|
+
* For Enterprise: 5
|
|
843
1302
|
*/
|
|
844
|
-
|
|
1303
|
+
drainRate: number;
|
|
845
1304
|
/**
|
|
846
|
-
*
|
|
1305
|
+
* Whether adaptive control is enabled
|
|
1306
|
+
* Default: true
|
|
847
1307
|
*/
|
|
848
|
-
|
|
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;
|
|
849
1317
|
/**
|
|
850
|
-
*
|
|
1318
|
+
* Maximum number of retries
|
|
1319
|
+
* Default: 3
|
|
851
1320
|
*/
|
|
852
|
-
|
|
1321
|
+
maxRetries?: number;
|
|
853
1322
|
/**
|
|
854
|
-
*
|
|
1323
|
+
* Base delay between retries (ms)
|
|
1324
|
+
* Default: 1_000
|
|
855
1325
|
*/
|
|
856
|
-
|
|
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 {
|
|
857
1387
|
/**
|
|
858
|
-
*
|
|
859
|
-
|
|
860
|
-
|
|
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 {
|
|
861
1432
|
/**
|
|
862
|
-
*
|
|
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}
|
|
863
1545
|
*/
|
|
864
|
-
|
|
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 {
|
|
865
1571
|
/**
|
|
866
|
-
*
|
|
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).
|
|
867
1667
|
*/
|
|
868
|
-
|
|
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 {
|
|
869
1681
|
/**
|
|
870
|
-
*
|
|
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.
|
|
871
1727
|
*/
|
|
872
|
-
|
|
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>;
|
|
2570
|
+
/**
|
|
2571
|
+
* Alias for getNext
|
|
2572
|
+
* @param http
|
|
2573
|
+
*
|
|
2574
|
+
* @todo !fix api version
|
|
2575
|
+
*/
|
|
2576
|
+
fetchNext(http: TypeHttp): Promise<AjaxResult<T> | null>;
|
|
2577
|
+
getNext(http: TypeHttp): Promise<AjaxResult<T> | false>;
|
|
2578
|
+
setData(): never;
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
/**
|
|
2582
|
+
* @todo fix docs
|
|
2583
|
+
*/
|
|
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
|
+
};
|
|
873
2607
|
/**
|
|
874
|
-
*
|
|
2608
|
+
* Used only in Api:V3
|
|
875
2609
|
*/
|
|
876
|
-
|
|
2610
|
+
cursor?: {
|
|
2611
|
+
field: string;
|
|
2612
|
+
value: number;
|
|
2613
|
+
order: 'ASC' | 'DESC' | 'asc' | 'desc' | string;
|
|
2614
|
+
};
|
|
2615
|
+
[key: string]: any;
|
|
2616
|
+
};
|
|
2617
|
+
/**
|
|
2618
|
+
* Options for batch calls
|
|
2619
|
+
*/
|
|
2620
|
+
interface ICallBatchOptions {
|
|
877
2621
|
/**
|
|
878
|
-
*
|
|
2622
|
+
* Whether to stop execution on the first error
|
|
2623
|
+
* @default true
|
|
879
2624
|
*/
|
|
880
|
-
|
|
2625
|
+
isHaltOnError?: boolean;
|
|
881
2626
|
/**
|
|
882
|
-
*
|
|
2627
|
+
* Unique request identifier for tracking. Used for query deduplication and debugging.
|
|
883
2628
|
*/
|
|
884
|
-
|
|
885
|
-
issuer?: 'request' | 'store' | string;
|
|
2629
|
+
requestId?: string;
|
|
886
2630
|
}
|
|
887
|
-
type HandlerRefreshAuth = Pick<HandlerAuthParams, 'access_token' | 'refresh_token' | 'expires' | 'expires_in' | 'client_endpoint' | 'server_endpoint' | 'member_id' | 'scope' | 'status' | 'domain'>;
|
|
888
2631
|
/**
|
|
889
|
-
*
|
|
890
|
-
*/
|
|
891
|
-
type CallbackRefreshAuth = (params: {
|
|
892
|
-
authData: AuthData;
|
|
893
|
-
b24OAuthParams: B24OAuthParams;
|
|
894
|
-
}) => Promise<void>;
|
|
895
|
-
/**
|
|
896
|
-
* Use for custom get new refresh token for OAuth
|
|
2632
|
+
* Result of the batch call
|
|
897
2633
|
*/
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
type
|
|
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
|
-
member_id: string;
|
|
934
|
-
};
|
|
2662
|
+
interface IRequestIdGenerator {
|
|
2663
|
+
getRequestId(): string;
|
|
2664
|
+
getHeaderFieldName(): string;
|
|
2665
|
+
getQueryStringParameterName(): string;
|
|
2666
|
+
getQueryStringSdkParameterName(): string;
|
|
2667
|
+
}
|
|
935
2668
|
/**
|
|
936
|
-
* Interface for
|
|
2669
|
+
* Interface for HTTP client
|
|
937
2670
|
*/
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
type TypeB24 = {
|
|
946
|
-
/**
|
|
947
|
-
* @link https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/system-functions/bx24-init.html
|
|
948
|
-
*/
|
|
949
|
-
readonly isInit: boolean;
|
|
950
|
-
init(): Promise<void>;
|
|
951
|
-
destroy(): void;
|
|
952
|
-
getLogger(): LoggerBrowser;
|
|
953
|
-
setLogger(logger: LoggerBrowser): void;
|
|
954
|
-
get auth(): AuthActions;
|
|
955
|
-
/**
|
|
956
|
-
* Get the account address BX24 ( https://name.bitrix24.com )
|
|
957
|
-
*/
|
|
958
|
-
getTargetOrigin(): string;
|
|
2671
|
+
type TypeHttp = {
|
|
2672
|
+
apiVersion: ApiVersion;
|
|
2673
|
+
ajaxClient: AxiosInstance | any;
|
|
2674
|
+
setLogger(logger: LoggerInterface): void;
|
|
2675
|
+
getLogger(): LoggerInterface;
|
|
959
2676
|
/**
|
|
960
|
-
*
|
|
2677
|
+
* Executing batch queries
|
|
961
2678
|
*/
|
|
962
|
-
|
|
2679
|
+
batch<T = unknown>(calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal, options?: ICallBatchOptions): Promise<Result<ICallBatchResult<T>>>;
|
|
963
2680
|
/**
|
|
964
|
-
*
|
|
965
|
-
*
|
|
966
|
-
* @param
|
|
967
|
-
* @param
|
|
968
|
-
* @
|
|
969
|
-
*
|
|
970
|
-
* @return {Promise}
|
|
971
|
-
*
|
|
972
|
-
* @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
|
|
973
2686
|
*/
|
|
974
|
-
|
|
2687
|
+
call<T = unknown>(method: string, params: TypeCallParams, requestId?: string): Promise<AjaxResult<T>>;
|
|
975
2688
|
/**
|
|
976
|
-
*
|
|
977
|
-
*
|
|
978
|
-
* @param {string} method Query method
|
|
979
|
-
* @param {object} params Request parameters
|
|
980
|
-
* @param {null|((progress: number) => void)} progress Processing steps
|
|
981
|
-
* @param {string} customKeyForResult Custom field indicating that the result will be a grouping key
|
|
982
|
-
* @return {Promise}
|
|
2689
|
+
* Sets the restriction parameters
|
|
983
2690
|
*/
|
|
984
|
-
|
|
2691
|
+
setRestrictionManagerParams(params: RestrictionParams): Promise<void>;
|
|
985
2692
|
/**
|
|
986
|
-
*
|
|
987
|
-
* Implements the fast algorithm described in {@see https://apidocs.bitrix24.com/api-reference/performance/huge-data.html}
|
|
988
|
-
*
|
|
989
|
-
* @param {string} method Query method
|
|
990
|
-
* @param {object} params Request parameters
|
|
991
|
-
* @param {string} idKey Entity ID field name ('ID' || 'id')
|
|
992
|
-
* @param {string} customKeyForResult Custom field indicating that the result will be a grouping key
|
|
993
|
-
*
|
|
994
|
-
* @return {AsyncGenerator} Generator
|
|
2693
|
+
* Returns the current constraint settings
|
|
995
2694
|
*/
|
|
996
|
-
|
|
2695
|
+
getRestrictionManagerParams(): RestrictionParams;
|
|
997
2696
|
/**
|
|
998
|
-
*
|
|
999
|
-
*
|
|
1000
|
-
* @param {array|object} calls Request packet
|
|
1001
|
-
* calls = [[method,params],[method,params]]
|
|
1002
|
-
* calls = [{method:method,params:params},[method,params]]
|
|
1003
|
-
* calls = {call_id:[method,params],...}
|
|
1004
|
-
* @param {boolean} isHaltOnError Abort package execution when an error occurs
|
|
1005
|
-
* @param {boolean} returnAjaxResult Return `Record<string | number, AjaxResult> | AjaxResult[]` in response
|
|
1006
|
-
*
|
|
1007
|
-
* @return {Promise} Promise
|
|
1008
|
-
*
|
|
1009
|
-
* @see https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/how-to-call-rest-methods/bx24-call-batch.html
|
|
2697
|
+
* Returns job statistics
|
|
1010
2698
|
*/
|
|
1011
|
-
|
|
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
|
+
};
|
|
1012
2716
|
/**
|
|
1013
|
-
*
|
|
1014
|
-
*
|
|
1015
|
-
* @param {array} calls Request packet
|
|
1016
|
-
* calls = [[method,params],[method,params]]
|
|
1017
|
-
* @param {boolean} isHaltOnError Abort package execution when an error occurs
|
|
1018
|
-
*
|
|
1019
|
-
* @return {Promise} Promise
|
|
1020
|
-
*
|
|
1021
|
-
* @see https://apidocs.bitrix24.com/api-reference/bx24-js-sdk/how-to-call-rest-methods/bx24-call-batch.html
|
|
2717
|
+
* Resets limiters and statistics
|
|
1022
2718
|
*/
|
|
1023
|
-
|
|
2719
|
+
reset(): Promise<void>;
|
|
1024
2720
|
/**
|
|
1025
|
-
*
|
|
2721
|
+
* On|Off warning about client-side query execution
|
|
2722
|
+
* @param {boolean} value
|
|
2723
|
+
* @param {string} message
|
|
1026
2724
|
*/
|
|
1027
|
-
|
|
2725
|
+
setClientSideWarning(value: boolean, message: string): void;
|
|
1028
2726
|
};
|
|
1029
2727
|
|
|
1030
2728
|
/**
|
|
@@ -1432,28 +3130,27 @@ interface IPlacementUF {
|
|
|
1432
3130
|
* It is worth remembering that there will be 1-2 languages for the B24.Box
|
|
1433
3131
|
*/
|
|
1434
3132
|
declare enum B24LangList {
|
|
1435
|
-
|
|
3133
|
+
ru = "ru",
|
|
3134
|
+
id = "id",
|
|
3135
|
+
ms = "ms",
|
|
1436
3136
|
de = "de",
|
|
3137
|
+
en = "en",
|
|
1437
3138
|
la = "la",
|
|
1438
|
-
br = "br",
|
|
1439
3139
|
fr = "fr",
|
|
3140
|
+
in = "in",
|
|
1440
3141
|
it = "it",
|
|
1441
3142
|
pl = "pl",
|
|
1442
|
-
|
|
1443
|
-
|
|
3143
|
+
br = "br",
|
|
3144
|
+
vn = "vn",
|
|
1444
3145
|
tr = "tr",
|
|
3146
|
+
kz = "kz",
|
|
3147
|
+
ua = "ua",
|
|
3148
|
+
ar = "ar",
|
|
3149
|
+
th = "th",
|
|
1445
3150
|
sc = "sc",
|
|
1446
3151
|
tc = "tc",
|
|
1447
|
-
ja = "ja"
|
|
1448
|
-
vn = "vn",
|
|
1449
|
-
id = "id",
|
|
1450
|
-
ms = "ms",
|
|
1451
|
-
th = "th",
|
|
1452
|
-
ar = "ar"
|
|
3152
|
+
ja = "ja"
|
|
1453
3153
|
}
|
|
1454
|
-
/**
|
|
1455
|
-
* @todo add docs
|
|
1456
|
-
*/
|
|
1457
3154
|
declare const B24LocaleMap: Record<B24LangList, string>;
|
|
1458
3155
|
|
|
1459
3156
|
/**
|
|
@@ -1627,7 +3324,7 @@ declare enum ConnectionType {
|
|
|
1627
3324
|
LongPolling = "longPolling"
|
|
1628
3325
|
}
|
|
1629
3326
|
type TypeConnector = {
|
|
1630
|
-
setLogger(logger:
|
|
3327
|
+
setLogger(logger: LoggerInterface): void;
|
|
1631
3328
|
destroy(): void;
|
|
1632
3329
|
connect(): void;
|
|
1633
3330
|
disconnect(code: number, reason: string): void;
|
|
@@ -1667,8 +3364,8 @@ type StorageManagerParams = {
|
|
|
1667
3364
|
siteId?: string;
|
|
1668
3365
|
};
|
|
1669
3366
|
type TypeStorageManager = {
|
|
1670
|
-
setLogger(logger:
|
|
1671
|
-
getLogger():
|
|
3367
|
+
setLogger(logger: LoggerInterface): void;
|
|
3368
|
+
getLogger(): LoggerInterface;
|
|
1672
3369
|
set(name: string, value: any): void;
|
|
1673
3370
|
get(name: string, defaultValue: any): any;
|
|
1674
3371
|
remove(name: string): void;
|
|
@@ -1917,6 +3614,48 @@ type TypePullClientMessageBatch = {
|
|
|
1917
3614
|
expiry?: number;
|
|
1918
3615
|
};
|
|
1919
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
|
+
|
|
1920
3659
|
type AnswerError = {
|
|
1921
3660
|
error: string;
|
|
1922
3661
|
errorDescription: string;
|
|
@@ -1926,88 +3665,320 @@ type AjaxErrorParams = {
|
|
|
1926
3665
|
answerError: AnswerError;
|
|
1927
3666
|
cause?: Error;
|
|
1928
3667
|
};
|
|
1929
|
-
type
|
|
1930
|
-
|
|
1931
|
-
description?: string;
|
|
1932
|
-
status: number;
|
|
1933
|
-
requestInfo?: {
|
|
1934
|
-
method?: string;
|
|
3668
|
+
type AjaxErrorDetails = SdkErrorDetails & {
|
|
3669
|
+
requestInfo?: Partial<AjaxQuery> & {
|
|
1935
3670
|
url?: string;
|
|
1936
|
-
params?: Record<string, unknown> | unknown;
|
|
1937
3671
|
};
|
|
1938
|
-
|
|
1939
|
-
|
|
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
|
+
|
|
1940
3859
|
/**
|
|
1941
|
-
*
|
|
3860
|
+
* Adaptive delayer
|
|
3861
|
+
*
|
|
3862
|
+
* @todo docs
|
|
1942
3863
|
*/
|
|
1943
|
-
declare class
|
|
1944
|
-
|
|
1945
|
-
private
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
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>;
|
|
1950
3899
|
/**
|
|
1951
|
-
*
|
|
3900
|
+
* Checks and waits for the rate limit
|
|
3901
|
+
* The loop is needed for parallel requests (Promise.all())
|
|
1952
3902
|
*/
|
|
1953
|
-
|
|
1954
|
-
|
|
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>;
|
|
1955
3906
|
/**
|
|
1956
|
-
*
|
|
3907
|
+
* These exceptions will be thrown
|
|
1957
3908
|
*/
|
|
1958
|
-
|
|
3909
|
+
get exceptionCodeForHard(): string[];
|
|
1959
3910
|
/**
|
|
1960
|
-
*
|
|
3911
|
+
* These exceptions will be thrown into `AjaxResult` as `AjaxError`
|
|
1961
3912
|
*/
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
error_description?: string;
|
|
1967
|
-
};
|
|
1968
|
-
config?: {
|
|
1969
|
-
method?: string;
|
|
1970
|
-
url?: string;
|
|
1971
|
-
params?: unknown;
|
|
1972
|
-
};
|
|
1973
|
-
}): 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;
|
|
1974
3917
|
/**
|
|
1975
|
-
*
|
|
3918
|
+
* Returns job statistics
|
|
1976
3919
|
*/
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
}): AjaxError;
|
|
3920
|
+
getStats(): RestrictionManagerStats & {
|
|
3921
|
+
adaptiveDelayAvg: number;
|
|
3922
|
+
errorCounts: Record<string, number>;
|
|
3923
|
+
};
|
|
1982
3924
|
/**
|
|
1983
|
-
*
|
|
3925
|
+
* Resets limiters and statistics
|
|
1984
3926
|
*/
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
message: string;
|
|
1989
|
-
status: number;
|
|
1990
|
-
timestamp: string;
|
|
1991
|
-
requestInfo: {
|
|
1992
|
-
method?: string;
|
|
1993
|
-
url?: string;
|
|
1994
|
-
params?: Record<string, unknown> | unknown;
|
|
1995
|
-
} | undefined;
|
|
1996
|
-
stack: string | undefined;
|
|
1997
|
-
};
|
|
3927
|
+
reset(): Promise<void>;
|
|
3928
|
+
setConfig(params: RestrictionParams): Promise<void>;
|
|
3929
|
+
getParams(): RestrictionParams;
|
|
1998
3930
|
/**
|
|
1999
|
-
*
|
|
3931
|
+
* Public access to the delay function
|
|
2000
3932
|
*/
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
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;
|
|
2004
3962
|
}
|
|
3963
|
+
declare const versionManager: VersionManager;
|
|
2005
3964
|
|
|
3965
|
+
/**
|
|
3966
|
+
* @todo docs
|
|
3967
|
+
*/
|
|
2006
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
|
+
*/
|
|
2007
3975
|
static readonly batchSize = 50;
|
|
2008
3976
|
protected _isInit: boolean;
|
|
2009
|
-
protected
|
|
2010
|
-
protected
|
|
3977
|
+
protected _httpV2: null | TypeHttp;
|
|
3978
|
+
protected _httpV3: null | TypeHttp;
|
|
3979
|
+
protected _logger: LoggerInterface;
|
|
3980
|
+
protected _actionsManager: ActionsManager;
|
|
3981
|
+
protected _toolsManager: ToolsManager;
|
|
2011
3982
|
protected constructor();
|
|
2012
3983
|
/**
|
|
2013
3984
|
* @inheritDoc
|
|
@@ -2015,9 +3986,9 @@ declare abstract class AbstractB24 implements TypeB24 {
|
|
|
2015
3986
|
get isInit(): boolean;
|
|
2016
3987
|
init(): Promise<void>;
|
|
2017
3988
|
destroy(): void;
|
|
2018
|
-
setLogger(logger: LoggerBrowser): void;
|
|
2019
|
-
getLogger(): LoggerBrowser;
|
|
2020
3989
|
abstract get auth(): AuthActions;
|
|
3990
|
+
get actions(): ActionsManager;
|
|
3991
|
+
get tools(): ToolsManager;
|
|
2021
3992
|
/**
|
|
2022
3993
|
* @inheritDoc
|
|
2023
3994
|
*/
|
|
@@ -2025,32 +3996,76 @@ declare abstract class AbstractB24 implements TypeB24 {
|
|
|
2025
3996
|
/**
|
|
2026
3997
|
* @inheritDoc
|
|
2027
3998
|
*/
|
|
2028
|
-
abstract getTargetOriginWithPath(): string
|
|
3999
|
+
abstract getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
2029
4000
|
/**
|
|
2030
|
-
*
|
|
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`
|
|
2031
4009
|
*/
|
|
2032
4010
|
callMethod(method: string, params?: object, start?: number): Promise<AjaxResult>;
|
|
2033
4011
|
/**
|
|
2034
|
-
*
|
|
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`
|
|
2035
4020
|
*/
|
|
2036
|
-
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>;
|
|
2037
4022
|
/**
|
|
2038
|
-
*
|
|
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`
|
|
2039
4031
|
*/
|
|
2040
|
-
fetchListMethod(method: string, params?: any, idKey?: string, customKeyForResult?:
|
|
4032
|
+
fetchListMethod(method: string, params?: any, idKey?: string, customKeyForResult?: string | null): AsyncGenerator<any[]>;
|
|
2041
4033
|
/**
|
|
2042
|
-
*
|
|
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`
|
|
2043
4042
|
*/
|
|
2044
4043
|
callBatch(calls: Array<any> | object, isHaltOnError?: boolean, returnAjaxResult?: boolean): Promise<Result>;
|
|
2045
|
-
|
|
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;
|
|
2046
4059
|
/**
|
|
2047
4060
|
* @inheritDoc
|
|
2048
4061
|
*/
|
|
2049
|
-
|
|
4062
|
+
setHttpClient(version: ApiVersion, client: TypeHttp): void;
|
|
4063
|
+
setLogger(logger: LoggerInterface): void;
|
|
4064
|
+
getLogger(): LoggerInterface;
|
|
2050
4065
|
/**
|
|
2051
4066
|
* @inheritDoc
|
|
2052
4067
|
*/
|
|
2053
|
-
|
|
4068
|
+
setRestrictionManagerParams(params: RestrictionParams): Promise<void>;
|
|
2054
4069
|
/**
|
|
2055
4070
|
* Returns settings for http connection
|
|
2056
4071
|
* @protected
|
|
@@ -2063,6 +4078,184 @@ declare abstract class AbstractB24 implements TypeB24 {
|
|
|
2063
4078
|
protected _ensureInitialized(): void;
|
|
2064
4079
|
}
|
|
2065
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
|
+
|
|
2066
4259
|
declare class FormatterNumbers {
|
|
2067
4260
|
private static isInternalConstructing;
|
|
2068
4261
|
private static instance;
|
|
@@ -2098,7 +4291,7 @@ declare class IbanSpecification {
|
|
|
2098
4291
|
/**
|
|
2099
4292
|
* Check if the passed iban is valid, according to this specification.
|
|
2100
4293
|
*
|
|
2101
|
-
* @param {
|
|
4294
|
+
* @param {string} iban the iban to validate
|
|
2102
4295
|
* @returns {boolean} true if valid, false otherwise
|
|
2103
4296
|
*/
|
|
2104
4297
|
isValid(iban: string): boolean;
|
|
@@ -2156,7 +4349,7 @@ declare class IbanSpecification {
|
|
|
2156
4349
|
* Calculates MOD 97 10 of the passed IBAN as specified in ISO7064.
|
|
2157
4350
|
*
|
|
2158
4351
|
* @param iban
|
|
2159
|
-
* @returns {number}
|
|
4352
|
+
* @returns {number} MOD
|
|
2160
4353
|
*/
|
|
2161
4354
|
private _iso7064Mod9710;
|
|
2162
4355
|
}
|
|
@@ -2173,7 +4366,7 @@ declare class FormatterIban {
|
|
|
2173
4366
|
/**
|
|
2174
4367
|
* Check if an IBAN is valid.
|
|
2175
4368
|
*
|
|
2176
|
-
* @param {
|
|
4369
|
+
* @param {string} iban the IBAN to validate.
|
|
2177
4370
|
* @returns {boolean} true if the passed IBAN is valid, false otherwise
|
|
2178
4371
|
*/
|
|
2179
4372
|
isValid(iban: string): boolean;
|
|
@@ -2183,8 +4376,8 @@ declare class FormatterIban {
|
|
|
2183
4376
|
* Convert an IBAN to a BBAN.
|
|
2184
4377
|
*
|
|
2185
4378
|
* @param iban
|
|
2186
|
-
* @param {
|
|
2187
|
-
* @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.
|
|
2188
4381
|
*/
|
|
2189
4382
|
toBBAN(iban: string, separator?: string): string;
|
|
2190
4383
|
/**
|
|
@@ -2214,26 +4407,38 @@ declare const useFormatter: () => {
|
|
|
2214
4407
|
/**
|
|
2215
4408
|
* B24.Hook Manager.
|
|
2216
4409
|
*
|
|
2217
|
-
* @link https://
|
|
4410
|
+
* @link https://bitrix24.github.io/b24jssdk/docs/hook/
|
|
4411
|
+
*
|
|
4412
|
+
* @todo docs
|
|
2218
4413
|
*/
|
|
2219
4414
|
declare class B24Hook extends AbstractB24 implements TypeB24 {
|
|
2220
4415
|
#private;
|
|
2221
|
-
constructor(b24HookParams: B24HookParams
|
|
2222
|
-
|
|
4416
|
+
constructor(b24HookParams: B24HookParams, options?: {
|
|
4417
|
+
restrictionParams?: Partial<RestrictionParams>;
|
|
4418
|
+
});
|
|
2223
4419
|
get auth(): AuthActions;
|
|
2224
4420
|
/**
|
|
2225
4421
|
* Disables warning about client-side query execution
|
|
2226
4422
|
*/
|
|
2227
4423
|
offClientSideWarning(): void;
|
|
2228
4424
|
/**
|
|
2229
|
-
*
|
|
4425
|
+
* @inheritDoc
|
|
2230
4426
|
*/
|
|
2231
4427
|
getTargetOrigin(): string;
|
|
2232
4428
|
/**
|
|
2233
|
-
*
|
|
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
|
|
2234
4438
|
*/
|
|
2235
|
-
|
|
2236
|
-
|
|
4439
|
+
static fromWebhookUrl(url: string, options?: {
|
|
4440
|
+
restrictionParams?: Partial<RestrictionParams>;
|
|
4441
|
+
}): B24Hook;
|
|
2237
4442
|
}
|
|
2238
4443
|
|
|
2239
4444
|
/**
|
|
@@ -2249,13 +4454,15 @@ declare class AuthHookManager implements AuthActions {
|
|
|
2249
4454
|
refreshAuth(): Promise<AuthData>;
|
|
2250
4455
|
getUniq(prefix: string): string;
|
|
2251
4456
|
/**
|
|
2252
|
-
*
|
|
4457
|
+
* @inheritDoc
|
|
2253
4458
|
*/
|
|
2254
4459
|
getTargetOrigin(): string;
|
|
2255
4460
|
/**
|
|
2256
|
-
* 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}`
|
|
2257
4464
|
*/
|
|
2258
|
-
getTargetOriginWithPath(): string
|
|
4465
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
2259
4466
|
/**
|
|
2260
4467
|
* We believe that hooks are created only by the admin
|
|
2261
4468
|
*/
|
|
@@ -2286,6 +4493,9 @@ declare enum MessageCommands {
|
|
|
2286
4493
|
selectUser = "selectUser",
|
|
2287
4494
|
selectAccess = "selectAccess",
|
|
2288
4495
|
selectCRM = "selectCRM",
|
|
4496
|
+
/**
|
|
4497
|
+
* @memo this not work. Need test
|
|
4498
|
+
*/
|
|
2289
4499
|
showAppForm = "showAppForm",
|
|
2290
4500
|
getInterface = "getInterface",
|
|
2291
4501
|
placementBindEvent = "placementBindEvent"
|
|
@@ -2307,46 +4517,50 @@ declare class AppFrame {
|
|
|
2307
4517
|
*/
|
|
2308
4518
|
getAppSid(): string;
|
|
2309
4519
|
/**
|
|
2310
|
-
* Get the account address BX24 (https://
|
|
4520
|
+
* Get the account address BX24 (https://your_domain.bitrix24.com)
|
|
2311
4521
|
*/
|
|
2312
4522
|
getTargetOrigin(): string;
|
|
2313
4523
|
/**
|
|
2314
|
-
* 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/`
|
|
2315
4527
|
*/
|
|
2316
|
-
getTargetOriginWithPath(): string
|
|
4528
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
2317
4529
|
/**
|
|
2318
4530
|
* Returns the localization of the B24 interface
|
|
2319
|
-
* @return {B24LangList} - default B24LangList.en
|
|
4531
|
+
* @return {B24LangList} - default `B24LangList.en`
|
|
2320
4532
|
*
|
|
2321
|
-
* @link https://apidocs.bitrix24.com/
|
|
4533
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-get-lang.html
|
|
2322
4534
|
*/
|
|
2323
4535
|
getLang(): B24LangList;
|
|
2324
4536
|
}
|
|
2325
4537
|
|
|
2326
4538
|
/**
|
|
2327
4539
|
* Parent Window Request Parameters
|
|
2328
|
-
*
|
|
2329
|
-
*
|
|
2330
|
-
*
|
|
2331
|
-
*
|
|
4540
|
+
* - `isRawValue?: boolean` if true then JSON.stringify will not be executed
|
|
4541
|
+
* - `isSafely?: boolean` auto completion mode Promise.resolve()
|
|
4542
|
+
* - `safelyTime?: number` after what time (900 ms) should it be automatically resolved Promise
|
|
4543
|
+
* - `callBack?: () => void` for placement event
|
|
4544
|
+
* - `requestId?: string` Unique request identifier for tracking. Used for query deduplication and debugging.
|
|
2332
4545
|
*/
|
|
2333
4546
|
interface SendParams {
|
|
2334
|
-
[index: string]: any;
|
|
2335
4547
|
isRawValue?: boolean;
|
|
2336
4548
|
isSafely?: boolean;
|
|
2337
4549
|
safelyTime?: number;
|
|
2338
4550
|
callBack?: (...args: any[]) => void;
|
|
4551
|
+
requestId?: string;
|
|
4552
|
+
[index: string]: any;
|
|
2339
4553
|
}
|
|
2340
4554
|
/**
|
|
2341
4555
|
* Parent Window Communication Manager at B24
|
|
2342
4556
|
*/
|
|
2343
4557
|
declare class MessageManager {
|
|
2344
4558
|
#private;
|
|
2345
|
-
protected _logger:
|
|
4559
|
+
protected _logger: LoggerInterface;
|
|
2346
4560
|
private readonly runCallbackHandler;
|
|
2347
4561
|
constructor(appFrame: AppFrame);
|
|
2348
|
-
setLogger(logger:
|
|
2349
|
-
getLogger():
|
|
4562
|
+
setLogger(logger: LoggerInterface): void;
|
|
4563
|
+
getLogger(): LoggerInterface;
|
|
2350
4564
|
/**
|
|
2351
4565
|
* Subscribe to the onMessage event of the parent window
|
|
2352
4566
|
*/
|
|
@@ -2375,17 +4589,18 @@ declare class MessageManager {
|
|
|
2375
4589
|
/**
|
|
2376
4590
|
* Parent window manager
|
|
2377
4591
|
*
|
|
2378
|
-
* @link https://apidocs.bitrix24.com/
|
|
4592
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/
|
|
2379
4593
|
*/
|
|
2380
4594
|
declare class ParentManager {
|
|
2381
4595
|
#private;
|
|
2382
4596
|
constructor(messageManager: MessageManager);
|
|
4597
|
+
get message(): MessageManager;
|
|
2383
4598
|
/**
|
|
2384
4599
|
* The method closes the open modal window with the application
|
|
2385
4600
|
*
|
|
2386
4601
|
* @return {Promise<void>}
|
|
2387
4602
|
*
|
|
2388
|
-
* @link https://apidocs.bitrix24.com/
|
|
4603
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-close-application.html
|
|
2389
4604
|
*/
|
|
2390
4605
|
closeApplication(): Promise<void>;
|
|
2391
4606
|
/**
|
|
@@ -2393,7 +4608,7 @@ declare class ParentManager {
|
|
|
2393
4608
|
*
|
|
2394
4609
|
* @return {Promise<void>}
|
|
2395
4610
|
*
|
|
2396
|
-
* @link https://apidocs.bitrix24.com/
|
|
4611
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-fit-window.html
|
|
2397
4612
|
*
|
|
2398
4613
|
* @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
|
|
2399
4614
|
*/
|
|
@@ -2406,7 +4621,7 @@ declare class ParentManager {
|
|
|
2406
4621
|
*
|
|
2407
4622
|
* @return {Promise<void>}
|
|
2408
4623
|
*
|
|
2409
|
-
* @link https://apidocs.bitrix24.com/
|
|
4624
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-resize-window.html
|
|
2410
4625
|
*
|
|
2411
4626
|
* @memo in certain situations it may not be executed, in this case isSafely mode will be triggered
|
|
2412
4627
|
*/
|
|
@@ -2427,7 +4642,7 @@ declare class ParentManager {
|
|
|
2427
4642
|
*
|
|
2428
4643
|
* @return {Promise<{scrollWidth: number; scrollHeight: number}>}
|
|
2429
4644
|
*
|
|
2430
|
-
* @link https://apidocs.bitrix24.com/
|
|
4645
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-get-scroll-size.html
|
|
2431
4646
|
*/
|
|
2432
4647
|
getScrollSize(): {
|
|
2433
4648
|
scrollWidth: number;
|
|
@@ -2439,7 +4654,7 @@ declare class ParentManager {
|
|
|
2439
4654
|
* @param {number} scroll should specify the vertical scrollbar position (0 - scroll to the very top)
|
|
2440
4655
|
* @return {Promise<void>}
|
|
2441
4656
|
*
|
|
2442
|
-
* @link https://apidocs.bitrix24.com/
|
|
4657
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-scroll-parent-window.html
|
|
2443
4658
|
*/
|
|
2444
4659
|
scrollParentWindow(scroll: number): Promise<void>;
|
|
2445
4660
|
/**
|
|
@@ -2447,7 +4662,7 @@ declare class ParentManager {
|
|
|
2447
4662
|
*
|
|
2448
4663
|
* @return {Promise<void>}
|
|
2449
4664
|
*
|
|
2450
|
-
* @link https://apidocs.bitrix24.com/
|
|
4665
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-reload-window.html
|
|
2451
4666
|
*/
|
|
2452
4667
|
reloadWindow(): Promise<void>;
|
|
2453
4668
|
/**
|
|
@@ -2457,7 +4672,7 @@ declare class ParentManager {
|
|
|
2457
4672
|
*
|
|
2458
4673
|
* @return {Promise<void>}
|
|
2459
4674
|
*
|
|
2460
|
-
* @link https://apidocs.bitrix24.com/
|
|
4675
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-set-title.html
|
|
2461
4676
|
*/
|
|
2462
4677
|
setTitle(title: string): Promise<void>;
|
|
2463
4678
|
/**
|
|
@@ -2468,7 +4683,7 @@ declare class ParentManager {
|
|
|
2468
4683
|
*
|
|
2469
4684
|
* @return {Promise<void>}
|
|
2470
4685
|
*
|
|
2471
|
-
* @link https://apidocs.bitrix24.com/
|
|
4686
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-call-to.html
|
|
2472
4687
|
*/
|
|
2473
4688
|
imCallTo(userId: number, isVideo?: boolean): Promise<void>;
|
|
2474
4689
|
/**
|
|
@@ -2478,7 +4693,7 @@ declare class ParentManager {
|
|
|
2478
4693
|
*
|
|
2479
4694
|
* @return {Promise<void>}
|
|
2480
4695
|
*
|
|
2481
|
-
* @link https://apidocs.bitrix24.com/
|
|
4696
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-phone-to.html
|
|
2482
4697
|
*/
|
|
2483
4698
|
imPhoneTo(phone: string): Promise<void>;
|
|
2484
4699
|
/**
|
|
@@ -2494,7 +4709,7 @@ declare class ParentManager {
|
|
|
2494
4709
|
*
|
|
2495
4710
|
* @return {Promise<void>}
|
|
2496
4711
|
*
|
|
2497
|
-
* @link https://apidocs.bitrix24.com/
|
|
4712
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-open-messenger.html
|
|
2498
4713
|
* @link https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=93&LESSON_ID=20152&LESSON_PATH=7657.7883.8025.20150.20152
|
|
2499
4714
|
*
|
|
2500
4715
|
*/
|
|
@@ -2510,7 +4725,7 @@ declare class ParentManager {
|
|
|
2510
4725
|
*
|
|
2511
4726
|
* @return {Promise<void>}
|
|
2512
4727
|
*
|
|
2513
|
-
* @link https://apidocs.bitrix24.com/
|
|
4728
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-im-open-history.html
|
|
2514
4729
|
*/
|
|
2515
4730
|
imOpenHistory(dialogId: number | `chat${number}` | `imol|${number}`): Promise<void>;
|
|
2516
4731
|
}
|
|
@@ -2518,7 +4733,7 @@ declare class ParentManager {
|
|
|
2518
4733
|
/**
|
|
2519
4734
|
* Manager for working with application settings via communication with the parent window
|
|
2520
4735
|
*
|
|
2521
|
-
* @link https://apidocs.bitrix24.com/
|
|
4736
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/index.html
|
|
2522
4737
|
*/
|
|
2523
4738
|
declare class OptionsManager$1 {
|
|
2524
4739
|
#private;
|
|
@@ -2531,25 +4746,25 @@ declare class OptionsManager$1 {
|
|
|
2531
4746
|
/**
|
|
2532
4747
|
* Getting application option
|
|
2533
4748
|
*
|
|
2534
|
-
* @link https://apidocs.bitrix24.com/
|
|
4749
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/bx24-app-option-get.html
|
|
2535
4750
|
*/
|
|
2536
4751
|
appGet(option: string): any;
|
|
2537
4752
|
/**
|
|
2538
4753
|
* Updates application data through the parent window
|
|
2539
4754
|
*
|
|
2540
|
-
* @link https://apidocs.bitrix24.com/
|
|
4755
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/bx24-app-option-set.html
|
|
2541
4756
|
*/
|
|
2542
4757
|
appSet(option: string, value: any): Promise<void>;
|
|
2543
4758
|
/**
|
|
2544
4759
|
* Getting user option
|
|
2545
4760
|
*
|
|
2546
|
-
* @link https://apidocs.bitrix24.com/
|
|
4761
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/bx24-user-option-get.html
|
|
2547
4762
|
*/
|
|
2548
4763
|
userGet(option: string): any;
|
|
2549
4764
|
/**
|
|
2550
4765
|
* Updates user data through the parent window
|
|
2551
4766
|
*
|
|
2552
|
-
* @link https://apidocs.bitrix24.com/
|
|
4767
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/options/bx24-user-option-set.html
|
|
2553
4768
|
*/
|
|
2554
4769
|
userSet(option: string, value: any): Promise<void>;
|
|
2555
4770
|
}
|
|
@@ -2650,7 +4865,7 @@ type SelectedCRM = {
|
|
|
2650
4865
|
/**
|
|
2651
4866
|
* Select dialog manager
|
|
2652
4867
|
*
|
|
2653
|
-
* @link https://apidocs.bitrix24.com/
|
|
4868
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/index.html
|
|
2654
4869
|
*/
|
|
2655
4870
|
declare class DialogManager {
|
|
2656
4871
|
#private;
|
|
@@ -2661,7 +4876,7 @@ declare class DialogManager {
|
|
|
2661
4876
|
*
|
|
2662
4877
|
* @return {Promise<null|SelectedUser>}
|
|
2663
4878
|
*
|
|
2664
|
-
* @link https://apidocs.bitrix24.com/
|
|
4879
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-user.html
|
|
2665
4880
|
*/
|
|
2666
4881
|
selectUser(): Promise<null | SelectedUser>;
|
|
2667
4882
|
/**
|
|
@@ -2670,27 +4885,25 @@ declare class DialogManager {
|
|
|
2670
4885
|
*
|
|
2671
4886
|
* @return {Promise<SelectedUser[]>}
|
|
2672
4887
|
*
|
|
2673
|
-
* @link https://apidocs.bitrix24.com/
|
|
4888
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-users.html
|
|
2674
4889
|
*/
|
|
2675
4890
|
selectUsers(): Promise<SelectedUser[]>;
|
|
2676
4891
|
/**
|
|
2677
|
-
* @deprecated
|
|
2678
4892
|
* Method displays a standard access permission selection dialog
|
|
2679
4893
|
*
|
|
2680
4894
|
* @param {string[]} blockedAccessPermissions
|
|
2681
4895
|
* @return {Promise<SelectedAccess[]>}
|
|
2682
4896
|
*
|
|
2683
|
-
* @link https://apidocs.bitrix24.com/
|
|
4897
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-access.html
|
|
2684
4898
|
*/
|
|
2685
4899
|
selectAccess(blockedAccessPermissions?: string[]): Promise<SelectedAccess[]>;
|
|
2686
4900
|
/**
|
|
2687
|
-
* @deprecated
|
|
2688
4901
|
* Method invokes the system dialog for selecting a CRM entity
|
|
2689
4902
|
*
|
|
2690
4903
|
* @param {SelectCRMParams} params
|
|
2691
4904
|
* @return {Promise<SelectedCRM>}
|
|
2692
4905
|
*
|
|
2693
|
-
* @link https://apidocs.bitrix24.com/
|
|
4906
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-dialogues/bx24-select-crm.html
|
|
2694
4907
|
*/
|
|
2695
4908
|
selectCRM(params?: SelectCRMParams): Promise<SelectedCRM>;
|
|
2696
4909
|
}
|
|
@@ -2712,7 +4925,7 @@ declare class SliderManager {
|
|
|
2712
4925
|
/**
|
|
2713
4926
|
* When the method is called, a pop-up window with the application frame will be opened.
|
|
2714
4927
|
*
|
|
2715
|
-
* @link https://apidocs.bitrix24.com/
|
|
4928
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-application.html
|
|
2716
4929
|
*/
|
|
2717
4930
|
openSliderAppPage(params?: any): Promise<any>;
|
|
2718
4931
|
/**
|
|
@@ -2720,7 +4933,7 @@ declare class SliderManager {
|
|
|
2720
4933
|
*
|
|
2721
4934
|
* @return {Promise<void>}
|
|
2722
4935
|
*
|
|
2723
|
-
* @link https://apidocs.bitrix24.com/
|
|
4936
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-close-application.html
|
|
2724
4937
|
*/
|
|
2725
4938
|
closeSliderAppPage(): Promise<void>;
|
|
2726
4939
|
/**
|
|
@@ -2729,22 +4942,16 @@ declare class SliderManager {
|
|
|
2729
4942
|
* @param {number} width - Number in the range from 1640 to 1200, from 1200 to 950, from 950 to 900, from 900 ...
|
|
2730
4943
|
* @return {Promise<StatusClose>}
|
|
2731
4944
|
*
|
|
2732
|
-
* @link https://apidocs.bitrix24.com/
|
|
4945
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-path.html
|
|
2733
4946
|
* @memo /^\/(crm\/(deal|lead|contact|company|type)|marketplace|company\/personal\/user\/[0-9]+|workgroups\/group\/[0-9]+)\//
|
|
2734
4947
|
*/
|
|
2735
4948
|
openPath(url: URL, width?: number): Promise<StatusClose>;
|
|
2736
|
-
/**
|
|
2737
|
-
* @deprecated
|
|
2738
|
-
* @param params
|
|
2739
|
-
*/
|
|
2740
|
-
showAppForm(params: any): Promise<void>;
|
|
2741
4949
|
}
|
|
2742
4950
|
|
|
2743
4951
|
/**
|
|
2744
4952
|
* Placement Manager
|
|
2745
4953
|
*
|
|
2746
4954
|
* @see https://apidocs.bitrix24.com/api-reference/widgets/ui-interaction/index.html
|
|
2747
|
-
* @see https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=99&CHAPTER_ID=02535&LESSON_PATH=8771.5380.2535
|
|
2748
4955
|
*/
|
|
2749
4956
|
declare class PlacementManager {
|
|
2750
4957
|
#private;
|
|
@@ -2754,7 +4961,12 @@ declare class PlacementManager {
|
|
|
2754
4961
|
* @param data
|
|
2755
4962
|
*/
|
|
2756
4963
|
initData(data: MessageInitData): PlacementManager;
|
|
4964
|
+
/**
|
|
4965
|
+
* Symlink on `placement`
|
|
4966
|
+
* For backward compatibility
|
|
4967
|
+
*/
|
|
2757
4968
|
get title(): string;
|
|
4969
|
+
get placement(): string;
|
|
2758
4970
|
get isDefault(): boolean;
|
|
2759
4971
|
get options(): any;
|
|
2760
4972
|
get isSliderMode(): boolean;
|
|
@@ -2800,12 +5012,17 @@ declare class PlacementManager {
|
|
|
2800
5012
|
* B24 Manager. Replacement api.bitrix24.com
|
|
2801
5013
|
*
|
|
2802
5014
|
* @link https://api.bitrix24.com/api/v1/
|
|
5015
|
+
* @link https://bitrix24.github.io/b24jssdk/docs/frame/
|
|
2803
5016
|
* @see /bitrix/js/rest/applayout.js
|
|
5017
|
+
*
|
|
5018
|
+
* @todo add docs
|
|
2804
5019
|
*/
|
|
2805
5020
|
declare class B24Frame extends AbstractB24 implements TypeB24 {
|
|
2806
5021
|
#private;
|
|
2807
|
-
constructor(queryParams: B24FrameQueryParams
|
|
2808
|
-
|
|
5022
|
+
constructor(queryParams: B24FrameQueryParams, options?: {
|
|
5023
|
+
restrictionParams?: Partial<RestrictionParams>;
|
|
5024
|
+
});
|
|
5025
|
+
setLogger(logger: LoggerInterface): void;
|
|
2809
5026
|
get isFirstRun(): boolean;
|
|
2810
5027
|
get isInstallMode(): boolean;
|
|
2811
5028
|
get parent(): ParentManager;
|
|
@@ -2823,17 +5040,17 @@ declare class B24Frame extends AbstractB24 implements TypeB24 {
|
|
|
2823
5040
|
/**
|
|
2824
5041
|
* Signals that the installer or application setup has finished running.
|
|
2825
5042
|
*
|
|
2826
|
-
* @link https://apidocs.bitrix24.com/
|
|
5043
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-functions/bx24-install-finish.html
|
|
2827
5044
|
*/
|
|
2828
5045
|
installFinish(): Promise<any>;
|
|
2829
5046
|
/**
|
|
2830
|
-
*
|
|
5047
|
+
* @inheritDoc
|
|
2831
5048
|
*/
|
|
2832
5049
|
getTargetOrigin(): string;
|
|
2833
5050
|
/**
|
|
2834
|
-
*
|
|
5051
|
+
* @inheritDoc
|
|
2835
5052
|
*/
|
|
2836
|
-
getTargetOriginWithPath(): string
|
|
5053
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
2837
5054
|
/**
|
|
2838
5055
|
* Returns the sid of the application relative to the parent window like this `9c33468728e1d2c8c97562475edfd96`
|
|
2839
5056
|
*/
|
|
@@ -2841,7 +5058,7 @@ declare class B24Frame extends AbstractB24 implements TypeB24 {
|
|
|
2841
5058
|
/**
|
|
2842
5059
|
* Returns the localization of the B24 interface
|
|
2843
5060
|
*
|
|
2844
|
-
* @link https://apidocs.bitrix24.com/
|
|
5061
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-get-lang.html
|
|
2845
5062
|
*/
|
|
2846
5063
|
getLang(): B24LangList;
|
|
2847
5064
|
}
|
|
@@ -2860,39 +5077,92 @@ declare class AuthManager implements AuthActions {
|
|
|
2860
5077
|
/**
|
|
2861
5078
|
* Returns authorization data
|
|
2862
5079
|
*
|
|
2863
|
-
* @link https://apidocs.bitrix24.com/
|
|
5080
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-functions/bx24-get-auth.html
|
|
2864
5081
|
*/
|
|
2865
5082
|
getAuthData(): false | AuthData;
|
|
2866
5083
|
/**
|
|
2867
5084
|
* Updates authorization data through the parent window
|
|
2868
5085
|
*
|
|
2869
|
-
* @link https://apidocs.bitrix24.com/
|
|
5086
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-functions/bx24-refresh-auth.html
|
|
2870
5087
|
*/
|
|
2871
5088
|
refreshAuth(): Promise<AuthData>;
|
|
2872
5089
|
getUniq(prefix: string): string;
|
|
2873
5090
|
/**
|
|
2874
5091
|
* Determines whether the current user has administrator rights
|
|
2875
5092
|
*
|
|
2876
|
-
* @link https://apidocs.bitrix24.com/
|
|
5093
|
+
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-is-admin.html
|
|
2877
5094
|
*/
|
|
2878
5095
|
get isAdmin(): boolean;
|
|
5096
|
+
/**
|
|
5097
|
+
* @inheritDoc
|
|
5098
|
+
*/
|
|
5099
|
+
getTargetOrigin(): string;
|
|
5100
|
+
/**
|
|
5101
|
+
* @inheritDoc
|
|
5102
|
+
*/
|
|
5103
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
5104
|
+
}
|
|
5105
|
+
|
|
5106
|
+
declare class RefreshTokenError extends SdkError {
|
|
2879
5107
|
}
|
|
2880
5108
|
|
|
2881
5109
|
/**
|
|
2882
|
-
*
|
|
2883
|
-
* @todo add docs
|
|
5110
|
+
* OAuth Authorization Manager
|
|
2884
5111
|
*
|
|
2885
|
-
* @link https://apidocs.bitrix24.com/
|
|
5112
|
+
* @link https://apidocs.bitrix24.com/settings/oauth/index.html
|
|
5113
|
+
* @link https://bitrix24.github.io/b24jssdk/docs/oauth/
|
|
2886
5114
|
*/
|
|
5115
|
+
declare class AuthOAuthManager implements AuthActions {
|
|
5116
|
+
#private;
|
|
5117
|
+
constructor(b24OAuthParams: B24OAuthParams, oAuthSecret: B24OAuthSecret);
|
|
5118
|
+
/**
|
|
5119
|
+
* Returns authorization data
|
|
5120
|
+
* @see Http.#prepareParams
|
|
5121
|
+
*/
|
|
5122
|
+
getAuthData(): false | AuthData;
|
|
5123
|
+
/**
|
|
5124
|
+
* Updates authorization data
|
|
5125
|
+
*/
|
|
5126
|
+
refreshAuth(): Promise<AuthData>;
|
|
5127
|
+
setCallbackRefreshAuth(cb: CallbackRefreshAuth): void;
|
|
5128
|
+
removeCallbackRefreshAuth(): void;
|
|
5129
|
+
setCustomRefreshAuth(cb: CustomRefreshAuth): void;
|
|
5130
|
+
removeCustomRefreshAuth(): void;
|
|
5131
|
+
getUniq(prefix: string): string;
|
|
5132
|
+
/**
|
|
5133
|
+
* @inheritDoc
|
|
5134
|
+
*/
|
|
5135
|
+
getTargetOrigin(): string;
|
|
5136
|
+
/**
|
|
5137
|
+
* @inheritDoc
|
|
5138
|
+
*/
|
|
5139
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
5140
|
+
/**
|
|
5141
|
+
* Determines whether the current user has administrator rights
|
|
5142
|
+
*/
|
|
5143
|
+
get isAdmin(): boolean;
|
|
5144
|
+
initIsAdmin(http: TypeHttp, requestId?: string): Promise<void>;
|
|
5145
|
+
}
|
|
2887
5146
|
|
|
5147
|
+
/**
|
|
5148
|
+
* B24.OAuth Manager
|
|
5149
|
+
*
|
|
5150
|
+
* @link https://apidocs.bitrix24.com/settings/oauth/index.html
|
|
5151
|
+
* @link https://bitrix24.github.io/b24jssdk/docs/oauth/
|
|
5152
|
+
*
|
|
5153
|
+
* @todo add docs
|
|
5154
|
+
*/
|
|
2888
5155
|
declare class B24OAuth extends AbstractB24 implements TypeB24 {
|
|
2889
5156
|
#private;
|
|
2890
|
-
constructor(authOptions: B24OAuthParams, oAuthSecret: B24OAuthSecret
|
|
2891
|
-
|
|
5157
|
+
constructor(authOptions: B24OAuthParams, oAuthSecret: B24OAuthSecret, options?: {
|
|
5158
|
+
restrictionParams?: Partial<RestrictionParams>;
|
|
5159
|
+
});
|
|
2892
5160
|
/**
|
|
2893
5161
|
* Used to initialize information about the current user.
|
|
5162
|
+
*
|
|
5163
|
+
* @todo test this
|
|
2894
5164
|
*/
|
|
2895
|
-
initIsAdmin(): Promise<void>;
|
|
5165
|
+
initIsAdmin(requestId?: string): Promise<void>;
|
|
2896
5166
|
/**
|
|
2897
5167
|
* Sets an asynchronous Callback to receive updated authorization data
|
|
2898
5168
|
* @param cb
|
|
@@ -2917,59 +5187,26 @@ declare class B24OAuth extends AbstractB24 implements TypeB24 {
|
|
|
2917
5187
|
offClientSideWarning(): void;
|
|
2918
5188
|
get auth(): AuthActions;
|
|
2919
5189
|
/**
|
|
2920
|
-
*
|
|
2921
|
-
*/
|
|
2922
|
-
getTargetOrigin(): string;
|
|
2923
|
-
/**
|
|
2924
|
-
* Get the account address BX24 with Path ( https://name.bitrix24.com/rest/1/xxxxx )
|
|
2925
|
-
*/
|
|
2926
|
-
getTargetOriginWithPath(): string;
|
|
2927
|
-
}
|
|
2928
|
-
|
|
2929
|
-
declare class AuthOAuthManager implements AuthActions {
|
|
2930
|
-
#private;
|
|
2931
|
-
constructor(b24OAuthParams: B24OAuthParams, oAuthSecret: B24OAuthSecret);
|
|
2932
|
-
/**
|
|
2933
|
-
* Returns authorization data
|
|
2934
|
-
* @see Http.#prepareParams
|
|
2935
|
-
*/
|
|
2936
|
-
getAuthData(): false | AuthData;
|
|
2937
|
-
/**
|
|
2938
|
-
* Updates authorization data
|
|
2939
|
-
*/
|
|
2940
|
-
refreshAuth(): Promise<AuthData>;
|
|
2941
|
-
setCallbackRefreshAuth(cb: CallbackRefreshAuth): void;
|
|
2942
|
-
removeCallbackRefreshAuth(): void;
|
|
2943
|
-
setCustomRefreshAuth(cb: CustomRefreshAuth): void;
|
|
2944
|
-
removeCustomRefreshAuth(): void;
|
|
2945
|
-
getUniq(prefix: string): string;
|
|
2946
|
-
/**
|
|
2947
|
-
* Get the account address BX24 ( https://name.bitrix24.com )
|
|
5190
|
+
* @inheritDoc
|
|
2948
5191
|
*/
|
|
2949
5192
|
getTargetOrigin(): string;
|
|
2950
5193
|
/**
|
|
2951
|
-
*
|
|
2952
|
-
*/
|
|
2953
|
-
getTargetOriginWithPath(): string;
|
|
2954
|
-
/**
|
|
2955
|
-
* Determines whether the current user has administrator rights
|
|
5194
|
+
* @inheritDoc
|
|
2956
5195
|
*/
|
|
2957
|
-
|
|
2958
|
-
initIsAdmin(http: TypeHttp): Promise<void>;
|
|
5196
|
+
getTargetOriginWithPath(): Map<ApiVersion, string>;
|
|
2959
5197
|
}
|
|
2960
5198
|
|
|
2961
5199
|
declare abstract class AbstractHelper {
|
|
2962
5200
|
protected _b24: TypeB24;
|
|
2963
|
-
protected _logger: null | LoggerBrowser;
|
|
2964
5201
|
protected _data: any;
|
|
5202
|
+
protected _logger: LoggerInterface;
|
|
2965
5203
|
constructor(b24: TypeB24);
|
|
2966
|
-
setLogger(logger:
|
|
2967
|
-
getLogger():
|
|
5204
|
+
setLogger(logger: LoggerInterface): void;
|
|
5205
|
+
getLogger(): LoggerInterface;
|
|
2968
5206
|
/**
|
|
2969
5207
|
* Initializes the data received
|
|
2970
|
-
* @param data
|
|
2971
5208
|
*/
|
|
2972
|
-
initData(
|
|
5209
|
+
initData(_data: any): Promise<void>;
|
|
2973
5210
|
abstract get data(): any;
|
|
2974
5211
|
}
|
|
2975
5212
|
|
|
@@ -3012,7 +5249,7 @@ declare class LicenseManager extends AbstractHelper {
|
|
|
3012
5249
|
* Set RestrictionManager params by license
|
|
3013
5250
|
* @link https://apidocs.bitrix24.com/api-reference/common/system/app-info.html
|
|
3014
5251
|
*/
|
|
3015
|
-
makeRestrictionManagerParams(): void
|
|
5252
|
+
makeRestrictionManagerParams(): Promise<void>;
|
|
3016
5253
|
}
|
|
3017
5254
|
|
|
3018
5255
|
type CurrencyFormatInit = {
|
|
@@ -3098,7 +5335,6 @@ declare class OptionsManager extends AbstractHelper {
|
|
|
3098
5335
|
*/
|
|
3099
5336
|
declare class B24HelperManager {
|
|
3100
5337
|
private readonly _b24;
|
|
3101
|
-
protected _logger: null | LoggerBrowser;
|
|
3102
5338
|
private _isInit;
|
|
3103
5339
|
private _profile;
|
|
3104
5340
|
private _app;
|
|
@@ -3110,9 +5346,10 @@ declare class B24HelperManager {
|
|
|
3110
5346
|
private _b24PullClient;
|
|
3111
5347
|
private _pullClientUnSubscribe;
|
|
3112
5348
|
private _pullClientModuleId;
|
|
5349
|
+
protected _logger: LoggerInterface;
|
|
3113
5350
|
constructor(b24: TypeB24);
|
|
3114
|
-
setLogger(logger:
|
|
3115
|
-
getLogger():
|
|
5351
|
+
setLogger(logger: LoggerInterface): void;
|
|
5352
|
+
getLogger(): LoggerInterface;
|
|
3116
5353
|
destroy(): void;
|
|
3117
5354
|
loadData(dataTypes?: LoadDataType[]): Promise<void>;
|
|
3118
5355
|
private parseUserData;
|
|
@@ -3124,7 +5361,7 @@ declare class B24HelperManager {
|
|
|
3124
5361
|
get isInit(): boolean;
|
|
3125
5362
|
get forB24Form(): TypeB24Form;
|
|
3126
5363
|
/**
|
|
3127
|
-
* Get the account address BX24 (https://
|
|
5364
|
+
* Get the account address BX24 (https://your_domain.bitrix24.com)
|
|
3128
5365
|
*/
|
|
3129
5366
|
get hostName(): string;
|
|
3130
5367
|
get profileInfo(): ProfileManager;
|
|
@@ -3165,9 +5402,6 @@ declare const useB24Helper: () => {
|
|
|
3165
5402
|
startPullClient: () => void;
|
|
3166
5403
|
};
|
|
3167
5404
|
|
|
3168
|
-
/**
|
|
3169
|
-
* @todo fix logic for _loggingEnabled
|
|
3170
|
-
*/
|
|
3171
5405
|
declare class PullClient implements ConnectorParent {
|
|
3172
5406
|
private _logger;
|
|
3173
5407
|
private _restClient;
|
|
@@ -3220,8 +5454,8 @@ declare class PullClient implements ConnectorParent {
|
|
|
3220
5454
|
* @param params
|
|
3221
5455
|
*/
|
|
3222
5456
|
constructor(params: TypePullClientParams);
|
|
3223
|
-
setLogger(logger:
|
|
3224
|
-
getLogger():
|
|
5457
|
+
setLogger(logger: LoggerInterface): void;
|
|
5458
|
+
getLogger(): LoggerInterface;
|
|
3225
5459
|
destroy(): void;
|
|
3226
5460
|
private init;
|
|
3227
5461
|
get connector(): null | TypeConnector;
|
|
@@ -3391,9 +5625,6 @@ declare class PullClient implements ConnectorParent {
|
|
|
3391
5625
|
*/
|
|
3392
5626
|
private emitUserStatusChange;
|
|
3393
5627
|
private restoreUserStatusSubscription;
|
|
3394
|
-
/**
|
|
3395
|
-
* @param logTag
|
|
3396
|
-
*/
|
|
3397
5628
|
private loadConfig;
|
|
3398
5629
|
/**
|
|
3399
5630
|
* @param config
|
|
@@ -3564,7 +5795,10 @@ declare class PullClient implements ConnectorParent {
|
|
|
3564
5795
|
private onCustomEvent;
|
|
3565
5796
|
}
|
|
3566
5797
|
|
|
3567
|
-
declare function initializeB24Frame(
|
|
5798
|
+
declare function initializeB24Frame(options?: {
|
|
5799
|
+
version?: ApiVersion;
|
|
5800
|
+
restrictionParams?: Partial<RestrictionParams>;
|
|
5801
|
+
}): Promise<B24Frame>;
|
|
3568
5802
|
|
|
3569
|
-
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,
|
|
3570
|
-
export type { ActivityConfig, ActivityHandlerParams, ActivityOrRobotConfig, ActivityProperty, ActivityPropertyType, AjaxErrorParams, AjaxQuery,
|
|
5803
|
+
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 };
|
|
5804
|
+
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 };
|