itd-api 0.14.3 → 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 (69) 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 +38 -53
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +6 -4
  8. package/dist/index.d.ts +6 -4
  9. package/dist/index.js +37 -53
  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-D68xbO4E.cjs → cookies-Dv5LQp55.cjs} +7 -9
  18. package/dist/shared/cookies-Dv5LQp55.cjs.map +1 -0
  19. package/dist/shared/{cookies-BdntFeQ5.js → cookies-mDZE19_j.js} +6 -8
  20. package/dist/shared/cookies-mDZE19_j.js.map +1 -0
  21. package/dist/shared/{events-BdiOYajm.js → events-BbpL69OD.js} +4 -4
  22. package/dist/shared/{events-BdiOYajm.js.map → events-BbpL69OD.js.map} +1 -1
  23. package/dist/shared/{events-BeEkp9jA.cjs → events-C3Wup3mC.cjs} +4 -4
  24. package/dist/shared/{events-BeEkp9jA.cjs.map → events-C3Wup3mC.cjs.map} +1 -1
  25. package/dist/shared/{events-CWQN0YE4.d.cts → events-CMhrmHei.d.cts} +1 -1
  26. package/dist/shared/{events-rSRPzpN3.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-hYW_Whkx.js → multi-storage-CLPyg8_T.js} +5 -5
  32. package/dist/shared/{multi-storage-hYW_Whkx.js.map → multi-storage-CLPyg8_T.js.map} +1 -1
  33. package/dist/shared/{multi-storage-BNiP6Mbq.cjs → multi-storage-DXBY9ceK.cjs} +5 -5
  34. package/dist/shared/{multi-storage-BNiP6Mbq.cjs.map → multi-storage-DXBY9ceK.cjs.map} +1 -1
  35. package/dist/shared/{options-BqQVtTmm.js → options-Dana2yeL.js} +3 -3
  36. package/dist/shared/{options-BqQVtTmm.js.map → options-Dana2yeL.js.map} +1 -1
  37. package/dist/shared/{options-C2WubUA6.cjs → options-eaq9yK8b.cjs} +3 -3
  38. package/dist/shared/{options-C2WubUA6.cjs.map → options-eaq9yK8b.cjs.map} +1 -1
  39. package/dist/shared/{render-djloH2Vb.d.ts → render-B3nhAeaQ.d.ts} +42 -17
  40. package/dist/shared/{render-kuaH5fPv.cjs → render-BXeYbuuY.cjs} +34 -16
  41. package/dist/shared/render-BXeYbuuY.cjs.map +1 -0
  42. package/dist/shared/{render-BJHqSS2F.d.cts → render-ByW1tXn-.d.cts} +15 -16
  43. package/dist/shared/{render-DhoQdYkn.js → render-C706i1rL.js} +34 -16
  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-DH4We-ip.js → url-CZpgaPdI.js} +940 -519
  50. package/dist/shared/url-CZpgaPdI.js.map +1 -0
  51. package/dist/shared/{url-wVgUPR6Q.d.ts → url-D4bo3tpX.d.ts} +497 -450
  52. package/dist/shared/{url-eD0nHl_4.d.cts → url-DHWmfmrE.d.cts} +874 -801
  53. package/dist/shared/{url-C8u7GIqz.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/cookies-BdntFeQ5.js.map +0 -1
  63. package/dist/shared/cookies-D68xbO4E.cjs.map +0 -1
  64. package/dist/shared/render-DhoQdYkn.js.map +0 -1
  65. package/dist/shared/render-kuaH5fPv.cjs.map +0 -1
  66. package/dist/shared/url-C8u7GIqz.cjs.map +0 -1
  67. package/dist/shared/url-DH4We-ip.js.map +0 -1
  68. package/dist/shared/validate-CbM3k811.cjs.map +0 -1
  69. 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-C8u7GIqz.cjs");
4
- const require_cookies = require("../shared/cookies-D68xbO4E.cjs");
5
- const require_events = require("../shared/events-BeEkp9jA.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 systemClock, A as ClientConnection, F as tokenProvider, G as ItdError, H as ItdAuthError, K as ItdErrorKind, M as AuthProvider, N as anonymousAuth, O as Listener, P as bearerToken, Q as ItdNotFoundError, Qt as ItdClock, R as ItdAbortError, Sn as EventChannelStatus, St as LIBRARY_VERSION, U as ItdConfigError, V as ItdApiErrorKind, Wt as RuntimeOptions, X as ItdForbiddenError, Xt as LogLevel, Yt as RuntimeMode, Z as ItdNetworkError, Zt as Logger, _t as isItdStateError, a as NotificationEvent, bt as DEFAULT_BASE_URL, c as NotificationSettings, ct as isItdAuthError, et as ItdRateLimitError, ht as isItdRateLimitError, i as formatNotificationText, it as ItdValidationError, j as AuthIdentity, jn as NotificationType, k as Unsubscribe, kn as Loose, 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-eD0nHl_4.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-CWQN0YE4.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, En as Loose, Et as ClientHooks, F as tokenProvider, I as ItdAbortError, J as ItdForbiddenError, Jt as Logger, Kt as RuntimeMode, L as ItdApiError, M as AuthProvider, N as anonymousAuth, O as Listener, On as NotificationType, P as bearerToken, 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 isItdApiError, 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, n as canonicalNotificationType, nt as ItdValidationError, o as normalizeNotification, ot as isItdAuthError, pt as isItdRateLimitError, qt as LogLevel, r as isKnownNotificationType, s as Notification, t as resolveNotificationUrl, tt as ItdTimeoutError, yn as EventChannelStatus, yt as LIBRARY_VERSION, z as ItdApiErrorKind } from "../shared/url-wVgUPR6Q.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-rSRPzpN3.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-DH4We-ip.js";
3
- import { E as LogLevel, v as RuntimeMode } from "../shared/cookies-BdntFeQ5.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-BdiOYajm.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-kuaH5fPv.cjs");
4
- const require_events = require("./shared/events-BeEkp9jA.cjs");
5
- const require_url = require("./shared/url-C8u7GIqz.cjs");
6
- const require_cookies = require("./shared/cookies-D68xbO4E.cjs");
7
- const require_storage = require("./shared/storage-xximVWs_.cjs");
8
- const require_multi_storage = require("./shared/multi-storage-BNiP6Mbq.cjs");
9
- const require_options = require("./shared/options-C2WubUA6.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 {
@@ -51,6 +51,10 @@ var ChatEvents = class {
51
51
  get status() {
52
52
  return this.#channel.status;
53
53
  }
54
+ /** Канал подключён, подключается или ожидает переподключения. */
55
+ get active() {
56
+ return this.#channel.active;
57
+ }
54
58
  /**
55
59
  * Подписывается на обновления или события подключения.
56
60
  *
@@ -723,45 +727,6 @@ async function solveCaptchaToken(solver, askProvider, context) {
723
727
  function captchaBody(captcha) {
724
728
  return { [resolveField(captcha.type, captcha.field)]: captcha.token };
725
729
  }
726
- // src/session/jwt.ts
727
- /**
728
- * Разбирает строку base64url.
729
- *
730
- * `atob` понимает только обычный base64, поэтому алфавит приводится к нему, а недостающее
731
- * выравнивание добивается. Результат декодируется как UTF-8: в полезной нагрузке токена
732
- * может оказаться кириллица, и «бинарная» строка из `atob` сломала бы `JSON.parse`.
733
- */
734
- function decodeBase64Url(segment) {
735
- const base64 = segment.replace(/-/g, "+").replace(/_/g, "/");
736
- const padded = base64.padEnd(base64.length + (4 - base64.length % 4) % 4, "=");
737
- const binary = atob(padded);
738
- const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
739
- return new TextDecoder().decode(bytes);
740
- }
741
- /** Читает полезную нагрузку JWT без проверки подписи. */
742
- function readTokenPayload(token) {
743
- try {
744
- const payload = token.split(".")[1];
745
- if (!payload) return void 0;
746
- const parsed = JSON.parse(decodeBase64Url(payload));
747
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
748
- return parsed;
749
- } catch {
750
- return;
751
- }
752
- }
753
- /** Читает используемые клиентом поля JWT за один раз. */
754
- function readTokenMetadata(token) {
755
- const payload = readTokenPayload(token);
756
- if (!payload) return {};
757
- const { sub, sid, exp } = payload;
758
- const expiresAt = typeof exp === "number" && Number.isFinite(exp) ? exp * 1e3 : void 0;
759
- return {
760
- ...typeof sub === "string" && sub.length > 0 ? { subject: sub } : {},
761
- ...typeof sid === "string" && sid.length > 0 ? { sessionId: sid } : {},
762
- ...expiresAt !== void 0 && Number.isFinite(expiresAt) ? { expiresAt } : {}
763
- };
764
- }
765
730
  // src/session/auth.ts
766
731
  /** Запас до истечения токена на очередь и выполнение запроса. */
767
732
  const ACCESS_TOKEN_REFRESH_LEEWAY_MS = 3e4;
@@ -1010,6 +975,16 @@ var AuthManager = class {
1010
975
  this.#jar = jar;
1011
976
  this.#hooks = hooks;
1012
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
+ } });
1013
988
  }
