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
|
/** Имя встроенного сервиса статуса. */
|
|
@@ -2526,6 +2581,19 @@ interface PrivacySettings {
|
|
|
2526
2581
|
/** Показывать ли время последнего посещения. */
|
|
2527
2582
|
showLastSeen: boolean;
|
|
2528
2583
|
}
|
|
2584
|
+
/** Пользователь, добавленный в список исключений для личных сообщений. */
|
|
2585
|
+
interface MessageAllowlistUser extends Pick<UserBase, 'id' | 'displayName'> {
|
|
2586
|
+
username?: string | null;
|
|
2587
|
+
avatar?: string | null;
|
|
2588
|
+
verified?: boolean;
|
|
2589
|
+
hasNuksta?: boolean;
|
|
2590
|
+
/** Время добавления в список. */
|
|
2591
|
+
addedAt?: IsoDate | null;
|
|
2592
|
+
}
|
|
2593
|
+
/** Принадлежность пользователя к списку исключений для личных сообщений. */
|
|
2594
|
+
interface MessageAllowlistMembership {
|
|
2595
|
+
inMessageAllowlist: boolean;
|
|
2596
|
+
}
|
|
2529
2597
|
/**
|
|
2530
2598
|
* Результат подписки на пользователя.
|
|
2531
2599
|
*
|
|
@@ -2692,4 +2760,4 @@ declare function isKnownNotificationType(type: string): boolean;
|
|
|
2692
2760
|
* ```
|
|
2693
2761
|
*/
|
|
2694
2762
|
declare function resolveNotificationUrl(notification: Notification): string;
|
|
2695
|
-
export {
|
|
2763
|
+
export { ItdServerError as $, OPERATIONS as $t, ClientConnection as A, ReportTargetType as An, RateLimitBucketOverride as At, ItdAuthError as B, RuntimeOptions as Bt, SubscriptionState as C, LastSeenUnit as Cn, OperationMethod as Ct, Emitter as D, NotificationType as Dn, OperationRequestOptions as Dt, UsernameAvailability as E, MessageAccess as En, ErrorContextHook as Et, tokenProvider as F, ViewSource as Fn, RequestOptions as Ft, ItdFieldErrors as G, RuntimeMode as Gt, ItdConflictError as H, QueryValue as Ht, ItdAbortError as I, WallAccess as In, ResponseContext as It, ItdForbiddenError as J, ItdClock as Jt, ItdFileError as K, LogLevel as Kt, ItdApiError as L, RetryContext as Lt, AuthProvider as M, SpanType as Mn, RawRequestOptions as Mt, anonymousAuth as N, UsernameUnavailableReason as Nn, RequestContext as Nt, Listener as O, QrLocationPrecision as On, PaginationOptions as Ot, bearerToken as P, ViewReason as Pn, RequestExtensions as Pt, ItdRateLimitError as Q, ItdOperationDefinition as Qt, ItdApiErrorInit as R, RetryDecisionContext as Rt, PublicProfile as S, ItdErrorCode as Sn, OperationMetadata as St, UserSummary as T, Loose as Tn, ClientHooks as Tt, ItdError as U, ServiceDefinition as Ut, ItdConfigError as V, QueryParams as Vt, ItdErrorKind as W, RateLimitPacing as Wt, ItdNotFoundError as X, BuiltInOperationId as Xt, ItdNetworkError as Y, systemClock as Yt, ItdPhoneVerificationError as Z, CustomOperationId as Zt, MyProfile as _, CommentSort as _n, STATUS_SERVICE as _t, NotificationEvent as a, BUCKET_LIMITS as an, isItdAuthError as at, PrivacySettings as b, IncidentKind as bn, OperationAnnotations as bt, NotificationSettings as c, IsoDate as cn, isItdFileError as ct, AuthUser as d, UserRef as dn, isItdPhoneVerificationError as dt, OperationId as en, ItdStateError as et, Author as f, AccessType as fn, isItdRateLimitError as ft, MessageAllowlistUser as g, CaptchaType as gn, DEFAULT_BASE_URL as gt, MessageAllowlistMembership as h, CaptchaField as hn, isItdValidationError as ht, formatNotificationText as i, operationRetrySafety as in, isItdApiError as it, AuthIdentity as j, ServiceState as jn, RateLimitOptions as jt, Unsubscribe as k, ReportReason as kn, RateLimitBucketContext as kt, Actor as l, Span as ln, isItdForbiddenError as lt, LastSeen as m, CaptchaChoice as mn, isItdStateError as mt, canonicalNotificationType as n, operationBucket as nn, ItdValidationError as nt, normalizeNotification as o, DEFAULT_RATE_LIMIT_BUCKET as on, isItdConflictError as ot, FollowResult as p, AttachmentType as pn, isItdServerError as pt, ItdFileErrorReason as q, Logger as qt, isKnownNotificationType as r, operationMethod as rn, TimeoutBudget as rt, Notification as s, RateLimitBucket as sn, isItdError as st, resolveNotificationUrl as t, isBuiltInOperationId as tn, ItdTimeoutError as tt, AuthState as u, UserId as un, isItdNotFoundError as ut, Pin as v, EventChannelStatus as vn, LIBRARY_VERSION as vt, UserBase as w, LikesVisibility as wn, RetrySafety as wt, Profile as x, InteractionType as xn, OperationContract as xt, PinsResult as y, FeedTab as yn, FeatureOperationId as yt, ItdApiErrorKind as z, RetryOptions as zt };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_validate = require("./validate-BHKy_YMv.cjs");
|
|
2
|
-
const require_cookies = require("./cookies-
|
|
2
|
+
const require_cookies = require("./cookies-u2hXCcpR.cjs");
|
|
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 require_validate.ItdAbortError(void 0, { cause: signal.reason }));
|
|
431
|
+
}
|
|
432
|
+
let onAbort;
|
|
433
|
+
const aborted = new Promise((_resolve, reject) => {
|
|
434
|
+
onAbort = () => reject(new require_validate.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 require_validate.ItdTimeoutError) return reason;
|
|
456
|
+
if (fallback instanceof require_validate.ItdAbortError) return fallback;
|
|
457
|
+
return new require_validate.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 require_validate.ItdAbortError(void 0, { cause: signal.reason }));
|
|
1408
|
-
}
|
|
1409
|
-
let onAbort;
|
|
1410
|
-
const aborted = new Promise((_resolve, reject) => {
|
|
1411
|
-
onAbort = () => reject(new require_validate.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 require_validate.ItdTimeoutError) return reason;
|
|
1433
|
-
if (fallback instanceof require_validate.ItdAbortError) return fallback;
|
|
1434
|
-
return new require_validate.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,6 +4640,7 @@ 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
4646
|
Object.defineProperty(exports, "AccessType", {
|
|
@@ -5013,4 +5082,4 @@ Object.defineProperty(exports, "waitForRequest", {
|
|
|
5013
5082
|
}
|
|
5014
5083
|
});
|
|
5015
5084
|
|
|
5016
|
-
//# sourceMappingURL=url-
|
|
5085
|
+
//# sourceMappingURL=url-CQbNqbJX.cjs.map
|