itd-api 0.14.4 → 0.14.5

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 (67) hide show
  1. package/dist/events/index.cjs +4 -4
  2. package/dist/events/index.d.cts +2 -2
  3. package/dist/events/index.d.ts +2 -2
  4. package/dist/events/index.js +4 -4
  5. package/dist/index.cjs +32 -52
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +3 -3
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.js +31 -51
  10. package/dist/index.js.map +1 -1
  11. package/dist/node/index.cjs +5 -5
  12. package/dist/node/index.js +5 -5
  13. package/dist/rest/index.cjs +5 -5
  14. package/dist/rest/index.d.cts +2 -2
  15. package/dist/rest/index.d.ts +2 -2
  16. package/dist/rest/index.js +5 -5
  17. package/dist/shared/{cookies-BLmvIZBD.cjs → cookies-Dv5LQp55.cjs} +2 -2
  18. package/dist/shared/{cookies-BLmvIZBD.cjs.map → cookies-Dv5LQp55.cjs.map} +1 -1
  19. package/dist/shared/{cookies-lIXHWhOd.js → cookies-mDZE19_j.js} +2 -2
  20. package/dist/shared/{cookies-lIXHWhOd.js.map → cookies-mDZE19_j.js.map} +1 -1
  21. package/dist/shared/{events-C7MJnuJw.js → events-BbpL69OD.js} +4 -4
  22. package/dist/shared/{events-C7MJnuJw.js.map → events-BbpL69OD.js.map} +1 -1
  23. package/dist/shared/{events-9dRKcUPZ.cjs → events-C3Wup3mC.cjs} +4 -4
  24. package/dist/shared/{events-9dRKcUPZ.cjs.map → events-C3Wup3mC.cjs.map} +1 -1
  25. package/dist/shared/{events-BSotWa3Z.d.cts → events-CMhrmHei.d.cts} +1 -1
  26. package/dist/shared/{events-B18vQGEH.d.ts → events-Cupq8UXH.d.ts} +1 -1
  27. package/dist/shared/{key-value-store-BJdmlzkM.js → key-value-store-BDvrZ-GQ.js} +2 -2
  28. package/dist/shared/{key-value-store-BJdmlzkM.js.map → key-value-store-BDvrZ-GQ.js.map} +1 -1
  29. package/dist/shared/{key-value-store-Bxt33ZF3.cjs → key-value-store-CeiDXFAC.cjs} +2 -2
  30. package/dist/shared/{key-value-store-Bxt33ZF3.cjs.map → key-value-store-CeiDXFAC.cjs.map} +1 -1
  31. package/dist/shared/{multi-storage-CPiHgcXH.js → multi-storage-CLPyg8_T.js} +5 -5
  32. package/dist/shared/{multi-storage-CPiHgcXH.js.map → multi-storage-CLPyg8_T.js.map} +1 -1
  33. package/dist/shared/{multi-storage-lwn-cmG6.cjs → multi-storage-DXBY9ceK.cjs} +5 -5
  34. package/dist/shared/{multi-storage-lwn-cmG6.cjs.map → multi-storage-DXBY9ceK.cjs.map} +1 -1
  35. package/dist/shared/{options-DorH4keX.js → options-Dana2yeL.js} +3 -3
  36. package/dist/shared/{options-DorH4keX.js.map → options-Dana2yeL.js.map} +1 -1
  37. package/dist/shared/{options-DYeE1hFt.cjs → options-eaq9yK8b.cjs} +3 -3
  38. package/dist/shared/{options-DYeE1hFt.cjs.map → options-eaq9yK8b.cjs.map} +1 -1
  39. package/dist/shared/{render-C5G2o3yL.d.ts → render-B3nhAeaQ.d.ts} +29 -17
  40. package/dist/shared/{render-DOLkOCVs.cjs → render-BXeYbuuY.cjs} +19 -14
  41. package/dist/shared/render-BXeYbuuY.cjs.map +1 -0
  42. package/dist/shared/{render-CWiDhdKI.d.cts → render-ByW1tXn-.d.cts} +2 -16
  43. package/dist/shared/{render-DFhMFt1f.js → render-C706i1rL.js} +19 -14
  44. package/dist/shared/render-C706i1rL.js.map +1 -0
  45. package/dist/shared/{storage-xximVWs_.cjs → storage-Bj7GKkEQ.cjs} +3 -3
  46. package/dist/shared/{storage-xximVWs_.cjs.map → storage-Bj7GKkEQ.cjs.map} +1 -1
  47. package/dist/shared/{storage-8oAVzQmF.js → storage-ChR4KC8V.js} +3 -3
  48. package/dist/shared/{storage-8oAVzQmF.js.map → storage-ChR4KC8V.js.map} +1 -1
  49. package/dist/shared/{url-DcjNue8i.js → url-CZpgaPdI.js} +940 -519
  50. package/dist/shared/url-CZpgaPdI.js.map +1 -0
  51. package/dist/shared/{url-C49-l_KW.d.ts → url-D4bo3tpX.d.ts} +492 -450
  52. package/dist/shared/{url-ZRjcpC__.d.cts → url-DHWmfmrE.d.cts} +871 -803
  53. package/dist/shared/{url-vXQWF--L.cjs → url-Duzw4X6d.cjs} +952 -519
  54. package/dist/shared/url-Duzw4X6d.cjs.map +1 -0
  55. package/dist/shared/{validate-oLSGiGwQ.js → validate-CCgIq5u0.js} +5 -4
  56. package/dist/shared/validate-CCgIq5u0.js.map +1 -0
  57. package/dist/shared/{validate-CbM3k811.cjs → validate-DQrtiCtV.cjs} +5 -4
  58. package/dist/shared/validate-DQrtiCtV.cjs.map +1 -0
  59. package/dist/web/index.cjs +3 -3
  60. package/dist/web/index.js +3 -3
  61. package/package.json +1 -1
  62. package/dist/shared/render-DFhMFt1f.js.map +0 -1
  63. package/dist/shared/render-DOLkOCVs.cjs.map +0 -1
  64. package/dist/shared/url-DcjNue8i.js.map +0 -1
  65. package/dist/shared/url-vXQWF--L.cjs.map +0 -1
  66. package/dist/shared/validate-CbM3k811.cjs.map +0 -1
  67. package/dist/shared/validate-oLSGiGwQ.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_validate = require("../shared/validate-CbM3k811.cjs");
