itd-api 0.14.0 → 0.14.2
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 +4 -4
- package/dist/events/index.d.cts +2 -2
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.js +4 -4
- package/dist/index.cjs +38 -23
- 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 +31 -24
- package/dist/index.js.map +1 -1
- package/dist/node/index.cjs +5 -5
- package/dist/node/index.js +5 -5
- package/dist/rest/index.cjs +13 -5
- package/dist/rest/index.d.cts +3 -3
- package/dist/rest/index.d.ts +3 -3
- package/dist/rest/index.js +6 -6
- package/dist/shared/{cookies-Bw5HAxTB.js → cookies-BdntFeQ5.js} +4 -3
- package/dist/shared/cookies-BdntFeQ5.js.map +1 -0
- package/dist/shared/{cookies-DRYS-vZm.cjs → cookies-D68xbO4E.cjs} +4 -3
- package/dist/shared/cookies-D68xbO4E.cjs.map +1 -0
- package/dist/shared/{events-Dl27rIA0.d.cts → events-B2D1rsQf.d.cts} +1 -1
- package/dist/shared/{events--hwTmeN2.cjs → events-B_97nfiJ.cjs} +13 -13
- package/dist/shared/events-B_97nfiJ.cjs.map +1 -0
- package/dist/shared/{events-g5XfBnc3.d.ts → events-BcR4RzSS.d.ts} +1 -1
- package/dist/shared/{events-DXLOZXNe.js → events-CzYBo3XI.js} +13 -13
- package/dist/shared/events-CzYBo3XI.js.map +1 -0
- package/dist/shared/{key-value-store-BwXlaoD4.js → key-value-store-BJdmlzkM.js} +2 -2
- package/dist/shared/{key-value-store-BwXlaoD4.js.map → key-value-store-BJdmlzkM.js.map} +1 -1
- package/dist/shared/{key-value-store-CmnIjuE4.cjs → key-value-store-Bxt33ZF3.cjs} +2 -2
- package/dist/shared/{key-value-store-CmnIjuE4.cjs.map → key-value-store-Bxt33ZF3.cjs.map} +1 -1
- package/dist/shared/{multi-storage-DDQKI9yT.cjs → multi-storage-BNiP6Mbq.cjs} +5 -5
- package/dist/shared/{multi-storage-DDQKI9yT.cjs.map → multi-storage-BNiP6Mbq.cjs.map} +1 -1
- package/dist/shared/{multi-storage-BDwZ3sOJ.js → multi-storage-hYW_Whkx.js} +5 -5
- package/dist/shared/{multi-storage-BDwZ3sOJ.js.map → multi-storage-hYW_Whkx.js.map} +1 -1
- package/dist/shared/{options-RfX5uXP5.js → options-BqQVtTmm.js} +3 -3
- package/dist/shared/{options-RfX5uXP5.js.map → options-BqQVtTmm.js.map} +1 -1
- package/dist/shared/{options-BrA90TVm.cjs → options-C2WubUA6.cjs} +3 -3
- package/dist/shared/{options-BrA90TVm.cjs.map → options-C2WubUA6.cjs.map} +1 -1
- package/dist/shared/{render-C11kvqb5.d.ts → render-4Rp2sa1a.d.ts} +726 -248
- package/dist/shared/{render-DHeGjOzq.cjs → render-B67QcLUQ.cjs} +1715 -1242
- package/dist/shared/render-B67QcLUQ.cjs.map +1 -0
- package/dist/shared/{render-B6sj0OJ5.js → render-CXxr13yg.js} +1710 -1279
- package/dist/shared/render-CXxr13yg.js.map +1 -0
- package/dist/shared/{render-D_pGoEH3.d.cts → render-DaHR-AHp.d.cts} +726 -248
- package/dist/shared/{storage-Bc4lWtSj.js → storage-8oAVzQmF.js} +3 -3
- package/dist/shared/{storage-Bc4lWtSj.js.map → storage-8oAVzQmF.js.map} +1 -1
- package/dist/shared/{storage-e2xYL6ro.cjs → storage-xximVWs_.cjs} +3 -3
- package/dist/shared/{storage-e2xYL6ro.cjs.map → storage-xximVWs_.cjs.map} +1 -1
- package/dist/shared/{url-B6_um5qJ.d.cts → url-DVN-pqkV.d.cts} +102 -18
- package/dist/shared/{url-BPqHN_CZ.d.ts → url-Dey3grvo.d.ts} +102 -18
- package/dist/shared/{url-W5GQOtlk.cjs → url-HVCnoH85.cjs} +167 -93
- package/dist/shared/url-HVCnoH85.cjs.map +1 -0
- package/dist/shared/{url-CY2NxyqI.js → url-ww6B39DX.js} +168 -94
- package/dist/shared/url-ww6B39DX.js.map +1 -0
- package/dist/shared/{validate-BHKy_YMv.cjs → validate-CbM3k811.cjs} +21 -1
- package/dist/shared/validate-CbM3k811.cjs.map +1 -0
- package/dist/shared/{validate-BQzL_oJ4.js → validate-oLSGiGwQ.js} +16 -2
- package/dist/shared/validate-oLSGiGwQ.js.map +1 -0
- package/dist/web/index.cjs +3 -3
- package/dist/web/index.js +3 -3
- 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
- package/dist/shared/validate-BHKy_YMv.cjs.map +0 -1
- package/dist/shared/validate-BQzL_oJ4.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ItdValidationError,
|
|
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-
|
|
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 createDeviceId } from "./cookies-BdntFeQ5.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.2";
|
|
1541
1605
|
// src/core/config.ts
|
|
1542
1606
|
/** Базовый URL API итд.com. Домен записан в punycode: `итд.com`. */
|
|
1543
1607
|
const DEFAULT_BASE_URL = "https://xn--d1ah4a.com";
|
|
@@ -3624,7 +3688,12 @@ function createApiError(context) {
|
|
|
3624
3688
|
...init,
|
|
3625
3689
|
userId: parsed.userId
|
|
3626
3690
|
});
|
|
3627
|
-
|
|
3691
|
+
const Ctor = CODE_TO_CLASS[parsed.code] ?? classByStatus(context.status);
|
|
3692
|
+
if (Ctor === ItdRateLimitError) return new ItdRateLimitError({
|
|
3693
|
+
...init,
|
|
3694
|
+
scope: context.headers?.get("X-RateLimit-Scope") ?? void 0
|
|
3695
|
+
});
|
|
3696
|
+
return new Ctor(init);
|
|
3628
3697
|
}
|
|
3629
3698
|
// src/core/execution/transport.ts
|
|
3630
3699
|
/** Ставит заголовок, превращая ошибку среды в понятную ошибку конфигурации. */
|
|
@@ -4508,6 +4577,10 @@ const TEMPLATES = Object.freeze({
|
|
|
4508
4577
|
[NotificationType.VerificationRejected]: {
|
|
4509
4578
|
one: () => "Ваша заявка на верификацию отклонена",
|
|
4510
4579
|
many: () => "Ваша заявка на верификацию отклонена"
|
|
4580
|
+
},
|
|
4581
|
+
[NotificationType.SubscriptionGift]: {
|
|
4582
|
+
one: (name) => `${name} подарил(а) вам подписку`,
|
|
4583
|
+
many: (name, others) => `${name} и ещё ${others} подарили вам подписку`
|
|
4511
4584
|
}
|
|
4512
4585
|
});
|
|
4513
4586
|
/**
|
|
@@ -4572,8 +4645,9 @@ function resolveNotificationUrl(notification) {
|
|
|
4572
4645
|
if (COMMENT_TYPES.has(type)) return parentEntityId ? `/@${username}/post/${parentEntityId}?comment=${entityId}` : `/@${username}/post/${entityId}`;
|
|
4573
4646
|
}
|
|
4574
4647
|
if (username && FOLLOW_TYPES.has(type)) return `/@${username}`;
|
|
4648
|
+
if (type === NotificationType.SubscriptionGift) return clickUrl || "/settings/subscription";
|
|
4575
4649
|
return clickUrl || "/notifications";
|
|
4576
4650
|
}
|
|
4577
|
-
export { CommentSort as $, passthroughOperation as A,
|
|
4651
|
+
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
4652
|
|
|
4579
|
-
//# sourceMappingURL=url-
|
|
4653
|
+
//# sourceMappingURL=url-ww6B39DX.js.map
|