itd-api 0.5.0 → 0.6.0
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.md +6 -4
- package/dist/index.cjs +216 -101
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -179
- package/dist/index.d.ts +55 -179
- package/dist/index.js +217 -80
- package/dist/index.js.map +1 -1
- package/dist/{multi-storage-B0r0AInH.js → multi-storage-BUZaLAPO.js} +13 -9
- package/dist/{multi-storage-B0r0AInH.js.map → multi-storage-BUZaLAPO.js.map} +1 -1
- package/dist/{multi-storage-CLqmzq07.d.ts → multi-storage-BUoEoW8f.d.cts} +3 -7
- package/dist/{multi-storage-mBuCOVZY.cjs → multi-storage-Bf84xiO8.cjs} +12 -14
- package/dist/{multi-storage-mBuCOVZY.cjs.map → multi-storage-Bf84xiO8.cjs.map} +1 -1
- package/dist/{multi-storage-s_PcWPGH.d.cts → multi-storage-CQSlI_kn.d.ts} +3 -7
- package/dist/node.cjs +2 -2
- package/dist/node.d.cts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.js +2 -2
- package/dist/{storage-Doe3lpFQ.d.ts → storage-BqMxs76Y.d.cts} +4 -4
- package/dist/{storage-Doe3lpFQ.d.cts → storage-BqMxs76Y.d.ts} +4 -4
- package/dist/{storage-dF8Tio5y.cjs → storage-DnzZPS_9.cjs} +36 -27
- package/dist/{storage-dF8Tio5y.cjs.map → storage-DnzZPS_9.cjs.map} +1 -1
- package/dist/{storage-DWrK3Z4M.js → storage-IHdXw52v.js} +36 -27
- package/dist/{storage-DWrK3Z4M.js.map → storage-IHdXw52v.js.map} +1 -1
- package/dist/web.cjs +1 -1
- package/dist/web.d.cts +1 -1
- package/dist/web.d.ts +1 -1
- package/dist/web.js +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as withNamespace, a as createTokenStorage, c as KeyValueStore, d as MemoryKeyValueStore, f as RecordKeyValueStoreSource, g as withCodec, h as isEnumerableKeyValueStore, i as TokenStorageAdapterOptions, l as KeyValueStoreKeys, m as createRecordKeyValueStore, n as MemoryTokenStorage, o as EnumerableKeyValueStore, p as createKeyValueStore, r as TokenStorage, s as KeyValueCodec, t as ItdSession, u as KeyValueStoreResult } from "./storage-
|
|
2
|
-
import {
|
|
1
|
+
import { _ as withNamespace, a as createTokenStorage, c as KeyValueStore, d as MemoryKeyValueStore, f as RecordKeyValueStoreSource, g as withCodec, h as isEnumerableKeyValueStore, i as TokenStorageAdapterOptions, l as KeyValueStoreKeys, m as createRecordKeyValueStore, n as MemoryTokenStorage, o as EnumerableKeyValueStore, p as createKeyValueStore, r as TokenStorage, s as KeyValueCodec, t as ItdSession, u as KeyValueStoreResult } from "./storage-BqMxs76Y.cjs";
|
|
2
|
+
import { a as scopedTokenStorage, c as FileInput, d as FileTransferMode, f as FromStreamOptions, g as UrlFileOptions, h as UrlFile, i as createMultiTokenStorage, l as FileStreamContent, m as StreamFile, n as MultiTokenStorage, o as FileContent, p as LazyFile, r as MultiTokenStorageAdapterOptions, s as FileContext, t as MemoryMultiTokenStorage, u as FileStreamOptions } from "./multi-storage-BUoEoW8f.cjs";
|
|
3
3
|
//#region src/types/enums.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Перечисления API итд.com.
|
|
@@ -697,6 +697,14 @@ declare const OPERATIONS: Readonly<{
|
|
|
697
697
|
readonly method: "PUT";
|
|
698
698
|
readonly retrySafety: "idempotent";
|
|
699
699
|
}>;
|
|
700
|
+
readonly 'realtime.poll.updates': Readonly<{
|
|
701
|
+
readonly method: "GET";
|
|
702
|
+
readonly retrySafety: "safe";
|
|
703
|
+
}>;
|
|
704
|
+
readonly 'realtime.poll.unread': Readonly<{
|
|
705
|
+
readonly method: "GET";
|
|
706
|
+
readonly retrySafety: "safe";
|
|
707
|
+
}>;
|
|
700
708
|
readonly 'hashtags.search': Readonly<{
|
|
701
709
|
readonly method: "GET";
|
|
702
710
|
readonly retrySafety: "safe";
|
|
@@ -812,14 +820,6 @@ declare const RuntimeMode: Readonly<{
|
|
|
812
820
|
readonly Server: "server";
|
|
813
821
|
}>;
|
|
814
822
|
type RuntimeMode = (typeof RuntimeMode)[keyof typeof RuntimeMode];
|
|
815
|
-
/** Распознанная среда исполнения. */
|
|
816
|
-
declare const DetectedRuntime: Readonly<{
|
|
817
|
-
readonly Browser: "browser";
|
|
818
|
-
/** Есть `window`, но нет `document`; cookie ведёт нативный сетевой слой. */
|
|
819
|
-
readonly ReactNative: "react-native";
|
|
820
|
-
readonly Server: "server";
|
|
821
|
-
}>;
|
|
822
|
-
type DetectedRuntime = (typeof DetectedRuntime)[keyof typeof DetectedRuntime];
|
|
823
823
|
//#endregion
|
|
824
824
|
//#region src/core/services.d.ts
|
|
825
825
|
/** Сервис платформы на отдельном домене. */
|
|
@@ -838,48 +838,6 @@ interface ServiceDefinition {
|
|
|
838
838
|
*/
|
|
839
839
|
auth?: boolean | undefined;
|
|
840
840
|
}
|
|
841
|
-
/**
|
|
842
|
-
* Именованные сервисы клиента.
|
|
843
|
-
*
|
|
844
|
-
* @internal
|
|
845
|
-
*/
|
|
846
|
-
declare class ServiceRegistry {
|
|
847
|
-
#private;
|
|
848
|
-
/** @param primaryBaseUrl базовый URL клиента */
|
|
849
|
-
constructor(primaryBaseUrl?: string);
|
|
850
|
-
/**
|
|
851
|
-
* Регистрирует сервис. Имя очищается от краевых пробелов, базовый URL приводится
|
|
852
|
-
* к каноничному виду, а незаданный `auth` выводится из хоста.
|
|
853
|
-
*
|
|
854
|
-
* @throws {ItdConfigError} если имя пустое, имя занято или `baseUrl` не абсолютный URL
|
|
855
|
-
*/
|
|
856
|
-
define(definition: ServiceDefinition): void;
|
|
857
|
-
/** Определение сервиса либо `undefined`, если такого нет. */
|
|
858
|
-
get(name: string): ServiceDefinition | undefined;
|
|
859
|
-
/** Зарегистрирован ли сервис с таким именем. */
|
|
860
|
-
has(name: string): boolean;
|
|
861
|
-
/**
|
|
862
|
-
* Определение сервиса.
|
|
863
|
-
*
|
|
864
|
-
* @throws {ItdConfigError} если сервис не зарегистрирован
|
|
865
|
-
*/
|
|
866
|
-
require(name: string): ServiceDefinition;
|
|
867
|
-
/**
|
|
868
|
-
* Базовый URL сервиса.
|
|
869
|
-
*
|
|
870
|
-
* @throws {ItdConfigError} если сервис не зарегистрирован
|
|
871
|
-
*/
|
|
872
|
-
resolveBaseUrl(name: string): string;
|
|
873
|
-
/**
|
|
874
|
-
* Принадлежит ли URL основному хосту клиента или его поддомену.
|
|
875
|
-
*
|
|
876
|
-
* Используется для безопасного значения по умолчанию у разового `baseUrl`: Bearer-токен
|
|
877
|
-
* не должен уходить на посторонний хост без явного `skipAuth: false`.
|
|
878
|
-
*
|
|
879
|
-
* @internal
|
|
880
|
-
*/
|
|
881
|
-
isPrimarySite(baseUrl: string): boolean;
|
|
882
|
-
}
|
|
883
841
|
//#endregion
|
|
884
842
|
//#region src/core/url.d.ts
|
|
885
843
|
/** Значение параметра запроса. `undefined` и `null` в строку не попадают. */
|
|
@@ -1087,6 +1045,14 @@ interface ItdClientOptions {
|
|
|
1087
1045
|
clock?: ItdClock | undefined;
|
|
1088
1046
|
/** Таймаут запроса в мс. По умолчанию 30000 — столько же использует сайт итд.com. `0` снимает ограничение. */
|
|
1089
1047
|
timeout?: number | undefined;
|
|
1048
|
+
/**
|
|
1049
|
+
* Сколько `close()` и `dispose()` ждут чужой код, мс. По умолчанию 10000.
|
|
1050
|
+
*
|
|
1051
|
+
* Ждут обработчиков realtime-потока и операций, вошедших в обёртки плагинов. По истечении
|
|
1052
|
+
* срока ресурсы всё равно освобождаются, а метод отклоняется `ItdStateError` с указанием
|
|
1053
|
+
* того, что удерживало остановку. `0` снимает ограничение.
|
|
1054
|
+
*/
|
|
1055
|
+
shutdownTimeout?: number | undefined;
|
|
1090
1056
|
/** Повторные попытки. `false` отключает их полностью. */
|
|
1091
1057
|
retry?: RetryOptions | false | undefined;
|
|
1092
1058
|
/** Ограничение нагрузки. `false` отключает очередь. */
|
|
@@ -1199,30 +1165,13 @@ interface OperationRequestOptions extends RawRequestOptions {
|
|
|
1199
1165
|
//#endregion
|
|
1200
1166
|
//#region src/core/version.d.ts
|
|
1201
1167
|
/** Версия библиотеки. Попадает в `User-Agent`. */
|
|
1202
|
-
declare const LIBRARY_VERSION = "0.
|
|
1168
|
+
declare const LIBRARY_VERSION = "0.6.0";
|
|
1203
1169
|
//#endregion
|
|
1204
1170
|
//#region src/core/config.d.ts
|
|
1205
1171
|
/** Базовый URL API итд.com. Домен записан в punycode: `итд.com`. */
|
|
1206
1172
|
declare const DEFAULT_BASE_URL = "https://xn--d1ah4a.com";
|
|
1207
|
-
/** Базовый URL страницы статуса. Домен записан в punycode: `статус.итд.com`. */
|
|
1208
|
-
declare const DEFAULT_STATUS_BASE_URL = "https://xn--80a7abcbg.xn--d1ah4a.com";
|
|
1209
1173
|
/** Имя встроенного сервиса статуса. */
|
|
1210
1174
|
declare const STATUS_SERVICE = "status";
|
|
1211
|
-
/** Сервисы, зарегистрированные у любого клиента. */
|
|
1212
|
-
declare const BUILT_IN_SERVICES: readonly ServiceDefinition[];
|
|
1213
|
-
/** Таймаут запроса по умолчанию — 30 секунд. */
|
|
1214
|
-
declare const DEFAULT_TIMEOUT = 30000;
|
|
1215
|
-
/**
|
|
1216
|
-
* `User-Agent` по умолчанию.
|
|
1217
|
-
*
|
|
1218
|
-
* Сайт стоит за DDoS-Guard, и запросы вовсе без `User-Agent` (так делает `fetch` в Node)
|
|
1219
|
-
* имеют шанс не пройти фильтр. Префикс `Mozilla/5.0` — дань традиции таких фильтров,
|
|
1220
|
-
* дальше идёт честное имя библиотеки: подделываться под браузер она не должна.
|
|
1221
|
-
*
|
|
1222
|
-
* В браузере заголовок не выставляется — `User-Agent` там запрещён к изменению, и среда
|
|
1223
|
-
* молча его игнорирует.
|
|
1224
|
-
*/
|
|
1225
|
-
declare const DEFAULT_USER_AGENT = "Mozilla/5.0 (compatible; itd-api/0.5.0; +https://github.com/KiowDev/itd-api)";
|
|
1226
1175
|
/**
|
|
1227
1176
|
* Срез конфигурации, нужный слою авторизации.
|
|
1228
1177
|
*
|
|
@@ -1242,18 +1191,6 @@ interface AuthConfig {
|
|
|
1242
1191
|
}
|
|
1243
1192
|
//#endregion
|
|
1244
1193
|
//#region src/core/cookies.d.ts
|
|
1245
|
-
/** Имя cookie-флага «есть refresh-сессия». Ставится сайтом итд.com рядом с refresh-токеном. */
|
|
1246
|
-
declare const AUTH_FLAG_COOKIE = "is_auth";
|
|
1247
|
-
/**
|
|
1248
|
-
* Имя cookie с refresh-токеном.
|
|
1249
|
-
*
|
|
1250
|
-
* `POST /api/v1/auth/refresh` читает токен **только отсюда** — тело запроса сервер игнорирует.
|
|
1251
|
-
* Cookie помечена `HttpOnly`, поэтому в браузере её не прочитать и не выставить; вне браузера
|
|
1252
|
-
* она проходит через jar, и туда же кладётся токен, переданный строкой.
|
|
1253
|
-
*/
|
|
1254
|
-
declare const REFRESH_COOKIE = "refresh_token";
|
|
1255
|
-
/** Путь, которым сервер ограничивает {@link REFRESH_COOKIE}. */
|
|
1256
|
-
declare const REFRESH_COOKIE_PATH = "/api/v1/auth";
|
|
1257
1194
|
/**
|
|
1258
1195
|
* Минимальное хранилище cookie для сред без своего.
|
|
1259
1196
|
*
|
|
@@ -1406,25 +1343,17 @@ type PipelineRequestInput = Omit<PipelineRequest, 'operationId'> & {
|
|
|
1406
1343
|
type RequestHandler = (request: PipelineRequest) => Promise<unknown>;
|
|
1407
1344
|
//#endregion
|
|
1408
1345
|
//#region src/core/auth.d.ts
|
|
1409
|
-
/** Пути эндпоинтов авторизации. */
|
|
1410
|
-
declare const AUTH_PATHS: {
|
|
1411
|
-
readonly signUp: "/api/v1/auth/sign-up";
|
|
1412
|
-
readonly signIn: "/api/v1/auth/sign-in";
|
|
1413
|
-
readonly verifyOtp: "/api/v1/auth/verify-otp";
|
|
1414
|
-
readonly resendOtp: "/api/v1/auth/resend-otp";
|
|
1415
|
-
readonly refresh: "/api/v1/auth/refresh";
|
|
1416
|
-
readonly logout: "/api/v1/auth/logout";
|
|
1417
|
-
readonly forgotPassword: "/api/v1/auth/forgot-password";
|
|
1418
|
-
readonly resetPassword: "/api/v1/auth/reset-password";
|
|
1419
|
-
readonly changePassword: "/api/v1/auth/change-password";
|
|
1420
|
-
readonly sessions: "/api/v1/auth/sessions";
|
|
1421
|
-
};
|
|
1422
1346
|
/**
|
|
1423
1347
|
* Публичный ключ Cloudflare Turnstile платформы итд.com.
|
|
1424
1348
|
*
|
|
1425
1349
|
* Нужен, чтобы отрисовать виджет капчи и получить токен для `signIn`, `signUp`
|
|
1426
1350
|
* и `forgotPassword`.
|
|
1427
1351
|
*
|
|
1352
|
+
* Ключ привязан к домену: на чужом origin Cloudflare отказывает виджету с кодом `110200`.
|
|
1353
|
+
* Поэтому отрисовать его может только код, выполняемый на самом итд.com. Остальным
|
|
1354
|
+
* подходит `@itd-api/turnstile`, готовый токен из другого источника или вовсе вход
|
|
1355
|
+
* без капчи — по сохранённой сессии либо по токенам, взятым в браузере.
|
|
1356
|
+
*
|
|
1428
1357
|
* @example
|
|
1429
1358
|
* ```ts
|
|
1430
1359
|
* turnstile.render('#captcha', {
|
|
@@ -1434,8 +1363,6 @@ declare const AUTH_PATHS: {
|
|
|
1434
1363
|
* ```
|
|
1435
1364
|
*/
|
|
1436
1365
|
declare const TURNSTILE_SITE_KEY = "0x4AAAAAACHhxczw6fJGwPBg";
|
|
1437
|
-
/** Заголовок с идентификатором устройства. Сервер связывает с ним запись в списке сессий. */
|
|
1438
|
-
declare const DEVICE_ID_HEADER = "X-Device-Id";
|
|
1439
1366
|
/** События слоя авторизации. */
|
|
1440
1367
|
interface AuthEvents {
|
|
1441
1368
|
/** Токен получен или обновлён. */
|
|
@@ -2006,21 +1933,22 @@ interface NotificationEvent {
|
|
|
2006
1933
|
* ```
|
|
2007
1934
|
*/
|
|
2008
1935
|
declare function normalizeNotification(input: unknown): Notification;
|
|
1936
|
+
//#endregion
|
|
1937
|
+
//#region src/realtime/transport.d.ts
|
|
1938
|
+
/** Запрос транспорта к конвейеру клиента. */
|
|
1939
|
+
interface RealtimeRequestInput {
|
|
1940
|
+
operationId: BuiltInOperationId;
|
|
1941
|
+
path: string;
|
|
1942
|
+
query?: QueryParams | undefined;
|
|
1943
|
+
signal: AbortSignal;
|
|
1944
|
+
}
|
|
2009
1945
|
/**
|
|
2010
|
-
*
|
|
2011
|
-
*
|
|
2012
|
-
* Кроме самого уведомления событие несёт служебные поля уровня конверта: актуальный
|
|
2013
|
-
* счётчик непрочитанных и признак звука.
|
|
2014
|
-
*/
|
|
2015
|
-
declare function readNotificationEvent(data: unknown): NotificationEvent;
|
|
2016
|
-
/**
|
|
2017
|
-
* Разбирает событие `unread_count` из потока.
|
|
1946
|
+
* Порт к конвейеру клиента: очередь, авторизация, повторы, плагины и хуки.
|
|
2018
1947
|
*
|
|
2019
|
-
*
|
|
1948
|
+
* Ответ приходит уже разобранным и без обёртки `{ data: … }`, а неудача — типизированной
|
|
1949
|
+
* ошибкой библиотеки.
|
|
2020
1950
|
*/
|
|
2021
|
-
|
|
2022
|
-
//#endregion
|
|
2023
|
-
//#region src/realtime/transport.d.ts
|
|
1951
|
+
type RealtimeRequest = (input: RealtimeRequestInput) => Promise<unknown>;
|
|
2024
1952
|
/** Событие, пришедшее по каналу реального времени. */
|
|
2025
1953
|
interface TransportEvent {
|
|
2026
1954
|
/** Имя события: `notification`, `unread_count` и другие. */
|
|
@@ -2036,6 +1964,12 @@ interface TransportContext {
|
|
|
2036
1964
|
authorize: boolean;
|
|
2037
1965
|
/** Реализация `fetch`. */
|
|
2038
1966
|
fetch: typeof fetch;
|
|
1967
|
+
/**
|
|
1968
|
+
* Выполнение обычных HTTP-запросов транспорта через конвейер клиента.
|
|
1969
|
+
*
|
|
1970
|
+
* Есть только у потока, созданного клиентом: конвейер принадлежит ему.
|
|
1971
|
+
*/
|
|
1972
|
+
request?: RealtimeRequest | undefined;
|
|
2039
1973
|
/**
|
|
2040
1974
|
* Общие заголовки клиента: `User-Agent`, `X-Device-Id`, заголовки конфигурации
|
|
2041
1975
|
* и cookie для указанного адреса.
|
|
@@ -2175,21 +2109,6 @@ type RealtimeSequentializer<C extends RealtimeContextBase = RealtimeContext> = (
|
|
|
2175
2109
|
declare function runRealtimeMiddleware<C extends RealtimeContextBase>(middleware: readonly RealtimeMiddleware<C>[], context: C, terminal: RealtimeNext): Promise<void>;
|
|
2176
2110
|
//#endregion
|
|
2177
2111
|
//#region src/realtime/reconnect.d.ts
|
|
2178
|
-
/**
|
|
2179
|
-
* Паузы перед попытками переподключения, мс.
|
|
2180
|
-
*
|
|
2181
|
-
* Значения совпадают с теми, что использует сайт итд.com, — поведение библиотеки
|
|
2182
|
-
* не отличается от привычного пользователю.
|
|
2183
|
-
*/
|
|
2184
|
-
declare const RECONNECT_BACKOFF: readonly number[];
|
|
2185
|
-
/** Доля случайного разброса паузы. */
|
|
2186
|
-
declare const RECONNECT_JITTER = 0.3;
|
|
2187
|
-
/**
|
|
2188
|
-
* Сколько раз пытаться переподключиться подряд.
|
|
2189
|
-
*
|
|
2190
|
-
* После исчерпания поток сообщает `giveup` и ждёт ручного `connect()`.
|
|
2191
|
-
*/
|
|
2192
|
-
declare const MAX_RECONNECT_ATTEMPTS = 15;
|
|
2193
2112
|
/** Настройки переподключения. */
|
|
2194
2113
|
interface ReconnectOptions {
|
|
2195
2114
|
/** Таблица пауз. Последнее значение действует для всех дальнейших попыток. */
|
|
@@ -2330,6 +2249,8 @@ interface RealtimeDeps {
|
|
|
2330
2249
|
/** Разрешено ли транспорту передавать токен этому сервису. */
|
|
2331
2250
|
authorize?: boolean | undefined;
|
|
2332
2251
|
fetch: typeof fetch;
|
|
2252
|
+
/** Конвейер клиента — см. {@link TransportContext.request}. */
|
|
2253
|
+
request?: RealtimeRequest | undefined;
|
|
2333
2254
|
clock?: ItdClock;
|
|
2334
2255
|
/** Общие заголовки клиента для адреса — см. {@link TransportContext.baseHeaders}. */
|
|
2335
2256
|
baseHeaders: (url: string) => Promise<Headers>;
|
|
@@ -3308,8 +3229,6 @@ interface UploadOptions {
|
|
|
3308
3229
|
/** Размер очереди библиотеки при потоковой передаче. */
|
|
3309
3230
|
streamBufferBytes?: number | undefined;
|
|
3310
3231
|
}
|
|
3311
|
-
/** Таймаут одной попытки загрузки файла — 5 минут. */
|
|
3312
|
-
declare const DEFAULT_UPLOAD_TIMEOUT = 300000;
|
|
3313
3232
|
/** Файлы и медиа. */
|
|
3314
3233
|
declare class FilesResource extends BaseResource {
|
|
3315
3234
|
#private;
|
|
@@ -4715,23 +4634,29 @@ declare class ItdClient {
|
|
|
4715
4634
|
* Освобождает ресурсы клиента: закрывает все потоки уведомлений, отправляет открытые
|
|
4716
4635
|
* накопители {@link telemetry}, затем останавливает очередь запросов.
|
|
4717
4636
|
*
|
|
4718
|
-
* Метод дожидается активных обработчиков
|
|
4719
|
-
* снова; ранее созданный поток можно запустить
|
|
4637
|
+
* Метод дожидается активных обработчиков потока, но не дольше `shutdownTimeout`. После
|
|
4638
|
+
* вызова клиентом можно пользоваться снова; ранее созданный поток можно запустить
|
|
4639
|
+
* повторным `connect()`.
|
|
4720
4640
|
*
|
|
4721
4641
|
* Общая очередь, полученная от {@link ItdAccounts}, не останавливается: её гасит сам
|
|
4722
4642
|
* контейнер, когда закрывает все аккаунты разом.
|
|
4723
4643
|
*
|
|
4724
4644
|
* Терминальное освобождение — это {@link dispose}.
|
|
4645
|
+
*
|
|
4646
|
+
* @throws {ItdStateError} если обработчики потока не завершились за отведённый срок
|
|
4725
4647
|
*/
|
|
4726
4648
|
close(): Promise<void>;
|
|
4727
4649
|
/**
|
|
4728
|
-
* Окончательно освобождает клиент: выполняет {@link close}
|
|
4650
|
+
* Окончательно освобождает клиент: выполняет {@link close}, отменяет незавершённые
|
|
4651
|
+
* запросы и отключает все плагины.
|
|
4729
4652
|
*
|
|
4730
4653
|
* Терминальное состояние устанавливается сразу при первом вызове. После этого новые
|
|
4731
4654
|
* запросы, подключение плагинов, регистрация сервисов и создание или повторный запуск
|
|
4732
4655
|
* realtime-потоков завершаются с {@link ItdStateError}. Повторные вызовы возвращают
|
|
4733
4656
|
* тот же результат очистки.
|
|
4734
4657
|
*
|
|
4658
|
+
* Ожидание обработчиков потока и операций плагинов ограничено `shutdownTimeout`.
|
|
4659
|
+
*
|
|
4735
4660
|
* @example
|
|
4736
4661
|
* ```ts
|
|
4737
4662
|
* await using itd = new ItdClient({ auth: token });
|
|
@@ -5468,17 +5393,6 @@ declare function statusDays(service: ServiceStatus): (StatusDay | null)[];
|
|
|
5468
5393
|
declare function formatNotificationText(notification: Notification): string;
|
|
5469
5394
|
//#endregion
|
|
5470
5395
|
//#region src/notifications/type-map.d.ts
|
|
5471
|
-
/**
|
|
5472
|
-
* Соответствие коротких имён типов уведомлений развёрнутым.
|
|
5473
|
-
*
|
|
5474
|
-
* Сервер — и в списке, и в потоке событий — присылает короткие имена: `like`, `comment`,
|
|
5475
|
-
* `reply`, `repost`, `comment_like`. Развёрнутые (`post_reaction`, `post_comment`)
|
|
5476
|
-
* встречаются в оформлении интерфейса, поэтому библиотека приводит типы к ним:
|
|
5477
|
-
* они однозначно называют и объект, и действие.
|
|
5478
|
-
*
|
|
5479
|
-
* Пришедшее значение всегда остаётся в поле `rawType`.
|
|
5480
|
-
*/
|
|
5481
|
-
declare const NOTIFICATION_TYPE_ALIASES: Readonly<Record<string, NotificationType>>;
|
|
5482
5396
|
/**
|
|
5483
5397
|
* Приводит имя типа к каноническому.
|
|
5484
5398
|
*
|
|
@@ -5609,45 +5523,7 @@ declare class RealtimeComposer<C extends RealtimeContextBase = RealtimeContext>
|
|
|
5609
5523
|
middleware(): RealtimeMiddleware<C>;
|
|
5610
5524
|
}
|
|
5611
5525
|
//#endregion
|
|
5612
|
-
//#region src/realtime/poll.d.ts
|
|
5613
|
-
/** Настройки опроса. */
|
|
5614
|
-
interface PollTransportOptions {
|
|
5615
|
-
/** Часы опроса. Обычно подменяются только в тестах. */
|
|
5616
|
-
clock?: ItdClock;
|
|
5617
|
-
/** Как часто опрашивать сервер, мс. По умолчанию 15 000. */
|
|
5618
|
-
interval?: number;
|
|
5619
|
-
/** Сколько уведомлений запрашивать за раз. По умолчанию 20. */
|
|
5620
|
-
limit?: number;
|
|
5621
|
-
}
|
|
5622
|
-
//#endregion
|
|
5623
|
-
//#region src/realtime/sse.d.ts
|
|
5624
|
-
/** Путь потока уведомлений. */
|
|
5625
|
-
declare const STREAM_PATH = "/api/notifications/stream";
|
|
5626
|
-
/** Настройки SSE-транспорта. */
|
|
5627
|
-
interface SseTransportOptions {
|
|
5628
|
-
/** Часы потока. Обычно подменяются только в тестах. */
|
|
5629
|
-
clock?: ItdClock;
|
|
5630
|
-
/**
|
|
5631
|
-
* Сколько миллисекунд ждать данных, прежде чем считать соединение мёртвым.
|
|
5632
|
-
*
|
|
5633
|
-
* Сервер не присылает keep-alive, а оборванное TCP-соединение может не закрыться
|
|
5634
|
-
* само — без этой проверки поток «тихо умирает» и новых уведомлений не приходит.
|
|
5635
|
-
* По умолчанию 90 000. `0` отключает проверку.
|
|
5636
|
-
*/
|
|
5637
|
-
idleTimeout?: number;
|
|
5638
|
-
/**
|
|
5639
|
-
* Сколько миллисекунд ждать ответа на запрос потока, прежде чем оборвать попытку.
|
|
5640
|
-
*
|
|
5641
|
-
* Проверка молчания ({@link idleTimeout}) начинается только после получения тела ответа.
|
|
5642
|
-
* Если `fetch` завис на установке соединения, без этого таймаута переподключение не
|
|
5643
|
-
* запустится до системного сетевого таймаута. По умолчанию 20 000. `0` отключает проверку.
|
|
5644
|
-
*/
|
|
5645
|
-
handshakeTimeout?: number;
|
|
5646
|
-
}
|
|
5647
|
-
//#endregion
|
|
5648
5526
|
//#region src/realtime/websocket.d.ts
|
|
5649
|
-
/** Стандартный путь WebSocket-подключения. */
|
|
5650
|
-
declare const WEBSOCKET_PATH = "/api/ws";
|
|
5651
5527
|
/** Дополнительные параметры конструктора, поддерживаемые Node-реализациями вроде `ws`. */
|
|
5652
5528
|
interface WebSocketImplementationOptions {
|
|
5653
5529
|
headers?: Record<string, string> | undefined;
|
|
@@ -5720,5 +5596,5 @@ interface RenderSpansOptions {
|
|
|
5720
5596
|
*/
|
|
5721
5597
|
declare function renderSpans(content: string, spans?: readonly Span[] | null | undefined, options?: RenderSpansOptions): string;
|
|
5722
5598
|
//#endregion
|
|
5723
|
-
export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES,
|
|
5599
|
+
export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES, AccessType, type AccountEvents, type Actor, type AddAccountOptions, type AllowedMimeType, type Announcement, type AnnouncementButton, type Attachment, AttachmentType, type AttemptContext, type AttemptExtensions, type AttemptInterceptor, type AttemptNext, type AudioMimeType, type AuthEvents, type AuthIdentity, type AuthInput, type AuthResource, type AuthState, type Author, type AutoSpansOptions, type BuilderInput, type BuiltInOperationId, type CaptchaCredentials, type ChangelogEntry, type Clan, type ClientHooks, type ClientPlugin, type Comment, type CommentBuilder, type CommentInput, type CommentReplyTo, CommentSort, type CommentsParams, type CommentsResource, type CreateCommentInput, type CreatePollInput, type CreatePostData, type CreatePostInput, type CreateReportInput, type Credentials, type CredentialsAuth, type CustomOperationId, DEFAULT_BASE_URL, type DwellEntry, type EnumerableKeyValueStore, type ErrorContextHook, type FeedParams, FeedTab, type FileContent, type FileContext, type FileInput, type FileStreamContent, type FileStreamOptions, FileTransferMode, type FilesResource, type FollowResult, type ForgotPasswordInput, type FromStreamOptions, type Hashtag, type HashtagPostsParams, type HashtagsResource, IMAGE_MIME_TYPES, type ImageMimeType, IncidentKind, type InteractionEntry, InteractionType, type IsoDate, ItdAbortError, ItdAccounts, type ItdAccountsOptions, ItdApiError, type ItdApiErrorInit, ItdApiErrorKind, ItdAuthError, type ItdBuilder, ItdClient, type ItdClientOptions, type ItdClock, ItdConfigError, ItdConflictError, ItdError, ItdErrorCode, ItdErrorKind, type ItdFieldErrors, ItdFileError, ItdFileErrorReason, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdPhoneVerificationError, ItdRateLimitError, ItdRealtime, ItdServerError, type ItdSession, ItdStateError, ItdTimeoutError, ItdValidationError, type KeyValueCodec, type KeyValueStore, type KeyValueStoreKeys, type KeyValueStoreResult, LIBRARY_VERSION, type LazyFile, type LikeResult, LikesVisibility, type Listener, type Logger, type Loose, type MarkupBuilder, type MarkupContent, type MarkupInput, type MarkupSpan, MemoryKeyValueStore, MemoryMultiTokenStorage, MemoryTokenStorage, type MultiTokenStorage, type MultiTokenStorageAdapterOptions, type MyProfile, type Notification, type NotificationEvent, type NotificationEventOfType, type NotificationListParams, type NotificationOfType, type NotificationSettings, NotificationType, type NotificationsResource, OPERATIONS, type OperationDefinition, type OperationExtensions, type OperationId, type OperationMethod, type OperationRequestOptions, type OperationTransformer, type Page, type PageState, PaginationMode, type PaginationOptions, Paginator, type PaginatorOptions, type ParseMarkupOptions, type PaymentMethod, type PhotoOpenInput, type Pin, type PinPostResult, type PinsResult, type PlatformClientVersion, type PlatformResource, type PlatformStatus, type PlatformVersions, type PluginApi, type PluginTeardown, type Poll, type PollBuilder, type PollInput, type PollOption, type Portal, type Post, type PostBuilder, type PostInput, type PostStats, type PostUpdateInput, type PostsResource, type PrivacySettings, type Profile, type PublicProfile, type QueryParams, type QueryValue, type RateLimitOptions, type RateLimitScope, type RawRequestOptions, RealtimeComposer, type RealtimeContext, type RealtimeContextBase, type RealtimeEngineEvents, type RealtimeErrorBoundary, type RealtimeErrorContext, type RealtimeEvents, type RealtimeFilter, type RealtimeHandler, type RealtimeMiddleware, type RealtimeMiddlewareGroup, type RealtimeMiddlewareLike, type RealtimeMiddlewareObj, type RealtimeNext, type RealtimeNotificationContext, type RealtimeNotificationFilter, type RealtimeNotificationSelector, type RealtimeNotificationUpdate, type RealtimeOptions, type RealtimePredicate, type RealtimeRequest, type RealtimeRequestInput, type RealtimeRouteSelector, type RealtimeRouteTable, RealtimeRouter, type RealtimeSequentializer, RealtimeStatus, type RealtimeTransport, RealtimeTransportKind, type RealtimeTypeGuard, type RealtimeUnknownUpdate, type RealtimeUnreadCountUpdate, type RealtimeUpdate, type RealtimeUpdateOfType, RealtimeUpdateOrigin, RealtimeUpdateType, type ReconnectOptions, type RecordKeyValueStoreSource, type RemoveAccountOptions, type RenderSpansOptions, type RepliesParams, type Report, type ReportBuilder, type ReportInput, ReportReason, ReportTargetType, type ReportsResource, type RequestContext, type RequestExtensions, type RequestOptions, type ResetPasswordInput, type ResponseContext, type RetryContext, type RetryDecisionContext, type RetryOptions, RetrySafety, RuntimeMode, STATUS_SERVICE, type SearchResource, type SearchResult, type ServiceDefinition, ServiceState, type ServiceStatus, type Session, type SignInResult, SignInStatus, type Span, SpanRenderFormat, SpanType, type StatusDay, type StatusIncidentLine, type StreamFile, type Subscription, type SubscriptionResource, type SubscriptionState, TURNSTILE_SITE_KEY, type TelemetryBatch, type TelemetryBatchOptions, type TelemetryClock, type TelemetryOptions, type TelemetryResource, type TextMarkup, type TokenStorage, type TokenStorageAdapterOptions, type TransportContext, type TransportEvent, UnauthorizedStreamError, type Unsubscribe, type UpdateNotificationSettingsInput, type UpdatePostInput, type UpdatePrivacyInput, type UpdateProfileInput, type UploadOptions, type UploadedFile, type UrlFile, type UrlFileOptions, type UserId, type UserListParams, type UserPostsParams, type UserRef, type UserSummary, type UsersResource, VIDEO_MIME_TYPES, type VerificationResource, type VerificationStatus, type VideoMimeType, type VideoProgressInput, ViewReason, ViewSource, type ViewTracker, type ViewTrackerInput, type ViewTrackerOptions, WallAccess, type WebSocketImplementationOptions, type WebSocketLike, type WebSocketOpenFailureClassifier, WebSocketTransport, type WebSocketTransportOptions, autoSpans, canonicalNotificationType, comment, createAccounts, createClient, createKeyValueStore, createMultiTokenStorage, createRecordKeyValueStore, createTokenStorage, formatNotificationText, fromStream, fromUrl, isBuilder, isBuiltInOperationId, isEnumerableKeyValueStore, isItdApiError, isItdAuthError, isItdConflictError, isItdError, isItdFileError, isItdForbiddenError, isItdNotFoundError, isItdPhoneVerificationError, isItdRateLimitError, isItdServerError, isItdStateError, isItdValidationError, isKnownNotificationType, isMyProfile, mapPage, markup, normalizeNotification, operationMethod, operationRetrySafety, parseHtml, parseMarkdown, poll, post, renderSpans, report, resolveNotificationUrl, runRealtimeMiddleware, scopedTokenStorage, statusDays, systemClock, toDate, utcStampToIso, withCodec, withNamespace };
|
|
5724
5600
|
//# sourceMappingURL=index.d.cts.map
|