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/LICENSE +674 -0
- package/README.md +59 -0
- package/dist/main.cjs +601 -0
- package/dist/main.cjs.map +1 -0
- package/dist/main.d.cts +365 -0
- package/dist/main.d.ts +365 -0
- package/dist/main.js +599 -0
- package/dist/main.js.map +1 -0
- package/package.json +44 -0
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
//#region src/lib/client.d.ts
|
|
2
|
+
declare class Client {
|
|
3
|
+
readonly api: URL;
|
|
4
|
+
cookies: string[];
|
|
5
|
+
readonly options: ClientOptions;
|
|
6
|
+
constructor(api: URL | string, options?: ClientOptions);
|
|
7
|
+
static formData(params: Record<string, unknown>): FormData;
|
|
8
|
+
static searchParams(params: Record<string, unknown>): URLSearchParams;
|
|
9
|
+
get<T = unknown>(params: Record<string, unknown>, options?: RequestInit): Promise<T>;
|
|
10
|
+
post<T = unknown>(params: Record<string, unknown>, options?: RequestInit): Promise<T>;
|
|
11
|
+
request(url: string | URL, options?: RequestInit): Promise<Response>;
|
|
12
|
+
}
|
|
13
|
+
interface ClientOptions {
|
|
14
|
+
headers?: RequestInit['headers'];
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/lib/wiki.d.ts
|
|
18
|
+
declare class Wiki {
|
|
19
|
+
readonly client: Client;
|
|
20
|
+
protected readonly cachedTokens: Record<string, string>;
|
|
21
|
+
constructor(url: string | URL, options?: ClientOptions);
|
|
22
|
+
action<T = unknown>(params: Record<string, unknown>, options?: Record<string, unknown>): Promise<T>;
|
|
23
|
+
/**
|
|
24
|
+
* Enumerate all categories.
|
|
25
|
+
* @see https://www.mediawiki.org/wiki/API:Allcategories
|
|
26
|
+
*/
|
|
27
|
+
allcategories(params: AllCategoriesRequest): Promise<AllCategories>;
|
|
28
|
+
/**
|
|
29
|
+
* List all deleted revisions by a user or in a namespace.
|
|
30
|
+
* @see https://www.mediawiki.org/wiki/API:Alldeletedrevisions
|
|
31
|
+
*/
|
|
32
|
+
alldeletedrevisions(params: AllDeletedRevisionsRequest): Promise<AllDeletedRevisions>;
|
|
33
|
+
/**
|
|
34
|
+
* List all file usages, including non-existing.
|
|
35
|
+
* @see https://www.mediawiki.org/wiki/API:Allfileusages
|
|
36
|
+
*/
|
|
37
|
+
allfileusages(params: AllFileUsagesRequest): Promise<AllFileUsages>;
|
|
38
|
+
/**
|
|
39
|
+
* Enumerate all images sequentially.
|
|
40
|
+
* @see https://www.mediawiki.org/wiki/API:Allimages
|
|
41
|
+
*/
|
|
42
|
+
allimages(params: AllImagesRequest): Promise<AllImages>;
|
|
43
|
+
/**
|
|
44
|
+
* Enumerate all links that point to a given namespace.
|
|
45
|
+
* @see https://www.mediawiki.org/wiki/API:Alllinks
|
|
46
|
+
*/
|
|
47
|
+
alllinks(params: AllLinksRequest): Promise<AllLinks>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns messages from the site.
|
|
50
|
+
* @see https://www.mediawiki.org/wiki/API:Allmessages
|
|
51
|
+
*/
|
|
52
|
+
allmessages(params: AllMessagesRequest): Promise<any>;
|
|
53
|
+
/**
|
|
54
|
+
* Enumerate all pages sequentially in a given namespace.
|
|
55
|
+
* @see https://www.mediawiki.org/wiki/API:Allpages
|
|
56
|
+
*/
|
|
57
|
+
allpages(params: AllPagesRequest): Promise<AllPages>;
|
|
58
|
+
/**
|
|
59
|
+
* List all redirects to a namespace.
|
|
60
|
+
* @see https://www.mediawiki.org/wiki/API:Allredirects
|
|
61
|
+
*/
|
|
62
|
+
allredirects(params: AllRedirectsRequest): Promise<AllRedirects>;
|
|
63
|
+
/**
|
|
64
|
+
* List all revisions.
|
|
65
|
+
* @see https://www.mediawiki.org/wiki/API:Allrevisions
|
|
66
|
+
*/
|
|
67
|
+
allrevisions(params: AllRevisionsRequest): Promise<AllRevisions>;
|
|
68
|
+
/**
|
|
69
|
+
* List all transclusions (pages embedded using `{{x}}`), including non-existing.
|
|
70
|
+
* @see https://www.mediawiki.org/wiki/API:Alltransclusions
|
|
71
|
+
*/
|
|
72
|
+
alltransclusions(params: AllTransclusionsRequest): Promise<AllTransclusions>;
|
|
73
|
+
/**
|
|
74
|
+
* Enumerate all registered users.
|
|
75
|
+
* @see https://www.mediawiki.org/wiki/API:Allusers
|
|
76
|
+
*/
|
|
77
|
+
allusers(params: AllUsersRequest): Promise<AllUsers>;
|
|
78
|
+
/**
|
|
79
|
+
* Find all pages that link to the given page.
|
|
80
|
+
* @see https://www.mediawiki.org/wiki/API:Backlinks
|
|
81
|
+
*/
|
|
82
|
+
backlinks(params: BacklinksRequest): Promise<Backlinks>;
|
|
83
|
+
/**
|
|
84
|
+
* Block a user.
|
|
85
|
+
*/
|
|
86
|
+
block(params: BlockRequest): Promise<any>;
|
|
87
|
+
/**
|
|
88
|
+
* List all blocked users and IP addresses.
|
|
89
|
+
* @see https://www.mediawiki.org/wiki/API:Blocks
|
|
90
|
+
*/
|
|
91
|
+
blocks(params: BlocksRequest): Promise<Blocks>;
|
|
92
|
+
/**
|
|
93
|
+
* List all categories the pages belong to.
|
|
94
|
+
* @see https://www.mediawiki.org/wiki/API:Categories
|
|
95
|
+
*/
|
|
96
|
+
categories(params: CategoriesRequest): Promise<Categories>;
|
|
97
|
+
/**
|
|
98
|
+
* Returns information about the given categories.
|
|
99
|
+
* @see https://www.mediawiki.org/wiki/API:Categoryinfo
|
|
100
|
+
*/
|
|
101
|
+
categoryinfo(params: CategoryInfoRequest): Promise<CategoryInfo>;
|
|
102
|
+
/**
|
|
103
|
+
* List all pages in a given category.
|
|
104
|
+
* @see https://www.mediawiki.org/wiki/API:Categorymembers
|
|
105
|
+
*/
|
|
106
|
+
categorymembers(params: CategoryMembersRequest): Promise<CategoryMembers>;
|
|
107
|
+
/**
|
|
108
|
+
* Get the list of logged-in contributors (including temporary users) and the count of
|
|
109
|
+
* logged-out contributors to a page.
|
|
110
|
+
* @see https://www.mediawiki.org/wiki/API:Contributors
|
|
111
|
+
*/
|
|
112
|
+
contributors(params: ContributorsRequest): Promise<Contributors>;
|
|
113
|
+
csrfToken(force?: boolean): Promise<string>;
|
|
114
|
+
/**
|
|
115
|
+
* Get deleted revision information.
|
|
116
|
+
* @see https://www.mediawiki.org/wiki/API:Deletedrevisions
|
|
117
|
+
*/
|
|
118
|
+
deletedrevisions(params: DeletedRevisionsRequest): Promise<DeletedRevisions>;
|
|
119
|
+
/**
|
|
120
|
+
* List all files that are duplicates of the given files based on hash values.
|
|
121
|
+
* @see https://www.mediawiki.org/wiki/API:Duplicatefiles
|
|
122
|
+
*/
|
|
123
|
+
duplicatefiles(params: DuplicateFilesRequest): Promise<DuplicateFiles>;
|
|
124
|
+
/**
|
|
125
|
+
* Create and edit pages.
|
|
126
|
+
*/
|
|
127
|
+
edit(params: EditRequest): Promise<any>;
|
|
128
|
+
/**
|
|
129
|
+
* Find all pages that embed (transclude) the given title.
|
|
130
|
+
* @see https://www.mediawiki.org/wiki/API:Embeddedin
|
|
131
|
+
*/
|
|
132
|
+
embeddedin(params: EmbeddedInRequest): Promise<EmbeddedIn>;
|
|
133
|
+
/**
|
|
134
|
+
* Returns all external URLs (not interwikis) from the given pages.
|
|
135
|
+
* @see https://www.mediawiki.org/wiki/API:Extlinks
|
|
136
|
+
*/
|
|
137
|
+
extlinks(params: ExtLinksRequest): Promise<ExtLinks>;
|
|
138
|
+
/**
|
|
139
|
+
* Enumerate pages that contain a given URL.
|
|
140
|
+
* @see https://www.mediawiki.org/wiki/API:Exturlusage
|
|
141
|
+
*/
|
|
142
|
+
exturlusage(params: ExtUrlUsageRequest): Promise<ExtUrlUsage>;
|
|
143
|
+
/**
|
|
144
|
+
* Enumerate all deleted files sequentially.
|
|
145
|
+
* @see https://www.mediawiki.org/wiki/API:Filearchive
|
|
146
|
+
*/
|
|
147
|
+
filearchive(params: FileArchiveRequest): Promise<FileArchive>;
|
|
148
|
+
/**
|
|
149
|
+
* Return meta information about image repositories configured on the wiki.
|
|
150
|
+
* @see https://www.mediawiki.org/wiki/API:Filerepoinfo
|
|
151
|
+
*/
|
|
152
|
+
filerepoinfo(params: FileRepoInfoRequest): Promise<any>;
|
|
153
|
+
/**
|
|
154
|
+
* Find all pages that use the given files.
|
|
155
|
+
* @see https://www.mediawiki.org/wiki/API:Fileusage
|
|
156
|
+
*/
|
|
157
|
+
fileusage(params: FileUsageRequest): Promise<FileUsage>;
|
|
158
|
+
/**
|
|
159
|
+
* Get the list of pages to work on by executing the specified query module.
|
|
160
|
+
* @see https://www.mediawiki.org/wiki/API:Query#Generators
|
|
161
|
+
*/
|
|
162
|
+
generate<T extends AllQueries, P extends AllProps>(params: GeneratorRequest<T, P>): Promise<GeneratorResult<P>>;
|
|
163
|
+
/**
|
|
164
|
+
* Returns global image usage for a certain image.
|
|
165
|
+
* @see https://www.mediawiki.org/wiki/API:Globalusage
|
|
166
|
+
*/
|
|
167
|
+
globalusage(params: GlobalUsageRequest): Promise<GlobalUsageRequest>;
|
|
168
|
+
/**
|
|
169
|
+
* Returns file information and upload history.
|
|
170
|
+
* @see https://www.mediawiki.org/wiki/API:Imageinfo
|
|
171
|
+
*/
|
|
172
|
+
imageinfo(params: ImageInfoRequest): Promise<ImageInfo>;
|
|
173
|
+
/**
|
|
174
|
+
* Return all files contained on the given pages.
|
|
175
|
+
* @see https://www.mediawiki.org/wiki/API:Images
|
|
176
|
+
*/
|
|
177
|
+
images(params: ImagesRequest): Promise<Images>;
|
|
178
|
+
/**
|
|
179
|
+
* Find all pages that use the given image title.
|
|
180
|
+
* @see https://www.mediawiki.org/wiki/API:Imageusage
|
|
181
|
+
*/
|
|
182
|
+
imageusage(params: ImageUsageRequest): Promise<ImageUsage>;
|
|
183
|
+
/**
|
|
184
|
+
* Get basic page information.
|
|
185
|
+
* @see https://www.mediawiki.org/wiki/API:Info
|
|
186
|
+
*/
|
|
187
|
+
info(params: InfoRequest): Promise<Info>;
|
|
188
|
+
/**
|
|
189
|
+
* Find all pages that link to the given interwiki link.
|
|
190
|
+
* Can be used to find all links with a prefix, or all links to a title (with a given prefix).
|
|
191
|
+
* Using neither parameter is effectively "all interwiki links".
|
|
192
|
+
* @see https://www.mediawiki.org/wiki/API:Iwbacklinks
|
|
193
|
+
*/
|
|
194
|
+
iwbacklinks(params: IwBacklinksRequest): Promise<IwBacklinks>;
|
|
195
|
+
/**
|
|
196
|
+
* Returns all interwiki links from the given pages.
|
|
197
|
+
* @see https://www.mediawiki.org/wiki/API:Iwlinks
|
|
198
|
+
*/
|
|
199
|
+
iwlinks(params: IwLinksRequest): Promise<IwLinks>;
|
|
200
|
+
/**
|
|
201
|
+
* Find all pages thast link to the given language link.
|
|
202
|
+
* Can be used to find all links with a language code, or all links to a title (with a given language).
|
|
203
|
+
* Using neither parameter is effectively "all language links".
|
|
204
|
+
* @see https://www.mediawiki.org/wiki/API:Langbacklinks
|
|
205
|
+
*/
|
|
206
|
+
langbacklinks(params: LangBacklinksRequest): Promise<LangBacklinks>;
|
|
207
|
+
/**
|
|
208
|
+
* Returns all interlanguage links from the given pages.
|
|
209
|
+
* @see https://www.mediawiki.org/wiki/API:Langlinks
|
|
210
|
+
*/
|
|
211
|
+
langlinks(params: LangLinksRequest): Promise<LangLinks>;
|
|
212
|
+
/**
|
|
213
|
+
* Returns all links from the given pages.
|
|
214
|
+
* @see https://www.mediawiki.org/wiki/API:Links
|
|
215
|
+
*/
|
|
216
|
+
links(params: LinksRequest): Promise<Links>;
|
|
217
|
+
/**
|
|
218
|
+
* Find all pages that link to the given pages.
|
|
219
|
+
* @see https://www.mediawiki.org/wiki/API:Linkshere
|
|
220
|
+
*/
|
|
221
|
+
linkshere(params: LinksHereRequest): Promise<LinksHere>;
|
|
222
|
+
/**
|
|
223
|
+
* Get events from logs.
|
|
224
|
+
* @see https://www.mediawiki.org/wiki/API:Logevents
|
|
225
|
+
*/
|
|
226
|
+
logevents(params: LogEventsRequest): Promise<LogEvents>;
|
|
227
|
+
/**
|
|
228
|
+
* Log in and get authentication tokens.
|
|
229
|
+
*
|
|
230
|
+
* This action should only be used in combination with Special:BotPasswords.
|
|
231
|
+
*
|
|
232
|
+
* This will modify your "Wiki" instance, and all next requests will be authenticated.
|
|
233
|
+
* @see https://www.mediawiki.org/wiki/API:Login
|
|
234
|
+
*/
|
|
235
|
+
login(username: string, password: string): Promise<{
|
|
236
|
+
lguserid: number;
|
|
237
|
+
lgusername: string;
|
|
238
|
+
result: string;
|
|
239
|
+
}>;
|
|
240
|
+
/**
|
|
241
|
+
* Log out and clear session data.
|
|
242
|
+
*/
|
|
243
|
+
logout(): Promise<void>;
|
|
244
|
+
/**
|
|
245
|
+
* List all page property names in use on the wiki.
|
|
246
|
+
* @see https://www.mediawiki.org/wiki/API:Pagepropnames
|
|
247
|
+
*/
|
|
248
|
+
pagepropnames(params: PagePropNamesRequest): Promise<PagePropNames>;
|
|
249
|
+
/**
|
|
250
|
+
* Get various page properties defined in the page content.
|
|
251
|
+
* @see https://www.mediawiki.org/wiki/API:Pageprops
|
|
252
|
+
*/
|
|
253
|
+
pageprops(params: PagePropsRequest): Promise<PageProps>;
|
|
254
|
+
/**
|
|
255
|
+
* List all pages using a given page property.
|
|
256
|
+
* @see https://www.mediawiki.org/wiki/API:Pageswithprop
|
|
257
|
+
*/
|
|
258
|
+
pageswithprop(params: PagesWithPropRequest): Promise<PagesWithProp>;
|
|
259
|
+
/**
|
|
260
|
+
* Perform a prefix search for page titles.
|
|
261
|
+
* @see https://www.mediawiki.org/wiki/API:Prefixsearch
|
|
262
|
+
*/
|
|
263
|
+
prefixsearch(params: PrefixSearchRequest): Promise<PrefixSearch>;
|
|
264
|
+
/**
|
|
265
|
+
* List all titles protected from creation.
|
|
266
|
+
* @see https://www.mediawiki.org/wiki/API:Protectedtitles
|
|
267
|
+
*/
|
|
268
|
+
protectedtitles(params: ProtectedTitlesRequest): Promise<ProtectedTitles>;
|
|
269
|
+
query<T = unknown>(params: Record<string, unknown>, options?: Record<string, unknown>): Promise<T>;
|
|
270
|
+
/**
|
|
271
|
+
* Get a list provided by a QueryPage-based special page.
|
|
272
|
+
* @see https://www.mediawiki.org/wiki/API:Querypage
|
|
273
|
+
*/
|
|
274
|
+
querypage(params: QueryPageRequest): Promise<QueryPage>;
|
|
275
|
+
/**
|
|
276
|
+
* Get a set of random pages.
|
|
277
|
+
* @see https://www.mediawiki.org/wiki/API:Random
|
|
278
|
+
*/
|
|
279
|
+
random(params: RandomRequest): Promise<Random>;
|
|
280
|
+
/**
|
|
281
|
+
* Enumerate recent changes.
|
|
282
|
+
* @see https://www.mediawiki.org/wiki/API:Recentchanges
|
|
283
|
+
*/
|
|
284
|
+
recentchanges(params: RecentChangesRequest): Promise<RecentChanges>;
|
|
285
|
+
/**
|
|
286
|
+
* Returns all redirects to the given pages.
|
|
287
|
+
* @see https://www.mediawiki.org/wiki/API:Redirects
|
|
288
|
+
*/
|
|
289
|
+
redirects(params: RedirectsRequest): Promise<Redirects>;
|
|
290
|
+
/**
|
|
291
|
+
* Get revision information.
|
|
292
|
+
* @see https://www.mediawiki.org/wiki/API:Revisions
|
|
293
|
+
*/
|
|
294
|
+
revisions(params: RevisionsRequest): Promise<Revisions>;
|
|
295
|
+
/**
|
|
296
|
+
* Perform a full text search.
|
|
297
|
+
* @see https://www.mediawiki.org/wiki/API:Search
|
|
298
|
+
*/
|
|
299
|
+
search(params: SearchRequest): Promise<Search>;
|
|
300
|
+
/**
|
|
301
|
+
* Return general information about the site.
|
|
302
|
+
* @see https://www.mediawiki.org/wiki/API:Siteinfo
|
|
303
|
+
*/
|
|
304
|
+
siteinfo(params: SiteInfoRequest): Promise<any>;
|
|
305
|
+
/**
|
|
306
|
+
* List change tags.
|
|
307
|
+
* @see https://www.mediawiki.org/wiki/API:Tags
|
|
308
|
+
*/
|
|
309
|
+
tags(params: TagsRequest): Promise<Tags>;
|
|
310
|
+
/**
|
|
311
|
+
* Returns all pages transcluded on the given pages.
|
|
312
|
+
* @see https://www.mediawiki.org/wiki/API:Templates
|
|
313
|
+
*/
|
|
314
|
+
templates(params: TemplatesRequest): Promise<Templates>;
|
|
315
|
+
/**
|
|
316
|
+
* Gets tokens for data-modifying actions.
|
|
317
|
+
* @see https://www.mediawiki.org/wiki/API:Tokens
|
|
318
|
+
*/
|
|
319
|
+
tokens(tokenType: '*' | Prop<TokenType>, force?: boolean): Promise<{ [k in `${TokenType}token`]?: string }>;
|
|
320
|
+
/**
|
|
321
|
+
* Find all pages that transclude the given pages.
|
|
322
|
+
* @see https://www.mediawiki.org/wiki/API:Transcludedin
|
|
323
|
+
*/
|
|
324
|
+
transcludedin(params: TranscludedInRequest): Promise<TranscludedIn>;
|
|
325
|
+
/**
|
|
326
|
+
* Unblock a user.
|
|
327
|
+
*/
|
|
328
|
+
unblock(params: UnblockRequest): Promise<any>;
|
|
329
|
+
/**
|
|
330
|
+
* Upload a file, or get the status of pending uploads.
|
|
331
|
+
*/
|
|
332
|
+
upload(params: UploadRequest): Promise<unknown>;
|
|
333
|
+
/**
|
|
334
|
+
* Get all edits by a user.
|
|
335
|
+
* @see https://www.mediawiki.org/wiki/API:Usercontribs
|
|
336
|
+
*/
|
|
337
|
+
usercontribs(params: UserContribsRequest): Promise<UserContribs>;
|
|
338
|
+
/**
|
|
339
|
+
* Get information about the current user.
|
|
340
|
+
* @see https://www.mediawiki.org/wiki/API:Userinfo
|
|
341
|
+
*/
|
|
342
|
+
userinfo(params: UserInfoRequest): Promise<any>;
|
|
343
|
+
/**
|
|
344
|
+
* Change a user's group membership.
|
|
345
|
+
*/
|
|
346
|
+
userrights(params: UserRightsRequest): Promise<any>;
|
|
347
|
+
/**
|
|
348
|
+
* Get information about a list of users.
|
|
349
|
+
* @see https://www.mediawiki.org/wiki/API:Users
|
|
350
|
+
*/
|
|
351
|
+
users(params: UsersRequest): Promise<Users>;
|
|
352
|
+
/**
|
|
353
|
+
* Get recent changes to pages in the current user's watchlist.
|
|
354
|
+
* @see https://www.mediawiki.org/wiki/API:Watchlist
|
|
355
|
+
*/
|
|
356
|
+
watchlist(params: WatchlistRequest): Promise<Watchlist>;
|
|
357
|
+
/**
|
|
358
|
+
* Get all pages on the current user's watchlist.
|
|
359
|
+
* @see https://www.mediawiki.org/wiki/API:Watchlistraw
|
|
360
|
+
*/
|
|
361
|
+
watchlistraw(params: WatchlistRawRequest): Promise<WatchlistRaw>;
|
|
362
|
+
}
|
|
363
|
+
//#endregion
|
|
364
|
+
export { Client, ClientOptions, Wiki };
|
|
365
|
+
//# sourceMappingURL=main.d.ts.map
|