itd-api 0.9.2 → 0.9.3

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.
Files changed (37) hide show
  1. package/dist/events/index.cjs +2 -2
  2. package/dist/events/index.d.cts +2 -2
  3. package/dist/events/index.d.ts +2 -2
  4. package/dist/events/index.js +2 -2
  5. package/dist/index.cjs +87 -53
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +8 -10
  8. package/dist/index.d.ts +8 -10
  9. package/dist/index.js +87 -53
  10. package/dist/index.js.map +1 -1
  11. package/dist/rest/index.cjs +2 -2
  12. package/dist/rest/index.d.cts +2 -2
  13. package/dist/rest/index.d.ts +2 -2
  14. package/dist/rest/index.js +2 -2
  15. package/dist/shared/{events-BCn5LRnT.d.cts → events-BPxBF0gQ.d.cts} +2 -2
  16. package/dist/shared/{events-BIBO2Jif.js → events-BzjI6pn5.js} +2 -2
  17. package/dist/shared/{events-BIBO2Jif.js.map → events-BzjI6pn5.js.map} +1 -1
  18. package/dist/shared/{events-BsRm_Fba.cjs → events-C1FudmSe.cjs} +2 -2
  19. package/dist/shared/{events-BsRm_Fba.cjs.map → events-C1FudmSe.cjs.map} +1 -1
  20. package/dist/shared/{events-t1uGgpkf.d.ts → events-DnwfcLxS.d.ts} +2 -2
  21. package/dist/shared/{render-DA83gS0f.d.cts → render-C1F_QWYD.d.cts} +2 -14
  22. package/dist/shared/{render--ZXmYEf-.js → render-CtOpp9Pm.js} +2 -30
  23. package/dist/shared/render-CtOpp9Pm.js.map +1 -0
  24. package/dist/shared/{render-DqVzx68r.cjs → render-Omy1drH1.cjs} +2 -30
  25. package/dist/shared/render-Omy1drH1.cjs.map +1 -0
  26. package/dist/shared/{render-BdnBV-aT.d.ts → render-uFW2kDxp.d.ts} +2 -14
  27. package/dist/shared/{url-i2f-X1hX.js → url-3Ts6EEHQ.js} +32 -15
  28. package/dist/shared/url-3Ts6EEHQ.js.map +1 -0
  29. package/dist/shared/{url-Doc0XXW_.cjs → url-D6wsXm1T.cjs} +32 -15
  30. package/dist/shared/url-D6wsXm1T.cjs.map +1 -0
  31. package/dist/shared/{url-Dbj6V6fk.d.ts → url-DubjkRR9.d.cts} +8 -16
  32. package/dist/shared/{url-Dbj6V6fk.d.cts → url-DubjkRR9.d.ts} +8 -16
  33. package/package.json +3 -3
  34. package/dist/shared/render--ZXmYEf-.js.map +0 -1
  35. package/dist/shared/render-DqVzx68r.cjs.map +0 -1
  36. package/dist/shared/url-Doc0XXW_.cjs.map +0 -1
  37. package/dist/shared/url-i2f-X1hX.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { At as RequestOptions, Ct as PaginationOptions, Dt as RawRequestOptions, It as QueryParams, Rt as ServiceDefinition, St as OperationRequestOptions, Tt as RateLimitBucketOverride, Ut as BuiltInOperationId, Vt as ItdClock, _ as PrivacySettings, _n as ReportTargetType, _t as OperationMethod, bn as ViewReason, c as NotificationSettings, dn as InteractionType, f as Author, g as PinsResult, gn as ReportReason, gt as OperationMetadata, ht as OperationContract, in as UserRef, ln as FeedTab, lt as Unsubscribe, m as MyProfile, mn as Loose, mt as OperationAnnotations, nn as Span, nt as AuthIdentity, on as AttachmentType, p as FollowResult, qt as OperationId, rn as UserId, s as Notification, sn as CommentSort, tn as IsoDate, tt as ClientConnection, un as IncidentKind, v as Profile, vn as ServiceState, vt as RetrySafety, x as UserSummary, xn as ViewSource, xt as Logger, y as PublicProfile, yt as ClientHooks } from "./url-Dbj6V6fk.js";
