itd-api 0.7.1 → 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 +14 -14
- 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 +269 -175
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +77 -56
- package/dist/index.d.ts +77 -56
- package/dist/index.js +251 -160
- 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 +72 -14
- package/dist/rest/index.cjs.map +1 -1
- package/dist/rest/index.d.cts +11 -3
- package/dist/rest/index.d.ts +11 -3
- package/dist/rest/index.js +66 -8
- 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-CbzB1Leq.js → events-TfhKh26b.js} +770 -490
- package/dist/shared/events-TfhKh26b.js.map +1 -0
- package/dist/shared/{websocket-sYlynrr0.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-DMp_3Nzk.d.cts → render-BszcKF7S.d.cts} +432 -254
- package/dist/shared/{render-vtLixIiU.js → render-CiL1VS0b.js} +1261 -621
- package/dist/shared/render-CiL1VS0b.js.map +1 -0
- package/dist/shared/{render-DyeHJNBw.cjs → render-DNTESBSl.cjs} +1335 -671
- package/dist/shared/render-DNTESBSl.cjs.map +1 -0
- package/dist/shared/{render-DZrxhC5_.d.ts → render-DVB7T8pm.d.ts} +432 -254
- 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-CYXgxqGx.js → url-B3ocFlHj.js} +491 -425
- package/dist/shared/url-B3ocFlHj.js.map +1 -0
- package/dist/shared/{url-B6-bXHKt.d.ts → url-Be9jlWRv.d.cts} +1233 -1195
- package/dist/shared/{url-B6-bXHKt.d.cts → url-Be9jlWRv.d.ts} +1233 -1195
- package/dist/shared/{url-yjl2c8Ie.cjs → url-CFN1sT9S.cjs} +562 -478
- 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-BfogACAb.js +0 -91
- package/dist/shared/auth-provider-BfogACAb.js.map +0 -1
- package/dist/shared/auth-provider-CTJkKfgy.cjs +0 -108
- package/dist/shared/auth-provider-CTJkKfgy.cjs.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-DyeHJNBw.cjs.map +0 -1
- package/dist/shared/render-vtLixIiU.js.map +0 -1
- package/dist/shared/url-CYXgxqGx.js.map +0 -1
- package/dist/shared/url-yjl2c8Ie.cjs.map +0 -1
- package/dist/shared/websocket-BMtihD56.d.ts +0 -562
- package/dist/shared/websocket-CbzB1Leq.js.map +0 -1
- package/dist/shared/websocket-D1p32SB2.d.cts +0 -562
- package/dist/shared/websocket-sYlynrr0.cjs.map +0 -1
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.
|
|
@@ -23,6 +23,7 @@ const require_auth_provider = require("../shared/auth-provider-CTJkKfgy.cjs");
|
|
|
23
23
|
*/
|
|
24
24
|
var ItdRestClient = class ItdRestClient {
|
|
25
25
|
#runtime;
|
|
26
|
+
#features;
|
|
26
27
|
#resources;
|
|
27
28
|
/** Общий результат терминальной очистки для идемпотентных повторных вызовов. */
|
|
28
29
|
#disposePromise;
|
|
@@ -77,14 +78,22 @@ var ItdRestClient = class ItdRestClient {
|
|
|
77
78
|
}
|
|
78
79
|
constructor(options = {}) {
|
|
79
80
|
const { auth, ...runtimeOptions } = options;
|
|
81
|
+
const catalog = new require_render.ExtensibleOperationCatalog(require_url.ITD_CATALOG);
|
|
80
82
|
this.#runtime = require_url.createClientRuntime(runtimeOptions, {
|
|
81
|
-
catalog
|
|
83
|
+
catalog,
|
|
82
84
|
assertActive: (action) => this.#assertActive(action),
|
|
83
85
|
auth: () => resolveAuthProvider(auth)
|
|
84
86
|
});
|
|
87
|
+
this.#features = require_render.createFeatureHost(this.#runtime, {
|
|
88
|
+
catalog,
|
|
89
|
+
assertActive: (action) => this.#assertActive(action)
|
|
90
|
+
});
|
|
91
|
+
const status = this.#features.install(require_render.createStatusFeature());
|
|
85
92
|
this.#resources = require_render.createResources({
|
|
86
93
|
http: this.#runtime.http,
|
|
87
|
-
|
|
94
|
+
files: this.#features.files,
|
|
95
|
+
status,
|
|
96
|
+
createNotifications: (http) => new require_render.NotificationsResource(http)
|
|
88
97
|
});
|
|
89
98
|
}
|
|
90
99
|
#assertActive(action) {
|
|
@@ -117,6 +126,33 @@ var ItdRestClient = class ItdRestClient {
|
|
|
117
126
|
rateLimitState() {
|
|
118
127
|
return this.#runtime.rateLimitState();
|
|
119
128
|
}
|
|
129
|
+
/** Устанавливает REST-модуль с общей обработкой запросов клиента. */
|
|
130
|
+
install(feature) {
|
|
131
|
+
return this.#features.install(feature);
|
|
132
|
+
}
|
|
133
|
+
/** Устанавливает REST-модуль и добавляет его API в свойство только для чтения. */
|
|
134
|
+
withFeature(key, feature) {
|
|
135
|
+
this.#assertActive("установить feature");
|
|
136
|
+
if (typeof key !== "string" || key.trim() === "" || key !== key.trim()) throw new require_errors.ItdConfigError("Свойство feature должно иметь непустое имя без краевых пробелов");
|
|
137
|
+
if (key === "then" || key in this) throw new require_errors.ItdConfigError(`Свойство клиента «${key}» уже занято или зарезервировано`);
|
|
138
|
+
if (!Object.isExtensible(this)) throw new require_errors.ItdConfigError("Нельзя опубликовать feature на нерасширяемом клиенте");
|
|
139
|
+
const api = this.install(feature);
|
|
140
|
+
Object.defineProperty(this, key, {
|
|
141
|
+
value: api,
|
|
142
|
+
enumerable: true,
|
|
143
|
+
configurable: false,
|
|
144
|
+
writable: false
|
|
145
|
+
});
|
|
146
|
+
return this;
|
|
147
|
+
}
|
|
148
|
+
/** Имена установленных модулей в порядке установки. */
|
|
149
|
+
featureNames() {
|
|
150
|
+
return this.#features.names();
|
|
151
|
+
}
|
|
152
|
+
/** Установлен ли модуль с таким именем. */
|
|
153
|
+
hasFeature(name) {
|
|
154
|
+
return this.#features.has(name);
|
|
155
|
+
}
|
|
120
156
|
/**
|
|
121
157
|
* Подключает плагин.
|
|
122
158
|
*
|
|
@@ -169,11 +205,23 @@ var ItdRestClient = class ItdRestClient {
|
|
|
169
205
|
* это {@link dispose}.
|
|
170
206
|
*/
|
|
171
207
|
async close() {
|
|
208
|
+
const errors = [];
|
|
172
209
|
try {
|
|
173
|
-
|
|
210
|
+
try {
|
|
211
|
+
await this.#features.close();
|
|
212
|
+
} catch (error) {
|
|
213
|
+
errors.push(error);
|
|
214
|
+
}
|
|
215
|
+
try {
|
|
216
|
+
await this.#resources.closeTelemetry(false);
|
|
217
|
+
} catch (error) {
|
|
218
|
+
errors.push(error);
|
|
219
|
+
}
|
|
174
220
|
} finally {
|
|
175
221
|
this.#runtime.close();
|
|
176
222
|
}
|
|
223
|
+
if (errors.length === 1) throw errors[0];
|
|
224
|
+
if (errors.length > 1) throw new AggregateError(errors, "Не удалось закрыть клиент");
|
|
177
225
|
}
|
|
178
226
|
/**
|
|
179
227
|
* Окончательно освобождает клиент: выполняет {@link close}, отменяет незавершённые
|
|
@@ -196,11 +244,21 @@ var ItdRestClient = class ItdRestClient {
|
|
|
196
244
|
async #dispose() {
|
|
197
245
|
const errors = [];
|
|
198
246
|
this.#resources.prepareTelemetryClose();
|
|
247
|
+
try {
|
|
248
|
+
await this.#features.close();
|
|
249
|
+
} catch (error) {
|
|
250
|
+
errors.push(error);
|
|
251
|
+
}
|
|
199
252
|
try {
|
|
200
253
|
await this.#resources.closeTelemetry(true);
|
|
201
254
|
} catch (error) {
|
|
202
255
|
errors.push(error);
|
|
203
256
|
}
|
|
257
|
+
try {
|
|
258
|
+
await this.#features.dispose();
|
|
259
|
+
} catch (error) {
|
|
260
|
+
errors.push(error);
|
|
261
|
+
}
|
|
204
262
|
try {
|
|
205
263
|
this.#runtime.close();
|
|
206
264
|
await this.#runtime.dispose();
|
|
@@ -219,8 +277,8 @@ var ItdRestClient = class ItdRestClient {
|
|
|
219
277
|
};
|
|
220
278
|
/** Приводит опцию `auth` к провайдеру конвейера. */
|
|
221
279
|
function resolveAuthProvider(auth) {
|
|
222
|
-
if (auth === void 0) return
|
|
223
|
-
return typeof auth === "string" ?
|
|
280
|
+
if (auth === void 0) return require_url.anonymousAuth();
|
|
281
|
+
return typeof auth === "string" ? require_url.bearerToken(auth) : auth;
|
|
224
282
|
}
|
|
225
283
|
/**
|
|
226
284
|
* Создаёт минимальный клиент REST API. Равнозначно конструктору {@link ItdRestClient}.
|
|
@@ -278,7 +336,7 @@ exports.RateLimitPacing = require_url.RateLimitPacing;
|
|
|
278
336
|
exports.ReportReason = require_url.ReportReason;
|
|
279
337
|
exports.ReportTargetType = require_url.ReportTargetType;
|
|
280
338
|
exports.RetrySafety = require_url.RetrySafety;
|
|
281
|
-
exports.RuntimeMode =
|
|
339
|
+
exports.RuntimeMode = require_redact.RuntimeMode;
|
|
282
340
|
exports.STATUS_SERVICE = require_url.STATUS_SERVICE;
|
|
283
341
|
exports.ServiceState = require_url.ServiceState;
|
|
284
342
|
exports.SpanRenderFormat = require_render.SpanRenderFormat;
|
|
@@ -287,9 +345,9 @@ exports.VIDEO_MIME_TYPES = require_render.VIDEO_MIME_TYPES;
|
|
|
287
345
|
exports.ViewReason = require_url.ViewReason;
|
|
288
346
|
exports.ViewSource = require_url.ViewSource;
|
|
289
347
|
exports.WallAccess = require_url.WallAccess;
|
|
290
|
-
exports.anonymousAuth =
|
|
348
|
+
exports.anonymousAuth = require_url.anonymousAuth;
|
|
291
349
|
exports.autoSpans = require_render.autoSpans;
|
|
292
|
-
exports.bearerToken =
|
|
350
|
+
exports.bearerToken = require_url.bearerToken;
|
|
293
351
|
exports.canonicalNotificationType = require_url.canonicalNotificationType;
|
|
294
352
|
exports.comment = require_render.comment;
|
|
295
353
|
exports.createRestClient = createRestClient;
|
|
@@ -328,7 +386,7 @@ exports.resolveNotificationUrl = require_url.resolveNotificationUrl;
|
|
|
328
386
|
exports.statusDays = require_render.statusDays;
|
|
329
387
|
exports.systemClock = require_url.systemClock;
|
|
330
388
|
exports.toDate = require_render.toDate;
|
|
331
|
-
exports.tokenProvider =
|
|
389
|
+
exports.tokenProvider = require_url.tokenProvider;
|
|
332
390
|
exports.utcStampToIso = require_render.utcStampToIso;
|
|
333
391
|
|
|
334
392
|
//# sourceMappingURL=index.cjs.map
|
package/dist/rest/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["#runtime","#resources","createClientRuntime","ITD_CATALOG","#assertActive","createResources","#disposed","ItdStateError","#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 { ItdStateError } from '../core/errors.js';\nimport { type ClientRuntime, createClientRuntime } from '../core/execution/client-runtime.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 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 #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\n this.#runtime = createClientRuntime(runtimeOptions, {\n catalog: ITD_CATALOG,\n assertActive: (action) => this.#assertActive(action),\n auth: () => resolveAuthProvider(auth),\n });\n this.#resources = createResources({\n http: this.#runtime.http,\n fetch: this.#runtime.config.fetch,\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 /**\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 try {\n await this.#resources.closeTelemetry(false);\n } finally {\n this.#runtime.close();\n }\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.#resources.closeTelemetry(true);\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":"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"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["#runtime","#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":"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"}
|
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,6 +73,14 @@ declare class ItdRestClient {
|
|
|
73
73
|
* Пустой массив при `rateLimit: false`.
|
|
74
74
|
*/
|
|
75
75
|
rateLimitState(): RateLimitBucketState[];
|
|
76
|
+
/** Устанавливает REST-модуль с общей обработкой запросов клиента. */
|
|
77
|
+
install<TApi>(feature: ClientFeature<TApi>): TApi;
|
|
78
|
+
/** Устанавливает REST-модуль и добавляет его API в свойство только для чтения. */
|
|
79
|
+
withFeature<const K extends string, TApi>(key: K, feature: ClientFeature<TApi>): this & { readonly [P in K]: TApi; };
|
|
80
|
+
/** Имена установленных модулей в порядке установки. */
|
|
81
|
+
featureNames(): string[];
|
|
82
|
+
/** Установлен ли модуль с таким именем. */
|
|
83
|
+
hasFeature(name: string): boolean;
|
|
76
84
|
/**
|
|
77
85
|
* Подключает плагин.
|
|
78
86
|
*
|
|
@@ -134,5 +142,5 @@ declare class ItdRestClient {
|
|
|
134
142
|
*/
|
|
135
143
|
declare function createRestClient(options?: RestClientOptions): ItdRestClient;
|
|
136
144
|
//#endregion
|
|
137
|
-
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 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 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 };
|
|
138
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,6 +73,14 @@ declare class ItdRestClient {
|
|
|
73
73
|
* Пустой массив при `rateLimit: false`.
|
|
74
74
|
*/
|
|
75
75
|
rateLimitState(): RateLimitBucketState[];
|
|
76
|
+
/** Устанавливает REST-модуль с общей обработкой запросов клиента. */
|
|
77
|
+
install<TApi>(feature: ClientFeature<TApi>): TApi;
|
|
78
|
+
/** Устанавливает REST-модуль и добавляет его API в свойство только для чтения. */
|
|
79
|
+
withFeature<const K extends string, TApi>(key: K, feature: ClientFeature<TApi>): this & { readonly [P in K]: TApi; };
|
|
80
|
+
/** Имена установленных модулей в порядке установки. */
|
|
81
|
+
featureNames(): string[];
|
|
82
|
+
/** Установлен ли модуль с таким именем. */
|
|
83
|
+
hasFeature(name: string): boolean;
|
|
76
84
|
/**
|
|
77
85
|
* Подключает плагин.
|
|
78
86
|
*
|
|
@@ -134,5 +142,5 @@ declare class ItdRestClient {
|
|
|
134
142
|
*/
|
|
135
143
|
declare function createRestClient(options?: RestClientOptions): ItdRestClient;
|
|
136
144
|
//#endregion
|
|
137
|
-
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 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 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 };
|
|
138
146
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/rest/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $ 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.
|
|
@@ -22,6 +22,7 @@ import { n as bearerToken, r as tokenProvider, t as anonymousAuth } from "../sha
|
|
|
22
22
|
*/
|
|
23
23
|
var ItdRestClient = class ItdRestClient {
|
|
24
24
|
#runtime;
|
|
25
|
+
#features;
|
|
25
26
|
#resources;
|
|
26
27
|
/** Общий результат терминальной очистки для идемпотентных повторных вызовов. */
|
|
27
28
|
#disposePromise;
|
|
@@ -76,14 +77,22 @@ var ItdRestClient = class ItdRestClient {
|
|
|
76
77
|
}
|
|
77
78
|
constructor(options = {}) {
|
|
78
79
|
const { auth, ...runtimeOptions } = options;
|
|
80
|
+
const catalog = new ExtensibleOperationCatalog(ITD_CATALOG);
|
|
79
81
|
this.#runtime = createClientRuntime(runtimeOptions, {
|
|
80
|
-
catalog
|
|
82
|
+
catalog,
|
|
81
83
|
assertActive: (action) => this.#assertActive(action),
|
|
82
84
|
auth: () => resolveAuthProvider(auth)
|
|
83
85
|
});
|
|
86
|
+
this.#features = createFeatureHost(this.#runtime, {
|
|
87
|
+
catalog,
|
|
88
|
+
assertActive: (action) => this.#assertActive(action)
|
|
89
|
+
});
|
|
90
|
+
const status = this.#features.install(createStatusFeature());
|
|
84
91
|
this.#resources = createResources({
|
|
85
92
|
http: this.#runtime.http,
|
|
86
|
-
|
|
93
|
+
files: this.#features.files,
|
|
94
|
+
status,
|
|
95
|
+
createNotifications: (http) => new NotificationsResource(http)
|
|
87
96
|
});
|
|
88
97
|
}
|
|
89
98
|
#assertActive(action) {
|
|
@@ -116,6 +125,33 @@ var ItdRestClient = class ItdRestClient {
|
|
|
116
125
|
rateLimitState() {
|
|
117
126
|
return this.#runtime.rateLimitState();
|
|
118
127
|
}
|
|
128
|
+
/** Устанавливает REST-модуль с общей обработкой запросов клиента. */
|
|
129
|
+
install(feature) {
|
|
130
|
+
return this.#features.install(feature);
|
|
131
|
+
}
|
|
132
|
+
/** Устанавливает REST-модуль и добавляет его API в свойство только для чтения. */
|
|
133
|
+
withFeature(key, feature) {
|
|
134
|
+
this.#assertActive("установить feature");
|
|
135
|
+
if (typeof key !== "string" || key.trim() === "" || key !== key.trim()) throw new ItdConfigError("Свойство feature должно иметь непустое имя без краевых пробелов");
|
|
136
|
+
if (key === "then" || key in this) throw new ItdConfigError(`Свойство клиента «${key}» уже занято или зарезервировано`);
|
|
137
|
+
if (!Object.isExtensible(this)) throw new ItdConfigError("Нельзя опубликовать feature на нерасширяемом клиенте");
|
|
138
|
+
const api = this.install(feature);
|
|
139
|
+
Object.defineProperty(this, key, {
|
|
140
|
+
value: api,
|
|
141
|
+
enumerable: true,
|
|
142
|
+
configurable: false,
|
|
143
|
+
writable: false
|
|
144
|
+
});
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
147
|
+
/** Имена установленных модулей в порядке установки. */
|
|
148
|
+
featureNames() {
|
|
149
|
+
return this.#features.names();
|
|
150
|
+
}
|
|
151
|
+
/** Установлен ли модуль с таким именем. */
|
|
152
|
+
hasFeature(name) {
|
|
153
|
+
return this.#features.has(name);
|
|
154
|
+
}
|
|
119
155
|
/**
|
|
120
156
|
* Подключает плагин.
|
|
121
157
|
*
|
|
@@ -168,11 +204,23 @@ var ItdRestClient = class ItdRestClient {
|
|
|
168
204
|
* это {@link dispose}.
|
|
169
205
|
*/
|
|
170
206
|
async close() {
|
|
207
|
+
const errors = [];
|
|
171
208
|
try {
|
|
172
|
-
|
|
209
|
+
try {
|
|
210
|
+
await this.#features.close();
|
|
211
|
+
} catch (error) {
|
|
212
|
+
errors.push(error);
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
await this.#resources.closeTelemetry(false);
|
|
216
|
+
} catch (error) {
|
|
217
|
+
errors.push(error);
|
|
218
|
+
}
|
|
173
219
|
} finally {
|
|
174
220
|
this.#runtime.close();
|
|
175
221
|
}
|
|
222
|
+
if (errors.length === 1) throw errors[0];
|
|
223
|
+
if (errors.length > 1) throw new AggregateError(errors, "Не удалось закрыть клиент");
|
|
176
224
|
}
|
|
177
225
|
/**
|
|
178
226
|
* Окончательно освобождает клиент: выполняет {@link close}, отменяет незавершённые
|
|
@@ -195,11 +243,21 @@ var ItdRestClient = class ItdRestClient {
|
|
|
195
243
|
async #dispose() {
|
|
196
244
|
const errors = [];
|
|
197
245
|
this.#resources.prepareTelemetryClose();
|
|
246
|
+
try {
|
|
247
|
+
await this.#features.close();
|
|
248
|
+
} catch (error) {
|
|
249
|
+
errors.push(error);
|
|
250
|
+
}
|
|
198
251
|
try {
|
|
199
252
|
await this.#resources.closeTelemetry(true);
|
|
200
253
|
} catch (error) {
|
|
201
254
|
errors.push(error);
|
|
202
255
|
}
|
|
256
|
+
try {
|
|
257
|
+
await this.#features.dispose();
|
|
258
|
+
} catch (error) {
|
|
259
|
+
errors.push(error);
|
|
260
|
+
}
|
|
203
261
|
try {
|
|
204
262
|
this.#runtime.close();
|
|
205
263
|
await this.#runtime.dispose();
|