itd-api 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +1 -0
  2. package/dist/events/index.cjs +3 -3
  3. package/dist/events/index.d.cts +2 -2
  4. package/dist/events/index.d.ts +2 -2
  5. package/dist/events/index.js +3 -3
  6. package/dist/index.cjs +34 -20
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +10 -6
  9. package/dist/index.d.ts +10 -6
  10. package/dist/index.js +28 -21
  11. package/dist/index.js.map +1 -1
  12. package/dist/node/index.cjs +2 -2
  13. package/dist/node/index.js +2 -2
  14. package/dist/rest/index.cjs +11 -4
  15. package/dist/rest/index.d.cts +3 -3
  16. package/dist/rest/index.d.ts +3 -3
  17. package/dist/rest/index.js +5 -5
  18. package/dist/shared/{cookies-Bw5HAxTB.js → cookies-YP0m72v2.js} +3 -2
  19. package/dist/shared/cookies-YP0m72v2.js.map +1 -0
  20. package/dist/shared/{cookies-DRYS-vZm.cjs → cookies-u2hXCcpR.cjs} +3 -2
  21. package/dist/shared/cookies-u2hXCcpR.cjs.map +1 -0
  22. package/dist/shared/{events-Dl27rIA0.d.cts → events-BmYzFrRC.d.cts} +1 -1
  23. package/dist/shared/{events-DXLOZXNe.js → events-BnL_gckg.js} +12 -12
  24. package/dist/shared/events-BnL_gckg.js.map +1 -0
  25. package/dist/shared/{events-g5XfBnc3.d.ts → events-Bw7VaSDs.d.ts} +1 -1
  26. package/dist/shared/{events--hwTmeN2.cjs → events-DUFuPzVO.cjs} +12 -12
  27. package/dist/shared/events-DUFuPzVO.cjs.map +1 -0
  28. package/dist/shared/{multi-storage-DDQKI9yT.cjs → multi-storage-BIeeBDV6.cjs} +2 -2
  29. package/dist/shared/{multi-storage-DDQKI9yT.cjs.map → multi-storage-BIeeBDV6.cjs.map} +1 -1
  30. package/dist/shared/{multi-storage-BDwZ3sOJ.js → multi-storage-DmUOaXbC.js} +2 -2
  31. package/dist/shared/{multi-storage-BDwZ3sOJ.js.map → multi-storage-DmUOaXbC.js.map} +1 -1
  32. package/dist/shared/{options-RfX5uXP5.js → options-D-8h06B_.js} +2 -2
  33. package/dist/shared/{options-RfX5uXP5.js.map → options-D-8h06B_.js.map} +1 -1
  34. package/dist/shared/{options-BrA90TVm.cjs → options-hZolLxgs.cjs} +2 -2
  35. package/dist/shared/{options-BrA90TVm.cjs.map → options-hZolLxgs.cjs.map} +1 -1
  36. package/dist/shared/{render-B6sj0OJ5.js → render-CgSQp84V.js} +1708 -1277
  37. package/dist/shared/render-CgSQp84V.js.map +1 -0
  38. package/dist/shared/{render-C11kvqb5.d.ts → render-DPXlBr5L.d.ts} +726 -248
  39. package/dist/shared/{render-D_pGoEH3.d.cts → render-DcIXTSuo.d.cts} +726 -248
  40. package/dist/shared/{render-DHeGjOzq.cjs → render-dKMV-872.cjs} +1713 -1240
  41. package/dist/shared/render-dKMV-872.cjs.map +1 -0
  42. package/dist/shared/{url-BPqHN_CZ.d.ts → url-B_TELARK.d.ts} +85 -17
  43. package/dist/shared/{url-W5GQOtlk.cjs → url-CQbNqbJX.cjs} +160 -91
  44. package/dist/shared/url-CQbNqbJX.cjs.map +1 -0
  45. package/dist/shared/{url-B6_um5qJ.d.cts → url-D7U9qjXD.d.cts} +85 -17
  46. package/dist/shared/{url-CY2NxyqI.js → url-DYGRJqxh.js} +161 -92
  47. package/dist/shared/url-DYGRJqxh.js.map +1 -0
  48. package/package.json +1 -1
  49. package/dist/shared/cookies-Bw5HAxTB.js.map +0 -1
  50. package/dist/shared/cookies-DRYS-vZm.cjs.map +0 -1
  51. package/dist/shared/events--hwTmeN2.cjs.map +0 -1
  52. package/dist/shared/events-DXLOZXNe.js.map +0 -1
  53. package/dist/shared/render-B6sj0OJ5.js.map +0 -1
  54. package/dist/shared/render-DHeGjOzq.cjs.map +0 -1
  55. package/dist/shared/url-CY2NxyqI.js.map +0 -1
  56. package/dist/shared/url-W5GQOtlk.cjs.map +0 -1