1
+ import { At as RequestOptions, Ct as PaginationOptions, Dt as RawRequestOptions, It as QueryParams, Rt as ServiceDefinition, St as OperationRequestOptions, Tt as RateLimitBucketOverride, Ut as BuiltInOperationId, Vt as ItdClock, _ as PrivacySettings, _n as ReportTargetType, _t as OperationMethod, bn as ViewReason, c as NotificationSettings, dn as InteractionType, f as Author, g as PinsResult, gn as ReportReason, gt as OperationMetadata, ht as OperationContract, in as UserRef, ln as FeedTab, lt as Unsubscribe, m as MyProfile, mn as Loose, mt as OperationAnnotations, nn as Span, nt as AuthIdentity, on as AttachmentType, p as FollowResult, qt as OperationId, rn as UserId, s as Notification, sn as CommentSort, tn as IsoDate, tt as ClientConnection, un as IncidentKind, v as Profile, vn as ServiceState, vt as RetrySafety, x as UserSummary, xn as ViewSource, xt as Logger, y as PublicProfile, yt as ClientHooks } from "./url-DubjkRR9.js";
2
2
  import { c as LazyFile, d as UrlFileOptions, i as FileStreamContent, l as StreamFile, n as FileContext, o as FileTransferMode, r as FileInput, s as FromStreamOptions } from "./contracts-BoT7msmq.js";
3
3
  import { r as KeyValueStore } from "./key-value-store-COZaNHZS.js";
4
4
  //#region src/core/cookies.d.ts
