itd-api 0.12.1 → 0.13.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.
Files changed (90) hide show
  1. package/dist/events/index.cjs +4 -4
  2. package/dist/events/index.d.cts +7 -2
  3. package/dist/events/index.d.ts +7 -2
  4. package/dist/events/index.js +4 -4
  5. package/dist/index.cjs +672 -90
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +497 -46
  8. package/dist/index.d.ts +497 -46
  9. package/dist/index.js +664 -91
  10. package/dist/index.js.map +1 -1
  11. package/dist/node/index.cjs +6 -7
  12. package/dist/node/index.cjs.map +1 -1
  13. package/dist/node/index.d.cts +24 -7
  14. package/dist/node/index.d.ts +24 -7
  15. package/dist/node/index.js +6 -7
  16. package/dist/node/index.js.map +1 -1
  17. package/dist/rest/index.cjs +19 -7
  18. package/dist/rest/index.cjs.map +1 -1
  19. package/dist/rest/index.d.cts +28 -7
  20. package/dist/rest/index.d.ts +28 -7
  21. package/dist/rest/index.js +17 -8
  22. package/dist/rest/index.js.map +1 -1
  23. package/dist/shared/{contracts-BoT7msmq.d.ts → contracts-DEbkC0cB.d.cts} +1 -4
  24. package/dist/shared/{contracts-BoT7msmq.d.cts → contracts-pxnDIsQP.d.ts} +1 -4
  25. package/dist/shared/{events-FaXfdle0.d.cts → events-B6uqXOSs.d.cts} +42 -63
  26. package/dist/shared/{events-_iYo8EP5.js → events-C_MgYlXR.js} +30 -40
  27. package/dist/shared/events-C_MgYlXR.js.map +1 -0
  28. package/dist/shared/{events-BKyxZQNw.cjs → events-DV1i1t6J.cjs} +30 -40
  29. package/dist/shared/events-DV1i1t6J.cjs.map +1 -0
  30. package/dist/shared/{events-9215JDDd.d.ts → events-D_aMNrPd.d.ts} +2 -23
  31. package/dist/shared/{key-value-store-DYSPsqwq.cjs → key-value-store-6DHm_iNW.cjs} +3 -4
  32. package/dist/shared/{key-value-store-DYSPsqwq.cjs.map → key-value-store-6DHm_iNW.cjs.map} +1 -1
  33. package/dist/shared/{key-value-store-COZaNHZS.d.ts → key-value-store-BGoSgLze.d.cts} +1 -4
  34. package/dist/shared/{key-value-store-w1Dn5Pjb.js → key-value-store-PnZE_DFC.js} +3 -4
  35. package/dist/shared/{key-value-store-w1Dn5Pjb.js.map → key-value-store-PnZE_DFC.js.map} +1 -1
  36. package/dist/shared/{key-value-store-COZaNHZS.d.cts → key-value-store-WUQBeTAr.d.ts} +1 -4
  37. package/dist/shared/{multi-storage-DiBSx64p.js → multi-storage-DM0skcSO.js} +6 -7
  38. package/dist/shared/{multi-storage-DiBSx64p.js.map → multi-storage-DM0skcSO.js.map} +1 -1
  39. package/dist/shared/{multi-storage-LkljOSzA.d.ts → multi-storage-DQiERirK.d.ts} +3 -6
  40. package/dist/shared/{multi-storage-7Y3KCseI.cjs → multi-storage-DnonVBfO.cjs} +6 -7
  41. package/dist/shared/multi-storage-DnonVBfO.cjs.map +1 -0
  42. package/dist/shared/{multi-storage-BEL7tcKn.d.cts → multi-storage-OGWNMK3x.d.cts} +3 -6
  43. package/dist/shared/{options-D5ttspWk.cjs → options-SvAWOaqT.cjs} +8 -12
  44. package/dist/shared/{options-D5ttspWk.cjs.map → options-SvAWOaqT.cjs.map} +1 -1
  45. package/dist/shared/{options-DLlaETn_.js → options-bS27r_gR.js} +8 -12
  46. package/dist/shared/{options-DLlaETn_.js.map → options-bS27r_gR.js.map} +1 -1
  47. package/dist/shared/{redact-DSfdmeY7.js → redact-C4b2NzdB.js} +16 -16
  48. package/dist/shared/redact-C4b2NzdB.js.map +1 -0
  49. package/dist/shared/{redact-BbhtA9o-.cjs → redact-DDGkv8KF.cjs} +16 -16
  50. package/dist/shared/redact-DDGkv8KF.cjs.map +1 -0
  51. package/dist/shared/{render-BQvC5UxF.cjs → render-0-JJPOwb.cjs} +204 -109
  52. package/dist/shared/render-0-JJPOwb.cjs.map +1 -0
  53. package/dist/shared/{render-CFoF2WaH.js → render-CF49aBO8.js} +181 -110
  54. package/dist/shared/render-CF49aBO8.js.map +1 -0
  55. package/dist/shared/{render-X2JCo1JS.d.cts → render-CYVOc_IW.d.cts} +152 -251
  56. package/dist/shared/{render-BS09ygcy.d.ts → render-eOxYgdoA.d.ts} +152 -102
  57. package/dist/shared/{storage-86wiHeXD.js → storage-B6OkSi38.js} +4 -5
  58. package/dist/shared/{storage-86wiHeXD.js.map → storage-B6OkSi38.js.map} +1 -1
  59. package/dist/shared/{storage-CTRGT5wF.d.ts → storage-C_ZujAZt.d.ts} +2 -5
  60. package/dist/shared/{storage-CIjejZDt.cjs → storage-CezF2Mvz.cjs} +4 -5
  61. package/dist/shared/{storage-CIjejZDt.cjs.map → storage-CezF2Mvz.cjs.map} +1 -1
  62. package/dist/shared/{storage-BQrtKon9.d.cts → storage-FtS4NIC7.d.cts} +2 -5
  63. package/dist/shared/{url-CdT4lMxQ.js → url-CPKhcxf1.js} +250 -91
  64. package/dist/shared/url-CPKhcxf1.js.map +1 -0
  65. package/dist/shared/{url-_R0oJ7gE.d.ts → url-DCqxoxGX.d.cts} +1903 -1623
  66. package/dist/shared/{url-_R0oJ7gE.d.cts → url-DL5Mip4L.d.ts} +209 -78
  67. package/dist/shared/{url-ioIaywDi.cjs → url-DOfjru6L.cjs} +250 -91
  68. package/dist/shared/url-DOfjru6L.cjs.map +1 -0
  69. package/dist/shared/{validate-D7_kq3g5.js → validate-B5l_vLKD.js} +5 -7
  70. package/dist/shared/validate-B5l_vLKD.js.map +1 -0
  71. package/dist/shared/{validate-CFx2dISs.cjs → validate-CfxCK1BC.cjs} +5 -7
  72. package/dist/shared/validate-CfxCK1BC.cjs.map +1 -0
  73. package/dist/web/index.cjs +4 -5
  74. package/dist/web/index.cjs.map +1 -1
  75. package/dist/web/index.d.cts +22 -5
  76. package/dist/web/index.d.ts +22 -5
  77. package/dist/web/index.js +4 -5
  78. package/dist/web/index.js.map +1 -1
  79. package/package.json +6 -6
  80. package/dist/shared/events-BKyxZQNw.cjs.map +0 -1
  81. package/dist/shared/events-_iYo8EP5.js.map +0 -1
  82. package/dist/shared/multi-storage-7Y3KCseI.cjs.map +0 -1
  83. package/dist/shared/redact-BbhtA9o-.cjs.map +0 -1
  84. package/dist/shared/redact-DSfdmeY7.js.map +0 -1
  85. package/dist/shared/render-BQvC5UxF.cjs.map +0 -1
  86. package/dist/shared/render-CFoF2WaH.js.map +0 -1
  87. package/dist/shared/url-CdT4lMxQ.js.map +0 -1
  88. package/dist/shared/url-ioIaywDi.cjs.map +0 -1
  89. package/dist/shared/validate-CFx2dISs.cjs.map +0 -1
  90. package/dist/shared/validate-D7_kq3g5.js.map +0 -1
