itd-api 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/events/index.cjs +2 -2
- package/dist/events/index.d.cts +2 -2
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.js +2 -2
- package/dist/index.cjs +87 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -10
- package/dist/index.d.ts +8 -10
- package/dist/index.js +87 -53
- package/dist/index.js.map +1 -1
- package/dist/rest/index.cjs +2 -2
- package/dist/rest/index.d.cts +2 -2
- package/dist/rest/index.d.ts +2 -2
- package/dist/rest/index.js +2 -2
- package/dist/shared/{events-BCn5LRnT.d.cts → events-BPxBF0gQ.d.cts} +2 -2
- package/dist/shared/{events-BIBO2Jif.js → events-BzjI6pn5.js} +2 -2
- package/dist/shared/{events-BIBO2Jif.js.map → events-BzjI6pn5.js.map} +1 -1
- package/dist/shared/{events-BsRm_Fba.cjs → events-C1FudmSe.cjs} +2 -2
- package/dist/shared/{events-BsRm_Fba.cjs.map → events-C1FudmSe.cjs.map} +1 -1
- package/dist/shared/{events-t1uGgpkf.d.ts → events-DnwfcLxS.d.ts} +2 -2
- package/dist/shared/{render-DA83gS0f.d.cts → render-C1F_QWYD.d.cts} +2 -14
- package/dist/shared/{render--ZXmYEf-.js → render-CtOpp9Pm.js} +2 -30
- package/dist/shared/render-CtOpp9Pm.js.map +1 -0
- package/dist/shared/{render-DqVzx68r.cjs → render-Omy1drH1.cjs} +2 -30
- package/dist/shared/render-Omy1drH1.cjs.map +1 -0
- package/dist/shared/{render-BdnBV-aT.d.ts → render-uFW2kDxp.d.ts} +2 -14
- package/dist/shared/{url-i2f-X1hX.js → url-3Ts6EEHQ.js} +32 -15
- package/dist/shared/url-3Ts6EEHQ.js.map +1 -0
- package/dist/shared/{url-Doc0XXW_.cjs → url-D6wsXm1T.cjs} +32 -15
- package/dist/shared/url-D6wsXm1T.cjs.map +1 -0
- package/dist/shared/{url-Dbj6V6fk.d.ts → url-DubjkRR9.d.cts} +8 -16
- package/dist/shared/{url-Dbj6V6fk.d.cts → url-DubjkRR9.d.ts} +8 -16
- package/package.json +3 -3
- package/dist/shared/render--ZXmYEf-.js.map +0 -1
- package/dist/shared/render-DqVzx68r.cjs.map +0 -1
- package/dist/shared/url-Doc0XXW_.cjs.map +0 -1
- package/dist/shared/url-i2f-X1hX.js.map +0 -1
package/dist/events/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_url = require("../shared/url-
|
|
2
|
+
const require_url = require("../shared/url-D6wsXm1T.cjs");
|
|
3
3
|
const require_errors = require("../shared/errors-BmP3TKoW.cjs");
|
|
4
4
|
const require_redact = require("../shared/redact-lAmck1Z6.cjs");
|
|
5
|
-
const require_events = require("../shared/events-
|
|
5
|
+
const require_events = require("../shared/events-C1FudmSe.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;
|
package/dist/events/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as isItdStateError, A as ItdErrorKind, B as ItdStateError, Bt as RuntimeMode, C as ItdApiError, D as ItdConfigError, E as ItdAuthError, F as ItdNetworkError, Ft as RuntimeOptions, H as ItdValidationError, Ht as systemClock, I as ItdNotFoundError, K as isItdError, P as ItdForbiddenError, R as ItdRateLimitError, S as ItdAbortError, T as ItdApiErrorKind, U as isItdApiError, V as ItdTimeoutError, Vt as ItdClock, W as isItdAuthError, Z as isItdRateLimitError, a as NotificationEvent, at as bearerToken, c as NotificationSettings, cn as EventChannelStatus, ct as Listener, et as isItdValidationError, ft as LIBRARY_VERSION, hn as NotificationType, i as formatNotificationText, it as anonymousAuth, k as ItdError, lt as Unsubscribe, mn as Loose, n as canonicalNotificationType, nt as AuthIdentity, o as normalizeNotification, ot as tokenProvider, r as isKnownNotificationType, rt as AuthProvider, s as Notification, t as resolveNotificationUrl, tt as ClientConnection, ut as DEFAULT_BASE_URL, xt as Logger, yt as ClientHooks, z as ItdServerError } from "../shared/url-
|
|
2
|
-
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-
|
|
1
|
+
import { $ as isItdStateError, A as ItdErrorKind, B as ItdStateError, Bt as RuntimeMode, C as ItdApiError, D as ItdConfigError, E as ItdAuthError, F as ItdNetworkError, Ft as RuntimeOptions, H as ItdValidationError, Ht as systemClock, I as ItdNotFoundError, K as isItdError, P as ItdForbiddenError, R as ItdRateLimitError, S as ItdAbortError, T as ItdApiErrorKind, U as isItdApiError, V as ItdTimeoutError, Vt as ItdClock, W as isItdAuthError, Z as isItdRateLimitError, a as NotificationEvent, at as bearerToken, c as NotificationSettings, cn as EventChannelStatus, ct as Listener, et as isItdValidationError, ft as LIBRARY_VERSION, hn as NotificationType, i as formatNotificationText, it as anonymousAuth, k as ItdError, lt as Unsubscribe, mn as Loose, n as canonicalNotificationType, nt as AuthIdentity, o as normalizeNotification, ot as tokenProvider, r as isKnownNotificationType, rt as AuthProvider, s as Notification, t as resolveNotificationUrl, tt as ClientConnection, ut as DEFAULT_BASE_URL, xt as Logger, yt as ClientHooks, z as ItdServerError } from "../shared/url-DubjkRR9.cjs";
|
|
2
|
+
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-BPxBF0gQ.cjs";
|
|
3
3
|
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, 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, 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 };
|
package/dist/events/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as isItdStateError, A as ItdErrorKind, B as ItdStateError, Bt as RuntimeMode, C as ItdApiError, D as ItdConfigError, E as ItdAuthError, F as ItdNetworkError, Ft as RuntimeOptions, H as ItdValidationError, Ht as systemClock, I as ItdNotFoundError, K as isItdError, P as ItdForbiddenError, R as ItdRateLimitError, S as ItdAbortError, T as ItdApiErrorKind, U as isItdApiError, V as ItdTimeoutError, Vt as ItdClock, W as isItdAuthError, Z as isItdRateLimitError, a as NotificationEvent, at as bearerToken, c as NotificationSettings, cn as EventChannelStatus, ct as Listener, et as isItdValidationError, ft as LIBRARY_VERSION, hn as NotificationType, i as formatNotificationText, it as anonymousAuth, k as ItdError, lt as Unsubscribe, mn as Loose, n as canonicalNotificationType, nt as AuthIdentity, o as normalizeNotification, ot as tokenProvider, r as isKnownNotificationType, rt as AuthProvider, s as Notification, t as resolveNotificationUrl, tt as ClientConnection, ut as DEFAULT_BASE_URL, xt as Logger, yt as ClientHooks, z as ItdServerError } from "../shared/url-
|
|
2
|
-
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-
|
|
1
|
+
import { $ as isItdStateError, A as ItdErrorKind, B as ItdStateError, Bt as RuntimeMode, C as ItdApiError, D as ItdConfigError, E as ItdAuthError, F as ItdNetworkError, Ft as RuntimeOptions, H as ItdValidationError, Ht as systemClock, I as ItdNotFoundError, K as isItdError, P as ItdForbiddenError, R as ItdRateLimitError, S as ItdAbortError, T as ItdApiErrorKind, U as isItdApiError, V as ItdTimeoutError, Vt as ItdClock, W as isItdAuthError, Z as isItdRateLimitError, a as NotificationEvent, at as bearerToken, c as NotificationSettings, cn as EventChannelStatus, ct as Listener, et as isItdValidationError, ft as LIBRARY_VERSION, hn as NotificationType, i as formatNotificationText, it as anonymousAuth, k as ItdError, lt as Unsubscribe, mn as Loose, n as canonicalNotificationType, nt as AuthIdentity, o as normalizeNotification, ot as tokenProvider, r as isKnownNotificationType, rt as AuthProvider, s as Notification, t as resolveNotificationUrl, tt as ClientConnection, ut as DEFAULT_BASE_URL, xt as Logger, yt as ClientHooks, z as ItdServerError } from "../shared/url-DubjkRR9.js";
|
|
2
|
+
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-DnwfcLxS.js";
|
|
3
3
|
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, 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, 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 };
|
package/dist/events/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as NotificationType, a as tokenProvider, c as normalizeNotification, d as canonicalNotificationType, et as DEFAULT_BASE_URL, f as isKnownNotificationType, g as EventChannelStatus, i as bearerToken, it as LIBRARY_VERSION, lt as systemClock, n as formatNotificationText, r as anonymousAuth, t as resolveNotificationUrl } from "../shared/url-
|
|
1
|
+
import { S as NotificationType, a as tokenProvider, c as normalizeNotification, d as canonicalNotificationType, et as DEFAULT_BASE_URL, f as isKnownNotificationType, g as EventChannelStatus, i as bearerToken, it as LIBRARY_VERSION, lt as systemClock, n as formatNotificationText, r as anonymousAuth, t as resolveNotificationUrl } from "../shared/url-3Ts6EEHQ.js";
|
|
2
2
|
import { A as isItdStateError, C as isItdError, O as isItdRateLimitError, _ as ItdStateError, a as ItdConfigError, b as isItdApiError, c as ItdErrorKind, d as ItdForbiddenError, f as ItdNetworkError, g as ItdServerError, h as ItdRateLimitError, i as ItdAuthError, j as isItdValidationError, n as ItdApiError, p as ItdNotFoundError, r as ItdApiErrorKind, s as ItdError, t as ItdAbortError, v as ItdTimeoutError, x as isItdAuthError, y as ItdValidationError } from "../shared/errors-GI10kZxk.js";
|
|
3
3
|
import { v as RuntimeMode } from "../shared/redact-DJV0XM3n.js";
|
|
4
|
-
import { a as WebSocketTransport, c as NotificationEventsTransport, d as NotificationUpdateOrigin, f as NotificationUpdateType, h as runEventMiddleware, i as createNotificationEventsClient, m as UnauthorizedStreamError, n as EventRouter, p as EventChannel, r as NotificationEventsClient, s as NotificationEvents, t as EventComposer } from "../shared/events-
|
|
4
|
+
import { a as WebSocketTransport, c as NotificationEventsTransport, d as NotificationUpdateOrigin, f as NotificationUpdateType, h as runEventMiddleware, i as createNotificationEventsClient, m as UnauthorizedStreamError, n as EventRouter, p as EventChannel, r as NotificationEventsClient, s as NotificationEvents, t as EventComposer } from "../shared/events-BzjI6pn5.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, NotificationEvents, NotificationEventsClient, NotificationEventsTransport, NotificationType, NotificationUpdateOrigin, NotificationUpdateType, RuntimeMode, 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,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_url = require("./shared/url-
|
|
2
|
+
const require_url = require("./shared/url-D6wsXm1T.cjs");
|
|
3
3
|
const require_errors = require("./shared/errors-BmP3TKoW.cjs");
|
|
4
4
|
const require_redact = require("./shared/redact-lAmck1Z6.cjs");
|
|
5
|
-
const require_render = require("./shared/render-
|
|
5
|
+
const require_render = require("./shared/render-Omy1drH1.cjs");
|
|
6
6
|
const require_options = require("./shared/options-DjEtbVaf.cjs");
|
|
7
|
-
const require_events = require("./shared/events-
|
|
7
|
+
const require_events = require("./shared/events-C1FudmSe.cjs");
|
|
8
8
|
const require_key_value_store = require("./shared/key-value-store-B5GYVEYZ.cjs");
|
|
9
9
|
const require_storage = require("./shared/storage-CZJZoaz9.cjs");
|
|
10
10
|
const require_multi_storage = require("./shared/multi-storage-s-fPtjoy.cjs");
|
|
@@ -75,38 +75,34 @@ function decodeBase64Url(segment) {
|
|
|
75
75
|
const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
76
76
|
return new TextDecoder().decode(bytes);
|
|
77
77
|
}
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
*
|
|
81
|
-
* Подпись не проверяется — ключа для проверки у клиента нет. Прочитанные значения служат
|
|
82
|
-
* лишь метками для разделения локального состояния и не дают доступа: его определяет сервер.
|
|
83
|
-
*/
|
|
84
|
-
function readTokenIdentity(token) {
|
|
78
|
+
/** Читает полезную нагрузку JWT без проверки подписи. */
|
|
79
|
+
function readTokenPayload(token) {
|
|
85
80
|
try {
|
|
86
81
|
const payload = token.split(".")[1];
|
|
87
|
-
if (!payload) return
|
|
82
|
+
if (!payload) return void 0;
|
|
88
83
|
const parsed = JSON.parse(decodeBase64Url(payload));
|
|
89
|
-
if (typeof parsed !== "object" || parsed === null) return
|
|
90
|
-
|
|
91
|
-
return {
|
|
92
|
-
...typeof sub === "string" && sub.length > 0 ? { subject: sub } : {},
|
|
93
|
-
...typeof sid === "string" && sid.length > 0 ? { sessionId: sid } : {}
|
|
94
|
-
};
|
|
84
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
|
|
85
|
+
return parsed;
|
|
95
86
|
} catch {
|
|
96
|
-
return
|
|
87
|
+
return;
|
|
97
88
|
}
|
|
98
89
|
}
|
|
99
|
-
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
90
|
+
/** Читает используемые клиентом поля JWT за один раз. */
|
|
91
|
+
function readTokenMetadata(token) {
|
|
92
|
+
const payload = readTokenPayload(token);
|
|
93
|
+
if (!payload) return {};
|
|
94
|
+
const { sub, sid, exp } = payload;
|
|
95
|
+
const expiresAt = typeof exp === "number" && Number.isFinite(exp) ? exp * 1e3 : void 0;
|
|
96
|
+
return {
|
|
97
|
+
...typeof sub === "string" && sub.length > 0 ? { subject: sub } : {},
|
|
98
|
+
...typeof sid === "string" && sid.length > 0 ? { sessionId: sid } : {},
|
|
99
|
+
...expiresAt !== void 0 && Number.isFinite(expiresAt) ? { expiresAt } : {}
|
|
100
|
+
};
|
|
107
101
|
}
|
|
108
102
|
//#endregion
|
|
109
103
|
//#region src/session/auth.ts
|
|
104
|
+
/** Запас до истечения токена на очередь и выполнение запроса. */
|
|
105
|
+
const ACCESS_TOKEN_REFRESH_LEEWAY_MS = 3e4;
|
|
110
106
|
/**
|
|
111
107
|
* Проверяет форму `auth` и сообщает о типичных ошибках понятным текстом.
|
|
112
108
|
*
|
|
@@ -306,7 +302,7 @@ var AuthManager = class {
|
|
|
306
302
|
* старте читают хранилище один раз и не заводят каждый свой `deviceId`.
|
|
307
303
|
*/
|
|
308
304
|
#loading = null;
|
|
309
|
-
/**
|
|
305
|
+
/** Текущее обновление: к нему присоединяются запросы той же ревизии. */
|
|
310
306
|
#refreshing = null;
|
|
311
307
|
/** Общий промис входа по логину и паролю. */
|
|
312
308
|
#signingIn = null;
|
|
@@ -316,6 +312,7 @@ var AuthManager = class {
|
|
|
316
312
|
#externalToken;
|
|
317
313
|
/** Идентификаторы последнего токена внешнего источника для синхронных потребителей. */
|
|
318
314
|
#externalIdentity;
|
|
315
|
+
#tokenMetadata;
|
|
319
316
|
/**
|
|
320
317
|
* Идентификатор устройства.
|
|
321
318
|
*
|
|
@@ -329,9 +326,7 @@ var AuthManager = class {
|
|
|
329
326
|
* Счётчик смен владельца авторизации.
|
|
330
327
|
*
|
|
331
328
|
* Растёт при каждой операции, которая заменяет или очищает сессию извне: `clear`,
|
|
332
|
-
* `setSession`, `setAccessToken`, вход.
|
|
333
|
-
* сетевым запросом и сверяет перед записью — иначе запоздавший ответ обновления мог бы
|
|
334
|
-
* воскресить уже очищенную сессию поверх `signOut`.
|
|
329
|
+
* `setSession`, `setAccessToken`, вход. Refresh сверяет снимок до и после сетевого запроса.
|
|
335
330
|
*/
|
|
336
331
|
#authEpoch = 0;
|
|
337
332
|
#externalReadGeneration = 0;
|
|
@@ -364,6 +359,7 @@ var AuthManager = class {
|
|
|
364
359
|
this.#disposed = true;
|
|
365
360
|
this.#externalReadGeneration += 1;
|
|
366
361
|
this.#invalidateInFlight();
|
|
362
|
+
this.#tokenMetadata = void 0;
|
|
367
363
|
this.#emitter.removeAllListeners();
|
|
368
364
|
}
|
|
369
365
|
/**
|
|
@@ -424,12 +420,25 @@ var AuthManager = class {
|
|
|
424
420
|
return this.#session?.accessToken ?? null;
|
|
425
421
|
}
|
|
426
422
|
#identityForToken(accessToken) {
|
|
427
|
-
const token =
|
|
423
|
+
const token = this.#metadataForToken(accessToken);
|
|
428
424
|
return {
|
|
429
425
|
...token.subject ? { userId: token.subject } : {},
|
|
430
426
|
...token.sessionId ? { sessionId: token.sessionId } : {}
|
|
431
427
|
};
|
|
432
428
|
}
|
|
429
|
+
#metadataForToken(accessToken) {
|
|
430
|
+
if (!accessToken) {
|
|
431
|
+
this.#tokenMetadata = void 0;
|
|
432
|
+
return {};
|
|
433
|
+
}
|
|
434
|
+
if (this.#tokenMetadata?.accessToken === accessToken) return this.#tokenMetadata.value;
|
|
435
|
+
const value = readTokenMetadata(accessToken);
|
|
436
|
+
this.#tokenMetadata = {
|
|
437
|
+
accessToken,
|
|
438
|
+
value
|
|
439
|
+
};
|
|
440
|
+
return value;
|
|
441
|
+
}
|
|
433
442
|
async #readExternalToken(getToken) {
|
|
434
443
|
this.#assertActive();
|
|
435
444
|
const generation = ++this.#externalReadGeneration;
|
|
@@ -476,15 +485,33 @@ var AuthManager = class {
|
|
|
476
485
|
if (this.#jar.has("is_auth", this.#config.baseUrl)) return true;
|
|
477
486
|
return Boolean(this.#session?.refreshToken);
|
|
478
487
|
}
|
|
479
|
-
/**
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
488
|
+
/** Готовит внутреннюю сессию до retry исходного запроса. */
|
|
489
|
+
async preflight(allowRefresh) {
|
|
490
|
+
this.#assertActive();
|
|
491
|
+
let accessToken = (await this.#loadSession())?.accessToken;
|
|
492
|
+
if (!accessToken) {
|
|
493
|
+
const auth = this.#config.auth;
|
|
494
|
+
if (typeof auth === "object" && auth !== null && "email" in auth) accessToken = await this.#signInWithCredentials(auth) ?? void 0;
|
|
495
|
+
}
|
|
496
|
+
if (!accessToken || !allowRefresh || !this.#config.autoRefresh) return;
|
|
497
|
+
const expiresAt = this.#metadataForToken(accessToken).expiresAt;
|
|
498
|
+
if (expiresAt === void 0 || expiresAt > this.#config.clock.now() + ACCESS_TOKEN_REFRESH_LEEWAY_MS || !this.#hasRefreshSession()) return;
|
|
499
|
+
try {
|
|
500
|
+
await this.#refreshDeduplicated({
|
|
501
|
+
epoch: this.#authEpoch,
|
|
502
|
+
accessToken
|
|
503
|
+
});
|
|
504
|
+
} catch (error) {
|
|
505
|
+
this.#emitter.emit("authError", { error });
|
|
506
|
+
throw error;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
/** Перед каждой попыткой перечитывает внешний источник токена. */
|
|
485
510
|
async prepare() {
|
|
486
511
|
this.#assertActive();
|
|
487
|
-
await this
|
|
512
|
+
if ((await this.#loadSession())?.accessToken) return;
|
|
513
|
+
const auth = this.#config.auth;
|
|
514
|
+
if (typeof auth === "object" && auth !== null && "getToken" in auth) await this.#readExternalToken(() => auth.getToken());
|
|
488
515
|
}
|
|
489
516
|
/**
|
|
490
517
|
* Заголовки уже подготовленной авторизации без чтения storage или вызова внешнего источника.
|
|
@@ -631,7 +658,7 @@ var AuthManager = class {
|
|
|
631
658
|
async getUserId() {
|
|
632
659
|
this.#assertActive();
|
|
633
660
|
const session = await this.#loadSession();
|
|
634
|
-
return session?.accessToken ?
|
|
661
|
+
return session?.accessToken ? this.#identityForToken(session.accessToken).userId : void 0;
|
|
635
662
|
}
|
|
636
663
|
/** Заменяет сессию и связанные с ней cookie целиком. */
|
|
637
664
|
async setSession(session) {
|
|
@@ -734,24 +761,30 @@ var AuthManager = class {
|
|
|
734
761
|
this.#persistence = pending.catch(() => {});
|
|
735
762
|
return pending;
|
|
736
763
|
}
|
|
737
|
-
/**
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
const promise = this.#performRefresh().finally(() => {
|
|
745
|
-
this.#refreshing = null;
|
|
764
|
+
/** Дедуплицирует refresh одной ревизии; следующая ждёт завершения предыдущей. */
|
|
765
|
+
#refreshDeduplicated(expectation = { epoch: this.#authEpoch }) {
|
|
766
|
+
const current = this.#refreshing;
|
|
767
|
+
if (current) {
|
|
768
|
+
if (current.epoch === expectation.epoch) return current.promise;
|
|
769
|
+
return current.promise.then(() => this.#refreshDeduplicated(expectation), () => this.#refreshDeduplicated(expectation));
|
|
770
|
+
}
|
|
771
|
+
const promise = this.#performRefresh(expectation).finally(() => {
|
|
772
|
+
if (this.#refreshing?.promise === promise) this.#refreshing = null;
|
|
746
773
|
});
|
|
747
|
-
this.#refreshing =
|
|
774
|
+
this.#refreshing = {
|
|
775
|
+
epoch: expectation.epoch,
|
|
776
|
+
promise
|
|
777
|
+
};
|
|
748
778
|
return promise;
|
|
749
779
|
}
|
|
750
|
-
|
|
780
|
+
#matchesRefreshExpectation(expectation) {
|
|
781
|
+
return this.#authEpoch === expectation.epoch && (expectation.accessToken === void 0 || this.#session?.accessToken === expectation.accessToken);
|
|
782
|
+
}
|
|
783
|
+
async #performRefresh(expectation) {
|
|
751
784
|
this.#assertActive();
|
|
752
785
|
await this.#loadSession();
|
|
786
|
+
if (!this.#matchesRefreshExpectation(expectation)) return this.#currentAccessToken();
|
|
753
787
|
if (!this.#hasRefreshSession()) return this.#reloginOrNull();
|
|
754
|
-
const epoch = this.#authEpoch;
|
|
755
788
|
const flowCookies = this.#jar.clone();
|
|
756
789
|
try {
|
|
757
790
|
const accessToken = await this.#http.execute(AUTH_REFRESH, {
|
|
@@ -760,7 +793,7 @@ var AuthManager = class {
|
|
|
760
793
|
skipAuthRefresh: true,
|
|
761
794
|
cookieJar: flowCookies
|
|
762
795
|
});
|
|
763
|
-
if (this.#
|
|
796
|
+
if (!this.#matchesRefreshExpectation(expectation)) return this.#session?.accessToken ?? null;
|
|
764
797
|
this.#jar.replaceWith(flowCookies);
|
|
765
798
|
const rotated = this.#jar.getValue(require_redact.REFRESH_COOKIE, this.#config.baseUrl + require_redact.REFRESH_COOKIE_PATH);
|
|
766
799
|
this.#transitionAuth(accessToken, false);
|
|
@@ -772,10 +805,11 @@ var AuthManager = class {
|
|
|
772
805
|
});
|
|
773
806
|
this.#emitter.emit("tokens", { accessToken });
|
|
774
807
|
await saved;
|
|
808
|
+
if (this.#authEpoch !== expectation.epoch) return this.#currentAccessToken();
|
|
775
809
|
return accessToken;
|
|
776
810
|
} catch (error) {
|
|
811
|
+
if (this.#authEpoch !== expectation.epoch) return this.#currentAccessToken();
|
|
777
812
|
if (error instanceof require_errors.ItdAuthError) {
|
|
778
|
-
if (this.#authEpoch !== epoch) return this.#session?.accessToken ?? null;
|
|
779
813
|
this.#invalidateInFlight();
|
|
780
814
|
const clearedRevision = this.#authEpoch;
|
|
781
815
|
this.#transitionAuth(void 0);
|