3
- const require_url = require("../shared/url-vXQWF--L.cjs");
4
- const require_cookies = require("../shared/cookies-BLmvIZBD.cjs");
5
- const require_events = require("../shared/events-9dRKcUPZ.cjs");
2
+ const require_validate = require("../shared/validate-DQrtiCtV.cjs");
3
+ const require_url = require("../shared/url-Duzw4X6d.cjs");
4
+ const require_cookies = require("../shared/cookies-Dv5LQp55.cjs");
5
+ const require_events = require("../shared/events-C3Wup3mC.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 { $t as ItdClock, A as ClientConnection, An as Loose, Cn as EventChannelStatus, F as tokenProvider, G as ItdError, H as ItdAuthError, K as ItdErrorKind, M as AuthProvider, Mn as NotificationType, N as anonymousAuth, O as Listener, P as bearerToken, Q as ItdNotFoundError, Qt as Logger, R as ItdAbortError, St as LIBRARY_VERSION, U as ItdConfigError, V as ItdApiErrorKind, Wt as RuntimeOptions, X as ItdForbiddenError, Yt as RuntimeMode, Z as ItdNetworkError, Zt as LogLevel, _t as isItdStateError, a as NotificationEvent, bt as DEFAULT_BASE_URL, c as NotificationSettings, ct as isItdAuthError, en as systemClock, et as ItdRateLimitError, ht as isItdRateLimitError, i as formatNotificationText, it as ItdValidationError, j as AuthIdentity, k as Unsubscribe, kt as ClientHooks, n as canonicalNotificationType, nt as ItdStateError, o as normalizeNotification, ot as TimeoutBudget, r as isKnownNotificationType, rt as ItdTimeoutError, s as Notification, st as isItdApiError, t as resolveNotificationUrl, tt as ItdServerError, ut as isItdError, vt as isItdValidationError, z as ItdApiError } from "../shared/url-ZRjcpC__.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-BSotWa3Z.cjs";
6
+ import { $t as ItdValidationError, A as ClientConnection, B as DEFAULT_BASE_URL, Bt as ItdError, F as tokenProvider, Gt as ItdForbiddenError, H as LIBRARY_VERSION, It as ItdApiErrorKind, Kt as ItdNetworkError, Lt as ItdAuthError, M as AuthProvider, N as anonymousAuth, Nn as NotificationType, Nt as ItdAbortError, O as Listener, P as bearerToken, Pt as ItdApiError, Qt as ItdTimeoutError, Rt as ItdConfigError, Vt as ItdErrorKind, Xt as ItdServerError, Y as ClientHooks, Yt as ItdRateLimitError, Zt as ItdStateError, _t as LogLevel, a as NotificationEvent, an as isItdError, bt as systemClock, c as NotificationSettings, fn as isItdStateError, ht as RuntimeMode, i as formatNotificationText, j as AuthIdentity, jn as Loose, k as Unsubscribe, n as canonicalNotificationType, nn as isItdApiError, o as normalizeNotification, pn as isItdValidationError, qt as ItdNotFoundError, r as isKnownNotificationType, rn as isItdAuthError, s as Notification, t as resolveNotificationUrl, tn as TimeoutBudget, un as isItdRateLimitError, ut as RuntimeOptions, vt as Logger, wn as EventChannelStatus, yt as ItdClock } from "../shared/url-DHWmfmrE.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-CMhrmHei.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 ItdServerError, A as ClientConnection, B as ItdAuthError, Dn as Loose, Et as ClientHooks, F as tokenProvider, I as ItdAbortError, J as ItdForbiddenError, Jt as LogLevel, Kt as RuntimeMode, L as ItdApiError, M as AuthProvider, N as anonymousAuth, O as Listener, P as bearerToken, Q as ItdRateLimitError, U as ItdError, V as ItdConfigError, Vt as RuntimeOptions, W as ItdErrorKind, X as ItdNotFoundError, Xt as ItdClock, Y as ItdNetworkError, Yt as Logger, Zt as systemClock, _t as DEFAULT_BASE_URL, a as NotificationEvent, at as isItdApiError, bn as EventChannelStatus, c as NotificationSettings, ct as isItdError, et as ItdStateError, gt as isItdValidationError, ht as isItdStateError, i as formatNotificationText, it as TimeoutBudget, j as AuthIdentity, k as Unsubscribe, kn as NotificationType, n as canonicalNotificationType, nt as ItdValidationError, o as normalizeNotification, ot as isItdAuthError, pt as isItdRateLimitError, r as isKnownNotificationType, s as Notification, t as resolveNotificationUrl, tt as ItdTimeoutError, yt as LIBRARY_VERSION, z as ItdApiErrorKind } from "../shared/url-C49-l_KW.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-B18vQGEH.js";
6
+ import { $t as isItdAuthError, A as ClientConnection, At as ItdApiError, Dn as Loose, F as tokenProvider, G as ClientHooks, Gt as ItdRateLimitError, Ht as ItdNetworkError, I as DEFAULT_BASE_URL, It as ItdError, Jt as ItdTimeoutError, Kt as ItdServerError, Lt as ItdErrorKind, M as AuthProvider, Mt as ItdApiErrorKind, N as anonymousAuth, Nt as ItdAuthError, O as Listener, P as bearerToken, Pt as ItdConfigError, Qt as isItdApiError, R as LIBRARY_VERSION, Ut as ItdNotFoundError, Vt as ItdForbiddenError, Yt as ItdValidationError, Zt as TimeoutBudget, a as NotificationEvent, bn as EventChannelStatus, c as NotificationSettings, cn as isItdStateError, dt as RuntimeMode, gt as systemClock, ht as ItdClock, i as formatNotificationText, j as AuthIdentity, k as Unsubscribe, kn as NotificationType, kt as ItdAbortError, ln as isItdValidationError, mt as Logger, n as canonicalNotificationType, o as normalizeNotification, on as isItdRateLimitError, ot as RuntimeOptions, pt as LogLevel, qt as ItdStateError, r as isKnownNotificationType, s as Notification, t as resolveNotificationUrl, tn as isItdError } from "../shared/url-D4bo3tpX.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-Cupq8UXH.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
- import { C as ItdValidationError, D as isItdAuthError, E as isItdApiError, I as isItdStateError, L as isItdValidationError, P as isItdRateLimitError, S as ItdTimeoutError, T as TimeoutBudget, _ as ItdNotFoundError, a as ItdAbortError, b as ItdServerError, c as ItdAuthError, d as ItdError, f as ItdErrorKind, g as ItdNetworkError, h as ItdForbiddenError, k as isItdError, l as ItdConfigError, o as ItdApiError, s as ItdApiErrorKind, x as ItdStateError, y as ItdRateLimitError } from "../shared/validate-oLSGiGwQ.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-DcjNue8i.js";
3
- import { E as LogLevel, v as RuntimeMode } from "../shared/cookies-lIXHWhOd.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-C7MJnuJw.js";
1
+ import { C as ItdValidationError, D as isItdAuthError, E as isItdApiError, I as isItdStateError, L as isItdValidationError, P as isItdRateLimitError, S as ItdTimeoutError, T as TimeoutBudget, _ as ItdNotFoundError, a as ItdAbortError, b as ItdServerError, c as ItdAuthError, d as ItdError, f as ItdErrorKind, g as ItdNetworkError, h as ItdForbiddenError, k as isItdError, l as ItdConfigError, o as ItdApiError, s as ItdApiErrorKind, x as ItdStateError, y as ItdRateLimitError } from "../shared/validate-CCgIq5u0.js";
2
+ import { S as bearerToken, h as DEFAULT_BASE_URL, n as formatNotificationText, nt as EventChannelStatus, o as canonicalNotificationType, r as normalizeNotification, s as isKnownNotificationType, t as resolveNotificationUrl, ut as NotificationType, w as tokenProvider, x as anonymousAuth, xt as systemClock, y as LIBRARY_VERSION } from "../shared/url-CZpgaPdI.js";
3
+ import { E as LogLevel, v as RuntimeMode } from "../shared/cookies-mDZE19_j.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-BbpL69OD.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,13 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_validate = require("./shared/validate-CbM3k811.cjs");
3
- const require_render = require("./shared/render-DOLkOCVs.cjs");
4
- const require_events = require("./shared/events-9dRKcUPZ.cjs");
5
- const require_url = require("./shared/url-vXQWF--L.cjs");
6
- const require_cookies = require("./shared/cookies-BLmvIZBD.cjs");
7
- const require_storage = require("./shared/storage-xximVWs_.cjs");
8
- const require_multi_storage = require("./shared/multi-storage-lwn-cmG6.cjs");
9
- const require_options = require("./shared/options-DYeE1hFt.cjs");
10
- const require_key_value_store = require("./shared/key-value-store-Bxt33ZF3.cjs");
2
+ const require_validate = require("./shared/validate-DQrtiCtV.cjs");
3
+ const require_render = require("./shared/render-BXeYbuuY.cjs");
4
+ const require_events = require("./shared/events-C3Wup3mC.cjs");
5
+ const require_url = require("./shared/url-Duzw4X6d.cjs");
6
+ const require_cookies = require("./shared/cookies-Dv5LQp55.cjs");
7
+ const require_storage = require("./shared/storage-Bj7GKkEQ.cjs");
8
+ const require_multi_storage = require("./shared/multi-storage-DXBY9ceK.cjs");
9
+ const require_options = require("./shared/options-eaq9yK8b.cjs");
10
+ const require_key_value_store = require("./shared/key-value-store-CeiDXFAC.cjs");
11
11
  // src/events/chats.ts
12
12
  /** Канал событий чатов. Доступен как `itd.chats.events` в полном клиенте. */
13
13
  var ChatEvents = class {
@@ -727,45 +727,6 @@ async function solveCaptchaToken(solver, askProvider, context) {
727
727
  function captchaBody(captcha) {
728
728
  return { [resolveField(captcha.type, captcha.field)]: captcha.token };
729
729
  }
730
- // src/session/jwt.ts
731
- /**
732
- * Разбирает строку base64url.
733
- *
734
- * `atob` понимает только обычный base64, поэтому алфавит приводится к нему, а недостающее
735
- * выравнивание добивается. Результат декодируется как UTF-8: в полезной нагрузке токена
736
- * может оказаться кириллица, и «бинарная» строка из `atob` сломала бы `JSON.parse`.
737
- */
738
- function decodeBase64Url(segment) {
739
- const base64 = segment.replace(/-/g, "+").replace(/_/g, "/");
740
- const padded = base64.padEnd(base64.length + (4 - base64.length % 4) % 4, "=");
741
- const binary = atob(padded);
742
- const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
743
- return new TextDecoder().decode(bytes);
744
- }
745
- /** Читает полезную нагрузку JWT без проверки подписи. */
746
- function readTokenPayload(token) {
747
- try {
748
- const payload = token.split(".")[1];
749
- if (!payload) return void 0;
750
- const parsed = JSON.parse(decodeBase64Url(payload));
751
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
752
- return parsed;
753
- } catch {
754
- return;
755
- }
756
- }
757
- /** Читает используемые клиентом поля JWT за один раз. */
758
- function readTokenMetadata(token) {
759
- const payload = readTokenPayload(token);
760
- if (!payload) return {};
761
- const { sub, sid, exp } = payload;
762
- const expiresAt = typeof exp === "number" && Number.isFinite(exp) ? exp * 1e3 : void 0;
763
- return {
764
- ...typeof sub === "string" && sub.length > 0 ? { subject: sub } : {},
765
- ...typeof sid === "string" && sid.length > 0 ? { sessionId: sid } : {},
766
- ...expiresAt !== void 0 && Number.isFinite(expiresAt) ? { expiresAt } : {}
767
- };
768
- }
769
730
  // src/session/auth.ts
770
731
  /** Запас до истечения токена на очередь и выполнение запроса. */
771
732
  const ACCESS_TOKEN_REFRESH_LEEWAY_MS = 3e4;
@@ -1014,6 +975,16 @@ var AuthManager = class {
1014
975
  this.#jar = jar;
1015
976
  this.#hooks = hooks;
1016
977
  this.#emitter = new require_events.Emitter((error) => require_events.reportListenerError(config.logger, "авторизации", error));
978
+ const auth = config.auth;
979
+ if (hooks.onAccountChange && typeof auth === "object" && "getToken" in auth) require_url.setQueuedAuthPreparation(this, { prepare: async () => {
980
+ const token = await this.#prepareAccessToken();
981
+ return () => {
982
+ const current = this.#session?.accessToken ?? this.#externalToken ?? null;
983
+ if (token === current) return true;
984
+ const { userId } = this.#identityForToken(token ?? void 0);
985
+ return userId !== void 0 && userId === this.getCurrentAuthIdentity().userId;
986
+ };
987
+ } });
1017
988
  }
1018
989
  /** Подписка на события авторизации. */
1019
990
  get on() {
@@ -1108,7 +1079,7 @@ var AuthManager = class {
1108
1079
  return {};
1109
1080
  }
1110
1081
  if (this.#tokenMetadata?.accessToken === accessToken) return this.#tokenMetadata.value;
1111
- const value = readTokenMetadata(accessToken);
1082
+ const value = require_url.readTokenMetadata(accessToken);
1112
1083
  this.#tokenMetadata = {
1113
1084
  accessToken,
1114
1085
  value
@@ -1184,10 +1155,16 @@ var AuthManager = class {
1184
1155
  }
1185
1156
  /** Перед каждой попыткой перечитывает внешний источник токена. */
1186
1157
  async prepare() {
1158
+ await this.#prepareAccessToken();
1159
+ }
1160
+ /** Возвращает токен, прочитанный при подготовке этой попытки. */
1161
+ async #prepareAccessToken() {
1187
1162
  this.#assertActive();
1188
- if ((await this.#loadSession())?.accessToken) return;
1163
+ const session = await this.#loadSession();
1164
+ if (session?.accessToken) return session.accessToken;
1189
1165
  const auth = this.#config.auth;
1190
- if (typeof auth === "object" && auth !== null && "getToken" in auth) await this.#readExternalToken(() => auth.getToken());
1166
+ if (typeof auth === "object" && auth !== null && "getToken" in auth) return this.#readExternalToken(() => auth.getToken());
1167
+ return null;
1191
1168
  }
1192
1169
  /**
1193
1170
  * Заголовки уже подготовленной авторизации без чтения storage или вызова внешнего источника.
@@ -2554,7 +2531,10 @@ var ItdClient = class ItdClient {
2554
2531
  assertActive: (action) => assertClientActive(this, action),
2555
2532
  auth: (deps) => createItdAuth(options, {
2556
2533
  ...deps,
2557
- onAccountChange: () => featureHost?.stop()
2534
+ onAccountChange: () => {
2535
+ deps.onAccountChange?.();
2536
+ featureHost?.stop();
2537
+ }
2558
2538
  })
2559
2539
  });
2560
2540
  this.#features = featureHost = require_render.createFeatureHost(this.#runtime, {