itd-api 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +2 -2
  2. package/dist/index.cjs +81 -8
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +22 -4
  5. package/dist/index.d.ts +22 -4
  6. package/dist/index.js +81 -8
  7. package/dist/index.js.map +1 -1
  8. package/dist/realtime/index.cjs +3 -3
  9. package/dist/realtime/index.d.cts +2 -2
  10. package/dist/realtime/index.d.ts +2 -2
  11. package/dist/realtime/index.js +3 -3
  12. package/dist/rest/index.cjs +70 -6
  13. package/dist/rest/index.cjs.map +1 -1
  14. package/dist/rest/index.d.cts +11 -3
  15. package/dist/rest/index.d.ts +11 -3
  16. package/dist/rest/index.js +70 -6
  17. package/dist/rest/index.js.map +1 -1
  18. package/dist/shared/{auth-provider-CTJkKfgy.cjs → auth-provider-CG8oCQ9F.cjs} +2 -2
  19. package/dist/shared/{auth-provider-CTJkKfgy.cjs.map → auth-provider-CG8oCQ9F.cjs.map} +1 -1
  20. package/dist/shared/{auth-provider-BfogACAb.js → auth-provider-mYqxsSVa.js} +2 -2
  21. package/dist/shared/{auth-provider-BfogACAb.js.map → auth-provider-mYqxsSVa.js.map} +1 -1
  22. package/dist/shared/{render-vtLixIiU.js → render-C6HRPs10.js} +353 -56
  23. package/dist/shared/render-C6HRPs10.js.map +1 -0
  24. package/dist/shared/{render-DZrxhC5_.d.ts → render-CgwKdOzu.d.ts} +101 -40
  25. package/dist/shared/{render-DMp_3Nzk.d.cts → render-DO0F5YSm.d.cts} +101 -40
  26. package/dist/shared/{render-DyeHJNBw.cjs → render-mcuELiYi.cjs} +369 -54
  27. package/dist/shared/render-mcuELiYi.cjs.map +1 -0
  28. package/dist/shared/{url-yjl2c8Ie.cjs → url-BaMCQpYH.cjs} +76 -24
  29. package/dist/shared/url-BaMCQpYH.cjs.map +1 -0
  30. package/dist/shared/{url-B6-bXHKt.d.ts → url-DTfZ2toq.d.cts} +6 -8
  31. package/dist/shared/{url-B6-bXHKt.d.cts → url-DTfZ2toq.d.ts} +6 -8
  32. package/dist/shared/{url-CYXgxqGx.js → url-IU0xN9wX.js} +65 -25
  33. package/dist/shared/url-IU0xN9wX.js.map +1 -0
  34. package/dist/shared/{websocket-CbzB1Leq.js → websocket-BLR8eVJV.js} +2 -2
  35. package/dist/shared/{websocket-CbzB1Leq.js.map → websocket-BLR8eVJV.js.map} +1 -1
  36. package/dist/shared/{websocket-sYlynrr0.cjs → websocket-C_eI4H2o.cjs} +2 -2
  37. package/dist/shared/{websocket-sYlynrr0.cjs.map → websocket-C_eI4H2o.cjs.map} +1 -1
  38. package/dist/shared/{websocket-D1p32SB2.d.cts → websocket-DF7XIMiX.d.cts} +2 -2
  39. package/dist/shared/{websocket-BMtihD56.d.ts → websocket-DYKBr8HF.d.ts} +2 -2
  40. package/package.json +1 -1
  41. package/dist/shared/render-DyeHJNBw.cjs.map +0 -1
  42. package/dist/shared/render-vtLixIiU.js.map +0 -1
  43. package/dist/shared/url-CYXgxqGx.js.map +0 -1
  44. package/dist/shared/url-yjl2c8Ie.cjs.map +0 -1
@@ -1,6 +1,8 @@
1
1
  //#region src/core/operation.d.ts
2
2
  /** HTTP-метод операции. */
3
3
  type OperationMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
4
+ /** ID операции подключаемого модуля: `<featureName>.<operationName>`. */
5
+ type FeatureOperationId<TFeatureName extends string = string, TOperationName extends string = string> = `${TFeatureName}.${TOperationName}`;
4
6
  /** Семантическая безопасность автоматического повтора операции. */