package/README.md CHANGED
@@ -107,6 +107,7 @@ import { ItdClient } from 'itd-api';
107
107
  | `@itd-api/proxy` | прокси-транспорт для HTTP и WebSocket | Node.js 18+, Bun, Deno | [npm](https://www.npmjs.com/package/@itd-api/proxy) | [документация](https://kiowdev.github.io/itd-api/packages/proxy) |
108
108
  | `@itd-api/cache` | TTL/LRU-кэш и дедупликация запросов | среды основного клиента | [npm](https://www.npmjs.com/package/@itd-api/cache) | [документация](https://kiowdev.github.io/itd-api/packages/cache) |
109
109
  | `@itd-api/hydrate` | методы действий на моделях API | среды основного клиента | [npm](https://www.npmjs.com/package/@itd-api/hydrate) | [документация](https://kiowdev.github.io/itd-api/packages/hydrate) |
110
+ | `@itd-api/chat-bot` | создание ботов для чатов ИТД | среды с WebSocket | [npm](https://www.npmjs.com/package/@itd-api/chat-bot) | [документация](https://kiowdev.github.io/itd-api/packages/chat-bot) |
110
111
  | `@itd-api/crypto` | скрытые сообщения в постах, комментариях и профилях | среды основного клиента | [npm](https://www.npmjs.com/package/@itd-api/crypto) | [документация](https://kiowdev.github.io/itd-api/packages/crypto) |
111
112
  | `@itd-api/testing` | сценарные ответы и сервер API в памяти | среды основного клиента | [npm](https://www.npmjs.com/package/@itd-api/testing) | [документация](https://kiowdev.github.io/itd-api/packages/testing) |
112
113
 
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_validate = require("../shared/validate-BHKy_YMv.cjs");
3
- const require_url = require("../shared/url-W5GQOtlk.cjs");
4
- const require_cookies = require("../shared/cookies-DRYS-vZm.cjs");
5
- const require_events = require("../shared/events--hwTmeN2.cjs");
3
+ const require_url = require("../shared/url-CQbNqbJX.cjs");
4
+ const require_cookies = require("../shared/cookies-u2hXCcpR.cjs");
5
+ const require_events = require("../shared/events-DUFuPzVO.cjs");
6
6
  exports.DEFAULT_BASE_URL = require_url.DEFAULT_BASE_URL;
7
7
  exports.EventChannel = require_events.EventChannel;
8
8
  exports.EventChannelStatus = require_url.EventChannelStatus;
@@ -3,6 +3,6 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
- import { $ as ItdServerError, A as AuthProvider, B as ItdAuthError, D as Unsubscribe, E as Listener, En as Loose, Et as ClientHooks, I as ItdAbortError, J as ItdForbiddenError, Jt as Logger, Kt as RuntimeMode, L as ItdApiError, M as bearerToken, N as tokenProvider, O as ClientConnection, On as NotificationType, Q as ItdRateLimitError, U as ItdError, V as ItdConfigError, Vt as RuntimeOptions, W as ItdErrorKind, X as ItdNotFoundError, Xt as systemClock, Y as ItdNetworkError, Yt as ItdClock, _t as DEFAULT_BASE_URL, a as NotificationEvent, at as isItdAuthError, c as NotificationSettings, et as ItdStateError, ft as isItdRateLimitError, ht as isItdValidationError, i as formatNotificationText, it as isItdApiError, j as anonymousAuth, k as AuthIdentity, mt as isItdStateError, n as canonicalNotificationType, nt as ItdValidationError, o as normalizeNotification, qt as LogLevel, r as isKnownNotificationType, rt as TimeoutBudget, s as Notification, st as isItdError, t as resolveNotificationUrl, tt as ItdTimeoutError, yn as EventChannelStatus, yt as LIBRARY_VERSION, z as ItdApiErrorKind } from "../shared/url-B6_um5qJ.cjs";
7
- import { $ as EventTransportFrame, A as EventSequentializer, B as NotificationOfType, C as EventSession, D as EventMiddlewareObject, E as EventMiddleware, F as NotificationEventContext, G as UnknownNotificationUpdate, H as NotificationUpdateOfType, I as NotificationEventFilter, J as NotificationEventsMap, K as UnreadCountUpdate, L as NotificationEventOfType, M as runEventMiddleware, N as EventContext, O as EventNext, P as NotificationContext, Q as EventTransportContext, R as NotificationEventSelector, S as EventEnqueueOptions, T as EventHandler, U as NotificationUpdateOrigin, V as NotificationUpdate, W as NotificationUpdateType, X as NotificationEventsTransport, Y as NotificationEventsOptions, Z as EventTransport, _ as WebSocketTransportOptions, a as EventMiddlewareGroup, b as EventChannelEvents, c as EventRouteSelector, d as NotificationEventsClientOptions, et as UnauthorizedStreamError, f as createNotificationEventsClient, g as WebSocketTransport, h as WebSocketOpenFailureClassifier, i as EventFilter, j as EventTypeGuard, k as EventPredicate, l as EventRouter, m as WebSocketLike, n as EventErrorBoundary, o as EventMiddlewareLike, p as WebSocketImplementationOptions, q as NotificationEvents, r as EventErrorContext, s as EventRouteTable, t as EventComposer, tt as ReconnectOptions, u as NotificationEventsClient, v as EventChannel, w as EventSyncReason, x as EventChannelOptions, y as EventChannelDeps, z as NotificationEventsUpdate } from "../shared/events-Dl27rIA0.cjs";
6
+ import { A as ClientConnection, An as NotificationType, F as tokenProvider, G as ItdError, H as ItdAuthError, Jt as RuntimeMode, K as ItdErrorKind, M as AuthProvider, N as anonymousAuth, O as Listener, On as Loose, Ot as ClientHooks, P as bearerToken, Q as ItdNotFoundError, Qt as systemClock, R as ItdAbortError, U as ItdConfigError, Ut as RuntimeOptions, V as ItdApiErrorKind, X as ItdForbiddenError, Xt as Logger, Yt as LogLevel, Z as ItdNetworkError, Zt as ItdClock, _t as isItdValidationError, a as NotificationEvent, at as TimeoutBudget, c as NotificationSettings, et as ItdRateLimitError, gt as isItdStateError, i as formatNotificationText, it as ItdValidationError, j as AuthIdentity, k as Unsubscribe, lt as isItdError, mt as isItdRateLimitError, n as canonicalNotificationType, nt as ItdStateError, o as normalizeNotification, ot as isItdApiError, r as isKnownNotificationType, rt as ItdTimeoutError, s as Notification, st as isItdAuthError, t as resolveNotificationUrl, tt as ItdServerError, xn as EventChannelStatus, xt as LIBRARY_VERSION, yt as DEFAULT_BASE_URL, z as ItdApiError } from "../shared/url-D7U9qjXD.cjs";
7
+ import { $ as EventTransportFrame, A as EventSequentializer, B as NotificationOfType, C as EventSession, D as EventMiddlewareObject, E as EventMiddleware, F as NotificationEventContext, G as UnknownNotificationUpdate, H as NotificationUpdateOfType, I as NotificationEventFilter, J as NotificationEventsMap, K as UnreadCountUpdate, L as NotificationEventOfType, M as runEventMiddleware, N as EventContext, O as EventNext, P as NotificationContext, Q as EventTransportContext, R as NotificationEventSelector, S as EventEnqueueOptions, T as EventHandler, U as NotificationUpdateOrigin, V as NotificationUpdate, W as NotificationUpdateType, X as NotificationEventsTransport, Y as NotificationEventsOptions, Z as EventTransport, _ as WebSocketTransportOptions, a as EventMiddlewareGroup, b as EventChannelEvents, c as EventRouteSelector, d as NotificationEventsClientOptions, et as UnauthorizedStreamError, f as createNotificationEventsClient, g as WebSocketTransport, h as WebSocketOpenFailureClassifier, i as EventFilter, j as EventTypeGuard, k as EventPredicate, l as EventRouter, m as WebSocketLike, n as EventErrorBoundary, o as EventMiddlewareLike, p as WebSocketImplementationOptions, q as NotificationEvents, r as EventErrorContext, s as EventRouteTable, t as EventComposer, tt as ReconnectOptions, u as NotificationEventsClient, v as EventChannel, w as EventSyncReason, x as EventChannelOptions, y as EventChannelDeps, z as NotificationEventsUpdate } from "../shared/events-BmYzFrRC.cjs";
8
8
  export { type AuthIdentity, type AuthProvider, type ClientConnection, type ClientHooks, DEFAULT_BASE_URL, 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, ItdAbortError, ItdApiError, ItdApiErrorKind, ItdAuthError, type ItdClock, ItdConfigError, ItdError, ItdErrorKind, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdRateLimitError, ItdServerError, ItdStateError, ItdTimeoutError, ItdValidationError, LIBRARY_VERSION, type Listener, LogLevel, type Logger, type Loose, 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 NotificationOfType, type NotificationSettings, NotificationType, type NotificationUpdate, type NotificationUpdateOfType, NotificationUpdateOrigin, NotificationUpdateType, type ReconnectOptions, RuntimeMode, type RuntimeOptions, TimeoutBudget, UnauthorizedStreamError, type UnknownNotificationUpdate, type UnreadCountUpdate, type Unsubscribe, type WebSocketImplementationOptions, type WebSocketLike, type WebSocketOpenFailureClassifier, WebSocketTransport, type WebSocketTransportOptions, anonymousAuth, bearerToken, canonicalNotificationType, createNotificationEventsClient, formatNotificationText, isItdApiError, isItdAuthError, isItdError, isItdRateLimitError, isItdStateError, isItdValidationError, isKnownNotificationType, normalizeNotification, resolveNotificationUrl, runEventMiddleware, systemClock, tokenProvider };
@@ -3,6 +3,6 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
- import { $ as ItdTimeoutError, A as AuthProvider, Cn as Loose, Ct as ClientHooks, D as Unsubscribe, E as Listener, F as ItdApiError, Gt as Logger, H as ItdErrorKind, J as ItdNotFoundError, K as ItdForbiddenError, Kt as ItdClock, L as ItdApiErrorKind, M as bearerToken, N as tokenProvider, O as ClientConnection, P as ItdAbortError, Q as ItdStateError, R as ItdAuthError, Rt as RuntimeOptions, Tn as NotificationType, Ut as RuntimeMode, V as ItdError, Wt as LogLevel, X as ItdRateLimitError, Z as ItdServerError, a as NotificationEvent, at as isItdError, c as NotificationSettings, et as ItdValidationError, ft as isItdStateError, gn as EventChannelStatus, gt as LIBRARY_VERSION, i as formatNotificationText, j as anonymousAuth, k as AuthIdentity, mt as DEFAULT_BASE_URL, n as canonicalNotificationType, nt as isItdApiError, o as normalizeNotification, pt as isItdValidationError, q as ItdNetworkError, qt as systemClock, r as isKnownNotificationType, rt as isItdAuthError, s as Notification, t as resolveNotificationUrl, tt as TimeoutBudget, ut as isItdRateLimitError, z as ItdConfigError } from "../shared/url-BPqHN_CZ.js";
7
- import { $ as EventTransportContext, A as EventHandler, B as NotificationEventContext, C as EventChannelDeps, D as EventSession, E as EventEnqueueOptions, F as EventSequentializer, G as NotificationOfType, H as NotificationEventOfType, I as EventTypeGuard, J as NotificationUpdateOrigin, K as NotificationUpdate, L as runEventMiddleware, M as EventMiddlewareObject, N as EventNext, O as EventSyncReason, P as EventPredicate, Q as EventTransport, R as EventContext, S as EventChannel, T as EventChannelOptions, U as NotificationEventSelector, V as NotificationEventFilter, W as NotificationEventsUpdate, X as UnknownNotificationUpdate, Y as NotificationUpdateType, Z as UnreadCountUpdate, _ as createNotificationEventsClient, a as WebSocketTransportOptions, b as NotificationEventsOptions, c as EventErrorContext, d as EventMiddlewareLike, et as EventTransportFrame, f as EventRouteTable, g as NotificationEventsClientOptions, h as NotificationEventsClient, i as WebSocketTransport, j as EventMiddleware, k as ReconnectOptions, l as EventFilter, m as EventRouter, n as WebSocketLike, o as EventComposer, p as EventRouteSelector, q as NotificationUpdateOfType, r as WebSocketOpenFailureClassifier, s as EventErrorBoundary, t as WebSocketImplementationOptions, tt as UnauthorizedStreamError, u as EventMiddlewareGroup, v as NotificationEvents, w as EventChannelEvents, x as NotificationEventsTransport, y as NotificationEventsMap, z as NotificationContext } from "../shared/events-g5XfBnc3.js";
6
+ import { $ as ItdServerError, A as ClientConnection, B as ItdAuthError, Bt as RuntimeOptions, Dn as NotificationType, F as tokenProvider, Gt as RuntimeMode, I as ItdAbortError, J as ItdForbiddenError, Jt as ItdClock, Kt as LogLevel, L as ItdApiError, M as AuthProvider, N as anonymousAuth, O as Listener, P as bearerToken, Q as ItdRateLimitError, Tn as Loose, Tt as ClientHooks, U as ItdError, V as ItdConfigError, W as ItdErrorKind, X as ItdNotFoundError, Y as ItdNetworkError, Yt as systemClock, a as NotificationEvent, at as isItdAuthError, c as NotificationSettings, et as ItdStateError, ft as isItdRateLimitError, gt as DEFAULT_BASE_URL, ht as isItdValidationError, i as formatNotificationText, it as isItdApiError, j as AuthIdentity, k as Unsubscribe, mt as isItdStateError, n as canonicalNotificationType, nt as ItdValidationError, o as normalizeNotification, qt as Logger, r as isKnownNotificationType, rt as TimeoutBudget, s as Notification, st as isItdError, t as resolveNotificationUrl, tt as ItdTimeoutError, vn as EventChannelStatus, vt as LIBRARY_VERSION, z as ItdApiErrorKind } from "../shared/url-B_TELARK.js";
7
+ import { $ as EventTransportContext, A as EventHandler, B as NotificationEventContext, C as EventChannelDeps, D as EventSession, E as EventEnqueueOptions, F as EventSequentializer, G as NotificationOfType, H as NotificationEventOfType, I as EventTypeGuard, J as NotificationUpdateOrigin, K as NotificationUpdate, L as runEventMiddleware, M as EventMiddlewareObject, N as EventNext, O as EventSyncReason, P as EventPredicate, Q as EventTransport, R as EventContext, S as EventChannel, T as EventChannelOptions, U as NotificationEventSelector, V as NotificationEventFilter, W as NotificationEventsUpdate, X as UnknownNotificationUpdate, Y as NotificationUpdateType, Z as UnreadCountUpdate, _ as createNotificationEventsClient, a as WebSocketTransportOptions, b as NotificationEventsOptions, c as EventErrorContext, d as EventMiddlewareLike, et as EventTransportFrame, f as EventRouteTable, g as NotificationEventsClientOptions, h as NotificationEventsClient, i as WebSocketTransport, j as EventMiddleware, k as ReconnectOptions, l as EventFilter, m as EventRouter, n as WebSocketLike, o as EventComposer, p as EventRouteSelector, q as NotificationUpdateOfType, r as WebSocketOpenFailureClassifier, s as EventErrorBoundary, t as WebSocketImplementationOptions, tt as UnauthorizedStreamError, u as EventMiddlewareGroup, v as NotificationEvents, w as EventChannelEvents, x as NotificationEventsTransport, y as NotificationEventsMap, z as NotificationContext } from "../shared/events-Bw7VaSDs.js";
8
8
  export { type AuthIdentity, type AuthProvider, type ClientConnection, type ClientHooks, DEFAULT_BASE_URL, 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, ItdAbortError, ItdApiError, ItdApiErrorKind, ItdAuthError, type ItdClock, ItdConfigError, ItdError, ItdErrorKind, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdRateLimitError, ItdServerError, ItdStateError, ItdTimeoutError, ItdValidationError, LIBRARY_VERSION, type Listener, LogLevel, type Logger, type Loose, 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 NotificationOfType, type NotificationSettings, NotificationType, type NotificationUpdate, type NotificationUpdateOfType, NotificationUpdateOrigin, NotificationUpdateType, type ReconnectOptions, RuntimeMode, type RuntimeOptions, TimeoutBudget, UnauthorizedStreamError, type UnknownNotificationUpdate, type UnreadCountUpdate, type Unsubscribe, type WebSocketImplementationOptions, type WebSocketLike, type WebSocketOpenFailureClassifier, WebSocketTransport, type WebSocketTransportOptions, anonymousAuth, bearerToken, canonicalNotificationType, createNotificationEventsClient, formatNotificationText, isItdApiError, isItdAuthError, isItdError, isItdRateLimitError, isItdStateError, isItdValidationError, isKnownNotificationType, normalizeNotification, resolveNotificationUrl, runEventMiddleware, systemClock, tokenProvider };
@@ -1,5 +1,5 @@
1
1
  import { C as ItdValidationError, E as isItdAuthError, F as isItdStateError, I as isItdValidationError, N as isItdRateLimitError, O as isItdError, 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, l as ItdConfigError, o as ItdApiError, s as ItdApiErrorKind, w as TimeoutBudget, x as ItdStateError, y as ItdRateLimitError } from "../shared/validate-BQzL_oJ4.js";
2
- import { S as LIBRARY_VERSION, a as tokenProvider, ct as NotificationType, et as EventChannelStatus, i as bearerToken, l as canonicalNotificationType, n as formatNotificationText, o as normalizeNotification, r as anonymousAuth, t as resolveNotificationUrl, u as isKnownNotificationType, v as DEFAULT_BASE_URL, yt as systemClock } from "../shared/url-CY2NxyqI.js";
3
- import { E as LogLevel, v as RuntimeMode } from "../shared/cookies-Bw5HAxTB.js";
4
- import { d as NotificationUpdateType, g as runEventMiddleware, h as UnauthorizedStreamError, i as createNotificationEventsClient, m as EventChannel, n as EventRouter, o as NotificationEvents, p as WebSocketTransport, r as NotificationEventsClient, s as NotificationEventsTransport, t as EventComposer, u as NotificationUpdateOrigin } from "../shared/events-DXLOZXNe.js";
2
+ import { S as LIBRARY_VERSION, a as tokenProvider, ct as NotificationType, et as EventChannelStatus, i as bearerToken, l as canonicalNotificationType, n as formatNotificationText, o as normalizeNotification, r as anonymousAuth, t as resolveNotificationUrl, u as isKnownNotificationType, v as DEFAULT_BASE_URL, yt as systemClock } from "../shared/url-DYGRJqxh.js";
3
+ import { E as LogLevel, v as RuntimeMode } from "../shared/cookies-YP0m72v2.js";
4
+ import { d as NotificationUpdateType, g as runEventMiddleware, h as UnauthorizedStreamError, i as createNotificationEventsClient, m as EventChannel, n as EventRouter, o as NotificationEvents, p as WebSocketTransport, r as NotificationEventsClient, s as NotificationEventsTransport, t as EventComposer, u as NotificationUpdateOrigin } from "../shared/events-BnL_gckg.js";
5
5
  export { DEFAULT_BASE_URL, EventChannel, EventChannelStatus, EventComposer, EventRouter, ItdAbortError, ItdApiError, ItdApiErrorKind, ItdAuthError, ItdConfigError, ItdError, ItdErrorKind, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdRateLimitError, ItdServerError, ItdStateError, ItdTimeoutError, ItdValidationError, LIBRARY_VERSION, LogLevel, NotificationEvents, NotificationEventsClient, NotificationEventsTransport, NotificationType, NotificationUpdateOrigin, NotificationUpdateType, RuntimeMode, TimeoutBudget, UnauthorizedStreamError, WebSocketTransport, anonymousAuth, bearerToken, canonicalNotificationType, createNotificationEventsClient, formatNotificationText, isItdApiError, isItdAuthError, isItdError, isItdRateLimitError, isItdStateError, isItdValidationError, isKnownNotificationType, normalizeNotification, resolveNotificationUrl, runEventMiddleware, systemClock, tokenProvider };
package/dist/index.cjs CHANGED
@@ -1,15 +1,15 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_validate = require("./shared/validate-BHKy_YMv.cjs");
3
- const require_render = require("./shared/render-DHeGjOzq.cjs");
4
- const require_events = require("./shared/events--hwTmeN2.cjs");
5
- const require_url = require("./shared/url-W5GQOtlk.cjs");
6
- const require_cookies = require("./shared/cookies-DRYS-vZm.cjs");
3
+ const require_render = require("./shared/render-dKMV-872.cjs");
4
+ const require_events = require("./shared/events-DUFuPzVO.cjs");
5
+ const require_url = require("./shared/url-CQbNqbJX.cjs");
6
+ const require_cookies = require("./shared/cookies-u2hXCcpR.cjs");
7
7
  const require_storage = require("./shared/storage-e2xYL6ro.cjs");
8
- const require_multi_storage = require("./shared/multi-storage-DDQKI9yT.cjs");
9
- const require_options = require("./shared/options-BrA90TVm.cjs");
8
+ const require_multi_storage = require("./shared/multi-storage-BIeeBDV6.cjs");
9
+ const require_options = require("./shared/options-hZolLxgs.cjs");
10
10
  const require_key_value_store = require("./shared/key-value-store-CmnIjuE4.cjs");
11
11
  // src/events/chats.ts
12
- /** Поток изменений мессенджера. Доступен как `itd.chats.events` в полном клиенте. */
12
+ /** Канал событий чатов. Доступен как `itd.chats.events` в полном клиенте. */
13
13
  var ChatEvents = class {
14
14
  #channel;
15
15
  #updates;
@@ -41,8 +41,11 @@ var ChatEvents = class {
41
41
  origin,
42
42
  stream: this
43
43
  }),
44
- deliver: (update) => this.#deliverLive(update)
44
+ deliver: (update) => this.#channel.emit("update", update)
45
45
  }, options);
46
+ this.#channel.use(async ({ update }, next) => {
47
+ if (this.#acceptLiveUpdate(update)) await next();
48
+ });
46
49
  }
47
50
  /** Текущее состояние соединения. */
48
51
  get status() {
@@ -60,13 +63,17 @@ var ChatEvents = class {
60
63
  on(event, listener) {
61
64
  return this.#channel.on(event, listener);
62
65
  }
66
+ /** Добавляет обработчик обновлений WebSocket и возвращает функцию его удаления. */
67
+ use(middleware) {
68
+ return this.#channel.use(middleware);
69
+ }
63
70
  /**
64
71
  * Подключается к WebSocket и догружает пропущенные события.
65
72
  *
66
- * @param since номер последнего события (`eventSeq` из списка чатов или журнала)
73
+ * @param since номер последнего события. Возьмите `eventSeq` из списка чатов или события.
67
74
  */
68
75
  async connect(since) {
69
- if (since !== void 0 && !isSequence(since)) throw new require_validate.ItdConfigError("Позиция журнала чатов должна быть целым неотрицательным числом");
76
+ if (since !== void 0 && !isSequence(since)) throw new require_validate.ItdConfigError("Номер события должен быть целым неотрицательным числом");
70
77
  if (!this.#channel.active && since !== void 0) this.#position = since;
71
78
  return this.#channel.connect();
72
79
  }
@@ -79,7 +86,7 @@ var ChatEvents = class {
79
86
  drain() {
80
87
  return this.#channel.drain();
81
88
  }
82
- /** Читает журнал до конца, пока движок буферизует события открытого сокета. */
89
+ /** Загружает пропущенные события, пока новые события WebSocket ждут обработки. */
83
90
  async #sync(signal) {
84
91
  while (this.#position !== void 0 && !signal.aborted) {
85
92
  const since = this.#position;
@@ -91,10 +98,10 @@ var ChatEvents = class {
91
98
  return;
92
99
  }
93
100
  const next = page.nextEventSeq;
94
- if (!isSequence(next) || next < since) throw new Error("Некорректная позиция в журнале чатов");
101
+ if (!isSequence(next) || next < since) throw new Error("Сервер вернул некорректный номер следующего события");
95
102
  for (const update of page.events) {
96
103
  if (signal.aborted) return;
97
- this.#publish(update);
104
+ if (this.#advance(update)) this.#channel.emit("update", update);
98
105
  }
99
106
  if (signal.aborted) return;
100
107
  this.#position = Math.max(this.#position ?? since, next);
@@ -103,27 +110,27 @@ var ChatEvents = class {
103
110
  if (!page.events.length || next === since) return;
104
111
  }
105
112
  }
106
- /** При разрыве последовательности восстанавливает поток с последней позиции. */
107
- #deliverLive(update) {
113
+ /** Учитывает кадр до пользовательских обработчиков и запускает догрузку при пропуске. */
114
+ #acceptLiveUpdate(update) {
108
115
  const sequence = update.eventSeq;
109
116
  if (isSequence(sequence) && this.#position !== void 0 && sequence > this.#position) {
110
117
  const count = isSequence(update.eventSeqCount) ? Math.max(1, update.eventSeqCount) : 1;
111
118
  if (sequence - this.#position !== count) {
112
119
  this.#channel.recover(/* @__PURE__ */ new Error("Пропущены события чата"));
113
- return;
120
+ return false;
114
121
  }
115
122
  }
116
- this.#publish(update);
123
+ return this.#advance(update);
117
124
  }
118
125
  /** Пропускает повторные события из REST и буфера WebSocket. */
119
- #publish(update) {
126
+ #advance(update) {
120
127
  const sequence = update.eventSeq;
121
128
  if (isSequence(sequence)) {
122
- if (this.#position !== void 0 && sequence <= this.#position) return;
129
+ if (this.#position !== void 0 && sequence <= this.#position) return false;
123
130
  this.#position = sequence;
124
131
  this.#channel.confirmRecovery();
125
132
  }
126
- this.#channel.emit("update", update);
133
+ return true;
127
134
  }
128
135
  };
129
136
  function isSequence(value) {
@@ -3436,6 +3443,7 @@ exports.FileTransferMode = require_options.FileTransferMode;
3436
3443
  exports.IMAGE_MIME_TYPES = require_render.IMAGE_MIME_TYPES;
3437
3444
  exports.IncidentKind = require_url.IncidentKind;
3438
3445
  exports.InteractionType = require_url.InteractionType;
3446
+ exports.InternationalSubscriptionCheckoutMode = require_render.InternationalSubscriptionCheckoutMode;
3439
3447
  exports.ItdAbortError = require_validate.ItdAbortError;
3440
3448
  exports.ItdAccounts = ItdAccounts;
3441
3449
  exports.ItdApiError = require_validate.ItdApiError;
@@ -3479,6 +3487,7 @@ exports.OPERATIONS = require_url.OPERATIONS;
3479
3487
  exports.OperationMethod = require_url.OperationMethod;
3480
3488
  exports.PaginationMode = require_render.PaginationMode;
3481
3489
  exports.Paginator = require_render.Paginator;
3490
+ exports.PaymentMethodType = require_render.PaymentMethodType;
3482
3491
  exports.PhoneDeliveryChannel = PhoneDeliveryChannel;
3483
3492
  exports.PhoneLoginStep = PhoneLoginStep;
3484
3493
  exports.PhoneReverseState = PhoneReverseState;
@@ -3501,6 +3510,9 @@ exports.ShopProductStatus = require_render.ShopProductStatus;
3501
3510
  exports.SignInStatus = SignInStatus;
3502
3511
  exports.SpanRenderFormat = require_render.SpanRenderFormat;
3503
3512
  exports.SpanType = require_url.SpanType;
3513
+ exports.SubscriptionCheckoutKind = require_render.SubscriptionCheckoutKind;
3514
+ exports.SubscriptionCheckoutStatus = require_render.SubscriptionCheckoutStatus;
3515
+ exports.SubscriptionPaymentProvider = require_render.SubscriptionPaymentProvider;
3504
3516
  exports.TURNSTILE_SITE_KEY = TURNSTILE_SITE_KEY;
3505
3517
  exports.TimeoutBudget = require_validate.TimeoutBudget;
3506
3518
  exports.UnauthorizedStreamError = require_events.UnauthorizedStreamError;
@@ -3544,6 +3556,8 @@ exports.isKnownNotificationType = require_url.isKnownNotificationType;
3544
3556
  exports.isMyProfile = require_render.isMyProfile;
3545
3557
  exports.mapPage = require_render.mapPage;
3546
3558
  exports.markup = require_render.markup;
3559
+ exports.message = require_render.message;
3560
+ exports.messageMarkup = require_render.messageMarkup;
3547
3561
  exports.normalizeNotification = require_url.normalizeNotification;
3548
3562
  exports.operationBucket = require_url.operationBucket;
3549
3563
  exports.operationMethod = require_url.operationMethod;