@@ -1,7 +1,26 @@
1
- import { $ as isItdNotFoundError, $t as isBuiltInOperationId, A as ItdConfigError, An as SpanType, At as RawRequestOptions, B as ItdPhoneVerificationError, Bt as QueryValue, C as UserSummary, Cn as Loose, Ct as ClientHooks, D as ItdApiErrorInit, Dn as ReportReason, Dt as RateLimitBucketContext, E as ItdApiError, Et as PaginationOptions, F as ItdFileError, Ft as RetryContext, G as ItdValidationError, Gt as Logger, H as ItdServerError, Ht as RateLimitPacing, I as ItdFileErrorReason, It as RetryDecisionContext, J as isItdAuthError, Jt as BuiltInOperationId, K as TimeoutBudget, Kt as ItdClock, L as ItdForbiddenError, Lt as RetryOptions, M as ItdError, Mn as ViewReason, Mt as RequestExtensions, N as ItdErrorKind, Nn as ViewSource, Nt as RequestOptions, O as ItdApiErrorKind, On as ReportTargetType, Ot as RateLimitBucketOverride, P as ItdFieldErrors, Pn as WallAccess, Pt as ResponseContext, Q as isItdForbiddenError, Qt as OperationId, R as ItdNetworkError, Rt as RuntimeOptions, S as UserBase, Sn as LikesVisibility, St as RetrySafety, T as ItdAbortError, Tn as NotificationType, Tt as OperationRequestOptions, U as ItdStateError, Ut as RuntimeMode, V as ItdRateLimitError, Vt as ServiceDefinition, W as ItdTimeoutError, Wt as LogLevel, X as isItdError, Xt as ItdOperationDefinition, Y as isItdConflictError, Yt as CustomOperationId, Z as isItdFileError, Zt as OPERATIONS, _ as PinsResult, _n as FeedTab, _t as FeatureOperationId, a as NotificationEvent, an as RateLimitBucket, b as PublicProfile, bn as ItdErrorCode, bt as OperationMetadata, c as NotificationSettings, cn as UserId, ct as ClientConnection, d as AuthUser, dn as AttachmentType, dt as anonymousAuth, en as operationBucket, et as isItdPhoneVerificationError, f as Author, ft as bearerToken, g as Pin, gt as LIBRARY_VERSION, h as MyProfile, hn as CommentSort, ht as STATUS_SERVICE, i as formatNotificationText, in as DEFAULT_RATE_LIMIT_BUCKET, it as isItdValidationError, j as ItdConflictError, jn as UsernameUnavailableReason, jt as RequestContext, k as ItdAuthError, kn as ServiceState, kt as RateLimitOptions, l as Actor, ln as UserRef, m as LastSeen, mt as DEFAULT_BASE_URL, n as canonicalNotificationType, nn as operationRetrySafety, nt as isItdServerError, o as normalizeNotification, on as IsoDate, ot as Listener, p as FollowResult, pt as tokenProvider, q as isItdApiError, qt as systemClock, r as isKnownNotificationType, rn as BUCKET_LIMITS, rt as isItdStateError, s as Notification, sn as Span, st as Unsubscribe, t as resolveNotificationUrl, tn as operationMethod, tt as isItdRateLimitError, u as AuthState, un as AccessType, ut as AuthProvider, v as PrivacySettings, vn as IncidentKind, vt as OperationAnnotations, w as UsernameAvailability, wn as MessageAccess, wt as ErrorContextHook, x as SubscriptionState, xn as LastSeenUnit, xt as OperationMethod, y as Profile, yn as InteractionType, z as ItdNotFoundError, zt as QueryParams } from "../shared/url-_R0oJ7gE.js";
2
- import { $ as ShopConsentContext, $n as NotificationListParams, $t as autoSpans, A as DwellEntry, An as Poll, Ar as PreparedStreamSource, At as ReportInput, B as ViewTrackerInput, Bn as comment, Bt as post, C as fromStream, Cn as Comment, Cr as FeatureInstallation, Ct as ShopRecipient, D as UpdateProfileInput, Dn as LikeResult, Dr as FileResolver, Dt as SearchResult, E as UpdatePrivacyInput, En as Hashtag, Er as ManagedClientResource, Et as SearchResource, F as TelemetryClock, Fn as PostStats, Ft as UserPostsParams, G as ShopConsentsResource, Gn as CreatePollInput, Gt as parseHtml, H as SubscriptionResource, Hn as ItdBuilder, Ht as PollInput, I as TelemetryOptions, In as PostUpdateResult, It as CreatePostInput, J as ShopOrdersResource, Jn as UpdatePostInput, Jt as MarkupBuilder, K as ShopDeliveryResource, Kn as CreatePostData, Kt as parseMarkdown, L as TelemetryResource, Ln as UpdateResultBase, Lt as PostBuilder, M as PhotoOpenInput, Mn as Post, Mr as ResolveFileOptions, Mt as CommentsParams, N as TelemetryBatch, Nn as PostBase, Nt as FeedParams, O as UserListParams, On as OriginalPost, Or as PreparedBufferSource, Ot as ReportsResource, P as TelemetryBatchOptions, Pn as PostCounters, Pt as PostsResource, Q as ShopConsent, Qn as Subscription, Qt as TextMarkup, R as VideoProgressInput, Rn as CommentBuilder, Rt as PostInput, S as VideoMimeType, Sn as Attachment, Sr as FeatureContext, St as ShopProductStatus, T as VerificationResource, Tn as CommentUpdateResult, Tr as FeatureRequestOptions, Tt as ShopSizeChartRow, U as CreateShopOrderOptions, Un as isBuilder, Ut as poll, V as ViewTrackerOptions, Vn as BuilderInput, Vt as PollBuilder, W as PayShopOrderOptions, Wn as CreateCommentInput, Wt as ParseMarkupOptions, X as ShopResource, Xt as MarkupInput, Y as ShopProductsResource, Yn as PaymentMethod, Yt as MarkupContent, Z as CreateShopOrderInput, Zn as Session, Zt as MarkupSpan, _ as AllowedMimeType, _n as FilesResource, _r as OperationTransformer, _t as ShopPayment, a as ShopFeatureOptions, an as ServiceStatus, ar as PaginationMode, at as ShopDeliveryDestination, b as ImageMimeType, bn as CommentsResource, br as ClientFeature, bt as ShopProductColor, c as ShopOrderAccessStorage, cn as Announcement, cr as mapPage, ct as ShopOrderAccessSession, d as statusDays, dn as Clan, dr as AttemptExtensions, dt as ShopOrderDelivery, en as markup, er as NotificationsResource, et as ShopConsentKind, f as isMyProfile, fn as Portal, fr as AttemptInterceptor, ft as ShopOrderItem, g as AUDIO_MIME_TYPES, gn as HashtagsResource, gr as OperationTransformContext, gt as ShopOrderSupport, h as ALLOWED_MIME_TYPES, hn as HashtagPostsParams, hr as OperationExtensions, ht as ShopOrderSummary, i as ShopFeatureApi, in as PlatformStatus, ir as PageState, it as ShopDeliveryCountry, j as InteractionEntry, jn as PollOption, jr as ResolveFileContext, jt as report, k as UsersResource, kn as PinPostResult, kr as PreparedFileSource, kt as ReportBuilder, l as ShopOrderAccessStorageAdapterOptions, ln as AnnouncementButton, lr as RateLimitBucketState, lt as ShopOrderAccessVerification, m as utcStampToIso, mn as VerificationStatus, mr as ClientPlugin, mt as ShopOrderStatus, n as SpanRenderFormat, nn as PlatformResource, nt as ShopDeliveryCalculation, o as createShopFeature, on as StatusDay, or as Paginator, ot as ShopDeliveryPoint, p as toDate, pn as Report, pr as AttemptNext, pt as ShopOrderItemInput, q as ShopOrderRequestOptions, qn as CreateReportInput, qt as AutoSpansOptions, r as renderSpans, rn as PlatformVersions, rr as Page, rt as ShopDeliveryCity, s as MemoryShopOrderAccessStorage, sn as StatusIncidentLine, sr as PaginatorOptions, st as ShopOrder, t as RenderSpansOptions, tn as PlatformClientVersion, tr as UpdateNotificationSettingsInput, tt as ShopCreatedOrder, u as createShopOrderAccessStorage, un as ChangelogEntry, ur as AttemptContext, ut as ShopOrderBase, v as AudioMimeType, vn as UploadOptions, vr as PluginApi, vt as ShopProduct, w as fromUrl, wn as CommentReplyTo, wr as FeatureOperationDefinition, wt as ShopSizeChart, x as VIDEO_MIME_TYPES, xn as RepliesParams, xr as FeatureBucketDefinition, xt as ShopProductSpec, y as IMAGE_MIME_TYPES, yn as UploadedFile, yr as PluginTeardown, yt as ShopProductCategory, z as ViewTracker, zn as CommentInput, zt as PostUpdateInput } from "../shared/render-BS09ygcy.js";
3
- 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";
4
- //#region src/rest/client.d.ts
1
+ /**
2
+ * `itd-api/rest` — минимальный клиент REST API итд.com.
3
+ *
4
+ * Тот же конвейер запросов, что и у полного `ItdClient`: повторы, очередь по серверным
5
+ * счётчикам частоты, плагины, типизированные ошибки. Без сессии, потока событий
6
+ * и контейнера аккаунтов — их сюда не затянуть даже случайно, границу сторожит
7
+ * `scripts/check-imports.mjs`.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { createRestClient } from 'itd-api/rest';
12
+ *
13
+ * const api = createRestClient({ auth: process.env.ITD_TOKEN });
14
+ * for await (const post of api.posts.iterate({ tab: 'popular' })) {
15
+ * console.log(post.content);
16
+ * }
17
+ * ```
18
+ *
19
+ * @packageDocumentation
20
+ */
21
+ import { $ as ShopConsentContext, $n as BuilderInput, $t as autoSpans, A as DwellEntry, An as BannerDrawingTool, Ar as OperationTransformer, At as ReportInput, B as ViewTrackerInput, Bn as OriginalPost, Br as FileResolver, Bt as post, C as fromStream, Cn as HashtagsResource, Cr as AttemptContext, Ct as ShopRecipient, D as UpdateProfileInput, Dn as BannerDrawing, Dr as ClientPlugin, Dt as SearchResult, E as UpdatePrivacyInput, En as UploadedFile, Er as AttemptNext, Et as SearchResource, F as TelemetryClock, Fn as Comment, Fr as FeatureContext, Ft as UserPostsParams, G as ShopConsentsResource, Gn as PostBase, Gr as ResolveFileOptions, Gt as parseHtml, H as SubscriptionResource, Hn as Poll, Hr as PreparedFileSource, Ht as PollInput, I as TelemetryOptions, In as CommentReplyTo, Ir as FeatureInstallation, It as CreatePostInput, J as ShopOrdersResource, Jn as PostUpdateResult, Jt as MarkupBuilder, K as ShopDeliveryResource, Kn as PostCounters, Kt as parseMarkdown, L as TelemetryResource, Ln as CommentUpdateResult, Lr as FeatureOperationDefinition, Lt as PostBuilder, M as PhotoOpenInput, Mn as CommentsResource, Mr as PluginTeardown, Mt as CommentsParams, N as TelemetryBatch, Nn as RepliesParams, Nr as ClientFeature, Nt as FeedParams, O as UserListParams, On as BannerDrawingOperation, Or as OperationExtensions, Ot as ReportsResource, P as TelemetryBatchOptions, Pn as Attachment, Pr as FeatureBucketDefinition, Pt as PostsResource, Q as ShopConsent, Qn as comment, Qt as TextMarkup, R as VideoProgressInput, Rn as Hashtag, Rr as FeatureRequestOptions, Rt as PostInput, S as VideoMimeType, Sn as HashtagPostsParams, Sr as RateLimitBucketState, St as ShopProductStatus, T as VerificationResource, Tn as UploadOptions, Tr as AttemptInterceptor, Tt as ShopSizeChartRow, U as CreateShopOrderOptions, Un as PollOption, Ur as PreparedStreamSource, Ut as poll, V as ViewTrackerOptions, Vn as PinPostResult, Vr as PreparedBufferSource, Vt as PollBuilder, W as PayShopOrderOptions, Wn as Post, Wr as ResolveFileContext, Wt as ParseMarkupOptions, X as ShopResource, Xn as CommentBuilder, Xt as MarkupInput, Y as ShopProductsResource, Yn as UpdateResultBase, Yt as MarkupContent, Z as CreateShopOrderInput, Zn as CommentInput, Zt as MarkupSpan, _ as AllowedMimeType, _n as LegalDocumentBlock, _r as PageState, _t as ShopPayment, a as ShopFeatureOptions, an as ServiceStatus, ar as CreateReportInput, at as ShopDeliveryDestination, b as ImageMimeType, bn as LegalDocumentSummary, br as PaginatorOptions, bt as ShopProductColor, c as ShopOrderAccessStorage, cn as Announcement, cr as PaymentMethod, ct as ShopOrderAccessSession, d as statusDays, dn as Clan, dr as Subscription, dt as ShopOrderDelivery, en as markup, er as ItdBuilder, et as ShopConsentKind, f as isMyProfile, fn as Portal, fr as NotificationListParams, ft as ShopOrderItem, g as AUDIO_MIME_TYPES, gn as LegalDocument, gr as Page, gt as ShopOrderSupport, h as ALLOWED_MIME_TYPES, hn as LegalResource, ht as ShopOrderSummary, i as ShopFeatureApi, in as PlatformStatus, ir as CreatePostData, it as ShopDeliveryCountry, j as InteractionEntry, jn as UploadedBannerDrawing, jr as PluginApi, jt as report, k as UsersResource, kn as BannerDrawingPoint, kr as OperationTransformContext, kt as ReportBuilder, l as ShopOrderAccessStorageAdapterOptions, ln as AnnouncementButton, lt as ShopOrderAccessVerification, m as utcStampToIso, mn as VerificationStatus, mr as UpdateNotificationSettingsInput, mt as ShopOrderStatus, n as SpanRenderFormat, nn as PlatformResource, nr as CreateCommentInput, nt as ShopDeliveryCalculation, o as createShopFeature, on as StatusDay, or as UpdatePostInput, ot as ShopDeliveryPoint, p as toDate, pn as Report, pr as NotificationsResource, pt as ShopOrderItemInput, q as ShopOrderRequestOptions, qn as PostStats, qt as AutoSpansOptions, r as renderSpans, rn as PlatformVersions, rr as CreatePollInput, rt as ShopDeliveryCity, s as MemoryShopOrderAccessStorage, sn as StatusIncidentLine, sr as AccountLifecycleResource, st as ShopOrder, t as RenderSpansOptions, tn as PlatformClientVersion, tr as isBuilder, tt as ShopCreatedOrder, u as createShopOrderAccessStorage, un as ChangelogEntry, ur as Session, ut as ShopOrderBase, v as AudioMimeType, vn as LegalDocumentBlockType, vr as PaginationMode, vt as ShopProduct, w as fromUrl, wn as FilesResource, wr as AttemptExtensions, wt as ShopSizeChart, x as VIDEO_MIME_TYPES, xn as LegalDocumentVersion, xr as mapPage, xt as ShopProductSpec, y as IMAGE_MIME_TYPES, yn as LegalDocumentScope, yr as Paginator, yt as ShopProductCategory, z as ViewTracker, zn as LikeResult, zr as ManagedClientResource, zt as PostUpdateInput } from "../shared/render-eOxYgdoA.js";
22
+ 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-pxnDIsQP.js";
23
+ import { $ as isItdNotFoundError, $t as isBuiltInOperationId, A as ItdConfigError, An as SpanType, At as RawRequestOptions, B as ItdPhoneVerificationError, Bt as QueryValue, C as UserSummary, Cn as Loose, Ct as ClientHooks, D as ItdApiErrorInit, Dn as ReportReason, Dt as RateLimitBucketContext, E as ItdApiError, Et as PaginationOptions, F as ItdFileError, Ft as RetryContext, G as ItdValidationError, Gt as Logger, H as ItdServerError, Ht as RateLimitPacing, I as ItdFileErrorReason, It as RetryDecisionContext, J as isItdAuthError, Jt as BuiltInOperationId, K as TimeoutBudget, Kt as ItdClock, L as ItdForbiddenError, Lt as RetryOptions, M as ItdError, Mn as ViewReason, Mt as RequestExtensions, N as ItdErrorKind, Nn as ViewSource, Nt as RequestOptions, O as ItdApiErrorKind, On as ReportTargetType, Ot as RateLimitBucketOverride, P as ItdFieldErrors, Pn as WallAccess, Pt as ResponseContext, Q as isItdForbiddenError, Qt as OperationId, R as ItdNetworkError, Rt as RuntimeOptions, S as UserBase, Sn as LikesVisibility, St as RetrySafety, T as ItdAbortError, Tn as NotificationType, Tt as OperationRequestOptions, U as ItdStateError, Ut as RuntimeMode, V as ItdRateLimitError, Vt as ServiceDefinition, W as ItdTimeoutError, Wt as LogLevel, X as isItdError, Xt as ItdOperationDefinition, Y as isItdConflictError, Yt as CustomOperationId, Z as isItdFileError, Zt as OPERATIONS, _ as PinsResult, _n as FeedTab, _t as FeatureOperationId, a as NotificationEvent, an as RateLimitBucket, b as PublicProfile, bn as ItdErrorCode, bt as OperationMetadata, c as NotificationSettings, cn as UserId, ct as ClientConnection, d as AuthUser, dn as AttachmentType, dt as anonymousAuth, en as operationBucket, et as isItdPhoneVerificationError, f as Author, ft as bearerToken, g as Pin, gt as LIBRARY_VERSION, h as MyProfile, hn as CommentSort, ht as STATUS_SERVICE, i as formatNotificationText, in as DEFAULT_RATE_LIMIT_BUCKET, it as isItdValidationError, j as ItdConflictError, jn as UsernameUnavailableReason, jt as RequestContext, k as ItdAuthError, kn as ServiceState, kt as RateLimitOptions, l as Actor, ln as UserRef, m as LastSeen, mt as DEFAULT_BASE_URL, n as canonicalNotificationType, nn as operationRetrySafety, nt as isItdServerError, o as normalizeNotification, on as IsoDate, ot as Listener, p as FollowResult, pt as tokenProvider, q as isItdApiError, qt as systemClock, r as isKnownNotificationType, rn as BUCKET_LIMITS, rt as isItdStateError, s as Notification, sn as Span, st as Unsubscribe, t as resolveNotificationUrl, tn as operationMethod, tt as isItdRateLimitError, u as AuthState, un as AccessType, ut as AuthProvider, v as PrivacySettings, vn as IncidentKind, vt as OperationAnnotations, w as UsernameAvailability, wn as MessageAccess, wt as ErrorContextHook, x as SubscriptionState, xn as LastSeenUnit, xt as OperationMethod, y as Profile, yn as InteractionType, z as ItdNotFoundError, zt as QueryParams } from "../shared/url-DL5Mip4L.js";
5
24
  /** Опции конструктора {@link ItdRestClient}. */