5
7
  declare const RetrySafety: Readonly<{
6
8
  /** Автоматический повтор не создаёт неприемлемого эффекта; обычно это чтение. */
@@ -495,10 +497,6 @@ declare const OPERATIONS: Readonly<{
495
497
  readonly method: "GET";
496
498
  readonly retrySafety: "safe";
497
499
  }>;
498
- readonly 'platform.status': Readonly<{
499
- readonly method: "GET";
500
- readonly retrySafety: "safe";
501
- }>;
502
500
  readonly 'telemetry.dwell': Readonly<{
503
501
  readonly method: "POST";
504
502
  readonly retrySafety: "unsafe";
@@ -513,7 +511,7 @@ type BuiltInOperationId = keyof typeof OPERATIONS;
513
511
  /** Пользовательская семантическая операция низкоуровневого запроса. */
514
512
  type CustomOperationId = `custom:${string}`;
515
513
  /** ID любого запроса, видимый transformers и hooks. */
516
- type OperationId = BuiltInOperationId | CustomOperationId | 'raw';
514
+ type OperationId = BuiltInOperationId | FeatureOperationId | CustomOperationId | 'raw';
517
515
  /** Проверяет принадлежность ID встроенному каталогу. */
518
516
  declare function isBuiltInOperationId(value: string): value is BuiltInOperationId;
519
517
  /** HTTP-метод встроенной операции. */
@@ -1316,7 +1314,7 @@ interface Span {
1316
1314
  //#endregion
1317
1315
  //#region src/core/version.d.ts
1318
1316
  /** Версия библиотеки. Попадает в `User-Agent`. */
1319
- declare const LIBRARY_VERSION = "0.7.1";
1317
+ declare const LIBRARY_VERSION = "0.7.2";
1320
1318
  //#endregion
1321
1319
  //#region src/core/config.d.ts
1322
1320
  /** Базовый URL API итд.com. Домен записан в punycode: `итд.com`. */
@@ -2079,5 +2077,5 @@ declare function isKnownNotificationType(type: string): boolean;
2079
2077
  */
2080
2078
  declare function resolveNotificationUrl(notification: Notification): string;
2081
2079
  //#endregion
2082
- export { UserSummary as $, RateLimitPacing as $t, isItdFileError as A, Emitter as At, Notification as B, RateLimitOptions as Bt, ItdStateError as C, ReportReason as Ct, isItdAuthError as D, ViewReason as Dt, isItdApiError as E, SpanType as Et, isItdServerError as F, Logger as Ft, FollowResult as G, ResponseContext as Gt, Actor as H, RequestContext as Ht, isItdStateError as I, OperationRequestOptions as It, PinsResult as J, RetryOptions as Jt, MyProfile as K, RetryContext as Kt, isItdValidationError as L, PaginationOptions as Lt, isItdNotFoundError as M, Unsubscribe as Mt, isItdPhoneVerificationError as N, ClientHooks as Nt, isItdConflictError as O, ViewSource as Ot, isItdRateLimitError as P, ErrorContextHook as Pt, SubscriptionState as Q, ServiceDefinition as Qt, NotificationEvent as R, RateLimitBucketContext as Rt, ItdServerError as S, RealtimeStatus as St, ItdValidationError as T, ServiceState as Tt, AuthState as U, RequestExtensions as Ut, NotificationSettings as V, RawRequestOptions as Vt, Author as W, RequestOptions as Wt, Profile as X, QueryParams as Xt, PrivacySettings as Y, RuntimeOptions as Yt, PublicProfile as Z, QueryValue as Zt, ItdForbiddenError as _, InteractionType as _t, ItdAbortError as a, ItdOperationDefinition as an, DEFAULT_BASE_URL as at, ItdPhoneVerificationError as b, Loose as bt, ItdApiErrorKind as c, isBuiltInOperationId as cn, IsoDate as ct, ItdConflictError as d, operationRetrySafety as dn, UserRef as dt, RuntimeMode as en, AuthIdentity as et, ItdError as f, BUCKET_LIMITS as fn, AccessType as ft, ItdFileErrorReason as g, RetrySafety as gn, IncidentKind as gt, ItdFileError as h, OperationMethod as hn, FeedTab as ht, formatNotificationText as i, CustomOperationId as in, tokenProvider as it, isItdForbiddenError as j, Listener as jt, isItdError as k, WallAccess as kt, ItdAuthError as l, operationBucket as ln, Span as lt, ItdFieldErrors as m, RateLimitBucket as mn, CommentSort as mt, canonicalNotificationType as n, systemClock as nn, anonymousAuth as nt, ItdApiError as o, OPERATIONS as on, STATUS_SERVICE as ot, ItdErrorKind as p, DEFAULT_RATE_LIMIT_BUCKET as pn, AttachmentType as pt, Pin as q, RetryDecisionContext as qt, isKnownNotificationType as r, BuiltInOperationId as rn, bearerToken as rt, ItdApiErrorInit as s, OperationId as sn, LIBRARY_VERSION as st, resolveNotificationUrl as t, ItdClock as tn, AuthProvider as tt, ItdConfigError as u, operationMethod as un, UserId as ut, ItdNetworkError as v, ItdErrorCode as vt, ItdTimeoutError as w, ReportTargetType as wt, ItdRateLimitError as x, NotificationType as xt, ItdNotFoundError as y, LikesVisibility as yt, normalizeNotification as z, RateLimitBucketOverride as zt };
2083
- //# sourceMappingURL=url-B6-bXHKt.d.ts.map
2080
+ export { UserSummary as $, RateLimitPacing as $t, isItdFileError as A, Emitter as At, Notification as B, RateLimitOptions as Bt, ItdStateError as C, ReportReason as Ct, isItdAuthError as D, ViewReason as Dt, isItdApiError as E, SpanType as Et, isItdServerError as F, Logger as Ft, FollowResult as G, ResponseContext as Gt, Actor as H, RequestContext as Ht, isItdStateError as I, OperationRequestOptions as It, PinsResult as J, RetryOptions as Jt, MyProfile as K, RetryContext as Kt, isItdValidationError as L, PaginationOptions as Lt, isItdNotFoundError as M, Unsubscribe as Mt, isItdPhoneVerificationError as N, ClientHooks as Nt, isItdConflictError as O, ViewSource as Ot, isItdRateLimitError as P, ErrorContextHook as Pt, SubscriptionState as Q, ServiceDefinition as Qt, NotificationEvent as R, RateLimitBucketContext as Rt, ItdServerError as S, RealtimeStatus as St, ItdValidationError as T, ServiceState as Tt, AuthState as U, RequestExtensions as Ut, NotificationSettings as V, RawRequestOptions as Vt, Author as W, RequestOptions as Wt, Profile as X, QueryParams as Xt, PrivacySettings as Y, RuntimeOptions as Yt, PublicProfile as Z, QueryValue as Zt, ItdForbiddenError as _, RetrySafety as _n, InteractionType as _t, ItdAbortError as a, ItdOperationDefinition as an, DEFAULT_BASE_URL as at, ItdPhoneVerificationError as b, Loose as bt, ItdApiErrorKind as c, isBuiltInOperationId as cn, IsoDate as ct, ItdConflictError as d, operationRetrySafety as dn, UserRef as dt, RuntimeMode as en, AuthIdentity as et, ItdError as f, BUCKET_LIMITS as fn, AccessType as ft, ItdFileErrorReason as g, OperationMethod as gn, IncidentKind as gt, ItdFileError as h, FeatureOperationId as hn, FeedTab as ht, formatNotificationText as i, CustomOperationId as in, tokenProvider as it, isItdForbiddenError as j, Listener as jt, isItdError as k, WallAccess as kt, ItdAuthError as l, operationBucket as ln, Span as lt, ItdFieldErrors as m, RateLimitBucket as mn, CommentSort as mt, canonicalNotificationType as n, systemClock as nn, anonymousAuth as nt, ItdApiError as o, OPERATIONS as on, STATUS_SERVICE as ot, ItdErrorKind as p, DEFAULT_RATE_LIMIT_BUCKET as pn, AttachmentType as pt, Pin as q, RetryDecisionContext as qt, isKnownNotificationType as r, BuiltInOperationId as rn, bearerToken as rt, ItdApiErrorInit as s, OperationId as sn, LIBRARY_VERSION as st, resolveNotificationUrl as t, ItdClock as tn, AuthProvider as tt, ItdConfigError as u, operationMethod as un, UserId as ut, ItdNetworkError as v, ItdErrorCode as vt, ItdTimeoutError as w, ReportTargetType as wt, ItdRateLimitError as x, NotificationType as xt, ItdNotFoundError as y, LikesVisibility as yt, normalizeNotification as z, RateLimitBucketOverride as zt };
2081
+ //# sourceMappingURL=url-DTfZ2toq.d.cts.map
@@ -1,6 +1,8 @@
1
1
  //#region src/core/operation.d.ts
2
2
  /** HTTP-метод операции. */
3
3
  type OperationMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
4
+ /** ID операции подключаемого модуля: `<featureName>.<operationName>`. */
5
+ type FeatureOperationId<TFeatureName extends string = string, TOperationName extends string = string> = `${TFeatureName}.${TOperationName}`;
4
6
  /** Семантическая безопасность автоматического повтора операции. */
5
7
  declare const RetrySafety: Readonly<{
6
8
  /** Автоматический повтор не создаёт неприемлемого эффекта; обычно это чтение. */
@@ -495,10 +497,6 @@ declare const OPERATIONS: Readonly<{
495
497
  readonly method: "GET";
496
498
  readonly retrySafety: "safe";
497
499
  }>;
498
- readonly 'platform.status': Readonly<{
499
- readonly method: "GET";
500
- readonly retrySafety: "safe";
501
- }>;
502
500
  readonly 'telemetry.dwell': Readonly<{
503
501
  readonly method: "POST";
504
502
  readonly retrySafety: "unsafe";
@@ -513,7 +511,7 @@ type BuiltInOperationId = keyof typeof OPERATIONS;
513
511
  /** Пользовательская семантическая операция низкоуровневого запроса. */
514
512
  type CustomOperationId = `custom:${string}`;
515
513
  /** ID любого запроса, видимый transformers и hooks. */
516
- type OperationId = BuiltInOperationId | CustomOperationId | 'raw';
514
+ type OperationId = BuiltInOperationId | FeatureOperationId | CustomOperationId | 'raw';
517
515
  /** Проверяет принадлежность ID встроенному каталогу. */
518
516
  declare function isBuiltInOperationId(value: string): value is BuiltInOperationId;
519
517
  /** HTTP-метод встроенной операции. */
@@ -1316,7 +1314,7 @@ interface Span {
1316
1314
  //#endregion
1317
1315
  //#region src/core/version.d.ts
1318
1316
  /** Версия библиотеки. Попадает в `User-Agent`. */
1319
- declare const LIBRARY_VERSION = "0.7.1";
1317
+ declare const LIBRARY_VERSION = "0.7.2";
1320
1318
  //#endregion
1321
1319
  //#region src/core/config.d.ts
1322
1320
  /** Базовый URL API итд.com. Домен записан в punycode: `итд.com`. */
@@ -2079,5 +2077,5 @@ declare function isKnownNotificationType(type: string): boolean;
2079
2077
  */
2080
2078
  declare function resolveNotificationUrl(notification: Notification): string;
2081
2079
  //#endregion
2082
- export { UserSummary as $, RateLimitPacing as $t, isItdFileError as A, Emitter as At, Notification as B, RateLimitOptions as Bt, ItdStateError as C, ReportReason as Ct, isItdAuthError as D, ViewReason as Dt, isItdApiError as E, SpanType as Et, isItdServerError as F, Logger as Ft, FollowResult as G, ResponseContext as Gt, Actor as H, RequestContext as Ht, isItdStateError as I, OperationRequestOptions as It, PinsResult as J, RetryOptions as Jt, MyProfile as K, RetryContext as Kt, isItdValidationError as L, PaginationOptions as Lt, isItdNotFoundError as M, Unsubscribe as Mt, isItdPhoneVerificationError as N, ClientHooks as Nt, isItdConflictError as O, ViewSource as Ot, isItdRateLimitError as P, ErrorContextHook as Pt, SubscriptionState as Q, ServiceDefinition as Qt, NotificationEvent as R, RateLimitBucketContext as Rt, ItdServerError as S, RealtimeStatus as St, ItdValidationError as T, ServiceState as Tt, AuthState as U, RequestExtensions as Ut, NotificationSettings as V, RawRequestOptions as Vt, Author as W, RequestOptions as Wt, Profile as X, QueryParams as Xt, PrivacySettings as Y, RuntimeOptions as Yt, PublicProfile as Z, QueryValue as Zt, ItdForbiddenError as _, InteractionType as _t, ItdAbortError as a, ItdOperationDefinition as an, DEFAULT_BASE_URL as at, ItdPhoneVerificationError as b, Loose as bt, ItdApiErrorKind as c, isBuiltInOperationId as cn, IsoDate as ct, ItdConflictError as d, operationRetrySafety as dn, UserRef as dt, RuntimeMode as en, AuthIdentity as et, ItdError as f, BUCKET_LIMITS as fn, AccessType as ft, ItdFileErrorReason as g, RetrySafety as gn, IncidentKind as gt, ItdFileError as h, OperationMethod as hn, FeedTab as ht, formatNotificationText as i, CustomOperationId as in, tokenProvider as it, isItdForbiddenError as j, Listener as jt, isItdError as k, WallAccess as kt, ItdAuthError as l, operationBucket as ln, Span as lt, ItdFieldErrors as m, RateLimitBucket as mn, CommentSort as mt, canonicalNotificationType as n, systemClock as nn, anonymousAuth as nt, ItdApiError as o, OPERATIONS as on, STATUS_SERVICE as ot, ItdErrorKind as p, DEFAULT_RATE_LIMIT_BUCKET as pn, AttachmentType as pt, Pin as q, RetryDecisionContext as qt, isKnownNotificationType as r, BuiltInOperationId as rn, bearerToken as rt, ItdApiErrorInit as s, OperationId as sn, LIBRARY_VERSION as st, resolveNotificationUrl as t, ItdClock as tn, AuthProvider as tt, ItdConfigError as u, operationMethod as un, UserId as ut, ItdNetworkError as v, ItdErrorCode as vt, ItdTimeoutError as w, ReportTargetType as wt, ItdRateLimitError as x, NotificationType as xt, ItdNotFoundError as y, LikesVisibility as yt, normalizeNotification as z, RateLimitBucketOverride as zt };
2083
- //# sourceMappingURL=url-B6-bXHKt.d.cts.map
2080
+ export { UserSummary as $, RateLimitPacing as $t, isItdFileError as A, Emitter as At, Notification as B, RateLimitOptions as Bt, ItdStateError as C, ReportReason as Ct, isItdAuthError as D, ViewReason as Dt, isItdApiError as E, SpanType as Et, isItdServerError as F, Logger as Ft, FollowResult as G, ResponseContext as Gt, Actor as H, RequestContext as Ht, isItdStateError as I, OperationRequestOptions as It, PinsResult as J, RetryOptions as Jt, MyProfile as K, RetryContext as Kt, isItdValidationError as L, PaginationOptions as Lt, isItdNotFoundError as M, Unsubscribe as Mt, isItdPhoneVerificationError as N, ClientHooks as Nt, isItdConflictError as O, ViewSource as Ot, isItdRateLimitError as P, ErrorContextHook as Pt, SubscriptionState as Q, ServiceDefinition as Qt, NotificationEvent as R, RateLimitBucketContext as Rt, ItdServerError as S, RealtimeStatus as St, ItdValidationError as T, ServiceState as Tt, AuthState as U, RequestExtensions as Ut, NotificationSettings as V, RawRequestOptions as Vt, Author as W, RequestOptions as Wt, Profile as X, QueryParams as Xt, PrivacySettings as Y, RuntimeOptions as Yt, PublicProfile as Z, QueryValue as Zt, ItdForbiddenError as _, RetrySafety as _n, InteractionType as _t, ItdAbortError as a, ItdOperationDefinition as an, DEFAULT_BASE_URL as at, ItdPhoneVerificationError as b, Loose as bt, ItdApiErrorKind as c, isBuiltInOperationId as cn, IsoDate as ct, ItdConflictError as d, operationRetrySafety as dn, UserRef as dt, RuntimeMode as en, AuthIdentity as et, ItdError as f, BUCKET_LIMITS as fn, AccessType as ft, ItdFileErrorReason as g, OperationMethod as gn, IncidentKind as gt, ItdFileError as h, FeatureOperationId as hn, FeedTab as ht, formatNotificationText as i, CustomOperationId as in, tokenProvider as it, isItdForbiddenError as j, Listener as jt, isItdError as k, WallAccess as kt, ItdAuthError as l, operationBucket as ln, Span as lt, ItdFieldErrors as m, RateLimitBucket as mn, CommentSort as mt, canonicalNotificationType as n, systemClock as nn, anonymousAuth as nt, ItdApiError as o, OPERATIONS as on, STATUS_SERVICE as ot, ItdErrorKind as p, DEFAULT_RATE_LIMIT_BUCKET as pn, AttachmentType as pt, Pin as q, RetryDecisionContext as qt, isKnownNotificationType as r, BuiltInOperationId as rn, bearerToken as rt, ItdApiErrorInit as s, OperationId as sn, LIBRARY_VERSION as st, resolveNotificationUrl as t, ItdClock as tn, AuthProvider as tt, ItdConfigError as u, operationMethod as un, UserId as ut, ItdNetworkError as v, ItdErrorCode as vt, ItdTimeoutError as w, ReportTargetType as wt, ItdRateLimitError as x, NotificationType as xt, ItdNotFoundError as y, LikesVisibility as yt, normalizeNotification as z, RateLimitBucketOverride as zt };
2081
+ //# sourceMappingURL=url-DTfZ2toq.d.ts.map
@@ -199,7 +199,7 @@ function requireOptionalBoolean(value, name) {
199
199
  //#endregion
200
200
  //#region src/core/version.ts
201
201
  /** Версия библиотеки. Попадает в `User-Agent`. */
202
- const LIBRARY_VERSION = "0.7.1";
202
+ const LIBRARY_VERSION = "0.7.2";
203
203
  //#endregion
204
204
  //#region src/core/config.ts
205
205
  /** Базовый URL API итд.com. Домен записан в punycode: `итд.com`. */
@@ -208,12 +208,6 @@ const DEFAULT_BASE_URL = "https://xn--d1ah4a.com";
208
208
  const DEFAULT_STATUS_BASE_URL = "https://xn--80a7abcbg.xn--d1ah4a.com";
209
209
  /** Имя встроенного сервиса статуса. */
210
210
  const STATUS_SERVICE = "status";
211
- /** Сервисы, зарегистрированные у любого клиента. */
212
- const BUILT_IN_SERVICES = Object.freeze([Object.freeze({
213
- name: STATUS_SERVICE,
214
- baseUrl: DEFAULT_STATUS_BASE_URL,
215
- auth: false
216
- })]);
217
211
  /**
218
212
  * `User-Agent` по умолчанию.
219
213
  *
@@ -998,7 +992,7 @@ var BucketQueue = class {
998
992
  * слот бакета, но до общей очереди ещё не дошли.
999
993
  */
1000
994
  #generation = 0;
1001
- constructor(destination, bucket, shared, options, clock) {
995
+ constructor(destination, bucket, shared, options, clock, featureDefinition) {
1002
996
  this.#destination = destination;
1003
997
  this.#bucket = bucket;
1004
998
  this.#shared = shared;
@@ -1006,9 +1000,9 @@ var BucketQueue = class {
1006
1000
  this.#pacing = options.pacing;
1007
1001
  this.#smooth = options.buckets && options.pacing === RateLimitPacing.Smooth;
1008
1002
  this.#flatPause = options.buckets ? void 0 : options.retryDelays[0] ?? 0;
1009
- this.#seedLimit = options.buckets ? seedLimit(bucket, options) : void 0;
1003
+ this.#seedLimit = options.buckets ? featureDefinition?.limit ?? seedLimit(bucket, options) : void 0;
1010
1004
  this.#gate = new RequestQueue({
1011
- concurrency: options.buckets ? options.bucketOverrides[bucket]?.concurrency ?? options.bucketConcurrency : options.concurrency,
1005
+ concurrency: options.buckets ? featureDefinition?.concurrency ?? options.bucketOverrides[bucket]?.concurrency ?? options.bucketConcurrency : options.concurrency,
1012
1006
  onDispatch: this.#smooth ? () => this.#spend() : void 0
1013
1007
  }, clock);
1014
1008
  }
@@ -1137,10 +1131,42 @@ var RequestQueuePool = class {
1137
1131
  #clock;
1138
1132
  /** Ключ `undefined` — основная очередь внутренних клиентов без известного направления. */
1139
1133
  #destinations = /* @__PURE__ */ new Map();
1134
+ /** Динамические определения feature вместе с числом использующих их клиентов. */
1135
+ #featureBuckets = /* @__PURE__ */ new Map();
1140
1136
  constructor(options, clock = systemClock) {
1141
1137
  this.#options = options;
1142
1138
  this.#clock = clock;
1143
1139
  }
1140
+ /**
1141
+ * Регистрирует бакет подключаемого feature.
1142
+ *
1143
+ * Повтор той же декларации разрешён клиентам, разделяющим один pool через `ItdAccounts`.
1144
+ * Возвращённая функция откатывает регистрацию, пока очередь бакета ещё не создана.
1145
+ */
1146
+ defineBucket(name, definition) {
1147
+ const normalized = Object.freeze({
1148
+ ...definition.limit === void 0 ? {} : { limit: definition.limit },
1149
+ ...definition.concurrency === void 0 ? {} : { concurrency: definition.concurrency }
1150
+ });
1151
+ const existing = this.#featureBuckets.get(name);
1152
+ if (existing) {
1153
+ if (existing.definition.limit !== normalized.limit || existing.definition.concurrency !== normalized.concurrency) throw new ItdConfigError(`Бакет feature «${name}» уже зарегистрирован с другими ограничениями`);
1154
+ existing.references += 1;
1155
+ } else this.#featureBuckets.set(name, {
1156
+ definition: normalized,
1157
+ references: 1
1158
+ });
1159
+ let released = false;
1160
+ return () => {
1161
+ if (released) return;
1162
+ released = true;
1163
+ const current = this.#featureBuckets.get(name);
1164
+ if (!current) return;
1165
+ current.references -= 1;
1166
+ if (current.references > 0) return;
1167
+ if (![...this.#destinations.values()].some((entry) => entry.buckets.has(name))) this.#featureBuckets.delete(name);
1168
+ };
1169
+ }
1144
1170
  /** Очередь бакета на направлении. При `buckets: false` бакет всегда `default`. */
1145
1171
  for(destination, bucket) {
1146
1172
  const fallback = this.#options.defaultBucket;
@@ -1155,7 +1181,7 @@ var RequestQueuePool = class {
1155
1181
  }
1156
1182
  let queue = entry.buckets.get(name);
1157
1183
  if (!queue) {
1158
- queue = new BucketQueue(destination, name, entry.shared, this.#options, this.#clock);
1184
+ queue = new BucketQueue(destination, name, entry.shared, this.#options, this.#clock, this.#featureBuckets.get(name)?.definition);
1159
1185
  entry.buckets.set(name, queue);
1160
1186
  }
1161
1187
  return queue;
@@ -1180,6 +1206,7 @@ var RequestQueuePool = class {
1180
1206
  clear() {
1181
1207
  this.stop();
1182
1208
  this.#destinations.clear();
1209
+ this.#featureBuckets.clear();
1183
1210
  }
1184
1211
  };
1185
1212
  //#endregion
@@ -1251,6 +1278,28 @@ var ServiceRegistry = class {
1251
1278
  has(name) {
1252
1279
  return this.#services.has(name);
1253
1280
  }
1281
+ /** Удаляет сервис при откате атомарной установки feature. @internal */
1282
+ delete(name) {
1283
+ return this.#services.delete(name);
1284
+ }
1285
+ /**
1286
+ * Атомарно заменяет существующее определение и возвращает прежнее.
1287
+ * Используется feature, накладывающим default на сервис из опций клиента.
1288
+ *
1289
+ * @internal
1290
+ */
1291
+ replace(definition) {
1292
+ const name = definition.name.trim();
1293
+ const previous = this.require(name);
1294
+ this.#services.delete(name);
1295
+ try {
1296
+ this.define(definition);
1297
+ } catch (error) {
1298
+ this.#services.set(name, previous);
1299
+ throw error;
1300
+ }
1301
+ return previous;
1302
+ }
1254
1303
  /**
1255
1304
  * Определение сервиса.
1256
1305
  *
@@ -2452,16 +2501,10 @@ const ClientRuntimeStage = Object.freeze({
2452
2501
  AuthHeaders: "auth_headers",
2453
2502
  Transport: "transport"
2454
2503
  });
2455
- /** Регистрирует встроенные сервисы и накладывает пользовательские overrides. */
2504
+ /** Регистрирует сервисы, заранее объявленные в опциях клиента. */
2456
2505
  function createServiceRegistry(config) {
2457
2506
  const services = new ServiceRegistry(config.baseUrl);
2458
- const overrides = new Map(config.services.map((service) => [service.name.trim(), service]));
2459
- for (const builtIn of BUILT_IN_SERVICES) {
2460
- const override = overrides.get(builtIn.name);
2461
- overrides.delete(builtIn.name);
2462
- services.define(override ? mergeService(builtIn, override) : builtIn);
2463
- }
2464
- for (const service of overrides.values()) services.define(service);
2507
+ for (const service of config.services) services.define(service);
2465
2508
  return services;
2466
2509
  }
2467
2510
  /** Собирает внутренний runtime клиента и единственный request pipeline. @internal */
@@ -2596,6 +2639,7 @@ function createClientRuntime(options, internals) {
2596
2639
  stageOrder,
2597
2640
  platformHeaders: (url) => transport.platformHeaders(url),
2598
2641
  rateLimitState: () => queues?.states() ?? [],
2642
+ registerRateLimitBucket: (name, definition) => queues?.defineBucket(name, definition),
2599
2643
  close: () => {
2600
2644
  if (ownsQueues) queues?.stop();
2601
2645
  },
@@ -3084,10 +3128,6 @@ const OPERATIONS = freezeOperations({
3084
3128
  method: "GET",
3085
3129
  retrySafety: RetrySafety.Safe
3086
3130
  },
3087
- "platform.status": {
3088
- method: "GET",
3089
- retrySafety: RetrySafety.Safe
3090
- },
3091
3131
  "telemetry.dwell": {
3092
3132
  method: "POST",
3093
3133
  retrySafety: RetrySafety.Unsafe
@@ -3668,6 +3708,6 @@ function resolveNotificationUrl(notification) {
3668
3708
  return clickUrl || "/notifications";
3669
3709
  }
3670
3710
  //#endregion
3671
- export { RuntimeMode as $, operationRetrySafety as A, maskSecret as B, ViewSource as C, isBuiltInOperationId as D, OPERATIONS as E, pickArray as F, orderPluginDefinitions as G, RetrySafety as H, pickBoolean as I, resolveRateLimit as J, DEFAULT_BASE_URL as K, pickNumber as L, DEFAULT_RATE_LIMIT_BUCKET as M, createClientRuntime as N, operationBucket as O, isRecord as P, RateLimitPacing as Q, pickObject as R, ViewReason as S, ITD_CATALOG as T, RequestQueuePool as U, redactUrl as V, assertPluginRemovable as W, isRecord$1 as X, LIBRARY_VERSION as Y, requireOptionalBoolean as Z, RealtimeStatus as _, readUnreadCountEvent as a, systemClock as at, ServiceState as b, AccessType as c, FeedTab as d, createDeviceId as et, IncidentKind as f, NotificationType as g, LikesVisibility as h, readNotificationEvent as i, createDeadline as it, BUCKET_LIMITS as j, operationMethod as k, AttachmentType as l, ItdErrorCode as m, formatNotificationText as n, isFile as nt, canonicalNotificationType as o, installAsyncDisposeFallback as ot, InteractionType as p, STATUS_SERVICE as q, normalizeNotification as r, supportsStreamingBody as rt, isKnownNotificationType as s, resolveNotificationUrl as t, isBlob as tt, CommentSort as u, ReportReason as v, WallAccess as w, SpanType as x, ReportTargetType as y, pickString as z };
3711
+ export { requireOptionalBoolean as $, operationRetrySafety as A, maskSecret as B, ViewSource as C, isBuiltInOperationId as D, OPERATIONS as E, pickArray as F, assertPluginRemovable as G, RetrySafety as H, pickBoolean as I, DEFAULT_STATUS_BASE_URL as J, orderPluginDefinitions as K, pickNumber as L, DEFAULT_RATE_LIMIT_BUCKET as M, createClientRuntime as N, operationBucket as O, isRecord as P, isRecord$1 as Q, pickObject as R, ViewReason as S, ITD_CATALOG as T, mergeService as U, redactUrl as V, RequestQueuePool as W, resolveRateLimit as X, STATUS_SERVICE as Y, LIBRARY_VERSION as Z, RealtimeStatus as _, readUnreadCountEvent as a, supportsStreamingBody as at, ServiceState as b, AccessType as c, installAsyncDisposeFallback as ct, FeedTab as d, RateLimitPacing as et, IncidentKind as f, NotificationType as g, LikesVisibility as h, readNotificationEvent as i, isFile as it, BUCKET_LIMITS as j, operationMethod as k, AttachmentType as l, ItdErrorCode as m, formatNotificationText as n, createDeviceId as nt, canonicalNotificationType as o, createDeadline as ot, InteractionType as p, DEFAULT_BASE_URL as q, normalizeNotification as r, isBlob as rt, isKnownNotificationType as s, systemClock as st, resolveNotificationUrl as t, RuntimeMode as tt, CommentSort as u, ReportReason as v, WallAccess as w, SpanType as x, ReportTargetType as y, pickString as z };
3672
3712
 
3673
- //# sourceMappingURL=url-CYXgxqGx.js.map
3713
+ //# sourceMappingURL=url-IU0xN9wX.js.map