itd-api 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,252 @@
1
+ 'use strict';
2
+
3
+ var chunkQILCVTJI_cjs = require('./chunk-QILCVTJI.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "ALLOWED_MIME_TYPES", {
8
+ enumerable: true,
9
+ get: function () { return chunkQILCVTJI_cjs.ALLOWED_MIME_TYPES; }
10
+ });
11
+ Object.defineProperty(exports, "AUDIO_MIME_TYPES", {
12
+ enumerable: true,
13
+ get: function () { return chunkQILCVTJI_cjs.AUDIO_MIME_TYPES; }
14
+ });
15
+ Object.defineProperty(exports, "AttachmentType", {
16
+ enumerable: true,
17
+ get: function () { return chunkQILCVTJI_cjs.AttachmentType; }
18
+ });
19
+ Object.defineProperty(exports, "CommentSort", {
20
+ enumerable: true,
21
+ get: function () { return chunkQILCVTJI_cjs.CommentSort; }
22
+ });
23
+ Object.defineProperty(exports, "DEFAULT_BASE_URL", {
24
+ enumerable: true,
25
+ get: function () { return chunkQILCVTJI_cjs.DEFAULT_BASE_URL; }
26
+ });
27
+ Object.defineProperty(exports, "DEFAULT_TIMEOUT", {
28
+ enumerable: true,
29
+ get: function () { return chunkQILCVTJI_cjs.DEFAULT_TIMEOUT; }
30
+ });
31
+ Object.defineProperty(exports, "FeedTab", {
32
+ enumerable: true,
33
+ get: function () { return chunkQILCVTJI_cjs.FeedTab; }
34
+ });
35
+ Object.defineProperty(exports, "IMAGE_MIME_TYPES", {
36
+ enumerable: true,
37
+ get: function () { return chunkQILCVTJI_cjs.IMAGE_MIME_TYPES; }
38
+ });
39
+ Object.defineProperty(exports, "ItdAbortError", {
40
+ enumerable: true,
41
+ get: function () { return chunkQILCVTJI_cjs.ItdAbortError; }
42
+ });
43
+ Object.defineProperty(exports, "ItdApiError", {
44
+ enumerable: true,
45
+ get: function () { return chunkQILCVTJI_cjs.ItdApiError; }
46
+ });
47
+ Object.defineProperty(exports, "ItdAuthError", {
48
+ enumerable: true,
49
+ get: function () { return chunkQILCVTJI_cjs.ItdAuthError; }
50
+ });
51
+ Object.defineProperty(exports, "ItdClient", {
52
+ enumerable: true,
53
+ get: function () { return chunkQILCVTJI_cjs.ItdClient; }
54
+ });
55
+ Object.defineProperty(exports, "ItdConfigError", {
56
+ enumerable: true,
57
+ get: function () { return chunkQILCVTJI_cjs.ItdConfigError; }
58
+ });
59
+ Object.defineProperty(exports, "ItdConflictError", {
60
+ enumerable: true,
61
+ get: function () { return chunkQILCVTJI_cjs.ItdConflictError; }
62
+ });
63
+ Object.defineProperty(exports, "ItdError", {
64
+ enumerable: true,
65
+ get: function () { return chunkQILCVTJI_cjs.ItdError; }
66
+ });
67
+ Object.defineProperty(exports, "ItdErrorCode", {
68
+ enumerable: true,
69
+ get: function () { return chunkQILCVTJI_cjs.ItdErrorCode; }
70
+ });
71
+ Object.defineProperty(exports, "ItdForbiddenError", {
72
+ enumerable: true,
73
+ get: function () { return chunkQILCVTJI_cjs.ItdForbiddenError; }
74
+ });
75
+ Object.defineProperty(exports, "ItdNetworkError", {
76
+ enumerable: true,
77
+ get: function () { return chunkQILCVTJI_cjs.ItdNetworkError; }
78
+ });
79
+ Object.defineProperty(exports, "ItdNotFoundError", {
80
+ enumerable: true,
81
+ get: function () { return chunkQILCVTJI_cjs.ItdNotFoundError; }
82
+ });
83
+ Object.defineProperty(exports, "ItdPhoneVerificationError", {
84
+ enumerable: true,
85
+ get: function () { return chunkQILCVTJI_cjs.ItdPhoneVerificationError; }
86
+ });
87
+ Object.defineProperty(exports, "ItdRateLimitError", {
88
+ enumerable: true,
89
+ get: function () { return chunkQILCVTJI_cjs.ItdRateLimitError; }
90
+ });
91
+ Object.defineProperty(exports, "ItdRealtime", {
92
+ enumerable: true,
93
+ get: function () { return chunkQILCVTJI_cjs.ItdRealtime; }
94
+ });
95
+ Object.defineProperty(exports, "ItdServerError", {
96
+ enumerable: true,
97
+ get: function () { return chunkQILCVTJI_cjs.ItdServerError; }
98
+ });
99
+ Object.defineProperty(exports, "ItdTimeoutError", {
100
+ enumerable: true,
101
+ get: function () { return chunkQILCVTJI_cjs.ItdTimeoutError; }
102
+ });
103
+ Object.defineProperty(exports, "ItdValidationError", {
104
+ enumerable: true,
105
+ get: function () { return chunkQILCVTJI_cjs.ItdValidationError; }
106
+ });
107
+ Object.defineProperty(exports, "LikesVisibility", {
108
+ enumerable: true,
109
+ get: function () { return chunkQILCVTJI_cjs.LikesVisibility; }
110
+ });
111
+ Object.defineProperty(exports, "LocalStorageTokenStorage", {
112
+ enumerable: true,
113
+ get: function () { return chunkQILCVTJI_cjs.LocalStorageTokenStorage; }
114
+ });
115
+ Object.defineProperty(exports, "MAX_RECONNECT_ATTEMPTS", {
116
+ enumerable: true,
117
+ get: function () { return chunkQILCVTJI_cjs.MAX_RECONNECT_ATTEMPTS; }
118
+ });
119
+ Object.defineProperty(exports, "MemoryTokenStorage", {
120
+ enumerable: true,
121
+ get: function () { return chunkQILCVTJI_cjs.MemoryTokenStorage; }
122
+ });
123
+ Object.defineProperty(exports, "NOTIFICATION_TYPE_ALIASES", {
124
+ enumerable: true,
125
+ get: function () { return chunkQILCVTJI_cjs.NOTIFICATION_TYPE_ALIASES; }
126
+ });
127
+ Object.defineProperty(exports, "NotificationType", {
128
+ enumerable: true,
129
+ get: function () { return chunkQILCVTJI_cjs.NotificationType; }
130
+ });
131
+ Object.defineProperty(exports, "Paginator", {
132
+ enumerable: true,
133
+ get: function () { return chunkQILCVTJI_cjs.Paginator; }
134
+ });
135
+ Object.defineProperty(exports, "RECONNECT_BACKOFF", {
136
+ enumerable: true,
137
+ get: function () { return chunkQILCVTJI_cjs.RECONNECT_BACKOFF; }
138
+ });
139
+ Object.defineProperty(exports, "RECONNECT_JITTER", {
140
+ enumerable: true,
141
+ get: function () { return chunkQILCVTJI_cjs.RECONNECT_JITTER; }
142
+ });
143
+ Object.defineProperty(exports, "RealtimeStatus", {
144
+ enumerable: true,
145
+ get: function () { return chunkQILCVTJI_cjs.RealtimeStatus; }
146
+ });
147
+ Object.defineProperty(exports, "ReportReason", {
148
+ enumerable: true,
149
+ get: function () { return chunkQILCVTJI_cjs.ReportReason; }
150
+ });
151
+ Object.defineProperty(exports, "ReportTargetType", {
152
+ enumerable: true,
153
+ get: function () { return chunkQILCVTJI_cjs.ReportTargetType; }
154
+ });
155
+ Object.defineProperty(exports, "STREAM_PATH", {
156
+ enumerable: true,
157
+ get: function () { return chunkQILCVTJI_cjs.STREAM_PATH; }
158
+ });
159
+ Object.defineProperty(exports, "VIDEO_MIME_TYPES", {
160
+ enumerable: true,
161
+ get: function () { return chunkQILCVTJI_cjs.VIDEO_MIME_TYPES; }
162
+ });
163
+ Object.defineProperty(exports, "WallAccess", {
164
+ enumerable: true,
165
+ get: function () { return chunkQILCVTJI_cjs.WallAccess; }
166
+ });
167
+ Object.defineProperty(exports, "canonicalNotificationType", {
168
+ enumerable: true,
169
+ get: function () { return chunkQILCVTJI_cjs.canonicalNotificationType; }
170
+ });
171
+ Object.defineProperty(exports, "comment", {
172
+ enumerable: true,
173
+ get: function () { return chunkQILCVTJI_cjs.comment; }
174
+ });
175
+ Object.defineProperty(exports, "createClient", {
176
+ enumerable: true,
177
+ get: function () { return chunkQILCVTJI_cjs.createClient; }
178
+ });
179
+ Object.defineProperty(exports, "createTokenStorage", {
180
+ enumerable: true,
181
+ get: function () { return chunkQILCVTJI_cjs.createTokenStorage; }
182
+ });
183
+ Object.defineProperty(exports, "formatNotificationText", {
184
+ enumerable: true,
185
+ get: function () { return chunkQILCVTJI_cjs.formatNotificationText; }
186
+ });
187
+ Object.defineProperty(exports, "isBuilder", {
188
+ enumerable: true,
189
+ get: function () { return chunkQILCVTJI_cjs.isBuilder; }
190
+ });
191
+ Object.defineProperty(exports, "isItdApiError", {
192
+ enumerable: true,
193
+ get: function () { return chunkQILCVTJI_cjs.isItdApiError; }
194
+ });
195
+ Object.defineProperty(exports, "isItdAuthError", {
196
+ enumerable: true,
197
+ get: function () { return chunkQILCVTJI_cjs.isItdAuthError; }
198
+ });
199
+ Object.defineProperty(exports, "isItdError", {
200
+ enumerable: true,
201
+ get: function () { return chunkQILCVTJI_cjs.isItdError; }
202
+ });
203
+ Object.defineProperty(exports, "isItdRateLimitError", {
204
+ enumerable: true,
205
+ get: function () { return chunkQILCVTJI_cjs.isItdRateLimitError; }
206
+ });
207
+ Object.defineProperty(exports, "isItdValidationError", {
208
+ enumerable: true,
209
+ get: function () { return chunkQILCVTJI_cjs.isItdValidationError; }
210
+ });
211
+ Object.defineProperty(exports, "isKnownNotificationType", {
212
+ enumerable: true,
213
+ get: function () { return chunkQILCVTJI_cjs.isKnownNotificationType; }
214
+ });
215
+ Object.defineProperty(exports, "isMyProfile", {
216
+ enumerable: true,
217
+ get: function () { return chunkQILCVTJI_cjs.isMyProfile; }
218
+ });
219
+ Object.defineProperty(exports, "normalizeNotification", {
220
+ enumerable: true,
221
+ get: function () { return chunkQILCVTJI_cjs.normalizeNotification; }
222
+ });
223
+ Object.defineProperty(exports, "poll", {
224
+ enumerable: true,
225
+ get: function () { return chunkQILCVTJI_cjs.poll; }
226
+ });
227
+ Object.defineProperty(exports, "post", {
228
+ enumerable: true,
229
+ get: function () { return chunkQILCVTJI_cjs.post; }
230
+ });
231
+ Object.defineProperty(exports, "readNotificationEvent", {
232
+ enumerable: true,
233
+ get: function () { return chunkQILCVTJI_cjs.readNotificationEvent; }
234
+ });
235
+ Object.defineProperty(exports, "readUnreadCountEvent", {
236
+ enumerable: true,
237
+ get: function () { return chunkQILCVTJI_cjs.readUnreadCountEvent; }
238
+ });
239
+ Object.defineProperty(exports, "report", {
240
+ enumerable: true,
241
+ get: function () { return chunkQILCVTJI_cjs.report; }
242
+ });
243
+ Object.defineProperty(exports, "resolveNotificationUrl", {
244
+ enumerable: true,
245
+ get: function () { return chunkQILCVTJI_cjs.resolveNotificationUrl; }
246
+ });
247
+ Object.defineProperty(exports, "toDate", {
248
+ enumerable: true,
249
+ get: function () { return chunkQILCVTJI_cjs.toDate; }
250
+ });
251
+ //# sourceMappingURL=index.cjs.map
252
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
@@ -0,0 +1 @@
1
+ export { A as ALLOWED_MIME_TYPES, c as AUDIO_MIME_TYPES, d as Actor, e as Announcement, f as AnnouncementButton, g as Attachment, h as AttachmentType, i as AuthInput, j as AuthResource, k as Author, B as BuilderInput, C as ChangelogEntry, l as Clan, m as ClientHooks, n as Comment, o as CommentBuilder, p as CommentInput, q as CommentReplyTo, r as CommentSort, s as CommentsParams, t as CommentsResource, u as CreateCommentInput, v as CreatePollInput, w as CreatePostInput, x as CreateReportInput, y as Credentials, D as DEFAULT_BASE_URL, z as DEFAULT_TIMEOUT, E as DwellEntry, G as ErrorContextHook, H as FeedParams, J as FeedTab, K as FileInput, L as FilesResource, M as FollowResult, N as Hashtag, O as HashtagPostsParams, P as HashtagsResource, Q as IMAGE_MIME_TYPES, R as InteractionEntry, S as IsoDate, U as ItdAbortError, V as ItdApiError, W as ItdApiErrorInit, X as ItdAuthError, Y as ItdBuilder, a as ItdClient, b as ItdClientOptions, Z as ItdConfigError, _ as ItdConflictError, $ as ItdError, a0 as ItdErrorCode, a1 as ItdErrorKind, a2 as ItdFieldErrors, a3 as ItdForbiddenError, a4 as ItdNetworkError, a5 as ItdNotFoundError, a6 as ItdPhoneVerificationError, a7 as ItdRateLimitError, a8 as ItdRealtime, a9 as ItdServerError, I as ItdSession, aa as ItdTimeoutError, ab as ItdValidationError, ac as LikeResult, ad as LikesVisibility, ae as Listener, af as LocalStorageTokenStorage, ag as Logger, ah as Loose, ai as MAX_RECONNECT_ATTEMPTS, aj as MemoryTokenStorage, ak as MyProfile, al as NOTIFICATION_TYPE_ALIASES, am as Notification, an as NotificationEvent, ao as NotificationListParams, ap as NotificationSettings, aq as NotificationType, ar as NotificationsResource, as as OAuthProvider, at as Page, au as PageState, av as PaginationMode, aw as Paginator, ax as PaymentMethod, ay as Pin, az as PinPostResult, aA as PinsResult, aB as PlatformResource, aC as Poll, aD as PollBuilder, aE as PollInput, aF as PollOption, aG as PollTransportOptions, aH as Portal, aI as Post, aJ as PostBuilder, aK as PostInput, aL as PostStats, aM as PostsResource, aN as PrivacySettings, aO as Profile, aP as PublicProfile, aQ as RECONNECT_BACKOFF, aR as RECONNECT_JITTER, aS as RateLimitOptions, aT as RawRequestOptions, aU as RealtimeEvents, aV as RealtimeOptions, aW as RealtimeStatus, aX as RealtimeTransport, aY as RealtimeTransportKind, aZ as ReconnectOptions, a_ as RepliesParams, a$ as Report, b0 as ReportBuilder, b1 as ReportInput, b2 as ReportReason, b3 as ReportTargetType, b4 as ReportsResource, b5 as RequestContext, b6 as RequestOptions, b7 as ResponseContext, b8 as RetryContext, b9 as RetryOptions, ba as RuntimeMode, bb as STREAM_PATH, bc as SearchResource, bd as SearchResult, be as Session, bf as SignInResult, bg as Span, bh as SseTransportOptions, bi as Subscription, bj as SubscriptionResource, bk as SubscriptionState, bl as TelemetryResource, T as TokenStorage, bm as TransportContext, bn as TransportEvent, bo as Unsubscribe, bp as UpdateNotificationSettingsInput, bq as UpdatePrivacyInput, br as UpdateProfileInput, bs as UploadOptions, bt as UploadedFile, bu as UserId, bv as UserListParams, bw as UserPostsParams, bx as UserRef, by as UserSummary, bz as UsersResource, bA as VIDEO_MIME_TYPES, bB as VerificationResource, bC as VerificationStatus, bD as WallAccess, bE as canonicalNotificationType, bF as comment, bY as createClient, bG as createTokenStorage, bH as formatNotificationText, bI as isBuilder, bJ as isItdApiError, bK as isItdAuthError, bL as isItdError, bM as isItdRateLimitError, bN as isItdValidationError, bO as isKnownNotificationType, bP as isMyProfile, bQ as normalizeNotification, bR as poll, bS as post, bT as readNotificationEvent, bU as readUnreadCountEvent, bV as report, bW as resolveNotificationUrl, bX as toDate } from './index-RzyK1gKg.cjs';
@@ -0,0 +1 @@
1
+ export { A as ALLOWED_MIME_TYPES, c as AUDIO_MIME_TYPES, d as Actor, e as Announcement, f as AnnouncementButton, g as Attachment, h as AttachmentType, i as AuthInput, j as AuthResource, k as Author, B as BuilderInput, C as ChangelogEntry, l as Clan, m as ClientHooks, n as Comment, o as CommentBuilder, p as CommentInput, q as CommentReplyTo, r as CommentSort, s as CommentsParams, t as CommentsResource, u as CreateCommentInput, v as CreatePollInput, w as CreatePostInput, x as CreateReportInput, y as Credentials, D as DEFAULT_BASE_URL, z as DEFAULT_TIMEOUT, E as DwellEntry, G as ErrorContextHook, H as FeedParams, J as FeedTab, K as FileInput, L as FilesResource, M as FollowResult, N as Hashtag, O as HashtagPostsParams, P as HashtagsResource, Q as IMAGE_MIME_TYPES, R as InteractionEntry, S as IsoDate, U as ItdAbortError, V as ItdApiError, W as ItdApiErrorInit, X as ItdAuthError, Y as ItdBuilder, a as ItdClient, b as ItdClientOptions, Z as ItdConfigError, _ as ItdConflictError, $ as ItdError, a0 as ItdErrorCode, a1 as ItdErrorKind, a2 as ItdFieldErrors, a3 as ItdForbiddenError, a4 as ItdNetworkError, a5 as ItdNotFoundError, a6 as ItdPhoneVerificationError, a7 as ItdRateLimitError, a8 as ItdRealtime, a9 as ItdServerError, I as ItdSession, aa as ItdTimeoutError, ab as ItdValidationError, ac as LikeResult, ad as LikesVisibility, ae as Listener, af as LocalStorageTokenStorage, ag as Logger, ah as Loose, ai as MAX_RECONNECT_ATTEMPTS, aj as MemoryTokenStorage, ak as MyProfile, al as NOTIFICATION_TYPE_ALIASES, am as Notification, an as NotificationEvent, ao as NotificationListParams, ap as NotificationSettings, aq as NotificationType, ar as NotificationsResource, as as OAuthProvider, at as Page, au as PageState, av as PaginationMode, aw as Paginator, ax as PaymentMethod, ay as Pin, az as PinPostResult, aA as PinsResult, aB as PlatformResource, aC as Poll, aD as PollBuilder, aE as PollInput, aF as PollOption, aG as PollTransportOptions, aH as Portal, aI as Post, aJ as PostBuilder, aK as PostInput, aL as PostStats, aM as PostsResource, aN as PrivacySettings, aO as Profile, aP as PublicProfile, aQ as RECONNECT_BACKOFF, aR as RECONNECT_JITTER, aS as RateLimitOptions, aT as RawRequestOptions, aU as RealtimeEvents, aV as RealtimeOptions, aW as RealtimeStatus, aX as RealtimeTransport, aY as RealtimeTransportKind, aZ as ReconnectOptions, a_ as RepliesParams, a$ as Report, b0 as ReportBuilder, b1 as ReportInput, b2 as ReportReason, b3 as ReportTargetType, b4 as ReportsResource, b5 as RequestContext, b6 as RequestOptions, b7 as ResponseContext, b8 as RetryContext, b9 as RetryOptions, ba as RuntimeMode, bb as STREAM_PATH, bc as SearchResource, bd as SearchResult, be as Session, bf as SignInResult, bg as Span, bh as SseTransportOptions, bi as Subscription, bj as SubscriptionResource, bk as SubscriptionState, bl as TelemetryResource, T as TokenStorage, bm as TransportContext, bn as TransportEvent, bo as Unsubscribe, bp as UpdateNotificationSettingsInput, bq as UpdatePrivacyInput, br as UpdateProfileInput, bs as UploadOptions, bt as UploadedFile, bu as UserId, bv as UserListParams, bw as UserPostsParams, bx as UserRef, by as UserSummary, bz as UsersResource, bA as VIDEO_MIME_TYPES, bB as VerificationResource, bC as VerificationStatus, bD as WallAccess, bE as canonicalNotificationType, bF as comment, bY as createClient, bG as createTokenStorage, bH as formatNotificationText, bI as isBuilder, bJ as isItdApiError, bK as isItdAuthError, bL as isItdError, bM as isItdRateLimitError, bN as isItdValidationError, bO as isKnownNotificationType, bP as isMyProfile, bQ as normalizeNotification, bR as poll, bS as post, bT as readNotificationEvent, bU as readUnreadCountEvent, bV as report, bW as resolveNotificationUrl, bX as toDate } from './index-RzyK1gKg.js';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES, AttachmentType, CommentSort, DEFAULT_BASE_URL, DEFAULT_TIMEOUT, FeedTab, IMAGE_MIME_TYPES, ItdAbortError, ItdApiError, ItdAuthError, ItdClient, ItdConfigError, ItdConflictError, ItdError, ItdErrorCode, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdPhoneVerificationError, ItdRateLimitError, ItdRealtime, ItdServerError, ItdTimeoutError, ItdValidationError, LikesVisibility, LocalStorageTokenStorage, MAX_RECONNECT_ATTEMPTS, MemoryTokenStorage, NOTIFICATION_TYPE_ALIASES, NotificationType, Paginator, RECONNECT_BACKOFF, RECONNECT_JITTER, RealtimeStatus, ReportReason, ReportTargetType, STREAM_PATH, VIDEO_MIME_TYPES, WallAccess, canonicalNotificationType, comment, createClient, createTokenStorage, formatNotificationText, isBuilder, isItdApiError, isItdAuthError, isItdError, isItdRateLimitError, isItdValidationError, isKnownNotificationType, isMyProfile, normalizeNotification, poll, post, readNotificationEvent, readUnreadCountEvent, report, resolveNotificationUrl, toDate } from './chunk-76C65H5J.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
package/dist/node.cjs ADDED
@@ -0,0 +1,292 @@
1
+ 'use strict';
2
+
3
+ var chunkQILCVTJI_cjs = require('./chunk-QILCVTJI.cjs');
4
+
5
+ // src/node.ts
6
+ var nodeFileReader = async (path) => {
7
+ const { readFile } = await import('fs/promises');
8
+ const { basename } = await import('path');
9
+ return { data: new Uint8Array(await readFile(path)), filename: basename(path) };
10
+ };
11
+ var FileTokenStorage = class {
12
+ #path;
13
+ /** @param path путь к файлу сессии. Добавьте его в `.gitignore`. */
14
+ constructor(path) {
15
+ this.#path = path;
16
+ }
17
+ async get() {
18
+ try {
19
+ const { readFile } = await import('fs/promises');
20
+ const raw = await readFile(this.#path, "utf8");
21
+ const parsed = JSON.parse(raw);
22
+ return typeof parsed === "object" && parsed !== null ? parsed : null;
23
+ } catch {
24
+ return null;
25
+ }
26
+ }
27
+ async set(session) {
28
+ const { writeFile, rename } = await import('fs/promises');
29
+ const temporary = `${this.#path}.tmp`;
30
+ await writeFile(temporary, JSON.stringify(session, null, 2), { encoding: "utf8", mode: 384 });
31
+ await rename(temporary, this.#path);
32
+ }
33
+ async clear() {
34
+ try {
35
+ const { rm } = await import('fs/promises');
36
+ await rm(this.#path, { force: true });
37
+ } catch {
38
+ }
39
+ }
40
+ };
41
+ var ItdClient2 = class extends chunkQILCVTJI_cjs.ItdClient {
42
+ constructor(options = {}) {
43
+ super(options);
44
+ this.setFileReader(nodeFileReader);
45
+ }
46
+ };
47
+ function createClient(options = {}) {
48
+ return new ItdClient2(options);
49
+ }
50
+
51
+ Object.defineProperty(exports, "ALLOWED_MIME_TYPES", {
52
+ enumerable: true,
53
+ get: function () { return chunkQILCVTJI_cjs.ALLOWED_MIME_TYPES; }
54
+ });
55
+ Object.defineProperty(exports, "AUDIO_MIME_TYPES", {
56
+ enumerable: true,
57
+ get: function () { return chunkQILCVTJI_cjs.AUDIO_MIME_TYPES; }
58
+ });
59
+ Object.defineProperty(exports, "AttachmentType", {
60
+ enumerable: true,
61
+ get: function () { return chunkQILCVTJI_cjs.AttachmentType; }
62
+ });
63
+ Object.defineProperty(exports, "CommentSort", {
64
+ enumerable: true,
65
+ get: function () { return chunkQILCVTJI_cjs.CommentSort; }
66
+ });
67
+ Object.defineProperty(exports, "DEFAULT_BASE_URL", {
68
+ enumerable: true,
69
+ get: function () { return chunkQILCVTJI_cjs.DEFAULT_BASE_URL; }
70
+ });
71
+ Object.defineProperty(exports, "DEFAULT_TIMEOUT", {
72
+ enumerable: true,
73
+ get: function () { return chunkQILCVTJI_cjs.DEFAULT_TIMEOUT; }
74
+ });
75
+ Object.defineProperty(exports, "FeedTab", {
76
+ enumerable: true,
77
+ get: function () { return chunkQILCVTJI_cjs.FeedTab; }
78
+ });
79
+ Object.defineProperty(exports, "IMAGE_MIME_TYPES", {
80
+ enumerable: true,
81
+ get: function () { return chunkQILCVTJI_cjs.IMAGE_MIME_TYPES; }
82
+ });
83
+ Object.defineProperty(exports, "ItdAbortError", {
84
+ enumerable: true,
85
+ get: function () { return chunkQILCVTJI_cjs.ItdAbortError; }
86
+ });
87
+ Object.defineProperty(exports, "ItdApiError", {
88
+ enumerable: true,
89
+ get: function () { return chunkQILCVTJI_cjs.ItdApiError; }
90
+ });
91
+ Object.defineProperty(exports, "ItdAuthError", {
92
+ enumerable: true,
93
+ get: function () { return chunkQILCVTJI_cjs.ItdAuthError; }
94
+ });
95
+ Object.defineProperty(exports, "ItdConfigError", {
96
+ enumerable: true,
97
+ get: function () { return chunkQILCVTJI_cjs.ItdConfigError; }
98
+ });
99
+ Object.defineProperty(exports, "ItdConflictError", {
100
+ enumerable: true,
101
+ get: function () { return chunkQILCVTJI_cjs.ItdConflictError; }
102
+ });
103
+ Object.defineProperty(exports, "ItdError", {
104
+ enumerable: true,
105
+ get: function () { return chunkQILCVTJI_cjs.ItdError; }
106
+ });
107
+ Object.defineProperty(exports, "ItdErrorCode", {
108
+ enumerable: true,
109
+ get: function () { return chunkQILCVTJI_cjs.ItdErrorCode; }
110
+ });
111
+ Object.defineProperty(exports, "ItdForbiddenError", {
112
+ enumerable: true,
113
+ get: function () { return chunkQILCVTJI_cjs.ItdForbiddenError; }
114
+ });
115
+ Object.defineProperty(exports, "ItdNetworkError", {
116
+ enumerable: true,
117
+ get: function () { return chunkQILCVTJI_cjs.ItdNetworkError; }
118
+ });
119
+ Object.defineProperty(exports, "ItdNotFoundError", {
120
+ enumerable: true,
121
+ get: function () { return chunkQILCVTJI_cjs.ItdNotFoundError; }
122
+ });
123
+ Object.defineProperty(exports, "ItdPhoneVerificationError", {
124
+ enumerable: true,
125
+ get: function () { return chunkQILCVTJI_cjs.ItdPhoneVerificationError; }
126
+ });
127
+ Object.defineProperty(exports, "ItdRateLimitError", {
128
+ enumerable: true,
129
+ get: function () { return chunkQILCVTJI_cjs.ItdRateLimitError; }
130
+ });
131
+ Object.defineProperty(exports, "ItdRealtime", {
132
+ enumerable: true,
133
+ get: function () { return chunkQILCVTJI_cjs.ItdRealtime; }
134
+ });
135
+ Object.defineProperty(exports, "ItdServerError", {
136
+ enumerable: true,
137
+ get: function () { return chunkQILCVTJI_cjs.ItdServerError; }
138
+ });
139
+ Object.defineProperty(exports, "ItdTimeoutError", {
140
+ enumerable: true,
141
+ get: function () { return chunkQILCVTJI_cjs.ItdTimeoutError; }
142
+ });
143
+ Object.defineProperty(exports, "ItdValidationError", {
144
+ enumerable: true,
145
+ get: function () { return chunkQILCVTJI_cjs.ItdValidationError; }
146
+ });
147
+ Object.defineProperty(exports, "LikesVisibility", {
148
+ enumerable: true,
149
+ get: function () { return chunkQILCVTJI_cjs.LikesVisibility; }
150
+ });
151
+ Object.defineProperty(exports, "LocalStorageTokenStorage", {
152
+ enumerable: true,
153
+ get: function () { return chunkQILCVTJI_cjs.LocalStorageTokenStorage; }
154
+ });
155
+ Object.defineProperty(exports, "MAX_RECONNECT_ATTEMPTS", {
156
+ enumerable: true,
157
+ get: function () { return chunkQILCVTJI_cjs.MAX_RECONNECT_ATTEMPTS; }
158
+ });
159
+ Object.defineProperty(exports, "MemoryTokenStorage", {
160
+ enumerable: true,
161
+ get: function () { return chunkQILCVTJI_cjs.MemoryTokenStorage; }
162
+ });
163
+ Object.defineProperty(exports, "NOTIFICATION_TYPE_ALIASES", {
164
+ enumerable: true,
165
+ get: function () { return chunkQILCVTJI_cjs.NOTIFICATION_TYPE_ALIASES; }
166
+ });
167
+ Object.defineProperty(exports, "NotificationType", {
168
+ enumerable: true,
169
+ get: function () { return chunkQILCVTJI_cjs.NotificationType; }
170
+ });
171
+ Object.defineProperty(exports, "Paginator", {
172
+ enumerable: true,
173
+ get: function () { return chunkQILCVTJI_cjs.Paginator; }
174
+ });
175
+ Object.defineProperty(exports, "RECONNECT_BACKOFF", {
176
+ enumerable: true,
177
+ get: function () { return chunkQILCVTJI_cjs.RECONNECT_BACKOFF; }
178
+ });
179
+ Object.defineProperty(exports, "RECONNECT_JITTER", {
180
+ enumerable: true,
181
+ get: function () { return chunkQILCVTJI_cjs.RECONNECT_JITTER; }
182
+ });
183
+ Object.defineProperty(exports, "RealtimeStatus", {
184
+ enumerable: true,
185
+ get: function () { return chunkQILCVTJI_cjs.RealtimeStatus; }
186
+ });
187
+ Object.defineProperty(exports, "ReportReason", {
188
+ enumerable: true,
189
+ get: function () { return chunkQILCVTJI_cjs.ReportReason; }
190
+ });
191
+ Object.defineProperty(exports, "ReportTargetType", {
192
+ enumerable: true,
193
+ get: function () { return chunkQILCVTJI_cjs.ReportTargetType; }
194
+ });
195
+ Object.defineProperty(exports, "STREAM_PATH", {
196
+ enumerable: true,
197
+ get: function () { return chunkQILCVTJI_cjs.STREAM_PATH; }
198
+ });
199
+ Object.defineProperty(exports, "VIDEO_MIME_TYPES", {
200
+ enumerable: true,
201
+ get: function () { return chunkQILCVTJI_cjs.VIDEO_MIME_TYPES; }
202
+ });
203
+ Object.defineProperty(exports, "WallAccess", {
204
+ enumerable: true,
205
+ get: function () { return chunkQILCVTJI_cjs.WallAccess; }
206
+ });
207
+ Object.defineProperty(exports, "canonicalNotificationType", {
208
+ enumerable: true,
209
+ get: function () { return chunkQILCVTJI_cjs.canonicalNotificationType; }
210
+ });
211
+ Object.defineProperty(exports, "comment", {
212
+ enumerable: true,
213
+ get: function () { return chunkQILCVTJI_cjs.comment; }
214
+ });
215
+ Object.defineProperty(exports, "createTokenStorage", {
216
+ enumerable: true,
217
+ get: function () { return chunkQILCVTJI_cjs.createTokenStorage; }
218
+ });
219
+ Object.defineProperty(exports, "formatNotificationText", {
220
+ enumerable: true,
221
+ get: function () { return chunkQILCVTJI_cjs.formatNotificationText; }
222
+ });
223
+ Object.defineProperty(exports, "isBuilder", {
224
+ enumerable: true,
225
+ get: function () { return chunkQILCVTJI_cjs.isBuilder; }
226
+ });
227
+ Object.defineProperty(exports, "isItdApiError", {
228
+ enumerable: true,
229
+ get: function () { return chunkQILCVTJI_cjs.isItdApiError; }
230
+ });
231
+ Object.defineProperty(exports, "isItdAuthError", {
232
+ enumerable: true,
233
+ get: function () { return chunkQILCVTJI_cjs.isItdAuthError; }
234
+ });
235
+ Object.defineProperty(exports, "isItdError", {
236
+ enumerable: true,
237
+ get: function () { return chunkQILCVTJI_cjs.isItdError; }
238
+ });
239
+ Object.defineProperty(exports, "isItdRateLimitError", {
240
+ enumerable: true,
241
+ get: function () { return chunkQILCVTJI_cjs.isItdRateLimitError; }
242
+ });
243
+ Object.defineProperty(exports, "isItdValidationError", {
244
+ enumerable: true,
245
+ get: function () { return chunkQILCVTJI_cjs.isItdValidationError; }
246
+ });
247
+ Object.defineProperty(exports, "isKnownNotificationType", {
248
+ enumerable: true,
249
+ get: function () { return chunkQILCVTJI_cjs.isKnownNotificationType; }
250
+ });
251
+ Object.defineProperty(exports, "isMyProfile", {
252
+ enumerable: true,
253
+ get: function () { return chunkQILCVTJI_cjs.isMyProfile; }
254
+ });
255
+ Object.defineProperty(exports, "normalizeNotification", {
256
+ enumerable: true,
257
+ get: function () { return chunkQILCVTJI_cjs.normalizeNotification; }
258
+ });
259
+ Object.defineProperty(exports, "poll", {
260
+ enumerable: true,
261
+ get: function () { return chunkQILCVTJI_cjs.poll; }
262
+ });
263
+ Object.defineProperty(exports, "post", {
264
+ enumerable: true,
265
+ get: function () { return chunkQILCVTJI_cjs.post; }
266
+ });
267
+ Object.defineProperty(exports, "readNotificationEvent", {
268
+ enumerable: true,
269
+ get: function () { return chunkQILCVTJI_cjs.readNotificationEvent; }
270
+ });
271
+ Object.defineProperty(exports, "readUnreadCountEvent", {
272
+ enumerable: true,
273
+ get: function () { return chunkQILCVTJI_cjs.readUnreadCountEvent; }
274
+ });
275
+ Object.defineProperty(exports, "report", {
276
+ enumerable: true,
277
+ get: function () { return chunkQILCVTJI_cjs.report; }
278
+ });
279
+ Object.defineProperty(exports, "resolveNotificationUrl", {
280
+ enumerable: true,
281
+ get: function () { return chunkQILCVTJI_cjs.resolveNotificationUrl; }
282
+ });
283
+ Object.defineProperty(exports, "toDate", {
284
+ enumerable: true,
285
+ get: function () { return chunkQILCVTJI_cjs.toDate; }
286
+ });
287
+ exports.FileTokenStorage = FileTokenStorage;
288
+ exports.ItdClient = ItdClient2;
289
+ exports.createClient = createClient;
290
+ exports.nodeFileReader = nodeFileReader;
291
+ //# sourceMappingURL=node.cjs.map
292
+ //# sourceMappingURL=node.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/node.ts"],"names":["ItdClient"],"mappings":";;;;;AAkCO,IAAM,cAAA,GAA6B,OAAO,IAAA,KAAS;AACxD,EAAA,MAAM,EAAE,QAAA,EAAS,GAAI,MAAM,OAAO,aAAkB,CAAA;AACpD,EAAA,MAAM,EAAE,QAAA,EAAS,GAAI,MAAM,OAAO,MAAW,CAAA;AAE7C,EAAA,OAAO,EAAE,IAAA,EAAM,IAAI,UAAA,CAAW,MAAM,QAAA,CAAS,IAAI,CAAC,CAAA,EAAG,QAAA,EAAU,QAAA,CAAS,IAAI,CAAA,EAAE;AAChF;AAoBO,IAAM,mBAAN,MAA+C;AAAA,EAC3C,KAAA;AAAA;AAAA,EAGT,YAAY,IAAA,EAAc;AACxB,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAA;AAAA,EACf;AAAA,EAEA,MAAM,GAAA,GAAkC;AACtC,IAAA,IAAI;AACF,MAAA,MAAM,EAAE,QAAA,EAAS,GAAI,MAAM,OAAO,aAAkB,CAAA;AACpD,MAAA,MAAM,GAAA,GAAM,MAAM,QAAA,CAAS,IAAA,CAAK,OAAO,MAAM,CAAA;AAC7C,MAAA,MAAM,MAAA,GAAkB,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAEtC,MAAA,OAAO,OAAO,MAAA,KAAW,QAAA,IAAY,MAAA,KAAW,OAAQ,MAAA,GAAwB,IAAA;AAAA,IAClF,CAAA,CAAA,MAAQ;AAEN,MAAA,OAAO,IAAA;AAAA,IACT;AAAA,EACF;AAAA,EAEA,MAAM,IAAI,OAAA,EAAoC;AAC5C,IAAA,MAAM,EAAE,SAAA,EAAW,MAAA,EAAO,GAAI,MAAM,OAAO,aAAkB,CAAA;AAC7D,IAAA,MAAM,SAAA,GAAY,CAAA,EAAG,IAAA,CAAK,KAAK,CAAA,IAAA,CAAA;AAE/B,IAAA,MAAM,SAAA,CAAU,SAAA,EAAW,IAAA,CAAK,SAAA,CAAU,OAAA,EAAS,IAAA,EAAM,CAAC,CAAA,EAAG,EAAE,QAAA,EAAU,MAAA,EAAQ,IAAA,EAAM,KAAO,CAAA;AAC9F,IAAA,MAAM,MAAA,CAAO,SAAA,EAAW,IAAA,CAAK,KAAK,CAAA;AAAA,EACpC;AAAA,EAEA,MAAM,KAAA,GAAuB;AAC3B,IAAA,IAAI;AACF,MAAA,MAAM,EAAE,EAAA,EAAG,GAAI,MAAM,OAAO,aAAkB,CAAA;AAC9C,MAAA,MAAM,GAAG,IAAA,CAAK,KAAA,EAAO,EAAE,KAAA,EAAO,MAAM,CAAA;AAAA,IACtC,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AACF;AAQO,IAAMA,UAAAA,GAAN,cAAwBA,2BAAA,CAAW;AAAA,EACxC,WAAA,CAAY,OAAA,GAA4B,EAAC,EAAG;AAC1C,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,cAAc,cAAc,CAAA;AAAA,EACnC;AACF;AAGO,SAAS,YAAA,CAAa,OAAA,GAA4B,EAAC,EAAc;AACtE,EAAA,OAAO,IAAIA,WAAU,OAAO,CAAA;AAC9B","file":"node.cjs","sourcesContent":["/**\n * `itd-api/node` — то же, что `itd-api`, плюс работа с файловой системой.\n *\n * Импортируйте эту точку входа в Node, Bun и Deno: клиент отсюда умеет загружать файлы\n * по пути (`attach('./photo.jpg')`), а `FileTokenStorage` сохраняет сессию между запусками.\n * В основном бандле работы с файлами нет намеренно — иначе браузерные сборщики пытались бы\n * разрешить `node:fs`.\n *\n * @example\n * ```ts\n * import { ItdClient, FileTokenStorage } from 'itd-api/node';\n *\n * const itd = new ItdClient({\n * auth: { email, password },\n * storage: new FileTokenStorage('./.itd-session.json'),\n * });\n *\n * await itd.posts.create((p) => p.content('привет').attach('./photo.jpg'));\n * ```\n *\n * @packageDocumentation\n */\n\nimport { ItdClient as BaseClient } from './client.js';\nimport type { ItdSession, TokenStorage } from './core/storage.js';\nimport type { FileReader } from './resources/files.js';\nimport type { ItdClientOptions } from './types/options.js';\n\n/**\n * Читает файл с диска для загрузки.\n *\n * Модуль `node:fs` подключается динамически, поэтому импорт этой точки входа не тянет\n * его в браузерные сборки.\n */\nexport const nodeFileReader: FileReader = async (path) => {\n const { readFile } = await import('node:fs/promises');\n const { basename } = await import('node:path');\n\n return { data: new Uint8Array(await readFile(path)), filename: basename(path) };\n};\n\n/**\n * Хранит сессию в файле.\n *\n * Нужна долгоживущим процессам: без неё бот при каждом запуске входит заново, а серия\n * входов подряд может привести к временной блокировке аккаунта.\n *\n * Файл создаётся с правами `0600` (чтение и запись только владельцу) — в нём лежат токены.\n * Запись идёт через временный файл с последующим переименованием, поэтому падение процесса\n * посреди сохранения не оставит повреждённую сессию.\n *\n * @example\n * ```ts\n * const itd = new ItdClient({\n * auth: { email, password },\n * storage: new FileTokenStorage('./.itd-session.json'),\n * });\n * ```\n */\nexport class FileTokenStorage implements TokenStorage {\n readonly #path: string;\n\n /** @param path путь к файлу сессии. Добавьте его в `.gitignore`. */\n constructor(path: string) {\n this.#path = path;\n }\n\n async get(): Promise<ItdSession | null> {\n try {\n const { readFile } = await import('node:fs/promises');\n const raw = await readFile(this.#path, 'utf8');\n const parsed: unknown = JSON.parse(raw);\n\n return typeof parsed === 'object' && parsed !== null ? (parsed as ItdSession) : null;\n } catch {\n // Файла нет или он повреждён — считаем, что сессии не было.\n return null;\n }\n }\n\n async set(session: ItdSession): Promise<void> {\n const { writeFile, rename } = await import('node:fs/promises');\n const temporary = `${this.#path}.tmp`;\n\n await writeFile(temporary, JSON.stringify(session, null, 2), { encoding: 'utf8', mode: 0o600 });\n await rename(temporary, this.#path);\n }\n\n async clear(): Promise<void> {\n try {\n const { rm } = await import('node:fs/promises');\n await rm(this.#path, { force: true });\n } catch {\n // Удалять нечего — это не ошибка.\n }\n }\n}\n\n/**\n * Клиент API итд.com с поддержкой файловой системы.\n *\n * Отличается от базового только тем, что умеет читать файлы по пути:\n * `attach('./photo.jpg')` и `itd.files.upload('./video.mp4')` работают сразу.\n */\nexport class ItdClient extends BaseClient {\n constructor(options: ItdClientOptions = {}) {\n super(options);\n this.setFileReader(nodeFileReader);\n }\n}\n\n/** Создаёт {@link ItdClient} с поддержкой файловой системы. */\nexport function createClient(options: ItdClientOptions = {}): ItdClient {\n return new ItdClient(options);\n}\n\n// Всё остальное — билдеры, типы, ошибки, перечисления — доступно отсюда же,\n// чтобы в Node хватало одного импорта. Объявленные выше имена перекрывают одноимённые.\nexport * from './index.js';\n"]}
@@ -0,0 +1,72 @@
1
+ import { T as TokenStorage, I as ItdSession, a as ItdClient$1, b as ItdClientOptions, F as FileReader } from './index-RzyK1gKg.cjs';
2
+ export { A as ALLOWED_MIME_TYPES, c as AUDIO_MIME_TYPES, d as Actor, e as Announcement, f as AnnouncementButton, g as Attachment, h as AttachmentType, i as AuthInput, j as AuthResource, k as Author, B as BuilderInput, C as ChangelogEntry, l as Clan, m as ClientHooks, n as Comment, o as CommentBuilder, p as CommentInput, q as CommentReplyTo, r as CommentSort, s as CommentsParams, t as CommentsResource, u as CreateCommentInput, v as CreatePollInput, w as CreatePostInput, x as CreateReportInput, y as Credentials, D as DEFAULT_BASE_URL, z as DEFAULT_TIMEOUT, E as DwellEntry, G as ErrorContextHook, H as FeedParams, J as FeedTab, K as FileInput, L as FilesResource, M as FollowResult, N as Hashtag, O as HashtagPostsParams, P as HashtagsResource, Q as IMAGE_MIME_TYPES, R as InteractionEntry, S as IsoDate, U as ItdAbortError, V as ItdApiError, W as ItdApiErrorInit, X as ItdAuthError, Y as ItdBuilder, Z as ItdConfigError, _ as ItdConflictError, $ as ItdError, a0 as ItdErrorCode, a1 as ItdErrorKind, a2 as ItdFieldErrors, a3 as ItdForbiddenError, a4 as ItdNetworkError, a5 as ItdNotFoundError, a6 as ItdPhoneVerificationError, a7 as ItdRateLimitError, a8 as ItdRealtime, a9 as ItdServerError, aa as ItdTimeoutError, ab as ItdValidationError, ac as LikeResult, ad as LikesVisibility, ae as Listener, af as LocalStorageTokenStorage, ag as Logger, ah as Loose, ai as MAX_RECONNECT_ATTEMPTS, aj as MemoryTokenStorage, ak as MyProfile, al as NOTIFICATION_TYPE_ALIASES, am as Notification, an as NotificationEvent, ao as NotificationListParams, ap as NotificationSettings, aq as NotificationType, ar as NotificationsResource, as as OAuthProvider, at as Page, au as PageState, av as PaginationMode, aw as Paginator, ax as PaymentMethod, ay as Pin, az as PinPostResult, aA as PinsResult, aB as PlatformResource, aC as Poll, aD as PollBuilder, aE as PollInput, aF as PollOption, aG as PollTransportOptions, aH as Portal, aI as Post, aJ as PostBuilder, aK as PostInput, aL as PostStats, aM as PostsResource, aN as PrivacySettings, aO as Profile, aP as PublicProfile, aQ as RECONNECT_BACKOFF, aR as RECONNECT_JITTER, aS as RateLimitOptions, aT as RawRequestOptions, aU as RealtimeEvents, aV as RealtimeOptions, aW as RealtimeStatus, aX as RealtimeTransport, aY as RealtimeTransportKind, aZ as ReconnectOptions, a_ as RepliesParams, a$ as Report, b0 as ReportBuilder, b1 as ReportInput, b2 as ReportReason, b3 as ReportTargetType, b4 as ReportsResource, b5 as RequestContext, b6 as RequestOptions, b7 as ResponseContext, b8 as RetryContext, b9 as RetryOptions, ba as RuntimeMode, bb as STREAM_PATH, bc as SearchResource, bd as SearchResult, be as Session, bf as SignInResult, bg as Span, bh as SseTransportOptions, bi as Subscription, bj as SubscriptionResource, bk as SubscriptionState, bl as TelemetryResource, bm as TransportContext, bn as TransportEvent, bo as Unsubscribe, bp as UpdateNotificationSettingsInput, bq as UpdatePrivacyInput, br as UpdateProfileInput, bs as UploadOptions, bt as UploadedFile, bu as UserId, bv as UserListParams, bw as UserPostsParams, bx as UserRef, by as UserSummary, bz as UsersResource, bA as VIDEO_MIME_TYPES, bB as VerificationResource, bC as VerificationStatus, bD as WallAccess, bE as canonicalNotificationType, bF as comment, bG as createTokenStorage, bH as formatNotificationText, bI as isBuilder, bJ as isItdApiError, bK as isItdAuthError, bL as isItdError, bM as isItdRateLimitError, bN as isItdValidationError, bO as isKnownNotificationType, bP as isMyProfile, bQ as normalizeNotification, bR as poll, bS as post, bT as readNotificationEvent, bU as readUnreadCountEvent, bV as report, bW as resolveNotificationUrl, bX as toDate } from './index-RzyK1gKg.cjs';
3
+
4
+ /**
5
+ * `itd-api/node` — то же, что `itd-api`, плюс работа с файловой системой.
6
+ *
7
+ * Импортируйте эту точку входа в Node, Bun и Deno: клиент отсюда умеет загружать файлы
8
+ * по пути (`attach('./photo.jpg')`), а `FileTokenStorage` сохраняет сессию между запусками.
9
+ * В основном бандле работы с файлами нет намеренно — иначе браузерные сборщики пытались бы
10
+ * разрешить `node:fs`.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { ItdClient, FileTokenStorage } from 'itd-api/node';
15
+ *
16
+ * const itd = new ItdClient({
17
+ * auth: { email, password },
18
+ * storage: new FileTokenStorage('./.itd-session.json'),
19
+ * });
20
+ *
21
+ * await itd.posts.create((p) => p.content('привет').attach('./photo.jpg'));
22
+ * ```
23
+ *
24
+ * @packageDocumentation
25
+ */
26
+
27
+ /**
28
+ * Читает файл с диска для загрузки.
29
+ *
30
+ * Модуль `node:fs` подключается динамически, поэтому импорт этой точки входа не тянет
31
+ * его в браузерные сборки.
32
+ */
33
+ declare const nodeFileReader: FileReader;
34
+ /**
35
+ * Хранит сессию в файле.
36
+ *
37
+ * Нужна долгоживущим процессам: без неё бот при каждом запуске входит заново, а серия
38
+ * входов подряд может привести к временной блокировке аккаунта.
39
+ *
40
+ * Файл создаётся с правами `0600` (чтение и запись только владельцу) — в нём лежат токены.
41
+ * Запись идёт через временный файл с последующим переименованием, поэтому падение процесса
42
+ * посреди сохранения не оставит повреждённую сессию.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const itd = new ItdClient({
47
+ * auth: { email, password },
48
+ * storage: new FileTokenStorage('./.itd-session.json'),
49
+ * });
50
+ * ```
51
+ */
52
+ declare class FileTokenStorage implements TokenStorage {
53
+ #private;
54
+ /** @param path путь к файлу сессии. Добавьте его в `.gitignore`. */
55
+ constructor(path: string);
56
+ get(): Promise<ItdSession | null>;
57
+ set(session: ItdSession): Promise<void>;
58
+ clear(): Promise<void>;
59
+ }
60
+ /**
61
+ * Клиент API итд.com с поддержкой файловой системы.
62
+ *
63
+ * Отличается от базового только тем, что умеет читать файлы по пути:
64
+ * `attach('./photo.jpg')` и `itd.files.upload('./video.mp4')` работают сразу.
65
+ */
66
+ declare class ItdClient extends ItdClient$1 {
67
+ constructor(options?: ItdClientOptions);
68
+ }
69
+ /** Создаёт {@link ItdClient} с поддержкой файловой системы. */
70
+ declare function createClient(options?: ItdClientOptions): ItdClient;
71
+
72
+ export { FileTokenStorage, ItdClient, ItdClientOptions, ItdSession, TokenStorage, createClient, nodeFileReader };