itd-api 0.10.3 → 0.11.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/README.md +2 -1
- package/dist/events/index.cjs +27 -25
- package/dist/events/index.d.cts +3 -3
- package/dist/events/index.d.ts +3 -3
- package/dist/events/index.js +5 -5
- package/dist/index.cjs +136 -116
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -7
- package/dist/index.d.ts +18 -7
- package/dist/index.js +46 -30
- package/dist/index.js.map +1 -1
- package/dist/node/index.cjs +13 -13
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +5 -5
- package/dist/rest/index.cjs +43 -40
- package/dist/rest/index.cjs.map +1 -1
- 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/{events-BVfqWyBw.cjs → events-C6tmj8aW.cjs} +63 -59
- package/dist/shared/events-C6tmj8aW.cjs.map +1 -0
- package/dist/shared/{events-Cp7ITueA.d.ts → events-CAb9G7Sf.d.ts} +2 -2
- package/dist/shared/{events-Cwj7UPAa.js → events-MWNcnfrq.js} +19 -15
- package/dist/shared/events-MWNcnfrq.js.map +1 -0
- package/dist/shared/{events-D0Wtt-If.d.cts → events-Sc75x6rT.d.cts} +2 -2
- package/dist/shared/{key-value-store-B5GYVEYZ.cjs → key-value-store-DYSPsqwq.cjs} +11 -14
- package/dist/shared/key-value-store-DYSPsqwq.cjs.map +1 -0
- package/dist/shared/{key-value-store-Bt2PSMxY.js → key-value-store-w1Dn5Pjb.js} +5 -8
- package/dist/shared/key-value-store-w1Dn5Pjb.js.map +1 -0
- package/dist/shared/{multi-storage-C3Ngtop1.js → multi-storage-BLBrGN9Q.js} +6 -6
- package/dist/shared/multi-storage-BLBrGN9Q.js.map +1 -0
- package/dist/shared/{multi-storage-s-fPtjoy.cjs → multi-storage-C7-Gz6Z7.cjs} +8 -8
- package/dist/shared/multi-storage-C7-Gz6Z7.cjs.map +1 -0
- package/dist/shared/{options-DjEtbVaf.cjs → options-5tywTYId.cjs} +13 -13
- package/dist/shared/{options-DjEtbVaf.cjs.map → options-5tywTYId.cjs.map} +1 -1
- package/dist/shared/{options-i4LrKfqx.js → options-BerKicCs.js} +3 -3
- package/dist/shared/{options-i4LrKfqx.js.map → options-BerKicCs.js.map} +1 -1
- package/dist/shared/{redact-DJV0XM3n.js → redact-C5oxIvcc.js} +79 -18
- package/dist/shared/redact-C5oxIvcc.js.map +1 -0
- package/dist/shared/{redact-lAmck1Z6.cjs → redact-DoC7lSsp.cjs} +109 -24
- package/dist/shared/redact-DoC7lSsp.cjs.map +1 -0
- package/dist/shared/{render-DRmuHoEy.d.ts → render-CBroJPcV.d.ts} +178 -252
- package/dist/shared/{render-CJO_L2CD.d.cts → render-DM7AhTZW.d.cts} +178 -252
- package/dist/shared/{render-BT74nC1l.js → render-DRh5_aRe.js} +128 -135
- package/dist/shared/render-DRh5_aRe.js.map +1 -0
- package/dist/shared/{render-CYJSDypQ.cjs → render-Dnc84B4M.cjs} +234 -241
- package/dist/shared/render-Dnc84B4M.cjs.map +1 -0
- package/dist/shared/{storage-DiDe0PZM.js → storage-86wiHeXD.js} +3 -3
- package/dist/shared/{storage-DiDe0PZM.js.map → storage-86wiHeXD.js.map} +1 -1
- package/dist/shared/{storage-CZJZoaz9.cjs → storage-CIjejZDt.cjs} +4 -4
- package/dist/shared/{storage-CZJZoaz9.cjs.map → storage-CIjejZDt.cjs.map} +1 -1
- package/dist/shared/{url-BLnX-LYt.d.cts → url-BOi-_mJT.d.cts} +143 -79
- package/dist/shared/{url-BLnX-LYt.d.ts → url-BOi-_mJT.d.ts} +143 -79
- package/dist/shared/{url-DS0-lrl-.js → url-Bg61sk_Y.js} +741 -598
- package/dist/shared/url-Bg61sk_Y.js.map +1 -0
- package/dist/shared/{url-BnO1aWsd.cjs → url-DTgkCWv5.cjs} +848 -717
- package/dist/shared/url-DTgkCWv5.cjs.map +1 -0
- package/dist/shared/{errors-BmP3TKoW.cjs → validate-CFx2dISs.cjs} +84 -5
- package/dist/shared/validate-CFx2dISs.cjs.map +1 -0
- package/dist/shared/{errors-GI10kZxk.js → validate-D7_kq3g5.js} +55 -6
- package/dist/shared/validate-D7_kq3g5.js.map +1 -0
- package/dist/web/index.cjs +4 -4
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.js +3 -3
- package/package.json +1 -1
- package/dist/shared/errors-BmP3TKoW.cjs.map +0 -1
- package/dist/shared/errors-GI10kZxk.js.map +0 -1
- package/dist/shared/events-BVfqWyBw.cjs.map +0 -1
- package/dist/shared/events-Cwj7UPAa.js.map +0 -1
- package/dist/shared/key-value-store-B5GYVEYZ.cjs.map +0 -1
- package/dist/shared/key-value-store-Bt2PSMxY.js.map +0 -1
- package/dist/shared/multi-storage-C3Ngtop1.js.map +0 -1
- package/dist/shared/multi-storage-s-fPtjoy.cjs.map +0 -1
- package/dist/shared/redact-DJV0XM3n.js.map +0 -1
- package/dist/shared/redact-lAmck1Z6.cjs.map +0 -1
- package/dist/shared/render-BT74nC1l.js.map +0 -1
- package/dist/shared/render-CYJSDypQ.cjs.map +0 -1
- package/dist/shared/url-BnO1aWsd.cjs.map +0 -1
- package/dist/shared/url-DS0-lrl-.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_url = require("./shared/url-
|
|
3
|
-
const
|
|
4
|
-
const require_redact = require("./shared/redact-
|
|
5
|
-
const require_render = require("./shared/render-
|
|
6
|
-
const require_options = require("./shared/options-
|
|
7
|
-
const require_events = require("./shared/events-
|
|
8
|
-
const require_key_value_store = require("./shared/key-value-store-
|
|
9
|
-
const require_storage = require("./shared/storage-
|
|
10
|
-
const require_multi_storage = require("./shared/multi-storage-
|
|
2
|
+
const require_url = require("./shared/url-DTgkCWv5.cjs");
|
|
3
|
+
const require_validate = require("./shared/validate-CFx2dISs.cjs");
|
|
4
|
+
const require_redact = require("./shared/redact-DoC7lSsp.cjs");
|
|
5
|
+
const require_render = require("./shared/render-Dnc84B4M.cjs");
|
|
6
|
+
const require_options = require("./shared/options-5tywTYId.cjs");
|
|
7
|
+
const require_events = require("./shared/events-C6tmj8aW.cjs");
|
|
8
|
+
const require_key_value_store = require("./shared/key-value-store-DYSPsqwq.cjs");
|
|
9
|
+
const require_storage = require("./shared/storage-CIjejZDt.cjs");
|
|
10
|
+
const require_multi_storage = require("./shared/multi-storage-C7-Gz6Z7.cjs");
|
|
11
11
|
//#region src/notifications-api.ts
|
|
12
12
|
var ClientNotifications = class extends require_render.NotificationsResource {
|
|
13
13
|
#createEvents;
|
|
@@ -58,7 +58,7 @@ const QrLoginStreamStatus = Object.freeze({
|
|
|
58
58
|
});
|
|
59
59
|
function requireString(body, key, message) {
|
|
60
60
|
const value = require_url.pickString(body, key);
|
|
61
|
-
if (!value) throw new
|
|
61
|
+
if (!value) throw new require_validate.ItdConfigError(message);
|
|
62
62
|
return value;
|
|
63
63
|
}
|
|
64
64
|
const AUTH_CHECK = require_url.passthroughOperation("auth.check");
|
|
@@ -93,7 +93,7 @@ const AUTH_QR_REJECT = require_url.voidOperation("auth.qrReject");
|
|
|
93
93
|
//#endregion
|
|
94
94
|
//#region src/session/captcha.ts
|
|
95
95
|
function requireCaptchaText(value, field) {
|
|
96
|
-
if (value !== void 0 && (typeof value !== "string" || value.trim() === "")) throw new
|
|
96
|
+
if (value !== void 0 && (typeof value !== "string" || value.trim() === "")) throw new require_validate.ItdConfigError(`${field} должен быть непустой строкой`);
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Проверяет форму источника токена и приводит его к объекту.
|
|
@@ -106,9 +106,9 @@ function requireCaptchaText(value, field) {
|
|
|
106
106
|
function resolveCaptchaSolver(captcha) {
|
|
107
107
|
if (captcha === void 0) return void 0;
|
|
108
108
|
if (typeof captcha === "function") return { getToken: captcha };
|
|
109
|
-
if (!
|
|
109
|
+
if (!require_validate.isRecord(captcha)) throw new require_validate.ItdConfigError("captcha должен быть функцией либо объектом с getToken");
|
|
110
110
|
const { getToken, type, field } = captcha;
|
|
111
|
-
if (typeof getToken !== "function") throw new
|
|
111
|
+
if (typeof getToken !== "function") throw new require_validate.ItdConfigError("captcha.getToken должен быть функцией");
|
|
112
112
|
requireCaptchaText(type, "captcha.type");
|
|
113
113
|
requireCaptchaText(field, "captcha.field");
|
|
114
114
|
return captcha;
|
|
@@ -121,18 +121,18 @@ function resolveCaptchaSolver(captcha) {
|
|
|
121
121
|
*/
|
|
122
122
|
function validateCaptchaToken(captcha, path) {
|
|
123
123
|
if (captcha === void 0) return;
|
|
124
|
-
if (!
|
|
124
|
+
if (!require_validate.isRecord(captcha)) throw new require_validate.ItdConfigError(`${path} должен быть объектом { type, token }`);
|
|
125
125
|
const { type, token, field } = captcha;
|
|
126
|
-
if (typeof token !== "string" || token.trim() === "") throw new
|
|
127
|
-
if (typeof type !== "string" || type.trim() === "") throw new
|
|
126
|
+
if (typeof token !== "string" || token.trim() === "") throw new require_validate.ItdConfigError(`${path}.token должен быть непустой строкой`);
|
|
127
|
+
if (typeof type !== "string" || type.trim() === "") throw new require_validate.ItdConfigError(`${path}.type должен быть непустой строкой`);
|
|
128
128
|
requireCaptchaText(field, `${path}.field`);
|
|
129
129
|
}
|
|
130
130
|
/** Разбирает ответ `GET /api/v1/auth/captcha/provider` для автоматического входа. */
|
|
131
131
|
function readCaptchaProvider(body) {
|
|
132
|
-
const config =
|
|
132
|
+
const config = require_validate.isRecord(body) ? body : void 0;
|
|
133
133
|
const provider = config?.provider;
|
|
134
134
|
const field = config?.field;
|
|
135
|
-
if (typeof provider !== "string" || provider.trim() === "" || typeof field !== "string" || field.trim() === "") throw new
|
|
135
|
+
if (typeof provider !== "string" || provider.trim() === "" || typeof field !== "string" || field.trim() === "") throw new require_validate.ItdConfigError("Сервер вернул неподдерживаемую конфигурацию капчи");
|
|
136
136
|
return {
|
|
137
137
|
provider,
|
|
138
138
|
field
|
|
@@ -142,13 +142,13 @@ function readCaptchaProvider(body) {
|
|
|
142
142
|
function resolveField(type, configured) {
|
|
143
143
|
const field = configured ?? CAPTCHA_FIELDS[type];
|
|
144
144
|
if (field) return field;
|
|
145
|
-
throw new
|
|
145
|
+
throw new require_validate.ItdConfigError(`Неизвестно, в каком поле сервер ждёт токен капчи «${type}». Передайте captcha.field либо оставьте captcha.type = ${require_url.CaptchaChoice.Auto}, чтобы поле назвал сервер.`);
|
|
146
146
|
}
|
|
147
147
|
/** Спрашивает токен у источника и убеждается, что он непустой. */
|
|
148
|
-
async function requireSolvedToken(solver, type) {
|
|
149
|
-
const token = await solver.getToken(type);
|
|
148
|
+
async function requireSolvedToken(solver, type, context) {
|
|
149
|
+
const token = await solver.getToken(type, context);
|
|
150
150
|
if (typeof token === "string" && token.trim() !== "") return token;
|
|
151
|
-
throw new
|
|
151
|
+
throw new require_validate.ItdConfigError(`Источник капчи не вернул токен для провайдера «${type}». Проверьте captcha.getToken.`);
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
154
|
* Готовит фрагмент тела запроса, взяв токен у источника.
|
|
@@ -157,15 +157,16 @@ async function requireSolvedToken(solver, type) {
|
|
|
157
157
|
* и имя поля приходят оттуда. Явно названный тип обходится без этого запроса.
|
|
158
158
|
*
|
|
159
159
|
* @param askProvider как спросить активного провайдера; вызывается, только если это нужно
|
|
160
|
+
* @param context что источник получает вместе с типом капчи
|
|
160
161
|
* @throws {ItdConfigError} если токен получить не удалось
|
|
161
162
|
*/
|
|
162
|
-
async function solveCaptchaBody(solver, askProvider) {
|
|
163
|
+
async function solveCaptchaBody(solver, askProvider, context) {
|
|
163
164
|
const choice = solver.type ?? require_url.CaptchaChoice.Auto;
|
|
164
165
|
if (choice === require_url.CaptchaChoice.Auto) {
|
|
165
166
|
const { provider, field } = await askProvider();
|
|
166
|
-
return { [field]: await requireSolvedToken(solver, provider) };
|
|
167
|
+
return { [field]: await requireSolvedToken(solver, provider, context) };
|
|
167
168
|
}
|
|
168
|
-
return { [resolveField(choice, solver.field)]: await requireSolvedToken(solver, choice) };
|
|
169
|
+
return { [resolveField(choice, solver.field)]: await requireSolvedToken(solver, choice, context) };
|
|
169
170
|
}
|
|
170
171
|
/**
|
|
171
172
|
* Готовит фрагмент тела из готового токена.
|
|
@@ -231,41 +232,41 @@ const ACCESS_TOKEN_REFRESH_LEEWAY_MS = 3e4;
|
|
|
231
232
|
function validateAuth(auth) {
|
|
232
233
|
if (auth === void 0) return void 0;
|
|
233
234
|
if (typeof auth === "string") {
|
|
234
|
-
if (auth.trim() === "") throw new
|
|
235
|
+
if (auth.trim() === "") throw new require_validate.ItdConfigError("auth: передана пустая строка вместо accessToken");
|
|
235
236
|
return auth;
|
|
236
237
|
}
|
|
237
|
-
if (typeof auth !== "object" || auth === null) throw new
|
|
238
|
+
if (typeof auth !== "object" || auth === null) throw new require_validate.ItdConfigError(`auth должен быть строкой с токеном или объектом, получено: ${typeof auth}`);
|
|
238
239
|
if ([
|
|
239
240
|
"getToken" in auth,
|
|
240
241
|
"accessToken" in auth || "refreshToken" in auth,
|
|
241
242
|
"email" in auth || "password" in auth
|
|
242
|
-
].filter(Boolean).length > 1) throw new
|
|
243
|
+
].filter(Boolean).length > 1) throw new require_validate.ItdConfigError("auth должен описывать ровно один способ авторизации: getToken, accessToken или email/password");
|
|
243
244
|
if ("getToken" in auth) {
|
|
244
|
-
if (typeof auth.getToken !== "function") throw new
|
|
245
|
+
if (typeof auth.getToken !== "function") throw new require_validate.ItdConfigError("auth.getToken должен быть функцией");
|
|
245
246
|
return { ...auth };
|
|
246
247
|
}
|
|
247
248
|
if ("accessToken" in auth) {
|
|
248
|
-
if (typeof auth.accessToken !== "string" || auth.accessToken.trim() === "") throw new
|
|
249
|
-
if (auth.refreshToken !== void 0 && (typeof auth.refreshToken !== "string" || auth.refreshToken.trim() === "")) throw new
|
|
249
|
+
if (typeof auth.accessToken !== "string" || auth.accessToken.trim() === "") throw new require_validate.ItdConfigError("auth.accessToken должен быть непустой строкой");
|
|
250
|
+
if (auth.refreshToken !== void 0 && (typeof auth.refreshToken !== "string" || auth.refreshToken.trim() === "")) throw new require_validate.ItdConfigError("auth.refreshToken должен быть непустой строкой");
|
|
250
251
|
return { ...auth };
|
|
251
252
|
}
|
|
252
253
|
if ("email" in auth || "password" in auth) {
|
|
253
254
|
const { email, password, captcha } = auth;
|
|
254
|
-
if (typeof email !== "string" || email.trim() === "") throw new
|
|
255
|
-
if (typeof password !== "string" || password === "") throw new
|
|
255
|
+
if (typeof email !== "string" || email.trim() === "") throw new require_validate.ItdConfigError("auth.email должен быть непустой строкой");
|
|
256
|
+
if (typeof password !== "string" || password === "") throw new require_validate.ItdConfigError("auth.password должен быть непустой строкой");
|
|
256
257
|
validateCaptchaToken(captcha, "auth.captcha");
|
|
257
258
|
return { ...auth };
|
|
258
259
|
}
|
|
259
|
-
throw new
|
|
260
|
+
throw new require_validate.ItdConfigError("auth не распознан. Ожидается строка с accessToken либо объект { accessToken }, { email, password } или { getToken }");
|
|
260
261
|
}
|
|
261
262
|
function resolveStorage(storage) {
|
|
262
263
|
if (storage === void 0) return new require_storage.MemoryTokenStorage();
|
|
263
|
-
if (!
|
|
264
|
+
if (!require_validate.isObjectLike(storage)) throw new require_validate.ItdConfigError("storage должен быть объектом TokenStorage");
|
|
264
265
|
for (const method of [
|
|
265
266
|
"get",
|
|
266
267
|
"set",
|
|
267
268
|
"clear"
|
|
268
|
-
]) if (typeof storage[method] !== "function") throw new
|
|
269
|
+
]) if (typeof storage[method] !== "function") throw new require_validate.ItdConfigError(`storage.${method} должен быть функцией`);
|
|
269
270
|
return storage;
|
|
270
271
|
}
|
|
271
272
|
/**
|
|
@@ -275,10 +276,10 @@ function resolveStorage(storage) {
|
|
|
275
276
|
* @throws {ItdConfigError} при некорректных значениях
|
|
276
277
|
*/
|
|
277
278
|
function resolveSessionConfig(options, runtime) {
|
|
278
|
-
if (!
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
if (options.deviceId !== void 0 && (typeof options.deviceId !== "string" || options.deviceId.trim() === "")) throw new
|
|
279
|
+
if (!require_validate.isObjectLike(options)) throw new require_validate.ItdConfigError("опции клиента должны быть объектом");
|
|
280
|
+
require_validate.requireOptionalBoolean(options.autoRefresh, "autoRefresh");
|
|
281
|
+
require_validate.requireOptionalBoolean(options.reloginOnRefreshFailure, "reloginOnRefreshFailure");
|
|
282
|
+
if (options.deviceId !== void 0 && (typeof options.deviceId !== "string" || options.deviceId.trim() === "")) throw new require_validate.ItdConfigError("deviceId должен быть непустой строкой");
|
|
282
283
|
return {
|
|
283
284
|
...runtime,
|
|
284
285
|
auth: validateAuth(options.auth),
|
|
@@ -349,12 +350,12 @@ function withoutLegacyUserId(session) {
|
|
|
349
350
|
}
|
|
350
351
|
function normalizeSessionValue(value, source, mode = "strict", logger) {
|
|
351
352
|
const tolerant = mode === "stored";
|
|
352
|
-
if (!
|
|
353
|
+
if (!require_validate.isRecord(value)) {
|
|
353
354
|
if (tolerant) {
|
|
354
355
|
logger?.warn(`${source} вернула не объект сессии; сохранённая запись пропущена`);
|
|
355
356
|
return null;
|
|
356
357
|
}
|
|
357
|
-
throw new
|
|
358
|
+
throw new require_validate.ItdConfigError(`${source} должна быть объектом сессии`);
|
|
358
359
|
}
|
|
359
360
|
const record = value;
|
|
360
361
|
const normalized = { ...record };
|
|
@@ -371,7 +372,7 @@ function normalizeSessionValue(value, source, mode = "strict", logger) {
|
|
|
371
372
|
delete normalized[field];
|
|
372
373
|
return;
|
|
373
374
|
}
|
|
374
|
-
throw new
|
|
375
|
+
throw new require_validate.ItdConfigError(`${source}.${field} должна быть непустой строкой`);
|
|
375
376
|
}
|
|
376
377
|
normalized[field] = item;
|
|
377
378
|
};
|
|
@@ -380,7 +381,7 @@ function normalizeSessionValue(value, source, mode = "strict", logger) {
|
|
|
380
381
|
normalizeString("deviceId");
|
|
381
382
|
if (record.obtainedAt === void 0) delete normalized.obtainedAt;
|
|
382
383
|
else if (typeof record.obtainedAt !== "number" || !Number.isFinite(record.obtainedAt)) {
|
|
383
|
-
if (!tolerant) throw new
|
|
384
|
+
if (!tolerant) throw new require_validate.ItdConfigError(`${source}.obtainedAt должна быть конечным числом`);
|
|
384
385
|
else {
|
|
385
386
|
logger?.warn(`${source}.obtainedAt повреждена; поле сохранённой сессии пропущено`);
|
|
386
387
|
delete normalized.obtainedAt;
|
|
@@ -391,7 +392,7 @@ function normalizeSessionValue(value, source, mode = "strict", logger) {
|
|
|
391
392
|
if (tolerant) {
|
|
392
393
|
logger?.warn(`${source}.cookies повреждена; поле сохранённой сессии пропущено`);
|
|
393
394
|
delete normalized.cookies;
|
|
394
|
-
} else throw new
|
|
395
|
+
} else throw new require_validate.ItdConfigError(`${source}.cookies должна быть массивом`);
|
|
395
396
|
} else {
|
|
396
397
|
const valid = record.cookies.filter((cookie) => typeof cookie === "string" && require_redact.isSerializedCookieEntry(cookie));
|
|
397
398
|
if (valid.length > 0) normalized.cookies = valid;
|
|
@@ -401,7 +402,7 @@ function normalizeSessionValue(value, source, mode = "strict", logger) {
|
|
|
401
402
|
}
|
|
402
403
|
function normalizeSession(value, source) {
|
|
403
404
|
const normalized = normalizeSessionValue(value, source);
|
|
404
|
-
if (!normalized) throw new
|
|
405
|
+
if (!normalized) throw new require_validate.ItdConfigError(`${source} должна быть объектом сессии`);
|
|
405
406
|
return normalized;
|
|
406
407
|
}
|
|
407
408
|
let authScopeSequence = 0;
|
|
@@ -544,7 +545,7 @@ var AuthManager = class {
|
|
|
544
545
|
return true;
|
|
545
546
|
}
|
|
546
547
|
#assertActive() {
|
|
547
|
-
if (this.#disposed) throw new
|
|
548
|
+
if (this.#disposed) throw new require_validate.ItdStateError("Менеджер авторизации уже освобождён");
|
|
548
549
|
}
|
|
549
550
|
#currentAccessToken() {
|
|
550
551
|
return this.#session?.accessToken ?? null;
|
|
@@ -732,7 +733,7 @@ var AuthManager = class {
|
|
|
732
733
|
* `SESSION_NOT_FOUND`, `SESSION_REVOKED` — разные поводы и разные действия).
|
|
733
734
|
*/
|
|
734
735
|
#noRefreshSessionError() {
|
|
735
|
-
return new
|
|
736
|
+
return new require_validate.ItdAuthError({
|
|
736
737
|
status: 401,
|
|
737
738
|
code: "SESSION_EXPIRED",
|
|
738
739
|
message: "Не удалось обновить сессию: нет ни cookie is_auth, ни refresh-токена. Войдите заново либо передайте refreshToken в auth.",
|
|
@@ -764,7 +765,7 @@ var AuthManager = class {
|
|
|
764
765
|
}
|
|
765
766
|
async #storeAccessToken(accessToken, expectedRevision, cookies, replaceSession) {
|
|
766
767
|
this.#assertActive();
|
|
767
|
-
if (typeof accessToken !== "string" || accessToken.trim() === "") throw new
|
|
768
|
+
if (typeof accessToken !== "string" || accessToken.trim() === "") throw new require_validate.ItdConfigError("accessToken должен быть непустой строкой");
|
|
768
769
|
await this.#loadSession();
|
|
769
770
|
this.#assertActive();
|
|
770
771
|
if (this.#authEpoch !== expectedRevision) return false;
|
|
@@ -777,6 +778,7 @@ var AuthManager = class {
|
|
|
777
778
|
obtainedAt: this.#config.clock.now()
|
|
778
779
|
});
|
|
779
780
|
this.#emitter.emit("tokens", { accessToken });
|
|
781
|
+
this.#config.logger?.info(`${replaceSession ? "вход выполнен" : "принят токен доступа"}${this.#describeUser(accessToken)}`);
|
|
780
782
|
await saved;
|
|
781
783
|
return true;
|
|
782
784
|
}
|
|
@@ -828,6 +830,7 @@ var AuthManager = class {
|
|
|
828
830
|
const retained = this.#deviceId ? { deviceId: this.#deviceId } : null;
|
|
829
831
|
this.#session = retained;
|
|
830
832
|
this.#emitter.emit("signOut", void 0);
|
|
833
|
+
this.#config.logger?.info("сессия очищена");
|
|
831
834
|
await this.#enqueuePersistence(async () => {
|
|
832
835
|
await this.#config.storage.clear();
|
|
833
836
|
if (retained) await this.#config.storage.set(require_storage.copySession(retained));
|
|
@@ -845,6 +848,7 @@ var AuthManager = class {
|
|
|
845
848
|
this.#assertActive();
|
|
846
849
|
const stored = loaded === null ? null : normalizeSessionValue(loaded, "storage.get()", "stored", this.#config.logger);
|
|
847
850
|
if (stored?.cookies) this.#jar.deserialize(stored.cookies);
|
|
851
|
+
if (stored?.accessToken) this.#config.logger?.info(`сессия восстановлена из хранилища${this.#describeUser(stored.accessToken)}`);
|
|
848
852
|
const fromConfig = this.#sessionFromConfig(this.#config.auth);
|
|
849
853
|
this.#session = stored && fromConfig ? {
|
|
850
854
|
...stored,
|
|
@@ -941,12 +945,14 @@ var AuthManager = class {
|
|
|
941
945
|
obtainedAt: this.#config.clock.now()
|
|
942
946
|
});
|
|
943
947
|
this.#emitter.emit("tokens", { accessToken });
|
|
948
|
+
this.#config.logger?.info("токен доступа обновлён");
|
|
944
949
|
await saved;
|
|
945
950
|
if (this.#authEpoch !== expectation.epoch) return this.#currentAccessToken();
|
|
946
951
|
return accessToken;
|
|
947
952
|
} catch (error) {
|
|
948
953
|
if (this.#authEpoch !== expectation.epoch) return this.#currentAccessToken();
|
|
949
|
-
if (error instanceof
|
|
954
|
+
if (error instanceof require_validate.ItdAuthError) {
|
|
955
|
+
this.#config.logger?.warn(`обновить сессию не удалось (${error.message}); сохранённая сессия удалена`);
|
|
950
956
|
this.#invalidateInFlight();
|
|
951
957
|
const clearedRevision = this.#authEpoch;
|
|
952
958
|
this.#transitionAuth(void 0);
|
|
@@ -1002,7 +1008,7 @@ var AuthManager = class {
|
|
|
1002
1008
|
const configured = this.#takeConfiguredCaptcha();
|
|
1003
1009
|
if (configured) return captchaBody(configured);
|
|
1004
1010
|
const solver = this.#config.captcha;
|
|
1005
|
-
if (solver) return solveCaptchaBody(solver, () => this.#resolveCaptchaProvider());
|
|
1011
|
+
if (solver) return solveCaptchaBody(solver, () => this.#resolveCaptchaProvider(), { logger: this.#config.logger });
|
|
1006
1012
|
this.#config.logger?.debug("Запрос уходит без токена капчи: не передан аргумент captcha и не задана опция captcha");
|
|
1007
1013
|
return {};
|
|
1008
1014
|
}
|
|
@@ -1010,7 +1016,7 @@ var AuthManager = class {
|
|
|
1010
1016
|
#takeConfiguredCaptcha() {
|
|
1011
1017
|
if (this.#configCaptchaSpent) return void 0;
|
|
1012
1018
|
const auth = this.#config.auth;
|
|
1013
|
-
const captcha =
|
|
1019
|
+
const captcha = typeof auth === "object" && auth !== null && "email" in auth ? auth.captcha : void 0;
|
|
1014
1020
|
if (!captcha) return void 0;
|
|
1015
1021
|
this.#configCaptchaSpent = true;
|
|
1016
1022
|
return captcha;
|
|
@@ -1024,7 +1030,7 @@ var AuthManager = class {
|
|
|
1024
1030
|
skipAuthRefresh: true
|
|
1025
1031
|
}));
|
|
1026
1032
|
} catch (error) {
|
|
1027
|
-
if (
|
|
1033
|
+
if (require_validate.isItdApiError(error) && error.status === 404 && error.code === require_url.ItdErrorCode.NOT_FOUND) {
|
|
1028
1034
|
this.#config.logger?.warn("Сервер отключил определение провайдера капчи; используется Cloudflare Turnstile");
|
|
1029
1035
|
return {
|
|
1030
1036
|
provider: require_url.CaptchaType.Cloudflare,
|
|
@@ -1048,7 +1054,7 @@ var AuthManager = class {
|
|
|
1048
1054
|
skipAuthRefresh: true,
|
|
1049
1055
|
cookieJar: flowCookies
|
|
1050
1056
|
});
|
|
1051
|
-
if (result.status !== SignInStatus.Authenticated) throw new
|
|
1057
|
+
if (result.status !== SignInStatus.Authenticated) throw new require_validate.ItdConfigError("Вход по email и паролю требует подтверждения кодом из письма. Автоматический вход невозможен: воспользуйтесь itd.auth.signInWithOtp() и передайте полученный accessToken в конфигурацию клиента.");
|
|
1052
1058
|
const accessToken = result.accessToken;
|
|
1053
1059
|
this.#assertActive();
|
|
1054
1060
|
if (this.#authEpoch !== revision) return this.#session?.accessToken ?? null;
|
|
@@ -1061,9 +1067,15 @@ var AuthManager = class {
|
|
|
1061
1067
|
});
|
|
1062
1068
|
this.#emitter.emit("tokens", { accessToken });
|
|
1063
1069
|
this.#emitter.emit("signIn", { accessToken });
|
|
1070
|
+
this.#config.logger?.info(`вход по email и паролю выполнен${this.#describeUser(accessToken)}`);
|
|
1064
1071
|
await saved;
|
|
1065
1072
|
return accessToken;
|
|
1066
1073
|
}
|
|
1074
|
+
/** Хвост сообщения журнала с идентификатором пользователя, если токен его содержит. */
|
|
1075
|
+
#describeUser(accessToken) {
|
|
1076
|
+
const userId = this.#identityForToken(accessToken).userId;
|
|
1077
|
+
return userId ? `: пользователь ${userId}` : "";
|
|
1078
|
+
}
|
|
1067
1079
|
};
|
|
1068
1080
|
//#endregion
|
|
1069
1081
|
//#region src/session/qr-stream.ts
|
|
@@ -1075,7 +1087,7 @@ function readQrLoginStreamEvent(data) {
|
|
|
1075
1087
|
} catch {
|
|
1076
1088
|
return;
|
|
1077
1089
|
}
|
|
1078
|
-
if (!
|
|
1090
|
+
if (!require_validate.isRecord(value)) return void 0;
|
|
1079
1091
|
const event = value;
|
|
1080
1092
|
if (typeof event.status !== "string" || !QR_STREAM_STATUSES.has(event.status)) return;
|
|
1081
1093
|
return {
|
|
@@ -1121,7 +1133,7 @@ async function openQrLoginStream(connection, cookies, input, onEvent, signal) {
|
|
|
1121
1133
|
const path = AUTH_PATHS.qrStream;
|
|
1122
1134
|
const method = "POST";
|
|
1123
1135
|
const url = require_redact.joinUrl(connection.baseUrl, path);
|
|
1124
|
-
const abort = require_url.createRequestAbortScope(signal, connection.signal,
|
|
1136
|
+
const abort = require_url.createRequestAbortScope(signal, connection.signal, connection.clock);
|
|
1125
1137
|
try {
|
|
1126
1138
|
const headers = await connection.baseHeaders(url);
|
|
1127
1139
|
headers.delete("Authorization");
|
|
@@ -1140,13 +1152,12 @@ async function openQrLoginStream(connection, cookies, input, onEvent, signal) {
|
|
|
1140
1152
|
signal: abort.signal
|
|
1141
1153
|
});
|
|
1142
1154
|
} catch (error) {
|
|
1143
|
-
const failure = new
|
|
1155
|
+
const failure = new require_validate.ItdNetworkError(`Не удалось открыть QR-поток: ${String(error)}`, {
|
|
1144
1156
|
method,
|
|
1145
1157
|
path,
|
|
1146
1158
|
cause: error
|
|
1147
1159
|
});
|
|
1148
1160
|
throw require_url.requestAbortError(abort, {
|
|
1149
|
-
timeout: 0,
|
|
1150
1161
|
method,
|
|
1151
1162
|
path
|
|
1152
1163
|
}, failure);
|
|
@@ -1169,14 +1180,13 @@ async function openQrLoginStream(connection, cookies, input, onEvent, signal) {
|
|
|
1169
1180
|
now: connection.clock.now()
|
|
1170
1181
|
});
|
|
1171
1182
|
}
|
|
1172
|
-
if (!response.body) throw new
|
|
1183
|
+
if (!response.body) throw new require_validate.ItdNetworkError("Сервер не вернул тело QR-потока", {
|
|
1173
1184
|
method,
|
|
1174
1185
|
path
|
|
1175
1186
|
});
|
|
1176
1187
|
await consumeQrLoginStream(response.body, onEvent, abort.signal);
|
|
1177
1188
|
} catch (error) {
|
|
1178
1189
|
throw require_url.requestAbortError(abort, {
|
|
1179
|
-
timeout: 0,
|
|
1180
1190
|
method,
|
|
1181
1191
|
path
|
|
1182
1192
|
}, error);
|
|
@@ -1228,7 +1238,7 @@ var AuthResource = class extends require_render.BaseResource {
|
|
|
1228
1238
|
flow.expiresAt = flow.expiresAt === void 0 ? expiresAt : Math.min(flow.expiresAt, expiresAt);
|
|
1229
1239
|
}
|
|
1230
1240
|
#forgetTerminalQrError(qrId, error) {
|
|
1231
|
-
if (
|
|
1241
|
+
if (require_validate.isItdApiError(error) && error.hasCode("QR_EXPIRED", "QR_ALREADY_USED", "QR_TOKEN_MISMATCH")) this.#qrFlows.delete(qrId);
|
|
1232
1242
|
}
|
|
1233
1243
|
/**
|
|
1234
1244
|
* Проверяет состояние авторизации и возвращает текущего пользователя.
|
|
@@ -1334,7 +1344,7 @@ var AuthResource = class extends require_render.BaseResource {
|
|
|
1334
1344
|
* {@link claimQrLogin}, чтобы получить и сохранить access token.
|
|
1335
1345
|
*/
|
|
1336
1346
|
async streamQrLogin(input, onEvent, options = {}) {
|
|
1337
|
-
if (typeof onEvent !== "function") throw new
|
|
1347
|
+
if (typeof onEvent !== "function") throw new require_validate.ItdConfigError("onEvent QR-потока должен быть функцией");
|
|
1338
1348
|
const flow = this.#qrFlow(input.qrId);
|
|
1339
1349
|
try {
|
|
1340
1350
|
await openQrLoginStream(this.#connection, flow.cookies, input, async (event) => {
|
|
@@ -1491,7 +1501,7 @@ var AuthResource = class extends require_render.BaseResource {
|
|
|
1491
1501
|
const { getOtp, ...credentials } = input;
|
|
1492
1502
|
const result = await this.signIn(credentials, options);
|
|
1493
1503
|
if (result.status === SignInStatus.Authenticated) return result.accessToken;
|
|
1494
|
-
if (!result.flowToken) throw new
|
|
1504
|
+
if (!result.flowToken) throw new require_validate.ItdConfigError("Сервер запросил код подтверждения, но не вернул flowToken — продолжить вход невозможно");
|
|
1495
1505
|
const otp = await getOtp();
|
|
1496
1506
|
return this.verifyOtp({
|
|
1497
1507
|
email: credentials.email,
|
|
@@ -1660,7 +1670,7 @@ const CLIENT_PLUGIN_REGISTRIES = /* @__PURE__ */ new WeakMap();
|
|
|
1660
1670
|
const DISPOSED_CLIENTS = /* @__PURE__ */ new WeakSet();
|
|
1661
1671
|
function assertClientActive(client, action) {
|
|
1662
1672
|
if (!DISPOSED_CLIENTS.has(client)) return;
|
|
1663
|
-
throw new
|
|
1673
|
+
throw new require_validate.ItdStateError(`ItdClient уже окончательно освобождён через dispose(); нельзя ${action}. Создайте новый клиент`);
|
|
1664
1674
|
}
|
|
1665
1675
|
/** Проверяет возможность подключить плагин к клиенту без вызова `install()`. @internal */
|
|
1666
1676
|
function assertClientCanUsePlugin(client, plugin) {
|
|
@@ -1904,9 +1914,9 @@ var ItdClient = class ItdClient {
|
|
|
1904
1914
|
*/
|
|
1905
1915
|
withFeature(key, feature) {
|
|
1906
1916
|
assertClientActive(this, "установить feature");
|
|
1907
|
-
if (typeof key !== "string" || key.trim() === "" || key !== key.trim()) throw new
|
|
1908
|
-
if (key === "then" || key in this) throw new
|
|
1909
|
-
if (!Object.isExtensible(this)) throw new
|
|
1917
|
+
if (typeof key !== "string" || key.trim() === "" || key !== key.trim()) throw new require_validate.ItdConfigError("Свойство feature должно иметь непустое имя без краевых пробелов");
|
|
1918
|
+
if (key === "then" || key in this) throw new require_validate.ItdConfigError(`Свойство клиента «${key}» уже занято или зарезервировано`);
|
|
1919
|
+
if (!Object.isExtensible(this)) throw new require_validate.ItdConfigError("Нельзя опубликовать feature на нерасширяемом клиенте");
|
|
1910
1920
|
const api = this.install(feature);
|
|
1911
1921
|
Object.defineProperty(this, key, {
|
|
1912
1922
|
value: api,
|
|
@@ -2172,20 +2182,27 @@ function createClient(options = {}) {
|
|
|
2172
2182
|
}
|
|
2173
2183
|
//#endregion
|
|
2174
2184
|
//#region src/accounts.ts
|
|
2185
|
+
/** Как аккаунты делят между собой очередь запросов. */
|
|
2186
|
+
const RateLimitScope = Object.freeze({
|
|
2187
|
+
/** У каждого аккаунта своя очередь. */
|
|
2188
|
+
Account: "account",
|
|
2189
|
+
/** Одна очередь на всех — умолчание. */
|
|
2190
|
+
Shared: "shared"
|
|
2191
|
+
});
|
|
2175
2192
|
/** Проверяет имя до создания клиента или частичного восстановления контейнера. */
|
|
2176
2193
|
function validateAccountName(name) {
|
|
2177
|
-
if (typeof name !== "string" || name.trim() === "") throw new
|
|
2194
|
+
if (typeof name !== "string" || name.trim() === "") throw new require_validate.ItdConfigError("имя аккаунта должно быть непустой строкой");
|
|
2178
2195
|
}
|
|
2179
2196
|
/** Проверяет фабрики до создания первого аккаунта. */
|
|
2180
2197
|
function resolveAccountFeatures(features) {
|
|
2181
2198
|
if (features === void 0) return [];
|
|
2182
|
-
if (!Array.isArray(features)) throw new
|
|
2199
|
+
if (!Array.isArray(features)) throw new require_validate.ItdConfigError("features должен быть массивом фабрик подключаемых модулей");
|
|
2183
2200
|
const keys = /* @__PURE__ */ new Set();
|
|
2184
2201
|
return features.map((feature, index) => {
|
|
2185
|
-
if (typeof feature !== "object" || feature === null || typeof feature.create !== "function") throw new
|
|
2202
|
+
if (typeof feature !== "object" || feature === null || typeof feature.create !== "function") throw new require_validate.ItdConfigError(`features[${index}] должен предоставлять create()`);
|
|
2186
2203
|
if (feature.key !== void 0) {
|
|
2187
|
-
if (typeof feature.key !== "string" || feature.key.trim() === "" || feature.key !== feature.key.trim()) throw new
|
|
2188
|
-
if (keys.has(feature.key)) throw new
|
|
2204
|
+
if (typeof feature.key !== "string" || feature.key.trim() === "" || feature.key !== feature.key.trim()) throw new require_validate.ItdConfigError(`features[${index}].key должен быть непустой строкой без пробелов`);
|
|
2205
|
+
if (keys.has(feature.key)) throw new require_validate.ItdConfigError(`Свойство подключаемого модуля «${feature.key}» объявлено повторно`);
|
|
2189
2206
|
keys.add(feature.key);
|
|
2190
2207
|
}
|
|
2191
2208
|
const create = feature.create.bind(feature);
|
|
@@ -2198,7 +2215,7 @@ function resolveAccountFeatures(features) {
|
|
|
2198
2215
|
const DISPOSED_ACCOUNTS = /* @__PURE__ */ new WeakSet();
|
|
2199
2216
|
function assertAccountsActive(accounts, action) {
|
|
2200
2217
|
if (!DISPOSED_ACCOUNTS.has(accounts)) return;
|
|
2201
|
-
throw new
|
|
2218
|
+
throw new require_validate.ItdStateError(`ItdAccounts уже окончательно освобождён через dispose(); нельзя ${action}. Создайте новый контейнер`);
|
|
2202
2219
|
}
|
|
2203
2220
|
/**
|
|
2204
2221
|
* Несколько аккаунтов итд.com в одном месте.
|
|
@@ -2261,15 +2278,16 @@ var ItdAccounts = class ItdAccounts {
|
|
|
2261
2278
|
#disposePromise;
|
|
2262
2279
|
constructor(options = {}) {
|
|
2263
2280
|
const { storage, plugins, features, rateLimitScope, ...base } = options;
|
|
2264
|
-
|
|
2281
|
+
const scopes = Object.values(RateLimitScope);
|
|
2282
|
+
if (rateLimitScope !== void 0 && !scopes.includes(rateLimitScope)) throw new require_validate.ItdConfigError(`rateLimitScope должен быть одним из ${scopes.join(", ")}`);
|
|
2265
2283
|
this.#base = base;
|
|
2266
2284
|
this.#storage = storage ?? new require_multi_storage.MemoryMultiTokenStorage();
|
|
2267
2285
|
this.#plugins = require_url.orderPluginDefinitions(plugins ?? []);
|
|
2268
2286
|
this.#features = resolveAccountFeatures(features);
|
|
2269
|
-
this.#rateLimitScope = rateLimitScope ??
|
|
2270
|
-
const rateLimit = this.#rateLimitScope ===
|
|
2287
|
+
this.#rateLimitScope = rateLimitScope ?? RateLimitScope.Shared;
|
|
2288
|
+
const rateLimit = this.#rateLimitScope === RateLimitScope.Shared ? require_url.resolveRateLimit(base.rateLimit, require_url.ITD_CATALOG) : void 0;
|
|
2271
2289
|
this.#queues = rateLimit ? new require_url.RequestQueuePool(rateLimit, base.clock ?? require_url.systemClock) : void 0;
|
|
2272
|
-
const logger =
|
|
2290
|
+
const logger = require_redact.resolveLogger(base.logger);
|
|
2273
2291
|
this.#logger = logger;
|
|
2274
2292
|
this.#emitter = new require_events.Emitter((error) => require_events.reportListenerError(logger, "аккаунтов", error));
|
|
2275
2293
|
}
|
|
@@ -2310,9 +2328,9 @@ var ItdAccounts = class ItdAccounts {
|
|
|
2310
2328
|
addAccount(name, options = {}) {
|
|
2311
2329
|
assertAccountsActive(this, "добавить аккаунт");
|
|
2312
2330
|
validateAccountName(name);
|
|
2313
|
-
if (this.#clients.has(name)) throw new
|
|
2314
|
-
if (this.#removing.has(name)) throw new
|
|
2315
|
-
if (this.#rateLimitScope ===
|
|
2331
|
+
if (this.#clients.has(name)) throw new require_validate.ItdConfigError(`аккаунт «${name}» уже добавлен. Возьмите его через accounts.account('${name}')`);
|
|
2332
|
+
if (this.#removing.has(name)) throw new require_validate.ItdConfigError(`аккаунт «${name}» ещё удаляется. Дождитесь завершения removeAccount() перед повторным добавлением`);
|
|
2333
|
+
if (this.#rateLimitScope === RateLimitScope.Shared && options.rateLimit !== void 0 && options.rateLimit !== false) throw new require_validate.ItdConfigError("при rateLimitScope: 'shared' настройки rateLimit задаются контейнеру; аккаунту можно передать только rateLimit: false");
|
|
2316
2334
|
const storageControl = require_multi_storage.controlledTokenStorage(this.#storage, name);
|
|
2317
2335
|
let client;
|
|
2318
2336
|
try {
|
|
@@ -2351,7 +2369,7 @@ var ItdAccounts = class ItdAccounts {
|
|
|
2351
2369
|
const client = this.#clients.get(name);
|
|
2352
2370
|
if (!client) {
|
|
2353
2371
|
const known = this.names();
|
|
2354
|
-
throw new
|
|
2372
|
+
throw new require_validate.ItdConfigError(`аккаунт «${name}» не заведён. ` + (known.length > 0 ? `Известны: ${known.join(", ")}` : "Ни одного аккаунта нет — добавьте его через addAccount() или restore()"));
|
|
2355
2373
|
}
|
|
2356
2374
|
return client;
|
|
2357
2375
|
}
|
|
@@ -2438,7 +2456,7 @@ var ItdAccounts = class ItdAccounts {
|
|
|
2438
2456
|
*/
|
|
2439
2457
|
use(plugin) {
|
|
2440
2458
|
assertAccountsActive(this, "подключить плагин");
|
|
2441
|
-
if (this.#removingPlugins.has(plugin?.name)) throw new
|
|
2459
|
+
if (this.#removingPlugins.has(plugin?.name)) throw new require_validate.ItdConfigError(`плагин «${plugin.name}» ещё отключается; дождитесь завершения accounts.unuse()`);
|
|
2442
2460
|
const ordered = require_url.orderPluginDefinitions([...this.#plugins, plugin]);
|
|
2443
2461
|
const clients = [...this.#clients.values()];
|
|
2444
2462
|
for (const client of clients) assertClientCanUsePlugin(client, plugin);
|
|
@@ -2603,9 +2621,7 @@ var ItdAccounts = class ItdAccounts {
|
|
|
2603
2621
|
}
|
|
2604
2622
|
/** Не теряет ошибку фонового освобождения ресурсов, которого синхронный API не ждёт. */
|
|
2605
2623
|
#reportCleanup(scope, error) {
|
|
2606
|
-
|
|
2607
|
-
if (this.#logger) this.#logger.error(message, error);
|
|
2608
|
-
else console.error(`[itd-api] ${message}`, error);
|
|
2624
|
+
(this.#logger ?? require_redact.fallbackLogger).error(`Не удалось освободить ресурсы после ${scope}`, error);
|
|
2609
2625
|
}
|
|
2610
2626
|
/** Ретранслирует события клиента наружу, добавляя к ним имя аккаунта. */
|
|
2611
2627
|
#forwardEvents(account, client) {
|
|
@@ -2656,30 +2672,31 @@ exports.FileTransferMode = require_options.FileTransferMode;
|
|
|
2656
2672
|
exports.IMAGE_MIME_TYPES = require_render.IMAGE_MIME_TYPES;
|
|
2657
2673
|
exports.IncidentKind = require_url.IncidentKind;
|
|
2658
2674
|
exports.InteractionType = require_url.InteractionType;
|
|
2659
|
-
exports.ItdAbortError =
|
|
2675
|
+
exports.ItdAbortError = require_validate.ItdAbortError;
|
|
2660
2676
|
exports.ItdAccounts = ItdAccounts;
|
|
2661
|
-
exports.ItdApiError =
|
|
2662
|
-
exports.ItdApiErrorKind =
|
|
2663
|
-
exports.ItdAuthError =
|
|
2677
|
+
exports.ItdApiError = require_validate.ItdApiError;
|
|
2678
|
+
exports.ItdApiErrorKind = require_validate.ItdApiErrorKind;
|
|
2679
|
+
exports.ItdAuthError = require_validate.ItdAuthError;
|
|
2664
2680
|
exports.ItdClient = ItdClient;
|
|
2665
|
-
exports.ItdConfigError =
|
|
2666
|
-
exports.ItdConflictError =
|
|
2667
|
-
exports.ItdError =
|
|
2681
|
+
exports.ItdConfigError = require_validate.ItdConfigError;
|
|
2682
|
+
exports.ItdConflictError = require_validate.ItdConflictError;
|
|
2683
|
+
exports.ItdError = require_validate.ItdError;
|
|
2668
2684
|
exports.ItdErrorCode = require_url.ItdErrorCode;
|
|
2669
|
-
exports.ItdErrorKind =
|
|
2670
|
-
exports.ItdFileError =
|
|
2671
|
-
exports.ItdFileErrorReason =
|
|
2672
|
-
exports.ItdForbiddenError =
|
|
2673
|
-
exports.ItdNetworkError =
|
|
2674
|
-
exports.ItdNotFoundError =
|
|
2675
|
-
exports.ItdPhoneVerificationError =
|
|
2676
|
-
exports.ItdRateLimitError =
|
|
2677
|
-
exports.ItdServerError =
|
|
2678
|
-
exports.ItdStateError =
|
|
2679
|
-
exports.ItdTimeoutError =
|
|
2680
|
-
exports.ItdValidationError =
|
|
2685
|
+
exports.ItdErrorKind = require_validate.ItdErrorKind;
|
|
2686
|
+
exports.ItdFileError = require_validate.ItdFileError;
|
|
2687
|
+
exports.ItdFileErrorReason = require_validate.ItdFileErrorReason;
|
|
2688
|
+
exports.ItdForbiddenError = require_validate.ItdForbiddenError;
|
|
2689
|
+
exports.ItdNetworkError = require_validate.ItdNetworkError;
|
|
2690
|
+
exports.ItdNotFoundError = require_validate.ItdNotFoundError;
|
|
2691
|
+
exports.ItdPhoneVerificationError = require_validate.ItdPhoneVerificationError;
|
|
2692
|
+
exports.ItdRateLimitError = require_validate.ItdRateLimitError;
|
|
2693
|
+
exports.ItdServerError = require_validate.ItdServerError;
|
|
2694
|
+
exports.ItdStateError = require_validate.ItdStateError;
|
|
2695
|
+
exports.ItdTimeoutError = require_validate.ItdTimeoutError;
|
|
2696
|
+
exports.ItdValidationError = require_validate.ItdValidationError;
|
|
2681
2697
|
exports.LIBRARY_VERSION = require_url.LIBRARY_VERSION;
|
|
2682
2698
|
exports.LikesVisibility = require_url.LikesVisibility;
|
|
2699
|
+
exports.LogLevel = require_redact.LogLevel;
|
|
2683
2700
|
exports.MemoryKeyValueStore = require_key_value_store.MemoryKeyValueStore;
|
|
2684
2701
|
exports.MemoryMultiTokenStorage = require_multi_storage.MemoryMultiTokenStorage;
|
|
2685
2702
|
exports.MemoryShopOrderAccessStorage = require_render.MemoryShopOrderAccessStorage;
|
|
@@ -2691,12 +2708,14 @@ exports.NotificationType = require_url.NotificationType;
|
|
|
2691
2708
|
exports.NotificationUpdateOrigin = require_events.NotificationUpdateOrigin;
|
|
2692
2709
|
exports.NotificationUpdateType = require_events.NotificationUpdateType;
|
|
2693
2710
|
exports.OPERATIONS = require_url.OPERATIONS;
|
|
2711
|
+
exports.OperationMethod = require_url.OperationMethod;
|
|
2694
2712
|
exports.PaginationMode = require_render.PaginationMode;
|
|
2695
2713
|
exports.Paginator = require_render.Paginator;
|
|
2696
2714
|
exports.QrLocationPrecision = require_url.QrLocationPrecision;
|
|
2697
2715
|
exports.QrLoginStatus = QrLoginStatus;
|
|
2698
2716
|
exports.QrLoginStreamStatus = QrLoginStreamStatus;
|
|
2699
2717
|
exports.RateLimitPacing = require_url.RateLimitPacing;
|
|
2718
|
+
exports.RateLimitScope = RateLimitScope;
|
|
2700
2719
|
exports.ReportReason = require_url.ReportReason;
|
|
2701
2720
|
exports.ReportTargetType = require_url.ReportTargetType;
|
|
2702
2721
|
exports.RetrySafety = require_url.RetrySafety;
|
|
@@ -2711,6 +2730,7 @@ exports.SignInStatus = SignInStatus;
|
|
|
2711
2730
|
exports.SpanRenderFormat = require_render.SpanRenderFormat;
|
|
2712
2731
|
exports.SpanType = require_url.SpanType;
|
|
2713
2732
|
exports.TURNSTILE_SITE_KEY = TURNSTILE_SITE_KEY;
|
|
2733
|
+
exports.TimeoutBudget = require_validate.TimeoutBudget;
|
|
2714
2734
|
exports.UnauthorizedStreamError = require_events.UnauthorizedStreamError;
|
|
2715
2735
|
exports.VIDEO_MIME_TYPES = require_render.VIDEO_MIME_TYPES;
|
|
2716
2736
|
exports.ViewReason = require_url.ViewReason;
|
|
@@ -2735,18 +2755,18 @@ exports.fromUrl = require_render.fromUrl;
|
|
|
2735
2755
|
exports.isBuilder = require_render.isBuilder;
|
|
2736
2756
|
exports.isBuiltInOperationId = require_url.isBuiltInOperationId;
|
|
2737
2757
|
exports.isEnumerableKeyValueStore = require_key_value_store.isEnumerableKeyValueStore;
|
|
2738
|
-
exports.isItdApiError =
|
|
2739
|
-
exports.isItdAuthError =
|
|
2740
|
-
exports.isItdConflictError =
|
|
2741
|
-
exports.isItdError =
|
|
2742
|
-
exports.isItdFileError =
|
|
2743
|
-
exports.isItdForbiddenError =
|
|
2744
|
-
exports.isItdNotFoundError =
|
|
2745
|
-
exports.isItdPhoneVerificationError =
|
|
2746
|
-
exports.isItdRateLimitError =
|
|
2747
|
-
exports.isItdServerError =
|
|
2748
|
-
exports.isItdStateError =
|
|
2749
|
-
exports.isItdValidationError =
|
|
2758
|
+
exports.isItdApiError = require_validate.isItdApiError;
|
|
2759
|
+
exports.isItdAuthError = require_validate.isItdAuthError;
|
|
2760
|
+
exports.isItdConflictError = require_validate.isItdConflictError;
|
|
2761
|
+
exports.isItdError = require_validate.isItdError;
|
|
2762
|
+
exports.isItdFileError = require_validate.isItdFileError;
|
|
2763
|
+
exports.isItdForbiddenError = require_validate.isItdForbiddenError;
|
|
2764
|
+
exports.isItdNotFoundError = require_validate.isItdNotFoundError;
|
|
2765
|
+
exports.isItdPhoneVerificationError = require_validate.isItdPhoneVerificationError;
|
|
2766
|
+
exports.isItdRateLimitError = require_validate.isItdRateLimitError;
|
|
2767
|
+
exports.isItdServerError = require_validate.isItdServerError;
|
|
2768
|
+
exports.isItdStateError = require_validate.isItdStateError;
|
|
2769
|
+
exports.isItdValidationError = require_validate.isItdValidationError;
|
|
2750
2770
|
exports.isKnownNotificationType = require_url.isKnownNotificationType;
|
|
2751
2771
|
exports.isMyProfile = require_render.isMyProfile;
|
|
2752
2772
|
exports.mapPage = require_render.mapPage;
|