itd-api 0.7.2 → 0.8.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 +12 -12
- package/dist/events/index.cjs +53 -0
- package/dist/events/index.d.cts +3 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/index.js +5 -0
- package/dist/index.cjs +215 -194
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -63
- package/dist/index.d.ts +66 -63
- package/dist/index.js +197 -179
- package/dist/index.js.map +1 -1
- package/dist/node/index.cjs +4 -4
- package/dist/node/index.d.cts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.js +4 -4
- package/dist/rest/index.cjs +20 -26
- package/dist/rest/index.cjs.map +1 -1
- package/dist/rest/index.d.cts +7 -7
- package/dist/rest/index.d.ts +7 -7
- package/dist/rest/index.js +14 -20
- package/dist/rest/index.js.map +1 -1
- package/dist/shared/{errors-DfU8M5eS.cjs → errors-BmP3TKoW.cjs} +3 -3
- package/dist/shared/{errors-DfU8M5eS.cjs.map → errors-BmP3TKoW.cjs.map} +1 -1
- package/dist/shared/{errors-Bhrd2fJd.js → errors-GI10kZxk.js} +3 -3
- package/dist/shared/{errors-Bhrd2fJd.js.map → errors-GI10kZxk.js.map} +1 -1
- package/dist/shared/events-Br2r7coi.d.cts +698 -0
- package/dist/shared/events-QyhQZrnC.d.ts +698 -0
- package/dist/shared/{websocket-BLR8eVJV.js → events-TfhKh26b.js} +770 -490
- package/dist/shared/events-TfhKh26b.js.map +1 -0
- package/dist/shared/{websocket-C_eI4H2o.cjs → events-iTteVsd_.cjs} +834 -518
- package/dist/shared/events-iTteVsd_.cjs.map +1 -0
- package/dist/shared/{multi-storage-CkvTUC5m.js → multi-storage-1AEZTczk.js} +4 -4
- package/dist/shared/{multi-storage-CkvTUC5m.js.map → multi-storage-1AEZTczk.js.map} +1 -1
- package/dist/shared/{multi-storage--yTEqiod.cjs → multi-storage-CCUgkqvI.cjs} +6 -6
- package/dist/shared/{multi-storage--yTEqiod.cjs.map → multi-storage-CCUgkqvI.cjs.map} +1 -1
- package/dist/shared/{options-DtATYdLr.js → options-BNP633A5.js} +8 -6
- package/dist/shared/options-BNP633A5.js.map +1 -0
- package/dist/shared/{options-Dg5N3r1V.cjs → options-BUfoHE9G.cjs} +8 -6
- package/dist/shared/options-BUfoHE9G.cjs.map +1 -0
- package/dist/shared/{cookies-DZwFq6kr.cjs → redact-DB9EMGJx.cjs} +301 -2
- package/dist/shared/redact-DB9EMGJx.cjs.map +1 -0
- package/dist/shared/{cookies-tX2sNwxb.js → redact-FNK29Fv-.js} +224 -3
- package/dist/shared/redact-FNK29Fv-.js.map +1 -0
- package/dist/shared/{render-DO0F5YSm.d.cts → render-BszcKF7S.d.cts} +430 -313
- package/dist/shared/{render-C6HRPs10.js → render-CiL1VS0b.js} +925 -582
- package/dist/shared/render-CiL1VS0b.js.map +1 -0
- package/dist/shared/{render-mcuELiYi.cjs → render-DNTESBSl.cjs} +967 -618
- package/dist/shared/render-DNTESBSl.cjs.map +1 -0
- package/dist/shared/{render-CgwKdOzu.d.ts → render-DVB7T8pm.d.ts} +430 -313
- package/dist/shared/{storage-BPJR_k4-.cjs → storage-BLmXmzKF.cjs} +2 -2
- package/dist/shared/{storage-BPJR_k4-.cjs.map → storage-BLmXmzKF.cjs.map} +1 -1
- package/dist/shared/{storage-D86edNCB.js → storage-CCxn0Kkv.js} +2 -2
- package/dist/shared/{storage-D86edNCB.js.map → storage-CCxn0Kkv.js.map} +1 -1
- package/dist/shared/{url-IU0xN9wX.js → url-B3ocFlHj.js} +434 -408
- package/dist/shared/url-B3ocFlHj.js.map +1 -0
- package/dist/shared/{url-DTfZ2toq.d.cts → url-Be9jlWRv.d.cts} +1228 -1188
- package/dist/shared/{url-DTfZ2toq.d.ts → url-Be9jlWRv.d.ts} +1228 -1188
- package/dist/shared/{url-BaMCQpYH.cjs → url-CFN1sT9S.cjs} +497 -465
- package/dist/shared/url-CFN1sT9S.cjs.map +1 -0
- package/dist/web/index.cjs +2 -2
- package/dist/web/index.js +2 -2
- package/package.json +16 -15
- package/dist/realtime/index.cjs +0 -165
- package/dist/realtime/index.cjs.map +0 -1
- package/dist/realtime/index.d.cts +0 -51
- package/dist/realtime/index.d.ts +0 -51
- package/dist/realtime/index.js +0 -120
- package/dist/realtime/index.js.map +0 -1
- package/dist/shared/auth-provider-CG8oCQ9F.cjs +0 -108
- package/dist/shared/auth-provider-CG8oCQ9F.cjs.map +0 -1
- package/dist/shared/auth-provider-mYqxsSVa.js +0 -91
- package/dist/shared/auth-provider-mYqxsSVa.js.map +0 -1
- package/dist/shared/cookies-DZwFq6kr.cjs.map +0 -1
- package/dist/shared/cookies-tX2sNwxb.js.map +0 -1
- package/dist/shared/options-Dg5N3r1V.cjs.map +0 -1
- package/dist/shared/options-DtATYdLr.js.map +0 -1
- package/dist/shared/render-C6HRPs10.js.map +0 -1
- package/dist/shared/render-mcuELiYi.cjs.map +0 -1
- package/dist/shared/url-BaMCQpYH.cjs.map +0 -1
- package/dist/shared/url-IU0xN9wX.js.map +0 -1
- package/dist/shared/websocket-BLR8eVJV.js.map +0 -1
- package/dist/shared/websocket-C_eI4H2o.cjs.map +0 -1
- package/dist/shared/websocket-DF7XIMiX.d.cts +0 -562
- package/dist/shared/websocket-DYKBr8HF.d.ts +0 -562
package/dist/node/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_errors = require("../shared/errors-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const require_multi_storage = require("../shared/multi-storage
|
|
2
|
+
const require_errors = require("../shared/errors-BmP3TKoW.cjs");
|
|
3
|
+
const require_options = require("../shared/options-BUfoHE9G.cjs");
|
|
4
|
+
const require_storage = require("../shared/storage-BLmXmzKF.cjs");
|
|
5
|
+
const require_multi_storage = require("../shared/multi-storage-CCUgkqvI.cjs");
|
|
6
6
|
//#region src/node.ts
|
|
7
7
|
/**
|
|
8
8
|
* `itd-api/node` — файловая система для Node, Bun и Deno.
|
package/dist/node/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as TokenStorage, t as ItdSession } from "../shared/storage-C_eICCep.cjs";
|
|
2
1
|
import { a as FileStreamOptions, c as LazyFile, l as StreamFile, o as FileTransferMode } from "../shared/contracts-BoT7msmq.cjs";
|
|
2
|
+
import { r as TokenStorage, t as ItdSession } from "../shared/storage-C_eICCep.cjs";
|
|
3
3
|
import { n as MultiTokenStorage } from "../shared/multi-storage-CjAPB5Kq.cjs";
|
|
4
4
|
//#region src/node.d.ts
|
|
5
5
|
/** Что можно уточнить у файла с диска. */
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as TokenStorage, t as ItdSession } from "../shared/storage-C_eICCep.js";
|
|
2
1
|
import { a as FileStreamOptions, c as LazyFile, l as StreamFile, o as FileTransferMode } from "../shared/contracts-BoT7msmq.js";
|
|
2
|
+
import { r as TokenStorage, t as ItdSession } from "../shared/storage-C_eICCep.js";
|
|
3
3
|
import { n as MultiTokenStorage } from "../shared/multi-storage-DccjD7Ww.js";
|
|
4
4
|
//#region src/node.d.ts
|
|
5
5
|
/** Что можно уточнить у файла с диска. */
|
package/dist/node/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as ItdConfigError, l as ItdFileError, u as ItdFileErrorReason } from "../shared/errors-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { r as createMultiTokenStorage } from "../shared/multi-storage-
|
|
1
|
+
import { a as ItdConfigError, l as ItdFileError, u as ItdFileErrorReason } from "../shared/errors-GI10kZxk.js";
|
|
2
|
+
import { c as FileTransferMode, n as boundedFileStream, t as resolveFileStreamOptions } from "../shared/options-BNP633A5.js";
|
|
3
|
+
import { r as createTokenStorage, s as createRecordKeyValueStore } from "../shared/storage-CCxn0Kkv.js";
|
|
4
|
+
import { r as createMultiTokenStorage } from "../shared/multi-storage-1AEZTczk.js";
|
|
5
5
|
//#region src/node.ts
|
|
6
6
|
/**
|
|
7
7
|
* `itd-api/node` — файловая система для Node, Bun и Deno.
|
package/dist/rest/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_url = require("../shared/url-
|
|
3
|
-
const require_errors = require("../shared/errors-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
2
|
+
const require_url = require("../shared/url-CFN1sT9S.cjs");
|
|
3
|
+
const require_errors = require("../shared/errors-BmP3TKoW.cjs");
|
|
4
|
+
const require_redact = require("../shared/redact-DB9EMGJx.cjs");
|
|
5
|
+
const require_render = require("../shared/render-DNTESBSl.cjs");
|
|
6
|
+
const require_options = require("../shared/options-BUfoHE9G.cjs");
|
|
7
7
|
//#region src/rest/client.ts
|
|
8
8
|
/**
|
|
9
9
|
* Минимальный клиент REST API итд.com.
|
|
@@ -84,22 +84,16 @@ var ItdRestClient = class ItdRestClient {
|
|
|
84
84
|
assertActive: (action) => this.#assertActive(action),
|
|
85
85
|
auth: () => resolveAuthProvider(auth)
|
|
86
86
|
});
|
|
87
|
-
this.#features =
|
|
88
|
-
http: this.#runtime.http,
|
|
89
|
-
services: this.#runtime.services,
|
|
90
|
-
serviceOverrides: this.#runtime.config.services,
|
|
87
|
+
this.#features = require_render.createFeatureHost(this.#runtime, {
|
|
91
88
|
catalog,
|
|
92
|
-
|
|
93
|
-
clock: this.#runtime.config.clock,
|
|
94
|
-
logger: this.#runtime.config.logger,
|
|
95
|
-
assertActive: (action) => this.#assertActive(action),
|
|
96
|
-
registerBucket: (name, definition) => this.#runtime.registerRateLimitBucket(name, definition)
|
|
89
|
+
assertActive: (action) => this.#assertActive(action)
|
|
97
90
|
});
|
|
98
91
|
const status = this.#features.install(require_render.createStatusFeature());
|
|
99
92
|
this.#resources = require_render.createResources({
|
|
100
93
|
http: this.#runtime.http,
|
|
101
|
-
|
|
102
|
-
status
|
|
94
|
+
files: this.#features.files,
|
|
95
|
+
status,
|
|
96
|
+
createNotifications: (http) => new require_render.NotificationsResource(http)
|
|
103
97
|
});
|
|
104
98
|
}
|
|
105
99
|
#assertActive(action) {
|
|
@@ -132,11 +126,11 @@ var ItdRestClient = class ItdRestClient {
|
|
|
132
126
|
rateLimitState() {
|
|
133
127
|
return this.#runtime.rateLimitState();
|
|
134
128
|
}
|
|
135
|
-
/** Устанавливает REST
|
|
129
|
+
/** Устанавливает REST-модуль с общей обработкой запросов клиента. */
|
|
136
130
|
install(feature) {
|
|
137
131
|
return this.#features.install(feature);
|
|
138
132
|
}
|
|
139
|
-
/** Устанавливает REST
|
|
133
|
+
/** Устанавливает REST-модуль и добавляет его API в свойство только для чтения. */
|
|
140
134
|
withFeature(key, feature) {
|
|
141
135
|
this.#assertActive("установить feature");
|
|
142
136
|
if (typeof key !== "string" || key.trim() === "" || key !== key.trim()) throw new require_errors.ItdConfigError("Свойство feature должно иметь непустое имя без краевых пробелов");
|
|
@@ -151,11 +145,11 @@ var ItdRestClient = class ItdRestClient {
|
|
|
151
145
|
});
|
|
152
146
|
return this;
|
|
153
147
|
}
|
|
154
|
-
/** Имена установленных
|
|
148
|
+
/** Имена установленных модулей в порядке установки. */
|
|
155
149
|
featureNames() {
|
|
156
150
|
return this.#features.names();
|
|
157
151
|
}
|
|
158
|
-
/** Установлен ли
|
|
152
|
+
/** Установлен ли модуль с таким именем. */
|
|
159
153
|
hasFeature(name) {
|
|
160
154
|
return this.#features.has(name);
|
|
161
155
|
}
|
|
@@ -283,8 +277,8 @@ var ItdRestClient = class ItdRestClient {
|
|
|
283
277
|
};
|
|
284
278
|
/** Приводит опцию `auth` к провайдеру конвейера. */
|
|
285
279
|
function resolveAuthProvider(auth) {
|
|
286
|
-
if (auth === void 0) return
|
|
287
|
-
return typeof auth === "string" ?
|
|
280
|
+
if (auth === void 0) return require_url.anonymousAuth();
|
|
281
|
+
return typeof auth === "string" ? require_url.bearerToken(auth) : auth;
|
|
288
282
|
}
|
|
289
283
|
/**
|
|
290
284
|
* Создаёт минимальный клиент REST API. Равнозначно конструктору {@link ItdRestClient}.
|
|
@@ -342,7 +336,7 @@ exports.RateLimitPacing = require_url.RateLimitPacing;
|
|
|
342
336
|
exports.ReportReason = require_url.ReportReason;
|
|
343
337
|
exports.ReportTargetType = require_url.ReportTargetType;
|
|
344
338
|
exports.RetrySafety = require_url.RetrySafety;
|
|
345
|
-
exports.RuntimeMode =
|
|
339
|
+
exports.RuntimeMode = require_redact.RuntimeMode;
|
|
346
340
|
exports.STATUS_SERVICE = require_url.STATUS_SERVICE;
|
|
347
341
|
exports.ServiceState = require_url.ServiceState;
|
|
348
342
|
exports.SpanRenderFormat = require_render.SpanRenderFormat;
|
|
@@ -351,9 +345,9 @@ exports.VIDEO_MIME_TYPES = require_render.VIDEO_MIME_TYPES;
|
|
|
351
345
|
exports.ViewReason = require_url.ViewReason;
|
|
352
346
|
exports.ViewSource = require_url.ViewSource;
|
|
353
347
|
exports.WallAccess = require_url.WallAccess;
|
|
354
|
-
exports.anonymousAuth =
|
|
348
|
+
exports.anonymousAuth = require_url.anonymousAuth;
|
|
355
349
|
exports.autoSpans = require_render.autoSpans;
|
|
356
|
-
exports.bearerToken =
|
|
350
|
+
exports.bearerToken = require_url.bearerToken;
|
|
357
351
|
exports.canonicalNotificationType = require_url.canonicalNotificationType;
|
|
358
352
|
exports.comment = require_render.comment;
|
|
359
353
|
exports.createRestClient = createRestClient;
|
|
@@ -392,7 +386,7 @@ exports.resolveNotificationUrl = require_url.resolveNotificationUrl;
|
|
|
392
386
|
exports.statusDays = require_render.statusDays;
|
|
393
387
|
exports.systemClock = require_url.systemClock;
|
|
394
388
|
exports.toDate = require_render.toDate;
|
|
395
|
-
exports.tokenProvider =
|
|
389
|
+
exports.tokenProvider = require_url.tokenProvider;
|
|
396
390
|
exports.utcStampToIso = require_render.utcStampToIso;
|
|
397
391
|
|
|
398
392
|
//# sourceMappingURL=index.cjs.map
|
package/dist/rest/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["#runtime","#features","#resources","ExtensibleOperationCatalog","ITD_CATALOG","createClientRuntime","#assertActive","FeatureRegistry","createStatusFeature","createResources","#disposed","ItdStateError","ItdConfigError","#disposePromise","#dispose","anonymousAuth","bearerToken"],"sources":["../../src/rest/client.ts"],"sourcesContent":["import { installAsyncDisposeFallback } from '../core/async-dispose.js';\nimport { type AuthProvider, anonymousAuth, bearerToken } from '../core/auth-provider.js';\nimport { ItdConfigError, ItdStateError } from '../core/errors.js';\nimport { type ClientRuntime, createClientRuntime } from '../core/execution/client-runtime.js';\nimport { ExtensibleOperationCatalog } from '../core/feature-catalog.js';\nimport { type ClientFeature, FeatureRegistry } from '../core/features.js';\nimport type { RawRequestOptions, RuntimeOptions } from '../core/options.js';\nimport type { ClientPlugin } from '../core/plugins/contracts.js';\nimport type { RateLimitBucketState } from '../core/scheduling/rate-limit.js';\nimport type { ServiceDefinition } from '../core/services.js';\nimport { ITD_CATALOG } from '../domain/catalog.js';\nimport type { CommentsResource } from '../resources/comments.js';\nimport type { FilesResource } from '../resources/files.js';\nimport type { HashtagsResource } from '../resources/hashtags.js';\nimport type { NotificationsResource } from '../resources/notifications.js';\nimport type { PlatformResource } from '../resources/platform.js';\nimport type { PostsResource } from '../resources/posts.js';\nimport type { ReportsResource } from '../resources/reports.js';\nimport type { SearchResource } from '../resources/search.js';\nimport { createStatusFeature } from '../resources/status.js';\nimport type { SubscriptionResource } from '../resources/subscription.js';\nimport type { TelemetryResource } from '../resources/telemetry.js';\nimport type { UsersResource } from '../resources/users.js';\nimport type { VerificationResource } from '../resources/verification.js';\nimport { createResources, type RestResources } from './resources.js';\n\n/** Опции конструктора {@link ItdRestClient}. */\nexport interface RestClientOptions extends RuntimeOptions {\n /**\n * Авторизация. Строка — сокращение для {@link bearerToken}.\n *\n * Без неё доступны только публичные эндпоинты. Токен здесь считается готовым: продлевать\n * его клиент не умеет и на `401` отвечает ошибкой. Сессия, которая входит по паролю\n * и продлевает себя сама, живёт в полном `ItdClient`.\n */\n auth?: string | AuthProvider | undefined;\n}\n\n/**\n * Минимальный клиент REST API итд.com.\n *\n * Тот же конвейер запросов, что и у полного клиента, — с повторами, очередью, плагинами\n * и типизированными ошибками, — но без сессии, потока событий и нескольких аккаунтов.\n * Нужен там, где токен уже есть, а размер поставки важен: серверные интеграции, воркеры,\n * браузерные приложения.\n *\n * @example\n * ```ts\n * import { createRestClient } from 'itd-api/rest';\n *\n * const api = createRestClient({ auth: process.env.ITD_TOKEN });\n * const feed = await api.posts.list({ tab: 'popular' });\n * ```\n */\nexport class ItdRestClient {\n readonly #runtime: ClientRuntime;\n readonly #features: FeatureRegistry;\n readonly #resources: RestResources;\n /** Общий результат терминальной очистки для идемпотентных повторных вызовов. */\n #disposePromise: Promise<void> | undefined;\n #disposed = false;\n\n /** Профили, подписки, блокировки, приватность. */\n get users(): UsersResource {\n return this.#resources.users;\n }\n\n /** Лента, публикация, реакции, репосты, комментарии к постам. */\n get posts(): PostsResource {\n return this.#resources.posts;\n }\n\n /** Ответы на комментарии и действия над ними. */\n get comments(): CommentsResource {\n return this.#resources.comments;\n }\n\n /** Загрузка файлов и медиа. */\n get files(): FilesResource {\n return this.#resources.files;\n }\n\n /** Уведомления: список, счётчик, отметки о прочтении, настройки. */\n get notifications(): NotificationsResource {\n return this.#resources.notifications;\n }\n\n /** Хэштеги и посты по ним. */\n get hashtags(): HashtagsResource {\n return this.#resources.hashtags;\n }\n\n /** Глобальный поиск по пользователям и хэштегам. */\n get search(): SearchResource {\n return this.#resources.search;\n }\n\n /** Жалобы на контент и пользователей. */\n get reports(): ReportsResource {\n return this.#resources.reports;\n }\n\n /** Верификация профиля. */\n get verification(): VerificationResource {\n return this.#resources.verification;\n }\n\n /** Подписка и способы оплаты. */\n get subscription(): SubscriptionResource {\n return this.#resources.subscription;\n }\n\n /** Сведения о платформе: версии приложений, изменения, анонсы, баннер события. */\n get platform(): PlatformResource {\n return this.#resources.platform;\n }\n\n /** Телеметрия просмотров. */\n get telemetry(): TelemetryResource {\n return this.#resources.telemetry;\n }\n\n constructor(options: RestClientOptions = {}) {\n const { auth, ...runtimeOptions } = options;\n const catalog = new ExtensibleOperationCatalog(ITD_CATALOG);\n\n this.#runtime = createClientRuntime(runtimeOptions, {\n catalog,\n assertActive: (action) => this.#assertActive(action),\n auth: () => resolveAuthProvider(auth),\n });\n this.#features = new FeatureRegistry({\n http: this.#runtime.http,\n services: this.#runtime.services,\n serviceOverrides: this.#runtime.config.services,\n catalog,\n baseUrl: this.#runtime.config.baseUrl,\n clock: this.#runtime.config.clock,\n logger: this.#runtime.config.logger,\n assertActive: (action) => this.#assertActive(action),\n registerBucket: (name, definition) => this.#runtime.registerRateLimitBucket(name, definition),\n });\n const status = this.#features.install(createStatusFeature());\n this.#resources = createResources({\n http: this.#runtime.http,\n fetch: this.#runtime.config.fetch,\n status,\n });\n }\n\n #assertActive(action: string): void {\n if (!this.#disposed) return;\n throw new ItdStateError(\n `Клиент уже окончательно освобождён через dispose(); нельзя ${action}. Создайте новый клиент`,\n );\n }\n\n /** Базовый URL, к которому обращается клиент. */\n get baseUrl(): string {\n return this.#runtime.config.baseUrl;\n }\n\n /**\n * Выполняет произвольный запрос к API.\n *\n * Запасной путь для случаев, когда нужного метода ещё нет или ответ сервера разошёлся\n * с документацией. Проходит через ту же авторизацию, очередь и обработку ошибок.\n *\n * @throws {ItdStateError} если клиент уже освобождён через {@link dispose}\n */\n request<T = unknown>(options: RawRequestOptions): Promise<T> {\n return this.#runtime.http.request<T>({\n ...options,\n operationId: options.operationId ?? 'raw',\n });\n }\n\n /**\n * Остаток серверных лимитов по бакетам, через которые уже проходили запросы.\n *\n * Пустой массив при `rateLimit: false`.\n */\n rateLimitState(): RateLimitBucketState[] {\n return this.#runtime.rateLimitState();\n }\n\n /** Устанавливает REST feature поверх общего request pipeline клиента. */\n install<TApi>(feature: ClientFeature<TApi>): TApi {\n return this.#features.install(feature);\n }\n\n /** Устанавливает REST feature и публикует его API как readonly-свойство клиента. */\n withFeature<const K extends string, TApi>(\n key: K,\n feature: ClientFeature<TApi>,\n ): this & { readonly [P in K]: TApi } {\n this.#assertActive('установить feature');\n if (typeof key !== 'string' || key.trim() === '' || key !== key.trim()) {\n throw new ItdConfigError('Свойство feature должно иметь непустое имя без краевых пробелов');\n }\n if (key === 'then' || key in this) {\n throw new ItdConfigError(`Свойство клиента «${key}» уже занято или зарезервировано`);\n }\n if (!Object.isExtensible(this)) {\n throw new ItdConfigError('Нельзя опубликовать feature на нерасширяемом клиенте');\n }\n\n const api = this.install(feature);\n Object.defineProperty(this, key, {\n value: api,\n enumerable: true,\n configurable: false,\n writable: false,\n });\n return this as this & { readonly [P in K]: TApi };\n }\n\n /** Имена установленных feature в порядке установки. */\n featureNames(): string[] {\n return this.#features.names();\n }\n\n /** Установлен ли feature с таким именем. */\n hasFeature(name: string): boolean {\n return this.#features.has(name);\n }\n\n /**\n * Подключает плагин.\n *\n * Сессионная идентичность плагину не передаётся: у клиента с готовым токеном её нет.\n * Плагинам, которые изолируют состояние по аккаунту, нужен полный `ItdClient`.\n *\n * @throws {ItdConfigError} если плагин задан неверно или уже подключён\n * @throws {ItdStateError} если клиент уже освобождён через {@link dispose}\n */\n use(plugin: ClientPlugin): this {\n this.#assertActive('подключить плагин');\n this.#runtime.plugins.add(plugin, {\n baseUrl: this.#runtime.config.baseUrl,\n logger: this.#runtime.config.logger,\n });\n return this;\n }\n\n /**\n * Отключает плагин и освобождает заведённые им ресурсы.\n *\n * @returns `false`, если такого плагина не было\n * @throws {ItdConfigError} если от плагина зависит другой подключённый плагин\n */\n unuse(name: string): Promise<boolean> {\n return this.#runtime.plugins.remove(name);\n }\n\n /** Имена подключённых плагинов в фактическом порядке выполнения обёрток. */\n pluginNames(): string[] {\n return this.#runtime.plugins.names();\n }\n\n /** Подключён ли плагин с таким именем. */\n hasPlugin(name: string): boolean {\n return this.#runtime.plugins.has(name);\n }\n\n /**\n * Регистрирует сервис платформы — домен, отличный от основного.\n *\n * @throws {ItdConfigError} если определение неверно или имя уже занято\n * @throws {ItdStateError} если клиент уже освобождён через {@link dispose}\n */\n defineService(definition: ServiceDefinition): this {\n this.#assertActive('зарегистрировать сервис');\n this.#runtime.services.define(definition);\n return this;\n }\n\n /**\n * Отправляет открытые накопители {@link telemetry} и останавливает очередь запросов.\n *\n * После вызова клиентом можно пользоваться снова. Терминальное освобождение —\n * это {@link dispose}.\n */\n async close(): Promise<void> {\n const errors: unknown[] = [];\n try {\n try {\n await this.#features.close();\n } catch (error) {\n errors.push(error);\n }\n try {\n await this.#resources.closeTelemetry(false);\n } catch (error) {\n errors.push(error);\n }\n } finally {\n this.#runtime.close();\n }\n if (errors.length === 1) throw errors[0];\n if (errors.length > 1) throw new AggregateError(errors, 'Не удалось закрыть клиент');\n }\n\n /**\n * Окончательно освобождает клиент: выполняет {@link close}, отменяет незавершённые\n * запросы и отключает все плагины.\n *\n * Терминальное состояние устанавливается сразу при первом вызове; повторные вызовы\n * возвращают тот же результат очистки.\n *\n * @example\n * ```ts\n * await using api = createRestClient({ auth: token });\n * ```\n */\n dispose(): Promise<void> {\n if (this.#disposePromise) return this.#disposePromise;\n this.#disposed = true;\n this.#disposePromise = this.#dispose();\n return this.#disposePromise;\n }\n\n async #dispose(): Promise<void> {\n const errors: unknown[] = [];\n // Телеметрия уходит через ещё установленный plugin pipeline и мимо проверки состояния.\n this.#resources.prepareTelemetryClose();\n try {\n await this.#features.close();\n } catch (error) {\n errors.push(error);\n }\n try {\n await this.#resources.closeTelemetry(true);\n } catch (error) {\n errors.push(error);\n }\n try {\n await this.#features.dispose();\n } catch (error) {\n errors.push(error);\n }\n try {\n this.#runtime.close();\n await this.#runtime.dispose();\n } catch (error) {\n errors.push(error);\n }\n if (errors.length > 0) throw new AggregateError(errors, 'Не удалось освободить клиент');\n }\n\n /** Позволяет использовать клиент с `await using`. */\n [Symbol.asyncDispose](): Promise<void> {\n return this.dispose();\n }\n\n static {\n installAsyncDisposeFallback(ItdRestClient);\n }\n}\n\n/** Приводит опцию `auth` к провайдеру конвейера. */\nfunction resolveAuthProvider(auth: RestClientOptions['auth']): AuthProvider {\n if (auth === undefined) return anonymousAuth();\n return typeof auth === 'string' ? bearerToken(auth) : auth;\n}\n\n/**\n * Создаёт минимальный клиент REST API. Равнозначно конструктору {@link ItdRestClient}.\n *\n * @example\n * ```ts\n * const api = createRestClient({ auth: token, rateLimit: { concurrency: 4 } });\n * ```\n */\nexport function createRestClient(options: RestClientOptions = {}): ItdRestClient {\n return new ItdRestClient(options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsDA,IAAa,gBAAb,MAAa,cAAc;CACzB;CACA;CACA;;CAEA;CACA,YAAY;;CAGZ,IAAI,QAAuB;EACzB,OAAO,KAAKE,WAAW;CACzB;;CAGA,IAAI,QAAuB;EACzB,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,WAA6B;EAC/B,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,QAAuB;EACzB,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,gBAAuC;EACzC,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,WAA6B;EAC/B,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,SAAyB;EAC3B,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,UAA2B;EAC7B,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,eAAqC;EACvC,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,eAAqC;EACvC,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,WAA6B;EAC/B,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,YAA+B;EACjC,OAAO,KAAKA,WAAW;CACzB;CAEA,YAAY,UAA6B,CAAC,GAAG;EAC3C,MAAM,EAAE,MAA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","#features","#resources","ExtensibleOperationCatalog","ITD_CATALOG","createClientRuntime","#assertActive","createFeatureHost","createStatusFeature","createResources","NotificationsResource","#disposed","ItdStateError","ItdConfigError","#disposePromise","#dispose","anonymousAuth","bearerToken"],"sources":["../../src/rest/client.ts"],"sourcesContent":["import { installAsyncDisposeFallback } from '../core/async-dispose.js';\nimport { type AuthProvider, anonymousAuth, bearerToken } from '../core/auth-provider.js';\nimport { ItdConfigError, ItdStateError } from '../core/errors.js';\nimport { type ClientRuntime, createClientRuntime } from '../core/execution/client-runtime.js';\nimport { ExtensibleOperationCatalog } from '../core/feature-catalog.js';\nimport { type ClientFeatureHost, createFeatureHost } from '../core/feature-host.js';\nimport type { ClientFeature } from '../core/features.js';\nimport type { RawRequestOptions, RuntimeOptions } from '../core/options.js';\nimport type { ClientPlugin } from '../core/plugins/contracts.js';\nimport type { RateLimitBucketState } from '../core/scheduling/rate-limit.js';\nimport type { ServiceDefinition } from '../core/services.js';\nimport { ITD_CATALOG } from '../domain/catalog.js';\nimport type { CommentsResource } from '../resources/comments.js';\nimport type { FilesResource } from '../resources/files.js';\nimport type { HashtagsResource } from '../resources/hashtags.js';\nimport { NotificationsResource } from '../resources/notifications.js';\nimport type { PlatformResource } from '../resources/platform.js';\nimport type { PostsResource } from '../resources/posts.js';\nimport type { ReportsResource } from '../resources/reports.js';\nimport type { SearchResource } from '../resources/search.js';\nimport { createStatusFeature } from '../resources/status.js';\nimport type { SubscriptionResource } from '../resources/subscription.js';\nimport type { TelemetryResource } from '../resources/telemetry.js';\nimport type { UsersResource } from '../resources/users.js';\nimport type { VerificationResource } from '../resources/verification.js';\nimport { createResources, type RestResources } from './resources.js';\n\n/** Опции конструктора {@link ItdRestClient}. */\nexport interface RestClientOptions extends RuntimeOptions {\n /**\n * Авторизация. Строка — сокращение для {@link bearerToken}.\n *\n * Без неё доступны только публичные эндпоинты. Токен здесь считается готовым: продлевать\n * его клиент не умеет и на `401` отвечает ошибкой. Сессия, которая входит по паролю\n * и продлевает себя сама, живёт в полном `ItdClient`.\n */\n auth?: string | AuthProvider | undefined;\n}\n\n/**\n * Минимальный клиент REST API итд.com.\n *\n * Тот же конвейер запросов, что и у полного клиента, — с повторами, очередью, плагинами\n * и типизированными ошибками, — но без сессии, потока событий и нескольких аккаунтов.\n * Нужен там, где токен уже есть, а размер поставки важен: серверные интеграции, воркеры,\n * браузерные приложения.\n *\n * @example\n * ```ts\n * import { createRestClient } from 'itd-api/rest';\n *\n * const api = createRestClient({ auth: process.env.ITD_TOKEN });\n * const feed = await api.posts.list({ tab: 'popular' });\n * ```\n */\nexport class ItdRestClient {\n readonly #runtime: ClientRuntime;\n readonly #features: ClientFeatureHost;\n readonly #resources: RestResources;\n /** Общий результат терминальной очистки для идемпотентных повторных вызовов. */\n #disposePromise: Promise<void> | undefined;\n #disposed = false;\n\n /** Профили, подписки, блокировки, приватность. */\n get users(): UsersResource {\n return this.#resources.users;\n }\n\n /** Лента, публикация, реакции, репосты, комментарии к постам. */\n get posts(): PostsResource {\n return this.#resources.posts;\n }\n\n /** Ответы на комментарии и действия над ними. */\n get comments(): CommentsResource {\n return this.#resources.comments;\n }\n\n /** Загрузка файлов и медиа. */\n get files(): FilesResource {\n return this.#resources.files;\n }\n\n /** Уведомления: список, счётчик, отметки о прочтении, настройки. */\n get notifications(): NotificationsResource {\n return this.#resources.notifications;\n }\n\n /** Хэштеги и посты по ним. */\n get hashtags(): HashtagsResource {\n return this.#resources.hashtags;\n }\n\n /** Глобальный поиск по пользователям и хэштегам. */\n get search(): SearchResource {\n return this.#resources.search;\n }\n\n /** Жалобы на контент и пользователей. */\n get reports(): ReportsResource {\n return this.#resources.reports;\n }\n\n /** Верификация профиля. */\n get verification(): VerificationResource {\n return this.#resources.verification;\n }\n\n /** Подписка и способы оплаты. */\n get subscription(): SubscriptionResource {\n return this.#resources.subscription;\n }\n\n /** Сведения о платформе: версии приложений, изменения, анонсы, баннер события. */\n get platform(): PlatformResource {\n return this.#resources.platform;\n }\n\n /** Телеметрия просмотров. */\n get telemetry(): TelemetryResource {\n return this.#resources.telemetry;\n }\n\n constructor(options: RestClientOptions = {}) {\n const { auth, ...runtimeOptions } = options;\n const catalog = new ExtensibleOperationCatalog(ITD_CATALOG);\n\n this.#runtime = createClientRuntime(runtimeOptions, {\n catalog,\n assertActive: (action) => this.#assertActive(action),\n auth: () => resolveAuthProvider(auth),\n });\n this.#features = createFeatureHost(this.#runtime, {\n catalog,\n assertActive: (action) => this.#assertActive(action),\n });\n const status = this.#features.install(createStatusFeature());\n this.#resources = createResources({\n http: this.#runtime.http,\n files: this.#features.files,\n status,\n createNotifications: (http) => new NotificationsResource(http),\n });\n }\n\n #assertActive(action: string): void {\n if (!this.#disposed) return;\n throw new ItdStateError(\n `Клиент уже окончательно освобождён через dispose(); нельзя ${action}. Создайте новый клиент`,\n );\n }\n\n /** Базовый URL, к которому обращается клиент. */\n get baseUrl(): string {\n return this.#runtime.config.baseUrl;\n }\n\n /**\n * Выполняет произвольный запрос к API.\n *\n * Запасной путь для случаев, когда нужного метода ещё нет или ответ сервера разошёлся\n * с документацией. Проходит через ту же авторизацию, очередь и обработку ошибок.\n *\n * @throws {ItdStateError} если клиент уже освобождён через {@link dispose}\n */\n request<T = unknown>(options: RawRequestOptions): Promise<T> {\n return this.#runtime.http.request<T>({\n ...options,\n operationId: options.operationId ?? 'raw',\n });\n }\n\n /**\n * Остаток серверных лимитов по бакетам, через которые уже проходили запросы.\n *\n * Пустой массив при `rateLimit: false`.\n */\n rateLimitState(): RateLimitBucketState[] {\n return this.#runtime.rateLimitState();\n }\n\n /** Устанавливает REST-модуль с общей обработкой запросов клиента. */\n install<TApi>(feature: ClientFeature<TApi>): TApi {\n return this.#features.install(feature);\n }\n\n /** Устанавливает REST-модуль и добавляет его API в свойство только для чтения. */\n withFeature<const K extends string, TApi>(\n key: K,\n feature: ClientFeature<TApi>,\n ): this & { readonly [P in K]: TApi } {\n this.#assertActive('установить feature');\n if (typeof key !== 'string' || key.trim() === '' || key !== key.trim()) {\n throw new ItdConfigError('Свойство feature должно иметь непустое имя без краевых пробелов');\n }\n if (key === 'then' || key in this) {\n throw new ItdConfigError(`Свойство клиента «${key}» уже занято или зарезервировано`);\n }\n if (!Object.isExtensible(this)) {\n throw new ItdConfigError('Нельзя опубликовать feature на нерасширяемом клиенте');\n }\n\n const api = this.install(feature);\n Object.defineProperty(this, key, {\n value: api,\n enumerable: true,\n configurable: false,\n writable: false,\n });\n return this as this & { readonly [P in K]: TApi };\n }\n\n /** Имена установленных модулей в порядке установки. */\n featureNames(): string[] {\n return this.#features.names();\n }\n\n /** Установлен ли модуль с таким именем. */\n hasFeature(name: string): boolean {\n return this.#features.has(name);\n }\n\n /**\n * Подключает плагин.\n *\n * Сессионная идентичность плагину не передаётся: у клиента с готовым токеном её нет.\n * Плагинам, которые изолируют состояние по аккаунту, нужен полный `ItdClient`.\n *\n * @throws {ItdConfigError} если плагин задан неверно или уже подключён\n * @throws {ItdStateError} если клиент уже освобождён через {@link dispose}\n */\n use(plugin: ClientPlugin): this {\n this.#assertActive('подключить плагин');\n this.#runtime.plugins.add(plugin, {\n baseUrl: this.#runtime.config.baseUrl,\n logger: this.#runtime.config.logger,\n });\n return this;\n }\n\n /**\n * Отключает плагин и освобождает заведённые им ресурсы.\n *\n * @returns `false`, если такого плагина не было\n * @throws {ItdConfigError} если от плагина зависит другой подключённый плагин\n */\n unuse(name: string): Promise<boolean> {\n return this.#runtime.plugins.remove(name);\n }\n\n /** Имена подключённых плагинов в фактическом порядке выполнения обёрток. */\n pluginNames(): string[] {\n return this.#runtime.plugins.names();\n }\n\n /** Подключён ли плагин с таким именем. */\n hasPlugin(name: string): boolean {\n return this.#runtime.plugins.has(name);\n }\n\n /**\n * Регистрирует сервис платформы — домен, отличный от основного.\n *\n * @throws {ItdConfigError} если определение неверно или имя уже занято\n * @throws {ItdStateError} если клиент уже освобождён через {@link dispose}\n */\n defineService(definition: ServiceDefinition): this {\n this.#assertActive('зарегистрировать сервис');\n this.#runtime.services.define(definition);\n return this;\n }\n\n /**\n * Отправляет открытые накопители {@link telemetry} и останавливает очередь запросов.\n *\n * После вызова клиентом можно пользоваться снова. Терминальное освобождение —\n * это {@link dispose}.\n */\n async close(): Promise<void> {\n const errors: unknown[] = [];\n try {\n try {\n await this.#features.close();\n } catch (error) {\n errors.push(error);\n }\n try {\n await this.#resources.closeTelemetry(false);\n } catch (error) {\n errors.push(error);\n }\n } finally {\n this.#runtime.close();\n }\n if (errors.length === 1) throw errors[0];\n if (errors.length > 1) throw new AggregateError(errors, 'Не удалось закрыть клиент');\n }\n\n /**\n * Окончательно освобождает клиент: выполняет {@link close}, отменяет незавершённые\n * запросы и отключает все плагины.\n *\n * Терминальное состояние устанавливается сразу при первом вызове; повторные вызовы\n * возвращают тот же результат очистки.\n *\n * @example\n * ```ts\n * await using api = createRestClient({ auth: token });\n * ```\n */\n dispose(): Promise<void> {\n if (this.#disposePromise) return this.#disposePromise;\n this.#disposed = true;\n this.#disposePromise = this.#dispose();\n return this.#disposePromise;\n }\n\n async #dispose(): Promise<void> {\n const errors: unknown[] = [];\n // Телеметрия уходит через ещё установленные плагины и мимо проверки состояния.\n this.#resources.prepareTelemetryClose();\n try {\n await this.#features.close();\n } catch (error) {\n errors.push(error);\n }\n try {\n await this.#resources.closeTelemetry(true);\n } catch (error) {\n errors.push(error);\n }\n try {\n await this.#features.dispose();\n } catch (error) {\n errors.push(error);\n }\n try {\n this.#runtime.close();\n await this.#runtime.dispose();\n } catch (error) {\n errors.push(error);\n }\n if (errors.length > 0) throw new AggregateError(errors, 'Не удалось освободить клиент');\n }\n\n /** Позволяет использовать клиент с `await using`. */\n [Symbol.asyncDispose](): Promise<void> {\n return this.dispose();\n }\n\n static {\n installAsyncDisposeFallback(ItdRestClient);\n }\n}\n\n/** Приводит опцию `auth` к провайдеру конвейера. */\nfunction resolveAuthProvider(auth: RestClientOptions['auth']): AuthProvider {\n if (auth === undefined) return anonymousAuth();\n return typeof auth === 'string' ? bearerToken(auth) : auth;\n}\n\n/**\n * Создаёт минимальный клиент REST API. Равнозначно конструктору {@link ItdRestClient}.\n *\n * @example\n * ```ts\n * const api = createRestClient({ auth: token, rateLimit: { concurrency: 4 } });\n * ```\n */\nexport function createRestClient(options: RestClientOptions = {}): ItdRestClient {\n return new ItdRestClient(options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuDA,IAAa,gBAAb,MAAa,cAAc;CACzB;CACA;CACA;;CAEA;CACA,YAAY;;CAGZ,IAAI,QAAuB;EACzB,OAAO,KAAKE,WAAW;CACzB;;CAGA,IAAI,QAAuB;EACzB,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,WAA6B;EAC/B,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,QAAuB;EACzB,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,gBAAuC;EACzC,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,WAA6B;EAC/B,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,SAAyB;EAC3B,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,UAA2B;EAC7B,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,eAAqC;EACvC,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,eAAqC;EACvC,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,WAA6B;EAC/B,OAAO,KAAKA,WAAW;CACzB;;CAGA,IAAI,YAA+B;EACjC,OAAO,KAAKA,WAAW;CACzB;CAEA,YAAY,UAA6B,CAAC,GAAG;EAC3C,MAAM,EAAE,MAAM,GAAG,mBAAmB;EACpC,MAAM,UAAU,IAAIC,eAAAA,2BAA2BC,YAAAA,WAAW;EAE1D,KAAKJ,WAAWK,YAAAA,oBAAoB,gBAAgB;GAClD;GACA,eAAe,WAAW,KAAKC,cAAc,MAAM;GACnD,YAAY,oBAAoB,IAAI;EACtC,CAAC;EACD,KAAKL,YAAYM,eAAAA,kBAAkB,KAAKP,UAAU;GAChD;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,OAAO;GACd,OAAO,KAAK,KAAK;EACnB;EACA,IAAI;GACF,MAAM,KAAKC,WAAW,eAAe,IAAI;EAC3C,SAAS,OAAO;GACd,OAAO,KAAK,KAAK;EACnB;EACA,IAAI;GACF,MAAM,KAAKD,UAAU,QAAQ;EAC/B,SAAS,OAAO;GACd,OAAO,KAAK,KAAK;EACnB;EACA,IAAI;GACF,KAAKD,SAAS,MAAM;GACpB,MAAM,KAAKA,SAAS,QAAQ;EAC9B,SAAS,OAAO;GACd,OAAO,KAAK,KAAK;EACnB;EACA,IAAI,OAAO,SAAS,GAAG,MAAM,IAAI,eAAe,QAAQ,8BAA8B;CACxF;;CAGA,CAAC,OAAO,gBAA+B;EACrC,OAAO,KAAK,QAAQ;CACtB;CAEA;EACE,YAAA,4BAA4B,aAAa;CAC3C;AACF;;AAGA,SAAS,oBAAoB,MAA+C;CAC1E,IAAI,SAAS,KAAA,GAAW,OAAOgB,YAAAA,cAAc;CAC7C,OAAO,OAAO,SAAS,WAAWC,YAAAA,YAAY,IAAI,IAAI;AACxD;;;;;;;;;AAUA,SAAgB,iBAAiB,UAA6B,CAAC,GAAkB;CAC/E,OAAO,IAAI,cAAc,OAAO;AAClC"}
|
package/dist/rest/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as poll, $t as
|
|
1
|
+
import { $ as isItdValidationError, $t as RateLimitBucket, A as ItdFieldErrors, At as ResponseContext, B as ItdTimeoutError, Bt as ItdClock, C as ItdApiErrorInit, Ct as RateLimitBucketContext, D as ItdConflictError, Dt as RequestContext, E as ItdConfigError, Et as RawRequestOptions, F as ItdNotFoundError, Ft as QueryParams, G as isItdError, Gt as OPERATIONS, H as isItdApiError, Ht as BuiltInOperationId, I as ItdPhoneVerificationError, It as QueryValue, J as isItdNotFoundError, Jt as operationBucket, K as isItdFileError, Kt as OperationId, L as ItdRateLimitError, Lt as ServiceDefinition, M as ItdFileErrorReason, Mt as RetryDecisionContext, N as ItdForbiddenError, Nt as RetryOptions, O as ItdError, Ot as RequestExtensions, P as ItdNetworkError, Pt as RuntimeOptions, Q as isItdStateError, Qt as DEFAULT_RATE_LIMIT_BUCKET, R as ItdServerError, Rt as RateLimitPacing, S as ItdApiError, St as PaginationOptions, T as ItdAuthError, Tt as RateLimitOptions, U as isItdAuthError, Ut as CustomOperationId, V as ItdValidationError, Vt as systemClock, W as isItdConflictError, Wt as ItdOperationDefinition, X as isItdRateLimitError, Xt as operationRetrySafety, Y as isItdPhoneVerificationError, Yt as operationMethod, Z as isItdServerError, Zt as BUCKET_LIMITS, _ as Profile, _n as ServiceState, _t as RetrySafety, a as NotificationEvent, an as AttachmentType, at as tokenProvider, b as UserSummary, bn as ViewSource, bt as Logger, c as NotificationSettings, cn as FeedTab, ct as Unsubscribe, d as Author, dn as ItdErrorCode, dt as LIBRARY_VERSION, en as IsoDate, et as ClientConnection, f as FollowResult, fn as LikesVisibility, ft as FeatureOperationId, g as PrivacySettings, gn as ReportTargetType, gt as OperationMethod, h as PinsResult, hn as ReportReason, ht as OperationMetadata, i as formatNotificationText, in as AccessType, it as bearerToken, j as ItdFileError, jt as RetryContext, k as ItdErrorKind, kt as RequestOptions, l as Actor, ln as IncidentKind, lt as DEFAULT_BASE_URL, m as Pin, mn as NotificationType, n as canonicalNotificationType, nn as UserId, nt as AuthProvider, o as normalizeNotification, on as CommentSort, p as MyProfile, pn as Loose, pt as OperationAnnotations, q as isItdForbiddenError, qt as isBuiltInOperationId, r as isKnownNotificationType, rn as UserRef, rt as anonymousAuth, s as Notification, st as Listener, t as resolveNotificationUrl, tn as Span, un as InteractionType, ut as STATUS_SERVICE, v as PublicProfile, vn as SpanType, vt as ClientHooks, w as ItdApiErrorKind, wt as RateLimitBucketOverride, x as ItdAbortError, xn as WallAccess, xt as OperationRequestOptions, y as SubscriptionState, yn as ViewReason, yt as ErrorContextHook, z as ItdStateError, zt as RuntimeMode } from "../shared/url-Be9jlWRv.cjs";
|
|
2
|
+
import { $ as poll, $t as PaymentMethod, A as TelemetryResource, An as AttemptNext, At as CommentsResource, B as ReportInput, Bt as Post, C as DwellEntry, Cn as PreparedStreamSource, Ct as Report, D as TelemetryBatchOptions, Dn as AttemptContext, Dt as FilesResource, E as TelemetryBatch, Et as HashtagsResource, F as SubscriptionResource, Fn as PluginTeardown, Ft as Hashtag, G as UserPostsParams, Gt as BuilderInput, H as CommentsParams, Ht as CommentBuilder, I as SearchResource, It as LikeResult, J as PostInput, Jt as CreateCommentInput, K as CreatePostInput, Kt as ItdBuilder, L as SearchResult, Lt as PinPostResult, M as ViewTracker, Mn as OperationExtensions, Mt as Attachment, N as ViewTrackerInput, Nn as OperationTransformer, Nt as Comment, O as TelemetryClock, On as AttemptExtensions, Ot as UploadOptions, P as ViewTrackerOptions, Pn as PluginApi, Pt as CommentReplyTo, Q as PollInput, Qt as UpdatePostInput, R as ReportsResource, Rt as Poll, S as UsersResource, Sn as PreparedFileSource, St as Portal, T as PhotoOpenInput, Tn as ResolveFileOptions, Tt as HashtagPostsParams, U as FeedParams, Ut as CommentInput, V as report, Vt as PostStats, W as PostsResource, Wt as comment, X as post, Xt as CreatePostData, Y as PostUpdateInput, Yt as CreatePollInput, Z as PollBuilder, Zt as CreateReportInput, _ as fromUrl, _n as FeatureOperationDefinition, _t as StatusIncidentLine, a as isMyProfile, at as MarkupContent, b as UpdateProfileInput, bn as FileResolver, bt as ChangelogEntry, c as ALLOWED_MIME_TYPES, cn as PaginationMode, ct as TextMarkup, d as AudioMimeType, dn as mapPage, dt as PlatformClientVersion, en as Session, et as ParseMarkupOptions, f as IMAGE_MIME_TYPES, fn as RateLimitBucketState, ft as PlatformResource, g as fromStream, gn as FeatureInstallation, gt as StatusDay, h as VideoMimeType, hn as FeatureContext, ht as ServiceStatus, i as statusDays, in as UpdateNotificationSettingsInput, it as MarkupBuilder, j as VideoProgressInput, jn as ClientPlugin, jt as RepliesParams, k as TelemetryOptions, kn as AttemptInterceptor, kt as UploadedFile, l as AUDIO_MIME_TYPES, ln as Paginator, lt as autoSpans, m as VIDEO_MIME_TYPES, mn as FeatureBucketDefinition, mt as PlatformStatus, n as SpanRenderFormat, nn as NotificationListParams, nt as parseMarkdown, o as toDate, on as Page, ot as MarkupInput, p as ImageMimeType, pn as ClientFeature, pt as PlatformVersions, q as PostBuilder, qt as isBuilder, r as renderSpans, rn as NotificationsResource, rt as AutoSpansOptions, s as utcStampToIso, sn as PageState, st as MarkupSpan, t as RenderSpansOptions, tn as Subscription, tt as parseHtml, u as AllowedMimeType, un as PaginatorOptions, ut as markup, v as VerificationResource, vn as FeatureRequestOptions, vt as Announcement, w as InteractionEntry, wn as ResolveFileContext, wt as VerificationStatus, x as UserListParams, xn as PreparedBufferSource, xt as Clan, y as UpdatePrivacyInput, yn as ManagedClientResource, yt as AnnouncementButton, z as ReportBuilder, zt as PollOption } from "../shared/render-BszcKF7S.cjs";
|
|
3
3
|
import { a as FileStreamOptions, c as LazyFile, d as UrlFileOptions, i as FileStreamContent, l as StreamFile, n as FileContext, o as FileTransferMode, r as FileInput, s as FromStreamOptions, t as FileContent, u as UrlFile } from "../shared/contracts-BoT7msmq.cjs";
|
|
4
4
|
//#region src/rest/client.d.ts
|
|
5
5
|
/** Опции конструктора {@link ItdRestClient}. */
|
|
@@ -73,13 +73,13 @@ declare class ItdRestClient {
|
|
|
73
73
|
* Пустой массив при `rateLimit: false`.
|
|
74
74
|
*/
|
|
75
75
|
rateLimitState(): RateLimitBucketState[];
|
|
76
|
-
/** Устанавливает REST
|
|
76
|
+
/** Устанавливает REST-модуль с общей обработкой запросов клиента. */
|
|
77
77
|
install<TApi>(feature: ClientFeature<TApi>): TApi;
|
|
78
|
-
/** Устанавливает REST
|
|
78
|
+
/** Устанавливает REST-модуль и добавляет его API в свойство только для чтения. */
|
|
79
79
|
withFeature<const K extends string, TApi>(key: K, feature: ClientFeature<TApi>): this & { readonly [P in K]: TApi; };
|
|
80
|
-
/** Имена установленных
|
|
80
|
+
/** Имена установленных модулей в порядке установки. */
|
|
81
81
|
featureNames(): string[];
|
|
82
|
-
/** Установлен ли
|
|
82
|
+
/** Установлен ли модуль с таким именем. */
|
|
83
83
|
hasFeature(name: string): boolean;
|
|
84
84
|
/**
|
|
85
85
|
* Подключает плагин.
|
|
@@ -142,5 +142,5 @@ declare class ItdRestClient {
|
|
|
142
142
|
*/
|
|
143
143
|
declare function createRestClient(options?: RestClientOptions): ItdRestClient;
|
|
144
144
|
//#endregion
|
|
145
|
-
export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES, AccessType, type Actor, type AllowedMimeType, type Announcement, type AnnouncementButton, type Attachment, AttachmentType, type AttemptContext, type AttemptExtensions, type AttemptInterceptor, type AttemptNext, type AudioMimeType, type AuthProvider, type Author, type AutoSpansOptions, BUCKET_LIMITS, type BuilderInput, type BuiltInOperationId, type ChangelogEntry, type Clan, type ClientFeature, type ClientHooks, type ClientPlugin, type Comment, type CommentBuilder, type CommentInput, type CommentReplyTo, CommentSort, type CommentsParams, type CommentsResource, type CreateCommentInput, type CreatePollInput, type CreatePostData, type CreatePostInput, type CreateReportInput, type CustomOperationId, DEFAULT_BASE_URL, DEFAULT_RATE_LIMIT_BUCKET, type DwellEntry, type ErrorContextHook, type FeatureBucketDefinition, type FeatureContext, type FeatureInstallation, type FeatureOperationDefinition, type FeatureOperationId, type FeatureRequestOptions, type FeedParams, FeedTab, type FileContent, type FileContext, type FileInput, type FileStreamContent, type FileStreamOptions, FileTransferMode, type FilesResource, type FollowResult, type FromStreamOptions, type Hashtag, type HashtagPostsParams, type HashtagsResource, IMAGE_MIME_TYPES, type ImageMimeType, IncidentKind, type InteractionEntry, InteractionType, type IsoDate, ItdAbortError, ItdApiError, type ItdApiErrorInit, ItdApiErrorKind, ItdAuthError, type ItdBuilder, type ItdClock, ItdConfigError, ItdConflictError, ItdError, ItdErrorCode, ItdErrorKind, type ItdFieldErrors, ItdFileError, ItdFileErrorReason, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdPhoneVerificationError, ItdRateLimitError, ItdRestClient, ItdServerError, ItdStateError, ItdTimeoutError, ItdValidationError, LIBRARY_VERSION, type LazyFile, type LikeResult, LikesVisibility, type Listener, type Logger, type Loose, type MarkupBuilder, type MarkupContent, type MarkupInput, type MarkupSpan, type MyProfile, type Notification, type NotificationEvent, type NotificationListParams, type NotificationSettings, NotificationType, type NotificationsResource, OPERATIONS, type ItdOperationDefinition as OperationDefinition, type OperationExtensions, type OperationId, type OperationMethod, type OperationRequestOptions, type OperationTransformer, type Page, type PageState, PaginationMode, type PaginationOptions, Paginator, type PaginatorOptions, type ParseMarkupOptions, type PaymentMethod, type PhotoOpenInput, type Pin, type PinPostResult, type PinsResult, type PlatformClientVersion, type PlatformResource, type PlatformStatus, type PlatformVersions, type PluginApi, type PluginTeardown, type Poll, type PollBuilder, type PollInput, type PollOption, type Portal, type Post, type PostBuilder, type PostInput, type PostStats, type PostUpdateInput, type PostsResource, type PrivacySettings, type Profile, type PublicProfile, type QueryParams, type QueryValue, type RateLimitBucket, type RateLimitBucketContext, type RateLimitBucketOverride, type RateLimitBucketState, type RateLimitOptions, RateLimitPacing, type RawRequestOptions, type RenderSpansOptions, type RepliesParams, type Report, type ReportBuilder, type ReportInput, ReportReason, ReportTargetType, type ReportsResource, type RequestContext, type RequestExtensions, type RequestOptions, type ResponseContext, type RestClientOptions, type RetryContext, type RetryDecisionContext, type RetryOptions, RetrySafety, RuntimeMode, type RuntimeOptions, STATUS_SERVICE, type SearchResource, type SearchResult, type ServiceDefinition, ServiceState, type ServiceStatus, type Session, type Span, SpanRenderFormat, SpanType, type StatusDay, type StatusIncidentLine, type StreamFile, type Subscription, type SubscriptionResource, type SubscriptionState, type TelemetryBatch, type TelemetryBatchOptions, type TelemetryClock, type TelemetryOptions, type TelemetryResource, type TextMarkup, type Unsubscribe, type UpdateNotificationSettingsInput, type UpdatePostInput, type UpdatePrivacyInput, type UpdateProfileInput, type UploadOptions, type UploadedFile, type UrlFile, type UrlFileOptions, type UserId, type UserListParams, type UserPostsParams, type UserRef, type UserSummary, type UsersResource, VIDEO_MIME_TYPES, type VerificationResource, type VerificationStatus, type VideoMimeType, type VideoProgressInput, ViewReason, ViewSource, type ViewTracker, type ViewTrackerInput, type ViewTrackerOptions, WallAccess, anonymousAuth, autoSpans, bearerToken, canonicalNotificationType, comment, createRestClient, formatNotificationText, fromStream, fromUrl, isBuilder, isBuiltInOperationId, isItdApiError, isItdAuthError, isItdConflictError, isItdError, isItdFileError, isItdForbiddenError, isItdNotFoundError, isItdPhoneVerificationError, isItdRateLimitError, isItdServerError, isItdStateError, isItdValidationError, isKnownNotificationType, isMyProfile, mapPage, markup, normalizeNotification, operationBucket, operationMethod, operationRetrySafety, parseHtml, parseMarkdown, poll, post, renderSpans, report, resolveNotificationUrl, statusDays, systemClock, toDate, tokenProvider, utcStampToIso };
|
|
145
|
+
export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES, AccessType, type Actor, type AllowedMimeType, type Announcement, type AnnouncementButton, type Attachment, AttachmentType, type AttemptContext, type AttemptExtensions, type AttemptInterceptor, type AttemptNext, type AudioMimeType, type AuthProvider, type Author, type AutoSpansOptions, BUCKET_LIMITS, type BuilderInput, type BuiltInOperationId, type ChangelogEntry, type Clan, type ClientConnection, type ClientFeature, type ClientHooks, type ClientPlugin, type Comment, type CommentBuilder, type CommentInput, type CommentReplyTo, CommentSort, type CommentsParams, type CommentsResource, type CreateCommentInput, type CreatePollInput, type CreatePostData, type CreatePostInput, type CreateReportInput, type CustomOperationId, DEFAULT_BASE_URL, DEFAULT_RATE_LIMIT_BUCKET, type DwellEntry, type ErrorContextHook, type FeatureBucketDefinition, type FeatureContext, type FeatureInstallation, type FeatureOperationDefinition, type FeatureOperationId, type FeatureRequestOptions, type FeedParams, FeedTab, type FileContent, type FileContext, type FileInput, type FileResolver, type FileStreamContent, type FileStreamOptions, FileTransferMode, type FilesResource, type FollowResult, type FromStreamOptions, type Hashtag, type HashtagPostsParams, type HashtagsResource, IMAGE_MIME_TYPES, type ImageMimeType, IncidentKind, type InteractionEntry, InteractionType, type IsoDate, ItdAbortError, ItdApiError, type ItdApiErrorInit, ItdApiErrorKind, ItdAuthError, type ItdBuilder, type ItdClock, ItdConfigError, ItdConflictError, ItdError, ItdErrorCode, ItdErrorKind, type ItdFieldErrors, ItdFileError, ItdFileErrorReason, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdPhoneVerificationError, ItdRateLimitError, ItdRestClient, ItdServerError, ItdStateError, ItdTimeoutError, ItdValidationError, LIBRARY_VERSION, type LazyFile, type LikeResult, LikesVisibility, type Listener, type Logger, type Loose, type ManagedClientResource, type MarkupBuilder, type MarkupContent, type MarkupInput, type MarkupSpan, type MyProfile, type Notification, type NotificationEvent, type NotificationListParams, type NotificationSettings, NotificationType, type NotificationsResource, OPERATIONS, type OperationAnnotations, type ItdOperationDefinition as OperationDefinition, type OperationExtensions, type OperationId, type OperationMetadata, type OperationMethod, type OperationRequestOptions, type OperationTransformer, type Page, type PageState, PaginationMode, type PaginationOptions, Paginator, type PaginatorOptions, type ParseMarkupOptions, type PaymentMethod, type PhotoOpenInput, type Pin, type PinPostResult, type PinsResult, type PlatformClientVersion, type PlatformResource, type PlatformStatus, type PlatformVersions, type PluginApi, type PluginTeardown, type Poll, type PollBuilder, type PollInput, type PollOption, type Portal, type Post, type PostBuilder, type PostInput, type PostStats, type PostUpdateInput, type PostsResource, type PreparedBufferSource, type PreparedFileSource, type PreparedStreamSource, type PrivacySettings, type Profile, type PublicProfile, type QueryParams, type QueryValue, type RateLimitBucket, type RateLimitBucketContext, type RateLimitBucketOverride, type RateLimitBucketState, type RateLimitOptions, RateLimitPacing, type RawRequestOptions, type RenderSpansOptions, type RepliesParams, type Report, type ReportBuilder, type ReportInput, ReportReason, ReportTargetType, type ReportsResource, type RequestContext, type RequestExtensions, type RequestOptions, type ResolveFileContext, type ResolveFileOptions, type ResponseContext, type RestClientOptions, type RetryContext, type RetryDecisionContext, type RetryOptions, RetrySafety, RuntimeMode, type RuntimeOptions, STATUS_SERVICE, type SearchResource, type SearchResult, type ServiceDefinition, ServiceState, type ServiceStatus, type Session, type Span, SpanRenderFormat, SpanType, type StatusDay, type StatusIncidentLine, type StreamFile, type Subscription, type SubscriptionResource, type SubscriptionState, type TelemetryBatch, type TelemetryBatchOptions, type TelemetryClock, type TelemetryOptions, type TelemetryResource, type TextMarkup, type Unsubscribe, type UpdateNotificationSettingsInput, type UpdatePostInput, type UpdatePrivacyInput, type UpdateProfileInput, type UploadOptions, type UploadedFile, type UrlFile, type UrlFileOptions, type UserId, type UserListParams, type UserPostsParams, type UserRef, type UserSummary, type UsersResource, VIDEO_MIME_TYPES, type VerificationResource, type VerificationStatus, type VideoMimeType, type VideoProgressInput, ViewReason, ViewSource, type ViewTracker, type ViewTrackerInput, type ViewTrackerOptions, WallAccess, anonymousAuth, autoSpans, bearerToken, canonicalNotificationType, comment, createRestClient, formatNotificationText, fromStream, fromUrl, isBuilder, isBuiltInOperationId, isItdApiError, isItdAuthError, isItdConflictError, isItdError, isItdFileError, isItdForbiddenError, isItdNotFoundError, isItdPhoneVerificationError, isItdRateLimitError, isItdServerError, isItdStateError, isItdValidationError, isKnownNotificationType, isMyProfile, mapPage, markup, normalizeNotification, operationBucket, operationMethod, operationRetrySafety, parseHtml, parseMarkdown, poll, post, renderSpans, report, resolveNotificationUrl, statusDays, systemClock, toDate, tokenProvider, utcStampToIso };
|
|
146
146
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/rest/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as poll, $t as
|
|
1
|
+
import { $ as isItdValidationError, $t as RateLimitBucket, A as ItdFieldErrors, At as ResponseContext, B as ItdTimeoutError, Bt as ItdClock, C as ItdApiErrorInit, Ct as RateLimitBucketContext, D as ItdConflictError, Dt as RequestContext, E as ItdConfigError, Et as RawRequestOptions, F as ItdNotFoundError, Ft as QueryParams, G as isItdError, Gt as OPERATIONS, H as isItdApiError, Ht as BuiltInOperationId, I as ItdPhoneVerificationError, It as QueryValue, J as isItdNotFoundError, Jt as operationBucket, K as isItdFileError, Kt as OperationId, L as ItdRateLimitError, Lt as ServiceDefinition, M as ItdFileErrorReason, Mt as RetryDecisionContext, N as ItdForbiddenError, Nt as RetryOptions, O as ItdError, Ot as RequestExtensions, P as ItdNetworkError, Pt as RuntimeOptions, Q as isItdStateError, Qt as DEFAULT_RATE_LIMIT_BUCKET, R as ItdServerError, Rt as RateLimitPacing, S as ItdApiError, St as PaginationOptions, T as ItdAuthError, Tt as RateLimitOptions, U as isItdAuthError, Ut as CustomOperationId, V as ItdValidationError, Vt as systemClock, W as isItdConflictError, Wt as ItdOperationDefinition, X as isItdRateLimitError, Xt as operationRetrySafety, Y as isItdPhoneVerificationError, Yt as operationMethod, Z as isItdServerError, Zt as BUCKET_LIMITS, _ as Profile, _n as ServiceState, _t as RetrySafety, a as NotificationEvent, an as AttachmentType, at as tokenProvider, b as UserSummary, bn as ViewSource, bt as Logger, c as NotificationSettings, cn as FeedTab, ct as Unsubscribe, d as Author, dn as ItdErrorCode, dt as LIBRARY_VERSION, en as IsoDate, et as ClientConnection, f as FollowResult, fn as LikesVisibility, ft as FeatureOperationId, g as PrivacySettings, gn as ReportTargetType, gt as OperationMethod, h as PinsResult, hn as ReportReason, ht as OperationMetadata, i as formatNotificationText, in as AccessType, it as bearerToken, j as ItdFileError, jt as RetryContext, k as ItdErrorKind, kt as RequestOptions, l as Actor, ln as IncidentKind, lt as DEFAULT_BASE_URL, m as Pin, mn as NotificationType, n as canonicalNotificationType, nn as UserId, nt as AuthProvider, o as normalizeNotification, on as CommentSort, p as MyProfile, pn as Loose, pt as OperationAnnotations, q as isItdForbiddenError, qt as isBuiltInOperationId, r as isKnownNotificationType, rn as UserRef, rt as anonymousAuth, s as Notification, st as Listener, t as resolveNotificationUrl, tn as Span, un as InteractionType, ut as STATUS_SERVICE, v as PublicProfile, vn as SpanType, vt as ClientHooks, w as ItdApiErrorKind, wt as RateLimitBucketOverride, x as ItdAbortError, xn as WallAccess, xt as OperationRequestOptions, y as SubscriptionState, yn as ViewReason, yt as ErrorContextHook, z as ItdStateError, zt as RuntimeMode } from "../shared/url-Be9jlWRv.js";
|
|
2
|
+
import { $ as poll, $t as PaymentMethod, A as TelemetryResource, An as AttemptNext, At as CommentsResource, B as ReportInput, Bt as Post, C as DwellEntry, Cn as PreparedStreamSource, Ct as Report, D as TelemetryBatchOptions, Dn as AttemptContext, Dt as FilesResource, E as TelemetryBatch, Et as HashtagsResource, F as SubscriptionResource, Fn as PluginTeardown, Ft as Hashtag, G as UserPostsParams, Gt as BuilderInput, H as CommentsParams, Ht as CommentBuilder, I as SearchResource, It as LikeResult, J as PostInput, Jt as CreateCommentInput, K as CreatePostInput, Kt as ItdBuilder, L as SearchResult, Lt as PinPostResult, M as ViewTracker, Mn as OperationExtensions, Mt as Attachment, N as ViewTrackerInput, Nn as OperationTransformer, Nt as Comment, O as TelemetryClock, On as AttemptExtensions, Ot as UploadOptions, P as ViewTrackerOptions, Pn as PluginApi, Pt as CommentReplyTo, Q as PollInput, Qt as UpdatePostInput, R as ReportsResource, Rt as Poll, S as UsersResource, Sn as PreparedFileSource, St as Portal, T as PhotoOpenInput, Tn as ResolveFileOptions, Tt as HashtagPostsParams, U as FeedParams, Ut as CommentInput, V as report, Vt as PostStats, W as PostsResource, Wt as comment, X as post, Xt as CreatePostData, Y as PostUpdateInput, Yt as CreatePollInput, Z as PollBuilder, Zt as CreateReportInput, _ as fromUrl, _n as FeatureOperationDefinition, _t as StatusIncidentLine, a as isMyProfile, at as MarkupContent, b as UpdateProfileInput, bn as FileResolver, bt as ChangelogEntry, c as ALLOWED_MIME_TYPES, cn as PaginationMode, ct as TextMarkup, d as AudioMimeType, dn as mapPage, dt as PlatformClientVersion, en as Session, et as ParseMarkupOptions, f as IMAGE_MIME_TYPES, fn as RateLimitBucketState, ft as PlatformResource, g as fromStream, gn as FeatureInstallation, gt as StatusDay, h as VideoMimeType, hn as FeatureContext, ht as ServiceStatus, i as statusDays, in as UpdateNotificationSettingsInput, it as MarkupBuilder, j as VideoProgressInput, jn as ClientPlugin, jt as RepliesParams, k as TelemetryOptions, kn as AttemptInterceptor, kt as UploadedFile, l as AUDIO_MIME_TYPES, ln as Paginator, lt as autoSpans, m as VIDEO_MIME_TYPES, mn as FeatureBucketDefinition, mt as PlatformStatus, n as SpanRenderFormat, nn as NotificationListParams, nt as parseMarkdown, o as toDate, on as Page, ot as MarkupInput, p as ImageMimeType, pn as ClientFeature, pt as PlatformVersions, q as PostBuilder, qt as isBuilder, r as renderSpans, rn as NotificationsResource, rt as AutoSpansOptions, s as utcStampToIso, sn as PageState, st as MarkupSpan, t as RenderSpansOptions, tn as Subscription, tt as parseHtml, u as AllowedMimeType, un as PaginatorOptions, ut as markup, v as VerificationResource, vn as FeatureRequestOptions, vt as Announcement, w as InteractionEntry, wn as ResolveFileContext, wt as VerificationStatus, x as UserListParams, xn as PreparedBufferSource, xt as Clan, y as UpdatePrivacyInput, yn as ManagedClientResource, yt as AnnouncementButton, z as ReportBuilder, zt as PollOption } from "../shared/render-DVB7T8pm.js";
|
|
3
3
|
import { a as FileStreamOptions, c as LazyFile, d as UrlFileOptions, i as FileStreamContent, l as StreamFile, n as FileContext, o as FileTransferMode, r as FileInput, s as FromStreamOptions, t as FileContent, u as UrlFile } from "../shared/contracts-BoT7msmq.js";
|
|
4
4
|
//#region src/rest/client.d.ts
|
|
5
5
|
/** Опции конструктора {@link ItdRestClient}. */
|
|
@@ -73,13 +73,13 @@ declare class ItdRestClient {
|
|
|
73
73
|
* Пустой массив при `rateLimit: false`.
|
|
74
74
|
*/
|
|
75
75
|
rateLimitState(): RateLimitBucketState[];
|
|
76
|
-
/** Устанавливает REST
|
|
76
|
+
/** Устанавливает REST-модуль с общей обработкой запросов клиента. */
|
|
77
77
|
install<TApi>(feature: ClientFeature<TApi>): TApi;
|
|
78
|
-
/** Устанавливает REST
|
|
78
|
+
/** Устанавливает REST-модуль и добавляет его API в свойство только для чтения. */
|
|
79
79
|
withFeature<const K extends string, TApi>(key: K, feature: ClientFeature<TApi>): this & { readonly [P in K]: TApi; };
|
|
80
|
-
/** Имена установленных
|
|
80
|
+
/** Имена установленных модулей в порядке установки. */
|
|
81
81
|
featureNames(): string[];
|
|
82
|
-
/** Установлен ли
|
|
82
|
+
/** Установлен ли модуль с таким именем. */
|
|
83
83
|
hasFeature(name: string): boolean;
|
|
84
84
|
/**
|
|
85
85
|
* Подключает плагин.
|
|
@@ -142,5 +142,5 @@ declare class ItdRestClient {
|
|
|
142
142
|
*/
|
|
143
143
|
declare function createRestClient(options?: RestClientOptions): ItdRestClient;
|
|
144
144
|
//#endregion
|
|
145
|
-
export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES, AccessType, type Actor, type AllowedMimeType, type Announcement, type AnnouncementButton, type Attachment, AttachmentType, type AttemptContext, type AttemptExtensions, type AttemptInterceptor, type AttemptNext, type AudioMimeType, type AuthProvider, type Author, type AutoSpansOptions, BUCKET_LIMITS, type BuilderInput, type BuiltInOperationId, type ChangelogEntry, type Clan, type ClientFeature, type ClientHooks, type ClientPlugin, type Comment, type CommentBuilder, type CommentInput, type CommentReplyTo, CommentSort, type CommentsParams, type CommentsResource, type CreateCommentInput, type CreatePollInput, type CreatePostData, type CreatePostInput, type CreateReportInput, type CustomOperationId, DEFAULT_BASE_URL, DEFAULT_RATE_LIMIT_BUCKET, type DwellEntry, type ErrorContextHook, type FeatureBucketDefinition, type FeatureContext, type FeatureInstallation, type FeatureOperationDefinition, type FeatureOperationId, type FeatureRequestOptions, type FeedParams, FeedTab, type FileContent, type FileContext, type FileInput, type FileStreamContent, type FileStreamOptions, FileTransferMode, type FilesResource, type FollowResult, type FromStreamOptions, type Hashtag, type HashtagPostsParams, type HashtagsResource, IMAGE_MIME_TYPES, type ImageMimeType, IncidentKind, type InteractionEntry, InteractionType, type IsoDate, ItdAbortError, ItdApiError, type ItdApiErrorInit, ItdApiErrorKind, ItdAuthError, type ItdBuilder, type ItdClock, ItdConfigError, ItdConflictError, ItdError, ItdErrorCode, ItdErrorKind, type ItdFieldErrors, ItdFileError, ItdFileErrorReason, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdPhoneVerificationError, ItdRateLimitError, ItdRestClient, ItdServerError, ItdStateError, ItdTimeoutError, ItdValidationError, LIBRARY_VERSION, type LazyFile, type LikeResult, LikesVisibility, type Listener, type Logger, type Loose, type MarkupBuilder, type MarkupContent, type MarkupInput, type MarkupSpan, type MyProfile, type Notification, type NotificationEvent, type NotificationListParams, type NotificationSettings, NotificationType, type NotificationsResource, OPERATIONS, type ItdOperationDefinition as OperationDefinition, type OperationExtensions, type OperationId, type OperationMethod, type OperationRequestOptions, type OperationTransformer, type Page, type PageState, PaginationMode, type PaginationOptions, Paginator, type PaginatorOptions, type ParseMarkupOptions, type PaymentMethod, type PhotoOpenInput, type Pin, type PinPostResult, type PinsResult, type PlatformClientVersion, type PlatformResource, type PlatformStatus, type PlatformVersions, type PluginApi, type PluginTeardown, type Poll, type PollBuilder, type PollInput, type PollOption, type Portal, type Post, type PostBuilder, type PostInput, type PostStats, type PostUpdateInput, type PostsResource, type PrivacySettings, type Profile, type PublicProfile, type QueryParams, type QueryValue, type RateLimitBucket, type RateLimitBucketContext, type RateLimitBucketOverride, type RateLimitBucketState, type RateLimitOptions, RateLimitPacing, type RawRequestOptions, type RenderSpansOptions, type RepliesParams, type Report, type ReportBuilder, type ReportInput, ReportReason, ReportTargetType, type ReportsResource, type RequestContext, type RequestExtensions, type RequestOptions, type ResponseContext, type RestClientOptions, type RetryContext, type RetryDecisionContext, type RetryOptions, RetrySafety, RuntimeMode, type RuntimeOptions, STATUS_SERVICE, type SearchResource, type SearchResult, type ServiceDefinition, ServiceState, type ServiceStatus, type Session, type Span, SpanRenderFormat, SpanType, type StatusDay, type StatusIncidentLine, type StreamFile, type Subscription, type SubscriptionResource, type SubscriptionState, type TelemetryBatch, type TelemetryBatchOptions, type TelemetryClock, type TelemetryOptions, type TelemetryResource, type TextMarkup, type Unsubscribe, type UpdateNotificationSettingsInput, type UpdatePostInput, type UpdatePrivacyInput, type UpdateProfileInput, type UploadOptions, type UploadedFile, type UrlFile, type UrlFileOptions, type UserId, type UserListParams, type UserPostsParams, type UserRef, type UserSummary, type UsersResource, VIDEO_MIME_TYPES, type VerificationResource, type VerificationStatus, type VideoMimeType, type VideoProgressInput, ViewReason, ViewSource, type ViewTracker, type ViewTrackerInput, type ViewTrackerOptions, WallAccess, anonymousAuth, autoSpans, bearerToken, canonicalNotificationType, comment, createRestClient, formatNotificationText, fromStream, fromUrl, isBuilder, isBuiltInOperationId, isItdApiError, isItdAuthError, isItdConflictError, isItdError, isItdFileError, isItdForbiddenError, isItdNotFoundError, isItdPhoneVerificationError, isItdRateLimitError, isItdServerError, isItdStateError, isItdValidationError, isKnownNotificationType, isMyProfile, mapPage, markup, normalizeNotification, operationBucket, operationMethod, operationRetrySafety, parseHtml, parseMarkdown, poll, post, renderSpans, report, resolveNotificationUrl, statusDays, systemClock, toDate, tokenProvider, utcStampToIso };
|
|
145
|
+
export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES, AccessType, type Actor, type AllowedMimeType, type Announcement, type AnnouncementButton, type Attachment, AttachmentType, type AttemptContext, type AttemptExtensions, type AttemptInterceptor, type AttemptNext, type AudioMimeType, type AuthProvider, type Author, type AutoSpansOptions, BUCKET_LIMITS, type BuilderInput, type BuiltInOperationId, type ChangelogEntry, type Clan, type ClientConnection, type ClientFeature, type ClientHooks, type ClientPlugin, type Comment, type CommentBuilder, type CommentInput, type CommentReplyTo, CommentSort, type CommentsParams, type CommentsResource, type CreateCommentInput, type CreatePollInput, type CreatePostData, type CreatePostInput, type CreateReportInput, type CustomOperationId, DEFAULT_BASE_URL, DEFAULT_RATE_LIMIT_BUCKET, type DwellEntry, type ErrorContextHook, type FeatureBucketDefinition, type FeatureContext, type FeatureInstallation, type FeatureOperationDefinition, type FeatureOperationId, type FeatureRequestOptions, type FeedParams, FeedTab, type FileContent, type FileContext, type FileInput, type FileResolver, type FileStreamContent, type FileStreamOptions, FileTransferMode, type FilesResource, type FollowResult, type FromStreamOptions, type Hashtag, type HashtagPostsParams, type HashtagsResource, IMAGE_MIME_TYPES, type ImageMimeType, IncidentKind, type InteractionEntry, InteractionType, type IsoDate, ItdAbortError, ItdApiError, type ItdApiErrorInit, ItdApiErrorKind, ItdAuthError, type ItdBuilder, type ItdClock, ItdConfigError, ItdConflictError, ItdError, ItdErrorCode, ItdErrorKind, type ItdFieldErrors, ItdFileError, ItdFileErrorReason, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdPhoneVerificationError, ItdRateLimitError, ItdRestClient, ItdServerError, ItdStateError, ItdTimeoutError, ItdValidationError, LIBRARY_VERSION, type LazyFile, type LikeResult, LikesVisibility, type Listener, type Logger, type Loose, type ManagedClientResource, type MarkupBuilder, type MarkupContent, type MarkupInput, type MarkupSpan, type MyProfile, type Notification, type NotificationEvent, type NotificationListParams, type NotificationSettings, NotificationType, type NotificationsResource, OPERATIONS, type OperationAnnotations, type ItdOperationDefinition as OperationDefinition, type OperationExtensions, type OperationId, type OperationMetadata, type OperationMethod, type OperationRequestOptions, type OperationTransformer, type Page, type PageState, PaginationMode, type PaginationOptions, Paginator, type PaginatorOptions, type ParseMarkupOptions, type PaymentMethod, type PhotoOpenInput, type Pin, type PinPostResult, type PinsResult, type PlatformClientVersion, type PlatformResource, type PlatformStatus, type PlatformVersions, type PluginApi, type PluginTeardown, type Poll, type PollBuilder, type PollInput, type PollOption, type Portal, type Post, type PostBuilder, type PostInput, type PostStats, type PostUpdateInput, type PostsResource, type PreparedBufferSource, type PreparedFileSource, type PreparedStreamSource, type PrivacySettings, type Profile, type PublicProfile, type QueryParams, type QueryValue, type RateLimitBucket, type RateLimitBucketContext, type RateLimitBucketOverride, type RateLimitBucketState, type RateLimitOptions, RateLimitPacing, type RawRequestOptions, type RenderSpansOptions, type RepliesParams, type Report, type ReportBuilder, type ReportInput, ReportReason, ReportTargetType, type ReportsResource, type RequestContext, type RequestExtensions, type RequestOptions, type ResolveFileContext, type ResolveFileOptions, type ResponseContext, type RestClientOptions, type RetryContext, type RetryDecisionContext, type RetryOptions, RetrySafety, RuntimeMode, type RuntimeOptions, STATUS_SERVICE, type SearchResource, type SearchResult, type ServiceDefinition, ServiceState, type ServiceStatus, type Session, type Span, SpanRenderFormat, SpanType, type StatusDay, type StatusIncidentLine, type StreamFile, type Subscription, type SubscriptionResource, type SubscriptionState, type TelemetryBatch, type TelemetryBatchOptions, type TelemetryClock, type TelemetryOptions, type TelemetryResource, type TextMarkup, type Unsubscribe, type UpdateNotificationSettingsInput, type UpdatePostInput, type UpdatePrivacyInput, type UpdateProfileInput, type UploadOptions, type UploadedFile, type UrlFile, type UrlFileOptions, type UserId, type UserListParams, type UserPostsParams, type UserRef, type UserSummary, type UsersResource, VIDEO_MIME_TYPES, type VerificationResource, type VerificationStatus, type VideoMimeType, type VideoProgressInput, ViewReason, ViewSource, type ViewTracker, type ViewTrackerInput, type ViewTrackerOptions, WallAccess, anonymousAuth, autoSpans, bearerToken, canonicalNotificationType, comment, createRestClient, formatNotificationText, fromStream, fromUrl, isBuilder, isBuiltInOperationId, isItdApiError, isItdAuthError, isItdConflictError, isItdError, isItdFileError, isItdForbiddenError, isItdNotFoundError, isItdPhoneVerificationError, isItdRateLimitError, isItdServerError, isItdStateError, isItdValidationError, isKnownNotificationType, isMyProfile, mapPage, markup, normalizeNotification, operationBucket, operationMethod, operationRetrySafety, parseHtml, parseMarkdown, poll, post, renderSpans, report, resolveNotificationUrl, statusDays, systemClock, toDate, tokenProvider, utcStampToIso };
|
|
146
146
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/rest/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { A as isItdStateError, C as isItdError, D as isItdPhoneVerificationError, E as isItdNotFoundError, O as isItdRateLimitError, S as isItdConflictError, T as isItdForbiddenError, _ as ItdStateError, a as ItdConfigError, b as isItdApiError, c as ItdErrorKind, d as ItdForbiddenError, f as ItdNetworkError, g as ItdServerError, h as ItdRateLimitError, i as ItdAuthError, j as isItdValidationError, k as isItdServerError, l as ItdFileError, m as ItdPhoneVerificationError, n as ItdApiError, o as ItdConflictError, p as ItdNotFoundError, r as ItdApiErrorKind, s as ItdError, t as ItdAbortError, u as ItdFileErrorReason, v as ItdTimeoutError, w as isItdFileError, x as isItdAuthError, y as ItdValidationError } from "../shared/errors-
|
|
3
|
-
import {
|
|
4
|
-
import { c as
|
|
5
|
-
import {
|
|
1
|
+
import { $ as DEFAULT_BASE_URL, A as ITD_CATALOG, C as ReportReason, D as ViewReason, E as SpanType, F as operationMethod, I as operationRetrySafety, K as RetrySafety, L as BUCKET_LIMITS, N as isBuiltInOperationId, O as ViewSource, P as operationBucket, R as DEFAULT_RATE_LIMIT_BUCKET, S as NotificationType, T as ServiceState, _ as FeedTab, a as tokenProvider, b as ItdErrorCode, c as normalizeNotification, ct as systemClock, d as canonicalNotificationType, f as isKnownNotificationType, h as CommentSort, i as bearerToken, j as OPERATIONS, k as WallAccess, lt as installAsyncDisposeFallback, m as AttachmentType, n as formatNotificationText, ot as RateLimitPacing, p as AccessType, r as anonymousAuth, rt as LIBRARY_VERSION, t as resolveNotificationUrl, tt as STATUS_SERVICE, v as IncidentKind, w as ReportTargetType, x as LikesVisibility, y as InteractionType, z as createClientRuntime } from "../shared/url-B3ocFlHj.js";
|
|
2
|
+
import { A as isItdStateError, C as isItdError, D as isItdPhoneVerificationError, E as isItdNotFoundError, O as isItdRateLimitError, S as isItdConflictError, T as isItdForbiddenError, _ as ItdStateError, a as ItdConfigError, b as isItdApiError, c as ItdErrorKind, d as ItdForbiddenError, f as ItdNetworkError, g as ItdServerError, h as ItdRateLimitError, i as ItdAuthError, j as isItdValidationError, k as isItdServerError, l as ItdFileError, m as ItdPhoneVerificationError, n as ItdApiError, o as ItdConflictError, p as ItdNotFoundError, r as ItdApiErrorKind, s as ItdError, t as ItdAbortError, u as ItdFileErrorReason, v as ItdTimeoutError, w as isItdFileError, x as isItdAuthError, y as ItdValidationError } from "../shared/errors-GI10kZxk.js";
|
|
3
|
+
import { _ as RuntimeMode } from "../shared/redact-FNK29Fv-.js";
|
|
4
|
+
import { A as ExtensibleOperationCatalog, C as utcStampToIso, D as Paginator, E as PaginationMode, O as mapPage, S as toDate, _ as IMAGE_MIME_TYPES, a as fromStream, b as isBuilder, c as report, d as autoSpans, f as markup, g as AUDIO_MIME_TYPES, h as ALLOWED_MIME_TYPES, i as isMyProfile, k as createFeatureHost, l as post, m as parseMarkdown, n as renderSpans, o as fromUrl, p as parseHtml, r as statusDays, s as createResources, t as SpanRenderFormat, u as poll, v as VIDEO_MIME_TYPES, w as NotificationsResource, x as createStatusFeature, y as comment } from "../shared/render-CiL1VS0b.js";
|
|
5
|
+
import { c as FileTransferMode } from "../shared/options-BNP633A5.js";
|
|
6
6
|
//#region src/rest/client.ts
|
|
7
7
|
/**
|
|
8
8
|
* Минимальный клиент REST API итд.com.
|
|
@@ -83,22 +83,16 @@ var ItdRestClient = class ItdRestClient {
|
|
|
83
83
|
assertActive: (action) => this.#assertActive(action),
|
|
84
84
|
auth: () => resolveAuthProvider(auth)
|
|
85
85
|
});
|
|
86
|
-
this.#features =
|
|
87
|
-
http: this.#runtime.http,
|
|
88
|
-
services: this.#runtime.services,
|
|
89
|
-
serviceOverrides: this.#runtime.config.services,
|
|
86
|
+
this.#features = createFeatureHost(this.#runtime, {
|
|
90
87
|
catalog,
|
|
91
|
-
|
|
92
|
-
clock: this.#runtime.config.clock,
|
|
93
|
-
logger: this.#runtime.config.logger,
|
|
94
|
-
assertActive: (action) => this.#assertActive(action),
|
|
95
|
-
registerBucket: (name, definition) => this.#runtime.registerRateLimitBucket(name, definition)
|
|
88
|
+
assertActive: (action) => this.#assertActive(action)
|
|
96
89
|
});
|
|
97
90
|
const status = this.#features.install(createStatusFeature());
|
|
98
91
|
this.#resources = createResources({
|
|
99
92
|
http: this.#runtime.http,
|
|
100
|
-
|
|
101
|
-
status
|
|
93
|
+
files: this.#features.files,
|
|
94
|
+
status,
|
|
95
|
+
createNotifications: (http) => new NotificationsResource(http)
|
|
102
96
|
});
|
|
103
97
|
}
|
|
104
98
|
#assertActive(action) {
|
|
@@ -131,11 +125,11 @@ var ItdRestClient = class ItdRestClient {
|
|
|
131
125
|
rateLimitState() {
|
|
132
126
|
return this.#runtime.rateLimitState();
|
|
133
127
|
}
|
|
134
|
-
/** Устанавливает REST
|
|
128
|
+
/** Устанавливает REST-модуль с общей обработкой запросов клиента. */
|
|
135
129
|
install(feature) {
|
|
136
130
|
return this.#features.install(feature);
|
|
137
131
|
}
|
|
138
|
-
/** Устанавливает REST
|
|
132
|
+
/** Устанавливает REST-модуль и добавляет его API в свойство только для чтения. */
|
|
139
133
|
withFeature(key, feature) {
|
|
140
134
|
this.#assertActive("установить feature");
|
|
141
135
|
if (typeof key !== "string" || key.trim() === "" || key !== key.trim()) throw new ItdConfigError("Свойство feature должно иметь непустое имя без краевых пробелов");
|
|
@@ -150,11 +144,11 @@ var ItdRestClient = class ItdRestClient {
|
|
|
150
144
|
});
|
|
151
145
|
return this;
|
|
152
146
|
}
|
|
153
|
-
/** Имена установленных
|
|
147
|
+
/** Имена установленных модулей в порядке установки. */
|
|
154
148
|
featureNames() {
|
|
155
149
|
return this.#features.names();
|
|
156
150
|
}
|
|
157
|
-
/** Установлен ли
|
|
151
|
+
/** Установлен ли модуль с таким именем. */
|
|
158
152
|
hasFeature(name) {
|
|
159
153
|
return this.#features.has(name);
|
|
160
154
|
}
|