itd-api 0.12.0 → 0.13.0
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 +4 -4
- package/dist/events/index.d.cts +7 -2
- package/dist/events/index.d.ts +7 -2
- package/dist/events/index.js +4 -4
- package/dist/index.cjs +672 -90
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +497 -46
- package/dist/index.d.ts +497 -46
- package/dist/index.js +664 -91
- package/dist/index.js.map +1 -1
- package/dist/node/index.cjs +6 -7
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +24 -7
- package/dist/node/index.d.ts +24 -7
- package/dist/node/index.js +6 -7
- package/dist/node/index.js.map +1 -1
- package/dist/rest/index.cjs +19 -7
- package/dist/rest/index.cjs.map +1 -1
- package/dist/rest/index.d.cts +28 -7
- package/dist/rest/index.d.ts +28 -7
- package/dist/rest/index.js +17 -8
- package/dist/rest/index.js.map +1 -1
- package/dist/shared/{contracts-BoT7msmq.d.ts → contracts-DEbkC0cB.d.cts} +1 -4
- package/dist/shared/{contracts-BoT7msmq.d.cts → contracts-pxnDIsQP.d.ts} +1 -4
- package/dist/shared/{events-9L0Fonak.d.cts → events-B6uqXOSs.d.cts} +42 -63
- package/dist/shared/{events-D1BfefBT.js → events-C_MgYlXR.js} +30 -40
- package/dist/shared/events-C_MgYlXR.js.map +1 -0
- package/dist/shared/{events-C2DJZyI0.cjs → events-DV1i1t6J.cjs} +30 -40
- package/dist/shared/events-DV1i1t6J.cjs.map +1 -0
- package/dist/shared/{events-BpLAIiMj.d.ts → events-D_aMNrPd.d.ts} +2 -23
- package/dist/shared/{key-value-store-DYSPsqwq.cjs → key-value-store-6DHm_iNW.cjs} +3 -4
- package/dist/shared/{key-value-store-DYSPsqwq.cjs.map → key-value-store-6DHm_iNW.cjs.map} +1 -1
- package/dist/shared/{key-value-store-COZaNHZS.d.ts → key-value-store-BGoSgLze.d.cts} +1 -4
- package/dist/shared/{key-value-store-w1Dn5Pjb.js → key-value-store-PnZE_DFC.js} +3 -4
- package/dist/shared/{key-value-store-w1Dn5Pjb.js.map → key-value-store-PnZE_DFC.js.map} +1 -1
- package/dist/shared/{key-value-store-COZaNHZS.d.cts → key-value-store-WUQBeTAr.d.ts} +1 -4
- package/dist/shared/{multi-storage-DiBSx64p.js → multi-storage-DM0skcSO.js} +6 -7
- package/dist/shared/{multi-storage-DiBSx64p.js.map → multi-storage-DM0skcSO.js.map} +1 -1
- package/dist/shared/{multi-storage-LkljOSzA.d.ts → multi-storage-DQiERirK.d.ts} +3 -6
- package/dist/shared/{multi-storage-7Y3KCseI.cjs → multi-storage-DnonVBfO.cjs} +6 -7
- package/dist/shared/multi-storage-DnonVBfO.cjs.map +1 -0
- package/dist/shared/{multi-storage-BEL7tcKn.d.cts → multi-storage-OGWNMK3x.d.cts} +3 -6
- package/dist/shared/{options-D5ttspWk.cjs → options-SvAWOaqT.cjs} +8 -12
- package/dist/shared/{options-D5ttspWk.cjs.map → options-SvAWOaqT.cjs.map} +1 -1
- package/dist/shared/{options-DLlaETn_.js → options-bS27r_gR.js} +8 -12
- package/dist/shared/{options-DLlaETn_.js.map → options-bS27r_gR.js.map} +1 -1
- package/dist/shared/{redact-DSfdmeY7.js → redact-C4b2NzdB.js} +16 -16
- package/dist/shared/redact-C4b2NzdB.js.map +1 -0
- package/dist/shared/{redact-BbhtA9o-.cjs → redact-DDGkv8KF.cjs} +16 -16
- package/dist/shared/redact-DDGkv8KF.cjs.map +1 -0
- package/dist/shared/{render-CrGXcj6L.cjs → render-0-JJPOwb.cjs} +222 -111
- package/dist/shared/render-0-JJPOwb.cjs.map +1 -0
- package/dist/shared/{render-D3vSEbLL.js → render-CF49aBO8.js} +199 -112
- package/dist/shared/render-CF49aBO8.js.map +1 -0
- package/dist/shared/{render-Dzw3KeN5.d.cts → render-CYVOc_IW.d.cts} +191 -308
- package/dist/shared/{render-UsQ1hb2U.d.ts → render-eOxYgdoA.d.ts} +191 -159
- package/dist/shared/{storage-86wiHeXD.js → storage-B6OkSi38.js} +4 -5
- package/dist/shared/{storage-86wiHeXD.js.map → storage-B6OkSi38.js.map} +1 -1
- package/dist/shared/{storage-CTRGT5wF.d.ts → storage-C_ZujAZt.d.ts} +2 -5
- package/dist/shared/{storage-CIjejZDt.cjs → storage-CezF2Mvz.cjs} +4 -5
- package/dist/shared/{storage-CIjejZDt.cjs.map → storage-CezF2Mvz.cjs.map} +1 -1
- package/dist/shared/{storage-BQrtKon9.d.cts → storage-FtS4NIC7.d.cts} +2 -5
- package/dist/shared/{url-Dg1u29cu.js → url-CPKhcxf1.js} +250 -91
- package/dist/shared/url-CPKhcxf1.js.map +1 -0
- package/dist/shared/{url-C9YADYNg.d.cts → url-DCqxoxGX.d.cts} +1909 -1634
- package/dist/shared/{url-C9YADYNg.d.ts → url-DL5Mip4L.d.ts} +230 -104
- package/dist/shared/{url-B21Bdmw_.cjs → url-DOfjru6L.cjs} +250 -91
- package/dist/shared/url-DOfjru6L.cjs.map +1 -0
- package/dist/shared/{validate-D7_kq3g5.js → validate-B5l_vLKD.js} +5 -7
- package/dist/shared/validate-B5l_vLKD.js.map +1 -0
- package/dist/shared/{validate-CFx2dISs.cjs → validate-CfxCK1BC.cjs} +5 -7
- package/dist/shared/validate-CfxCK1BC.cjs.map +1 -0
- package/dist/web/index.cjs +4 -5
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.d.cts +22 -5
- package/dist/web/index.d.ts +22 -5
- package/dist/web/index.js +4 -5
- package/dist/web/index.js.map +1 -1
- package/package.json +6 -6
- package/dist/shared/events-C2DJZyI0.cjs.map +0 -1
- package/dist/shared/events-D1BfefBT.js.map +0 -1
- package/dist/shared/multi-storage-7Y3KCseI.cjs.map +0 -1
- package/dist/shared/redact-BbhtA9o-.cjs.map +0 -1
- package/dist/shared/redact-DSfdmeY7.js.map +0 -1
- package/dist/shared/render-CrGXcj6L.cjs.map +0 -1
- package/dist/shared/render-D3vSEbLL.js.map +0 -1
- package/dist/shared/url-B21Bdmw_.cjs.map +0 -1
- package/dist/shared/url-Dg1u29cu.js.map +0 -1
- package/dist/shared/validate-CFx2dISs.cjs.map +0 -1
- package/dist/shared/validate-D7_kq3g5.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_validate = require("./validate-
|
|
2
|
-
const require_redact = require("./redact-
|
|
3
|
-
|
|
1
|
+
const require_validate = require("./validate-CfxCK1BC.cjs");
|
|
2
|
+
const require_redact = require("./redact-DDGkv8KF.cjs");
|
|
3
|
+
// src/core/async-dispose.ts
|
|
4
4
|
/**
|
|
5
5
|
* Подставляет метод `await using` там, где `Symbol.asyncDispose` отсутствует.
|
|
6
6
|
*
|
|
@@ -17,8 +17,7 @@ function installAsyncDisposeFallback(target) {
|
|
|
17
17
|
prototype[Symbol.for("Symbol.asyncDispose")] = prototype.undefined;
|
|
18
18
|
delete prototype.undefined;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
//#region src/core/clock.ts
|
|
20
|
+
// src/core/clock.ts
|
|
22
21
|
/** Системные часы, используемые клиентом по умолчанию. */
|
|
23
22
|
const systemClock = Object.freeze({
|
|
24
23
|
now: () => Date.now(),
|
|
@@ -50,8 +49,7 @@ function createDeadline(timeout, clock = systemClock) {
|
|
|
50
49
|
cancel: clock.schedule(() => expire(), timeout)
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
|
-
|
|
54
|
-
//#region src/core/scheduling/pacing.ts
|
|
52
|
+
// src/core/scheduling/pacing.ts
|
|
55
53
|
/** Реакция на остаток лимита из заголовков ответа. */
|
|
56
54
|
const RateLimitPacing = Object.freeze({
|
|
57
55
|
/** Задержек нет, пока в бакете есть остаток; исчерпанный бакет ждёт `60000 / limit`. */
|
|
@@ -61,12 +59,10 @@ const RateLimitPacing = Object.freeze({
|
|
|
61
59
|
/** Остаток на темп не влияет; остаётся пауза после `429`. */
|
|
62
60
|
Off: "off"
|
|
63
61
|
});
|
|
64
|
-
|
|
65
|
-
//#region src/core/version.ts
|
|
62
|
+
// src/core/version.ts
|
|
66
63
|
/** Версия библиотеки. Попадает в `User-Agent`. */
|
|
67
|
-
const LIBRARY_VERSION = "0.
|
|
68
|
-
|
|
69
|
-
//#region src/core/config.ts
|
|
64
|
+
const LIBRARY_VERSION = "0.13.0";
|
|
65
|
+
// src/core/config.ts
|
|
70
66
|
/** Базовый URL API итд.com. Домен записан в punycode: `итд.com`. */
|
|
71
67
|
const DEFAULT_BASE_URL = "https://xn--d1ah4a.com";
|
|
72
68
|
/** Базовый URL страницы статуса. Домен записан в punycode: `статус.итд.com`. */
|
|
@@ -298,8 +294,7 @@ function resolveRuntimeConfig(options, catalog) {
|
|
|
298
294
|
logger: require_redact.resolveLogger(options.logger)
|
|
299
295
|
};
|
|
300
296
|
}
|
|
301
|
-
|
|
302
|
-
//#region src/core/plugins/attempts.ts
|
|
297
|
+
// src/core/plugins/attempts.ts
|
|
303
298
|
const ATTEMPT_SCOPE = Symbol("itd-api.attempt-interceptors");
|
|
304
299
|
/** Структурная проверка сохраняет совместимость с fetch-polyfill из другого realm. */
|
|
305
300
|
function isResponse(value) {
|
|
@@ -336,8 +331,7 @@ async function runAttemptInterceptors(interceptors, context, execute) {
|
|
|
336
331
|
return response;
|
|
337
332
|
}, execute)();
|
|
338
333
|
}
|
|
339
|
-
|
|
340
|
-
//#region src/core/plugins/order.ts
|
|
334
|
+
// src/core/plugins/order.ts
|
|
341
335
|
const RELATION_FIELDS = [
|
|
342
336
|
"requires",
|
|
343
337
|
"conflicts",
|
|
@@ -449,8 +443,7 @@ function assertPluginRemovable(plugins, name) {
|
|
|
449
443
|
const dependent = plugins.find((plugin) => plugin.requires?.includes(name));
|
|
450
444
|
if (dependent) throw new require_validate.ItdConfigError(`нельзя отключить плагин «${name}»: от него зависит «${dependent.name}»`);
|
|
451
445
|
}
|
|
452
|
-
|
|
453
|
-
//#region src/core/plugins/registry.ts
|
|
446
|
+
// src/core/plugins/registry.ts
|
|
454
447
|
/**
|
|
455
448
|
* Список подключённых плагинов и зарегистрированных ими расширений.
|
|
456
449
|
*
|
|
@@ -705,8 +698,7 @@ var PluginRegistry = class {
|
|
|
705
698
|
return cleanup;
|
|
706
699
|
}
|
|
707
700
|
};
|
|
708
|
-
|
|
709
|
-
//#region src/core/scheduling/rate-limit.ts
|
|
701
|
+
// src/core/scheduling/rate-limit.ts
|
|
710
702
|
/** Ошибка отмены запроса, который ещё не дошёл до транспорта. */
|
|
711
703
|
function queueAbortError() {
|
|
712
704
|
return new require_validate.ItdAbortError("Запрос отменён во время ожидания очереди");
|
|
@@ -1168,8 +1160,7 @@ var RequestQueuePool = class {
|
|
|
1168
1160
|
this.#destinations.clear();
|
|
1169
1161
|
}
|
|
1170
1162
|
};
|
|
1171
|
-
|
|
1172
|
-
//#region src/core/services.ts
|
|
1163
|
+
// src/core/services.ts
|
|
1173
1164
|
/**
|
|
1174
1165
|
* Накладывает пользовательское определение на встроенное.
|
|
1175
1166
|
*
|
|
@@ -1292,19 +1283,16 @@ var ServiceRegistry = class {
|
|
|
1292
1283
|
return require_redact.isSameSite(this.#primaryHost, require_redact.hostOf(baseUrl));
|
|
1293
1284
|
}
|
|
1294
1285
|
};
|
|
1295
|
-
|
|
1296
|
-
//#region src/core/plugins/hooks.ts
|
|
1286
|
+
// src/core/plugins/hooks.ts
|
|
1297
1287
|
/** Проверяет наличие публичного hook, не создавая дорогой контекст. @internal */
|
|
1298
1288
|
function hasRequestHook(hooks, field) {
|
|
1299
1289
|
return hooks[field] !== void 0;
|
|
1300
1290
|
}
|
|
1301
1291
|
/** Последовательно вызывает публичный hook конструктора. @internal */
|
|
1302
1292
|
async function dispatchRequestHook(hooks, field, context) {
|
|
1303
|
-
|
|
1304
|
-
await hook?.(context);
|
|
1293
|
+
await (0, hooks[field])?.(context);
|
|
1305
1294
|
}
|
|
1306
|
-
|
|
1307
|
-
//#region src/core/execution/lifecycle.ts
|
|
1295
|
+
// src/core/execution/lifecycle.ts
|
|
1308
1296
|
/**
|
|
1309
1297
|
* Объединяет отмену вызова, завершение владельца и срок ожидания в один сигнал.
|
|
1310
1298
|
*
|
|
@@ -1386,8 +1374,7 @@ function requestAbortError(scope, request, fallback) {
|
|
|
1386
1374
|
if (fallback instanceof require_validate.ItdAbortError) return fallback;
|
|
1387
1375
|
return new require_validate.ItdAbortError(`Запрос ${request.method.toUpperCase()} ${request.path} отменён`, { cause: reason });
|
|
1388
1376
|
}
|
|
1389
|
-
|
|
1390
|
-
//#region src/core/execution/pipeline.ts
|
|
1377
|
+
// src/core/execution/pipeline.ts
|
|
1391
1378
|
const OPERATION_STATE = Symbol("itd-api.operation-state");
|
|
1392
1379
|
function operationState(request) {
|
|
1393
1380
|
const internal = request;
|
|
@@ -1545,8 +1532,7 @@ function withLayerHeaders(request, headers) {
|
|
|
1545
1532
|
}
|
|
1546
1533
|
};
|
|
1547
1534
|
}
|
|
1548
|
-
|
|
1549
|
-
//#region src/core/execution/http.ts
|
|
1535
|
+
// src/core/execution/http.ts
|
|
1550
1536
|
/** Собирает запрос конвейера из контракта операции и параметров вызова. */
|
|
1551
1537
|
function operationRequest(operation, options) {
|
|
1552
1538
|
return {
|
|
@@ -1674,8 +1660,7 @@ var HttpClient = class {
|
|
|
1674
1660
|
}
|
|
1675
1661
|
}
|
|
1676
1662
|
};
|
|
1677
|
-
|
|
1678
|
-
//#region src/core/operation.ts
|
|
1663
|
+
// src/core/operation.ts
|
|
1679
1664
|
/** HTTP-метод операции. */
|
|
1680
1665
|
const OperationMethod = Object.freeze({
|
|
1681
1666
|
Get: "GET",
|
|
@@ -1737,8 +1722,7 @@ function identityResult(body) {
|
|
|
1737
1722
|
}
|
|
1738
1723
|
/** Отбрасывает служебное тело операции без результата. @internal */
|
|
1739
1724
|
function voidResult() {}
|
|
1740
|
-
|
|
1741
|
-
//#region src/core/scheduling/retry.ts
|
|
1725
|
+
// src/core/scheduling/retry.ts
|
|
1742
1726
|
/** Методы raw-запроса, безопасность которых гарантирована самим HTTP-контрактом. */
|
|
1743
1727
|
const SAFE_RAW_METHODS = /* @__PURE__ */ new Set([
|
|
1744
1728
|
"GET",
|
|
@@ -1817,8 +1801,7 @@ function createRetryScheduler(options, random = Math.random) {
|
|
|
1817
1801
|
return backoffDelay(retryAttempt, options, random);
|
|
1818
1802
|
};
|
|
1819
1803
|
}
|
|
1820
|
-
|
|
1821
|
-
//#region src/core/execution/middleware.ts
|
|
1804
|
+
// src/core/execution/middleware.ts
|
|
1822
1805
|
/** Сигнал для запроса без lifecycle: никогда не срабатывает. */
|
|
1823
1806
|
const IDLE_SIGNAL = new AbortController().signal;
|
|
1824
1807
|
/** Ожидание повтора, которое уважает отмену запроса. */
|
|
@@ -2076,8 +2059,7 @@ function createRetryMiddleware(deps) {
|
|
|
2076
2059
|
})();
|
|
2077
2060
|
};
|
|
2078
2061
|
}
|
|
2079
|
-
|
|
2080
|
-
//#region src/core/unwrap.ts
|
|
2062
|
+
// src/core/unwrap.ts
|
|
2081
2063
|
/**
|
|
2082
2064
|
* Снимает внешнюю обёртку `{ data: … }`.
|
|
2083
2065
|
*
|
|
@@ -2143,8 +2125,7 @@ function pickString(source, field) {
|
|
|
2143
2125
|
const value = source[field];
|
|
2144
2126
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
2145
2127
|
}
|
|
2146
|
-
|
|
2147
|
-
//#region src/core/error-factory.ts
|
|
2128
|
+
// src/core/error-factory.ts
|
|
2148
2129
|
/**
|
|
2149
2130
|
* Отличает строковый машинный код (`NOT_FOUND`) от обычного текста и HTML страницы прокси.
|
|
2150
2131
|
* Ограничение длины не даёт случайно принять большое служебное тело за код ошибки.
|
|
@@ -2245,9 +2226,12 @@ function parseErrorBody(body, status, statusText = "") {
|
|
|
2245
2226
|
function parseRetryAfter(header, now = Date.now()) {
|
|
2246
2227
|
if (!header) return void 0;
|
|
2247
2228
|
const seconds = Number(header);
|
|
2248
|
-
if (Number.isFinite(seconds))
|
|
2249
|
-
|
|
2250
|
-
|
|
2229
|
+
if (Number.isFinite(seconds)) {
|
|
2230
|
+
const delay = seconds * 1e3;
|
|
2231
|
+
return delay > 0 && Number.isFinite(delay) ? delay : void 0;
|
|
2232
|
+
}
|
|
2233
|
+
const delay = Date.parse(header) - now;
|
|
2234
|
+
return delay > 0 && Number.isFinite(delay) ? delay : void 0;
|
|
2251
2235
|
}
|
|
2252
2236
|
/** Читает целое число из заголовка. */
|
|
2253
2237
|
function readIntHeader(headers, name) {
|
|
@@ -2338,6 +2322,15 @@ function safeRawBody(body) {
|
|
|
2338
2322
|
function createApiError(context) {
|
|
2339
2323
|
const parsed = parseErrorBody(context.body, context.status, context.statusText);
|
|
2340
2324
|
const rateLimit = readRateLimit(context.headers);
|
|
2325
|
+
const retryDelays = [];
|
|
2326
|
+
const headerDelay = parseRetryAfter(context.headers?.get("retry-after"), context.now);
|
|
2327
|
+
if (headerDelay !== void 0) retryDelays.push(headerDelay);
|
|
2328
|
+
const body = require_validate.isRecord(context.body) ? context.body : void 0;
|
|
2329
|
+
const errorBody = require_validate.isRecord(body?.error) ? body.error : body;
|
|
2330
|
+
for (const delay of [errorBody?.retryIn, errorBody?.retryAfter]) {
|
|
2331
|
+
const milliseconds = typeof delay === "number" ? delay * 1e3 : 0;
|
|
2332
|
+
if (milliseconds > 0 && Number.isFinite(milliseconds)) retryDelays.push(milliseconds);
|
|
2333
|
+
}
|
|
2341
2334
|
const init = {
|
|
2342
2335
|
rateLimit: rateLimit.limit,
|
|
2343
2336
|
rateLimitRemaining: rateLimit.remaining,
|
|
@@ -2352,7 +2345,7 @@ function createApiError(context) {
|
|
|
2352
2345
|
path: context.path,
|
|
2353
2346
|
raw: safeRawBody(context.body),
|
|
2354
2347
|
response: context.response,
|
|
2355
|
-
retryAfter:
|
|
2348
|
+
retryAfter: retryDelays.length ? Math.max(...retryDelays) : void 0
|
|
2356
2349
|
};
|
|
2357
2350
|
if (parsed.code === "PHONE_VERIFICATION_REQUIRED") return new require_validate.ItdPhoneVerificationError({
|
|
2358
2351
|
...init,
|
|
@@ -2360,8 +2353,7 @@ function createApiError(context) {
|
|
|
2360
2353
|
});
|
|
2361
2354
|
return new (CODE_TO_CLASS[parsed.code] ?? (classByStatus(context.status)))(init);
|
|
2362
2355
|
}
|
|
2363
|
-
|
|
2364
|
-
//#region src/core/execution/transport.ts
|
|
2356
|
+
// src/core/execution/transport.ts
|
|
2365
2357
|
/** Ставит заголовок, превращая ошибку среды в понятную ошибку конфигурации. */
|
|
2366
2358
|
function setHeader(headers, name, value) {
|
|
2367
2359
|
try {
|
|
@@ -2719,8 +2711,7 @@ var Transport = class {
|
|
|
2719
2711
|
});
|
|
2720
2712
|
}
|
|
2721
2713
|
};
|
|
2722
|
-
|
|
2723
|
-
//#region src/core/execution/client-runtime.ts
|
|
2714
|
+
// src/core/execution/client-runtime.ts
|
|
2724
2715
|
/** Имена стадий обработки запроса в порядке выполнения. @internal */
|
|
2725
2716
|
const ClientRuntimeStage = Object.freeze({
|
|
2726
2717
|
OperationPlugins: "operation_plugins",
|
|
@@ -2934,8 +2925,7 @@ function createClientRuntime(options, internals) {
|
|
|
2934
2925
|
}
|
|
2935
2926
|
};
|
|
2936
2927
|
}
|
|
2937
|
-
|
|
2938
|
-
//#region src/domain/buckets.ts
|
|
2928
|
+
// src/domain/buckets.ts
|
|
2939
2929
|
/**
|
|
2940
2930
|
* Ёмкость серверных счётчиков частоты, запросов в минуту.
|
|
2941
2931
|
*
|
|
@@ -2970,9 +2960,6 @@ const BUCKET_LIMITS = Object.freeze({
|
|
|
2970
2960
|
"reports.create": 3,
|
|
2971
2961
|
"verification.submit": 3,
|
|
2972
2962
|
shop: 150,
|
|
2973
|
-
"shop.delivery.cities": 60,
|
|
2974
|
-
"shop.delivery.calculate": 45,
|
|
2975
|
-
"shop.delivery.points": 30,
|
|
2976
2963
|
"shop.consents.record": 15,
|
|
2977
2964
|
"shop.orders.pay": 13,
|
|
2978
2965
|
"shop.orders.verifyAccessCode": 13,
|
|
@@ -2992,8 +2979,7 @@ function isKnownBucket(name) {
|
|
|
2992
2979
|
* одновременность ограничена одним запросом.
|
|
2993
2980
|
*/
|
|
2994
2981
|
const DEFAULT_BUCKET_OVERRIDES = Object.freeze({ "files.upload": Object.freeze({ concurrency: 1 }) });
|
|
2995
|
-
|
|
2996
|
-
//#region src/domain/operations.ts
|
|
2982
|
+
// src/domain/operations.ts
|
|
2997
2983
|
function freezeOperations(operations) {
|
|
2998
2984
|
for (const definition of Object.values(operations)) Object.freeze(definition);
|
|
2999
2985
|
return Object.freeze(operations);
|
|
@@ -3019,6 +3005,179 @@ const OPERATIONS = freezeOperations({
|
|
|
3019
3005
|
retrySafety: RetrySafety.Safe,
|
|
3020
3006
|
bucket: "auth"
|
|
3021
3007
|
},
|
|
3008
|
+
"account.getInfo": {
|
|
3009
|
+
method: "GET",
|
|
3010
|
+
retrySafety: RetrySafety.Safe,
|
|
3011
|
+
bucket: "auth"
|
|
3012
|
+
},
|
|
3013
|
+
"account.password.set": {
|
|
3014
|
+
method: "POST",
|
|
3015
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3016
|
+
bucket: "auth"
|
|
3017
|
+
},
|
|
3018
|
+
"account.email.attach": {
|
|
3019
|
+
method: "POST",
|
|
3020
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3021
|
+
bucket: "auth"
|
|
3022
|
+
},
|
|
3023
|
+
"account.phone.attach": {
|
|
3024
|
+
method: "POST",
|
|
3025
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3026
|
+
bucket: "auth"
|
|
3027
|
+
},
|
|
3028
|
+
"account.email.startChange": {
|
|
3029
|
+
method: "POST",
|
|
3030
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3031
|
+
bucket: "auth"
|
|
3032
|
+
},
|
|
3033
|
+
"account.phone.startChange": {
|
|
3034
|
+
method: "POST",
|
|
3035
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3036
|
+
bucket: "auth"
|
|
3037
|
+
},
|
|
3038
|
+
"account.verifyAttach": {
|
|
3039
|
+
method: "POST",
|
|
3040
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3041
|
+
bucket: "auth"
|
|
3042
|
+
},
|
|
3043
|
+
"account.verifyChange": {
|
|
3044
|
+
method: "POST",
|
|
3045
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3046
|
+
bucket: "auth"
|
|
3047
|
+
},
|
|
3048
|
+
"account.email.resendOtp": {
|
|
3049
|
+
method: "POST",
|
|
3050
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3051
|
+
bucket: "auth"
|
|
3052
|
+
},
|
|
3053
|
+
"account.phone.resendOtp": {
|
|
3054
|
+
method: "POST",
|
|
3055
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3056
|
+
bucket: "auth"
|
|
3057
|
+
},
|
|
3058
|
+
"account.phone.sync": {
|
|
3059
|
+
method: "POST",
|
|
3060
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3061
|
+
bucket: "auth"
|
|
3062
|
+
},
|
|
3063
|
+
"account.phone.reverseOptions": {
|
|
3064
|
+
method: "POST",
|
|
3065
|
+
retrySafety: RetrySafety.Safe,
|
|
3066
|
+
bucket: "auth"
|
|
3067
|
+
},
|
|
3068
|
+
"account.phone.reverseStart": {
|
|
3069
|
+
method: "POST",
|
|
3070
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3071
|
+
bucket: "auth"
|
|
3072
|
+
},
|
|
3073
|
+
"account.phone.reverseStatus": {
|
|
3074
|
+
method: "POST",
|
|
3075
|
+
retrySafety: RetrySafety.Safe,
|
|
3076
|
+
bucket: "auth"
|
|
3077
|
+
},
|
|
3078
|
+
"account.phone.reverseAttachComplete": {
|
|
3079
|
+
method: "POST",
|
|
3080
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3081
|
+
bucket: "auth"
|
|
3082
|
+
},
|
|
3083
|
+
"account.phone.reverseChangeComplete": {
|
|
3084
|
+
method: "POST",
|
|
3085
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3086
|
+
bucket: "auth"
|
|
3087
|
+
},
|
|
3088
|
+
"account.changes.requestProof": {
|
|
3089
|
+
method: "POST",
|
|
3090
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3091
|
+
bucket: "auth"
|
|
3092
|
+
},
|
|
3093
|
+
"account.changes.confirm": {
|
|
3094
|
+
method: "POST",
|
|
3095
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3096
|
+
bucket: "auth"
|
|
3097
|
+
},
|
|
3098
|
+
"account.changes.wait": {
|
|
3099
|
+
method: "POST",
|
|
3100
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3101
|
+
bucket: "auth"
|
|
3102
|
+
},
|
|
3103
|
+
"account.changes.pending": {
|
|
3104
|
+
method: "GET",
|
|
3105
|
+
retrySafety: RetrySafety.Safe,
|
|
3106
|
+
bucket: "auth"
|
|
3107
|
+
},
|
|
3108
|
+
"account.changes.cancelPending": {
|
|
3109
|
+
method: "DELETE",
|
|
3110
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3111
|
+
bucket: "auth"
|
|
3112
|
+
},
|
|
3113
|
+
"account.password.change": {
|
|
3114
|
+
method: "POST",
|
|
3115
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3116
|
+
bucket: "auth"
|
|
3117
|
+
},
|
|
3118
|
+
"account.deactivate": {
|
|
3119
|
+
method: "DELETE",
|
|
3120
|
+
retrySafety: RetrySafety.Unsafe
|
|
3121
|
+
},
|
|
3122
|
+
"account.restore": {
|
|
3123
|
+
method: "POST",
|
|
3124
|
+
retrySafety: RetrySafety.Unsafe
|
|
3125
|
+
},
|
|
3126
|
+
"auth.phone.config": {
|
|
3127
|
+
method: "GET",
|
|
3128
|
+
retrySafety: RetrySafety.Safe,
|
|
3129
|
+
bucket: "auth"
|
|
3130
|
+
},
|
|
3131
|
+
"auth.phone.consent": {
|
|
3132
|
+
method: "GET",
|
|
3133
|
+
retrySafety: RetrySafety.Safe,
|
|
3134
|
+
bucket: "auth"
|
|
3135
|
+
},
|
|
3136
|
+
"auth.phone.start": {
|
|
3137
|
+
method: "POST",
|
|
3138
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3139
|
+
bucket: "auth"
|
|
3140
|
+
},
|
|
3141
|
+
"auth.phone.verify": {
|
|
3142
|
+
method: "POST",
|
|
3143
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3144
|
+
bucket: "auth"
|
|
3145
|
+
},
|
|
3146
|
+
"auth.phone.password": {
|
|
3147
|
+
method: "POST",
|
|
3148
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3149
|
+
bucket: "auth"
|
|
3150
|
+
},
|
|
3151
|
+
"auth.phone.resetPassword": {
|
|
3152
|
+
method: "POST",
|
|
3153
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3154
|
+
bucket: "auth"
|
|
3155
|
+
},
|
|
3156
|
+
"auth.phone.resend": {
|
|
3157
|
+
method: "POST",
|
|
3158
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3159
|
+
bucket: "auth"
|
|
3160
|
+
},
|
|
3161
|
+
"auth.phone.reverseOptions": {
|
|
3162
|
+
method: "POST",
|
|
3163
|
+
retrySafety: RetrySafety.Safe,
|
|
3164
|
+
bucket: "auth"
|
|
3165
|
+
},
|
|
3166
|
+
"auth.phone.reverseStart": {
|
|
3167
|
+
method: "POST",
|
|
3168
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3169
|
+
bucket: "auth"
|
|
3170
|
+
},
|
|
3171
|
+
"auth.phone.reverseStatus": {
|
|
3172
|
+
method: "POST",
|
|
3173
|
+
retrySafety: RetrySafety.Safe,
|
|
3174
|
+
bucket: "auth"
|
|
3175
|
+
},
|
|
3176
|
+
"auth.phone.reverseComplete": {
|
|
3177
|
+
method: "POST",
|
|
3178
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3179
|
+
bucket: "auth"
|
|
3180
|
+
},
|
|
3022
3181
|
"auth.signUp": {
|
|
3023
3182
|
method: "POST",
|
|
3024
3183
|
retrySafety: RetrySafety.Unsafe,
|
|
@@ -3059,11 +3218,6 @@ const OPERATIONS = freezeOperations({
|
|
|
3059
3218
|
retrySafety: RetrySafety.Unsafe,
|
|
3060
3219
|
bucket: "auth"
|
|
3061
3220
|
},
|
|
3062
|
-
"auth.changePassword": {
|
|
3063
|
-
method: "POST",
|
|
3064
|
-
retrySafety: RetrySafety.Unsafe,
|
|
3065
|
-
bucket: "auth"
|
|
3066
|
-
},
|
|
3067
3221
|
"auth.sessions": {
|
|
3068
3222
|
method: "GET",
|
|
3069
3223
|
retrySafety: RetrySafety.Safe,
|
|
@@ -3114,14 +3268,6 @@ const OPERATIONS = freezeOperations({
|
|
|
3114
3268
|
retrySafety: RetrySafety.Idempotent,
|
|
3115
3269
|
bucket: "users.updateMe"
|
|
3116
3270
|
},
|
|
3117
|
-
"users.deactivate": {
|
|
3118
|
-
method: "DELETE",
|
|
3119
|
-
retrySafety: RetrySafety.Unsafe
|
|
3120
|
-
},
|
|
3121
|
-
"users.restore": {
|
|
3122
|
-
method: "POST",
|
|
3123
|
-
retrySafety: RetrySafety.Unsafe
|
|
3124
|
-
},
|
|
3125
3271
|
"users.createProfile": {
|
|
3126
3272
|
method: "POST",
|
|
3127
3273
|
retrySafety: RetrySafety.Unsafe
|
|
@@ -3321,6 +3467,11 @@ const OPERATIONS = freezeOperations({
|
|
|
3321
3467
|
retrySafety: RetrySafety.Unsafe,
|
|
3322
3468
|
bucket: "files.upload"
|
|
3323
3469
|
},
|
|
3470
|
+
"files.uploadBannerDrawing": {
|
|
3471
|
+
method: "POST",
|
|
3472
|
+
retrySafety: RetrySafety.Unsafe,
|
|
3473
|
+
bucket: "files.upload"
|
|
3474
|
+
},
|
|
3324
3475
|
"files.remove": {
|
|
3325
3476
|
method: "DELETE",
|
|
3326
3477
|
retrySafety: RetrySafety.Unsafe,
|
|
@@ -3429,6 +3580,22 @@ const OPERATIONS = freezeOperations({
|
|
|
3429
3580
|
method: "GET",
|
|
3430
3581
|
retrySafety: RetrySafety.Safe
|
|
3431
3582
|
},
|
|
3583
|
+
"legal.list": {
|
|
3584
|
+
method: "GET",
|
|
3585
|
+
retrySafety: RetrySafety.Safe
|
|
3586
|
+
},
|
|
3587
|
+
"legal.current": {
|
|
3588
|
+
method: "GET",
|
|
3589
|
+
retrySafety: RetrySafety.Safe
|
|
3590
|
+
},
|
|
3591
|
+
"legal.versions": {
|
|
3592
|
+
method: "GET",
|
|
3593
|
+
retrySafety: RetrySafety.Safe
|
|
3594
|
+
},
|
|
3595
|
+
"legal.version": {
|
|
3596
|
+
method: "GET",
|
|
3597
|
+
retrySafety: RetrySafety.Safe
|
|
3598
|
+
},
|
|
3432
3599
|
"platform.changelog": {
|
|
3433
3600
|
method: "GET",
|
|
3434
3601
|
retrySafety: RetrySafety.Safe
|
|
@@ -3467,17 +3634,17 @@ const OPERATIONS = freezeOperations({
|
|
|
3467
3634
|
"shop.delivery.cities": {
|
|
3468
3635
|
method: "GET",
|
|
3469
3636
|
retrySafety: RetrySafety.Safe,
|
|
3470
|
-
bucket: "shop
|
|
3637
|
+
bucket: "shop"
|
|
3471
3638
|
},
|
|
3472
3639
|
"shop.delivery.points": {
|
|
3473
3640
|
method: "GET",
|
|
3474
3641
|
retrySafety: RetrySafety.Safe,
|
|
3475
|
-
bucket: "shop
|
|
3642
|
+
bucket: "shop"
|
|
3476
3643
|
},
|
|
3477
3644
|
"shop.delivery.calculate": {
|
|
3478
3645
|
method: "POST",
|
|
3479
3646
|
retrySafety: RetrySafety.Safe,
|
|
3480
|
-
bucket: "shop
|
|
3647
|
+
bucket: "shop"
|
|
3481
3648
|
},
|
|
3482
3649
|
"shop.orders.create": {
|
|
3483
3650
|
method: "POST",
|
|
@@ -3540,8 +3707,7 @@ function operationBucket(id) {
|
|
|
3540
3707
|
if (!isBuiltInOperationId(id)) return DEFAULT_RATE_LIMIT_BUCKET;
|
|
3541
3708
|
return OPERATIONS[id].bucket ?? "default";
|
|
3542
3709
|
}
|
|
3543
|
-
|
|
3544
|
-
//#region src/domain/catalog.ts
|
|
3710
|
+
// src/domain/catalog.ts
|
|
3545
3711
|
/** Ограничения встроенных бакетов: ёмкость из таблицы плюс встроенные поправки. */
|
|
3546
3712
|
const BUCKET_DEFINITIONS = Object.freeze(Object.fromEntries(Object.entries(BUCKET_LIMITS).map(([name, limit]) => [name, Object.freeze({
|
|
3547
3713
|
limit,
|
|
@@ -3563,8 +3729,7 @@ const ITD_CATALOG = Object.freeze({
|
|
|
3563
3729
|
bucketOverrides: DEFAULT_BUCKET_OVERRIDES,
|
|
3564
3730
|
defaultBucket: DEFAULT_RATE_LIMIT_BUCKET
|
|
3565
3731
|
});
|
|
3566
|
-
|
|
3567
|
-
//#region src/types/enums.ts
|
|
3732
|
+
// src/types/enums.ts
|
|
3568
3733
|
/**
|
|
3569
3734
|
* Вкладка ленты `GET /api/posts`.
|
|
3570
3735
|
*
|
|
@@ -3862,6 +4027,7 @@ const ItdErrorCode = Object.freeze({
|
|
|
3862
4027
|
INVALID_FLOW_TOKEN: "INVALID_FLOW_TOKEN",
|
|
3863
4028
|
ACCOUNT_DEACTIVATED: "ACCOUNT_DEACTIVATED",
|
|
3864
4029
|
ACCOUNT_EMAIL_DOMAIN_NOT_ALLOWED: "ACCOUNT_EMAIL_DOMAIN_NOT_ALLOWED",
|
|
4030
|
+
EMAIL_SIGNUP_DISABLED: "EMAIL_SIGNUP_DISABLED",
|
|
3865
4031
|
ACCOUNT_INVALID_CREDENTIALS: "ACCOUNT_INVALID_CREDENTIALS",
|
|
3866
4032
|
ACCOUNT_TEMPORARILY_LOCKED: "ACCOUNT_TEMPORARILY_LOCKED",
|
|
3867
4033
|
ACCOUNT_CURRENT_PASSWORD_INCORRECT: "ACCOUNT_CURRENT_PASSWORD_INCORRECT",
|
|
@@ -3893,8 +4059,7 @@ const ItdErrorCode = Object.freeze({
|
|
|
3893
4059
|
PHONE_VERIFICATION_REQUIRED: "PHONE_VERIFICATION_REQUIRED",
|
|
3894
4060
|
WRITE_ACCESS_RESTRICTED: "WRITE_ACCESS_RESTRICTED"
|
|
3895
4061
|
});
|
|
3896
|
-
|
|
3897
|
-
//#region src/notifications/type-map.ts
|
|
4062
|
+
// src/notifications/type-map.ts
|
|
3898
4063
|
/**
|
|
3899
4064
|
* Соответствие коротких имён типов уведомлений развёрнутым.
|
|
3900
4065
|
*
|
|
@@ -3938,8 +4103,7 @@ function canonicalNotificationType(rawType) {
|
|
|
3938
4103
|
function isKnownNotificationType(type) {
|
|
3939
4104
|
return KNOWN_TYPES.has(canonicalNotificationType(type));
|
|
3940
4105
|
}
|
|
3941
|
-
|
|
3942
|
-
//#region src/notifications/normalize.ts
|
|
4106
|
+
// src/notifications/normalize.ts
|
|
3943
4107
|
function asActor(value) {
|
|
3944
4108
|
if (!require_validate.isRecord(value)) return void 0;
|
|
3945
4109
|
const id = asString(value.id);
|
|
@@ -4035,8 +4199,7 @@ function readUnreadCountEvent(data) {
|
|
|
4035
4199
|
if (!payload) return void 0;
|
|
4036
4200
|
return typeof payload.count === "number" ? payload.count : void 0;
|
|
4037
4201
|
}
|
|
4038
|
-
|
|
4039
|
-
//#region src/operations/common.ts
|
|
4202
|
+
// src/operations/common.ts
|
|
4040
4203
|
/** Контракт встроенной операции без дополнительного преобразования результата. */
|
|
4041
4204
|
function passthroughOperation(id) {
|
|
4042
4205
|
return defineBuiltInOperation(id);
|
|
@@ -4045,8 +4208,7 @@ function passthroughOperation(id) {
|
|
|
4045
4208
|
function voidOperation(id) {
|
|
4046
4209
|
return defineBuiltInOperation(id, voidResult);
|
|
4047
4210
|
}
|
|
4048
|
-
|
|
4049
|
-
//#region src/core/auth-provider.ts
|
|
4211
|
+
// src/core/auth-provider.ts
|
|
4050
4212
|
/**
|
|
4051
4213
|
* Идентификатор устройства, общий для провайдеров без сессии.
|
|
4052
4214
|
*
|
|
@@ -4130,8 +4292,7 @@ function tokenProvider(getToken) {
|
|
|
4130
4292
|
}
|
|
4131
4293
|
};
|
|
4132
4294
|
}
|
|
4133
|
-
|
|
4134
|
-
//#region src/notifications/text.ts
|
|
4295
|
+
// src/notifications/text.ts
|
|
4135
4296
|
/** Имя, которое подставляется, если участник неизвестен. */
|
|
4136
4297
|
const UNKNOWN_ACTOR = "Пользователь";
|
|
4137
4298
|
/** Текст, который подставляется для неизвестного типа уведомления. */
|
|
@@ -4216,8 +4377,7 @@ function formatNotificationText(notification) {
|
|
|
4216
4377
|
const others = notification.count - 1;
|
|
4217
4378
|
return others > 0 ? template.many(name, others) : template.one(name);
|
|
4218
4379
|
}
|
|
4219
|
-
|
|
4220
|
-
//#region src/notifications/url.ts
|
|
4380
|
+
// src/notifications/url.ts
|
|
4221
4381
|
/** Типы, ведущие на пост. */
|
|
4222
4382
|
const POST_TYPES = /* @__PURE__ */ new Set([
|
|
4223
4383
|
NotificationType.PostReaction,
|
|
@@ -4261,7 +4421,6 @@ function resolveNotificationUrl(notification) {
|
|
|
4261
4421
|
if (username && FOLLOW_TYPES.has(type)) return `/@${username}`;
|
|
4262
4422
|
return clickUrl || "/notifications";
|
|
4263
4423
|
}
|
|
4264
|
-
//#endregion
|
|
4265
4424
|
Object.defineProperty(exports, "AccessType", {
|
|
4266
4425
|
enumerable: true,
|
|
4267
4426
|
get: function() {
|
|
@@ -4695,4 +4854,4 @@ Object.defineProperty(exports, "voidResult", {
|
|
|
4695
4854
|
}
|
|
4696
4855
|
});
|
|
4697
4856
|
|
|
4698
|
-
//# sourceMappingURL=url-
|
|
4857
|
+
//# sourceMappingURL=url-DOfjru6L.cjs.map
|