itd-api 0.14.2 → 0.14.4
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 +3 -3
- package/dist/events/index.d.cts +2 -2
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.js +3 -3
- package/dist/index.cjs +12 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/dist/node/index.cjs +2 -2
- package/dist/node/index.js +2 -2
- package/dist/rest/index.cjs +4 -4
- package/dist/rest/index.d.cts +2 -2
- package/dist/rest/index.d.ts +2 -2
- package/dist/rest/index.js +4 -4
- package/dist/shared/{cookies-D68xbO4E.cjs → cookies-BLmvIZBD.cjs} +6 -8
- package/dist/shared/cookies-BLmvIZBD.cjs.map +1 -0
- package/dist/shared/{cookies-BdntFeQ5.js → cookies-lIXHWhOd.js} +5 -7
- package/dist/shared/cookies-lIXHWhOd.js.map +1 -0
- package/dist/shared/{events-B_97nfiJ.cjs → events-9dRKcUPZ.cjs} +3 -3
- package/dist/shared/{events-B_97nfiJ.cjs.map → events-9dRKcUPZ.cjs.map} +1 -1
- package/dist/shared/{events-BcR4RzSS.d.ts → events-B18vQGEH.d.ts} +1 -1
- package/dist/shared/{events-B2D1rsQf.d.cts → events-BSotWa3Z.d.cts} +1 -1
- package/dist/shared/{events-CzYBo3XI.js → events-C7MJnuJw.js} +3 -3
- package/dist/shared/{events-CzYBo3XI.js.map → events-C7MJnuJw.js.map} +1 -1
- package/dist/shared/{multi-storage-hYW_Whkx.js → multi-storage-CPiHgcXH.js} +2 -2
- package/dist/shared/{multi-storage-hYW_Whkx.js.map → multi-storage-CPiHgcXH.js.map} +1 -1
- package/dist/shared/{multi-storage-BNiP6Mbq.cjs → multi-storage-lwn-cmG6.cjs} +2 -2
- package/dist/shared/{multi-storage-BNiP6Mbq.cjs.map → multi-storage-lwn-cmG6.cjs.map} +1 -1
- package/dist/shared/{options-C2WubUA6.cjs → options-DYeE1hFt.cjs} +2 -2
- package/dist/shared/{options-C2WubUA6.cjs.map → options-DYeE1hFt.cjs.map} +1 -1
- package/dist/shared/{options-BqQVtTmm.js → options-DorH4keX.js} +2 -2
- package/dist/shared/{options-BqQVtTmm.js.map → options-DorH4keX.js.map} +1 -1
- package/dist/shared/{render-4Rp2sa1a.d.ts → render-C5G2o3yL.d.ts} +14 -1
- package/dist/shared/{render-DaHR-AHp.d.cts → render-CWiDhdKI.d.cts} +14 -1
- package/dist/shared/{render-CXxr13yg.js → render-DFhMFt1f.js} +19 -6
- package/dist/shared/render-DFhMFt1f.js.map +1 -0
- package/dist/shared/{render-B67QcLUQ.cjs → render-DOLkOCVs.cjs} +19 -6
- package/dist/shared/render-DOLkOCVs.cjs.map +1 -0
- package/dist/shared/{url-Dey3grvo.d.ts → url-C49-l_KW.d.ts} +8 -3
- package/dist/shared/{url-ww6B39DX.js → url-DcjNue8i.js} +10 -6
- package/dist/shared/{url-ww6B39DX.js.map → url-DcjNue8i.js.map} +1 -1
- package/dist/shared/{url-DVN-pqkV.d.cts → url-ZRjcpC__.d.cts} +8 -3
- package/dist/shared/{url-HVCnoH85.cjs → url-vXQWF--L.cjs} +10 -6
- package/dist/shared/url-vXQWF--L.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/shared/cookies-BdntFeQ5.js.map +0 -1
- package/dist/shared/cookies-D68xbO4E.cjs.map +0 -1
- package/dist/shared/render-B67QcLUQ.cjs.map +0 -1
- package/dist/shared/render-CXxr13yg.js.map +0 -1
- package/dist/shared/url-HVCnoH85.cjs.map +0 -1
|
@@ -1469,6 +1469,11 @@ declare const RuntimeMode: Readonly<{
|
|
|
1469
1469
|
readonly Server: "server";
|
|
1470
1470
|
}>;
|
|
1471
1471
|
type RuntimeMode = (typeof RuntimeMode)[keyof typeof RuntimeMode];
|
|
1472
|
+
/**
|
|
1473
|
+
* Создаёт UUID v4 для идентификаторов запросов, устройств и сессий.
|
|
1474
|
+
* Если Web Crypto недоступен, использует `Math.random()`.
|
|
1475
|
+
*/
|
|
1476
|
+
declare function createUuidV4(): string;
|
|
1472
1477
|
/** Реакция на остаток лимита из заголовков ответа. */
|
|
1473
1478
|
declare const RateLimitPacing: Readonly<{
|
|
1474
1479
|
/** Задержек нет, пока в бакете есть остаток; исчерпанный бакет ждёт `60000 / limit`. */
|
|
@@ -1870,7 +1875,7 @@ interface OperationDefinition extends OperationMetadata {
|
|
|
1870
1875
|
readonly bucket?: string;
|
|
1871
1876
|
}
|
|
1872
1877
|
/** Версия библиотеки. Попадает в `User-Agent`. */
|
|
1873
|
-
declare const LIBRARY_VERSION = "0.14.
|
|
1878
|
+
declare const LIBRARY_VERSION = "0.14.4";
|
|
1874
1879
|
/** Базовый URL API итд.com. Домен записан в punycode: `итд.com`. */
|
|
1875
1880
|
declare const DEFAULT_BASE_URL = "https://xn--d1ah4a.com";
|
|
1876
1881
|
/** Имя встроенного сервиса статуса. */
|
|
@@ -2516,7 +2521,7 @@ interface ClientConnection {
|
|
|
2516
2521
|
readonly assertActive?: ((action: string) => void) | undefined;
|
|
2517
2522
|
/** Заголовки платформы и сервиса без Bearer-токена. */
|
|
2518
2523
|
baseHeaders(url: string): Promise<Headers>;
|
|
2519
|
-
/**
|
|
2524
|
+
/** Готовит авторизацию и возвращает токен для подключения. */
|
|
2520
2525
|
getToken(): Promise<string | null>;
|
|
2521
2526
|
/** Пытается восстановить авторизацию после отказа транспорта. */
|
|
2522
2527
|
refreshAuth(): Promise<boolean>;
|
|
@@ -2938,4 +2943,4 @@ declare function isKnownNotificationType(type: string): boolean;
|
|
|
2938
2943
|
* ```
|
|
2939
2944
|
*/
|
|
2940
2945
|
declare function resolveNotificationUrl(notification: Notification): string;
|
|
2941
|
-
export { ItdPhoneVerificationError as $,
|
|
2946
|
+
export { ItdPhoneVerificationError as $, ItdClock as $t, ClientConnection as A, Loose as An, ErrorContextHook as At, ItdApiErrorInit as B, ViewSource as Bn, ResponseContext as Bt, SubscriptionState as C, EventChannelStatus as Cn, FeatureOperationId as Ct, Emitter as D, ItdErrorCode as Dn, OperationMethod as Dt, UsernameAvailability as E, InteractionType as En, OperationMetadata as Et, tokenProvider as F, ReportTargetType as Fn, RateLimitOptions as Ft, ItdError as G, QueryParams as Gt, ItdAuthError as H, RetryDecisionContext as Ht, HttpClient as I, ServiceState as In, RawRequestOptions as It, ItdFileError as J, RateLimitPacing as Jt, ItdErrorKind as K, QueryValue as Kt, HttpOperationOptions as L, SpanType as Ln, RequestContext as Lt, AuthProvider as M, NotificationType as Mn, PaginationOptions as Mt, anonymousAuth as N, QrLocationPrecision as Nn, RateLimitBucketContext as Nt, Listener as O, LastSeenUnit as On, RetrySafety as Ot, bearerToken as P, ReportReason as Pn, RateLimitBucketOverride as Pt, ItdNotFoundError as Q, Logger as Qt, ItdAbortError as R, UsernameUnavailableReason as Rn, RequestExtensions as Rt, PublicProfile as S, CommentSort as Sn, LIBRARY_VERSION as St, UserSummary as T, IncidentKind as Tn, OperationContract as Tt, ItdConfigError as U, RetryOptions as Ut, ItdApiErrorKind as V, WallAccess as Vn, RetryContext as Vt, ItdConflictError as W, RuntimeOptions as Wt, ItdForbiddenError as X, createUuidV4 as Xt, ItdFileErrorReason as Y, RuntimeMode as Yt, ItdNetworkError as Z, LogLevel as Zt, MyProfile as _, AccessType as _n, isItdStateError as _t, NotificationEvent as a, OperationId as an, RateLimitErrorScope as at, PrivacySettings as b, CaptchaField as bn, DEFAULT_BASE_URL as bt, NotificationSettings as c, operationMethod as cn, isItdAuthError as ct, AuthUser as d, DEFAULT_RATE_LIMIT_BUCKET as dn, isItdFileError as dt, systemClock as en, ItdRateLimitError as et, Author as f, RateLimitBucket as fn, isItdForbiddenError as ft, MessageAllowlistUser as g, UserRef as gn, isItdServerError as gt, MessageAllowlistMembership as h, UserId as hn, isItdRateLimitError as ht, formatNotificationText as i, OPERATIONS as in, ItdValidationError as it, AuthIdentity as j, MessageAccess as jn, OperationRequestOptions as jt, Unsubscribe as k, LikesVisibility as kn, ClientHooks as kt, Actor as l, operationRetrySafety as ln, isItdConflictError as lt, LastSeen as m, Span as mn, isItdPhoneVerificationError as mt, canonicalNotificationType as n, CustomOperationId as nn, ItdStateError as nt, normalizeNotification as o, isBuiltInOperationId as on, TimeoutBudget as ot, FollowResult as p, IsoDate as pn, isItdNotFoundError as pt, ItdFieldErrors as q, ServiceDefinition as qt, isKnownNotificationType as r, ItdOperationDefinition as rn, ItdTimeoutError as rt, Notification as s, operationBucket as sn, isItdApiError as st, resolveNotificationUrl as t, BuiltInOperationId as tn, ItdServerError as tt, AuthState as u, BUCKET_LIMITS as un, isItdError as ut, Pin as v, AttachmentType as vn, isItdValidationError as vt, UserBase as w, FeedTab as wn, OperationAnnotations as wt, Profile as x, CaptchaType as xn, STATUS_SERVICE as xt, PinsResult as y, CaptchaChoice as yn, CookieJar as yt, ItdApiError as z, ViewReason as zn, RequestOptions as zt };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_validate = require("./validate-CbM3k811.cjs");
|
|
2
|
-
const require_cookies = require("./cookies-
|
|
2
|
+
const require_cookies = require("./cookies-BLmvIZBD.cjs");
|
|
3
3
|
// src/core/clock.ts
|
|
4
4
|
/** Системные часы, используемые клиентом по умолчанию. */
|
|
5
5
|
const systemClock = Object.freeze({
|
|
@@ -1601,7 +1601,7 @@ const RateLimitPacing = Object.freeze({
|
|
|
1601
1601
|
});
|
|
1602
1602
|
// src/core/version.ts
|
|
1603
1603
|
/** Версия библиотеки. Попадает в `User-Agent`. */
|
|
1604
|
-
const LIBRARY_VERSION = "0.14.
|
|
1604
|
+
const LIBRARY_VERSION = "0.14.4";
|
|
1605
1605
|
// src/core/config.ts
|
|
1606
1606
|
/** Базовый URL API итд.com. Домен записан в punycode: `итд.com`. */
|
|
1607
1607
|
const DEFAULT_BASE_URL = "https://xn--d1ah4a.com";
|
|
@@ -4238,9 +4238,10 @@ function createClientRuntime(options, internals) {
|
|
|
4238
4238
|
connection: (serviceName) => {
|
|
4239
4239
|
const service = serviceName === void 0 ? void 0 : services.require(serviceName);
|
|
4240
4240
|
const baseUrl = service?.baseUrl ?? config.baseUrl;
|
|
4241
|
+
const authorize = service?.auth ?? true;
|
|
4241
4242
|
return Object.freeze({
|
|
4242
4243
|
baseUrl,
|
|
4243
|
-
authorize
|
|
4244
|
+
authorize,
|
|
4244
4245
|
fetch: config.fetch,
|
|
4245
4246
|
clock: config.clock,
|
|
4246
4247
|
logger: config.logger,
|
|
@@ -4251,7 +4252,10 @@ function createClientRuntime(options, internals) {
|
|
|
4251
4252
|
for (const [name, value] of Object.entries(service?.headers ?? {})) headers.set(name, value);
|
|
4252
4253
|
return headers;
|
|
4253
4254
|
},
|
|
4254
|
-
getToken: () =>
|
|
4255
|
+
getToken: async () => {
|
|
4256
|
+
if (authorize) await auth.preflight?.(true);
|
|
4257
|
+
return auth.token();
|
|
4258
|
+
},
|
|
4255
4259
|
refreshAuth: () => auth.recover()
|
|
4256
4260
|
});
|
|
4257
4261
|
},
|
|
@@ -4441,7 +4445,7 @@ function readUnreadCountEvent(data) {
|
|
|
4441
4445
|
function localDeviceId() {
|
|
4442
4446
|
let deviceId;
|
|
4443
4447
|
return () => {
|
|
4444
|
-
deviceId ??= require_cookies.
|
|
4448
|
+
deviceId ??= require_cookies.createUuidV4();
|
|
4445
4449
|
return Promise.resolve(deviceId);
|
|
4446
4450
|
};
|
|
4447
4451
|
}
|
|
@@ -5087,4 +5091,4 @@ Object.defineProperty(exports, "waitForRequest", {
|
|
|
5087
5091
|
}
|
|
5088
5092
|
});
|
|
5089
5093
|
|
|
5090
|
-
//# sourceMappingURL=url-
|
|
5094
|
+
//# sourceMappingURL=url-vXQWF--L.cjs.map
|