@@ -1293,14 +1293,6 @@ interface HashtagPostsParams {
1293
1293
  */
1294
1294
  declare class HashtagsResource extends BaseResource {
1295
1295
  #private;
1296
- /**
1297
- * Ищет хэштеги.
1298
- *
1299
- * Без строки запроса возвращает общий список.
1300
- */
1301
- search(query?: string, params?: {
1302
- limit?: number;
1303
- }, options?: RequestOptions): Promise<Hashtag[]>;
1304
1296
  /** Загружает трендовые хэштеги. */
1305
1297
  trending(params?: {
1306
1298
  limit?: number;
@@ -2611,10 +2603,6 @@ declare class UsersResource extends BaseResource {
2611
2603
  get(user: UserRef, options?: RequestOptions): Promise<PublicProfile>;
2612
2604
  /** Проверяет, свободно ли имя пользователя. */
2613
2605
  checkUsername(username: string, options?: RequestOptions): Promise<boolean>;
2614
- /** Ищет пользователей по строке запроса. */
2615
- search(query: string, params?: {
2616
- limit?: number;
2617
- }, options?: RequestOptions): Promise<UserSummary[]>;
2618
2606
  /** Загружает рекомендации, на кого подписаться. */
2619
2607
  whoToFollow(options?: RequestOptions): Promise<UserSummary[]>;
2620
2608
  /** Загружает рейтинг кланов. */
@@ -2866,4 +2854,4 @@ interface RenderSpansOptions {
2866
2854
  declare function renderSpans(content: string, spans?: readonly Span[] | null | undefined, options?: RenderSpansOptions): string;
2867
2855
  //#endregion
2868
2856
  export { ShopConsentContext as $, PaginationMode as $n, markup as $t, DwellEntry as A, Post as An, report as At, ViewTrackerInput as B, CreatePollInput as Bn, PollBuilder as Bt, fromStream as C, CommentReplyTo as Cn, OperationExtensions as Cr, ShopSizeChart as Ct, UpdateProfileInput as D, PinPostResult as Dn, PluginTeardown as Dr, ReportsResource as Dt, UpdatePrivacyInput as E, LikeResult as En, PluginApi as Er, SearchResult as Et, TelemetryClock as F, comment as Fn, CreatePostInput as Ft, ShopConsentsResource as G, Session as Gn, parseMarkdown as Gt, SubscriptionResource as H, CreateReportInput as Hn, poll as Ht, TelemetryOptions as I, BuilderInput as In, PostBuilder as It, ShopOrdersResource as J, NotificationsResource as Jn, MarkupContent as Jt, ShopDeliveryResource as K, Subscription as Kn, AutoSpansOptions as Kt, TelemetryResource as L, ItdBuilder as Ln, PostInput as Lt, PhotoOpenInput as M, PostUpdateResult as Mn, FeedParams as Mt, TelemetryBatch as N, CommentBuilder as Nn, PostsResource as Nt, UserListParams as O, Poll as On, CookieJar as Or, ReportBuilder as Ot, TelemetryBatchOptions as P, CommentInput as Pn, UserPostsParams as Pt, ShopConsent as Q, PageState as Qn, autoSpans as Qt, VideoProgressInput as R, isBuilder as Rn, PostUpdateInput as Rt, VideoMimeType as S, Comment as Sn, ClientPlugin as Sr, ShopRecipient as St, VerificationResource as T, Hashtag as Tn, OperationTransformer as Tr, SearchResource as Tt, CreateShopOrderOptions as U, UpdatePostInput as Un, ParseMarkupOptions as Ut, ViewTrackerOptions as V, CreatePostData as Vn, PollInput as Vt, PayShopOrderOptions as W, PaymentMethod as Wn, parseHtml as Wt, ShopResource as X, BaseResource as Xn, MarkupSpan as Xt, ShopProductsResource as Y, UpdateNotificationSettingsInput as Yn, MarkupInput as Yt, CreateShopOrderInput as Z, Page as Zn, TextMarkup as Zt, AllowedMimeType as _, UploadOptions as _n, HttpClient as _r, ShopProduct as _t, ShopFeatureOptions as a, StatusDay as an, FeatureBucketDefinition as ar, ShopDeliveryDestination as at, ImageMimeType as b, RepliesParams as bn, AttemptInterceptor as br, ShopProductSpec as bt, ShopOrderAccessStorage as c, AnnouncementButton as cn, FeatureOperationDefinition as cr, ShopOrderAccessSession as ct, statusDays as d, Portal as dn, FileResolver as dr, ShopOrderItem as dt, PlatformClientVersion as en, Paginator as er, ShopConsentKind as et, isMyProfile as f, Report as fn, PreparedBufferSource as fr, ShopOrderItemInput as ft, AUDIO_MIME_TYPES as g, FilesResource as gn, ResolveFileOptions as gr, ShopPayment as gt, ALLOWED_MIME_TYPES as h, HashtagsResource as hn, ResolveFileContext as hr, ShopOrderSupport as ht, ShopFeatureApi as i, ServiceStatus as in, ClientFeature as ir, ShopDeliveryCountry as it, InteractionEntry as j, PostStats as jn, CommentsParams as jt, UsersResource as k, PollOption as kn, ReportInput as kt, ShopOrderAccessStorageAdapterOptions as l, ChangelogEntry as ln, FeatureRequestOptions as lr, ShopOrderAccessVerification as lt, utcStampToIso as m, HashtagPostsParams as mn, PreparedStreamSource as mr, ShopOrderSummary as mt, SpanRenderFormat as n, PlatformVersions as nn, mapPage as nr, ShopDeliveryCalculation as nt, createShopFeature as o, StatusIncidentLine as on, FeatureContext as or, ShopDeliveryPoint as ot, toDate as p, VerificationStatus as pn, PreparedFileSource as pr, ShopOrderStatus as pt, ShopOrderRequestOptions as q, NotificationListParams as qn, MarkupBuilder as qt, renderSpans as r, PlatformStatus as rn, RateLimitBucketState as rr, ShopDeliveryCity as rt, MemoryShopOrderAccessStorage as s, Announcement as sn, FeatureInstallation as sr, ShopOrder as st, RenderSpansOptions as t, PlatformResource as tn, PaginatorOptions as tr, ShopCreatedOrder as tt, createShopOrderAccessStorage as u, Clan as un, ManagedClientResource as ur, ShopOrderDelivery as ut, AudioMimeType as v, UploadedFile as vn, AttemptContext as vr, ShopProductCategory as vt, fromUrl as w, CommentUpdateResult as wn, OperationTransformContext as wr, ShopSizeChartRow as wt, VIDEO_MIME_TYPES as x, Attachment as xn, AttemptNext as xr, ShopProductStatus as xt, IMAGE_MIME_TYPES as y, CommentsResource as yn, AttemptExtensions as yr, ShopProductColor as yt, ViewTracker as z, CreateCommentInput as zn, post as zt };
2869
- //# sourceMappingURL=render-BdnBV-aT.d.ts.map
2857
+ //# sourceMappingURL=render-uFW2kDxp.d.ts.map
@@ -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.9.2";
88
+ const LIBRARY_VERSION = "0.9.3";
89
89
  //#endregion
90
90
  //#region src/core/config.ts
91
91
  /** Базовый URL API итд.com. Домен записан в punycode: `итд.com`. */
@@ -1364,7 +1364,10 @@ function requestAuthRecoveryState(request) {
1364
1364
  const internal = request;
1365
1365
  const current = internal[REQUEST_AUTH_RECOVERY_STATE];
1366
1366
  if (current) return current;
1367
- const state = { recovered: false };
1367
+ const state = {
1368
+ recovered: false,
1369
+ preparationErrors: /* @__PURE__ */ new Set()
1370
+ };
1368
1371
  internal[REQUEST_AUTH_RECOVERY_STATE] = state;
1369
1372
  return state;
1370
1373
  }
@@ -1802,6 +1805,19 @@ function createServicesMiddleware(registry) {
1802
1805
  return next(prepared);
1803
1806
  };
1804
1807
  }
1808
+ /** Однократная auth-подготовка вне retry исходного запроса. */
1809
+ function createAuthPreflightMiddleware(getAuth) {
1810
+ return async (request, next) => {
1811
+ if (!request.skipAuth) {
1812
+ const auth = getAuth();
1813
+ if (auth.preflight) {
1814
+ const pending = auth.preflight(request.skipAuthRefresh !== true);
1815
+ await (request.signal ? waitForRequest(pending, request.signal) : pending);
1816
+ }
1817
+ }
1818
+ return next(request);
1819
+ };
1820
+ }
1805
1821
  /**
1806
1822
  * Подготавливает auth state до входа транспортной попытки в очередь.
1807
1823
  *
@@ -1812,7 +1828,12 @@ function createAuthPreparationMiddleware(auth) {
1812
1828
  return async (request, next) => {
1813
1829
  if (!request.skipAuth) {
1814
1830
  const pending = auth.prepare();
1815
- await (request.signal ? waitForRequest(pending, request.signal) : pending);
1831
+ try {
1832
+ await (request.signal ? waitForRequest(pending, request.signal) : pending);
1833
+ } catch (error) {
1834
+ requestAuthRecoveryState(request).preparationErrors.add(error);
1835
+ throw error;
1836
+ }
1816
1837
  }
1817
1838
  return next(request);
1818
1839
  };
@@ -1852,7 +1873,8 @@ function createAuthRecoveryMiddleware(auth) {
1852
1873
  try {
1853
1874
  return await next(request);
1854
1875
  } catch (error) {
1855
- if (request.skipAuthRefresh || recovery.recovered || !isItdApiError(error) || error.status !== 401) throw error;
1876
+ const preparationFailed = recovery.preparationErrors.delete(error);
1877
+ if (request.skipAuthRefresh || recovery.recovered || preparationFailed || !isItdApiError(error) || error.status !== 401) throw error;
1856
1878
  const pending = auth.recover();
1857
1879
  if (!await (request.signal ? waitForRequest(pending, request.signal) : pending)) throw error;
1858
1880
  recovery.recovered = true;
@@ -2581,6 +2603,7 @@ var Transport = class {
2581
2603
  const ClientRuntimeStage = Object.freeze({
2582
2604
  OperationPlugins: "operation_plugins",
2583
2605
  Services: "services",
2606
+ AuthPreflight: "auth_preflight",
2584
2607
  Retry: "retry",
2585
2608
  AuthRecovery: "auth_recovery",
2586
2609
  AuthPreparation: "auth_preparation",
@@ -2656,6 +2679,10 @@ function createClientRuntime(options, internals) {
2656
2679
  name: ClientRuntimeStage.Services,
2657
2680
  middleware: createServicesMiddleware(services)
2658
2681
  },
2682
+ {
2683
+ name: ClientRuntimeStage.AuthPreflight,
2684
+ middleware: createAuthPreflightMiddleware(() => auth)
2685
+ },
2659
2686
  {
2660
2687
  name: ClientRuntimeStage.Retry,
2661
2688
  middleware: createRetryMiddleware({
@@ -2929,11 +2956,6 @@ const OPERATIONS = freezeOperations({
2929
2956
  retrySafety: RetrySafety.Safe,
2930
2957
  bucket: "users"
2931
2958
  },
2932
- "users.search": {
2933
- method: "GET",
2934
- retrySafety: RetrySafety.Safe,
2935
- bucket: "users"
2936
- },
2937
2959
  "users.whoToFollow": {
2938
2960
  method: "GET",
2939
2961
  retrySafety: RetrySafety.Safe,
@@ -3170,11 +3192,6 @@ const OPERATIONS = freezeOperations({
3170
3192
  retrySafety: RetrySafety.Safe,
3171
3193
  bucket: "notifications"
3172
3194
  },
3173
- "hashtags.search": {
3174
- method: "GET",
3175
- retrySafety: RetrySafety.Safe,
3176
- bucket: "hashtags"
3177
- },
3178
3195
  "hashtags.trending": {
3179
3196
  method: "GET",
3180
3197
  retrySafety: RetrySafety.Safe,
@@ -3997,4 +4014,4 @@ function resolveNotificationUrl(notification) {
3997
4014
  //#endregion
3998
4015
  export { orderPluginDefinitions as $, ITD_CATALOG as A, isRecord as B, ReportReason as C, ViewReason as D, SpanType as E, operationMethod as F, pickString as G, pickBoolean as H, operationRetrySafety as I, identityResult as J, RetrySafety as K, BUCKET_LIMITS as L, defineBuiltInOperation as M, isBuiltInOperationId as N, ViewSource as O, operationBucket as P, assertPluginRemovable as Q, DEFAULT_RATE_LIMIT_BUCKET as R, NotificationType as S, ServiceState as T, pickNumber as U, pickArray as V, pickObject as W, mergeService as X, voidResult as Y, RequestQueuePool as Z, FeedTab as _, tokenProvider as a, isRecord$1 as at, ItdErrorCode as b, normalizeNotification as c, createDeadline as ct, canonicalNotificationType as d, DEFAULT_BASE_URL as et, isKnownNotificationType as f, EventChannelStatus as g, CommentSort as h, bearerToken as i, LIBRARY_VERSION as it, OPERATIONS as j, WallAccess as k, readNotificationEvent as l, systemClock as lt, AttachmentType as m, formatNotificationText as n, STATUS_SERVICE as nt, passthroughOperation as o, requireOptionalBoolean as ot, AccessType as p, defineOperation as q, anonymousAuth as r, resolveRateLimit as rt, voidOperation as s, RateLimitPacing as st, resolveNotificationUrl as t, DEFAULT_STATUS_BASE_URL as tt, readUnreadCountEvent as u, installAsyncDisposeFallback as ut, IncidentKind as v, ReportTargetType as w, LikesVisibility as x, InteractionType as y, createClientRuntime as z };
3999
4016
 
4000
- //# sourceMappingURL=url-i2f-X1hX.js.map
4017
+ //# sourceMappingURL=url-3Ts6EEHQ.js.map