itd-api 0.7.2 → 0.8.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 +12 -12
- package/dist/events/index.cjs +53 -0
- package/dist/events/index.d.cts +3 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/index.js +5 -0
- package/dist/index.cjs +215 -194
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -63
- package/dist/index.d.ts +66 -63
- package/dist/index.js +197 -179
- package/dist/index.js.map +1 -1
- package/dist/node/index.cjs +4 -4
- package/dist/node/index.d.cts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.js +4 -4
- package/dist/rest/index.cjs +20 -26
- package/dist/rest/index.cjs.map +1 -1
- package/dist/rest/index.d.cts +7 -7
- package/dist/rest/index.d.ts +7 -7
- package/dist/rest/index.js +14 -20
- package/dist/rest/index.js.map +1 -1
- package/dist/shared/{errors-DfU8M5eS.cjs → errors-BmP3TKoW.cjs} +3 -3
- package/dist/shared/{errors-DfU8M5eS.cjs.map → errors-BmP3TKoW.cjs.map} +1 -1
- package/dist/shared/{errors-Bhrd2fJd.js → errors-GI10kZxk.js} +3 -3
- package/dist/shared/{errors-Bhrd2fJd.js.map → errors-GI10kZxk.js.map} +1 -1
- package/dist/shared/events-Br2r7coi.d.cts +698 -0
- package/dist/shared/events-QyhQZrnC.d.ts +698 -0
- package/dist/shared/{websocket-BLR8eVJV.js → events-TfhKh26b.js} +770 -490
- package/dist/shared/events-TfhKh26b.js.map +1 -0
- package/dist/shared/{websocket-C_eI4H2o.cjs → events-iTteVsd_.cjs} +834 -518
- package/dist/shared/events-iTteVsd_.cjs.map +1 -0
- package/dist/shared/{multi-storage-CkvTUC5m.js → multi-storage-1AEZTczk.js} +4 -4
- package/dist/shared/{multi-storage-CkvTUC5m.js.map → multi-storage-1AEZTczk.js.map} +1 -1
- package/dist/shared/{multi-storage--yTEqiod.cjs → multi-storage-CCUgkqvI.cjs} +6 -6
- package/dist/shared/{multi-storage--yTEqiod.cjs.map → multi-storage-CCUgkqvI.cjs.map} +1 -1
- package/dist/shared/{options-DtATYdLr.js → options-BNP633A5.js} +8 -6
- package/dist/shared/options-BNP633A5.js.map +1 -0
- package/dist/shared/{options-Dg5N3r1V.cjs → options-BUfoHE9G.cjs} +8 -6
- package/dist/shared/options-BUfoHE9G.cjs.map +1 -0
- package/dist/shared/{cookies-DZwFq6kr.cjs → redact-DB9EMGJx.cjs} +301 -2
- package/dist/shared/redact-DB9EMGJx.cjs.map +1 -0
- package/dist/shared/{cookies-tX2sNwxb.js → redact-FNK29Fv-.js} +224 -3
- package/dist/shared/redact-FNK29Fv-.js.map +1 -0
- package/dist/shared/{render-DO0F5YSm.d.cts → render-BszcKF7S.d.cts} +430 -313
- package/dist/shared/{render-C6HRPs10.js → render-CiL1VS0b.js} +925 -582
- package/dist/shared/render-CiL1VS0b.js.map +1 -0
- package/dist/shared/{render-mcuELiYi.cjs → render-DNTESBSl.cjs} +967 -618
- package/dist/shared/render-DNTESBSl.cjs.map +1 -0
- package/dist/shared/{render-CgwKdOzu.d.ts → render-DVB7T8pm.d.ts} +430 -313
- package/dist/shared/{storage-BPJR_k4-.cjs → storage-BLmXmzKF.cjs} +2 -2
- package/dist/shared/{storage-BPJR_k4-.cjs.map → storage-BLmXmzKF.cjs.map} +1 -1
- package/dist/shared/{storage-D86edNCB.js → storage-CCxn0Kkv.js} +2 -2
- package/dist/shared/{storage-D86edNCB.js.map → storage-CCxn0Kkv.js.map} +1 -1
- package/dist/shared/{url-IU0xN9wX.js → url-B3ocFlHj.js} +434 -408
- package/dist/shared/url-B3ocFlHj.js.map +1 -0
- package/dist/shared/{url-DTfZ2toq.d.cts → url-Be9jlWRv.d.cts} +1228 -1188
- package/dist/shared/{url-DTfZ2toq.d.ts → url-Be9jlWRv.d.ts} +1228 -1188
- package/dist/shared/{url-BaMCQpYH.cjs → url-CFN1sT9S.cjs} +497 -465
- package/dist/shared/url-CFN1sT9S.cjs.map +1 -0
- package/dist/web/index.cjs +2 -2
- package/dist/web/index.js +2 -2
- package/package.json +16 -15
- package/dist/realtime/index.cjs +0 -165
- package/dist/realtime/index.cjs.map +0 -1
- package/dist/realtime/index.d.cts +0 -51
- package/dist/realtime/index.d.ts +0 -51
- package/dist/realtime/index.js +0 -120
- package/dist/realtime/index.js.map +0 -1
- package/dist/shared/auth-provider-CG8oCQ9F.cjs +0 -108
- package/dist/shared/auth-provider-CG8oCQ9F.cjs.map +0 -1
- package/dist/shared/auth-provider-mYqxsSVa.js +0 -91
- package/dist/shared/auth-provider-mYqxsSVa.js.map +0 -1
- package/dist/shared/cookies-DZwFq6kr.cjs.map +0 -1
- package/dist/shared/cookies-tX2sNwxb.js.map +0 -1
- package/dist/shared/options-Dg5N3r1V.cjs.map +0 -1
- package/dist/shared/options-DtATYdLr.js.map +0 -1
- package/dist/shared/render-C6HRPs10.js.map +0 -1
- package/dist/shared/render-mcuELiYi.cjs.map +0 -1
- package/dist/shared/url-BaMCQpYH.cjs.map +0 -1
- package/dist/shared/url-IU0xN9wX.js.map +0 -1
- package/dist/shared/websocket-BLR8eVJV.js.map +0 -1
- package/dist/shared/websocket-C_eI4H2o.cjs.map +0 -1
- package/dist/shared/websocket-DF7XIMiX.d.cts +0 -562
- package/dist/shared/websocket-DYKBr8HF.d.ts +0 -562
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as poll, $t as
|
|
3
|
-
import { _ as
|
|
4
|
-
import { A as NotificationOfType, B as RealtimeUpdateOfType, C as RealtimeMiddlewareObj, D as RealtimeTypeGuard, E as RealtimeSequentializer, F as RealtimeNotificationSelector, G as RealtimeTransport, H as RealtimeUpdateType, I as RealtimeNotificationUpdate, J as UnauthorizedStreamError, K as TransportContext, L as RealtimeUnknownUpdate, M as RealtimeContextBase, N as RealtimeNotificationContext, O as runRealtimeMiddleware, P as RealtimeNotificationFilter, R as RealtimeUnreadCountUpdate, S as RealtimeMiddleware, T as RealtimePredicate, U as RealtimeRequest, V as RealtimeUpdateOrigin, W as RealtimeRequestInput, _ as RealtimeOptions, a as WebSocketTransportOptions, b as ReconnectOptions, c as RealtimeErrorContext, d as RealtimeMiddlewareLike, f as RealtimeRouteTable, g as RealtimeEvents, h as ItdRealtime, i as WebSocketTransport, j as RealtimeContext, k as NotificationEventOfType, l as RealtimeFilter, m as RealtimeRouter, n as WebSocketLike, o as RealtimeComposer, p as RealtimeRouteSelector, q as TransportEvent, r as WebSocketOpenFailureClassifier, s as RealtimeErrorBoundary, t as WebSocketImplementationOptions, u as RealtimeMiddlewareGroup, v as RealtimeTransportKind, w as RealtimeNext, x as RealtimeHandler, y as RealtimeEngineEvents, z as RealtimeUpdate } from "./shared/websocket-DYKBr8HF.js";
|
|
1
|
+
import { $ as isItdValidationError, $t as RateLimitBucket, A as ItdFieldErrors, At as ResponseContext, B as ItdTimeoutError, Bt as ItdClock, C as ItdApiErrorInit, Ct as RateLimitBucketContext, D as ItdConflictError, Dt as RequestContext, E as ItdConfigError, Et as RawRequestOptions, F as ItdNotFoundError, Ft as QueryParams, G as isItdError, Gt as OPERATIONS, H as isItdApiError, Ht as BuiltInOperationId, I as ItdPhoneVerificationError, It as QueryValue, J as isItdNotFoundError, Jt as operationBucket, K as isItdFileError, Kt as OperationId, L as ItdRateLimitError, Lt as ServiceDefinition, M as ItdFileErrorReason, Mt as RetryDecisionContext, N as ItdForbiddenError, Nt as RetryOptions, O as ItdError, Ot as RequestExtensions, P as ItdNetworkError, Pt as RuntimeOptions, Q as isItdStateError, Qt as DEFAULT_RATE_LIMIT_BUCKET, R as ItdServerError, Rt as RateLimitPacing, S as ItdApiError, St as PaginationOptions, T as ItdAuthError, Tt as RateLimitOptions, U as isItdAuthError, Ut as CustomOperationId, V as ItdValidationError, Vt as systemClock, W as isItdConflictError, Wt as ItdOperationDefinition, X as isItdRateLimitError, Xt as operationRetrySafety, Y as isItdPhoneVerificationError, Yt as operationMethod, Z as isItdServerError, Zt as BUCKET_LIMITS, _ as Profile, _n as ServiceState, _t as RetrySafety, a as NotificationEvent, an as AttachmentType, b as UserSummary, bn as ViewSource, bt as Logger, c as NotificationSettings, cn as FeedTab, ct as Unsubscribe, d as Author, dn as ItdErrorCode, dt as LIBRARY_VERSION, en as IsoDate, et as ClientConnection, f as FollowResult, fn as LikesVisibility, ft as FeatureOperationId, g as PrivacySettings, gn as ReportTargetType, gt as OperationMethod, h as PinsResult, hn as ReportReason, ht as OperationMetadata, i as formatNotificationText, in as AccessType, j as ItdFileError, jt as RetryContext, k as ItdErrorKind, kt as RequestOptions, l as Actor, ln as IncidentKind, lt as DEFAULT_BASE_URL, m as Pin, mn as NotificationType, n as canonicalNotificationType, nn as UserId, nt as AuthProvider, o as normalizeNotification, on as CommentSort, ot as Emitter, p as MyProfile, pn as Loose, pt as OperationAnnotations, q as isItdForbiddenError, qt as isBuiltInOperationId, r as isKnownNotificationType, rn as UserRef, s as Notification, sn as EventChannelStatus, st as Listener, t as resolveNotificationUrl, tn as Span, tt as AuthIdentity, u as AuthState, un as InteractionType, ut as STATUS_SERVICE, v as PublicProfile, vn as SpanType, vt as ClientHooks, w as ItdApiErrorKind, wt as RateLimitBucketOverride, x as ItdAbortError, xn as WallAccess, xt as OperationRequestOptions, y as SubscriptionState, yn as ViewReason, yt as ErrorContextHook, z as ItdStateError, zt as RuntimeMode } from "./shared/url-Be9jlWRv.js";
|
|
2
|
+
import { $ as poll, $t as PaymentMethod, A as TelemetryResource, An as AttemptNext, At as CommentsResource, B as ReportInput, Bt as Post, C as DwellEntry, Cn as PreparedStreamSource, Ct as Report, D as TelemetryBatchOptions, Dn as AttemptContext, Dt as FilesResource, E as TelemetryBatch, En as HttpClient, Et as HashtagsResource, F as SubscriptionResource, Fn as PluginTeardown, Ft as Hashtag, G as UserPostsParams, Gt as BuilderInput, H as CommentsParams, Ht as CommentBuilder, I as SearchResource, It as LikeResult, J as PostInput, Jt as CreateCommentInput, K as CreatePostInput, Kt as ItdBuilder, L as SearchResult, Lt as PinPostResult, M as ViewTracker, Mn as OperationExtensions, Mt as Attachment, N as ViewTrackerInput, Nn as OperationTransformer, Nt as Comment, O as TelemetryClock, On as AttemptExtensions, Ot as UploadOptions, P as ViewTrackerOptions, Pn as PluginApi, Pt as CommentReplyTo, Q as PollInput, Qt as UpdatePostInput, R as ReportsResource, Rt as Poll, S as UsersResource, Sn as PreparedFileSource, St as Portal, T as PhotoOpenInput, Tn as ResolveFileOptions, Tt as HashtagPostsParams, U as FeedParams, Ut as CommentInput, V as report, Vt as PostStats, W as PostsResource, Wt as comment, X as post, Xt as CreatePostData, Y as PostUpdateInput, Yt as CreatePollInput, Z as PollBuilder, Zt as CreateReportInput, _ as fromUrl, _n as FeatureOperationDefinition, _t as StatusIncidentLine, a as isMyProfile, an as BaseResource, at as MarkupContent, b as UpdateProfileInput, bn as FileResolver, bt as ChangelogEntry, c as ALLOWED_MIME_TYPES, cn as PaginationMode, ct as TextMarkup, d as AudioMimeType, dn as mapPage, dt as PlatformClientVersion, en as Session, et as ParseMarkupOptions, f as IMAGE_MIME_TYPES, fn as RateLimitBucketState, ft as PlatformResource, g as fromStream, gn as FeatureInstallation, gt as StatusDay, h as VideoMimeType, hn as FeatureContext, ht as ServiceStatus, i as statusDays, in as UpdateNotificationSettingsInput, it as MarkupBuilder, j as VideoProgressInput, jn as ClientPlugin, jt as RepliesParams, k as TelemetryOptions, kn as AttemptInterceptor, kt as UploadedFile, l as AUDIO_MIME_TYPES, ln as Paginator, lt as autoSpans, m as VIDEO_MIME_TYPES, mn as FeatureBucketDefinition, mt as PlatformStatus, n as SpanRenderFormat, nn as NotificationListParams, nt as parseMarkdown, o as toDate, on as Page, ot as MarkupInput, p as ImageMimeType, pn as ClientFeature, pt as PlatformVersions, q as PostBuilder, qt as isBuilder, r as renderSpans, rn as NotificationsResource, rt as AutoSpansOptions, s as utcStampToIso, sn as PageState, st as MarkupSpan, t as RenderSpansOptions, tn as Subscription, tt as parseHtml, u as AllowedMimeType, un as PaginatorOptions, ut as markup, v as VerificationResource, vn as FeatureRequestOptions, vt as Announcement, w as InteractionEntry, wn as ResolveFileContext, wt as VerificationStatus, x as UserListParams, xn as PreparedBufferSource, xt as Clan, y as UpdatePrivacyInput, yn as ManagedClientResource, yt as AnnouncementButton, z as ReportBuilder, zt as PollOption } from "./shared/render-DVB7T8pm.js";
|
|
3
|
+
import { $ as EventTransport, A as ReconnectOptions, B as NotificationContext, C as EventChannelDeps, D as EventSession, E as EventEnqueueOptions, F as EventPredicate, G as NotificationEventsUpdate, H as NotificationEventFilter, I as EventSequentializer, J as NotificationUpdateOfType, K as NotificationOfType, L as EventTypeGuard, M as EventMiddleware, N as EventMiddlewareObject, O as EventSyncReason, P as EventNext, Q as UnreadCountUpdate, R as runEventMiddleware, S as EventChannel, T as EventChannelOptions, U as NotificationEventOfType, V as NotificationEventContext, W as NotificationEventSelector, X as NotificationUpdateType, Y as NotificationUpdateOrigin, Z as UnknownNotificationUpdate, _ as createNotificationEventsClient, a as WebSocketTransportOptions, b as NotificationEventsOptions, c as EventErrorContext, d as EventMiddlewareLike, et as EventTransportContext, f as EventRouteTable, g as NotificationEventsClientOptions, h as NotificationEventsClient, i as WebSocketTransport, j as EventHandler, l as EventFilter, m as EventRouter, n as WebSocketLike, nt as UnauthorizedStreamError, o as EventComposer, p as EventRouteSelector, q as NotificationUpdate, r as WebSocketOpenFailureClassifier, s as EventErrorBoundary, t as WebSocketImplementationOptions, tt as EventTransportFrame, u as EventMiddlewareGroup, v as NotificationEvents, w as EventChannelEvents, x as NotificationEventsTransport, y as NotificationEventsMap, z as EventContext } from "./shared/events-QyhQZrnC.js";
|
|
5
4
|
import { a as FileStreamOptions, c as LazyFile, d as UrlFileOptions, i as FileStreamContent, l as StreamFile, n as FileContext, o as FileTransferMode, r as FileInput, s as FromStreamOptions, t as FileContent, u as UrlFile } from "./shared/contracts-BoT7msmq.js";
|
|
5
|
+
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 "./shared/storage-C_eICCep.js";
|
|
6
6
|
import { a as scopedTokenStorage, i as createMultiTokenStorage, n as MultiTokenStorage, r as MultiTokenStorageAdapterOptions, t as MemoryMultiTokenStorage } from "./shared/multi-storage-DccjD7Ww.js";
|
|
7
7
|
//#region src/core/cookies.d.ts
|
|
8
8
|
/**
|
|
@@ -64,6 +64,13 @@ declare class CookieJar {
|
|
|
64
64
|
clear(): void;
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
|
+
//#region src/notifications-api.d.ts
|
|
68
|
+
/** Уведомления полного клиента: REST-методы и стабильный канал событий. */
|
|
69
|
+
interface NotificationsApi extends NotificationsResource {
|
|
70
|
+
/** Один канал событий уведомлений на всё время жизни клиента. */
|
|
71
|
+
readonly events: NotificationEvents;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
67
74
|
//#region src/session/options.d.ts
|
|
68
75
|
/**
|
|
69
76
|
* Вход по логину и паролю.
|
|
@@ -157,7 +164,29 @@ interface SessionOptions {
|
|
|
157
164
|
* });
|
|
158
165
|
* ```
|
|
159
166
|
*/
|
|
160
|
-
interface ItdClientOptions extends RuntimeOptions, SessionOptions {
|
|
167
|
+
interface ItdClientOptions extends RuntimeOptions, SessionOptions {
|
|
168
|
+
/** Неизменяемые настройки предметных каналов событий клиента. */
|
|
169
|
+
events?: {
|
|
170
|
+
/** Настройки канала уведомлений на всё время жизни клиента. */
|
|
171
|
+
notifications?: NotificationEventsOptions | undefined;
|
|
172
|
+
} | undefined;
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/operations/auth.d.ts
|
|
176
|
+
/** Чем закончился запрос входа. */
|
|
177
|
+
declare const SignInStatus: Readonly<{
|
|
178
|
+
readonly Authenticated: "authenticated";
|
|
179
|
+
readonly OtpRequired: "otp_required";
|
|
180
|
+
}>;
|
|
181
|
+
type SignInStatus = (typeof SignInStatus)[keyof typeof SignInStatus];
|
|
182
|
+
/** Результат входа: готовый токен либо продолжение через код подтверждения. */
|
|
183
|
+
type SignInResult = {
|
|
184
|
+
status: 'authenticated';
|
|
185
|
+
accessToken: string;
|
|
186
|
+
} | {
|
|
187
|
+
status: 'otp_required';
|
|
188
|
+
flowToken: string | undefined;
|
|
189
|
+
};
|
|
161
190
|
//#endregion
|
|
162
191
|
//#region src/session/auth.d.ts
|
|
163
192
|
/**
|
|
@@ -228,12 +257,12 @@ interface AuthManagerHooks {
|
|
|
228
257
|
*/
|
|
229
258
|
declare class AuthManager implements AuthProvider {
|
|
230
259
|
#private;
|
|
231
|
-
constructor(config: SessionConfig,
|
|
260
|
+
constructor(config: SessionConfig, http: HttpClient, jar: CookieJar, hooks?: AuthManagerHooks);
|
|
232
261
|
/** Подписка на события авторизации. */
|
|
233
262
|
get on(): Emitter<AuthEvents>['on'];
|
|
234
263
|
/** Подписка на одно срабатывание. */
|
|
235
264
|
get once(): Emitter<AuthEvents>['once'];
|
|
236
|
-
/** Снимает
|
|
265
|
+
/** Снимает служебные подписки при окончательном освобождении владельца. @internal */
|
|
237
266
|
dispose(): void;
|
|
238
267
|
/**
|
|
239
268
|
* Непрозрачная fallback-область авторизации.
|
|
@@ -362,25 +391,12 @@ interface ResetPasswordInput {
|
|
|
362
391
|
flowToken: string;
|
|
363
392
|
newPassword: string;
|
|
364
393
|
}
|
|
365
|
-
/** Чем закончился вход: сразу токеном или запросом кода подтверждения. */
|
|
366
|
-
declare const SignInStatus: Readonly<{
|
|
367
|
-
readonly Authenticated: "authenticated";
|
|
368
|
-
readonly OtpRequired: "otp_required";
|
|
369
|
-
}>;
|
|
370
|
-
type SignInStatus = (typeof SignInStatus)[keyof typeof SignInStatus];
|
|
371
394
|
/**
|
|
372
395
|
* Результат входа.
|
|
373
396
|
*
|
|
374
397
|
* Сервер может как сразу выдать токен, так и потребовать код подтверждения — размеченное
|
|
375
398
|
* объединение делает оба случая явными.
|
|
376
399
|
*/
|
|
377
|
-
type SignInResult = {
|
|
378
|
-
status: 'authenticated';
|
|
379
|
-
accessToken: string;
|
|
380
|
-
} | {
|
|
381
|
-
status: 'otp_required';
|
|
382
|
-
flowToken: string | undefined;
|
|
383
|
-
};
|
|
384
400
|
/**
|
|
385
401
|
* Авторизация, сессии и пароли.
|
|
386
402
|
*
|
|
@@ -586,7 +602,7 @@ declare class ItdClient {
|
|
|
586
602
|
/** Загрузка файлов и медиа. */
|
|
587
603
|
get files(): FilesResource;
|
|
588
604
|
/** Уведомления: список, счётчик, отметки о прочтении, настройки. */
|
|
589
|
-
get notifications():
|
|
605
|
+
get notifications(): NotificationsApi;
|
|
590
606
|
/** Хэштеги и посты по ним. */
|
|
591
607
|
get hashtags(): HashtagsResource;
|
|
592
608
|
/** Глобальный поиск по пользователям и хэштегам. */
|
|
@@ -633,29 +649,27 @@ declare class ItdClient {
|
|
|
633
649
|
*/
|
|
634
650
|
rateLimitState(): RateLimitBucketState[];
|
|
635
651
|
/**
|
|
636
|
-
* Устанавливает предметный модуль
|
|
652
|
+
* Устанавливает предметный модуль с общей сессией и обработкой запросов клиента.
|
|
637
653
|
*
|
|
638
|
-
* Сервисы, операции и бакеты
|
|
639
|
-
*
|
|
654
|
+
* Сервисы, операции и бакеты регистрируются до синхронного `setup()`. Возвращает
|
|
655
|
+
* типизированный API модуля.
|
|
640
656
|
*/
|
|
641
657
|
install<TApi>(feature: ClientFeature<TApi>): TApi;
|
|
642
658
|
/**
|
|
643
|
-
* Устанавливает
|
|
659
|
+
* Устанавливает модуль и добавляет его API в свойство клиента только для чтения.
|
|
644
660
|
*
|
|
645
661
|
* Возвращаемое пересечение сохраняет тип уже подключённых свойств, поэтому вызовы можно
|
|
646
|
-
* объединять в цепочку: `new ItdClient().withFeature('
|
|
662
|
+
* объединять в цепочку: `new ItdClient().withFeature('pixelBattle', pixelBattleFeature)`.
|
|
647
663
|
*/
|
|
648
664
|
withFeature<const K extends string, TApi>(key: K, feature: ClientFeature<TApi>): this & { readonly [P in K]: TApi; };
|
|
649
|
-
/** Имена установленных
|
|
665
|
+
/** Имена установленных модулей в порядке установки. */
|
|
650
666
|
featureNames(): string[];
|
|
651
|
-
/** Установлен ли
|
|
667
|
+
/** Установлен ли модуль с таким именем. */
|
|
652
668
|
hasFeature(name: string): boolean;
|
|
653
669
|
/**
|
|
654
670
|
* Подключает плагин.
|
|
655
671
|
*
|
|
656
|
-
* Плагин может
|
|
657
|
-
* транспортной попытки. Оба контракта охватывают все методы клиента. Подключать плагин
|
|
658
|
-
* можно в любой момент, но обычно это делают сразу после создания клиента.
|
|
672
|
+
* Плагин может регистрировать обёртки операций и перехватчики сетевых попыток.
|
|
659
673
|
*
|
|
660
674
|
* @throws {ItdConfigError} если плагин задан неверно или уже подключён
|
|
661
675
|
* @throws {ItdStateError} если клиент уже освобождён через {@link dispose}
|
|
@@ -733,44 +747,20 @@ declare class ItdClient {
|
|
|
733
747
|
* ```
|
|
734
748
|
*/
|
|
735
749
|
on<K extends keyof AuthEvents>(event: K, listener: Listener<AuthEvents[K]>): Unsubscribe;
|
|
736
|
-
/**
|
|
737
|
-
* Создаёт поток уведомлений в реальном времени.
|
|
738
|
-
*
|
|
739
|
-
* Каждый вызов даёт новый независимый поток; обычно он нужен один на приложение.
|
|
740
|
-
* Соединение поднимается методом `connect()` и держится само. Замена авторизации на токен
|
|
741
|
-
* другого пользователя завершает все потоки клиента; смена только сессии их не затрагивает.
|
|
742
|
-
*
|
|
743
|
-
* @example
|
|
744
|
-
* ```ts
|
|
745
|
-
* import { NotificationType } from 'itd-api';
|
|
746
|
-
*
|
|
747
|
-
* const stream = itd.realtime();
|
|
748
|
-
*
|
|
749
|
-
* stream.onNotification(NotificationType.PostComment, async ({ update }) => {
|
|
750
|
-
* await handleComment(update.data.notification);
|
|
751
|
-
* });
|
|
752
|
-
* stream.on('unreadCount', (count) => setBadge(count));
|
|
753
|
-
*
|
|
754
|
-
* await stream.connect();
|
|
755
|
-
* ```
|
|
756
|
-
*
|
|
757
|
-
* @throws {ItdStateError} если клиент уже освобождён через {@link dispose}
|
|
758
|
-
*/
|
|
759
|
-
realtime(options?: RealtimeOptions): ItdRealtime;
|
|
760
750
|
/**
|
|
761
751
|
* Освобождает ресурсы клиента: закрывает все потоки уведомлений, отправляет открытые
|
|
762
752
|
* накопители {@link telemetry}, затем останавливает очередь запросов.
|
|
763
753
|
*
|
|
764
|
-
* Метод дожидается активных обработчиков
|
|
765
|
-
*
|
|
766
|
-
* повторным `connect()`.
|
|
754
|
+
* Метод дожидается завершения активных обработчиков и освобождения ресурсов остановленных
|
|
755
|
+
* событийных соединений, но не дольше `shutdownTimeout`. После вызова клиентом можно
|
|
756
|
+
* пользоваться снова; ранее созданный поток можно запустить повторным `connect()`.
|
|
767
757
|
*
|
|
768
758
|
* Общая очередь, полученная от {@link ItdAccounts}, не останавливается: её гасит сам
|
|
769
759
|
* контейнер, когда закрывает все аккаунты разом.
|
|
770
760
|
*
|
|
771
761
|
* Терминальное освобождение — это {@link dispose}.
|
|
772
762
|
*
|
|
773
|
-
* @throws {ItdStateError} если
|
|
763
|
+
* @throws {ItdStateError} если остановка событийного соединения не завершилась за отведённый срок
|
|
774
764
|
*/
|
|
775
765
|
close(): Promise<void>;
|
|
776
766
|
/**
|
|
@@ -779,10 +769,11 @@ declare class ItdClient {
|
|
|
779
769
|
*
|
|
780
770
|
* Терминальное состояние устанавливается сразу при первом вызове. После этого новые
|
|
781
771
|
* запросы, подключение плагинов, регистрация сервисов и создание или повторный запуск
|
|
782
|
-
*
|
|
772
|
+
* событийных каналов завершаются с {@link ItdStateError}. Повторные вызовы возвращают
|
|
783
773
|
* тот же результат очистки.
|
|
784
774
|
*
|
|
785
|
-
* Ожидание
|
|
775
|
+
* Ожидание остановки событийных соединений и операций плагинов ограничено
|
|
776
|
+
* `shutdownTimeout`.
|
|
786
777
|
*
|
|
787
778
|
* @example
|
|
788
779
|
* ```ts
|
|
@@ -837,6 +828,16 @@ declare function createClient(options?: ItdClientOptions): ItdClient;
|
|
|
837
828
|
//#region src/accounts.d.ts
|
|
838
829
|
/** Как аккаунты делят между собой очередь запросов. */
|
|
839
830
|
type RateLimitScope = 'account' | 'shared';
|
|
831
|
+
/**
|
|
832
|
+
* Фабрика подключаемого модуля для клиентов {@link ItdAccounts}.
|
|
833
|
+
*
|
|
834
|
+
* `create()` вызывается отдельно для каждого аккаунта, поэтому описание модуля и его API
|
|
835
|
+
* между клиентами не разделяется. `key` публикует API как readonly-свойство клиента.
|
|
836
|
+
*/
|
|
837
|
+
interface AccountFeature<TApi = unknown> {
|
|
838
|
+
readonly key?: string | undefined;
|
|
839
|
+
create(): ClientFeature<TApi>;
|
|
840
|
+
}
|
|
840
841
|
/**
|
|
841
842
|
* Опции конструктора {@link ItdAccounts}.
|
|
842
843
|
*
|
|
@@ -852,6 +853,8 @@ interface ItdAccountsOptions extends Omit<ItdClientOptions, 'auth' | 'storage' |
|
|
|
852
853
|
storage?: MultiTokenStorage | undefined;
|
|
853
854
|
/** Плагины, подключаемые каждому аккаунту, в том числе добавленному позже. */
|
|
854
855
|
plugins?: readonly ClientPlugin[] | undefined;
|
|
856
|
+
/** Модули, создаваемые и устанавливаемые отдельно для каждого аккаунта. */
|
|
857
|
+
features?: readonly AccountFeature[] | undefined;
|
|
855
858
|
/**
|
|
856
859
|
* Как делить очередь запросов. По умолчанию `'shared'` — одна на всех.
|
|
857
860
|
*
|
|
@@ -953,7 +956,7 @@ declare class ItdAccounts {
|
|
|
953
956
|
/**
|
|
954
957
|
* Заводит аккаунт.
|
|
955
958
|
*
|
|
956
|
-
* Возвращается обычный `ItdClient` — со всеми ресурсами, плагинами и
|
|
959
|
+
* Возвращается обычный `ItdClient` — со всеми ресурсами, плагинами и каналом событий.
|
|
957
960
|
* Хранилище ему подставляется само: срез общего по имени аккаунта.
|
|
958
961
|
*
|
|
959
962
|
* Опция `auth` не обязательна: когда сессия этого аккаунта уже лежит в хранилище,
|
|
@@ -1084,5 +1087,5 @@ declare class ItdAccounts {
|
|
|
1084
1087
|
*/
|
|
1085
1088
|
declare function createAccounts(options?: ItdAccountsOptions): ItdAccounts;
|
|
1086
1089
|
//#endregion
|
|
1087
|
-
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, BUCKET_LIMITS, type BuilderInput, type BuiltInOperationId, type CaptchaCredentials, type ChangelogEntry, type Clan, type ClientFeature, 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, DEFAULT_RATE_LIMIT_BUCKET, type DwellEntry, type EnumerableKeyValueStore, type ErrorContextHook, type FeatureBucketDefinition, type FeatureContext, type FeatureInstallation, type FeatureOperationDefinition, type FeatureOperationId, type FeatureRequestOptions, 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,
|
|
1090
|
+
export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES, AccessType, type AccountEvents, type AccountFeature, 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 AuthProvider, type AuthResource, type AuthState, type Author, type AutoSpansOptions, BUCKET_LIMITS, type BuilderInput, type BuiltInOperationId, type CaptchaCredentials, type ChangelogEntry, type Clan, type ClientConnection, type ClientFeature, 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, DEFAULT_RATE_LIMIT_BUCKET, type DwellEntry, type EnumerableKeyValueStore, type ErrorContextHook, EventChannel, type EventChannelDeps, type EventChannelEvents, type EventChannelOptions, EventChannelStatus, EventComposer, type EventContext, type EventEnqueueOptions, type EventErrorBoundary, type EventErrorContext, type EventFilter, type EventHandler, type EventMiddleware, type EventMiddlewareGroup, type EventMiddlewareLike, type EventMiddlewareObject, type EventNext, type EventPredicate, type EventRouteSelector, type EventRouteTable, EventRouter, type EventSequentializer, type EventSession, type EventSyncReason, type EventTransport, type EventTransportContext, type EventTransportFrame, type EventTypeGuard, type FeatureBucketDefinition, type FeatureContext, type FeatureInstallation, type FeatureOperationDefinition, type FeatureOperationId, type FeatureRequestOptions, type FeedParams, FeedTab, type FileContent, type FileContext, type FileInput, type FileResolver, 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, 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 ManagedClientResource, type MarkupBuilder, type MarkupContent, type MarkupInput, type MarkupSpan, MemoryKeyValueStore, MemoryMultiTokenStorage, MemoryTokenStorage, type MultiTokenStorage, type MultiTokenStorageAdapterOptions, type MyProfile, type Notification, type NotificationContext, type NotificationEvent, type NotificationEventContext, type NotificationEventFilter, type NotificationEventOfType, type NotificationEventSelector, NotificationEvents, NotificationEventsClient, type NotificationEventsClientOptions, type NotificationEventsMap, type NotificationEventsOptions, NotificationEventsTransport, type NotificationEventsUpdate, type NotificationListParams, type NotificationOfType, type NotificationSettings, NotificationType, type NotificationUpdate, type NotificationUpdateOfType, NotificationUpdateOrigin, NotificationUpdateType, type NotificationsApi, type NotificationsResource, OPERATIONS, type OperationAnnotations, type ItdOperationDefinition as OperationDefinition, type OperationExtensions, type OperationId, type OperationMetadata, 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 PreparedBufferSource, type PreparedFileSource, type PreparedStreamSource, type PrivacySettings, type Profile, type PublicProfile, type QueryParams, type QueryValue, type RateLimitBucket, type RateLimitBucketContext, type RateLimitBucketOverride, type RateLimitBucketState, type RateLimitOptions, RateLimitPacing, type RateLimitScope, type RawRequestOptions, 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 ResolveFileContext, type ResolveFileOptions, type ResponseContext, type RetryContext, type RetryDecisionContext, type RetryOptions, RetrySafety, RuntimeMode, type RuntimeOptions, STATUS_SERVICE, type SearchResource, type SearchResult, type ServiceDefinition, ServiceState, type ServiceStatus, type Session, type SessionOptions, 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, UnauthorizedStreamError, type UnknownNotificationUpdate, type UnreadCountUpdate, 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, createNotificationEventsClient, 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, operationBucket, operationMethod, operationRetrySafety, parseHtml, parseMarkdown, poll, post, renderSpans, report, resolveNotificationUrl, runEventMiddleware, scopedTokenStorage, statusDays, systemClock, toDate, utcStampToIso, withCodec, withNamespace };
|
|
1088
1091
|
//# sourceMappingURL=index.d.ts.map
|