itd-api 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +105 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +160 -132
- package/dist/index.d.ts +160 -132
- package/dist/index.js +105 -58
- 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-BNGjJVI3.d.cts → events-CZXU16qU.d.cts} +2 -2
- package/dist/shared/{events-B0Wtn4cF.js → events-Cipe-Fm9.js} +2 -2
- package/dist/shared/{events-B0Wtn4cF.js.map → events-Cipe-Fm9.js.map} +1 -1
- package/dist/shared/{events-CJO6q93Z.d.ts → events-D3CSlpXR.d.ts} +2 -2
- package/dist/shared/{events-BB791aPk.cjs → events-MtRNe_TF.cjs} +2 -2
- package/dist/shared/{events-BB791aPk.cjs.map → events-MtRNe_TF.cjs.map} +1 -1
- package/dist/shared/{render-DC5nvqcP.d.ts → render-Cs6AOXbD.d.ts} +2 -2
- package/dist/shared/{render-CkhvH_yh.js → render-CubTTof_.js} +2 -2
- package/dist/shared/{render-CkhvH_yh.js.map → render-CubTTof_.js.map} +1 -1
- package/dist/shared/{render-C1A57W-5.d.cts → render-bZwOk3CC.d.cts} +2 -2
- package/dist/shared/{render-BimHjOhw.cjs → render-dscKp9CC.cjs} +2 -2
- package/dist/shared/{render-BimHjOhw.cjs.map → render-dscKp9CC.cjs.map} +1 -1
- package/dist/shared/{url-BA5hEwj2.js → url-CntTEAxu.js} +4 -4
- package/dist/shared/{url-BA5hEwj2.js.map → url-CntTEAxu.js.map} +1 -1
- package/dist/shared/{url-CDVgMIq5.cjs → url-DgTYZN_v.cjs} +4 -4
- package/dist/shared/{url-CDVgMIq5.cjs.map → url-DgTYZN_v.cjs.map} +1 -1
- package/dist/shared/{url-DkMueFAT.d.cts → url-Dum7r_FT.d.cts} +4 -4
- package/dist/shared/{url-DkMueFAT.d.ts → url-Dum7r_FT.d.ts} +4 -4
- package/package.json +1 -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-DgTYZN_v.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-MtRNe_TF.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, _n as Loose, a as NotificationEvent, at as bearerToken, c as NotificationSettings, ct as Listener, dn as EventChannelStatus, et as isItdValidationError, ft as LIBRARY_VERSION, i as formatNotificationText, it as anonymousAuth, k as ItdError, lt as Unsubscribe, 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, vn as NotificationType, 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, _n as Loose, a as NotificationEvent, at as bearerToken, c as NotificationSettings, ct as Listener, dn as EventChannelStatus, et as isItdValidationError, ft as LIBRARY_VERSION, i as formatNotificationText, it as anonymousAuth, k as ItdError, lt as Unsubscribe, 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, vn as NotificationType, xt as Logger, yt as ClientHooks, z as ItdServerError } from "../shared/url-Dum7r_FT.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-CZXU16qU.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, _n as Loose, a as NotificationEvent, at as bearerToken, c as NotificationSettings, ct as Listener, dn as EventChannelStatus, et as isItdValidationError, ft as LIBRARY_VERSION, i as formatNotificationText, it as anonymousAuth, k as ItdError, lt as Unsubscribe, 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, vn as NotificationType, 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, _n as Loose, a as NotificationEvent, at as bearerToken, c as NotificationSettings, ct as Listener, dn as EventChannelStatus, et as isItdValidationError, ft as LIBRARY_VERSION, i as formatNotificationText, it as anonymousAuth, k as ItdError, lt as Unsubscribe, 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, vn as NotificationType, xt as Logger, yt as ClientHooks, z as ItdServerError } from "../shared/url-Dum7r_FT.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-D3CSlpXR.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 { T as NotificationType, a as tokenProvider, c as normalizeNotification, d as canonicalNotificationType, f as isKnownNotificationType, ht as systemClock, i as bearerToken, n as formatNotificationText, ot as DEFAULT_BASE_URL, r as anonymousAuth, t as resolveNotificationUrl, ut as LIBRARY_VERSION, y as EventChannelStatus } from "../shared/url-
|
|
1
|
+
import { T as NotificationType, a as tokenProvider, c as normalizeNotification, d as canonicalNotificationType, f as isKnownNotificationType, ht as systemClock, i as bearerToken, n as formatNotificationText, ot as DEFAULT_BASE_URL, r as anonymousAuth, t as resolveNotificationUrl, ut as LIBRARY_VERSION, y as EventChannelStatus } from "../shared/url-CntTEAxu.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, g as runEventMiddleware, h as UnauthorizedStreamError, i as createNotificationEventsClient, m as EventChannel, n as EventRouter, 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, g as runEventMiddleware, h as UnauthorizedStreamError, i as createNotificationEventsClient, m as EventChannel, n as EventRouter, r as NotificationEventsClient, s as NotificationEvents, t as EventComposer } from "../shared/events-Cipe-Fm9.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-DgTYZN_v.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-dscKp9CC.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-MtRNe_TF.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");
|
|
@@ -92,21 +92,36 @@ function requireCaptchaText(value, field) {
|
|
|
92
92
|
if (value !== void 0 && (typeof value !== "string" || value.trim() === "")) throw new require_errors.ItdConfigError(`${field} должен быть непустой строкой`);
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
|
-
* Проверяет форму
|
|
95
|
+
* Проверяет форму источника токена и приводит его к объекту.
|
|
96
96
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
97
|
+
* Сам объект сохраняется как есть: `getToken` вызывается на нём, чтобы источнику остался
|
|
98
|
+
* доступен собственный `this`.
|
|
99
99
|
*
|
|
100
100
|
* @throws {ItdConfigError} при некорректных значениях
|
|
101
101
|
*/
|
|
102
|
-
function
|
|
102
|
+
function resolveCaptchaSolver(captcha) {
|
|
103
|
+
if (captcha === void 0) return void 0;
|
|
104
|
+
if (typeof captcha === "function") return { getToken: captcha };
|
|
105
|
+
if (!require_url.isRecord$1(captcha)) throw new require_errors.ItdConfigError("captcha должен быть функцией либо объектом с getToken");
|
|
106
|
+
const { getToken, type, field } = captcha;
|
|
107
|
+
if (typeof getToken !== "function") throw new require_errors.ItdConfigError("captcha.getToken должен быть функцией");
|
|
108
|
+
requireCaptchaText(type, "captcha.type");
|
|
109
|
+
requireCaptchaText(field, "captcha.field");
|
|
110
|
+
return captcha;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Проверяет форму готового токена капчи.
|
|
114
|
+
*
|
|
115
|
+
* @param path имя опции или аргумента для текста ошибки
|
|
116
|
+
* @throws {ItdConfigError} если токен или его тип не указаны
|
|
117
|
+
*/
|
|
118
|
+
function validateCaptchaToken(captcha, path) {
|
|
103
119
|
if (captcha === void 0) return;
|
|
104
|
-
if (!require_url.isRecord$1(captcha)) throw new require_errors.ItdConfigError(
|
|
105
|
-
const { type, token,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
requireCaptchaText(field,
|
|
109
|
-
if (getToken !== void 0 && typeof getToken !== "function") throw new require_errors.ItdConfigError("auth.captcha.getToken должен быть функцией");
|
|
120
|
+
if (!require_url.isRecord$1(captcha)) throw new require_errors.ItdConfigError(`${path} должен быть объектом { type, token }`);
|
|
121
|
+
const { type, token, field } = captcha;
|
|
122
|
+
if (typeof token !== "string" || token.trim() === "") throw new require_errors.ItdConfigError(`${path}.token должен быть непустой строкой`);
|
|
123
|
+
if (typeof type !== "string" || type.trim() === "") throw new require_errors.ItdConfigError(`${path}.type должен быть непустой строкой`);
|
|
124
|
+
requireCaptchaText(field, `${path}.field`);
|
|
110
125
|
}
|
|
111
126
|
/** Разбирает ответ `GET /api/v1/auth/captcha/provider` для автоматического входа. */
|
|
112
127
|
function readCaptchaProvider(body) {
|
|
@@ -123,43 +138,40 @@ function readCaptchaProvider(body) {
|
|
|
123
138
|
function resolveField(type, configured) {
|
|
124
139
|
const field = configured ?? CAPTCHA_FIELDS[type];
|
|
125
140
|
if (field) return field;
|
|
126
|
-
throw new require_errors.ItdConfigError(`Неизвестно, в каком поле сервер ждёт токен капчи «${type}». Передайте
|
|
141
|
+
throw new require_errors.ItdConfigError(`Неизвестно, в каком поле сервер ждёт токен капчи «${type}». Передайте captcha.field либо оставьте captcha.type = ${require_url.CaptchaChoice.Auto}, чтобы поле назвал сервер.`);
|
|
127
142
|
}
|
|
128
|
-
/** Спрашивает
|
|
129
|
-
async function
|
|
130
|
-
const token = await
|
|
131
|
-
if (token) return token;
|
|
132
|
-
throw new require_errors.ItdConfigError(`Источник капчи не вернул токен для провайдера «${type}». Проверьте
|
|
143
|
+
/** Спрашивает токен у источника и убеждается, что он непустой. */
|
|
144
|
+
async function requireSolvedToken(solver, type) {
|
|
145
|
+
const token = await solver.getToken(type);
|
|
146
|
+
if (typeof token === "string" && token.trim() !== "") return token;
|
|
147
|
+
throw new require_errors.ItdConfigError(`Источник капчи не вернул токен для провайдера «${type}». Проверьте captcha.getToken.`);
|
|
133
148
|
}
|
|
134
149
|
/**
|
|
135
|
-
* Готовит фрагмент тела
|
|
150
|
+
* Готовит фрагмент тела запроса, взяв токен у источника.
|
|
136
151
|
*
|
|
137
152
|
* При `CaptchaChoice.Auto` провайдер спрашивается у сервера — тогда и тип виджета,
|
|
138
|
-
* и имя поля приходят оттуда. Явно названный тип
|
|
153
|
+
* и имя поля приходят оттуда. Явно названный тип обходится без этого запроса.
|
|
139
154
|
*
|
|
140
155
|
* @param askProvider как спросить активного провайдера; вызывается, только если это нужно
|
|
141
|
-
* @throws {ItdConfigError} если
|
|
156
|
+
* @throws {ItdConfigError} если токен получить не удалось
|
|
142
157
|
*/
|
|
143
|
-
async function
|
|
144
|
-
|
|
145
|
-
const choice = captcha.type ?? require_url.CaptchaChoice.Auto;
|
|
158
|
+
async function solveCaptchaBody(solver, askProvider) {
|
|
159
|
+
const choice = solver.type ?? require_url.CaptchaChoice.Auto;
|
|
146
160
|
if (choice === require_url.CaptchaChoice.Auto) {
|
|
147
161
|
const { provider, field } = await askProvider();
|
|
148
|
-
return { [field]: await
|
|
162
|
+
return { [field]: await requireSolvedToken(solver, provider) };
|
|
149
163
|
}
|
|
150
|
-
return { [resolveField(choice,
|
|
164
|
+
return { [resolveField(choice, solver.field)]: await requireSolvedToken(solver, choice) };
|
|
151
165
|
}
|
|
152
166
|
/**
|
|
153
|
-
* Готовит фрагмент тела
|
|
167
|
+
* Готовит фрагмент тела из готового токена.
|
|
154
168
|
*
|
|
155
|
-
* Поле берётся из самого
|
|
169
|
+
* Поле берётся из самого токена либо из умолчания провайдера; запроса к серверу нет.
|
|
156
170
|
*
|
|
157
|
-
* @throws {ItdConfigError} если
|
|
171
|
+
* @throws {ItdConfigError} если токен или его тип не указаны
|
|
158
172
|
*/
|
|
159
173
|
function captchaBody(captcha) {
|
|
160
|
-
|
|
161
|
-
if (typeof captcha.token !== "string" || captcha.token.trim() === "") throw new require_errors.ItdConfigError("captcha.token должен быть непустой строкой");
|
|
162
|
-
if (typeof captcha.type !== "string" || captcha.type.trim() === "") throw new require_errors.ItdConfigError("captcha.type должен быть непустой строкой");
|
|
174
|
+
validateCaptchaToken(captcha, "captcha");
|
|
163
175
|
return { [resolveField(captcha.type, captcha.field)]: captcha.token };
|
|
164
176
|
}
|
|
165
177
|
//#endregion
|
|
@@ -237,7 +249,7 @@ function validateAuth(auth) {
|
|
|
237
249
|
const { email, password, captcha } = auth;
|
|
238
250
|
if (typeof email !== "string" || email.trim() === "") throw new require_errors.ItdConfigError("auth.email должен быть непустой строкой");
|
|
239
251
|
if (typeof password !== "string" || password === "") throw new require_errors.ItdConfigError("auth.password должен быть непустой строкой");
|
|
240
|
-
|
|
252
|
+
validateCaptchaToken(captcha, "auth.captcha");
|
|
241
253
|
return { ...auth };
|
|
242
254
|
}
|
|
243
255
|
throw new require_errors.ItdConfigError("auth не распознан. Ожидается строка с accessToken либо объект { accessToken }, { email, password } или { getToken }");
|
|
@@ -266,6 +278,7 @@ function resolveSessionConfig(options, runtime) {
|
|
|
266
278
|
return {
|
|
267
279
|
...runtime,
|
|
268
280
|
auth: validateAuth(options.auth),
|
|
281
|
+
captcha: resolveCaptchaSolver(options.captcha),
|
|
269
282
|
storage: resolveStorage(options.storage),
|
|
270
283
|
deviceId: options.deviceId,
|
|
271
284
|
autoRefresh: options.autoRefresh ?? true,
|
|
@@ -437,6 +450,8 @@ var AuthManager = class {
|
|
|
437
450
|
*/
|
|
438
451
|
#authEpoch = 0;
|
|
439
452
|
#externalReadGeneration = 0;
|
|
453
|
+
/** Разовый токен из `auth.captcha` тратится ровно на один запрос. */
|
|
454
|
+
#configCaptchaSpent = false;
|
|
440
455
|
#disposed = false;
|
|
441
456
|
#persistence = Promise.resolve();
|
|
442
457
|
constructor(config, http, jar, hooks = {}) {
|
|
@@ -964,6 +979,34 @@ var AuthManager = class {
|
|
|
964
979
|
this.#signingIn = promise;
|
|
965
980
|
return promise;
|
|
966
981
|
}
|
|
982
|
+
/**
|
|
983
|
+
* Готовит фрагмент тела с токеном капчи для запроса, который её требует.
|
|
984
|
+
*
|
|
985
|
+
* Источники в порядке убывания приоритета: токен, переданный в сам вызов; разовый токен
|
|
986
|
+
* из `auth.captcha`; опция `captcha`. Когда ни одного нет, фрагмент пустой: нужна ли
|
|
987
|
+
* капча этому запросу, решает сервер.
|
|
988
|
+
*
|
|
989
|
+
* @param explicit готовый токен, переданный в вызов
|
|
990
|
+
* @throws {ItdConfigError} если токен неполный или источник его не вернул
|
|
991
|
+
*/
|
|
992
|
+
async captchaBody(explicit) {
|
|
993
|
+
if (explicit) return captchaBody(explicit);
|
|
994
|
+
const configured = this.#takeConfiguredCaptcha();
|
|
995
|
+
if (configured) return captchaBody(configured);
|
|
996
|
+
const solver = this.#config.captcha;
|
|
997
|
+
if (solver) return solveCaptchaBody(solver, () => this.#resolveCaptchaProvider());
|
|
998
|
+
this.#config.logger?.debug("Запрос уходит без токена капчи: не передан аргумент captcha и не задана опция captcha");
|
|
999
|
+
return {};
|
|
1000
|
+
}
|
|
1001
|
+
/** Отдаёт разовый токен из `auth.captcha`, помечая его потраченным. */
|
|
1002
|
+
#takeConfiguredCaptcha() {
|
|
1003
|
+
if (this.#configCaptchaSpent) return void 0;
|
|
1004
|
+
const auth = this.#config.auth;
|
|
1005
|
+
const captcha = require_url.isRecord$1(auth) ? auth.captcha : void 0;
|
|
1006
|
+
if (!captcha) return void 0;
|
|
1007
|
+
this.#configCaptchaSpent = true;
|
|
1008
|
+
return captcha;
|
|
1009
|
+
}
|
|
967
1010
|
/** Спрашивает у сервера активного провайдера и поле, в котором он ждёт токен. */
|
|
968
1011
|
async #resolveCaptchaProvider() {
|
|
969
1012
|
return readCaptchaProvider(await this.#http.execute(AUTH_CAPTCHA_PROVIDER, {
|
|
@@ -973,7 +1016,7 @@ var AuthManager = class {
|
|
|
973
1016
|
}));
|
|
974
1017
|
}
|
|
975
1018
|
async #performSignIn(credentials, revision) {
|
|
976
|
-
const captcha = await
|
|
1019
|
+
const captcha = await this.captchaBody();
|
|
977
1020
|
const flowCookies = new require_redact.CookieJar();
|
|
978
1021
|
const result = await this.#http.execute(AUTH_SIGN_IN, {
|
|
979
1022
|
path: AUTH_PATHS.signIn,
|
|
@@ -1154,7 +1197,8 @@ var AuthResource = class extends require_render.BaseResource {
|
|
|
1154
1197
|
if (existing) return existing;
|
|
1155
1198
|
const flow = {
|
|
1156
1199
|
cookies: this.#auth.createCookieFlow(false),
|
|
1157
|
-
expiresAt: void 0
|
|
1200
|
+
expiresAt: void 0,
|
|
1201
|
+
captchaRequired: false
|
|
1158
1202
|
};
|
|
1159
1203
|
this.#qrFlows.set(qrId, flow);
|
|
1160
1204
|
return flow;
|
|
@@ -1205,7 +1249,8 @@ var AuthResource = class extends require_render.BaseResource {
|
|
|
1205
1249
|
if (typeof result.qrId === "string" && result.qrId !== "") {
|
|
1206
1250
|
const flow = {
|
|
1207
1251
|
cookies,
|
|
1208
|
-
expiresAt: void 0
|
|
1252
|
+
expiresAt: void 0,
|
|
1253
|
+
captchaRequired: false
|
|
1209
1254
|
};
|
|
1210
1255
|
this.#touchQrFlow(flow, result.expiresIn);
|
|
1211
1256
|
this.#qrFlows.set(result.qrId, flow);
|
|
@@ -1215,20 +1260,21 @@ var AuthResource = class extends require_render.BaseResource {
|
|
|
1215
1260
|
/**
|
|
1216
1261
|
* Проверяет QR-сессию и завершает вход после подтверждения на другом устройстве.
|
|
1217
1262
|
*
|
|
1218
|
-
* До подтверждения возвращает промежуточный статус.
|
|
1219
|
-
*
|
|
1220
|
-
* Полученный `accessToken` автоматически сохраняется в клиенте.
|
|
1263
|
+
* До подтверждения возвращает промежуточный статус. Токен капчи добывается, только когда
|
|
1264
|
+
* сервер о ней попросил — статусом `captcha_required` на прошлой проверке, — либо когда
|
|
1265
|
+
* передан в сам вызов. Полученный `accessToken` автоматически сохраняется в клиенте.
|
|
1221
1266
|
*/
|
|
1222
1267
|
async claimQrLogin(input, options = {}) {
|
|
1223
1268
|
const revision = this.#auth.revision();
|
|
1224
1269
|
const flow = this.#qrFlow(input.qrId);
|
|
1225
1270
|
try {
|
|
1226
1271
|
const { captcha, ...rest } = input;
|
|
1272
|
+
const needsCaptcha = captcha !== void 0 || flow.captchaRequired;
|
|
1227
1273
|
const result = await this.http.execute(AUTH_QR_CLAIM, {
|
|
1228
1274
|
path: AUTH_PATHS.qrClaim,
|
|
1229
1275
|
body: {
|
|
1230
1276
|
...rest,
|
|
1231
|
-
...
|
|
1277
|
+
...needsCaptcha ? await this.#auth.captchaBody(captcha) : {}
|
|
1232
1278
|
},
|
|
1233
1279
|
skipAuth: true,
|
|
1234
1280
|
skipAuthRefresh: true,
|
|
@@ -1236,6 +1282,7 @@ var AuthResource = class extends require_render.BaseResource {
|
|
|
1236
1282
|
...options
|
|
1237
1283
|
});
|
|
1238
1284
|
this.#touchQrFlow(flow, result.expiresIn);
|
|
1285
|
+
if (result.status === QrLoginStatus.CaptchaRequired) flow.captchaRequired = true;
|
|
1239
1286
|
if (result.status === QrLoginStatus.Authorized) {
|
|
1240
1287
|
await this.#auth.commitAuthFlow(result.accessToken, flow.cookies, revision);
|
|
1241
1288
|
this.#qrFlows.delete(input.qrId);
|
|
@@ -1271,13 +1318,13 @@ var AuthResource = class extends require_render.BaseResource {
|
|
|
1271
1318
|
*
|
|
1272
1319
|
* @returns `flowToken`, который нужно передать в {@link verifyOtp}
|
|
1273
1320
|
*/
|
|
1274
|
-
signUp(credentials, options = {}) {
|
|
1321
|
+
async signUp(credentials, options = {}) {
|
|
1275
1322
|
const { captcha, ...rest } = credentials;
|
|
1276
1323
|
return this.http.execute(AUTH_SIGN_UP, {
|
|
1277
1324
|
path: AUTH_PATHS.signUp,
|
|
1278
1325
|
body: {
|
|
1279
1326
|
...rest,
|
|
1280
|
-
...captchaBody(captcha)
|
|
1327
|
+
...await this.#auth.captchaBody(captcha)
|
|
1281
1328
|
},
|
|
1282
1329
|
skipAuth: true,
|
|
1283
1330
|
skipAuthRefresh: true,
|
|
@@ -1292,18 +1339,19 @@ var AuthResource = class extends require_render.BaseResource {
|
|
|
1292
1339
|
*
|
|
1293
1340
|
* При успешном входе токен сохраняется в клиенте автоматически.
|
|
1294
1341
|
*
|
|
1295
|
-
* @param credentials email, пароль и
|
|
1342
|
+
* @param credentials email, пароль и токен капчи — см. {@link CredentialsWithCaptcha}
|
|
1296
1343
|
*/
|
|
1297
1344
|
async signIn(credentials, options = {}) {
|
|
1298
1345
|
const { captcha, ...rest } = credentials;
|
|
1299
1346
|
const revision = this.#auth.revision();
|
|
1300
1347
|
const cookies = this.#auth.createCookieFlow(false);
|
|
1348
|
+
const body = {
|
|
1349
|
+
...rest,
|
|
1350
|
+
...await this.#auth.captchaBody(captcha)
|
|
1351
|
+
};
|
|
1301
1352
|
const result = await this.http.execute(AUTH_SIGN_IN, {
|
|
1302
1353
|
path: AUTH_PATHS.signIn,
|
|
1303
|
-
body
|
|
1304
|
-
...rest,
|
|
1305
|
-
...captchaBody(captcha)
|
|
1306
|
-
},
|
|
1354
|
+
body,
|
|
1307
1355
|
skipAuth: true,
|
|
1308
1356
|
skipAuthRefresh: true,
|
|
1309
1357
|
cookieJar: cookies,
|
|
@@ -1431,12 +1479,12 @@ var AuthResource = class extends require_render.BaseResource {
|
|
|
1431
1479
|
*
|
|
1432
1480
|
* @returns `flowToken`, который нужно передать в {@link resetPassword}
|
|
1433
1481
|
*/
|
|
1434
|
-
forgotPassword(input, options = {}) {
|
|
1482
|
+
async forgotPassword(input, options = {}) {
|
|
1435
1483
|
return this.http.execute(AUTH_FORGOT_PASSWORD, {
|
|
1436
1484
|
path: AUTH_PATHS.forgotPassword,
|
|
1437
1485
|
body: {
|
|
1438
1486
|
email: input.email,
|
|
1439
|
-
...captchaBody(input.captcha)
|
|
1487
|
+
...await this.#auth.captchaBody(input.captcha)
|
|
1440
1488
|
},
|
|
1441
1489
|
skipAuth: true,
|
|
1442
1490
|
skipAuthRefresh: true,
|
|
@@ -1571,8 +1619,9 @@ function createManagedClient(options, internals) {
|
|
|
1571
1619
|
* const itd = new ItdClient({
|
|
1572
1620
|
* // `auth` не обязателен: когда хранилище уже содержит сессию, токен берётся оттуда,
|
|
1573
1621
|
* // а истёкший продлевается сам. Здесь он нужен на первый запуск.
|
|
1574
|
-
*
|
|
1575
|
-
*
|
|
1622
|
+
* auth: { email, password },
|
|
1623
|
+
* // Капчу входа решает пакет @itd-api/captcha — см. CaptchaSolver.
|
|
1624
|
+
* captcha: createCaptchaSolver(),
|
|
1576
1625
|
* storage: new FileTokenStorage('./.itd-session.json'),
|
|
1577
1626
|
* rateLimit: { concurrency: 4, rps: 8 },
|
|
1578
1627
|
* });
|
|
@@ -2086,6 +2135,8 @@ function assertAccountsActive(accounts, action) {
|
|
|
2086
2135
|
*
|
|
2087
2136
|
* await using accounts = new ItdAccounts({
|
|
2088
2137
|
* storage: new FileMultiTokenStorage('./.itd-sessions.json'),
|
|
2138
|
+
* // Общие опции достаются каждому аккаунту: один источник токена капчи на всех.
|
|
2139
|
+
* captcha: createCaptchaSolver(),
|
|
2089
2140
|
* rateLimit: { concurrency: 4 },
|
|
2090
2141
|
* });
|
|
2091
2142
|
*
|
|
@@ -2093,9 +2144,7 @@ function assertAccountsActive(accounts, action) {
|
|
|
2093
2144
|
* await accounts.restore();
|
|
2094
2145
|
*
|
|
2095
2146
|
* if (!accounts.has('kiow')) {
|
|
2096
|
-
* accounts.addAccount('kiow', {
|
|
2097
|
-
* auth: { email, password, captcha: createCaptchaSolver() },
|
|
2098
|
-
* });
|
|
2147
|
+
* accounts.addAccount('kiow', { auth: { email, password } });
|
|
2099
2148
|
* }
|
|
2100
2149
|
*
|
|
2101
2150
|
* await accounts.account('kiow').posts.create({ content: 'привет' });
|
|
@@ -2174,9 +2223,7 @@ var ItdAccounts = class ItdAccounts {
|
|
|
2174
2223
|
*
|
|
2175
2224
|
* @example
|
|
2176
2225
|
* ```ts
|
|
2177
|
-
* accounts.addAccount('bot', {
|
|
2178
|
-
* auth: { email, password, captcha: createCaptchaSolver() },
|
|
2179
|
-
* });
|
|
2226
|
+
* accounts.addAccount('bot', { auth: { email, password } });
|
|
2180
2227
|
* accounts.addAccount('reader', { auth: '<accessToken>' });
|
|
2181
2228
|
* accounts.addAccount('через-прокси', { fetch: proxyFetch('socks5://…') });
|
|
2182
2229
|
* ```
|