itd-api 0.10.2 → 0.10.4
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 +2 -2
- package/dist/events/index.d.cts +2 -2
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.js +2 -2
- package/dist/index.cjs +19 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/rest/index.cjs +2 -2
- package/dist/rest/index.d.cts +2 -2
- package/dist/rest/index.d.ts +2 -2
- package/dist/rest/index.js +2 -2
- package/dist/shared/{events-8OLqvKwQ.cjs → events-B8cjz_Ed.cjs} +2 -2
- package/dist/shared/{events-8OLqvKwQ.cjs.map → events-B8cjz_Ed.cjs.map} +1 -1
- package/dist/shared/{events-Cr1Mc2Gl.d.cts → events-CK3zHntT.d.cts} +2 -2
- package/dist/shared/{events-0I_Pixnq.js → events-D2n7Yu1P.js} +2 -2
- package/dist/shared/{events-0I_Pixnq.js.map → events-D2n7Yu1P.js.map} +1 -1
- package/dist/shared/{events-DXooQkyB.d.ts → events-DGdU8q1X.d.ts} +2 -2
- package/dist/shared/{render-BxPM234w.d.cts → render-9F_kR6sq.d.cts} +2 -2
- package/dist/shared/{render-CnpKoGO8.cjs → render-BrrZOSV5.cjs} +2 -2
- package/dist/shared/{render-CnpKoGO8.cjs.map → render-BrrZOSV5.cjs.map} +1 -1
- package/dist/shared/{render-GQw5m1-o.js → render-C6CJ343E.js} +2 -2
- package/dist/shared/{render-GQw5m1-o.js.map → render-C6CJ343E.js.map} +1 -1
- package/dist/shared/{render-D69bOsxu.d.ts → render-UsOGMRzS.d.ts} +2 -2
- package/dist/shared/{url-BnaioEsz.cjs → url-BNTKqBMB.cjs} +20 -10
- package/dist/shared/url-BNTKqBMB.cjs.map +1 -0
- package/dist/shared/{url-D0KJ5pws.js → url-Dc7wLikf.js} +20 -10
- package/dist/shared/url-Dc7wLikf.js.map +1 -0
- package/dist/shared/{url-Qv7smwHP.d.cts → url-yB6T_H_-.d.cts} +2 -2
- package/dist/shared/{url-Qv7smwHP.d.ts → url-yB6T_H_-.d.ts} +2 -2
- package/package.json +1 -1
- package/dist/shared/url-BnaioEsz.cjs.map +0 -1
- package/dist/shared/url-D0KJ5pws.js.map +0 -1
|
@@ -85,7 +85,7 @@ function requireOptionalBoolean(value, name) {
|
|
|
85
85
|
//#endregion
|
|
86
86
|
//#region src/core/version.ts
|
|
87
87
|
/** Версия библиотеки. Попадает в `User-Agent`. */
|
|
88
|
-
const LIBRARY_VERSION = "0.10.
|
|
88
|
+
const LIBRARY_VERSION = "0.10.4";
|
|
89
89
|
//#endregion
|
|
90
90
|
//#region src/core/config.ts
|
|
91
91
|
/** Базовый URL API итд.com. Домен записан в punycode: `итд.com`. */
|
|
@@ -2031,6 +2031,13 @@ function pickString(source, field) {
|
|
|
2031
2031
|
//#endregion
|
|
2032
2032
|
//#region src/core/error-factory.ts
|
|
2033
2033
|
/**
|
|
2034
|
+
* Отличает строковый машинный код (`NOT_FOUND`) от обычного текста и HTML страницы прокси.
|
|
2035
|
+
* Ограничение длины не даёт случайно принять большое служебное тело за код ошибки.
|
|
2036
|
+
*/
|
|
2037
|
+
function readPlainTextErrorCode(value) {
|
|
2038
|
+
return value.length <= 128 && /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$/.test(value) ? value : void 0;
|
|
2039
|
+
}
|
|
2040
|
+
/**
|
|
2034
2041
|
* Сводит ошибки по полям к единой форме `{ поле: [сообщения] }`.
|
|
2035
2042
|
*
|
|
2036
2043
|
* Понимает две документированные формы:
|
|
@@ -2070,14 +2077,17 @@ function collectFieldErrors(source) {
|
|
|
2070
2077
|
*/
|
|
2071
2078
|
function parseErrorBody(body, status, statusText = "") {
|
|
2072
2079
|
const fallbackMessage = statusText ? `HTTP ${status} ${statusText}` : `HTTP ${status}`;
|
|
2073
|
-
if (typeof body === "string")
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2080
|
+
if (typeof body === "string") {
|
|
2081
|
+
const message = asString(body.trim()) ?? fallbackMessage;
|
|
2082
|
+
return {
|
|
2083
|
+
code: readPlainTextErrorCode(message) ?? "UNKNOWN_ERROR",
|
|
2084
|
+
message,
|
|
2085
|
+
detail: void 0,
|
|
2086
|
+
title: void 0,
|
|
2087
|
+
fieldErrors: {},
|
|
2088
|
+
userId: void 0
|
|
2089
|
+
};
|
|
2090
|
+
}
|
|
2081
2091
|
if (!isRecord(body)) return {
|
|
2082
2092
|
code: "UNKNOWN_ERROR",
|
|
2083
2093
|
message: fallbackMessage,
|
|
@@ -4108,4 +4118,4 @@ function resolveNotificationUrl(notification) {
|
|
|
4108
4118
|
//#endregion
|
|
4109
4119
|
export { identityResult as $, SpanType as A, operationRetrySafety as B, ItdErrorCode as C, ReportReason as D, QrLocationPrecision as E, OPERATIONS as F, isRecord as G, DEFAULT_RATE_LIMIT_BUCKET as H, defineBuiltInOperation as I, pickNumber as J, pickArray as K, isBuiltInOperationId as L, ViewSource as M, WallAccess as N, ReportTargetType as O, ITD_CATALOG as P, defineOperation as Q, operationBucket as R, InteractionType as S, NotificationType as T, createClientRuntime as U, BUCKET_LIMITS as V, createApiError as W, pickString as X, pickObject as Y, RetrySafety as Z, CaptchaType as _, installAsyncDisposeFallback as _t, tokenProvider as a, assertPluginRemovable as at, FeedTab as b, normalizeNotification as c, DEFAULT_STATUS_BASE_URL as ct, canonicalNotificationType as d, LIBRARY_VERSION as dt, voidResult as et, isKnownNotificationType as f, isRecord$1 as ft, CaptchaField as g, systemClock as gt, CaptchaChoice as h, createDeadline as ht, bearerToken as i, RequestQueuePool as it, ViewReason as j, ServiceState as k, readNotificationEvent as l, STATUS_SERVICE as lt, AttachmentType as m, RateLimitPacing as mt, formatNotificationText as n, requestAbortError as nt, passthroughOperation as o, orderPluginDefinitions as ot, AccessType as p, requireOptionalBoolean as pt, pickBoolean as q, anonymousAuth as r, mergeService as rt, voidOperation as s, DEFAULT_BASE_URL as st, resolveNotificationUrl as t, createRequestAbortScope as tt, readUnreadCountEvent as u, resolveRateLimit as ut, CommentSort as v, LikesVisibility as w, IncidentKind as x, EventChannelStatus as y, operationMethod as z };
|
|
4110
4120
|
|
|
4111
|
-
//# sourceMappingURL=url-
|
|
4121
|
+
//# sourceMappingURL=url-Dc7wLikf.js.map
|