itd-api 0.0.3 → 0.0.5
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 -25
- package/dist/{chunk-JIT55WDH.js → chunk-RUPF4X5L.js} +351 -184
- package/dist/chunk-RUPF4X5L.js.map +1 -0
- package/dist/{chunk-3ODOEKQO.cjs → chunk-YM2YUO4D.cjs} +364 -183
- package/dist/chunk-YM2YUO4D.cjs.map +1 -0
- package/dist/{index-BCuk8jNA.d.cts → index-Dv0LXpMf.d.cts} +216 -42
- package/dist/{index-BCuk8jNA.d.ts → index-Dv0LXpMf.d.ts} +216 -42
- package/dist/index.cjs +126 -70
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/node.cjs +125 -69
- 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 +7 -3
- package/dist/chunk-3ODOEKQO.cjs.map +0 -1
- package/dist/chunk-JIT55WDH.js.map +0 -1
package/dist/node.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkYM2YUO4D_cjs = require('./chunk-YM2YUO4D.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 chunkYM2YUO4D_cjs.ItdClient {
|
|
42
42
|
constructor(options = {}) {
|
|
43
43
|
super(options);
|
|
44
44
|
this.setFileReader(nodeFileReader);
|
|
@@ -50,271 +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 chunkYM2YUO4D_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 chunkYM2YUO4D_cjs.AUDIO_MIME_TYPES; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "AUTH_FLAG_COOKIE", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkYM2YUO4D_cjs.AUTH_FLAG_COOKIE; }
|
|
62
62
|
});
|
|
63
63
|
Object.defineProperty(exports, "AUTH_PATHS", {
|
|
64
64
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunkYM2YUO4D_cjs.AUTH_PATHS; }
|
|
66
66
|
});
|
|
67
67
|
Object.defineProperty(exports, "AttachmentType", {
|
|
68
68
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunkYM2YUO4D_cjs.AttachmentType; }
|
|
70
70
|
});
|
|
71
71
|
Object.defineProperty(exports, "CommentSort", {
|
|
72
72
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunkYM2YUO4D_cjs.CommentSort; }
|
|
74
74
|
});
|
|
75
75
|
Object.defineProperty(exports, "DEFAULT_BASE_URL", {
|
|
76
76
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunkYM2YUO4D_cjs.DEFAULT_BASE_URL; }
|
|
78
78
|
});
|
|
79
79
|
Object.defineProperty(exports, "DEFAULT_TIMEOUT", {
|
|
80
80
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
81
|
+
get: function () { return chunkYM2YUO4D_cjs.DEFAULT_TIMEOUT; }
|
|
82
82
|
});
|
|
83
83
|
Object.defineProperty(exports, "DEFAULT_USER_AGENT", {
|
|
84
84
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
85
|
+
get: function () { return chunkYM2YUO4D_cjs.DEFAULT_USER_AGENT; }
|
|
86
86
|
});
|
|
87
87
|
Object.defineProperty(exports, "DEVICE_ID_HEADER", {
|
|
88
88
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunkYM2YUO4D_cjs.DEVICE_ID_HEADER; }
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, "DetectedRuntime", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () { return chunkYM2YUO4D_cjs.DetectedRuntime; }
|
|
90
94
|
});
|
|
91
95
|
Object.defineProperty(exports, "FeedTab", {
|
|
92
96
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunkYM2YUO4D_cjs.FeedTab; }
|
|
94
98
|
});
|
|
95
99
|
Object.defineProperty(exports, "IMAGE_MIME_TYPES", {
|
|
96
100
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunkYM2YUO4D_cjs.IMAGE_MIME_TYPES; }
|
|
98
102
|
});
|
|
99
103
|
Object.defineProperty(exports, "ItdAbortError", {
|
|
100
104
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdAbortError; }
|
|
102
106
|
});
|
|
103
107
|
Object.defineProperty(exports, "ItdApiError", {
|
|
104
108
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdApiError; }
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(exports, "ItdApiErrorKind", {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdApiErrorKind; }
|
|
106
114
|
});
|
|
107
115
|
Object.defineProperty(exports, "ItdAuthError", {
|
|
108
116
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdAuthError; }
|
|
110
118
|
});
|
|
111
119
|
Object.defineProperty(exports, "ItdConfigError", {
|
|
112
120
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdConfigError; }
|
|
114
122
|
});
|
|
115
123
|
Object.defineProperty(exports, "ItdConflictError", {
|
|
116
124
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdConflictError; }
|
|
118
126
|
});
|
|
119
127
|
Object.defineProperty(exports, "ItdError", {
|
|
120
128
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
129
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdError; }
|
|
122
130
|
});
|
|
123
131
|
Object.defineProperty(exports, "ItdErrorCode", {
|
|
124
132
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdErrorCode; }
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(exports, "ItdErrorKind", {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdErrorKind; }
|
|
126
138
|
});
|
|
127
139
|
Object.defineProperty(exports, "ItdForbiddenError", {
|
|
128
140
|
enumerable: true,
|
|
129
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdForbiddenError; }
|
|
130
142
|
});
|
|
131
143
|
Object.defineProperty(exports, "ItdNetworkError", {
|
|
132
144
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdNetworkError; }
|
|
134
146
|
});
|
|
135
147
|
Object.defineProperty(exports, "ItdNotFoundError", {
|
|
136
148
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
149
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdNotFoundError; }
|
|
138
150
|
});
|
|
139
151
|
Object.defineProperty(exports, "ItdPhoneVerificationError", {
|
|
140
152
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
153
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdPhoneVerificationError; }
|
|
142
154
|
});
|
|
143
155
|
Object.defineProperty(exports, "ItdRateLimitError", {
|
|
144
156
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
157
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdRateLimitError; }
|
|
146
158
|
});
|
|
147
159
|
Object.defineProperty(exports, "ItdRealtime", {
|
|
148
160
|
enumerable: true,
|
|
149
|
-
get: function () { return
|
|
161
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdRealtime; }
|
|
150
162
|
});
|
|
151
163
|
Object.defineProperty(exports, "ItdServerError", {
|
|
152
164
|
enumerable: true,
|
|
153
|
-
get: function () { return
|
|
165
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdServerError; }
|
|
154
166
|
});
|
|
155
167
|
Object.defineProperty(exports, "ItdTimeoutError", {
|
|
156
168
|
enumerable: true,
|
|
157
|
-
get: function () { return
|
|
169
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdTimeoutError; }
|
|
158
170
|
});
|
|
159
171
|
Object.defineProperty(exports, "ItdValidationError", {
|
|
160
172
|
enumerable: true,
|
|
161
|
-
get: function () { return
|
|
173
|
+
get: function () { return chunkYM2YUO4D_cjs.ItdValidationError; }
|
|
162
174
|
});
|
|
163
175
|
Object.defineProperty(exports, "LIBRARY_VERSION", {
|
|
164
176
|
enumerable: true,
|
|
165
|
-
get: function () { return
|
|
177
|
+
get: function () { return chunkYM2YUO4D_cjs.LIBRARY_VERSION; }
|
|
166
178
|
});
|
|
167
179
|
Object.defineProperty(exports, "LikesVisibility", {
|
|
168
180
|
enumerable: true,
|
|
169
|
-
get: function () { return
|
|
181
|
+
get: function () { return chunkYM2YUO4D_cjs.LikesVisibility; }
|
|
170
182
|
});
|
|
171
183
|
Object.defineProperty(exports, "LocalStorageTokenStorage", {
|
|
172
184
|
enumerable: true,
|
|
173
|
-
get: function () { return
|
|
185
|
+
get: function () { return chunkYM2YUO4D_cjs.LocalStorageTokenStorage; }
|
|
174
186
|
});
|
|
175
187
|
Object.defineProperty(exports, "MAX_RECONNECT_ATTEMPTS", {
|
|
176
188
|
enumerable: true,
|
|
177
|
-
get: function () { return
|
|
189
|
+
get: function () { return chunkYM2YUO4D_cjs.MAX_RECONNECT_ATTEMPTS; }
|
|
178
190
|
});
|
|
179
191
|
Object.defineProperty(exports, "MemoryTokenStorage", {
|
|
180
192
|
enumerable: true,
|
|
181
|
-
get: function () { return
|
|
193
|
+
get: function () { return chunkYM2YUO4D_cjs.MemoryTokenStorage; }
|
|
182
194
|
});
|
|
183
195
|
Object.defineProperty(exports, "NOTIFICATION_TYPE_ALIASES", {
|
|
184
196
|
enumerable: true,
|
|
185
|
-
get: function () { return
|
|
197
|
+
get: function () { return chunkYM2YUO4D_cjs.NOTIFICATION_TYPE_ALIASES; }
|
|
186
198
|
});
|
|
187
199
|
Object.defineProperty(exports, "NotificationType", {
|
|
188
200
|
enumerable: true,
|
|
189
|
-
get: function () { return
|
|
201
|
+
get: function () { return chunkYM2YUO4D_cjs.NotificationType; }
|
|
202
|
+
});
|
|
203
|
+
Object.defineProperty(exports, "OAuthProvider", {
|
|
204
|
+
enumerable: true,
|
|
205
|
+
get: function () { return chunkYM2YUO4D_cjs.OAuthProvider; }
|
|
206
|
+
});
|
|
207
|
+
Object.defineProperty(exports, "PaginationMode", {
|
|
208
|
+
enumerable: true,
|
|
209
|
+
get: function () { return chunkYM2YUO4D_cjs.PaginationMode; }
|
|
190
210
|
});
|
|
191
211
|
Object.defineProperty(exports, "Paginator", {
|
|
192
212
|
enumerable: true,
|
|
193
|
-
get: function () { return
|
|
213
|
+
get: function () { return chunkYM2YUO4D_cjs.Paginator; }
|
|
194
214
|
});
|
|
195
215
|
Object.defineProperty(exports, "RECONNECT_BACKOFF", {
|
|
196
216
|
enumerable: true,
|
|
197
|
-
get: function () { return
|
|
217
|
+
get: function () { return chunkYM2YUO4D_cjs.RECONNECT_BACKOFF; }
|
|
198
218
|
});
|
|
199
219
|
Object.defineProperty(exports, "RECONNECT_JITTER", {
|
|
200
220
|
enumerable: true,
|
|
201
|
-
get: function () { return
|
|
221
|
+
get: function () { return chunkYM2YUO4D_cjs.RECONNECT_JITTER; }
|
|
202
222
|
});
|
|
203
223
|
Object.defineProperty(exports, "REFRESH_COOKIE", {
|
|
204
224
|
enumerable: true,
|
|
205
|
-
get: function () { return
|
|
225
|
+
get: function () { return chunkYM2YUO4D_cjs.REFRESH_COOKIE; }
|
|
206
226
|
});
|
|
207
227
|
Object.defineProperty(exports, "REFRESH_COOKIE_PATH", {
|
|
208
228
|
enumerable: true,
|
|
209
|
-
get: function () { return
|
|
229
|
+
get: function () { return chunkYM2YUO4D_cjs.REFRESH_COOKIE_PATH; }
|
|
210
230
|
});
|
|
211
231
|
Object.defineProperty(exports, "RealtimeStatus", {
|
|
212
232
|
enumerable: true,
|
|
213
|
-
get: function () { return
|
|
233
|
+
get: function () { return chunkYM2YUO4D_cjs.RealtimeStatus; }
|
|
234
|
+
});
|
|
235
|
+
Object.defineProperty(exports, "RealtimeTransportKind", {
|
|
236
|
+
enumerable: true,
|
|
237
|
+
get: function () { return chunkYM2YUO4D_cjs.RealtimeTransportKind; }
|
|
214
238
|
});
|
|
215
239
|
Object.defineProperty(exports, "ReportReason", {
|
|
216
240
|
enumerable: true,
|
|
217
|
-
get: function () { return
|
|
241
|
+
get: function () { return chunkYM2YUO4D_cjs.ReportReason; }
|
|
218
242
|
});
|
|
219
243
|
Object.defineProperty(exports, "ReportTargetType", {
|
|
220
244
|
enumerable: true,
|
|
221
|
-
get: function () { return
|
|
245
|
+
get: function () { return chunkYM2YUO4D_cjs.ReportTargetType; }
|
|
246
|
+
});
|
|
247
|
+
Object.defineProperty(exports, "RuntimeMode", {
|
|
248
|
+
enumerable: true,
|
|
249
|
+
get: function () { return chunkYM2YUO4D_cjs.RuntimeMode; }
|
|
222
250
|
});
|
|
223
251
|
Object.defineProperty(exports, "STREAM_PATH", {
|
|
224
252
|
enumerable: true,
|
|
225
|
-
get: function () { return
|
|
253
|
+
get: function () { return chunkYM2YUO4D_cjs.STREAM_PATH; }
|
|
254
|
+
});
|
|
255
|
+
Object.defineProperty(exports, "SignInStatus", {
|
|
256
|
+
enumerable: true,
|
|
257
|
+
get: function () { return chunkYM2YUO4D_cjs.SignInStatus; }
|
|
226
258
|
});
|
|
227
259
|
Object.defineProperty(exports, "TURNSTILE_SITE_KEY", {
|
|
228
260
|
enumerable: true,
|
|
229
|
-
get: function () { return
|
|
261
|
+
get: function () { return chunkYM2YUO4D_cjs.TURNSTILE_SITE_KEY; }
|
|
262
|
+
});
|
|
263
|
+
Object.defineProperty(exports, "UnauthorizedStreamError", {
|
|
264
|
+
enumerable: true,
|
|
265
|
+
get: function () { return chunkYM2YUO4D_cjs.UnauthorizedStreamError; }
|
|
230
266
|
});
|
|
231
267
|
Object.defineProperty(exports, "VIDEO_MIME_TYPES", {
|
|
232
268
|
enumerable: true,
|
|
233
|
-
get: function () { return
|
|
269
|
+
get: function () { return chunkYM2YUO4D_cjs.VIDEO_MIME_TYPES; }
|
|
234
270
|
});
|
|
235
271
|
Object.defineProperty(exports, "WallAccess", {
|
|
236
272
|
enumerable: true,
|
|
237
|
-
get: function () { return
|
|
273
|
+
get: function () { return chunkYM2YUO4D_cjs.WallAccess; }
|
|
238
274
|
});
|
|
239
275
|
Object.defineProperty(exports, "canonicalNotificationType", {
|
|
240
276
|
enumerable: true,
|
|
241
|
-
get: function () { return
|
|
277
|
+
get: function () { return chunkYM2YUO4D_cjs.canonicalNotificationType; }
|
|
242
278
|
});
|
|
243
279
|
Object.defineProperty(exports, "comment", {
|
|
244
280
|
enumerable: true,
|
|
245
|
-
get: function () { return
|
|
281
|
+
get: function () { return chunkYM2YUO4D_cjs.comment; }
|
|
246
282
|
});
|
|
247
283
|
Object.defineProperty(exports, "createTokenStorage", {
|
|
248
284
|
enumerable: true,
|
|
249
|
-
get: function () { return
|
|
285
|
+
get: function () { return chunkYM2YUO4D_cjs.createTokenStorage; }
|
|
250
286
|
});
|
|
251
287
|
Object.defineProperty(exports, "formatNotificationText", {
|
|
252
288
|
enumerable: true,
|
|
253
|
-
get: function () { return
|
|
289
|
+
get: function () { return chunkYM2YUO4D_cjs.formatNotificationText; }
|
|
254
290
|
});
|
|
255
291
|
Object.defineProperty(exports, "isBuilder", {
|
|
256
292
|
enumerable: true,
|
|
257
|
-
get: function () { return
|
|
293
|
+
get: function () { return chunkYM2YUO4D_cjs.isBuilder; }
|
|
258
294
|
});
|
|
259
295
|
Object.defineProperty(exports, "isItdApiError", {
|
|
260
296
|
enumerable: true,
|
|
261
|
-
get: function () { return
|
|
297
|
+
get: function () { return chunkYM2YUO4D_cjs.isItdApiError; }
|
|
262
298
|
});
|
|
263
299
|
Object.defineProperty(exports, "isItdAuthError", {
|
|
264
300
|
enumerable: true,
|
|
265
|
-
get: function () { return
|
|
301
|
+
get: function () { return chunkYM2YUO4D_cjs.isItdAuthError; }
|
|
302
|
+
});
|
|
303
|
+
Object.defineProperty(exports, "isItdConflictError", {
|
|
304
|
+
enumerable: true,
|
|
305
|
+
get: function () { return chunkYM2YUO4D_cjs.isItdConflictError; }
|
|
266
306
|
});
|
|
267
307
|
Object.defineProperty(exports, "isItdError", {
|
|
268
308
|
enumerable: true,
|
|
269
|
-
get: function () { return
|
|
309
|
+
get: function () { return chunkYM2YUO4D_cjs.isItdError; }
|
|
310
|
+
});
|
|
311
|
+
Object.defineProperty(exports, "isItdForbiddenError", {
|
|
312
|
+
enumerable: true,
|
|
313
|
+
get: function () { return chunkYM2YUO4D_cjs.isItdForbiddenError; }
|
|
314
|
+
});
|
|
315
|
+
Object.defineProperty(exports, "isItdNotFoundError", {
|
|
316
|
+
enumerable: true,
|
|
317
|
+
get: function () { return chunkYM2YUO4D_cjs.isItdNotFoundError; }
|
|
318
|
+
});
|
|
319
|
+
Object.defineProperty(exports, "isItdPhoneVerificationError", {
|
|
320
|
+
enumerable: true,
|
|
321
|
+
get: function () { return chunkYM2YUO4D_cjs.isItdPhoneVerificationError; }
|
|
270
322
|
});
|
|
271
323
|
Object.defineProperty(exports, "isItdRateLimitError", {
|
|
272
324
|
enumerable: true,
|
|
273
|
-
get: function () { return
|
|
325
|
+
get: function () { return chunkYM2YUO4D_cjs.isItdRateLimitError; }
|
|
326
|
+
});
|
|
327
|
+
Object.defineProperty(exports, "isItdServerError", {
|
|
328
|
+
enumerable: true,
|
|
329
|
+
get: function () { return chunkYM2YUO4D_cjs.isItdServerError; }
|
|
274
330
|
});
|
|
275
331
|
Object.defineProperty(exports, "isItdValidationError", {
|
|
276
332
|
enumerable: true,
|
|
277
|
-
get: function () { return
|
|
333
|
+
get: function () { return chunkYM2YUO4D_cjs.isItdValidationError; }
|
|
278
334
|
});
|
|
279
335
|
Object.defineProperty(exports, "isKnownNotificationType", {
|
|
280
336
|
enumerable: true,
|
|
281
|
-
get: function () { return
|
|
337
|
+
get: function () { return chunkYM2YUO4D_cjs.isKnownNotificationType; }
|
|
282
338
|
});
|
|
283
339
|
Object.defineProperty(exports, "isMyProfile", {
|
|
284
340
|
enumerable: true,
|
|
285
|
-
get: function () { return
|
|
341
|
+
get: function () { return chunkYM2YUO4D_cjs.isMyProfile; }
|
|
286
342
|
});
|
|
287
343
|
Object.defineProperty(exports, "normalizeNotification", {
|
|
288
344
|
enumerable: true,
|
|
289
|
-
get: function () { return
|
|
345
|
+
get: function () { return chunkYM2YUO4D_cjs.normalizeNotification; }
|
|
290
346
|
});
|
|
291
347
|
Object.defineProperty(exports, "poll", {
|
|
292
348
|
enumerable: true,
|
|
293
|
-
get: function () { return
|
|
349
|
+
get: function () { return chunkYM2YUO4D_cjs.poll; }
|
|
294
350
|
});
|
|
295
351
|
Object.defineProperty(exports, "post", {
|
|
296
352
|
enumerable: true,
|
|
297
|
-
get: function () { return
|
|
353
|
+
get: function () { return chunkYM2YUO4D_cjs.post; }
|
|
298
354
|
});
|
|
299
355
|
Object.defineProperty(exports, "readNotificationEvent", {
|
|
300
356
|
enumerable: true,
|
|
301
|
-
get: function () { return
|
|
357
|
+
get: function () { return chunkYM2YUO4D_cjs.readNotificationEvent; }
|
|
302
358
|
});
|
|
303
359
|
Object.defineProperty(exports, "readUnreadCountEvent", {
|
|
304
360
|
enumerable: true,
|
|
305
|
-
get: function () { return
|
|
361
|
+
get: function () { return chunkYM2YUO4D_cjs.readUnreadCountEvent; }
|
|
306
362
|
});
|
|
307
363
|
Object.defineProperty(exports, "report", {
|
|
308
364
|
enumerable: true,
|
|
309
|
-
get: function () { return
|
|
365
|
+
get: function () { return chunkYM2YUO4D_cjs.report; }
|
|
310
366
|
});
|
|
311
367
|
Object.defineProperty(exports, "resolveNotificationUrl", {
|
|
312
368
|
enumerable: true,
|
|
313
|
-
get: function () { return
|
|
369
|
+
get: function () { return chunkYM2YUO4D_cjs.resolveNotificationUrl; }
|
|
314
370
|
});
|
|
315
371
|
Object.defineProperty(exports, "toDate", {
|
|
316
372
|
enumerable: true,
|
|
317
|
-
get: function () { return
|
|
373
|
+
get: function () { return chunkYM2YUO4D_cjs.toDate; }
|
|
318
374
|
});
|
|
319
375
|
exports.FileTokenStorage = FileTokenStorage;
|
|
320
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 AUTH_FLAG_COOKIE, e as AUTH_PATHS, f as Actor, g as
|
|
1
|
+
import { T as TokenStorage, I as ItdSession, a as ItdClient$1, b as ItdClientOptions, F as FileReader } from './index-Dv0LXpMf.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-Dv0LXpMf.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 AUTH_FLAG_COOKIE,
|
|
|
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 AUTH_FLAG_COOKIE, e as AUTH_PATHS, f as Actor, g as
|
|
1
|
+
import { T as TokenStorage, I as ItdSession, a as ItdClient$1, b as ItdClientOptions, F as FileReader } from './index-Dv0LXpMf.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-Dv0LXpMf.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 AUTH_FLAG_COOKIE,
|
|
|
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, AUTH_FLAG_COOKIE, AUTH_PATHS, AttachmentType, CommentSort, DEFAULT_BASE_URL, DEFAULT_TIMEOUT, DEFAULT_USER_AGENT, DEVICE_ID_HEADER, FeedTab, IMAGE_MIME_TYPES, ItdAbortError, ItdApiError, ItdAuthError, ItdConfigError, ItdConflictError, ItdError, ItdErrorCode, ItdForbiddenError, ItdNetworkError, ItdNotFoundError, ItdPhoneVerificationError, ItdRateLimitError, ItdRealtime, ItdServerError, ItdTimeoutError, ItdValidationError, LIBRARY_VERSION, LikesVisibility, LocalStorageTokenStorage, MAX_RECONNECT_ATTEMPTS, MemoryTokenStorage, NOTIFICATION_TYPE_ALIASES, NotificationType, Paginator, RECONNECT_BACKOFF, RECONNECT_JITTER, REFRESH_COOKIE, REFRESH_COOKIE_PATH, RealtimeStatus, ReportReason, ReportTargetType, STREAM_PATH, TURNSTILE_SITE_KEY, 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-RUPF4X5L.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-RUPF4X5L.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"]}
|