1014
989
  /** Подписка на события авторизации. */
1015
990
  get on() {
@@ -1104,7 +1079,7 @@ var AuthManager = class {
1104
1079
  return {};
1105
1080
  }
1106
1081
  if (this.#tokenMetadata?.accessToken === accessToken) return this.#tokenMetadata.value;
1107
- const value = readTokenMetadata(accessToken);
1082
+ const value = require_url.readTokenMetadata(accessToken);
1108
1083
  this.#tokenMetadata = {
1109
1084
  accessToken,
1110
1085
  value
@@ -1180,10 +1155,16 @@ var AuthManager = class {
1180
1155
  }
1181
1156
  /** Перед каждой попыткой перечитывает внешний источник токена. */
1182
1157
  async prepare() {
1158
+ await this.#prepareAccessToken();
1159
+ }
1160
+ /** Возвращает токен, прочитанный при подготовке этой попытки. */
1161
+ async #prepareAccessToken() {
1183
1162
  this.#assertActive();
1184
- if ((await this.#loadSession())?.accessToken) return;
1163
+ const session = await this.#loadSession();
1164
+ if (session?.accessToken) return session.accessToken;
1185
1165
  const auth = this.#config.auth;
1186
- 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;
1187
1168
  }
1188
1169
  /**
1189
1170
  * Заголовки уже подготовленной авторизации без чтения storage или вызова внешнего источника.
@@ -1224,7 +1205,7 @@ var AuthManager = class {
1224
1205
  const revision = this.#authEpoch;
1225
1206
  const session = await this.#loadSession();
1226
1207
  this.#assertActive();
1227
- const deviceId = this.#config.deviceId ?? session?.deviceId ?? require_cookies.createDeviceId();
1208
+ const deviceId = this.#config.deviceId ?? session?.deviceId ?? require_cookies.createUuidV4();
1228
1209
  this.#deviceId = deviceId;
1229
1210
  if (this.#authEpoch !== revision) return deviceId;
1230
1211
  if (session?.deviceId !== deviceId) await this.#saveSession({
@@ -2550,7 +2531,10 @@ var ItdClient = class ItdClient {
2550
2531
  assertActive: (action) => assertClientActive(this, action),
2551
2532
  auth: (deps) => createItdAuth(options, {
2552
2533
  ...deps,
2553
- onAccountChange: () => featureHost?.stop()
2534
+ onAccountChange: () => {
2535
+ deps.onAccountChange?.();
2536
+ featureHost?.stop();
2537
+ }
2554
2538
  })
2555
2539
  });
2556
2540
  this.#features = featureHost = require_render.createFeatureHost(this.#runtime, {
@@ -3535,6 +3519,7 @@ exports.createRecordKeyValueStore = require_key_value_store.createRecordKeyValue
3535
3519
  exports.createShopFeature = require_render.createShopFeature;
3536
3520
  exports.createShopOrderAccessStorage = require_render.createShopOrderAccessStorage;
3537
3521
  exports.createTokenStorage = require_storage.createTokenStorage;
3522
+ exports.createUuidV4 = require_cookies.createUuidV4;
3538
3523
  exports.formatNotificationText = require_url.formatNotificationText;
3539
3524
  exports.fromStream = require_render.fromStream;
3540
3525
  exports.fromUrl = require_render.fromUrl;