itd-api 0.0.2 → 0.0.4
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 +133 -11
- package/dist/{chunk-76C65H5J.js → chunk-JV75JWOX.js} +646 -275
- package/dist/chunk-JV75JWOX.js.map +1 -0
- package/dist/{chunk-QILCVTJI.cjs → chunk-XG43KEYF.cjs} +667 -274
- package/dist/chunk-XG43KEYF.cjs.map +1 -0
- package/dist/{index-RzyK1gKg.d.cts → index-olL_q_yu.d.cts} +392 -47
- package/dist/{index-RzyK1gKg.d.ts → index-olL_q_yu.d.ts} +392 -47
- package/dist/index.cjs +150 -62
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/node.cjs +149 -61
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +8 -12
- package/dist/node.d.ts +8 -12
- package/dist/node.js +2 -2
- package/dist/node.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-76C65H5J.js.map +0 -1
- package/dist/chunk-QILCVTJI.cjs.map +0 -1
package/dist/node.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkXG43KEYF_cjs = require('./chunk-XG43KEYF.cjs');
|
|
4
4
|
|
|
5
5
|
// src/node.ts
|
|
6
6
|
var nodeFileReader = async (path) => {
|
|
@@ -38,7 +38,7 @@ var FileTokenStorage = class {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
var ItdClient2 = class extends
|
|
41
|
+
var ItdClient2 = class extends chunkXG43KEYF_cjs.ItdClient {
|
|
42
42
|
constructor(options = {}) {
|
|
43
43
|
super(options);
|
|
44
44
|
this.setFileReader(nodeFileReader);
|
|
@@ -50,239 +50,327 @@ function createClient(options = {}) {
|
|
|
50
50
|
|
|
51
51
|
Object.defineProperty(exports, "ALLOWED_MIME_TYPES", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkXG43KEYF_cjs.ALLOWED_MIME_TYPES; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "AUDIO_MIME_TYPES", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkXG43KEYF_cjs.AUDIO_MIME_TYPES; }
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, "AUTH_FLAG_COOKIE", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function () { return chunkXG43KEYF_cjs.AUTH_FLAG_COOKIE; }
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "AUTH_PATHS", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () { return chunkXG43KEYF_cjs.AUTH_PATHS; }
|
|
58
66
|
});
|
|
59
67
|
Object.defineProperty(exports, "AttachmentType", {
|
|
60
68
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunkXG43KEYF_cjs.AttachmentType; }
|
|
62
70
|
});
|
|
63
71
|
Object.defineProperty(exports, "CommentSort", {
|
|
64
72
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunkXG43KEYF_cjs.CommentSort; }
|
|
66
74
|
});
|
|
67
75
|
Object.defineProperty(exports, "DEFAULT_BASE_URL", {
|
|
68
76
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunkXG43KEYF_cjs.DEFAULT_BASE_URL; }
|
|
70
78
|
});
|
|
71
79
|
Object.defineProperty(exports, "DEFAULT_TIMEOUT", {
|
|
72
80
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
81
|
+
get: function () { return chunkXG43KEYF_cjs.DEFAULT_TIMEOUT; }
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(exports, "DEFAULT_USER_AGENT", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function () { return chunkXG43KEYF_cjs.DEFAULT_USER_AGENT; }
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports, "DEVICE_ID_HEADER", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () { return chunkXG43KEYF_cjs.DEVICE_ID_HEADER; }
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, "DetectedRuntime", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () { return chunkXG43KEYF_cjs.DetectedRuntime; }
|
|
74
94
|
});
|
|
75
95
|
Object.defineProperty(exports, "FeedTab", {
|
|
76
96
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunkXG43KEYF_cjs.FeedTab; }
|
|
78
98
|
});
|
|
79
99
|
Object.defineProperty(exports, "IMAGE_MIME_TYPES", {
|
|
80
100
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunkXG43KEYF_cjs.IMAGE_MIME_TYPES; }
|
|
82
102
|
});
|
|
83
103
|
Object.defineProperty(exports, "ItdAbortError", {
|
|
84
104
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunkXG43KEYF_cjs.ItdAbortError; }
|
|
86
106
|
});
|
|
87
107
|
Object.defineProperty(exports, "ItdApiError", {
|
|
88
108
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunkXG43KEYF_cjs.ItdApiError; }
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(exports, "ItdApiErrorKind", {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
get: function () { return chunkXG43KEYF_cjs.ItdApiErrorKind; }
|
|
90
114
|
});
|
|
91
115
|
Object.defineProperty(exports, "ItdAuthError", {
|
|
92
116
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunkXG43KEYF_cjs.ItdAuthError; }
|
|
94
118
|
});
|
|
95
119
|
Object.defineProperty(exports, "ItdConfigError", {
|
|
96
120
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunkXG43KEYF_cjs.ItdConfigError; }
|
|
98
122
|
});
|
|
99
123
|
Object.defineProperty(exports, "ItdConflictError", {
|
|
100
124
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunkXG43KEYF_cjs.ItdConflictError; }
|
|
102
126
|
});
|
|
103
127
|
Object.defineProperty(exports, "ItdError", {
|
|
104
128
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
129
|
+
get: function () { return chunkXG43KEYF_cjs.ItdError; }
|
|
106
130
|
});
|
|
107
131
|
Object.defineProperty(exports, "ItdErrorCode", {
|
|
108
132
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunkXG43KEYF_cjs.ItdErrorCode; }
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(exports, "ItdErrorKind", {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
get: function () { return chunkXG43KEYF_cjs.ItdErrorKind; }
|
|
110
138
|
});
|
|
111
139
|
Object.defineProperty(exports, "ItdForbiddenError", {
|
|
112
140
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunkXG43KEYF_cjs.ItdForbiddenError; }
|
|
114
142
|
});
|
|
115
143
|
Object.defineProperty(exports, "ItdNetworkError", {
|
|
116
144
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunkXG43KEYF_cjs.ItdNetworkError; }
|
|
118
146
|
});
|
|
119
147
|
Object.defineProperty(exports, "ItdNotFoundError", {
|
|
120
148
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
149
|
+
get: function () { return chunkXG43KEYF_cjs.ItdNotFoundError; }
|
|
122
150
|
});
|
|
123
151
|
Object.defineProperty(exports, "ItdPhoneVerificationError", {
|
|
124
152
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
153
|
+
get: function () { return chunkXG43KEYF_cjs.ItdPhoneVerificationError; }
|
|
126
154
|
});
|
|
127
155
|
Object.defineProperty(exports, "ItdRateLimitError", {
|
|
128
156
|
enumerable: true,
|
|
129
|
-
get: function () { return
|
|
157
|
+
get: function () { return chunkXG43KEYF_cjs.ItdRateLimitError; }
|
|
130
158
|
});
|
|
131
159
|
Object.defineProperty(exports, "ItdRealtime", {
|
|
132
160
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
161
|
+
get: function () { return chunkXG43KEYF_cjs.ItdRealtime; }
|
|
134
162
|
});
|
|
135
163
|
Object.defineProperty(exports, "ItdServerError", {
|
|
136
164
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
165
|
+
get: function () { return chunkXG43KEYF_cjs.ItdServerError; }
|
|
138
166
|
});
|
|
139
167
|
Object.defineProperty(exports, "ItdTimeoutError", {
|
|
140
168
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
169
|
+
get: function () { return chunkXG43KEYF_cjs.ItdTimeoutError; }
|
|
142
170
|
});
|
|
143
171
|
Object.defineProperty(exports, "ItdValidationError", {
|
|
144
172
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
173
|
+
get: function () { return chunkXG43KEYF_cjs.ItdValidationError; }
|
|
174
|
+
});
|
|
175
|
+
Object.defineProperty(exports, "LIBRARY_VERSION", {
|
|
176
|
+
enumerable: true,
|
|
177
|
+
get: function () { return chunkXG43KEYF_cjs.LIBRARY_VERSION; }
|
|
146
178
|
});
|
|
147
179
|
Object.defineProperty(exports, "LikesVisibility", {
|
|
148
180
|
enumerable: true,
|
|
149
|
-
get: function () { return
|
|
181
|
+
get: function () { return chunkXG43KEYF_cjs.LikesVisibility; }
|
|
150
182
|
});
|
|
151
183
|
Object.defineProperty(exports, "LocalStorageTokenStorage", {
|
|
152
184
|
enumerable: true,
|
|
153
|
-
get: function () { return
|
|
185
|
+
get: function () { return chunkXG43KEYF_cjs.LocalStorageTokenStorage; }
|
|
154
186
|
});
|
|
155
187
|
Object.defineProperty(exports, "MAX_RECONNECT_ATTEMPTS", {
|
|
156
188
|
enumerable: true,
|
|
157
|
-
get: function () { return
|
|
189
|
+
get: function () { return chunkXG43KEYF_cjs.MAX_RECONNECT_ATTEMPTS; }
|
|
158
190
|
});
|
|
159
191
|
Object.defineProperty(exports, "MemoryTokenStorage", {
|
|
160
192
|
enumerable: true,
|
|
161
|
-
get: function () { return
|
|
193
|
+
get: function () { return chunkXG43KEYF_cjs.MemoryTokenStorage; }
|
|
162
194
|
});
|
|
163
195
|
Object.defineProperty(exports, "NOTIFICATION_TYPE_ALIASES", {
|
|
164
196
|
enumerable: true,
|
|
165
|
-
get: function () { return
|
|
197
|
+
get: function () { return chunkXG43KEYF_cjs.NOTIFICATION_TYPE_ALIASES; }
|
|
166
198
|
});
|
|
167
199
|
Object.defineProperty(exports, "NotificationType", {
|
|
168
200
|
enumerable: true,
|
|
169
|
-
get: function () { return
|
|
201
|
+
get: function () { return chunkXG43KEYF_cjs.NotificationType; }
|
|
202
|
+
});
|
|
203
|
+
Object.defineProperty(exports, "OAuthProvider", {
|
|
204
|
+
enumerable: true,
|
|
205
|
+
get: function () { return chunkXG43KEYF_cjs.OAuthProvider; }
|
|
206
|
+
});
|
|
207
|
+
Object.defineProperty(exports, "PaginationMode", {
|
|
208
|
+
enumerable: true,
|
|
209
|
+
get: function () { return chunkXG43KEYF_cjs.PaginationMode; }
|
|
170
210
|
});
|
|
171
211
|
Object.defineProperty(exports, "Paginator", {
|
|
172
212
|
enumerable: true,
|
|
173
|
-
get: function () { return
|
|
213
|
+
get: function () { return chunkXG43KEYF_cjs.Paginator; }
|
|
174
214
|
});
|
|
175
215
|
Object.defineProperty(exports, "RECONNECT_BACKOFF", {
|
|
176
216
|
enumerable: true,
|
|
177
|
-
get: function () { return
|
|
217
|
+
get: function () { return chunkXG43KEYF_cjs.RECONNECT_BACKOFF; }
|
|
178
218
|
});
|
|
179
219
|
Object.defineProperty(exports, "RECONNECT_JITTER", {
|
|
180
220
|
enumerable: true,
|
|
181
|
-
get: function () { return
|
|
221
|
+
get: function () { return chunkXG43KEYF_cjs.RECONNECT_JITTER; }
|
|
222
|
+
});
|
|
223
|
+
Object.defineProperty(exports, "REFRESH_COOKIE", {
|
|
224
|
+
enumerable: true,
|
|
225
|
+
get: function () { return chunkXG43KEYF_cjs.REFRESH_COOKIE; }
|
|
226
|
+
});
|
|
227
|
+
Object.defineProperty(exports, "REFRESH_COOKIE_PATH", {
|
|
228
|
+
enumerable: true,
|
|
229
|
+
get: function () { return chunkXG43KEYF_cjs.REFRESH_COOKIE_PATH; }
|
|
182
230
|
});
|
|
183
231
|
Object.defineProperty(exports, "RealtimeStatus", {
|
|
184
232
|
enumerable: true,
|
|
185
|
-
get: function () { return
|
|
233
|
+
get: function () { return chunkXG43KEYF_cjs.RealtimeStatus; }
|
|
234
|
+
});
|
|
235
|
+
Object.defineProperty(exports, "RealtimeTransportKind", {
|
|
236
|
+
enumerable: true,
|
|
237
|
+
get: function () { return chunkXG43KEYF_cjs.RealtimeTransportKind; }
|
|
186
238
|
});
|
|
187
239
|
Object.defineProperty(exports, "ReportReason", {
|
|
188
240
|
enumerable: true,
|
|
189
|
-
get: function () { return
|
|
241
|
+
get: function () { return chunkXG43KEYF_cjs.ReportReason; }
|
|
190
242
|
});
|
|
191
243
|
Object.defineProperty(exports, "ReportTargetType", {
|
|
192
244
|
enumerable: true,
|
|
193
|
-
get: function () { return
|
|
245
|
+
get: function () { return chunkXG43KEYF_cjs.ReportTargetType; }
|
|
246
|
+
});
|
|
247
|
+
Object.defineProperty(exports, "RuntimeMode", {
|
|
248
|
+
enumerable: true,
|
|
249
|
+
get: function () { return chunkXG43KEYF_cjs.RuntimeMode; }
|
|
194
250
|
});
|
|
195
251
|
Object.defineProperty(exports, "STREAM_PATH", {
|
|
196
252
|
enumerable: true,
|
|
197
|
-
get: function () { return
|
|
253
|
+
get: function () { return chunkXG43KEYF_cjs.STREAM_PATH; }
|
|
254
|
+
});
|
|
255
|
+
Object.defineProperty(exports, "SignInStatus", {
|
|
256
|
+
enumerable: true,
|
|
257
|
+
get: function () { return chunkXG43KEYF_cjs.SignInStatus; }
|
|
258
|
+
});
|
|
259
|
+
Object.defineProperty(exports, "TURNSTILE_SITE_KEY", {
|
|
260
|
+
enumerable: true,
|
|
261
|
+
get: function () { return chunkXG43KEYF_cjs.TURNSTILE_SITE_KEY; }
|
|
262
|
+
});
|
|
263
|
+
Object.defineProperty(exports, "UnauthorizedStreamError", {
|
|
264
|
+
enumerable: true,
|
|
265
|
+
get: function () { return chunkXG43KEYF_cjs.UnauthorizedStreamError; }
|
|
198
266
|
});
|
|
199
267
|
Object.defineProperty(exports, "VIDEO_MIME_TYPES", {
|
|
200
268
|
enumerable: true,
|
|
201
|
-
get: function () { return
|
|
269
|
+
get: function () { return chunkXG43KEYF_cjs.VIDEO_MIME_TYPES; }
|
|
202
270
|
});
|
|
203
271
|
Object.defineProperty(exports, "WallAccess", {
|
|
204
272
|
enumerable: true,
|
|
205
|
-
get: function () { return
|
|
273
|
+
get: function () { return chunkXG43KEYF_cjs.WallAccess; }
|
|
206
274
|
});
|
|
207
275
|
Object.defineProperty(exports, "canonicalNotificationType", {
|
|
208
276
|
enumerable: true,
|
|
209
|
-
get: function () { return
|
|
277
|
+
get: function () { return chunkXG43KEYF_cjs.canonicalNotificationType; }
|
|
210
278
|
});
|
|
211
279
|
Object.defineProperty(exports, "comment", {
|
|
212
280
|
enumerable: true,
|
|
213
|
-
get: function () { return
|
|
281
|
+
get: function () { return chunkXG43KEYF_cjs.comment; }
|
|
214
282
|
});
|
|
215
283
|
Object.defineProperty(exports, "createTokenStorage", {
|
|
216
284
|
enumerable: true,
|
|
217
|
-
get: function () { return
|
|
285
|
+
get: function () { return chunkXG43KEYF_cjs.createTokenStorage; }
|
|
218
286
|
});
|
|
219
287
|
Object.defineProperty(exports, "formatNotificationText", {
|
|
220
288
|
enumerable: true,
|
|
221
|
-
get: function () { return
|
|
289
|
+
get: function () { return chunkXG43KEYF_cjs.formatNotificationText; }
|
|
222
290
|
});
|
|
223
291
|
Object.defineProperty(exports, "isBuilder", {
|
|
224
292
|
enumerable: true,
|
|
225
|
-
get: function () { return
|
|
293
|
+
get: function () { return chunkXG43KEYF_cjs.isBuilder; }
|
|
226
294
|
});
|
|
227
295
|
Object.defineProperty(exports, "isItdApiError", {
|
|
228
296
|
enumerable: true,
|
|
229
|
-
get: function () { return
|
|
297
|
+
get: function () { return chunkXG43KEYF_cjs.isItdApiError; }
|
|
230
298
|
});
|
|
231
299
|
Object.defineProperty(exports, "isItdAuthError", {
|
|
232
300
|
enumerable: true,
|
|
233
|
-
get: function () { return
|
|
301
|
+
get: function () { return chunkXG43KEYF_cjs.isItdAuthError; }
|
|
302
|
+
});
|
|
303
|
+
Object.defineProperty(exports, "isItdConflictError", {
|
|
304
|
+
enumerable: true,
|
|
305
|
+
get: function () { return chunkXG43KEYF_cjs.isItdConflictError; }
|
|
234
306
|
});
|
|
235
307
|
Object.defineProperty(exports, "isItdError", {
|
|
236
308
|
enumerable: true,
|
|
237
|
-
get: function () { return
|
|
309
|
+
get: function () { return chunkXG43KEYF_cjs.isItdError; }
|
|
310
|
+
});
|
|
311
|
+
Object.defineProperty(exports, "isItdForbiddenError", {
|
|
312
|
+
enumerable: true,
|
|
313
|
+
get: function () { return chunkXG43KEYF_cjs.isItdForbiddenError; }
|
|
314
|
+
});
|
|
315
|
+
Object.defineProperty(exports, "isItdNotFoundError", {
|
|
316
|
+
enumerable: true,
|
|
317
|
+
get: function () { return chunkXG43KEYF_cjs.isItdNotFoundError; }
|
|
318
|
+
});
|
|
319
|
+
Object.defineProperty(exports, "isItdPhoneVerificationError", {
|
|
320
|
+
enumerable: true,
|
|
321
|
+
get: function () { return chunkXG43KEYF_cjs.isItdPhoneVerificationError; }
|
|
238
322
|
});
|
|
239
323
|
Object.defineProperty(exports, "isItdRateLimitError", {
|
|
240
324
|
enumerable: true,
|
|
241
|
-
get: function () { return
|
|
325
|
+
get: function () { return chunkXG43KEYF_cjs.isItdRateLimitError; }
|
|
326
|
+
});
|
|
327
|
+
Object.defineProperty(exports, "isItdServerError", {
|
|
328
|
+
enumerable: true,
|
|
329
|
+
get: function () { return chunkXG43KEYF_cjs.isItdServerError; }
|
|
242
330
|
});
|
|
243
331
|
Object.defineProperty(exports, "isItdValidationError", {
|
|
244
332
|
enumerable: true,
|
|
245
|
-
get: function () { return
|
|
333
|
+
get: function () { return chunkXG43KEYF_cjs.isItdValidationError; }
|
|
246
334
|
});
|
|
247
335
|
Object.defineProperty(exports, "isKnownNotificationType", {
|
|
248
336
|
enumerable: true,
|
|
249
|
-
get: function () { return
|
|
337
|
+
get: function () { return chunkXG43KEYF_cjs.isKnownNotificationType; }
|
|
250
338
|
});
|
|
251
339
|
Object.defineProperty(exports, "isMyProfile", {
|
|
252
340
|
enumerable: true,
|
|
253
|
-
get: function () { return
|
|
341
|
+
get: function () { return chunkXG43KEYF_cjs.isMyProfile; }
|
|
254
342
|
});
|
|
255
343
|
Object.defineProperty(exports, "normalizeNotification", {
|
|
256
344
|
enumerable: true,
|
|
257
|
-
get: function () { return
|
|
345
|
+
get: function () { return chunkXG43KEYF_cjs.normalizeNotification; }
|
|
258
346
|
});
|
|
259
347
|
Object.defineProperty(exports, "poll", {
|
|
260
348
|
enumerable: true,
|
|
261
|
-
get: function () { return
|
|
349
|
+
get: function () { return chunkXG43KEYF_cjs.poll; }
|
|
262
350
|
});
|
|
263
351
|
Object.defineProperty(exports, "post", {
|
|
264
352
|
enumerable: true,
|
|
265
|
-
get: function () { return
|
|
353
|
+
get: function () { return chunkXG43KEYF_cjs.post; }
|
|
266
354
|
});
|
|
267
355
|
Object.defineProperty(exports, "readNotificationEvent", {
|
|
268
356
|
enumerable: true,
|
|
269
|
-
get: function () { return
|
|
357
|
+
get: function () { return chunkXG43KEYF_cjs.readNotificationEvent; }
|
|
270
358
|
});
|
|
271
359
|
Object.defineProperty(exports, "readUnreadCountEvent", {
|
|
272
360
|
enumerable: true,
|
|
273
|
-
get: function () { return
|
|
361
|
+
get: function () { return chunkXG43KEYF_cjs.readUnreadCountEvent; }
|
|
274
362
|
});
|
|
275
363
|
Object.defineProperty(exports, "report", {
|
|
276
364
|
enumerable: true,
|
|
277
|
-
get: function () { return
|
|
365
|
+
get: function () { return chunkXG43KEYF_cjs.report; }
|
|
278
366
|
});
|
|
279
367
|
Object.defineProperty(exports, "resolveNotificationUrl", {
|
|
280
368
|
enumerable: true,
|
|
281
|
-
get: function () { return
|
|
369
|
+
get: function () { return chunkXG43KEYF_cjs.resolveNotificationUrl; }
|
|
282
370
|
});
|
|
283
371
|
Object.defineProperty(exports, "toDate", {
|
|
284
372
|
enumerable: true,
|
|
285
|
-
get: function () { return
|
|
373
|
+
get: function () { return chunkXG43KEYF_cjs.toDate; }
|
|
286
374
|
});
|
|
287
375
|
exports.FileTokenStorage = FileTokenStorage;
|
|
288
376
|
exports.ItdClient = ItdClient2;
|
package/dist/node.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/node.ts"],"names":["ItdClient"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["../src/node.ts"],"names":["ItdClient"],"mappings":";;;;;AAgCO,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;AAkBO,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 * // Когда сессия уже сохранена, `auth` не нужен — токен возьмётся из хранилища.\n * const itd = new ItdClient({ storage: new FileTokenStorage('./.itd-session.json') });\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 * аккаунта. С сохранённой сессией опция `auth` не нужна вовсе.\n *\n * Файл создаётся с правами `0600` (чтение и запись только владельцу) — в нём лежат токены.\n * Запись идёт через временный файл с последующим переименованием, поэтому падение процесса\n * посреди сохранения не оставит повреждённую сессию.\n *\n * @example\n * ```ts\n * const itd = new ItdClient({ storage: new FileTokenStorage('./.itd-session.json') });\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"]}
|
package/dist/node.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TokenStorage, I as ItdSession, a as ItdClient$1, b as ItdClientOptions, F as FileReader } from './index-
|
|
2
|
-
export { A as ALLOWED_MIME_TYPES, c as AUDIO_MIME_TYPES, d as
|
|
1
|
+
import { T as TokenStorage, I as ItdSession, a as ItdClient$1, b as ItdClientOptions, F as FileReader } from './index-olL_q_yu.cjs';
|
|
2
|
+
export { A as ALLOWED_MIME_TYPES, c as AUDIO_MIME_TYPES, d as AUTH_FLAG_COOKIE, e as AUTH_PATHS, f as Actor, g as AllowedMimeType, h as Announcement, i as AnnouncementButton, j as Attachment, k as AttachmentType, l as AudioMimeType, m as AuthInput, n as AuthResource, o as Author, B as BuilderInput, C as CaptchaCredentials, p as ChangelogEntry, q as Clan, r as ClientHooks, s as Comment, t as CommentBuilder, u as CommentInput, v as CommentReplyTo, w as CommentSort, x as CommentsParams, y as CommentsResource, z as CreateCommentInput, D as CreatePollInput, E as CreatePostInput, G as CreateReportInput, H as Credentials, J as CredentialsAuth, K as DEFAULT_BASE_URL, L as DEFAULT_TIMEOUT, M as DEFAULT_USER_AGENT, N as DEVICE_ID_HEADER, O as DetectedRuntime, P as DwellEntry, Q as ErrorContextHook, R as FeedParams, S as FeedTab, U as FileInput, V as FilesResource, W as FollowResult, X as ForgotPasswordInput, Y as Hashtag, Z as HashtagPostsParams, _ as HashtagsResource, $ as IMAGE_MIME_TYPES, a0 as ImageMimeType, a1 as InteractionEntry, a2 as IsoDate, a3 as ItdAbortError, a4 as ItdApiError, a5 as ItdApiErrorInit, a6 as ItdApiErrorKind, a7 as ItdAuthError, a8 as ItdBuilder, a9 as ItdConfigError, aa as ItdConflictError, ab as ItdError, ac as ItdErrorCode, ad as ItdErrorKind, ae as ItdFieldErrors, af as ItdForbiddenError, ag as ItdNetworkError, ah as ItdNotFoundError, ai as ItdPhoneVerificationError, aj as ItdRateLimitError, ak as ItdRealtime, al as ItdServerError, am as ItdTimeoutError, an as ItdValidationError, ao as LIBRARY_VERSION, ap as LikeResult, aq as LikesVisibility, ar as Listener, as as LocalStorageTokenStorage, at as Logger, au as Loose, av as MAX_RECONNECT_ATTEMPTS, aw as MemoryTokenStorage, ax as MyProfile, ay as NOTIFICATION_TYPE_ALIASES, az as Notification, aA as NotificationEvent, aB as NotificationListParams, aC as NotificationSettings, aD as NotificationType, aE as NotificationsResource, aF as OAuthProvider, aG as Page, aH as PageState, aI as PaginationMode, aJ as Paginator, aK as PaymentMethod, aL as Pin, aM as PinPostResult, aN as PinsResult, aO as PlatformResource, aP as Poll, aQ as PollBuilder, aR as PollInput, aS as PollOption, aT as PollTransportOptions, aU as Portal, aV as Post, aW as PostBuilder, aX as PostInput, aY as PostStats, aZ as PostsResource, a_ as PrivacySettings, a$ as Profile, b0 as PublicProfile, b1 as RECONNECT_BACKOFF, b2 as RECONNECT_JITTER, b3 as REFRESH_COOKIE, b4 as REFRESH_COOKIE_PATH, b5 as RateLimitOptions, b6 as RawRequestOptions, b7 as RealtimeEvents, b8 as RealtimeOptions, b9 as RealtimeStatus, ba as RealtimeTransport, bb as RealtimeTransportKind, bc as ReconnectOptions, bd as RepliesParams, be as Report, bf as ReportBuilder, bg as ReportInput, bh as ReportReason, bi as ReportTargetType, bj as ReportsResource, bk as RequestContext, bl as RequestOptions, bm as ResetPasswordInput, bn as ResponseContext, bo as RetryContext, bp as RetryOptions, bq as RuntimeMode, br as STREAM_PATH, bs as SearchResource, bt as SearchResult, bu as Session, bv as SignInResult, bw as SignInStatus, bx as Span, by as SseTransportOptions, bz as Subscription, bA as SubscriptionResource, bB as SubscriptionState, bC as TURNSTILE_SITE_KEY, bD as TelemetryResource, bE as TransportContext, bF as TransportEvent, bG as UnauthorizedStreamError, bH as Unsubscribe, bI as UpdateNotificationSettingsInput, bJ as UpdatePrivacyInput, bK as UpdateProfileInput, bL as UploadOptions, bM as UploadedFile, bN as UserId, bO as UserListParams, bP as UserPostsParams, bQ as UserRef, bR as UserSummary, bS as UsersResource, bT as VIDEO_MIME_TYPES, bU as VerificationResource, bV as VerificationStatus, bW as VideoMimeType, bX as WallAccess, bY as canonicalNotificationType, bZ as comment, b_ as createTokenStorage, b$ as formatNotificationText, c0 as isBuilder, c1 as isItdApiError, c2 as isItdAuthError, c3 as isItdConflictError, c4 as isItdError, c5 as isItdForbiddenError, c6 as isItdNotFoundError, c7 as isItdPhoneVerificationError, c8 as isItdRateLimitError, c9 as isItdServerError, ca as isItdValidationError, cb as isKnownNotificationType, cc as isMyProfile, cd as normalizeNotification, ce as poll, cf as post, cg as readNotificationEvent, ch as readUnreadCountEvent, ci as report, cj as resolveNotificationUrl, ck as toDate } from './index-olL_q_yu.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `itd-api/node` — то же, что `itd-api`, плюс работа с файловой системой.
|
|
@@ -13,10 +13,8 @@ export { A as ALLOWED_MIME_TYPES, c as AUDIO_MIME_TYPES, d as Actor, e as Announ
|
|
|
13
13
|
* ```ts
|
|
14
14
|
* import { ItdClient, FileTokenStorage } from 'itd-api/node';
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* storage: new FileTokenStorage('./.itd-session.json'),
|
|
19
|
-
* });
|
|
16
|
+
* // Когда сессия уже сохранена, `auth` не нужен — токен возьмётся из хранилища.
|
|
17
|
+
* const itd = new ItdClient({ storage: new FileTokenStorage('./.itd-session.json') });
|
|
20
18
|
*
|
|
21
19
|
* await itd.posts.create((p) => p.content('привет').attach('./photo.jpg'));
|
|
22
20
|
* ```
|
|
@@ -34,8 +32,9 @@ declare const nodeFileReader: FileReader;
|
|
|
34
32
|
/**
|
|
35
33
|
* Хранит сессию в файле.
|
|
36
34
|
*
|
|
37
|
-
* Нужна долгоживущим процессам: без неё бот при каждом запуске входит
|
|
38
|
-
* входов подряд может привести к временной блокировке
|
|
35
|
+
* Нужна долгоживущим процессам: без неё бот при каждом запуске входит заново — а вход
|
|
36
|
+
* требует решённой капчи, да и серия входов подряд может привести к временной блокировке
|
|
37
|
+
* аккаунта. С сохранённой сессией опция `auth` не нужна вовсе.
|
|
39
38
|
*
|
|
40
39
|
* Файл создаётся с правами `0600` (чтение и запись только владельцу) — в нём лежат токены.
|
|
41
40
|
* Запись идёт через временный файл с последующим переименованием, поэтому падение процесса
|
|
@@ -43,10 +42,7 @@ declare const nodeFileReader: FileReader;
|
|
|
43
42
|
*
|
|
44
43
|
* @example
|
|
45
44
|
* ```ts
|
|
46
|
-
* const itd = new ItdClient({
|
|
47
|
-
* auth: { email, password },
|
|
48
|
-
* storage: new FileTokenStorage('./.itd-session.json'),
|
|
49
|
-
* });
|
|
45
|
+
* const itd = new ItdClient({ storage: new FileTokenStorage('./.itd-session.json') });
|
|
50
46
|
* ```
|
|
51
47
|
*/
|
|
52
48
|
declare class FileTokenStorage implements TokenStorage {
|
package/dist/node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TokenStorage, I as ItdSession, a as ItdClient$1, b as ItdClientOptions, F as FileReader } from './index-
|
|
2
|
-
export { A as ALLOWED_MIME_TYPES, c as AUDIO_MIME_TYPES, d as
|
|
1
|
+
import { T as TokenStorage, I as ItdSession, a as ItdClient$1, b as ItdClientOptions, F as FileReader } from './index-olL_q_yu.js';
|
|
2
|
+
export { A as ALLOWED_MIME_TYPES, c as AUDIO_MIME_TYPES, d as AUTH_FLAG_COOKIE, e as AUTH_PATHS, f as Actor, g as AllowedMimeType, h as Announcement, i as AnnouncementButton, j as Attachment, k as AttachmentType, l as AudioMimeType, m as AuthInput, n as AuthResource, o as Author, B as BuilderInput, C as CaptchaCredentials, p as ChangelogEntry, q as Clan, r as ClientHooks, s as Comment, t as CommentBuilder, u as CommentInput, v as CommentReplyTo, w as CommentSort, x as CommentsParams, y as CommentsResource, z as CreateCommentInput, D as CreatePollInput, E as CreatePostInput, G as CreateReportInput, H as Credentials, J as CredentialsAuth, K as DEFAULT_BASE_URL, L as DEFAULT_TIMEOUT, M as DEFAULT_USER_AGENT, N as DEVICE_ID_HEADER, O as DetectedRuntime, P as DwellEntry, Q as ErrorContextHook, R as FeedParams, S as FeedTab, U as FileInput, V as FilesResource, W as FollowResult, X as ForgotPasswordInput, Y as Hashtag, Z as HashtagPostsParams, _ as HashtagsResource, $ as IMAGE_MIME_TYPES, a0 as ImageMimeType, a1 as InteractionEntry, a2 as IsoDate, a3 as ItdAbortError, a4 as ItdApiError, a5 as ItdApiErrorInit, a6 as ItdApiErrorKind, a7 as ItdAuthError, a8 as ItdBuilder, a9 as ItdConfigError, aa as ItdConflictError, ab as ItdError, ac as ItdErrorCode, ad as ItdErrorKind, ae as ItdFieldErrors, af as ItdForbiddenError, ag as ItdNetworkError, ah as ItdNotFoundError, ai as ItdPhoneVerificationError, aj as ItdRateLimitError, ak as ItdRealtime, al as ItdServerError, am as ItdTimeoutError, an as ItdValidationError, ao as LIBRARY_VERSION, ap as LikeResult, aq as LikesVisibility, ar as Listener, as as LocalStorageTokenStorage, at as Logger, au as Loose, av as MAX_RECONNECT_ATTEMPTS, aw as MemoryTokenStorage, ax as MyProfile, ay as NOTIFICATION_TYPE_ALIASES, az as Notification, aA as NotificationEvent, aB as NotificationListParams, aC as NotificationSettings, aD as NotificationType, aE as NotificationsResource, aF as OAuthProvider, aG as Page, aH as PageState, aI as PaginationMode, aJ as Paginator, aK as PaymentMethod, aL as Pin, aM as PinPostResult, aN as PinsResult, aO as PlatformResource, aP as Poll, aQ as PollBuilder, aR as PollInput, aS as PollOption, aT as PollTransportOptions, aU as Portal, aV as Post, aW as PostBuilder, aX as PostInput, aY as PostStats, aZ as PostsResource, a_ as PrivacySettings, a$ as Profile, b0 as PublicProfile, b1 as RECONNECT_BACKOFF, b2 as RECONNECT_JITTER, b3 as REFRESH_COOKIE, b4 as REFRESH_COOKIE_PATH, b5 as RateLimitOptions, b6 as RawRequestOptions, b7 as RealtimeEvents, b8 as RealtimeOptions, b9 as RealtimeStatus, ba as RealtimeTransport, bb as RealtimeTransportKind, bc as ReconnectOptions, bd as RepliesParams, be as Report, bf as ReportBuilder, bg as ReportInput, bh as ReportReason, bi as ReportTargetType, bj as ReportsResource, bk as RequestContext, bl as RequestOptions, bm as ResetPasswordInput, bn as ResponseContext, bo as RetryContext, bp as RetryOptions, bq as RuntimeMode, br as STREAM_PATH, bs as SearchResource, bt as SearchResult, bu as Session, bv as SignInResult, bw as SignInStatus, bx as Span, by as SseTransportOptions, bz as Subscription, bA as SubscriptionResource, bB as SubscriptionState, bC as TURNSTILE_SITE_KEY, bD as TelemetryResource, bE as TransportContext, bF as TransportEvent, bG as UnauthorizedStreamError, bH as Unsubscribe, bI as UpdateNotificationSettingsInput, bJ as UpdatePrivacyInput, bK as UpdateProfileInput, bL as UploadOptions, bM as UploadedFile, bN as UserId, bO as UserListParams, bP as UserPostsParams, bQ as UserRef, bR as UserSummary, bS as UsersResource, bT as VIDEO_MIME_TYPES, bU as VerificationResource, bV as VerificationStatus, bW as VideoMimeType, bX as WallAccess, bY as canonicalNotificationType, bZ as comment, b_ as createTokenStorage, b$ as formatNotificationText, c0 as isBuilder, c1 as isItdApiError, c2 as isItdAuthError, c3 as isItdConflictError, c4 as isItdError, c5 as isItdForbiddenError, c6 as isItdNotFoundError, c7 as isItdPhoneVerificationError, c8 as isItdRateLimitError, c9 as isItdServerError, ca as isItdValidationError, cb as isKnownNotificationType, cc as isMyProfile, cd as normalizeNotification, ce as poll, cf as post, cg as readNotificationEvent, ch as readUnreadCountEvent, ci as report, cj as resolveNotificationUrl, ck as toDate } from './index-olL_q_yu.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `itd-api/node` — то же, что `itd-api`, плюс работа с файловой системой.
|
|
@@ -13,10 +13,8 @@ export { A as ALLOWED_MIME_TYPES, c as AUDIO_MIME_TYPES, d as Actor, e as Announ
|
|
|
13
13
|
* ```ts
|
|
14
14
|
* import { ItdClient, FileTokenStorage } from 'itd-api/node';
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* storage: new FileTokenStorage('./.itd-session.json'),
|
|
19
|
-
* });
|
|
16
|
+
* // Когда сессия уже сохранена, `auth` не нужен — токен возьмётся из хранилища.
|
|
17
|
+
* const itd = new ItdClient({ storage: new FileTokenStorage('./.itd-session.json') });
|
|
20
18
|
*
|
|
21
19
|
* await itd.posts.create((p) => p.content('привет').attach('./photo.jpg'));
|
|
22
20
|
* ```
|
|
@@ -34,8 +32,9 @@ declare const nodeFileReader: FileReader;
|
|
|
34
32
|
/**
|
|
35
33
|
* Хранит сессию в файле.
|
|
36
34
|
*
|
|
37
|
-
* Нужна долгоживущим процессам: без неё бот при каждом запуске входит
|
|
38
|
-
* входов подряд может привести к временной блокировке
|
|
35
|
+
* Нужна долгоживущим процессам: без неё бот при каждом запуске входит заново — а вход
|
|
36
|
+
* требует решённой капчи, да и серия входов подряд может привести к временной блокировке
|
|
37
|
+
* аккаунта. С сохранённой сессией опция `auth` не нужна вовсе.
|
|
39
38
|
*
|
|
40
39
|
* Файл создаётся с правами `0600` (чтение и запись только владельцу) — в нём лежат токены.
|
|
41
40
|
* Запись идёт через временный файл с последующим переименованием, поэтому падение процесса
|
|
@@ -43,10 +42,7 @@ declare const nodeFileReader: FileReader;
|
|
|
43
42
|
*
|
|
44
43
|
* @example
|
|
45
44
|
* ```ts
|
|
46
|
-
* const itd = new ItdClient({
|
|
47
|
-
* auth: { email, password },
|
|
48
|
-
* storage: new FileTokenStorage('./.itd-session.json'),
|
|
49
|
-
* });
|
|
45
|
+
* const itd = new ItdClient({ storage: new FileTokenStorage('./.itd-session.json') });
|
|
50
46
|
* ```
|
|
51
47
|
*/
|
|
52
48
|
declare class FileTokenStorage implements TokenStorage {
|
package/dist/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ItdClient } from './chunk-
|
|
2
|
-
export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES, AttachmentType, CommentSort, DEFAULT_BASE_URL, DEFAULT_TIMEOUT, FeedTab, IMAGE_MIME_TYPES, ItdAbortError, ItdApiError, ItdAuthError, 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, createTokenStorage, formatNotificationText, isBuilder, isItdApiError, isItdAuthError, isItdError, isItdRateLimitError, isItdValidationError, isKnownNotificationType, isMyProfile, normalizeNotification, poll, post, readNotificationEvent, readUnreadCountEvent, report, resolveNotificationUrl, toDate } from './chunk-
|
|
1
|
+
import { ItdClient } from './chunk-JV75JWOX.js';
|
|
2
|
+
export { ALLOWED_MIME_TYPES, AUDIO_MIME_TYPES, AUTH_FLAG_COOKIE, AUTH_PATHS, AttachmentType, CommentSort, DEFAULT_BASE_URL, DEFAULT_TIMEOUT, DEFAULT_USER_AGENT, DEVICE_ID_HEADER, DetectedRuntime, FeedTab, IMAGE_MIME_TYPES, ItdAbortError, ItdApiError, ItdApiErrorKind, ItdAuthError, ItdConfigError, ItdConflictError, ItdError, ItdErrorCode, ItdErrorKind, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdPhoneVerificationError, ItdRateLimitError, ItdRealtime, ItdServerError, ItdTimeoutError, ItdValidationError, LIBRARY_VERSION, LikesVisibility, LocalStorageTokenStorage, MAX_RECONNECT_ATTEMPTS, MemoryTokenStorage, NOTIFICATION_TYPE_ALIASES, NotificationType, OAuthProvider, PaginationMode, Paginator, RECONNECT_BACKOFF, RECONNECT_JITTER, REFRESH_COOKIE, REFRESH_COOKIE_PATH, RealtimeStatus, RealtimeTransportKind, ReportReason, ReportTargetType, RuntimeMode, STREAM_PATH, SignInStatus, TURNSTILE_SITE_KEY, UnauthorizedStreamError, VIDEO_MIME_TYPES, WallAccess, canonicalNotificationType, comment, createTokenStorage, formatNotificationText, isBuilder, isItdApiError, isItdAuthError, isItdConflictError, isItdError, isItdForbiddenError, isItdNotFoundError, isItdPhoneVerificationError, isItdRateLimitError, isItdServerError, isItdValidationError, isKnownNotificationType, isMyProfile, normalizeNotification, poll, post, readNotificationEvent, readUnreadCountEvent, report, resolveNotificationUrl, toDate } from './chunk-JV75JWOX.js';
|
|
3
3
|
|
|
4
4
|
// src/node.ts
|
|
5
5
|
var nodeFileReader = async (path) => {
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/node.ts"],"names":["ItdClient"],"mappings":";;;;
|
|
1
|
+
{"version":3,"sources":["../src/node.ts"],"names":["ItdClient"],"mappings":";;;;AAgCO,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;AAkBO,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,cAAwB,SAAA,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.js","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 * // Когда сессия уже сохранена, `auth` не нужен — токен возьмётся из хранилища.\n * const itd = new ItdClient({ storage: new FileTokenStorage('./.itd-session.json') });\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 * аккаунта. С сохранённой сессией опция `auth` не нужна вовсе.\n *\n * Файл создаётся с правами `0600` (чтение и запись только владельцу) — в нём лежат токены.\n * Запись идёт через временный файл с последующим переименованием, поэтому падение процесса\n * посреди сохранения не оставит повреждённую сессию.\n *\n * @example\n * ```ts\n * const itd = new ItdClient({ storage: new FileTokenStorage('./.itd-session.json') });\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"]}
|