itd-api 0.14.0 → 0.14.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/README.md +1 -0
- 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 +34 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -6
- package/dist/index.d.ts +10 -6
- package/dist/index.js +28 -21
- 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 +11 -4
- package/dist/rest/index.d.cts +3 -3
- package/dist/rest/index.d.ts +3 -3
- package/dist/rest/index.js +5 -5
- package/dist/shared/{cookies-Bw5HAxTB.js → cookies-YP0m72v2.js} +3 -2
- package/dist/shared/cookies-YP0m72v2.js.map +1 -0
- package/dist/shared/{cookies-DRYS-vZm.cjs → cookies-u2hXCcpR.cjs} +3 -2
- package/dist/shared/cookies-u2hXCcpR.cjs.map +1 -0
- package/dist/shared/{events-Dl27rIA0.d.cts → events-BmYzFrRC.d.cts} +1 -1
- package/dist/shared/{events-DXLOZXNe.js → events-BnL_gckg.js} +12 -12
- package/dist/shared/events-BnL_gckg.js.map +1 -0
- package/dist/shared/{events-g5XfBnc3.d.ts → events-Bw7VaSDs.d.ts} +1 -1
- package/dist/shared/{events--hwTmeN2.cjs → events-DUFuPzVO.cjs} +12 -12
- package/dist/shared/events-DUFuPzVO.cjs.map +1 -0
- package/dist/shared/{multi-storage-DDQKI9yT.cjs → multi-storage-BIeeBDV6.cjs} +2 -2
- package/dist/shared/{multi-storage-DDQKI9yT.cjs.map → multi-storage-BIeeBDV6.cjs.map} +1 -1
- package/dist/shared/{multi-storage-BDwZ3sOJ.js → multi-storage-DmUOaXbC.js} +2 -2
- package/dist/shared/{multi-storage-BDwZ3sOJ.js.map → multi-storage-DmUOaXbC.js.map} +1 -1
- package/dist/shared/{options-RfX5uXP5.js → options-D-8h06B_.js} +2 -2
- package/dist/shared/{options-RfX5uXP5.js.map → options-D-8h06B_.js.map} +1 -1
- package/dist/shared/{options-BrA90TVm.cjs → options-hZolLxgs.cjs} +2 -2
- package/dist/shared/{options-BrA90TVm.cjs.map → options-hZolLxgs.cjs.map} +1 -1
- package/dist/shared/{render-B6sj0OJ5.js → render-CgSQp84V.js} +1708 -1277
- package/dist/shared/render-CgSQp84V.js.map +1 -0
- package/dist/shared/{render-C11kvqb5.d.ts → render-DPXlBr5L.d.ts} +726 -248
- package/dist/shared/{render-D_pGoEH3.d.cts → render-DcIXTSuo.d.cts} +726 -248
- package/dist/shared/{render-DHeGjOzq.cjs → render-dKMV-872.cjs} +1713 -1240
- package/dist/shared/render-dKMV-872.cjs.map +1 -0
- package/dist/shared/{url-BPqHN_CZ.d.ts → url-B_TELARK.d.ts} +85 -17
- package/dist/shared/{url-W5GQOtlk.cjs → url-CQbNqbJX.cjs} +160 -91
- package/dist/shared/url-CQbNqbJX.cjs.map +1 -0
- package/dist/shared/{url-B6_um5qJ.d.cts → url-D7U9qjXD.d.cts} +85 -17
- package/dist/shared/{url-CY2NxyqI.js → url-DYGRJqxh.js} +161 -92
- package/dist/shared/url-DYGRJqxh.js.map +1 -0
- package/package.json +1 -1
- package/dist/shared/cookies-Bw5HAxTB.js.map +0 -1
- package/dist/shared/cookies-DRYS-vZm.cjs.map +0 -1
- package/dist/shared/events--hwTmeN2.cjs.map +0 -1
- package/dist/shared/events-DXLOZXNe.js.map +0 -1
- package/dist/shared/render-B6sj0OJ5.js.map +0 -1
- package/dist/shared/render-DHeGjOzq.cjs.map +0 -1
- package/dist/shared/url-CY2NxyqI.js.map +0 -1
- package/dist/shared/url-W5GQOtlk.cjs.map +0 -1
|
@@ -192,8 +192,7 @@ type IncidentKind = Loose<(typeof IncidentKind)[keyof typeof IncidentKind]>;
|
|
|
192
192
|
/**
|
|
193
193
|
* Уровень доступа к разделу профиля.
|
|
194
194
|
*
|
|
195
|
-
*
|
|
196
|
-
* приватности.
|
|
195
|
+
* Общие значения настроек приватности профиля.
|
|
197
196
|
* Тип открытый: сервер может прислать значение вне этого перечня.
|
|
198
197
|
*/
|
|
199
198
|
declare const AccessType: Readonly<{
|
|
@@ -231,6 +230,16 @@ declare const LikesVisibility: Readonly<{
|
|
|
231
230
|
readonly Everyone: "everyone";
|
|
232
231
|
}>;
|
|
233
232
|
type LikesVisibility = AccessType;
|
|
233
|
+
/** Кто может писать пользователю личные сообщения. */
|
|
234
|
+
declare const MessageAccess: Readonly<{
|
|
235
|
+
readonly Nobody: "nobody";
|
|
236
|
+
readonly Mutual: "mutual";
|
|
237
|
+
readonly Followers: "followers";
|
|
238
|
+
/** Пользователи, на которых вы подписаны. */
|
|
239
|
+
readonly Following: "following";
|
|
240
|
+
readonly Everyone: "everyone";
|
|
241
|
+
}>;
|
|
242
|
+
type MessageAccess = Loose<(typeof MessageAccess)[keyof typeof MessageAccess]>;
|
|
234
243
|
/** Почему имя пользователя нельзя занять. Тип открытый: сервер может прислать другую причину. */
|
|
235
244
|
declare const UsernameUnavailableReason: Readonly<{
|
|
236
245
|
/**
|
|
@@ -246,18 +255,6 @@ declare const LastSeenUnit: Readonly<{
|
|
|
246
255
|
readonly Hours: "hours";
|
|
247
256
|
}>;
|
|
248
257
|
type LastSeenUnit = Loose<(typeof LastSeenUnit)[keyof typeof LastSeenUnit]>;
|
|
249
|
-
/** Кто может писать пользователю личные сообщения. Псевдоним {@link AccessType}. */
|
|
250
|
-
declare const MessageAccess: Readonly<{
|
|
251
|
-
/** Никто. */
|
|
252
|
-
readonly Nobody: "nobody";
|
|
253
|
-
/** Только взаимные подписки. */
|
|
254
|
-
readonly Mutual: "mutual";
|
|
255
|
-
/** Подписчики. */
|
|
256
|
-
readonly Followers: "followers";
|
|
257
|
-
/** Все. */
|
|
258
|
-
readonly Everyone: "everyone";
|
|
259
|
-
}>;
|
|
260
|
-
type MessageAccess = AccessType;
|
|
261
258
|
/**
|
|
262
259
|
* Канонический тип уведомления (новое поколение имён).
|
|
263
260
|
*
|
|
@@ -292,6 +289,8 @@ declare const NotificationType: Readonly<{
|
|
|
292
289
|
readonly VerificationApproved: "verification_approved";
|
|
293
290
|
/** Верификация отклонена. Приходит только по REST. */
|
|
294
291
|
readonly VerificationRejected: "verification_rejected";
|
|
292
|
+
/** Пользователь получил подписку в подарок. */
|
|
293
|
+
readonly SubscriptionGift: "subscription_gift";
|
|
295
294
|
}>;
|
|
296
295
|
type NotificationType = Loose<(typeof NotificationType)[keyof typeof NotificationType]>;
|
|
297
296
|
/**
|
|
@@ -867,6 +866,18 @@ declare const OPERATIONS: Readonly<{
|
|
|
867
866
|
readonly method: "PUT";
|
|
868
867
|
readonly retrySafety: "idempotent";
|
|
869
868
|
}>;
|
|
869
|
+
readonly 'users.messageAllowlist': Readonly<{
|
|
870
|
+
readonly method: "GET";
|
|
871
|
+
readonly retrySafety: "safe";
|
|
872
|
+
}>;
|
|
873
|
+
readonly 'users.addToMessageAllowlist': Readonly<{
|
|
874
|
+
readonly method: "POST";
|
|
875
|
+
readonly retrySafety: "unsafe";
|
|
876
|
+
}>;
|
|
877
|
+
readonly 'users.removeFromMessageAllowlist': Readonly<{
|
|
878
|
+
readonly method: "DELETE";
|
|
879
|
+
readonly retrySafety: "unsafe";
|
|
880
|
+
}>;
|
|
870
881
|
readonly 'users.pins': Readonly<{
|
|
871
882
|
readonly method: "GET";
|
|
872
883
|
readonly retrySafety: "safe";
|
|
@@ -1207,10 +1218,54 @@ declare const OPERATIONS: Readonly<{
|
|
|
1207
1218
|
readonly method: "GET";
|
|
1208
1219
|
readonly retrySafety: "safe";
|
|
1209
1220
|
}>;
|
|
1221
|
+
readonly 'subscription.checkoutState': Readonly<{
|
|
1222
|
+
readonly method: "GET";
|
|
1223
|
+
readonly retrySafety: "safe";
|
|
1224
|
+
}>;
|
|
1225
|
+
readonly 'subscription.payment': Readonly<{
|
|
1226
|
+
readonly method: "GET";
|
|
1227
|
+
readonly retrySafety: "safe";
|
|
1228
|
+
}>;
|
|
1229
|
+
readonly 'subscription.gift': Readonly<{
|
|
1230
|
+
readonly method: "GET";
|
|
1231
|
+
readonly retrySafety: "safe";
|
|
1232
|
+
}>;
|
|
1233
|
+
readonly 'subscription.giftGiver': Readonly<{
|
|
1234
|
+
readonly method: "GET";
|
|
1235
|
+
readonly retrySafety: "safe";
|
|
1236
|
+
}>;
|
|
1237
|
+
readonly 'subscription.internationalCheckoutCapability': Readonly<{
|
|
1238
|
+
readonly method: "GET";
|
|
1239
|
+
readonly retrySafety: "safe";
|
|
1240
|
+
}>;
|
|
1210
1241
|
readonly 'subscription.pay': Readonly<{
|
|
1211
1242
|
readonly method: "POST";
|
|
1212
1243
|
readonly retrySafety: "unsafe";
|
|
1213
1244
|
}>;
|
|
1245
|
+
readonly 'subscription.payCheckout': Readonly<{
|
|
1246
|
+
readonly method: "POST";
|
|
1247
|
+
readonly retrySafety: "unsafe";
|
|
1248
|
+
}>;
|
|
1249
|
+
readonly 'subscription.createGift': Readonly<{
|
|
1250
|
+
readonly method: "POST";
|
|
1251
|
+
readonly retrySafety: "unsafe";
|
|
1252
|
+
}>;
|
|
1253
|
+
readonly 'subscription.releaseCheckout': Readonly<{
|
|
1254
|
+
readonly method: "POST";
|
|
1255
|
+
readonly retrySafety: "unsafe";
|
|
1256
|
+
}>;
|
|
1257
|
+
readonly 'subscription.internationalCheckout': Readonly<{
|
|
1258
|
+
readonly method: "POST";
|
|
1259
|
+
readonly retrySafety: "unsafe";
|
|
1260
|
+
}>;
|
|
1261
|
+
readonly 'subscription.resumeInternationalCheckout': Readonly<{
|
|
1262
|
+
readonly method: "POST";
|
|
1263
|
+
readonly retrySafety: "unsafe";
|
|
1264
|
+
}>;
|
|
1265
|
+
readonly 'subscription.releaseInternationalCheckout': Readonly<{
|
|
1266
|
+
readonly method: "POST";
|
|
1267
|
+
readonly retrySafety: "unsafe";
|
|
1268
|
+
}>;
|
|
1214
1269
|
readonly 'subscription.setAutoRenewal': Readonly<{
|
|
1215
1270
|
readonly method: "POST";
|
|
1216
1271
|
readonly retrySafety: "idempotent";
|
|
@@ -1224,7 +1279,7 @@ declare const OPERATIONS: Readonly<{
|
|
|
1224
1279
|
readonly retrySafety: "safe";
|
|
1225
1280
|
}>;
|
|
1226
1281
|
readonly 'subscription.setDefaultMethod': Readonly<{
|
|
1227
|
-
readonly method: "
|
|
1282
|
+
readonly method: "PUT";
|
|
1228
1283
|
readonly retrySafety: "idempotent";
|
|
1229
1284
|
}>;
|
|
1230
1285
|
readonly 'subscription.removeMethod': Readonly<{
|
|
@@ -1815,7 +1870,7 @@ interface OperationDefinition extends OperationMetadata {
|
|
|
1815
1870
|
readonly bucket?: string;
|
|
1816
1871
|
}
|
|
1817
1872
|
/** Версия библиотеки. Попадает в `User-Agent`. */
|
|
1818
|
-
declare const LIBRARY_VERSION = "0.14.
|
|
1873
|
+
declare const LIBRARY_VERSION = "0.14.1";
|
|
1819
1874
|
/** Базовый URL API итд.com. Домен записан в punycode: `итд.com`. */
|
|
1820
1875
|
declare const DEFAULT_BASE_URL = "https://xn--d1ah4a.com";
|
|
1821
1876
|
/** Имя встроенного сервиса статуса. */
|
|
@@ -2688,6 +2743,19 @@ interface PrivacySettings {
|
|
|
2688
2743
|
/** Показывать ли время последнего посещения. */
|
|
2689
2744
|
showLastSeen: boolean;
|
|
2690
2745
|
}
|
|
2746
|
+
/** Пользователь, добавленный в список исключений для личных сообщений. */
|
|
2747
|
+
interface MessageAllowlistUser extends Pick<UserBase, 'id' | 'displayName'> {
|
|
2748
|
+
username?: string | null;
|
|
2749
|
+
avatar?: string | null;
|
|
2750
|
+
verified?: boolean;
|
|
2751
|
+
hasNuksta?: boolean;
|
|
2752
|
+
/** Время добавления в список. */
|
|
2753
|
+
addedAt?: IsoDate | null;
|
|
2754
|
+
}
|
|
2755
|
+
/** Принадлежность пользователя к списку исключений для личных сообщений. */
|
|
2756
|
+
interface MessageAllowlistMembership {
|
|
2757
|
+
inMessageAllowlist: boolean;
|
|
2758
|
+
}
|
|
2691
2759
|
/**
|
|
2692
2760
|
* Результат подписки на пользователя.
|
|
2693
2761
|
*
|
|
@@ -2854,4 +2922,4 @@ declare function isKnownNotificationType(type: string): boolean;
|
|
|
2854
2922
|
* ```
|
|
2855
2923
|
*/
|
|
2856
2924
|
declare function resolveNotificationUrl(notification: Notification): string;
|
|
2857
|
-
export {
|
|
2925
|
+
export { ItdPhoneVerificationError as $, BuiltInOperationId as $t, ClientConnection as A, NotificationType as An, OperationRequestOptions as At, ItdApiErrorInit as B, RetryContext as Bt, SubscriptionState as C, IncidentKind as Cn, OperationAnnotations as Ct, Emitter as D, LikesVisibility as Dn, RetrySafety as Dt, UsernameAvailability as E, LastSeenUnit as En, OperationMethod as Et, tokenProvider as F, SpanType as Fn, RawRequestOptions as Ft, ItdError as G, QueryValue as Gt, ItdAuthError as H, RetryOptions as Ht, HttpClient as I, UsernameUnavailableReason as In, RequestContext as It, ItdFileError as J, RuntimeMode as Jt, ItdErrorKind as K, ServiceDefinition as Kt, HttpOperationOptions as L, ViewReason as Ln, RequestExtensions as Lt, AuthProvider as M, ReportReason as Mn, RateLimitBucketContext as Mt, anonymousAuth as N, ReportTargetType as Nn, RateLimitBucketOverride as Nt, Listener as O, Loose as On, ClientHooks as Ot, bearerToken as P, ServiceState as Pn, RateLimitOptions as Pt, ItdNotFoundError as Q, systemClock as Qt, ItdAbortError as R, ViewSource as Rn, RequestOptions as Rt, PublicProfile as S, FeedTab as Sn, FeatureOperationId as St, UserSummary as T, ItdErrorCode as Tn, OperationMetadata as Tt, ItdConfigError as U, RuntimeOptions as Ut, ItdApiErrorKind as V, RetryDecisionContext as Vt, ItdConflictError as W, QueryParams as Wt, ItdForbiddenError as X, Logger as Xt, ItdFileErrorReason as Y, LogLevel as Yt, ItdNetworkError as Z, ItdClock as Zt, MyProfile as _, CaptchaChoice as _n, isItdValidationError as _t, NotificationEvent as a, operationBucket as an, TimeoutBudget as at, PrivacySettings as b, CommentSort as bn, STATUS_SERVICE as bt, NotificationSettings as c, BUCKET_LIMITS as cn, isItdConflictError as ct, AuthUser as d, IsoDate as dn, isItdForbiddenError as dt, CustomOperationId as en, ItdRateLimitError as et, Author as f, Span as fn, isItdNotFoundError as ft, MessageAllowlistUser as g, AttachmentType as gn, isItdStateError as gt, MessageAllowlistMembership as h, AccessType as hn, isItdServerError as ht, formatNotificationText as i, isBuiltInOperationId as in, ItdValidationError as it, AuthIdentity as j, QrLocationPrecision as jn, PaginationOptions as jt, Unsubscribe as k, MessageAccess as kn, ErrorContextHook as kt, Actor as l, DEFAULT_RATE_LIMIT_BUCKET as ln, isItdError as lt, LastSeen as m, UserRef as mn, isItdRateLimitError as mt, canonicalNotificationType as n, OPERATIONS as nn, ItdStateError as nt, normalizeNotification as o, operationMethod as on, isItdApiError as ot, FollowResult as p, UserId as pn, isItdPhoneVerificationError as pt, ItdFieldErrors as q, RateLimitPacing as qt, isKnownNotificationType as r, OperationId as rn, ItdTimeoutError as rt, Notification as s, operationRetrySafety as sn, isItdAuthError as st, resolveNotificationUrl as t, ItdOperationDefinition as tn, ItdServerError as tt, AuthState as u, RateLimitBucket as un, isItdFileError as ut, Pin as v, CaptchaField as vn, CookieJar as vt, UserBase as w, InteractionType as wn, OperationContract as wt, Profile as x, EventChannelStatus as xn, LIBRARY_VERSION as xt, PinsResult as y, CaptchaType as yn, DEFAULT_BASE_URL as yt, ItdApiError as z, WallAccess as zn, ResponseContext as zt };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as ItdValidationError, N as isItdRateLimitError, S as ItdTimeoutError, T as isItdApiError, _ 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, w as TimeoutBudget, x as ItdStateError, y as ItdRateLimitError } from "./validate-BQzL_oJ4.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 createDeviceId } from "./cookies-
|
|
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 createDeviceId } from "./cookies-YP0m72v2.js";
|
|
3
3
|
// src/core/clock.ts
|
|
4
4
|
/** Системные часы, используемые клиентом по умолчанию. */
|
|
5
5
|
const systemClock = Object.freeze({
|
|
@@ -181,8 +181,7 @@ const IncidentKind = Object.freeze({
|
|
|
181
181
|
/**
|
|
182
182
|
* Уровень доступа к разделу профиля.
|
|
183
183
|
*
|
|
184
|
-
*
|
|
185
|
-
* приватности.
|
|
184
|
+
* Общие значения настроек приватности профиля.
|
|
186
185
|
* Тип открытый: сервер может прислать значение вне этого перечня.
|
|
187
186
|
*/
|
|
188
187
|
const AccessType = Object.freeze({
|
|
@@ -199,6 +198,15 @@ const AccessType = Object.freeze({
|
|
|
199
198
|
const WallAccess = AccessType;
|
|
200
199
|
/** Кто видит реакции пользователя. Псевдоним {@link AccessType}. */
|
|
201
200
|
const LikesVisibility = AccessType;
|
|
201
|
+
/** Кто может писать пользователю личные сообщения. */
|
|
202
|
+
const MessageAccess = Object.freeze({
|
|
203
|
+
Nobody: "nobody",
|
|
204
|
+
Mutual: "mutual",
|
|
205
|
+
Followers: "followers",
|
|
206
|
+
/** Пользователи, на которых вы подписаны. */
|
|
207
|
+
Following: "following",
|
|
208
|
+
Everyone: "everyone"
|
|
209
|
+
});
|
|
202
210
|
/** Почему имя пользователя нельзя занять. Тип открытый: сервер может прислать другую причину. */
|
|
203
211
|
const UsernameUnavailableReason = Object.freeze({
|
|
204
212
|
/**
|
|
@@ -211,8 +219,6 @@ const LastSeenUnit = Object.freeze({
|
|
|
211
219
|
Minutes: "minutes",
|
|
212
220
|
Hours: "hours"
|
|
213
221
|
});
|
|
214
|
-
/** Кто может писать пользователю личные сообщения. Псевдоним {@link AccessType}. */
|
|
215
|
-
const MessageAccess = AccessType;
|
|
216
222
|
/**
|
|
217
223
|
* Канонический тип уведомления (новое поколение имён).
|
|
218
224
|
*
|
|
@@ -246,7 +252,9 @@ const NotificationType = Object.freeze({
|
|
|
246
252
|
/** Верификация одобрена. Приходит только по REST. */
|
|
247
253
|
VerificationApproved: "verification_approved",
|
|
248
254
|
/** Верификация отклонена. Приходит только по REST. */
|
|
249
|
-
VerificationRejected: "verification_rejected"
|
|
255
|
+
VerificationRejected: "verification_rejected",
|
|
256
|
+
/** Пользователь получил подписку в подарок. */
|
|
257
|
+
SubscriptionGift: "subscription_gift"
|
|
250
258
|
});
|
|
251
259
|
/**
|
|
252
260
|
* Тип взаимодействия с контентом в телеметрии (`POST /api/v1/x`, поле `t`).
|
|
@@ -366,6 +374,88 @@ const ItdErrorCode = Object.freeze({
|
|
|
366
374
|
PHONE_VERIFICATION_REQUIRED: "PHONE_VERIFICATION_REQUIRED",
|
|
367
375
|
WRITE_ACCESS_RESTRICTED: "WRITE_ACCESS_RESTRICTED"
|
|
368
376
|
});
|
|
377
|
+
// src/core/execution/lifecycle.ts
|
|
378
|
+
/**
|
|
379
|
+
* Объединяет отмену вызова, завершение владельца и срок ожидания в один сигнал.
|
|
380
|
+
*
|
|
381
|
+
* Истечение срока отменяет сигнал ошибкой из `expiry.error`; она же становится
|
|
382
|
+
* `signal.reason`.
|
|
383
|
+
*
|
|
384
|
+
* @internal
|
|
385
|
+
*/
|
|
386
|
+
function createRequestAbortScope(signal, lifetimeSignal, clock, expiry) {
|
|
387
|
+
const controller = new AbortController();
|
|
388
|
+
let expired;
|
|
389
|
+
const link = (source) => {
|
|
390
|
+
if (!source) return void 0;
|
|
391
|
+
if (source.aborted) {
|
|
392
|
+
controller.abort(source.reason);
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
const onAbort = () => controller.abort(source.reason);
|
|
396
|
+
source.addEventListener("abort", onAbort, { once: true });
|
|
397
|
+
return () => source.removeEventListener("abort", onAbort);
|
|
398
|
+
};
|
|
399
|
+
const detach = [link(signal), link(lifetimeSignal)];
|
|
400
|
+
let cancelTimer = expiry && expiry.after > 0 ? clock.schedule(() => {
|
|
401
|
+
cancelTimer = void 0;
|
|
402
|
+
if (controller.signal.aborted) return;
|
|
403
|
+
expired = expiry.error();
|
|
404
|
+
controller.abort(expired);
|
|
405
|
+
}, expiry.after) : void 0;
|
|
406
|
+
const disarm = () => {
|
|
407
|
+
cancelTimer?.();
|
|
408
|
+
cancelTimer = void 0;
|
|
409
|
+
};
|
|
410
|
+
return {
|
|
411
|
+
signal: controller.signal,
|
|
412
|
+
abort: (reason) => controller.abort(reason),
|
|
413
|
+
expired: () => expired,
|
|
414
|
+
disarm,
|
|
415
|
+
cleanup: () => {
|
|
416
|
+
disarm();
|
|
417
|
+
for (const remove of detach) remove?.();
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Прерывает только ожидание: исходный промис может корректно завершить фоновую работу,
|
|
423
|
+
* а его позднее отклонение не станет необработанным.
|
|
424
|
+
*
|
|
425
|
+
* @internal
|
|
426
|
+
*/
|
|
427
|
+
function waitForRequest(promise, signal) {
|
|
428
|
+
if (signal.aborted) {
|
|
429
|
+
promise.catch(() => {});
|
|
430
|
+
return Promise.reject(new ItdAbortError(void 0, { cause: signal.reason }));
|
|
431
|
+
}
|
|
432
|
+
let onAbort;
|
|
433
|
+
const aborted = new Promise((_resolve, reject) => {
|
|
434
|
+
onAbort = () => reject(new ItdAbortError(void 0, { cause: signal.reason }));
|
|
435
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
436
|
+
});
|
|
437
|
+
return Promise.race([promise, aborted]).finally(() => {
|
|
438
|
+
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Возвращает публичную ошибку, соответствующую причине остановки ожидания.
|
|
443
|
+
*
|
|
444
|
+
* Истёкший срок отдаёт ошибку, созданную таймером области. Отмена с причиной-ошибкой
|
|
445
|
+
* библиотеки (истёкший срок родительской области) отдаёт саму причину; прочая отмена
|
|
446
|
+
* оборачивается в {@link ItdAbortError}.
|
|
447
|
+
*
|
|
448
|
+
* @internal
|
|
449
|
+
*/
|
|
450
|
+
function requestAbortError(scope, request, fallback) {
|
|
451
|
+
const expired = scope.expired();
|
|
452
|
+
if (expired) return expired;
|
|
453
|
+
if (!scope.signal.aborted) return fallback;
|
|
454
|
+
const reason = scope.signal.reason;
|
|
455
|
+
if (reason instanceof ItdTimeoutError) return reason;
|
|
456
|
+
if (fallback instanceof ItdAbortError) return fallback;
|
|
457
|
+
return new ItdAbortError(`Запрос ${request.method.toUpperCase()} ${request.path} отменён`, { cause: reason });
|
|
458
|
+
}
|
|
369
459
|
// src/core/operation.ts
|
|
370
460
|
/** HTTP-метод операции. */
|
|
371
461
|
const OperationMethod = Object.freeze({
|
|
@@ -846,6 +936,18 @@ const OPERATIONS = freezeOperations({
|
|
|
846
936
|
method: "PUT",
|
|
847
937
|
retrySafety: RetrySafety.Idempotent
|
|
848
938
|
},
|
|
939
|
+
"users.messageAllowlist": {
|
|
940
|
+
method: "GET",
|
|
941
|
+
retrySafety: RetrySafety.Safe
|
|
942
|
+
},
|
|
943
|
+
"users.addToMessageAllowlist": {
|
|
944
|
+
method: "POST",
|
|
945
|
+
retrySafety: RetrySafety.Unsafe
|
|
946
|
+
},
|
|
947
|
+
"users.removeFromMessageAllowlist": {
|
|
948
|
+
method: "DELETE",
|
|
949
|
+
retrySafety: RetrySafety.Unsafe
|
|
950
|
+
},
|
|
849
951
|
"users.pins": {
|
|
850
952
|
method: "GET",
|
|
851
953
|
retrySafety: RetrySafety.Safe,
|
|
@@ -1186,10 +1288,54 @@ const OPERATIONS = freezeOperations({
|
|
|
1186
1288
|
method: "GET",
|
|
1187
1289
|
retrySafety: RetrySafety.Safe
|
|
1188
1290
|
},
|
|
1291
|
+
"subscription.checkoutState": {
|
|
1292
|
+
method: "GET",
|
|
1293
|
+
retrySafety: RetrySafety.Safe
|
|
1294
|
+
},
|
|
1295
|
+
"subscription.payment": {
|
|
1296
|
+
method: "GET",
|
|
1297
|
+
retrySafety: RetrySafety.Safe
|
|
1298
|
+
},
|
|
1299
|
+
"subscription.gift": {
|
|
1300
|
+
method: "GET",
|
|
1301
|
+
retrySafety: RetrySafety.Safe
|
|
1302
|
+
},
|
|
1303
|
+
"subscription.giftGiver": {
|
|
1304
|
+
method: "GET",
|
|
1305
|
+
retrySafety: RetrySafety.Safe
|
|
1306
|
+
},
|
|
1307
|
+
"subscription.internationalCheckoutCapability": {
|
|
1308
|
+
method: "GET",
|
|
1309
|
+
retrySafety: RetrySafety.Safe
|
|
1310
|
+
},
|
|
1189
1311
|
"subscription.pay": {
|
|
1190
1312
|
method: "POST",
|
|
1191
1313
|
retrySafety: RetrySafety.Unsafe
|
|
1192
1314
|
},
|
|
1315
|
+
"subscription.payCheckout": {
|
|
1316
|
+
method: "POST",
|
|
1317
|
+
retrySafety: RetrySafety.Unsafe
|
|
1318
|
+
},
|
|
1319
|
+
"subscription.createGift": {
|
|
1320
|
+
method: "POST",
|
|
1321
|
+
retrySafety: RetrySafety.Unsafe
|
|
1322
|
+
},
|
|
1323
|
+
"subscription.releaseCheckout": {
|
|
1324
|
+
method: "POST",
|
|
1325
|
+
retrySafety: RetrySafety.Unsafe
|
|
1326
|
+
},
|
|
1327
|
+
"subscription.internationalCheckout": {
|
|
1328
|
+
method: "POST",
|
|
1329
|
+
retrySafety: RetrySafety.Unsafe
|
|
1330
|
+
},
|
|
1331
|
+
"subscription.resumeInternationalCheckout": {
|
|
1332
|
+
method: "POST",
|
|
1333
|
+
retrySafety: RetrySafety.Unsafe
|
|
1334
|
+
},
|
|
1335
|
+
"subscription.releaseInternationalCheckout": {
|
|
1336
|
+
method: "POST",
|
|
1337
|
+
retrySafety: RetrySafety.Unsafe
|
|
1338
|
+
},
|
|
1193
1339
|
"subscription.setAutoRenewal": {
|
|
1194
1340
|
method: "POST",
|
|
1195
1341
|
retrySafety: RetrySafety.Idempotent
|
|
@@ -1203,7 +1349,7 @@ const OPERATIONS = freezeOperations({
|
|
|
1203
1349
|
retrySafety: RetrySafety.Safe
|
|
1204
1350
|
},
|
|
1205
1351
|
"subscription.setDefaultMethod": {
|
|
1206
|
-
method: "
|
|
1352
|
+
method: "PUT",
|
|
1207
1353
|
retrySafety: RetrySafety.Idempotent
|
|
1208
1354
|
},
|
|
1209
1355
|
"subscription.removeMethod": {
|
|
@@ -1351,88 +1497,6 @@ function operationBucket(id) {
|
|
|
1351
1497
|
if (!isBuiltInOperationId(id)) return DEFAULT_RATE_LIMIT_BUCKET;
|
|
1352
1498
|
return OPERATIONS[id].bucket ?? "default";
|
|
1353
1499
|
}
|
|
1354
|
-
// src/core/execution/lifecycle.ts
|
|
1355
|
-
/**
|
|
1356
|
-
* Объединяет отмену вызова, завершение владельца и срок ожидания в один сигнал.
|
|
1357
|
-
*
|
|
1358
|
-
* Истечение срока отменяет сигнал ошибкой из `expiry.error`; она же становится
|
|
1359
|
-
* `signal.reason`.
|
|
1360
|
-
*
|
|
1361
|
-
* @internal
|
|
1362
|
-
*/
|
|
1363
|
-
function createRequestAbortScope(signal, lifetimeSignal, clock, expiry) {
|
|
1364
|
-
const controller = new AbortController();
|
|
1365
|
-
let expired;
|
|
1366
|
-
const link = (source) => {
|
|
1367
|
-
if (!source) return void 0;
|
|
1368
|
-
if (source.aborted) {
|
|
1369
|
-
controller.abort(source.reason);
|
|
1370
|
-
return;
|
|
1371
|
-
}
|
|
1372
|
-
const onAbort = () => controller.abort(source.reason);
|
|
1373
|
-
source.addEventListener("abort", onAbort, { once: true });
|
|
1374
|
-
return () => source.removeEventListener("abort", onAbort);
|
|
1375
|
-
};
|
|
1376
|
-
const detach = [link(signal), link(lifetimeSignal)];
|
|
1377
|
-
let cancelTimer = expiry && expiry.after > 0 ? clock.schedule(() => {
|
|
1378
|
-
cancelTimer = void 0;
|
|
1379
|
-
if (controller.signal.aborted) return;
|
|
1380
|
-
expired = expiry.error();
|
|
1381
|
-
controller.abort(expired);
|
|
1382
|
-
}, expiry.after) : void 0;
|
|
1383
|
-
const disarm = () => {
|
|
1384
|
-
cancelTimer?.();
|
|
1385
|
-
cancelTimer = void 0;
|
|
1386
|
-
};
|
|
1387
|
-
return {
|
|
1388
|
-
signal: controller.signal,
|
|
1389
|
-
abort: (reason) => controller.abort(reason),
|
|
1390
|
-
expired: () => expired,
|
|
1391
|
-
disarm,
|
|
1392
|
-
cleanup: () => {
|
|
1393
|
-
disarm();
|
|
1394
|
-
for (const remove of detach) remove?.();
|
|
1395
|
-
}
|
|
1396
|
-
};
|
|
1397
|
-
}
|
|
1398
|
-
/**
|
|
1399
|
-
* Прерывает только ожидание: исходный промис может корректно завершить фоновую работу,
|
|
1400
|
-
* а его позднее отклонение не станет необработанным.
|
|
1401
|
-
*
|
|
1402
|
-
* @internal
|
|
1403
|
-
*/
|
|
1404
|
-
function waitForRequest(promise, signal) {
|
|
1405
|
-
if (signal.aborted) {
|
|
1406
|
-
promise.catch(() => {});
|
|
1407
|
-
return Promise.reject(new ItdAbortError(void 0, { cause: signal.reason }));
|
|
1408
|
-
}
|
|
1409
|
-
let onAbort;
|
|
1410
|
-
const aborted = new Promise((_resolve, reject) => {
|
|
1411
|
-
onAbort = () => reject(new ItdAbortError(void 0, { cause: signal.reason }));
|
|
1412
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
1413
|
-
});
|
|
1414
|
-
return Promise.race([promise, aborted]).finally(() => {
|
|
1415
|
-
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
1416
|
-
});
|
|
1417
|
-
}
|
|
1418
|
-
/**
|
|
1419
|
-
* Возвращает публичную ошибку, соответствующую причине остановки ожидания.
|
|
1420
|
-
*
|
|
1421
|
-
* Истёкший срок отдаёт ошибку, созданную таймером области. Отмена с причиной-ошибкой
|
|
1422
|
-
* библиотеки (истёкший срок родительской области) отдаёт саму причину; прочая отмена
|
|
1423
|
-
* оборачивается в {@link ItdAbortError}.
|
|
1424
|
-
*
|
|
1425
|
-
* @internal
|
|
1426
|
-
*/
|
|
1427
|
-
function requestAbortError(scope, request, fallback) {
|
|
1428
|
-
const expired = scope.expired();
|
|
1429
|
-
if (expired) return expired;
|
|
1430
|
-
if (!scope.signal.aborted) return fallback;
|
|
1431
|
-
const reason = scope.signal.reason;
|
|
1432
|
-
if (reason instanceof ItdTimeoutError) return reason;
|
|
1433
|
-
if (fallback instanceof ItdAbortError) return fallback;
|
|
1434
|
-
return new ItdAbortError(`Запрос ${request.method.toUpperCase()} ${request.path} отменён`, { cause: reason });
|
|
1435
|
-
}
|
|
1436
1500
|
// src/operations/common.ts
|
|
1437
1501
|
/** Контракт встроенной операции без дополнительного преобразования результата. */
|
|
1438
1502
|
function passthroughOperation(id) {
|
|
@@ -1537,7 +1601,7 @@ const RateLimitPacing = Object.freeze({
|
|
|
1537
1601
|
});
|
|
1538
1602
|
// src/core/version.ts
|
|
1539
1603
|
/** Версия библиотеки. Попадает в `User-Agent`. */
|
|
1540
|
-
const LIBRARY_VERSION = "0.14.
|
|
1604
|
+
const LIBRARY_VERSION = "0.14.1";
|
|
1541
1605
|
// src/core/config.ts
|
|
1542
1606
|
/** Базовый URL API итд.com. Домен записан в punycode: `итд.com`. */
|
|
1543
1607
|
const DEFAULT_BASE_URL = "https://xn--d1ah4a.com";
|
|
@@ -4508,6 +4572,10 @@ const TEMPLATES = Object.freeze({
|
|
|
4508
4572
|
[NotificationType.VerificationRejected]: {
|
|
4509
4573
|
one: () => "Ваша заявка на верификацию отклонена",
|
|
4510
4574
|
many: () => "Ваша заявка на верификацию отклонена"
|
|
4575
|
+
},
|
|
4576
|
+
[NotificationType.SubscriptionGift]: {
|
|
4577
|
+
one: (name) => `${name} подарил(а) вам подписку`,
|
|
4578
|
+
many: (name, others) => `${name} и ещё ${others} подарили вам подписку`
|
|
4511
4579
|
}
|
|
4512
4580
|
});
|
|
4513
4581
|
/**
|
|
@@ -4572,8 +4640,9 @@ function resolveNotificationUrl(notification) {
|
|
|
4572
4640
|
if (COMMENT_TYPES.has(type)) return parentEntityId ? `/@${username}/post/${parentEntityId}?comment=${entityId}` : `/@${username}/post/${entityId}`;
|
|
4573
4641
|
}
|
|
4574
4642
|
if (username && FOLLOW_TYPES.has(type)) return `/@${username}`;
|
|
4643
|
+
if (type === NotificationType.SubscriptionGift) return clickUrl || "/settings/subscription";
|
|
4575
4644
|
return clickUrl || "/notifications";
|
|
4576
4645
|
}
|
|
4577
|
-
export { CommentSort as $, passthroughOperation as A,
|
|
4646
|
+
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 };
|
|
4578
4647
|
|
|
4579
|
-
//# sourceMappingURL=url-
|
|
4648
|
+
//# sourceMappingURL=url-DYGRJqxh.js.map
|