6
25
  interface RestClientOptions extends RuntimeOptions {
7
26
  /**
@@ -31,6 +50,8 @@ interface RestClientOptions extends RuntimeOptions {
31
50
  */
32
51
  export declare class ItdRestClient {
33
52
  #private;
53
+ /** Деактивация и восстановление текущего аккаунта. */
54
+ get account(): AccountLifecycleResource;
34
55
  /** Профили, подписки, блокировки, приватность. */
35
56
  get users(): UsersResource;
36
57
  /** Лента, публикация, реакции, репосты, комментарии к постам. */
@@ -53,6 +74,8 @@ export declare class ItdRestClient {
53
74
  get verification(): VerificationResource;
54
75
  /** Подписка и способы оплаты. */
55
76
  get subscription(): SubscriptionResource;
77
+ /** Публичные документы ИТД и история их редакций. */
78
+ get legal(): LegalResource;
56
79
  /** Сведения о платформе: версии приложений, изменения, анонсы, баннер события. */
57
80
  get platform(): PlatformResource;
58
81
  /** Телеметрия просмотров. */
@@ -143,6 +166,4 @@ export declare class ItdRestClient {
143
166
  * ```
144
167
  */
145
168
  export declare function createRestClient(options?: RestClientOptions): ItdRestClient;
146
- //#endregion
147
- export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES, AccessType, type Actor, type AllowedMimeType, type Announcement, type AnnouncementButton, type Attachment, AttachmentType, type AttemptContext, type AttemptExtensions, type AttemptInterceptor, type AttemptNext, type AudioMimeType, type AuthProvider, type AuthState, type AuthUser, type Author, type AutoSpansOptions, BUCKET_LIMITS, type BuilderInput, type BuiltInOperationId, type ChangelogEntry, type Clan, type ClientConnection, type ClientFeature, type ClientHooks, type ClientPlugin, type Comment, type CommentBuilder, type CommentInput, type CommentReplyTo, CommentSort, type CommentUpdateResult, type CommentsParams, type CommentsResource, type CreateCommentInput, type CreatePollInput, type CreatePostData, type CreatePostInput, type CreateReportInput, type CreateShopOrderInput, type CreateShopOrderOptions, type CustomOperationId, DEFAULT_BASE_URL, DEFAULT_RATE_LIMIT_BUCKET, type DwellEntry, type ErrorContextHook, 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 FromStreamOptions, type Hashtag, type HashtagPostsParams, type HashtagsResource, IMAGE_MIME_TYPES, type ImageMimeType, IncidentKind, type InteractionEntry, InteractionType, type IsoDate, ItdAbortError, ItdApiError, type ItdApiErrorInit, ItdApiErrorKind, ItdAuthError, type ItdBuilder, type ItdClock, ItdConfigError, ItdConflictError, ItdError, ItdErrorCode, ItdErrorKind, type ItdFieldErrors, ItdFileError, ItdFileErrorReason, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdPhoneVerificationError, ItdRateLimitError, ItdServerError, ItdStateError, ItdTimeoutError, ItdValidationError, LIBRARY_VERSION, type LastSeen, LastSeenUnit, type LazyFile, type LikeResult, LikesVisibility, type Listener, LogLevel, type Logger, type Loose, type ManagedClientResource, type MarkupBuilder, type MarkupContent, type MarkupInput, type MarkupSpan, MemoryShopOrderAccessStorage, MessageAccess, type MyProfile, type Notification, type NotificationEvent, type NotificationListParams, type NotificationSettings, NotificationType, type NotificationsResource, OPERATIONS, type OperationAnnotations, type ItdOperationDefinition as OperationDefinition, type OperationExtensions, type OperationId, type OperationMetadata, OperationMethod, type OperationRequestOptions, type OperationTransformContext, type OperationTransformer, type OriginalPost, type Page, type PageState, PaginationMode, type PaginationOptions, Paginator, type PaginatorOptions, type ParseMarkupOptions, type PayShopOrderOptions, 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 PostBase, type PostBuilder, type PostCounters, type PostInput, type PostStats, type PostUpdateInput, type PostUpdateResult, 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 RawRequestOptions, type RenderSpansOptions, type RepliesParams, type Report, type ReportBuilder, type ReportInput, ReportReason, ReportTargetType, type ReportsResource, type RequestContext, type RequestExtensions, type RequestOptions, type ResolveFileContext, type ResolveFileOptions, type ResponseContext, type RestClientOptions, type RetryContext, type RetryDecisionContext, type RetryOptions, RetrySafety, RuntimeMode, type RuntimeOptions, STATUS_SERVICE, type SearchResource, type SearchResult, type ServiceDefinition, ServiceState, type ServiceStatus, type Session, type ShopConsent, type ShopConsentContext, ShopConsentKind, type ShopConsentsResource, type ShopCreatedOrder, type ShopDeliveryCalculation, type ShopDeliveryCity, type ShopDeliveryCountry, type ShopDeliveryDestination, type ShopDeliveryPoint, type ShopDeliveryResource, type ShopFeatureApi, type ShopFeatureOptions, type ShopOrder, type ShopOrderAccessSession, type ShopOrderAccessStorage, type ShopOrderAccessStorageAdapterOptions, type ShopOrderAccessVerification, type ShopOrderBase, type ShopOrderDelivery, type ShopOrderItem, type ShopOrderItemInput, type ShopOrderRequestOptions, ShopOrderStatus, type ShopOrderSummary, type ShopOrderSupport, type ShopOrdersResource, type ShopPayment, type ShopProduct, ShopProductCategory, type ShopProductColor, type ShopProductSpec, ShopProductStatus, type ShopProductsResource, type ShopRecipient, type ShopResource, type ShopSizeChart, type ShopSizeChartRow, type Span, SpanRenderFormat, SpanType, type StatusDay, type StatusIncidentLine, type StreamFile, type Subscription, type SubscriptionResource, type SubscriptionState, type TelemetryBatch, type TelemetryBatchOptions, type TelemetryClock, type TelemetryOptions, type TelemetryResource, type TextMarkup, TimeoutBudget, type Unsubscribe, type UpdateNotificationSettingsInput, type UpdatePostInput, type UpdatePrivacyInput, type UpdateProfileInput, type UpdateResultBase, type UploadOptions, type UploadedFile, type UrlFile, type UrlFileOptions, type UserBase, type UserId, type UserListParams, type UserPostsParams, type UserRef, type UserSummary, type UsernameAvailability, UsernameUnavailableReason, type UsersResource, VIDEO_MIME_TYPES, type VerificationResource, type VerificationStatus, type VideoMimeType, type VideoProgressInput, ViewReason, ViewSource, type ViewTracker, type ViewTrackerInput, type ViewTrackerOptions, WallAccess, anonymousAuth, autoSpans, bearerToken, canonicalNotificationType, comment, createShopFeature, createShopOrderAccessStorage, formatNotificationText, fromStream, fromUrl, isBuilder, isBuiltInOperationId, 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, statusDays, systemClock, toDate, tokenProvider, utcStampToIso };
148
- //# sourceMappingURL=index.d.ts.map
169
+ export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES, AccessType, type AccountLifecycleResource, type Actor, type AllowedMimeType, type Announcement, type AnnouncementButton, type Attachment, AttachmentType, type AttemptContext, type AttemptExtensions, type AttemptInterceptor, type AttemptNext, type AudioMimeType, type AuthProvider, type AuthState, type AuthUser, type Author, type AutoSpansOptions, BUCKET_LIMITS, type BannerDrawing, type BannerDrawingOperation, type BannerDrawingPoint, BannerDrawingTool, type BuilderInput, type BuiltInOperationId, type ChangelogEntry, type Clan, type ClientConnection, type ClientFeature, type ClientHooks, type ClientPlugin, type Comment, type CommentBuilder, type CommentInput, type CommentReplyTo, CommentSort, type CommentUpdateResult, type CommentsParams, type CommentsResource, type CreateCommentInput, type CreatePollInput, type CreatePostData, type CreatePostInput, type CreateReportInput, type CreateShopOrderInput, type CreateShopOrderOptions, type CustomOperationId, DEFAULT_BASE_URL, DEFAULT_RATE_LIMIT_BUCKET, type DwellEntry, type ErrorContextHook, 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 FromStreamOptions, type Hashtag, type HashtagPostsParams, type HashtagsResource, IMAGE_MIME_TYPES, type ImageMimeType, IncidentKind, type InteractionEntry, InteractionType, type IsoDate, ItdAbortError, ItdApiError, type ItdApiErrorInit, ItdApiErrorKind, ItdAuthError, type ItdBuilder, type ItdClock, ItdConfigError, ItdConflictError, ItdError, ItdErrorCode, ItdErrorKind, type ItdFieldErrors, ItdFileError, ItdFileErrorReason, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdPhoneVerificationError, ItdRateLimitError, ItdServerError, ItdStateError, ItdTimeoutError, ItdValidationError, LIBRARY_VERSION, type LastSeen, LastSeenUnit, type LazyFile, type LegalDocument, type LegalDocumentBlock, LegalDocumentBlockType, LegalDocumentScope, type LegalDocumentSummary, type LegalDocumentVersion, type LegalResource, type LikeResult, LikesVisibility, type Listener, LogLevel, type Logger, type Loose, type ManagedClientResource, type MarkupBuilder, type MarkupContent, type MarkupInput, type MarkupSpan, MemoryShopOrderAccessStorage, MessageAccess, type MyProfile, type Notification, type NotificationEvent, type NotificationListParams, type NotificationSettings, NotificationType, type NotificationsResource, OPERATIONS, type OperationAnnotations, type ItdOperationDefinition as OperationDefinition, type OperationExtensions, type OperationId, type OperationMetadata, OperationMethod, type OperationRequestOptions, type OperationTransformContext, type OperationTransformer, type OriginalPost, type Page, type PageState, PaginationMode, type PaginationOptions, Paginator, type PaginatorOptions, type ParseMarkupOptions, type PayShopOrderOptions, 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 PostBase, type PostBuilder, type PostCounters, type PostInput, type PostStats, type PostUpdateInput, type PostUpdateResult, 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 RawRequestOptions, type RenderSpansOptions, type RepliesParams, type Report, type ReportBuilder, type ReportInput, ReportReason, ReportTargetType, type ReportsResource, type RequestContext, type RequestExtensions, type RequestOptions, type ResolveFileContext, type ResolveFileOptions, type ResponseContext, type RestClientOptions, type RetryContext, type RetryDecisionContext, type RetryOptions, RetrySafety, RuntimeMode, type RuntimeOptions, STATUS_SERVICE, type SearchResource, type SearchResult, type ServiceDefinition, ServiceState, type ServiceStatus, type Session, type ShopConsent, type ShopConsentContext, ShopConsentKind, type ShopConsentsResource, type ShopCreatedOrder, type ShopDeliveryCalculation, type ShopDeliveryCity, type ShopDeliveryCountry, type ShopDeliveryDestination, type ShopDeliveryPoint, type ShopDeliveryResource, type ShopFeatureApi, type ShopFeatureOptions, type ShopOrder, type ShopOrderAccessSession, type ShopOrderAccessStorage, type ShopOrderAccessStorageAdapterOptions, type ShopOrderAccessVerification, type ShopOrderBase, type ShopOrderDelivery, type ShopOrderItem, type ShopOrderItemInput, type ShopOrderRequestOptions, ShopOrderStatus, type ShopOrderSummary, type ShopOrderSupport, type ShopOrdersResource, type ShopPayment, type ShopProduct, ShopProductCategory, type ShopProductColor, type ShopProductSpec, ShopProductStatus, type ShopProductsResource, type ShopRecipient, type ShopResource, type ShopSizeChart, type ShopSizeChartRow, type Span, SpanRenderFormat, SpanType, type StatusDay, type StatusIncidentLine, type StreamFile, type Subscription, type SubscriptionResource, type SubscriptionState, type TelemetryBatch, type TelemetryBatchOptions, type TelemetryClock, type TelemetryOptions, type TelemetryResource, type TextMarkup, TimeoutBudget, type Unsubscribe, type UpdateNotificationSettingsInput, type UpdatePostInput, type UpdatePrivacyInput, type UpdateProfileInput, type UpdateResultBase, type UploadOptions, type UploadedBannerDrawing, type UploadedFile, type UrlFile, type UrlFileOptions, type UserBase, type UserId, type UserListParams, type UserPostsParams, type UserRef, type UserSummary, type UsernameAvailability, UsernameUnavailableReason, type UsersResource, VIDEO_MIME_TYPES, type VerificationResource, type VerificationStatus, type VideoMimeType, type VideoProgressInput, ViewReason, ViewSource, type ViewTracker, type ViewTrackerInput, type ViewTrackerOptions, WallAccess, anonymousAuth, autoSpans, bearerToken, canonicalNotificationType, comment, createShopFeature, createShopOrderAccessStorage, formatNotificationText, fromStream, fromUrl, isBuilder, isBuiltInOperationId, 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, statusDays, systemClock, toDate, tokenProvider, utcStampToIso };
@@ -1,9 +1,9 @@
1
- import { $ as OperationMethod, A as ReportTargetType, B as isBuiltInOperationId, C as ItdErrorCode, D as NotificationType, E as MessageAccess, F as ViewSource, G as DEFAULT_RATE_LIMIT_BUCKET, H as operationMethod, I as WallAccess, K as createClientRuntime, L as ITD_CATALOG, M as SpanType, N as UsernameUnavailableReason, P as ViewReason, R as OPERATIONS, S as InteractionType, T as LikesVisibility, U as operationRetrySafety, V as operationBucket, W as BUCKET_LIMITS, _t as systemClock, a as tokenProvider, b as FeedTab, c as normalizeNotification, d as canonicalNotificationType, et as RetrySafety, f as isKnownNotificationType, ft as STATUS_SERVICE, ht as RateLimitPacing, i as bearerToken, j as ServiceState, k as ReportReason, m as AttachmentType, mt as LIBRARY_VERSION, n as formatNotificationText, p as AccessType, r as anonymousAuth, t as resolveNotificationUrl, ut as DEFAULT_BASE_URL, v as CommentSort, vt as installAsyncDisposeFallback, w as LastSeenUnit, x as IncidentKind } from "../shared/url-CdT4lMxQ.js";
2
- import { A as isItdForbiddenError, C as ItdValidationError, D as isItdConflictError, E as isItdAuthError, F as isItdStateError, I as isItdValidationError, M as isItdPhoneVerificationError, N as isItdRateLimitError, O as isItdError, P as isItdServerError, S as ItdTimeoutError, T as isItdApiError, _ as ItdNotFoundError, a as ItdAbortError, b as ItdServerError, c as ItdAuthError, d as ItdError, f as ItdErrorKind, g as ItdNetworkError, h as ItdForbiddenError, j as isItdNotFoundError, k as isItdFileError, l as ItdConfigError, m as ItdFileErrorReason, o as ItdApiError, p as ItdFileError, s as ItdApiErrorKind, u as ItdConflictError, v as ItdPhoneVerificationError, w as TimeoutBudget, x as ItdStateError, y as ItdRateLimitError } from "../shared/validate-D7_kq3g5.js";
3
- import { E as LogLevel, v as RuntimeMode } from "../shared/redact-DSfdmeY7.js";
4
- import { A as utcStampToIso, C as AUDIO_MIME_TYPES, D as isBuilder, E as comment, F as mapPage, I as createFeatureHost, L as ExtensibleOperationCatalog, N as PaginationMode, O as createStatusFeature, P as Paginator, S as ALLOWED_MIME_TYPES, T as VIDEO_MIME_TYPES, _ as poll, a as createShopOrderAccessStorage, b as parseHtml, c as ShopOrderStatus, d as isMyProfile, f as fromStream, g as post, h as report, i as MemoryShopOrderAccessStorage, j as NotificationsResource, k as toDate, l as ShopProductCategory, m as createResources, n as renderSpans, o as statusDays, p as fromUrl, r as createShopFeature, s as ShopConsentKind, t as SpanRenderFormat, u as ShopProductStatus, v as autoSpans, w as IMAGE_MIME_TYPES, x as parseMarkdown, y as markup } from "../shared/render-CFoF2WaH.js";
5
- import { c as FileTransferMode } from "../shared/options-DLlaETn_.js";
6
- //#region src/rest/client.ts
1
+ import { A as isBuilder, B as createFeatureHost, C as LegalDocumentBlockType, D as IMAGE_MIME_TYPES, E as AUDIO_MIME_TYPES, F as NotificationsResource, L as PaginationMode, M as toDate, N as utcStampToIso, O as VIDEO_MIME_TYPES, P as AccountLifecycleResource, R as Paginator, S as parseMarkdown, T as ALLOWED_MIME_TYPES, V as ExtensibleOperationCatalog, _ as post, a as createShopOrderAccessStorage, b as markup, c as ShopOrderStatus, d as isMyProfile, f as BannerDrawingTool, g as report, h as createResources, i as MemoryShopOrderAccessStorage, j as createStatusFeature, k as comment, l as ShopProductCategory, m as fromUrl, n as renderSpans, o as statusDays, p as fromStream, r as createShopFeature, s as ShopConsentKind, t as SpanRenderFormat, u as ShopProductStatus, v as poll, w as LegalDocumentScope, x as parseHtml, y as autoSpans, z as mapPage } from "../shared/render-CF49aBO8.js";
2
+ import { c as FileTransferMode } from "../shared/options-bS27r_gR.js";
3
+ import { $ as OperationMethod, A as ReportTargetType, B as isBuiltInOperationId, C as ItdErrorCode, D as NotificationType, E as MessageAccess, F as ViewSource, G as DEFAULT_RATE_LIMIT_BUCKET, H as operationMethod, I as WallAccess, K as createClientRuntime, L as ITD_CATALOG, M as SpanType, N as UsernameUnavailableReason, P as ViewReason, R as OPERATIONS, S as InteractionType, T as LikesVisibility, U as operationRetrySafety, V as operationBucket, W as BUCKET_LIMITS, _t as systemClock, a as tokenProvider, b as FeedTab, c as normalizeNotification, d as canonicalNotificationType, et as RetrySafety, f as isKnownNotificationType, ft as STATUS_SERVICE, ht as RateLimitPacing, i as bearerToken, j as ServiceState, k as ReportReason, m as AttachmentType, mt as LIBRARY_VERSION, n as formatNotificationText, p as AccessType, r as anonymousAuth, t as resolveNotificationUrl, ut as DEFAULT_BASE_URL, v as CommentSort, vt as installAsyncDisposeFallback, w as LastSeenUnit, x as IncidentKind } from "../shared/url-CPKhcxf1.js";
4
+ import { A as isItdForbiddenError, C as ItdValidationError, D as isItdConflictError, E as isItdAuthError, F as isItdStateError, I as isItdValidationError, M as isItdPhoneVerificationError, N as isItdRateLimitError, O as isItdError, P as isItdServerError, S as ItdTimeoutError, T as isItdApiError, _ as ItdNotFoundError, a as ItdAbortError, b as ItdServerError, c as ItdAuthError, d as ItdError, f as ItdErrorKind, g as ItdNetworkError, h as ItdForbiddenError, j as isItdNotFoundError, k as isItdFileError, l as ItdConfigError, m as ItdFileErrorReason, o as ItdApiError, p as ItdFileError, s as ItdApiErrorKind, u as ItdConflictError, v as ItdPhoneVerificationError, w as TimeoutBudget, x as ItdStateError, y as ItdRateLimitError } from "../shared/validate-B5l_vLKD.js";
5
+ import { E as LogLevel, v as RuntimeMode } from "../shared/redact-C4b2NzdB.js";
6
+ // src/rest/client.ts
7
7
  /**
8
8
  * Минимальный клиент REST API итд.com.
9
9
  *
@@ -27,6 +27,12 @@ var ItdRestClient = class ItdRestClient {
27
27
  /** Общий результат терминальной очистки для идемпотентных повторных вызовов. */
28
28
  #disposePromise;
29
29
  #disposed = false;
30
+ #account;
31
+ /** Деактивация и восстановление текущего аккаунта. */
32
+ get account() {
33
+ this.#account ??= new AccountLifecycleResource(this.#runtime.http);
34
+ return this.#account;
35
+ }
30
36
  /** Профили, подписки, блокировки, приватность. */
31
37
  get users() {
32
38
  return this.#resources.users;
@@ -71,6 +77,10 @@ var ItdRestClient = class ItdRestClient {
71
77
  get subscription() {
72
78
  return this.#resources.subscription;
73
79
  }
80
+ /** Публичные документы ИТД и история их редакций. */
81
+ get legal() {
82
+ return this.#resources.legal;
83
+ }
74
84
  /** Сведения о платформе: версии приложений, изменения, анонсы, баннер события. */
75
85
  get platform() {
76
86
  return this.#resources.platform;
@@ -294,7 +304,6 @@ function resolveAuthProvider(auth) {
294
304
  function createRestClient(options = {}) {
295
305
  return new ItdRestClient(options);
296
306
  }
297
- //#endregion
298
- export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES, AccessType, AttachmentType, BUCKET_LIMITS, CommentSort, DEFAULT_BASE_URL, DEFAULT_RATE_LIMIT_BUCKET, FeedTab, FileTransferMode, IMAGE_MIME_TYPES, IncidentKind, InteractionType, ItdAbortError, ItdApiError, ItdApiErrorKind, ItdAuthError, ItdConfigError, ItdConflictError, ItdError, ItdErrorCode, ItdErrorKind, ItdFileError, ItdFileErrorReason, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdPhoneVerificationError, ItdRateLimitError, ItdRestClient, ItdServerError, ItdStateError, ItdTimeoutError, ItdValidationError, LIBRARY_VERSION, LastSeenUnit, LikesVisibility, LogLevel, MemoryShopOrderAccessStorage, MessageAccess, NotificationType, OPERATIONS, OperationMethod, PaginationMode, Paginator, RateLimitPacing, ReportReason, ReportTargetType, RetrySafety, RuntimeMode, STATUS_SERVICE, ServiceState, ShopConsentKind, ShopOrderStatus, ShopProductCategory, ShopProductStatus, SpanRenderFormat, SpanType, TimeoutBudget, UsernameUnavailableReason, VIDEO_MIME_TYPES, ViewReason, ViewSource, WallAccess, anonymousAuth, autoSpans, bearerToken, canonicalNotificationType, comment, createRestClient, createShopFeature, createShopOrderAccessStorage, formatNotificationText, fromStream, fromUrl, isBuilder, isBuiltInOperationId, 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, statusDays, systemClock, toDate, tokenProvider, utcStampToIso };
307
+ export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES, AccessType, AttachmentType, BUCKET_LIMITS, BannerDrawingTool, CommentSort, DEFAULT_BASE_URL, DEFAULT_RATE_LIMIT_BUCKET, FeedTab, FileTransferMode, IMAGE_MIME_TYPES, IncidentKind, InteractionType, ItdAbortError, ItdApiError, ItdApiErrorKind, ItdAuthError, ItdConfigError, ItdConflictError, ItdError, ItdErrorCode, ItdErrorKind, ItdFileError, ItdFileErrorReason, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdPhoneVerificationError, ItdRateLimitError, ItdRestClient, ItdServerError, ItdStateError, ItdTimeoutError, ItdValidationError, LIBRARY_VERSION, LastSeenUnit, LegalDocumentBlockType, LegalDocumentScope, LikesVisibility, LogLevel, MemoryShopOrderAccessStorage, MessageAccess, NotificationType, OPERATIONS, OperationMethod, PaginationMode, Paginator, RateLimitPacing, ReportReason, ReportTargetType, RetrySafety, RuntimeMode, STATUS_SERVICE, ServiceState, ShopConsentKind, ShopOrderStatus, ShopProductCategory, ShopProductStatus, SpanRenderFormat, SpanType, TimeoutBudget, UsernameUnavailableReason, VIDEO_MIME_TYPES, ViewReason, ViewSource, WallAccess, anonymousAuth, autoSpans, bearerToken, canonicalNotificationType, comment, createRestClient, createShopFeature, createShopOrderAccessStorage, formatNotificationText, fromStream, fromUrl, isBuilder, isBuiltInOperationId, 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, statusDays, systemClock, toDate, tokenProvider, utcStampToIso };
299
308
 
300
309
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/rest/client.ts"],"sourcesContent":["import { installAsyncDisposeFallback } from '../core/async-dispose.js';\nimport { type AuthProvider, anonymousAuth, bearerToken } from '../core/auth-provider.js';\nimport { ItdConfigError, ItdStateError } from '../core/errors.js';\nimport { type ClientRuntime, createClientRuntime } from '../core/execution/client-runtime.js';\nimport { ExtensibleOperationCatalog } from '../core/feature-catalog.js';\nimport { type ClientFeatureHost, createFeatureHost } from '../core/feature-host.js';\nimport type { ClientFeature } from '../core/features.js';\nimport type { RawRequestOptions, RuntimeOptions } from '../core/options.js';\nimport type { ClientPlugin } from '../core/plugins/contracts.js';\nimport type { RateLimitBucketState } from '../core/scheduling/rate-limit.js';\nimport type { ServiceDefinition } from '../core/services.js';\nimport { ITD_CATALOG } from '../domain/catalog.js';\nimport type { CommentsResource } from '../resources/comments.js';\nimport type { FilesResource } from '../resources/files.js';\nimport type { HashtagsResource } from '../resources/hashtags.js';\nimport { NotificationsResource } from '../resources/notifications.js';\nimport type { PlatformResource } from '../resources/platform.js';\nimport type { PostsResource } from '../resources/posts.js';\nimport type { ReportsResource } from '../resources/reports.js';\nimport type { SearchResource } from '../resources/search.js';\nimport type { ShopResource } from '../resources/shop.js';\nimport { createStatusFeature } from '../resources/status.js';\nimport type { SubscriptionResource } from '../resources/subscription.js';\nimport type { TelemetryResource } from '../resources/telemetry.js';\nimport type { UsersResource } from '../resources/users.js';\nimport type { VerificationResource } from '../resources/verification.js';\nimport { createResources, type RestResources } from './resources.js';\n\n/** Опции конструктора {@link ItdRestClient}. */\nexport interface RestClientOptions extends RuntimeOptions {\n /**\n * Авторизация. Строка — сокращение для {@link bearerToken}.\n *\n * Без неё доступны только публичные эндпоинты. Токен здесь считается готовым: продлевать\n * его клиент не умеет и на `401` отвечает ошибкой. Сессия, которая входит по паролю\n * и продлевает себя сама, живёт в полном `ItdClient`.\n */\n auth?: string | AuthProvider | undefined;\n}\n\n/**\n * Минимальный клиент REST API итд.com.\n *\n * Тот же конвейер запросов, что и у полного клиента, — с повторами, очередью, плагинами\n * и типизированными ошибками, — но без сессии, потока событий и нескольких аккаунтов.\n * Нужен там, где токен уже есть, а размер поставки важен: серверные интеграции, воркеры,\n * браузерные приложения.\n *\n * @example\n * ```ts\n * import { createRestClient } from 'itd-api/rest';\n *\n * const api = createRestClient({ auth: process.env.ITD_TOKEN });\n * const feed = await api.posts.list({ tab: 'popular' });\n * ```\n */\nexport class ItdRestClient {\n readonly #runtime: ClientRuntime;\n readonly #features: ClientFeatureHost;\n readonly #resources: RestResources;\n /** Общий результат терминальной очистки для идемпотентных повторных вызовов. */\n #disposePromise: Promise<void> | undefined;\n #disposed = false;\n\n /** Профили, подписки, блокировки, приватность. */\n get users(): UsersResource {\n return this.#resources.users;\n }\n\n /** Лента, публикация, реакции, репосты, комментарии к постам. */\n get posts(): PostsResource {\n return this.#resources.posts;\n }\n\n /** Ответы на комментарии и действия над ними. */\n get comments(): CommentsResource {\n return this.#resources.comments;\n }\n\n /** Загрузка файлов и медиа. */\n get files(): FilesResource {\n return this.#resources.files;\n }\n\n /** Уведомления: список, счётчик, отметки о прочтении, настройки. */\n get notifications(): NotificationsResource {\n return this.#resources.notifications;\n }\n\n /** Хэштеги и посты по ним. */\n get hashtags(): HashtagsResource {\n return this.#resources.hashtags;\n }\n\n /** Глобальный поиск по пользователям и хэштегам. */\n get search(): SearchResource {\n return this.#resources.search;\n }\n\n /** Каталог, доставка и заказы магазина ИТД. */\n get shop(): ShopResource {\n return this.#resources.shop;\n }\n\n /** Жалобы на контент и пользователей. */\n get reports(): ReportsResource {\n return this.#resources.reports;\n }\n\n /** Верификация профиля. */\n get verification(): VerificationResource {\n return this.#resources.verification;\n }\n\n /** Подписка и способы оплаты. */\n get subscription(): SubscriptionResource {\n return this.#resources.subscription;\n }\n\n /** Сведения о платформе: версии приложений, изменения, анонсы, баннер события. */\n get platform(): PlatformResource {\n return this.#resources.platform;\n }\n\n /** Телеметрия просмотров. */\n get telemetry(): TelemetryResource {\n return this.#resources.telemetry;\n }\n\n constructor(options: RestClientOptions = {}) {\n const { auth, ...runtimeOptions } = options;\n const catalog = new ExtensibleOperationCatalog(ITD_CATALOG);\n\n this.#runtime = createClientRuntime(runtimeOptions, {\n catalog,\n assertActive: (action) => this.#assertActive(action),\n auth: () => resolveAuthProvider(auth),\n });\n this.#features = createFeatureHost(this.#runtime, {\n catalog,\n assertActive: (action) => this.#assertActive(action),\n });\n const status = this.#features.install(createStatusFeature());\n this.#resources = createResources({\n http: this.#runtime.http,\n files: this.#features.files,\n status,\n createNotifications: (http) => new NotificationsResource(http),\n });\n }\n\n #assertActive(action: string): void {\n if (!this.#disposed) return;\n throw new ItdStateError(\n `Клиент уже окончательно освобождён через dispose(); нельзя ${action}. Создайте новый клиент`,\n );\n }\n\n /** Базовый URL, к которому обращается клиент. */\n get baseUrl(): string {\n return this.#runtime.config.baseUrl;\n }\n\n /**\n * Выполняет произвольный запрос к API.\n *\n * Запасной путь для случаев, когда нужного метода ещё нет или ответ сервера разошёлся\n * с документацией. Проходит через ту же авторизацию, очередь и обработку ошибок.\n *\n * @throws {ItdStateError} если клиент уже освобождён через {@link dispose}\n */\n request<T = unknown>(options: RawRequestOptions): Promise<T> {\n return this.#runtime.http.request<T>({\n ...options,\n operationId: options.operationId ?? 'raw',\n });\n }\n\n /**\n * Остаток серверных лимитов по бакетам, через которые уже проходили запросы.\n *\n * Пустой массив при `rateLimit: false`.\n */\n rateLimitState(): RateLimitBucketState[] {\n return this.#runtime.rateLimitState();\n }\n\n /** Устанавливает REST-модуль с общей обработкой запросов клиента. */\n install<TApi>(feature: ClientFeature<TApi>): TApi {\n return this.#features.install(feature);\n }\n\n /** Устанавливает REST-модуль и добавляет его API в свойство только для чтения. */\n withFeature<const K extends string, TApi>(\n key: K,\n feature: ClientFeature<TApi>,\n ): this & { readonly [P in K]: TApi } {\n this.#assertActive('установить feature');\n if (typeof key !== 'string' || key.trim() === '' || key !== key.trim()) {\n throw new ItdConfigError('Свойство feature должно иметь непустое имя без краевых пробелов');\n }\n if (key === 'then' || key in this) {\n throw new ItdConfigError(`Свойство клиента «${key}» уже занято или зарезервировано`);\n }\n if (!Object.isExtensible(this)) {\n throw new ItdConfigError('Нельзя опубликовать feature на нерасширяемом клиенте');\n }\n\n const api = this.install(feature);\n Object.defineProperty(this, key, {\n value: api,\n enumerable: true,\n configurable: false,\n writable: false,\n });\n return this as this & { readonly [P in K]: TApi };\n }\n\n /** Имена установленных модулей в порядке установки. */\n featureNames(): string[] {\n return this.#features.names();\n }\n\n /** Установлен ли модуль с таким именем. */\n hasFeature(name: string): boolean {\n return this.#features.has(name);\n }\n\n /**\n * Подключает плагин.\n *\n * Сессионная идентичность плагину не передаётся: у клиента с готовым токеном её нет.\n * Плагинам, которые изолируют состояние по аккаунту, нужен полный `ItdClient`.\n *\n * @throws {ItdConfigError} если плагин задан неверно или уже подключён\n * @throws {ItdStateError} если клиент уже освобождён через {@link dispose}\n */\n use(plugin: ClientPlugin): this {\n this.#assertActive('подключить плагин');\n this.#runtime.plugins.add(plugin, {\n baseUrl: this.#runtime.config.baseUrl,\n logger: this.#runtime.config.logger,\n });\n return this;\n }\n\n /**\n * Отключает плагин и освобождает заведённые им ресурсы.\n *\n * @returns `false`, если такого плагина не было\n * @throws {ItdConfigError} если от плагина зависит другой подключённый плагин\n */\n unuse(name: string): Promise<boolean> {\n return this.#runtime.plugins.remove(name);\n }\n\n /** Имена подключённых плагинов в фактическом порядке выполнения обёрток. */\n pluginNames(): string[] {\n return this.#runtime.plugins.names();\n }\n\n /** Подключён ли плагин с таким именем. */\n hasPlugin(name: string): boolean {\n return this.#runtime.plugins.has(name);\n }\n\n /**\n * Регистрирует сервис платформы — домен, отличный от основного.\n *\n * @throws {ItdConfigError} если определение неверно или имя уже занято\n * @throws {ItdStateError} если клиент уже освобождён через {@link dispose}\n */\n defineService(definition: ServiceDefinition): this {\n this.#assertActive('зарегистрировать сервис');\n this.#runtime.services.define(definition);\n return this;\n }\n\n /**\n * Отправляет открытые накопители {@link telemetry} и останавливает очередь запросов.\n *\n * После вызова клиентом можно пользоваться снова. Терминальное освобождение —\n * это {@link dispose}.\n */\n async close(): Promise<void> {\n const errors: unknown[] = [];\n try {\n try {\n await this.#features.close();\n } catch (error) {\n errors.push(error);\n }\n try {\n await this.#resources.closeTelemetry(false);\n } catch (error) {\n errors.push(error);\n }\n } finally {\n this.#runtime.close();\n }\n if (errors.length === 1) throw errors[0];\n if (errors.length > 1) throw new AggregateError(errors, 'Не удалось закрыть клиент');\n }\n\n /**\n * Окончательно освобождает клиент: выполняет {@link close}, отменяет незавершённые\n * запросы и отключает все плагины.\n *\n * Терминальное состояние устанавливается сразу при первом вызове; повторные вызовы\n * возвращают тот же результат очистки.\n *\n * @example\n * ```ts\n * await using api = createRestClient({ auth: token });\n * ```\n */\n dispose(): Promise<void> {\n if (this.#disposePromise) return this.#disposePromise;\n this.#disposed = true;\n this.#disposePromise = this.#dispose();\n return this.#disposePromise;\n }\n\n async #dispose(): Promise<void> {\n const errors: unknown[] = [];\n // Телеметрия уходит через ещё установленные плагины и мимо проверки состояния.\n this.#resources.prepareTelemetryClose();\n try {\n await this.#features.close();\n } catch (error) {\n errors.push(error);\n }\n try {\n await this.#resources.closeTelemetry(true);\n } catch (error) {\n errors.push(error);\n }\n try {\n await this.#features.dispose();\n } catch (error) {\n errors.push(error);\n }\n try {\n this.#runtime.close();\n await this.#runtime.dispose();\n } catch (error) {\n errors.push(error);\n }\n if (errors.length > 0) throw new AggregateError(errors, 'Не удалось освободить клиент');\n }\n\n /** Позволяет использовать клиент с `await using`. */\n [Symbol.asyncDispose](): Promise<void> {\n return this.dispose();\n }\n\n static {\n installAsyncDisposeFallback(ItdRestClient);\n }\n}\n\n/** Приводит опцию `auth` к провайдеру конвейера. */\nfunction resolveAuthProvider(auth: RestClientOptions['auth']): AuthProvider {\n if (auth === undefined) return anonymousAuth();\n return typeof auth === 'string' ? bearerToken(auth) : auth;\n}\n\n/**\n * Создаёт минимальный клиент REST API. Равнозначно конструктору {@link ItdRestClient}.\n *\n * @example\n * ```ts\n * const api = createRestClient({ auth: token, rateLimit: { concurrency: 4 } });\n * ```\n */\nexport function createRestClient(options: RestClientOptions = {}): ItdRestClient {\n return new ItdRestClient(options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwDA,IAAa,gBAAb,MAAa,cAAc;CACzB;CACA;CACA;;CAEA;CACA,YAAY;;CAGZ,IAAI,QAAuB;EACzB,OAAO,KAAK,WAAW;CACzB;;CAGA,IAAI,QAAuB;EACzB,OAAO,KAAK,WAAW;CACzB;;CAGA,IAAI,WAA6B;EAC/B,OAAO,KAAK,WAAW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AAA,GAAW,OAAO,cAAc;CAC7C,OAAO,OAAO,SAAS,WAAW,YAAY,IAAI,IAAI;AACxD;;;;;;;;;AAUA,SAAgB,iBAAiB,UAA6B,CAAC,GAAkB;CAC/E,OAAO,IAAI,cAAc,OAAO;AAClC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/rest/client.ts"],"sourcesContent":["import { installAsyncDisposeFallback } from '../core/async-dispose.js';\nimport { type AuthProvider, anonymousAuth, bearerToken } from '../core/auth-provider.js';\nimport { ItdConfigError, ItdStateError } from '../core/errors.js';\nimport { type ClientRuntime, createClientRuntime } from '../core/execution/client-runtime.js';\nimport { ExtensibleOperationCatalog } from '../core/feature-catalog.js';\nimport { type ClientFeatureHost, createFeatureHost } from '../core/feature-host.js';\nimport type { ClientFeature } from '../core/features.js';\nimport type { RawRequestOptions, RuntimeOptions } from '../core/options.js';\nimport type { ClientPlugin } from '../core/plugins/contracts.js';\nimport type { RateLimitBucketState } from '../core/scheduling/rate-limit.js';\nimport type { ServiceDefinition } from '../core/services.js';\nimport { ITD_CATALOG } from '../domain/catalog.js';\nimport { AccountLifecycleResource } from '../resources/account/lifecycle.js';\nimport type { CommentsResource } from '../resources/comments.js';\nimport type { FilesResource } from '../resources/files.js';\nimport type { HashtagsResource } from '../resources/hashtags.js';\nimport type { LegalResource } from '../resources/legal.js';\nimport { NotificationsResource } from '../resources/notifications.js';\nimport type { PlatformResource } from '../resources/platform.js';\nimport type { PostsResource } from '../resources/posts.js';\nimport type { ReportsResource } from '../resources/reports.js';\nimport type { SearchResource } from '../resources/search.js';\nimport type { ShopResource } from '../resources/shop.js';\nimport { createStatusFeature } from '../resources/status.js';\nimport type { SubscriptionResource } from '../resources/subscription.js';\nimport type { TelemetryResource } from '../resources/telemetry.js';\nimport type { UsersResource } from '../resources/users.js';\nimport type { VerificationResource } from '../resources/verification.js';\nimport { createResources, type RestResources } from './resources.js';\n\n/** Опции конструктора {@link ItdRestClient}. */\nexport interface RestClientOptions extends RuntimeOptions {\n /**\n * Авторизация. Строка — сокращение для {@link bearerToken}.\n *\n * Без неё доступны только публичные эндпоинты. Токен здесь считается готовым: продлевать\n * его клиент не умеет и на `401` отвечает ошибкой. Сессия, которая входит по паролю\n * и продлевает себя сама, живёт в полном `ItdClient`.\n */\n auth?: string | AuthProvider | undefined;\n}\n\n/**\n * Минимальный клиент REST API итд.com.\n *\n * Тот же конвейер запросов, что и у полного клиента, — с повторами, очередью, плагинами\n * и типизированными ошибками, — но без сессии, потока событий и нескольких аккаунтов.\n * Нужен там, где токен уже есть, а размер поставки важен: серверные интеграции, воркеры,\n * браузерные приложения.\n *\n * @example\n * ```ts\n * import { createRestClient } from 'itd-api/rest';\n *\n * const api = createRestClient({ auth: process.env.ITD_TOKEN });\n * const feed = await api.posts.list({ tab: 'popular' });\n * ```\n */\nexport class ItdRestClient {\n readonly #runtime: ClientRuntime;\n readonly #features: ClientFeatureHost;\n readonly #resources: RestResources;\n /** Общий результат терминальной очистки для идемпотентных повторных вызовов. */\n #disposePromise: Promise<void> | undefined;\n #disposed = false;\n #account: AccountLifecycleResource | undefined;\n\n /** Деактивация и восстановление текущего аккаунта. */\n get account(): AccountLifecycleResource {\n this.#account ??= new AccountLifecycleResource(this.#runtime.http);\n return this.#account;\n }\n\n /** Профили, подписки, блокировки, приватность. */\n get users(): UsersResource {\n return this.#resources.users;\n }\n\n /** Лента, публикация, реакции, репосты, комментарии к постам. */\n get posts(): PostsResource {\n return this.#resources.posts;\n }\n\n /** Ответы на комментарии и действия над ними. */\n get comments(): CommentsResource {\n return this.#resources.comments;\n }\n\n /** Загрузка файлов и медиа. */\n get files(): FilesResource {\n return this.#resources.files;\n }\n\n /** Уведомления: список, счётчик, отметки о прочтении, настройки. */\n get notifications(): NotificationsResource {\n return this.#resources.notifications;\n }\n\n /** Хэштеги и посты по ним. */\n get hashtags(): HashtagsResource {\n return this.#resources.hashtags;\n }\n\n /** Глобальный поиск по пользователям и хэштегам. */\n get search(): SearchResource {\n return this.#resources.search;\n }\n\n /** Каталог, доставка и заказы магазина ИТД. */\n get shop(): ShopResource {\n return this.#resources.shop;\n }\n\n /** Жалобы на контент и пользователей. */\n get reports(): ReportsResource {\n return this.#resources.reports;\n }\n\n /** Верификация профиля. */\n get verification(): VerificationResource {\n return this.#resources.verification;\n }\n\n /** Подписка и способы оплаты. */\n get subscription(): SubscriptionResource {\n return this.#resources.subscription;\n }\n\n /** Публичные документы ИТД и история их редакций. */\n get legal(): LegalResource {\n return this.#resources.legal;\n }\n\n /** Сведения о платформе: версии приложений, изменения, анонсы, баннер события. */\n get platform(): PlatformResource {\n return this.#resources.platform;\n }\n\n /** Телеметрия просмотров. */\n get telemetry(): TelemetryResource {\n return this.#resources.telemetry;\n }\n\n constructor(options: RestClientOptions = {}) {\n const { auth, ...runtimeOptions } = options;\n const catalog = new ExtensibleOperationCatalog(ITD_CATALOG);\n\n this.#runtime = createClientRuntime(runtimeOptions, {\n catalog,\n assertActive: (action) => this.#assertActive(action),\n auth: () => resolveAuthProvider(auth),\n });\n this.#features = createFeatureHost(this.#runtime, {\n catalog,\n assertActive: (action) => this.#assertActive(action),\n });\n const status = this.#features.install(createStatusFeature());\n this.#resources = createResources({\n http: this.#runtime.http,\n files: this.#features.files,\n status,\n createNotifications: (http) => new NotificationsResource(http),\n });\n }\n\n #assertActive(action: string): void {\n if (!this.#disposed) return;\n throw new ItdStateError(\n `Клиент уже окончательно освобождён через dispose(); нельзя ${action}. Создайте новый клиент`,\n );\n }\n\n /** Базовый URL, к которому обращается клиент. */\n get baseUrl(): string {\n return this.#runtime.config.baseUrl;\n }\n\n /**\n * Выполняет произвольный запрос к API.\n *\n * Запасной путь для случаев, когда нужного метода ещё нет или ответ сервера разошёлся\n * с документацией. Проходит через ту же авторизацию, очередь и обработку ошибок.\n *\n * @throws {ItdStateError} если клиент уже освобождён через {@link dispose}\n */\n request<T = unknown>(options: RawRequestOptions): Promise<T> {\n return this.#runtime.http.request<T>({\n ...options,\n operationId: options.operationId ?? 'raw',\n });\n }\n\n /**\n * Остаток серверных лимитов по бакетам, через которые уже проходили запросы.\n *\n * Пустой массив при `rateLimit: false`.\n */\n rateLimitState(): RateLimitBucketState[] {\n return this.#runtime.rateLimitState();\n }\n\n /** Устанавливает REST-модуль с общей обработкой запросов клиента. */\n install<TApi>(feature: ClientFeature<TApi>): TApi {\n return this.#features.install(feature);\n }\n\n /** Устанавливает REST-модуль и добавляет его API в свойство только для чтения. */\n withFeature<const K extends string, TApi>(\n key: K,\n feature: ClientFeature<TApi>,\n ): this & { readonly [P in K]: TApi } {\n this.#assertActive('установить feature');\n if (typeof key !== 'string' || key.trim() === '' || key !== key.trim()) {\n throw new ItdConfigError('Свойство feature должно иметь непустое имя без краевых пробелов');\n }\n if (key === 'then' || key in this) {\n throw new ItdConfigError(`Свойство клиента «${key}» уже занято или зарезервировано`);\n }\n if (!Object.isExtensible(this)) {\n throw new ItdConfigError('Нельзя опубликовать feature на нерасширяемом клиенте');\n }\n\n const api = this.install(feature);\n Object.defineProperty(this, key, {\n value: api,\n enumerable: true,\n configurable: false,\n writable: false,\n });\n return this as this & { readonly [P in K]: TApi };\n }\n\n /** Имена установленных модулей в порядке установки. */\n featureNames(): string[] {\n return this.#features.names();\n }\n\n /** Установлен ли модуль с таким именем. */\n hasFeature(name: string): boolean {\n return this.#features.has(name);\n }\n\n /**\n * Подключает плагин.\n *\n * Сессионная идентичность плагину не передаётся: у клиента с готовым токеном её нет.\n * Плагинам, которые изолируют состояние по аккаунту, нужен полный `ItdClient`.\n *\n * @throws {ItdConfigError} если плагин задан неверно или уже подключён\n * @throws {ItdStateError} если клиент уже освобождён через {@link dispose}\n */\n use(plugin: ClientPlugin): this {\n this.#assertActive('подключить плагин');\n this.#runtime.plugins.add(plugin, {\n baseUrl: this.#runtime.config.baseUrl,\n logger: this.#runtime.config.logger,\n });\n return this;\n }\n\n /**\n * Отключает плагин и освобождает заведённые им ресурсы.\n *\n * @returns `false`, если такого плагина не было\n * @throws {ItdConfigError} если от плагина зависит другой подключённый плагин\n */\n unuse(name: string): Promise<boolean> {\n return this.#runtime.plugins.remove(name);\n }\n\n /** Имена подключённых плагинов в фактическом порядке выполнения обёрток. */\n pluginNames(): string[] {\n return this.#runtime.plugins.names();\n }\n\n /** Подключён ли плагин с таким именем. */\n hasPlugin(name: string): boolean {\n return this.#runtime.plugins.has(name);\n }\n\n /**\n * Регистрирует сервис платформы — домен, отличный от основного.\n *\n * @throws {ItdConfigError} если определение неверно или имя уже занято\n * @throws {ItdStateError} если клиент уже освобождён через {@link dispose}\n */\n defineService(definition: ServiceDefinition): this {\n this.#assertActive('зарегистрировать сервис');\n this.#runtime.services.define(definition);\n return this;\n }\n\n /**\n * Отправляет открытые накопители {@link telemetry} и останавливает очередь запросов.\n *\n * После вызова клиентом можно пользоваться снова. Терминальное освобождение —\n * это {@link dispose}.\n */\n async close(): Promise<void> {\n const errors: unknown[] = [];\n try {\n try {\n await this.#features.close();\n } catch (error) {\n errors.push(error);\n }\n try {\n await this.#resources.closeTelemetry(false);\n } catch (error) {\n errors.push(error);\n }\n } finally {\n this.#runtime.close();\n }\n if (errors.length === 1) throw errors[0];\n if (errors.length > 1) throw new AggregateError(errors, 'Не удалось закрыть клиент');\n }\n\n /**\n * Окончательно освобождает клиент: выполняет {@link close}, отменяет незавершённые\n * запросы и отключает все плагины.\n *\n * Терминальное состояние устанавливается сразу при первом вызове; повторные вызовы\n * возвращают тот же результат очистки.\n *\n * @example\n * ```ts\n * await using api = createRestClient({ auth: token });\n * ```\n */\n dispose(): Promise<void> {\n if (this.#disposePromise) return this.#disposePromise;\n this.#disposed = true;\n this.#disposePromise = this.#dispose();\n return this.#disposePromise;\n }\n\n async #dispose(): Promise<void> {\n const errors: unknown[] = [];\n // Телеметрия уходит через ещё установленные плагины и мимо проверки состояния.\n this.#resources.prepareTelemetryClose();\n try {\n await this.#features.close();\n } catch (error) {\n errors.push(error);\n }\n try {\n await this.#resources.closeTelemetry(true);\n } catch (error) {\n errors.push(error);\n }\n try {\n await this.#features.dispose();\n } catch (error) {\n errors.push(error);\n }\n try {\n this.#runtime.close();\n await this.#runtime.dispose();\n } catch (error) {\n errors.push(error);\n }\n if (errors.length > 0) throw new AggregateError(errors, 'Не удалось освободить клиент');\n }\n\n /** Позволяет использовать клиент с `await using`. */\n [Symbol.asyncDispose](): Promise<void> {\n return this.dispose();\n }\n\n static {\n installAsyncDisposeFallback(ItdRestClient);\n }\n}\n\n/** Приводит опцию `auth` к провайдеру конвейера. */\nfunction resolveAuthProvider(auth: RestClientOptions['auth']): AuthProvider {\n if (auth === undefined) return anonymousAuth();\n return typeof auth === 'string' ? bearerToken(auth) : auth;\n}\n\n/**\n * Создаёт минимальный клиент REST API. Равнозначно конструктору {@link ItdRestClient}.\n *\n * @example\n * ```ts\n * const api = createRestClient({ auth: token, rateLimit: { concurrency: 4 } });\n * ```\n */\nexport function createRestClient(options: RestClientOptions = {}): ItdRestClient {\n return new ItdRestClient(options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0DA,IAAa,gBAAb,MAAa,cAAc;CAChB;CACA;CACA;;CAET;CACA,YAAY;CACZ;;CAGA,IAAI,UAAoC;EACtC,KAAK,aAAa,IAAI,yBAAyB,KAAK,SAAS,IAAI;EACjE,OAAO,KAAK;CACd;;CAGA,IAAI,QAAuB;EACzB,OAAO,KAAK,WAAW;CACzB;;CAGA,IAAI,QAAuB;EACzB,OAAO,KAAK,WAAW;CACzB;;CAGA,IAAI,WAA6B;EAC/B,OAAO,KAAK,WAAW;CACzB;;CAGA,IAAI,QAAuB;EACzB,OAAO,KAAK,WAAW;CACzB;;CAGA,IAAI,gBAAuC;EACzC,OAAO,KAAK,WAAW;CACzB;;CAGA,IAAI,WAA6B;EAC/B,OAAO,KAAK,WAAW;CACzB;;CAGA,IAAI,SAAyB;EAC3B,OAAO,KAAK,WAAW;CACzB;;CAGA,IAAI,OAAqB;EACvB,OAAO,KAAK,WAAW;CACzB;;CAGA,IAAI,UAA2B;EAC7B,OAAO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OAAO,KAAK,KAAK;GACnB;EACF,UAAU;GACR,KAAK,SAAS,MAAM;EACtB;EACA,IAAI,OAAO,WAAW,GAAG,MAAM,OAAO;EACtC,IAAI,OAAO,SAAS,GAAG,MAAM,IAAI,eAAe,QAAQ,2BAA2B;CACrF;;;;;;;;;;;;;CAcA,UAAyB;EACvB,IAAI,KAAK,iBAAiB,OAAO,KAAK;EACtC,KAAK,YAAY;EACjB,KAAK,kBAAkB,KAAK,SAAS;EACrC,OAAO,KAAK;CACd;CAEA,MAAM,WAA0B;EAC9B,MAAM,SAAoB,CAAC;EAE3B,KAAK,WAAW,sBAAsB;EACtC,IAAI;GACF,MAAM,KAAK,UAAU,MAAM;EAC7B,SAAS,OAAO;GACd,OAAO,KAAK,KAAK;EACnB;EACA,IAAI;GACF,MAAM,KAAK,WAAW,eAAe,IAAI;EAC3C,SAAS,OAAO;GACd,OAAO,KAAK,KAAK;EACnB;EACA,IAAI;GACF,MAAM,KAAK,UAAU,QAAQ;EAC/B,SAAS,OAAO;GACd,OAAO,KAAK,KAAK;EACnB;EACA,IAAI;GACF,KAAK,SAAS,MAAM;GACpB,MAAM,KAAK,SAAS,QAAQ;EAC9B,SAAS,OAAO;GACd,OAAO,KAAK,KAAK;EACnB;EACA,IAAI,OAAO,SAAS,GAAG,MAAM,IAAI,eAAe,QAAQ,8BAA8B;CACxF;;CAGA,CAAC,OAAO,gBAA+B;EACrC,OAAO,KAAK,QAAQ;CACtB;CAEA;EACE,4BAA4B,aAAa;CAC3C;AACF;;AAGA,SAAS,oBAAoB,MAA+C;CAC1E,IAAI,SAAS,KAAA,GAAW,OAAO,cAAc;CAC7C,OAAO,OAAO,SAAS,WAAW,YAAY,IAAI,IAAI;AACxD;;;;;;;;;AAUA,SAAgB,iBAAiB,UAA6B,CAAC,GAAkB;CAC/E,OAAO,IAAI,cAAc,OAAO;AAClC"}
@@ -1,4 +1,3 @@
1
- //#region src/core/attachments/contracts.d.ts
2
1
  /** Способ передачи содержимого вложения. */
3
2
  declare const FileTransferMode: Readonly<{
4
3
  /** Сначала получить файл целиком, затем отправить его как `Blob`. */
@@ -79,6 +78,4 @@ interface FromStreamOptions extends Omit<FileStreamOptions, 'mode'> {
79
78
  /** Размер, если он известен заранее. */
80
79
  size?: number | undefined;
81
80
  }
82
- //#endregion
83
- export { FileStreamOptions as a, LazyFile as c, UrlFileOptions as d, FileStreamContent as i, StreamFile as l, FileContext as n, FileTransferMode as o, FileInput as r, FromStreamOptions as s, FileContent as t, UrlFile as u };
84
- //# sourceMappingURL=contracts-BoT7msmq.d.ts.map
81
+ export { FileStreamOptions as a, LazyFile as c, UrlFileOptions as d, FileStreamContent as i, StreamFile as l, FileContext as n, FileTransferMode as o, FileInput as r, FromStreamOptions as s, FileContent as t, UrlFile as u };
@@ -1,4 +1,3 @@
1
- //#region src/core/attachments/contracts.d.ts
2
1
  /** Способ передачи содержимого вложения. */
3
2
  declare const FileTransferMode: Readonly<{
4
3
  /** Сначала получить файл целиком, затем отправить его как `Blob`. */
@@ -79,6 +78,4 @@ interface FromStreamOptions extends Omit<FileStreamOptions, 'mode'> {
79
78
  /** Размер, если он известен заранее. */
80
79
  size?: number | undefined;
81
80
  }
82
- //#endregion
83
- export { FileStreamOptions as a, LazyFile as c, UrlFileOptions as d, FileStreamContent as i, StreamFile as l, FileContext as n, FileTransferMode as o, FileInput as r, FromStreamOptions as s, FileContent as t, UrlFile as u };
84
- //# sourceMappingURL=contracts-BoT7msmq.d.cts.map
81
+ export { FileStreamOptions as a, LazyFile as c, UrlFileOptions as d, FileStreamContent as i, StreamFile as l, FileContext as n, FileTransferMode as o, FileInput as r, FromStreamOptions as s, FileContent as t, UrlFile as u };
@@ -1,5 +1,4 @@
1
- import { Gt as Logger, Kt as ItdClock, Rt as RuntimeOptions, Tn as NotificationType, a as NotificationEvent, ct as ClientConnection, gn as EventChannelStatus, lt as AuthIdentity, ot as Listener, s as Notification, st as Unsubscribe, ut as AuthProvider, zt as QueryParams } from "./url-_R0oJ7gE.cjs";
2
- //#region src/events/transports/transport.d.ts
1
+ import { An as ClientConnection, Ct as EventChannelStatus, Fn as Unsubscribe, Ln as Logger, Mt as NotificationType, Pn as Listener, Tn as QueryParams, V as Notification, at as AuthIdentity, jn as ItdClock, ot as AuthProvider, wn as RuntimeOptions, z as NotificationEvent } from "./url-DCqxoxGX.cjs";
3
2
  /** Идентификаторы операций транспорта уведомлений. */
4
3
  type EventOperationId = 'events.notifications.poll.updates' | 'events.notifications.poll.unread';
5
4
  /** Запрос транспорта к конвейеру клиента. */
@@ -53,8 +52,6 @@ interface EventTransport {
53
52
  declare class UnauthorizedStreamError extends Error {
54
53
  constructor();
55
54
  }
56
- //#endregion
57
- //#region src/events/updates.d.ts
58
55
  /** Типы нормализованных обновлений потока. */
59
56
  declare const NotificationUpdateType: Readonly<{
60
57
  readonly Notification: "notification";
@@ -138,8 +135,6 @@ interface NotificationEventFilter<T extends NotificationType = NotificationType>
138
135
  }
139
136
  /** Краткая или объектная форма фильтра уведомлений. */
140
137
  type NotificationEventSelector<T extends NotificationType = NotificationType> = T | readonly T[] | NotificationEventFilter<T>;
141
- //#endregion
142
- //#region src/events/middleware.d.ts
143
138
  /** Продолжает цепочку промежуточных обработчиков потока. */
144
139
  type EventNext = () => Promise<void>;
145
140
  /** Обрабатывает обновление потока до его передачи подписчикам. */
@@ -158,8 +153,6 @@ type EventTypeGuard<C extends B, B extends EventContext = NotificationEventConte
158
153
  type EventSequentializer<C extends EventContext = NotificationEventContext> = (context: C) => PropertyKey | readonly PropertyKey[] | undefined;
159
154
  /** Выполняет промежуточные обработчики по порядку и запрещает повторный вызов `next()`. */
160
155
  declare function runEventMiddleware<C extends EventContext>(middleware: readonly EventMiddleware<C>[], context: C, terminal: EventNext): Promise<void>;
161
- //#endregion
162
- //#region src/events/reconnect.d.ts
163
156
  /** Настройки переподключения. */
164
157
  interface ReconnectOptions {
165
158
  /** Таблица пауз. Последнее значение действует для всех дальнейших попыток. */
@@ -169,8 +162,6 @@ interface ReconnectOptions {
169
162
  /** Предел числа попыток. */
170
163
  maxAttempts?: number;
171
164
  }
172
- //#endregion
173
- //#region src/events/engine.d.ts
174
165
  /** Зачем движок просит домен синхронизироваться. */
175
166
  type EventSyncReason = 'initial' | 'reconnect';
176
167
  /** Параметры постановки доменного события из REST или другого внешнего источника. */
@@ -325,8 +316,6 @@ declare class EventChannel<U, C extends EventContext<U, unknown, O>, E extends E
325
316
  */
326
317
  drain(): Promise<void>;
327
318
  }
328
- //#endregion
329
- //#region src/events/stream.d.ts
330
319
  /**
331
320
  * События потока уведомлений.
332
321
  *
@@ -512,8 +501,46 @@ declare class NotificationEvents<C extends NotificationEventContext = Notificati
512
501
  /** Снимает подписки `on()` и `once()`. Остальные обработчики остаются. */
513
502
  removeAllListeners(): void;
514
503
  }
515
- //#endregion
516
- //#region src/events/client.d.ts
504
+ /** Дополнительные параметры конструктора, поддерживаемые Node-реализациями вроде `ws`. */
505
+ interface WebSocketImplementationOptions {
506
+ headers?: Record<string, string> | undefined;
507
+ handshakeTimeout?: number | undefined;
508
+ }
509
+ /** Конструктор WebSocket, который можно передать вместо глобальной реализации. */
510
+ interface WebSocketLike {
511
+ new (url: string | URL, protocols?: string | string[], options?: WebSocketImplementationOptions): unknown;
512
+ }
513
+ /** Определяет, был ли отказ до открытия сокета вызван недействительным токеном. */
514
+ type WebSocketOpenFailureClassifier = (error: unknown, signal: AbortSignal) => boolean | Promise<boolean>;
515
+ /** Настройки WebSocket-транспорта. */
516
+ interface WebSocketTransportOptions {
517
+ /** Путь апгрейда. По умолчанию `/api/ws`. */
518
+ path?: string | undefined;
519
+ /** Реализация WebSocket для сред без глобальной либо для передачи заголовков апгрейда. */
520
+ webSocketImpl?: WebSocketLike | undefined;
521
+ /** Способ передачи токена. `auto` выбирает заголовок при инъекции и query иначе. */
522
+ auth?: 'query' | 'header' | 'auto' | undefined;
523
+ /** Молчание открытого соединения до переподключения, мс. По умолчанию 90 000. */
524
+ idleTimeout?: number | undefined;
525
+ /** Период текстового `ping`, мс. По умолчанию 30 000. */
526
+ keepAlive?: number | undefined;
527
+ /** Максимальное время установки соединения, мс. По умолчанию 20 000. */
528
+ handshakeTimeout?: number | undefined;
529
+ /**
530
+ * Проверяет отказ до `open`, когда среда скрыла HTTP-статус WebSocket-upgrade.
531
+ * `true` преобразует отказ в {@link UnauthorizedStreamError}.
532
+ */
533
+ classifyOpenFailure?: WebSocketOpenFailureClassifier | undefined;
534
+ /** Часы транспорта. Обычно подменяются только в тестах. */
535
+ clock?: ItdClock | undefined;
536
+ }
537
+ /** Транспорт исходных событий поверх стандартного WebSocket. */
538
+ declare class WebSocketTransport implements EventTransport {
539
+ #private;
540
+ readonly name = "ws";
541
+ constructor(options?: WebSocketTransportOptions);
542
+ connect(context: EventTransportContext): Promise<void>;
543
+ }
517
544
  /** Опции конструктора {@link NotificationEventsClient}. */
518
545
  interface NotificationEventsClientOptions<C extends NotificationEventContext = NotificationEventContext> extends RuntimeOptions, NotificationEventsOptions<C> {
519
546
  /**
@@ -559,8 +586,6 @@ declare class NotificationEventsClient<C extends NotificationEventContext = Noti
559
586
  * {@link NotificationEventsClient}.
560
587
  */
561
588
  declare function createNotificationEventsClient<C extends NotificationEventContext = NotificationEventContext>(options?: NotificationEventsClientOptions<C>): NotificationEventsClient<C>;
562
- //#endregion
563
- //#region src/events/router.d.ts
564
589
  /** Выбирает маршрут обновления. `undefined` и `null` означают отсутствие маршрута. */
565
590
  type EventRouteSelector<K extends PropertyKey, C extends EventContext = NotificationEventContext> = (context: C) => K | null | undefined | Promise<K | null | undefined>;
566
591
  /**
@@ -590,8 +615,6 @@ declare class EventRouter<K extends PropertyKey = PropertyKey, C extends EventCo
590
615
  /** Возвращает снимок маршрутов для `stream.use(router)` или ручной композиции. */
591
616
  middleware(): EventMiddleware<C>;
592
617
  }
593
- //#endregion
594
- //#region src/events/composer.d.ts
595
618
  /** Функция или объект промежуточного обработчика для {@link EventComposer}. */
596
619
  type EventMiddlewareLike<C extends EventContext = NotificationEventContext> = EventMiddleware<C> | EventMiddlewareObject<C>;
597
620
  /** Один или несколько промежуточных обработчиков ветки. */
@@ -649,48 +672,4 @@ declare class EventComposer<C extends EventContext = NotificationEventContext> i
649
672
  /** Возвращает промежуточный обработчик для `stream.use()` или вложенной цепочки. */
650
673
  middleware(): EventMiddleware<C>;
651
674
  }
652
- //#endregion
653
- //#region src/events/transports/websocket.d.ts
654
- /** Дополнительные параметры конструктора, поддерживаемые Node-реализациями вроде `ws`. */
655
- interface WebSocketImplementationOptions {
656
- headers?: Record<string, string> | undefined;
657
- handshakeTimeout?: number | undefined;
658
- }
659
- /** Конструктор WebSocket, который можно передать вместо глобальной реализации. */
660
- interface WebSocketLike {
661
- new (url: string | URL, protocols?: string | string[], options?: WebSocketImplementationOptions): unknown;
662
- }
663
- /** Определяет, был ли отказ до открытия сокета вызван недействительным токеном. */
664
- type WebSocketOpenFailureClassifier = (error: unknown, signal: AbortSignal) => boolean | Promise<boolean>;
665
- /** Настройки WebSocket-транспорта. */
666
- interface WebSocketTransportOptions {
667
- /** Путь апгрейда. По умолчанию `/api/ws`. */
668
- path?: string | undefined;
669
- /** Реализация WebSocket для сред без глобальной либо для передачи заголовков апгрейда. */
670
- webSocketImpl?: WebSocketLike | undefined;
671
- /** Способ передачи токена. `auto` выбирает заголовок при инъекции и query иначе. */
672
- auth?: 'query' | 'header' | 'auto' | undefined;
673
- /** Молчание открытого соединения до переподключения, мс. По умолчанию 90 000. */
674
- idleTimeout?: number | undefined;
675
- /** Период текстового `ping`, мс. По умолчанию 30 000. */
676
- keepAlive?: number | undefined;
677
- /** Максимальное время установки соединения, мс. По умолчанию 20 000. */
678
- handshakeTimeout?: number | undefined;
679
- /**
680
- * Проверяет отказ до `open`, когда среда скрыла HTTP-статус WebSocket-upgrade.
681
- * `true` преобразует отказ в {@link UnauthorizedStreamError}.
682
- */
683
- classifyOpenFailure?: WebSocketOpenFailureClassifier | undefined;
684
- /** Часы транспорта. Обычно подменяются только в тестах. */
685
- clock?: ItdClock | undefined;
686
- }
687
- /** Транспорт исходных событий поверх стандартного WebSocket. */
688
- declare class WebSocketTransport implements EventTransport {
689
- #private;
690
- readonly name = "ws";
691
- constructor(options?: WebSocketTransportOptions);
692
- connect(context: EventTransportContext): Promise<void>;
693
- }
694
- //#endregion
695
- export { EventTransportContext as $, EventHandler as A, NotificationEventContext as B, EventChannelDeps as C, EventSession as D, EventEnqueueOptions as E, EventSequentializer as F, NotificationOfType as G, NotificationEventOfType as H, EventTypeGuard as I, NotificationUpdateOrigin as J, NotificationUpdate as K, runEventMiddleware as L, EventMiddlewareObject as M, EventNext as N, EventSyncReason as O, EventPredicate as P, EventTransport as Q, EventContext as R, EventChannel as S, EventChannelOptions as T, NotificationEventSelector as U, NotificationEventFilter as V, NotificationEventsUpdate as W, UnknownNotificationUpdate as X, NotificationUpdateType as Y, UnreadCountUpdate as Z, createNotificationEventsClient as _, WebSocketTransportOptions as a, NotificationEventsOptions as b, EventErrorContext as c, EventMiddlewareLike as d, EventTransportFrame as et, EventRouteTable as f, NotificationEventsClientOptions as g, NotificationEventsClient as h, WebSocketTransport as i, EventMiddleware as j, ReconnectOptions as k, EventFilter as l, EventRouter as m, WebSocketLike as n, EventComposer as o, EventRouteSelector as p, NotificationUpdateOfType as q, WebSocketOpenFailureClassifier as r, EventErrorBoundary as s, WebSocketImplementationOptions as t, UnauthorizedStreamError as tt, EventMiddlewareGroup as u, NotificationEvents as v, EventChannelEvents as w, NotificationEventsTransport as x, NotificationEventsMap as y, NotificationContext as z };
696
- //# sourceMappingURL=events-FaXfdle0.d.cts.map
675
+ export { EventTransportContext as $, EventHandler as A, NotificationEventContext as B, EventChannelDeps as C, EventSession as D, EventEnqueueOptions as E, EventSequentializer as F, NotificationOfType as G, NotificationEventOfType as H, EventTypeGuard as I, NotificationUpdateOrigin as J, NotificationUpdate as K, runEventMiddleware as L, EventMiddlewareObject as M, EventNext as N, EventSyncReason as O, EventPredicate as P, EventTransport as Q, EventContext as R, EventChannel as S, EventChannelOptions as T, NotificationEventSelector as U, NotificationEventFilter as V, NotificationEventsUpdate as W, UnknownNotificationUpdate as X, NotificationUpdateType as Y, UnreadCountUpdate as Z, WebSocketTransportOptions as _, EventMiddlewareGroup as a, NotificationEventsOptions as b, EventRouteSelector as c, NotificationEventsClientOptions as d, EventTransportFrame as et, createNotificationEventsClient as f, WebSocketTransport as g, WebSocketOpenFailureClassifier as h, EventFilter as i, EventMiddleware as j, ReconnectOptions as k, EventRouter as l, WebSocketLike as m, EventErrorBoundary as n, EventMiddlewareLike as o, WebSocketImplementationOptions as p, NotificationUpdateOfType as q, EventErrorContext as r, EventRouteTable as s, EventComposer as t, UnauthorizedStreamError as tt, NotificationEventsClient as u, NotificationEvents as v, EventChannelEvents as w, NotificationEventsTransport as x, NotificationEventsMap as y, NotificationContext as z };