wikiscript 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js ADDED
@@ -0,0 +1,599 @@
1
+ //#region src/lib/client.ts
2
+ var Client = class Client {
3
+ api;
4
+ cookies = [];
5
+ options;
6
+ constructor(api, options) {
7
+ if (typeof api === "string") this.api = new URL(api);
8
+ else this.api = api;
9
+ this.options = options || {};
10
+ }
11
+ static formData(params) {
12
+ return Object.entries(params).reduce((form, [key, value]) => {
13
+ form.set(key, value);
14
+ return form;
15
+ }, new FormData());
16
+ }
17
+ static searchParams(params) {
18
+ return Object.entries(params).reduce((result, [key, value]) => {
19
+ if (Array.isArray(value)) value = value.join("|");
20
+ switch (typeof value) {
21
+ case "string":
22
+ result.set(key, value);
23
+ break;
24
+ case "boolean":
25
+ result.set(key, value ? "1" : "0");
26
+ break;
27
+ default: result.set(key, `${value}`);
28
+ }
29
+ return result;
30
+ }, new URLSearchParams());
31
+ }
32
+ async get(params, options) {
33
+ const searchParams = Client.searchParams(params);
34
+ return (await this.request(`${this.api}?${searchParams}`, options)).json();
35
+ }
36
+ async post(params, options = {}) {
37
+ let body;
38
+ switch (options.headers["content-type"]) {
39
+ case "application/x-www-form-urlencoded":
40
+ body = Client.searchParams(params);
41
+ break;
42
+ case "multipart/form-data":
43
+ body = Client.formData(params);
44
+ break;
45
+ default:
46
+ body = JSON.stringify(params);
47
+ break;
48
+ }
49
+ options = Object.assign({}, options, {
50
+ body,
51
+ method: "post"
52
+ });
53
+ return (await this.request(this.api, options)).json();
54
+ }
55
+ async request(url, options = {}) {
56
+ const headers = Object.assign({}, this.options.headers || {}, options.headers || {}, { cookie: this.cookies.join(",") });
57
+ options = Object.assign({}, options, { headers });
58
+ const req = await fetch(url, options);
59
+ this.cookies = this.cookies.concat(req.headers.getSetCookie());
60
+ return req;
61
+ }
62
+ };
63
+
64
+ //#endregion
65
+ //#region src/lib/wiki.ts
66
+ var Wiki = class {
67
+ client;
68
+ cachedTokens = {};
69
+ constructor(url, options) {
70
+ this.client = new Client(url, options);
71
+ }
72
+ async action(params, options = {}) {
73
+ const defaults = {
74
+ format: "json",
75
+ formatversion: 2
76
+ };
77
+ if (!options.token) defaults.token = await this.csrfToken();
78
+ params = Object.assign(options, defaults, params);
79
+ return await this.client.post(params);
80
+ }
81
+ /**
82
+ * Enumerate all categories.
83
+ * @see https://www.mediawiki.org/wiki/API:Allcategories
84
+ */
85
+ allcategories(params) {
86
+ return this.query(params, { list: "allcategories" });
87
+ }
88
+ /**
89
+ * List all deleted revisions by a user or in a namespace.
90
+ * @see https://www.mediawiki.org/wiki/API:Alldeletedrevisions
91
+ */
92
+ alldeletedrevisions(params) {
93
+ return this.query(params, { list: "alldeletedrevisions" });
94
+ }
95
+ /**
96
+ * List all file usages, including non-existing.
97
+ * @see https://www.mediawiki.org/wiki/API:Allfileusages
98
+ */
99
+ allfileusages(params) {
100
+ return this.query(params, { list: "allfileusages" });
101
+ }
102
+ /**
103
+ * Enumerate all images sequentially.
104
+ * @see https://www.mediawiki.org/wiki/API:Allimages
105
+ */
106
+ allimages(params) {
107
+ return this.query(params, { list: "allimages" });
108
+ }
109
+ /**
110
+ * Enumerate all links that point to a given namespace.
111
+ * @see https://www.mediawiki.org/wiki/API:Alllinks
112
+ */
113
+ alllinks(params) {
114
+ return this.query(params, { list: "alllinks" });
115
+ }
116
+ /**
117
+ * Returns messages from the site.
118
+ * @see https://www.mediawiki.org/wiki/API:Allmessages
119
+ */
120
+ async allmessages(params) {
121
+ return (await this.query(params, { meta: "allmessages" })).query.allmessages;
122
+ }
123
+ /**
124
+ * Enumerate all pages sequentially in a given namespace.
125
+ * @see https://www.mediawiki.org/wiki/API:Allpages
126
+ */
127
+ allpages(params) {
128
+ return this.query(params, { list: "allpages" });
129
+ }
130
+ /**
131
+ * List all redirects to a namespace.
132
+ * @see https://www.mediawiki.org/wiki/API:Allredirects
133
+ */
134
+ allredirects(params) {
135
+ return this.query(params, { list: "allredirects" });
136
+ }
137
+ /**
138
+ * List all revisions.
139
+ * @see https://www.mediawiki.org/wiki/API:Allrevisions
140
+ */
141
+ allrevisions(params) {
142
+ return this.query(params, { list: "allrevisions" });
143
+ }
144
+ /**
145
+ * List all transclusions (pages embedded using `{{x}}`), including non-existing.
146
+ * @see https://www.mediawiki.org/wiki/API:Alltransclusions
147
+ */
148
+ alltransclusions(params) {
149
+ return this.query(params, { list: "alltransclusions" });
150
+ }
151
+ /**
152
+ * Enumerate all registered users.
153
+ * @see https://www.mediawiki.org/wiki/API:Allusers
154
+ */
155
+ allusers(params) {
156
+ return this.query(params, { list: "allusers" });
157
+ }
158
+ /**
159
+ * Find all pages that link to the given page.
160
+ * @see https://www.mediawiki.org/wiki/API:Backlinks
161
+ */
162
+ backlinks(params) {
163
+ return this.query(params, { list: "backlinks" });
164
+ }
165
+ /**
166
+ * Block a user.
167
+ */
168
+ async block(params) {
169
+ return (await this.action(params, { action: "block" })).block;
170
+ }
171
+ /**
172
+ * List all blocked users and IP addresses.
173
+ * @see https://www.mediawiki.org/wiki/API:Blocks
174
+ */
175
+ blocks(params) {
176
+ return this.query(params, { list: "blocks" });
177
+ }
178
+ /**
179
+ * List all categories the pages belong to.
180
+ * @see https://www.mediawiki.org/wiki/API:Categories
181
+ */
182
+ categories(params) {
183
+ return this.query(params, { prop: "categories" });
184
+ }
185
+ /**
186
+ * Returns information about the given categories.
187
+ * @see https://www.mediawiki.org/wiki/API:Categoryinfo
188
+ */
189
+ categoryinfo(params) {
190
+ return this.query(params, { prop: "categoryinfo" });
191
+ }
192
+ /**
193
+ * List all pages in a given category.
194
+ * @see https://www.mediawiki.org/wiki/API:Categorymembers
195
+ */
196
+ categorymembers(params) {
197
+ return this.query(params, { list: "categorymembers" });
198
+ }
199
+ /**
200
+ * Get the list of logged-in contributors (including temporary users) and the count of
201
+ * logged-out contributors to a page.
202
+ * @see https://www.mediawiki.org/wiki/API:Contributors
203
+ */
204
+ contributors(params) {
205
+ return this.query(params, { prop: "contributors" });
206
+ }
207
+ async csrfToken(force = false) {
208
+ return (await this.tokens("csrf", force)).csrftoken;
209
+ }
210
+ /**
211
+ * Get deleted revision information.
212
+ * @see https://www.mediawiki.org/wiki/API:Deletedrevisions
213
+ */
214
+ deletedrevisions(params) {
215
+ return this.query(params, { prop: "deletedrevisions" });
216
+ }
217
+ /**
218
+ * List all files that are duplicates of the given files based on hash values.
219
+ * @see https://www.mediawiki.org/wiki/API:Duplicatefiles
220
+ */
221
+ duplicatefiles(params) {
222
+ return this.query(params, { prop: "duplicatefiles" });
223
+ }
224
+ /**
225
+ * Create and edit pages.
226
+ */
227
+ async edit(params) {
228
+ return (await this.action(params, {
229
+ action: "edit",
230
+ assert: params.bot ? "bot" : "user"
231
+ })).edit;
232
+ }
233
+ /**
234
+ * Find all pages that embed (transclude) the given title.
235
+ * @see https://www.mediawiki.org/wiki/API:Embeddedin
236
+ */
237
+ embeddedin(params) {
238
+ return this.query(params, { list: "embeddedin" });
239
+ }
240
+ /**
241
+ * Returns all external URLs (not interwikis) from the given pages.
242
+ * @see https://www.mediawiki.org/wiki/API:Extlinks
243
+ */
244
+ extlinks(params) {
245
+ return this.query(params, { prop: "extlinks" });
246
+ }
247
+ /**
248
+ * Enumerate pages that contain a given URL.
249
+ * @see https://www.mediawiki.org/wiki/API:Exturlusage
250
+ */
251
+ exturlusage(params) {
252
+ return this.query(params, { list: "exturlusage" });
253
+ }
254
+ /**
255
+ * Enumerate all deleted files sequentially.
256
+ * @see https://www.mediawiki.org/wiki/API:Filearchive
257
+ */
258
+ filearchive(params) {
259
+ return this.query(params, { list: "filearchive" });
260
+ }
261
+ /**
262
+ * Return meta information about image repositories configured on the wiki.
263
+ * @see https://www.mediawiki.org/wiki/API:Filerepoinfo
264
+ */
265
+ async filerepoinfo(params) {
266
+ return (await this.query(params, { meta: "filerepoinfo" })).query.repos;
267
+ }
268
+ /**
269
+ * Find all pages that use the given files.
270
+ * @see https://www.mediawiki.org/wiki/API:Fileusage
271
+ */
272
+ fileusage(params) {
273
+ return this.query(params, { prop: "fileusage" });
274
+ }
275
+ /**
276
+ * Get the list of pages to work on by executing the specified query module.
277
+ * @see https://www.mediawiki.org/wiki/API:Query#Generators
278
+ */
279
+ generate(params) {
280
+ return this.query(params);
281
+ }
282
+ /**
283
+ * Returns global image usage for a certain image.
284
+ * @see https://www.mediawiki.org/wiki/API:Globalusage
285
+ */
286
+ globalusage(params) {
287
+ return this.query(params, { prop: "globalusage" });
288
+ }
289
+ /**
290
+ * Returns file information and upload history.
291
+ * @see https://www.mediawiki.org/wiki/API:Imageinfo
292
+ */
293
+ imageinfo(params) {
294
+ return this.query(params, { prop: "imageinfo" });
295
+ }
296
+ /**
297
+ * Return all files contained on the given pages.
298
+ * @see https://www.mediawiki.org/wiki/API:Images
299
+ */
300
+ images(params) {
301
+ return this.query(params, { prop: "images" });
302
+ }
303
+ /**
304
+ * Find all pages that use the given image title.
305
+ * @see https://www.mediawiki.org/wiki/API:Imageusage
306
+ */
307
+ imageusage(params) {
308
+ return this.query(params, { list: "imageusage" });
309
+ }
310
+ /**
311
+ * Get basic page information.
312
+ * @see https://www.mediawiki.org/wiki/API:Info
313
+ */
314
+ info(params) {
315
+ return this.query(params, { prop: "info" });
316
+ }
317
+ /**
318
+ * Find all pages that link to the given interwiki link.
319
+ * Can be used to find all links with a prefix, or all links to a title (with a given prefix).
320
+ * Using neither parameter is effectively "all interwiki links".
321
+ * @see https://www.mediawiki.org/wiki/API:Iwbacklinks
322
+ */
323
+ iwbacklinks(params) {
324
+ return this.query(params, { list: "iwbacklinks" });
325
+ }
326
+ /**
327
+ * Returns all interwiki links from the given pages.
328
+ * @see https://www.mediawiki.org/wiki/API:Iwlinks
329
+ */
330
+ iwlinks(params) {
331
+ return this.query(params, { prop: "iwlinks" });
332
+ }
333
+ /**
334
+ * Find all pages thast link to the given language link.
335
+ * Can be used to find all links with a language code, or all links to a title (with a given language).
336
+ * Using neither parameter is effectively "all language links".
337
+ * @see https://www.mediawiki.org/wiki/API:Langbacklinks
338
+ */
339
+ langbacklinks(params) {
340
+ return this.query(params, { list: "langbacklinks" });
341
+ }
342
+ /**
343
+ * Returns all interlanguage links from the given pages.
344
+ * @see https://www.mediawiki.org/wiki/API:Langlinks
345
+ */
346
+ langlinks(params) {
347
+ return this.query(params, { prop: "langlinks" });
348
+ }
349
+ /**
350
+ * Returns all links from the given pages.
351
+ * @see https://www.mediawiki.org/wiki/API:Links
352
+ */
353
+ links(params) {
354
+ return this.query(params, { prop: "links" });
355
+ }
356
+ /**
357
+ * Find all pages that link to the given pages.
358
+ * @see https://www.mediawiki.org/wiki/API:Linkshere
359
+ */
360
+ linkshere(params) {
361
+ return this.query(params, { prop: "linkshere" });
362
+ }
363
+ /**
364
+ * Get events from logs.
365
+ * @see https://www.mediawiki.org/wiki/API:Logevents
366
+ */
367
+ logevents(params) {
368
+ return this.query(params, { list: "logevents" });
369
+ }
370
+ /**
371
+ * Log in and get authentication tokens.
372
+ *
373
+ * This action should only be used in combination with Special:BotPasswords.
374
+ *
375
+ * This will modify your "Wiki" instance, and all next requests will be authenticated.
376
+ * @see https://www.mediawiki.org/wiki/API:Login
377
+ */
378
+ async login(username, password) {
379
+ const tokens = await this.tokens("login");
380
+ const params = {
381
+ action: "login",
382
+ format: "json",
383
+ formatversion: "2",
384
+ lgname: username,
385
+ lgpassword: password,
386
+ lgtoken: tokens.logintoken
387
+ };
388
+ return (await this.client.post(params, { headers: { "content-type": "application/x-www-form-urlencoded" } })).login;
389
+ }
390
+ /**
391
+ * Log out and clear session data.
392
+ */
393
+ async logout() {
394
+ const params = {
395
+ action: "logout",
396
+ token: await this.csrfToken()
397
+ };
398
+ await this.client.post(params, { headers: { "content-type": "application/x-www-form-urlencoded" } });
399
+ }
400
+ /**
401
+ * List all page property names in use on the wiki.
402
+ * @see https://www.mediawiki.org/wiki/API:Pagepropnames
403
+ */
404
+ pagepropnames(params) {
405
+ return this.query(params, { list: "pagepropnames" });
406
+ }
407
+ /**
408
+ * Get various page properties defined in the page content.
409
+ * @see https://www.mediawiki.org/wiki/API:Pageprops
410
+ */
411
+ pageprops(params) {
412
+ return this.query(params, { prop: "pageprops" });
413
+ }
414
+ /**
415
+ * List all pages using a given page property.
416
+ * @see https://www.mediawiki.org/wiki/API:Pageswithprop
417
+ */
418
+ pageswithprop(params) {
419
+ return this.query(params, { list: "pageswithprop" });
420
+ }
421
+ /**
422
+ * Perform a prefix search for page titles.
423
+ * @see https://www.mediawiki.org/wiki/API:Prefixsearch
424
+ */
425
+ prefixsearch(params) {
426
+ return this.query(params, { list: "prefixsearch" });
427
+ }
428
+ /**
429
+ * List all titles protected from creation.
430
+ * @see https://www.mediawiki.org/wiki/API:Protectedtitles
431
+ */
432
+ protectedtitles(params) {
433
+ return this.query(params, { list: "protectedtitles" });
434
+ }
435
+ async query(params, options = {}) {
436
+ options = Object.assign(options, {
437
+ action: "query",
438
+ format: "json",
439
+ formatversion: 2
440
+ });
441
+ params = Object.assign(options, params);
442
+ return await this.client.get(params);
443
+ }
444
+ /**
445
+ * Get a list provided by a QueryPage-based special page.
446
+ * @see https://www.mediawiki.org/wiki/API:Querypage
447
+ */
448
+ querypage(params) {
449
+ return this.query(params, { list: "querypage" });
450
+ }
451
+ /**
452
+ * Get a set of random pages.
453
+ * @see https://www.mediawiki.org/wiki/API:Random
454
+ */
455
+ random(params) {
456
+ return this.query(params, { list: "random" });
457
+ }
458
+ /**
459
+ * Enumerate recent changes.
460
+ * @see https://www.mediawiki.org/wiki/API:Recentchanges
461
+ */
462
+ recentchanges(params) {
463
+ return this.query(params, { list: "recentchanges" });
464
+ }
465
+ /**
466
+ * Returns all redirects to the given pages.
467
+ * @see https://www.mediawiki.org/wiki/API:Redirects
468
+ */
469
+ redirects(params) {
470
+ return this.query(params, { prop: "redirects" });
471
+ }
472
+ /**
473
+ * Get revision information.
474
+ * @see https://www.mediawiki.org/wiki/API:Revisions
475
+ */
476
+ revisions(params) {
477
+ return this.query(params, { prop: "revisions" });
478
+ }
479
+ /**
480
+ * Perform a full text search.
481
+ * @see https://www.mediawiki.org/wiki/API:Search
482
+ */
483
+ search(params) {
484
+ return this.query(params, { list: "search" });
485
+ }
486
+ /**
487
+ * Return general information about the site.
488
+ * @see https://www.mediawiki.org/wiki/API:Siteinfo
489
+ */
490
+ async siteinfo(params) {
491
+ return (await this.query(params, { meta: "siteinfo" })).query;
492
+ }
493
+ /**
494
+ * List change tags.
495
+ * @see https://www.mediawiki.org/wiki/API:Tags
496
+ */
497
+ tags(params) {
498
+ return this.query(params, { list: "tags" });
499
+ }
500
+ /**
501
+ * Returns all pages transcluded on the given pages.
502
+ * @see https://www.mediawiki.org/wiki/API:Templates
503
+ */
504
+ templates(params) {
505
+ return this.query(params, { prop: "templates" });
506
+ }
507
+ /**
508
+ * Gets tokens for data-modifying actions.
509
+ * @see https://www.mediawiki.org/wiki/API:Tokens
510
+ */
511
+ async tokens(tokenType, force = false) {
512
+ if (!force && typeof tokenType === "string" && this.cachedTokens[tokenType]) return { [`${tokenType}token`]: this.cachedTokens[tokenType] };
513
+ let type;
514
+ if (Array.isArray(tokenType)) type = tokenType.join("|");
515
+ else type = tokenType;
516
+ return (await this.client.get({
517
+ action: "query",
518
+ format: "json",
519
+ formatversion: "2",
520
+ meta: "tokens",
521
+ type
522
+ })).query.tokens;
523
+ }
524
+ /**
525
+ * Find all pages that transclude the given pages.
526
+ * @see https://www.mediawiki.org/wiki/API:Transcludedin
527
+ */
528
+ transcludedin(params) {
529
+ return this.query(params, { prop: "transcludedin" });
530
+ }
531
+ /**
532
+ * Unblock a user.
533
+ */
534
+ async unblock(params) {
535
+ return (await this.action(params, { action: "unblock" })).unblock;
536
+ }
537
+ /**
538
+ * Upload a file, or get the status of pending uploads.
539
+ */
540
+ async upload(params) {
541
+ const defaults = {
542
+ action: "upload",
543
+ format: "json",
544
+ formatversion: 2,
545
+ token: await this.csrfToken()
546
+ };
547
+ params = Object.assign(defaults, params);
548
+ return await this.client.post(params, { headers: { "content-type": "multipart/form-data" } });
549
+ }
550
+ /**
551
+ * Get all edits by a user.
552
+ * @see https://www.mediawiki.org/wiki/API:Usercontribs
553
+ */
554
+ usercontribs(params) {
555
+ return this.query(params, { list: "usercontribs" });
556
+ }
557
+ /**
558
+ * Get information about the current user.
559
+ * @see https://www.mediawiki.org/wiki/API:Userinfo
560
+ */
561
+ async userinfo(params) {
562
+ return (await this.query(params, { meta: "userinfo" })).query.userinfo;
563
+ }
564
+ /**
565
+ * Change a user's group membership.
566
+ */
567
+ async userrights(params) {
568
+ const token = await this.tokens("userrights");
569
+ return (await this.action(params, {
570
+ action: "userrights",
571
+ token: token.userrightstoken
572
+ })).userrights;
573
+ }
574
+ /**
575
+ * Get information about a list of users.
576
+ * @see https://www.mediawiki.org/wiki/API:Users
577
+ */
578
+ users(params) {
579
+ return this.query(params, { list: "users" });
580
+ }
581
+ /**
582
+ * Get recent changes to pages in the current user's watchlist.
583
+ * @see https://www.mediawiki.org/wiki/API:Watchlist
584
+ */
585
+ watchlist(params) {
586
+ return this.query(params, { list: "watchlist" });
587
+ }
588
+ /**
589
+ * Get all pages on the current user's watchlist.
590
+ * @see https://www.mediawiki.org/wiki/API:Watchlistraw
591
+ */
592
+ watchlistraw(params) {
593
+ return this.query(params, { list: "watchlistraw" });
594
+ }
595
+ };
596
+
597
+ //#endregion
598
+ export { Client, Wiki };
599
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","names":["body: RequestInit['body']","defaults: Record<string, unknown>","type: string"],"sources":["../src/lib/client.ts","../src/lib/wiki.ts"],"sourcesContent":["export class Client {\n public readonly api: URL;\n public cookies: string[] = [];\n public readonly options: ClientOptions;\n\n public constructor(api: URL | string, options?: ClientOptions) {\n if (typeof api === 'string') {\n this.api = new URL(api);\n } else {\n this.api = api;\n }\n this.options = options || {};\n }\n\n public static formData(params: Record<string, unknown>): FormData {\n return Object.entries(params).reduce((form, [key, value]) => {\n form.set(key, value);\n return form;\n }, new FormData);\n }\n\n public static searchParams(params: Record<string, unknown>): URLSearchParams {\n return Object.entries(params).reduce((result, [key, value]) => {\n if (Array.isArray(value)) value = value.join('|');\n\n switch (typeof value) {\n case 'string':\n result.set(key, value);\n break;\n\n case 'boolean':\n result.set(key, value ? '1' : '0');\n break;\n\n default:\n result.set(key, `${value}`);\n }\n return result;\n }, new URLSearchParams());\n }\n\n public async get<T = unknown>(params: Record<string, unknown>, options?: RequestInit): Promise<T> {\n const searchParams = Client.searchParams(params);\n const req = await this.request(`${this.api}?${searchParams}`, options);\n return req.json() as T;\n }\n\n public async post<T = unknown>(params: Record<string, unknown>, options: RequestInit = {}): Promise<T> {\n let body: RequestInit['body'];\n\n // @ts-expect-error content-type exists in headers\n switch (options.headers['content-type']) {\n case 'application/x-www-form-urlencoded':\n body = Client.searchParams(params);\n break;\n\n case 'multipart/form-data':\n body = Client.formData(params);\n break;\n\n default:\n body = JSON.stringify(params);\n break;\n }\n options = Object.assign({}, options, {\n body,\n method: 'post',\n });\n\n const req = await this.request(this.api, options);\n return req.json() as T;\n }\n\n public async request(url: string | URL, options: RequestInit = {}) {\n const headers = Object.assign(\n {},\n this.options.headers || {},\n options.headers || {},\n { cookie: this.cookies.join(',') },\n );\n\n options = Object.assign({}, options, { headers });\n\n const req = await fetch(url, options);\n this.cookies = this.cookies.concat(req.headers.getSetCookie());\n\n return req;\n }\n}\n\nexport interface ClientOptions {\n headers?: RequestInit['headers'];\n}\n","import { Client, type ClientOptions } from './client';\n\nexport class Wiki {\n public readonly client: Client;\n protected readonly cachedTokens: Record<string, string> = {};\n\n public constructor (url: string | URL, options?: ClientOptions) {\n this.client = new Client(url, options);\n }\n\n public async action<T = unknown>(params: Record<string, unknown>, options: Record<string, unknown> = {}): Promise<T> {\n const defaults: Record<string, unknown> = {\n format: 'json',\n formatversion: 2,\n };\n if (!options.token) {\n defaults.token = await this.csrfToken();\n }\n\n params = Object.assign(options, defaults, params);\n return await this.client.post<T>(params);\n }\n\n /**\n * Enumerate all categories.\n * @see https://www.mediawiki.org/wiki/API:Allcategories\n */\n public allcategories(params: AllCategoriesRequest) {\n return this.query<AllCategories>(params, { list: 'allcategories' });\n }\n\n /**\n * List all deleted revisions by a user or in a namespace.\n * @see https://www.mediawiki.org/wiki/API:Alldeletedrevisions\n */\n public alldeletedrevisions(params: AllDeletedRevisionsRequest) {\n return this.query<AllDeletedRevisions>(params, { list: 'alldeletedrevisions' });\n }\n\n /**\n * List all file usages, including non-existing.\n * @see https://www.mediawiki.org/wiki/API:Allfileusages\n */\n public allfileusages(params: AllFileUsagesRequest) {\n return this.query<AllFileUsages>(params, { list: 'allfileusages' });\n }\n\n /**\n * Enumerate all images sequentially.\n * @see https://www.mediawiki.org/wiki/API:Allimages\n */\n public allimages(params: AllImagesRequest) {\n return this.query<AllImages>(params, { list: 'allimages' });\n }\n\n /**\n * Enumerate all links that point to a given namespace.\n * @see https://www.mediawiki.org/wiki/API:Alllinks\n */\n public alllinks(params: AllLinksRequest) {\n return this.query<AllLinks>(params, { list: 'alllinks' });\n }\n\n /**\n * Returns messages from the site.\n * @see https://www.mediawiki.org/wiki/API:Allmessages\n */\n public async allmessages(params: AllMessagesRequest) {\n const result = await this.query<AllMessages>(params, { meta: 'allmessages' });\n\n return result.query.allmessages;\n }\n\n /**\n * Enumerate all pages sequentially in a given namespace.\n * @see https://www.mediawiki.org/wiki/API:Allpages\n */\n public allpages(params: AllPagesRequest) {\n return this.query<AllPages>(params, { list: 'allpages' });\n }\n\n /**\n * List all redirects to a namespace.\n * @see https://www.mediawiki.org/wiki/API:Allredirects\n */\n public allredirects(params: AllRedirectsRequest) {\n return this.query<AllRedirects>(params, { list: 'allredirects' });\n }\n\n /**\n * List all revisions.\n * @see https://www.mediawiki.org/wiki/API:Allrevisions\n */\n public allrevisions(params: AllRevisionsRequest) {\n return this.query<AllRevisions>(params, { list: 'allrevisions' });\n }\n\n /**\n * List all transclusions (pages embedded using `{{x}}`), including non-existing.\n * @see https://www.mediawiki.org/wiki/API:Alltransclusions\n */\n public alltransclusions(params: AllTransclusionsRequest) {\n return this.query<AllTransclusions>(params, { list: 'alltransclusions' });\n }\n\n /**\n * Enumerate all registered users.\n * @see https://www.mediawiki.org/wiki/API:Allusers\n */\n public allusers(params: AllUsersRequest) {\n return this.query<AllUsers>(params, { list: 'allusers' });\n }\n\n /**\n * Find all pages that link to the given page.\n * @see https://www.mediawiki.org/wiki/API:Backlinks\n */\n public backlinks(params: BacklinksRequest) {\n return this.query<Backlinks>(params, { list: 'backlinks' });\n }\n\n /**\n * Block a user.\n */\n public async block(params: BlockRequest) {\n const request = await this.action<Block>(params, { action: 'block' });\n return request.block;\n }\n\n /**\n * List all blocked users and IP addresses.\n * @see https://www.mediawiki.org/wiki/API:Blocks\n */\n public blocks(params: BlocksRequest) {\n return this.query<Blocks>(params, { list: 'blocks' });\n }\n\n /**\n * List all categories the pages belong to.\n * @see https://www.mediawiki.org/wiki/API:Categories\n */\n public categories(params: CategoriesRequest) {\n return this.query<Categories>(params, { prop: 'categories' });\n }\n\n /**\n * Returns information about the given categories.\n * @see https://www.mediawiki.org/wiki/API:Categoryinfo\n */\n public categoryinfo(params: CategoryInfoRequest) {\n return this.query<CategoryInfo>(params, { prop: 'categoryinfo' });\n }\n\n /**\n * List all pages in a given category.\n * @see https://www.mediawiki.org/wiki/API:Categorymembers\n */\n public categorymembers(params: CategoryMembersRequest) {\n return this.query<CategoryMembers>(params, { list: 'categorymembers' });\n }\n\n /**\n * Get the list of logged-in contributors (including temporary users) and the count of\n * logged-out contributors to a page.\n * @see https://www.mediawiki.org/wiki/API:Contributors\n */\n public contributors(params: ContributorsRequest) {\n return this.query<Contributors>(params, { prop: 'contributors' });\n }\n\n public async csrfToken(force = false): Promise<string> {\n const tokens = await this.tokens('csrf', force);\n return tokens.csrftoken!;\n }\n\n /**\n * Get deleted revision information.\n * @see https://www.mediawiki.org/wiki/API:Deletedrevisions\n */\n public deletedrevisions(params: DeletedRevisionsRequest) {\n return this.query<DeletedRevisions>(params, { prop: 'deletedrevisions' });\n }\n\n /**\n * List all files that are duplicates of the given files based on hash values.\n * @see https://www.mediawiki.org/wiki/API:Duplicatefiles\n */\n public duplicatefiles(params: DuplicateFilesRequest) {\n return this.query<DuplicateFiles>(params, { prop: 'duplicatefiles' });\n }\n\n /**\n * Create and edit pages.\n */\n public async edit(params: EditRequest) {\n const request = await this.action<Edit>(params, {\n action: 'edit',\n assert: params.bot ? 'bot' : 'user',\n });\n return request.edit;\n }\n\n /**\n * Find all pages that embed (transclude) the given title.\n * @see https://www.mediawiki.org/wiki/API:Embeddedin\n */\n public embeddedin(params: EmbeddedInRequest) {\n return this.query<EmbeddedIn>(params, { list: 'embeddedin' });\n }\n\n /**\n * Returns all external URLs (not interwikis) from the given pages.\n * @see https://www.mediawiki.org/wiki/API:Extlinks\n */\n public extlinks(params: ExtLinksRequest) {\n return this.query<ExtLinks>(params, { prop: 'extlinks' });\n }\n\n /**\n * Enumerate pages that contain a given URL.\n * @see https://www.mediawiki.org/wiki/API:Exturlusage\n */\n public exturlusage(params: ExtUrlUsageRequest) {\n return this.query<ExtUrlUsage>(params, { list: 'exturlusage' });\n }\n\n /**\n * Enumerate all deleted files sequentially.\n * @see https://www.mediawiki.org/wiki/API:Filearchive\n */\n public filearchive(params: FileArchiveRequest) {\n return this.query<FileArchive>(params, { list: 'filearchive' });\n }\n\n /**\n * Return meta information about image repositories configured on the wiki.\n * @see https://www.mediawiki.org/wiki/API:Filerepoinfo\n */\n public async filerepoinfo(params: FileRepoInfoRequest) {\n const result = await this.query<FileRepoInfo>(params, { meta: 'filerepoinfo' });\n\n return result.query.repos;\n }\n\n /**\n * Find all pages that use the given files.\n * @see https://www.mediawiki.org/wiki/API:Fileusage\n */\n public fileusage(params: FileUsageRequest) {\n return this.query<FileUsage>(params, { prop: 'fileusage' });\n }\n\n /**\n * Get the list of pages to work on by executing the specified query module.\n * @see https://www.mediawiki.org/wiki/API:Query#Generators\n */\n public generate<T extends AllQueries, P extends AllProps>(params: GeneratorRequest<T, P>) {\n return this.query<GeneratorResult<P>>(params);\n }\n\n /**\n * Returns global image usage for a certain image.\n * @see https://www.mediawiki.org/wiki/API:Globalusage\n */\n public globalusage(params: GlobalUsageRequest) {\n return this.query<GlobalUsageRequest>(params, { prop: 'globalusage' });\n }\n\n /**\n * Returns file information and upload history.\n * @see https://www.mediawiki.org/wiki/API:Imageinfo\n */\n public imageinfo(params: ImageInfoRequest) {\n return this.query<ImageInfo>(params, { prop: 'imageinfo' });\n }\n\n /**\n * Return all files contained on the given pages.\n * @see https://www.mediawiki.org/wiki/API:Images\n */\n public images(params: ImagesRequest) {\n return this.query<Images>(params, { prop: 'images' });\n }\n\n /**\n * Find all pages that use the given image title.\n * @see https://www.mediawiki.org/wiki/API:Imageusage\n */\n public imageusage(params: ImageUsageRequest) {\n return this.query<ImageUsage>(params, { list: 'imageusage' });\n }\n\n /**\n * Get basic page information.\n * @see https://www.mediawiki.org/wiki/API:Info\n */\n public info(params: InfoRequest) {\n return this.query<Info>(params, { prop: 'info' });\n }\n\n /**\n * Find all pages that link to the given interwiki link.\n * Can be used to find all links with a prefix, or all links to a title (with a given prefix).\n * Using neither parameter is effectively \"all interwiki links\".\n * @see https://www.mediawiki.org/wiki/API:Iwbacklinks\n */\n public iwbacklinks(params: IwBacklinksRequest) {\n return this.query<IwBacklinks>(params, { list: 'iwbacklinks' });\n }\n\n /**\n * Returns all interwiki links from the given pages.\n * @see https://www.mediawiki.org/wiki/API:Iwlinks\n */\n public iwlinks(params: IwLinksRequest) {\n return this.query<IwLinks>(params, { prop: 'iwlinks' });\n }\n\n /**\n * Find all pages thast link to the given language link.\n * Can be used to find all links with a language code, or all links to a title (with a given language).\n * Using neither parameter is effectively \"all language links\".\n * @see https://www.mediawiki.org/wiki/API:Langbacklinks\n */\n public langbacklinks(params: LangBacklinksRequest) {\n return this.query<LangBacklinks>(params, { list: 'langbacklinks' });\n }\n\n /**\n * Returns all interlanguage links from the given pages.\n * @see https://www.mediawiki.org/wiki/API:Langlinks\n */\n public langlinks(params: LangLinksRequest) {\n return this.query<LangLinks>(params, { prop: 'langlinks' });\n }\n\n /**\n * Returns all links from the given pages.\n * @see https://www.mediawiki.org/wiki/API:Links\n */\n public links(params: LinksRequest) {\n return this.query<Links>(params, { prop: 'links' });\n }\n\n /**\n * Find all pages that link to the given pages.\n * @see https://www.mediawiki.org/wiki/API:Linkshere\n */\n public linkshere(params: LinksHereRequest) {\n return this.query<LinksHere>(params, { prop: 'linkshere' });\n }\n\n /**\n * Get events from logs.\n * @see https://www.mediawiki.org/wiki/API:Logevents\n */\n public logevents(params: LogEventsRequest) {\n return this.query<LogEvents>(params, { list: 'logevents' });\n }\n\n /**\n * Log in and get authentication tokens.\n *\n * This action should only be used in combination with Special:BotPasswords.\n *\n * This will modify your \"Wiki\" instance, and all next requests will be authenticated.\n * @see https://www.mediawiki.org/wiki/API:Login\n */\n public async login(username: string, password: string) {\n const tokens = await this.tokens('login');\n const params = {\n action: 'login',\n format: 'json',\n formatversion: '2',\n lgname: username,\n lgpassword: password,\n lgtoken: tokens.logintoken!,\n };\n\n const result = await this.client.post<{\n login: {\n lguserid: number;\n lgusername: string;\n result: string;\n };\n }>(params, {\n headers: {\n 'content-type': 'application/x-www-form-urlencoded',\n },\n });\n return result.login;\n }\n\n /**\n * Log out and clear session data.\n */\n public async logout(): Promise<void> {\n const token = await this.csrfToken();\n const params = {\n action: 'logout',\n token: token,\n };\n\n await this.client.post(params, {\n headers: {\n 'content-type': 'application/x-www-form-urlencoded',\n },\n });\n }\n\n /**\n * List all page property names in use on the wiki.\n * @see https://www.mediawiki.org/wiki/API:Pagepropnames\n */\n public pagepropnames(params: PagePropNamesRequest) {\n return this.query<PagePropNames>(params, { list: 'pagepropnames' });\n }\n\n /**\n * Get various page properties defined in the page content.\n * @see https://www.mediawiki.org/wiki/API:Pageprops\n */\n public pageprops(params: PagePropsRequest) {\n return this.query<PageProps>(params, { prop: 'pageprops' });\n }\n\n /**\n * List all pages using a given page property.\n * @see https://www.mediawiki.org/wiki/API:Pageswithprop\n */\n public pageswithprop(params: PagesWithPropRequest) {\n return this.query<PagesWithProp>(params, { list: 'pageswithprop' });\n }\n\n /**\n * Perform a prefix search for page titles.\n * @see https://www.mediawiki.org/wiki/API:Prefixsearch\n */\n public prefixsearch(params: PrefixSearchRequest) {\n return this.query<PrefixSearch>(params, { list: 'prefixsearch' });\n }\n\n /**\n * List all titles protected from creation.\n * @see https://www.mediawiki.org/wiki/API:Protectedtitles\n */\n public protectedtitles(params: ProtectedTitlesRequest) {\n return this.query<ProtectedTitles>(params, { list: 'protectedtitles' });\n }\n\n public async query<T = unknown>(params: Record<string, unknown>, options: Record<string, unknown> = {}): Promise<T> {\n options = Object.assign(options, {\n action: 'query',\n format: 'json',\n formatversion: 2,\n });\n\n params = Object.assign(options, params);\n return await this.client.get<T>(params);\n }\n\n /**\n * Get a list provided by a QueryPage-based special page.\n * @see https://www.mediawiki.org/wiki/API:Querypage\n */\n public querypage(params: QueryPageRequest) {\n return this.query<QueryPage>(params, { list: 'querypage' });\n }\n\n /**\n * Get a set of random pages.\n * @see https://www.mediawiki.org/wiki/API:Random\n */\n public random(params: RandomRequest) {\n return this.query<Random>(params, { list: 'random' });\n }\n\n /**\n * Enumerate recent changes.\n * @see https://www.mediawiki.org/wiki/API:Recentchanges\n */\n public recentchanges(params: RecentChangesRequest) {\n return this.query<RecentChanges>(params, { list: 'recentchanges' });\n }\n\n /**\n * Returns all redirects to the given pages.\n * @see https://www.mediawiki.org/wiki/API:Redirects\n */\n public redirects(params: RedirectsRequest) {\n return this.query<Redirects>(params, { prop: 'redirects' });\n }\n\n /**\n * Get revision information.\n * @see https://www.mediawiki.org/wiki/API:Revisions\n */\n public revisions(params: RevisionsRequest) {\n return this.query<Revisions>(params, { prop: 'revisions' });\n }\n\n /**\n * Perform a full text search.\n * @see https://www.mediawiki.org/wiki/API:Search\n */\n public search(params: SearchRequest) {\n return this.query<Search>(params, { list: 'search' });\n }\n\n /**\n * Return general information about the site.\n * @see https://www.mediawiki.org/wiki/API:Siteinfo\n */\n public async siteinfo(params: SiteInfoRequest) {\n const result = await this.query<SiteInfo>(params, { meta: 'siteinfo' });\n\n return result.query;\n }\n\n /**\n * List change tags.\n * @see https://www.mediawiki.org/wiki/API:Tags\n */\n public tags(params: TagsRequest) {\n return this.query<Tags>(params, { list: 'tags' });\n }\n\n /**\n * Returns all pages transcluded on the given pages.\n * @see https://www.mediawiki.org/wiki/API:Templates\n */\n public templates(params: TemplatesRequest) {\n return this.query<Templates>(params, { prop: 'templates' });\n }\n\n /**\n * Gets tokens for data-modifying actions.\n * @see https://www.mediawiki.org/wiki/API:Tokens\n */\n public async tokens(tokenType: '*' | Prop<TokenType>, force = false): Promise<{\n [k in `${TokenType}token`]?: string\n }> {\n if (!force && typeof tokenType === 'string' && this.cachedTokens[tokenType]) {\n return {\n [`${tokenType}token`]: this.cachedTokens[tokenType],\n };\n }\n\n let type: string;\n\n if (Array.isArray(tokenType)) type = tokenType.join('|');\n else type = tokenType;\n\n const tokens = await this.client.get<{\n query: {\n tokens: Record<`${TokenType}token`, string>;\n };\n }>({\n action: 'query',\n format: 'json',\n formatversion: '2',\n meta: 'tokens',\n type,\n });\n\n return tokens.query.tokens;\n }\n\n /**\n * Find all pages that transclude the given pages.\n * @see https://www.mediawiki.org/wiki/API:Transcludedin\n */\n public transcludedin(params: TranscludedInRequest) {\n return this.query<TranscludedIn>(params, { prop: 'transcludedin' });\n }\n\n /**\n * Unblock a user.\n */\n public async unblock(params: UnblockRequest) {\n const request = await this.action<Unblock>(params, { action: 'unblock' });\n return request.unblock;\n }\n\n /**\n * Upload a file, or get the status of pending uploads.\n */\n public async upload(params: UploadRequest) {\n const defaults: Record<string, unknown> = {\n action: 'upload',\n format: 'json',\n formatversion: 2,\n token: await this.csrfToken(),\n };\n\n params = Object.assign(defaults, params);\n\n return await this.client.post(params, {\n headers: {\n 'content-type': 'multipart/form-data',\n },\n });\n }\n\n /**\n * Get all edits by a user.\n * @see https://www.mediawiki.org/wiki/API:Usercontribs\n */\n public usercontribs(params: UserContribsRequest) {\n return this.query<UserContribs>(params, { list: 'usercontribs' });\n }\n\n /**\n * Get information about the current user.\n * @see https://www.mediawiki.org/wiki/API:Userinfo\n */\n public async userinfo(params: UserInfoRequest) {\n const result = await this.query<UserInfo>(params, { meta: 'userinfo' });\n\n return result.query.userinfo;\n }\n\n /**\n * Change a user's group membership.\n */\n public async userrights(params: UserRightsRequest) {\n const token = await this.tokens('userrights');\n const request = await this.action<UserRights>(params, { action: 'userrights', token: token.userrightstoken! });\n return request.userrights;\n }\n\n /**\n * Get information about a list of users.\n * @see https://www.mediawiki.org/wiki/API:Users\n */\n public users(params: UsersRequest) {\n return this.query<Users>(params, { list: 'users' });\n }\n\n /**\n * Get recent changes to pages in the current user's watchlist.\n * @see https://www.mediawiki.org/wiki/API:Watchlist\n */\n public watchlist(params: WatchlistRequest) {\n return this.query<Watchlist>(params, { list: 'watchlist' });\n }\n\n /**\n * Get all pages on the current user's watchlist.\n * @see https://www.mediawiki.org/wiki/API:Watchlistraw\n */\n public watchlistraw(params: WatchlistRawRequest) {\n return this.query<WatchlistRaw>(params, { list: 'watchlistraw' });\n }\n}\n"],"mappings":";AAAA,IAAa,SAAb,MAAa,OAAO;CAClB,AAAgB;CAChB,AAAO,UAAoB,EAAE;CAC7B,AAAgB;CAEhB,AAAO,YAAY,KAAmB,SAAyB;AAC7D,MAAI,OAAO,QAAQ,SACjB,MAAK,MAAM,IAAI,IAAI,IAAI;MAEvB,MAAK,MAAM;AAEb,OAAK,UAAU,WAAW,EAAE;;CAG9B,OAAc,SAAS,QAA2C;AAChE,SAAO,OAAO,QAAQ,OAAO,CAAC,QAAQ,MAAM,CAAC,KAAK,WAAW;AAC3D,QAAK,IAAI,KAAK,MAAM;AACpB,UAAO;KACN,IAAI,UAAQ,CAAC;;CAGlB,OAAc,aAAa,QAAkD;AAC3E,SAAO,OAAO,QAAQ,OAAO,CAAC,QAAQ,QAAQ,CAAC,KAAK,WA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