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
|
/** Имя встроенного сервиса статуса. */
|
|
@@ -2354,7 +2359,7 @@ interface ClientConnection {
|
|
|
2354
2359
|
readonly assertActive?: ((action: string) => void) | undefined;
|
|
2355
2360
|
/** Заголовки платформы и сервиса без Bearer-токена. */
|
|
2356
2361
|
baseHeaders(url: string): Promise<Headers>;
|
|
2357
|
-
/**
|
|
2362
|
+
/** Готовит авторизацию и возвращает токен для подключения. */
|
|
2358
2363
|
getToken(): Promise<string | null>;
|
|
2359
2364
|
/** Пытается восстановить авторизацию после отказа транспорта. */
|
|
2360
2365
|
refreshAuth(): Promise<boolean>;
|
|
@@ -2776,4 +2781,4 @@ declare function isKnownNotificationType(type: string): boolean;
|
|
|
2776
2781
|
* ```
|
|
2777
2782
|
*/
|
|
2778
2783
|
declare function resolveNotificationUrl(notification: Notification): string;
|
|
2779
|
-
export { ItdServerError as $,
|
|
2784
|
+
export { ItdServerError as $, CustomOperationId as $t, ClientConnection as A, QrLocationPrecision as An, RateLimitBucketContext as At, ItdAuthError as B, RetryOptions as Bt, SubscriptionState as C, InteractionType as Cn, OperationMetadata as Ct, Emitter as D, Loose as Dn, ErrorContextHook as Dt, UsernameAvailability as E, LikesVisibility as En, ClientHooks as Et, tokenProvider as F, UsernameUnavailableReason as Fn, RequestExtensions as Ft, ItdFieldErrors as G, RateLimitPacing as Gt, ItdConflictError as H, QueryParams as Ht, ItdAbortError as I, ViewReason as In, RequestOptions as It, ItdForbiddenError as J, LogLevel as Jt, ItdFileError as K, RuntimeMode as Kt, ItdApiError as L, ViewSource as Ln, ResponseContext as Lt, AuthProvider as M, ReportTargetType as Mn, RateLimitOptions as Mt, anonymousAuth as N, ServiceState as Nn, RawRequestOptions as Nt, Listener as O, MessageAccess as On, OperationRequestOptions as Ot, bearerToken as P, SpanType as Pn, RequestContext as Pt, ItdRateLimitError as Q, BuiltInOperationId as Qt, ItdApiErrorInit as R, WallAccess as Rn, RetryContext as Rt, PublicProfile as S, IncidentKind as Sn, OperationContract as St, UserSummary as T, LastSeenUnit as Tn, RetrySafety as Tt, ItdError as U, QueryValue as Ut, ItdConfigError as V, RuntimeOptions as Vt, ItdErrorKind as W, ServiceDefinition as Wt, ItdNotFoundError as X, ItdClock as Xt, ItdNetworkError as Y, Logger as Yt, ItdPhoneVerificationError as Z, systemClock as Zt, MyProfile as _, CaptchaField as _n, DEFAULT_BASE_URL as _t, NotificationEvent as a, operationMethod as an, isItdApiError as at, PrivacySettings as b, EventChannelStatus as bn, FeatureOperationId as bt, NotificationSettings as c, DEFAULT_RATE_LIMIT_BUCKET as cn, isItdError as ct, AuthUser as d, Span as dn, isItdNotFoundError as dt, ItdOperationDefinition as en, ItdStateError as et, Author as f, UserId as fn, isItdPhoneVerificationError as ft, MessageAllowlistUser as g, CaptchaChoice as gn, isItdValidationError as gt, MessageAllowlistMembership as h, AttachmentType as hn, isItdStateError as ht, formatNotificationText as i, operationBucket as in, TimeoutBudget as it, AuthIdentity as j, ReportReason as jn, RateLimitBucketOverride as jt, Unsubscribe as k, NotificationType as kn, PaginationOptions as kt, Actor as l, RateLimitBucket as ln, isItdFileError as lt, LastSeen as m, AccessType as mn, isItdServerError as mt, canonicalNotificationType as n, OperationId as nn, ItdValidationError as nt, normalizeNotification as o, operationRetrySafety as on, isItdAuthError as ot, FollowResult as p, UserRef as pn, isItdRateLimitError as pt, ItdFileErrorReason as q, createUuidV4 as qt, isKnownNotificationType as r, isBuiltInOperationId as rn, RateLimitErrorScope as rt, Notification as s, BUCKET_LIMITS as sn, isItdConflictError as st, resolveNotificationUrl as t, OPERATIONS as tn, ItdTimeoutError as tt, AuthState as u, IsoDate as un, isItdForbiddenError as ut, Pin as v, CaptchaType as vn, STATUS_SERVICE as vt, UserBase as w, ItdErrorCode as wn, OperationMethod as wt, Profile as x, FeedTab as xn, OperationAnnotations as xt, PinsResult as y, CommentSort as yn, LIBRARY_VERSION as yt, ItdApiErrorKind as z, RetryDecisionContext as zt };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as ItdValidationError, E as isItdApiError, P as isItdRateLimitError, S as ItdTimeoutError, T as TimeoutBudget, _ as ItdNotFoundError, a as ItdAbortError, b as ItdServerError, c as ItdAuthError, d as ItdError, g as ItdNetworkError, h as ItdForbiddenError, i as requireOptionalBoolean, l as ItdConfigError, n as isRecord, o as ItdApiError, p as ItdFileError, r as requireNonNegative, t as isObjectLike, u as ItdConflictError, v as ItdPhoneVerificationError, x as ItdStateError, y as ItdRateLimitError } from "./validate-oLSGiGwQ.js";
|
|
2
|
-
import { C as shouldSendCredentials, E as LogLevel, O as isLevelEnabled, S as resolveFetch, b as isBlob, c as hostOf, d as normalizeBaseUrl, f as originOf, g as redactHeaders, k as resolveLogger, l as isSameSite, m as redactBody, n as CookieJar, o as buildQuery, u as joinUrl, v as RuntimeMode, w as shouldUseCookieJar, y as
|
|
2
|
+
import { C as shouldSendCredentials, E as LogLevel, O as isLevelEnabled, S as resolveFetch, b as isBlob, c as hostOf, d as normalizeBaseUrl, f as originOf, g as redactHeaders, k as resolveLogger, l as isSameSite, m as redactBody, n as CookieJar, o as buildQuery, u as joinUrl, v as RuntimeMode, w as shouldUseCookieJar, y as createUuidV4 } from "./cookies-lIXHWhOd.js";
|
|
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 ??=
|
|
4448
|
+
deviceId ??= createUuidV4();
|
|
4445
4449
|
return Promise.resolve(deviceId);
|
|
4446
4450
|
};
|
|
4447
4451
|
}
|
|
@@ -4650,4 +4654,4 @@ function resolveNotificationUrl(notification) {
|
|
|
4650
4654
|
}
|
|
4651
4655
|
export { CommentSort as $, passthroughOperation as A, OperationMethod as B, RateLimitPacing as C, pickNumber as D, pickBoolean as E, operationBucket as F, createRequestAbortScope as G, defineOperation as H, operationMethod as I, AccessType as J, requestAbortError as K, operationRetrySafety as L, OPERATIONS as M, defineBuiltInOperation as N, pickObject as O, isBuiltInOperationId as P, CaptchaType as Q, BUCKET_LIMITS as R, LIBRARY_VERSION as S, pickArray as T, identityResult as U, RetrySafety as V, voidResult as W, CaptchaChoice as X, AttachmentType as Y, CaptchaField as Z, orderPluginDefinitions as _, WallAccess as _t, tokenProvider as a, LastSeenUnit as at, STATUS_SERVICE as b, readUnreadCountEvent as c, NotificationType as ct, ITD_CATALOG as d, ReportTargetType as dt, EventChannelStatus as et, createClientRuntime as f, ServiceState as ft, assertPluginRemovable as g, ViewSource as gt, RequestQueuePool as h, ViewReason as ht, bearerToken as i, ItdErrorCode as it, voidOperation as j, pickString as k, canonicalNotificationType as l, QrLocationPrecision as lt, mergeService as m, UsernameUnavailableReason as mt, formatNotificationText as n, IncidentKind as nt, normalizeNotification as o, LikesVisibility as ot, createApiError as p, SpanType as pt, waitForRequest as q, anonymousAuth as r, InteractionType as rt, readNotificationEvent as s, MessageAccess as st, resolveNotificationUrl as t, FeedTab as tt, isKnownNotificationType as u, ReportReason as ut, DEFAULT_BASE_URL as v, createDeadline as vt, installAsyncDisposeFallback as w, resolveRateLimit as x, DEFAULT_STATUS_BASE_URL as y, systemClock as yt, DEFAULT_RATE_LIMIT_BUCKET as z };
|
|
4652
4656
|
|
|
4653
|
-
//# sourceMappingURL=url-
|
|
4657
|
+
//# sourceMappingURL=url-DcjNue8i.js.map
|