types-mediawiki-response 1.0.0 → 1.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/core/block.d.ts +6 -30
- package/dist/core/changeauthenticationdata.d.ts +1 -1
- package/dist/core/createaccount.d.ts +1 -1
- package/dist/core/delete.d.ts +2 -18
- package/dist/core/edit.d.ts +1 -1
- package/dist/core/emailuser.d.ts +10 -10
- package/dist/core/filerevert.d.ts +4 -4
- package/dist/core/imagerotate.d.ts +3 -3
- package/dist/core/index.d.ts +2 -0
- package/dist/core/login.d.ts +7 -3
- package/dist/core/managetags.d.ts +3 -3
- package/dist/core/move.d.ts +7 -7
- package/dist/core/options.d.ts +1 -1
- package/dist/core/query/filerepoinfo.d.ts +1 -1
- package/dist/core/query/index.d.ts +6 -3
- package/dist/core/query/info.d.ts +14 -8
- package/dist/core/query/users.d.ts +4 -3
- package/dist/core/removeauthenticationdata.d.ts +1 -1
- package/dist/core/resetpassword.d.ts +1 -1
- package/dist/core/revisiondelete.d.ts +9 -9
- package/dist/core/tag.d.ts +34 -8
- package/dist/core/unblock.d.ts +35 -0
- package/dist/core/undelete.d.ts +23 -0
- package/dist/core/validatepassword.d.ts +3 -3
- package/dist/core/watch.d.ts +12 -5
- package/dist/envelope/index.d.ts +57 -20
- package/dist/extensions/babel.d.ts +1 -1
- package/dist/extensions/globalblocks.d.ts +35 -1
- package/dist/extensions/scribunto.d.ts +1 -1
- package/dist/extensions/thanks.d.ts +1 -1
- package/dist/extensions/wikilove.d.ts +1 -1
- package/package.json +6 -5
package/dist/core/block.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `action=block`
|
|
3
|
-
*
|
|
2
|
+
* `action=block` response — blocking a user or IP range, returned under a
|
|
3
|
+
* top-level `block` object. Requires the `block` right.
|
|
4
4
|
*
|
|
5
|
-
* fv2 note: the block result uses **`userID`** (capital `D`)
|
|
6
|
-
* result
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* fv2 note: the block result uses **`userID`** (capital `D`), unlike the
|
|
6
|
+
* unblock result's `userid`. Block flags are real booleans (present as
|
|
7
|
+
* `false`); partial-block restrictions come back as `null` when the block is
|
|
8
|
+
* sitewide.
|
|
9
9
|
*
|
|
10
10
|
* @see https://www.mediawiki.org/wiki/API:Block
|
|
11
11
|
*/
|
|
@@ -72,27 +72,3 @@ export interface ApiBlockResponse extends ApiEnvelope {
|
|
|
72
72
|
/** Result of `action=block`. */
|
|
73
73
|
block: ApiBlockResult;
|
|
74
74
|
}
|
|
75
|
-
/** The `unblock` object of an `action=unblock` response. */
|
|
76
|
-
export interface ApiUnblockResult {
|
|
77
|
-
/** Removed block id. */
|
|
78
|
-
id: number;
|
|
79
|
-
/** Unblocked user name / IP; empty string when removing an autoblock. */
|
|
80
|
-
user: string;
|
|
81
|
-
/** Unblocked user id (`0` for IPs and autoblocks). Note lowercase, unlike the block result. */
|
|
82
|
-
userid: number;
|
|
83
|
-
/** Unblock reason (echoed back). */
|
|
84
|
-
reason: string;
|
|
85
|
-
/** Whether the unblock added the unblocked user to the unblocker's watchlist. */
|
|
86
|
-
watchuser: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Expiry applied to the watched user page, present only when the request
|
|
89
|
-
* passed `watchlistexpiry` with `watchuser`; `null` when the page is not
|
|
90
|
-
* actually watched.
|
|
91
|
-
*/
|
|
92
|
-
watchlistexpiry?: Timestamp | null;
|
|
93
|
-
}
|
|
94
|
-
/** Response of `action=unblock`. */
|
|
95
|
-
export interface ApiUnblockResponse extends ApiEnvelope {
|
|
96
|
-
/** Result of `action=unblock`. */
|
|
97
|
-
unblock: ApiUnblockResult;
|
|
98
|
-
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* token, the `editmyprivateinfo` right, and a fully-configured secondary-provider
|
|
5
5
|
* session. On success `ApiChangeAuthenticationData` emits a single field:
|
|
6
6
|
* `changeauthenticationdata.status` = `success`. Any refusal or incomplete flow
|
|
7
|
-
* is a top-level
|
|
7
|
+
* is a top-level `ApiErrorResponse` (dieStatus / badrequest).
|
|
8
8
|
*
|
|
9
9
|
* @see https://www.mediawiki.org/wiki/API:Changeauthenticationdata
|
|
10
10
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* `message`/`messagecode`.
|
|
6
6
|
*
|
|
7
7
|
* These are **in-band** AuthManager outcomes, not a top-level
|
|
8
|
-
*
|
|
8
|
+
* `ApiErrorResponse`. `username` appears on `PASS`; `UI`/`RESTART`/
|
|
9
9
|
* `REDIRECT` outcomes add the `requests` descriptors; `canpreservestate` marks
|
|
10
10
|
* whether state can be kept.
|
|
11
11
|
*
|
package/dist/core/delete.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `action=delete`
|
|
3
|
-
*
|
|
2
|
+
* `action=delete` response — page deletion, returned under a top-level `delete`
|
|
3
|
+
* object. Requires the `delete` right.
|
|
4
4
|
*
|
|
5
5
|
* Under `formatversion=2` a successful delete carries **no `result` key**
|
|
6
6
|
* (older clients branched on `result: "Success"`).
|
|
@@ -29,19 +29,3 @@ export interface ApiDeleteResponse extends ApiEnvelope {
|
|
|
29
29
|
/** Result of `action=delete`. */
|
|
30
30
|
delete: ApiDeleteResult;
|
|
31
31
|
}
|
|
32
|
-
/** The `undelete` object of an `action=undelete` response. */
|
|
33
|
-
export interface ApiUndeleteResult {
|
|
34
|
-
/** Restored page title. */
|
|
35
|
-
title: string;
|
|
36
|
-
/** Number of revisions restored. */
|
|
37
|
-
revisions: number;
|
|
38
|
-
/** Number of file versions restored. */
|
|
39
|
-
fileversions: number;
|
|
40
|
-
/** Undelete reason (echoed back). */
|
|
41
|
-
reason: string;
|
|
42
|
-
}
|
|
43
|
-
/** Response of `action=undelete`. */
|
|
44
|
-
export interface ApiUndeleteResponse extends ApiEnvelope {
|
|
45
|
-
/** Result of `action=undelete`. */
|
|
46
|
-
undelete: ApiUndeleteResult;
|
|
47
|
-
}
|
package/dist/core/edit.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* challenge) returns the in-band failure branch: `result: "Failure"` plus that
|
|
11
11
|
* data and no revision ids. Most hard failures (bad token, protected page,
|
|
12
12
|
* `createonly` on an existing page) surface as a top-level
|
|
13
|
-
*
|
|
13
|
+
* `ApiErrorResponse`, not `result: "Failure"`.
|
|
14
14
|
*
|
|
15
15
|
* @see https://www.mediawiki.org/wiki/API:Edit
|
|
16
16
|
*/
|
package/dist/core/emailuser.d.ts
CHANGED
|
@@ -4,25 +4,25 @@
|
|
|
4
4
|
* under `emailuser`.
|
|
5
5
|
*
|
|
6
6
|
* `ApiEmailUser` reports the outcome **in-band** (not as a top-level
|
|
7
|
-
*
|
|
8
|
-
* and `warnings`/`errors` carry
|
|
9
|
-
*
|
|
10
|
-
* `errorformat`, which keeps them as
|
|
11
|
-
* a wiki without a mail transport.
|
|
7
|
+
* `ApiErrorResponse`): `result` is `Success`, `Warnings`, or `Failure`,
|
|
8
|
+
* and `warnings`/`errors` carry the messages, shaped per the request's
|
|
9
|
+
* `errorformat`. The keys are dropped when the status carries none of that
|
|
10
|
+
* kind — except under the default `bc` `errorformat`, which keeps them as
|
|
11
|
+
* empty arrays. A `Failure` also occurs on a wiki without a mail transport.
|
|
12
12
|
*
|
|
13
13
|
* @see https://www.mediawiki.org/wiki/API:Email
|
|
14
14
|
*/
|
|
15
15
|
import type { ApiSpecMessage } from "../common";
|
|
16
|
-
import type { ApiEnvelope } from "../envelope";
|
|
16
|
+
import type { ApiEnvelope, ApiMessage } from "../envelope";
|
|
17
17
|
/** Response of `action=emailuser`. */
|
|
18
18
|
export interface ApiEmailUserResponse extends ApiEnvelope {
|
|
19
19
|
/** Result of `action=emailuser`. */
|
|
20
20
|
emailuser: {
|
|
21
21
|
/** Whether the message was accepted, or accepted with warnings, or failed. */
|
|
22
22
|
result: "Success" | "Warnings" | "Failure" | (string & {});
|
|
23
|
-
/** Non-fatal messages (e.g. subject/text transformations)
|
|
24
|
-
warnings?: ApiSpecMessage[];
|
|
25
|
-
/** In-band delivery errors (present when `result` is `Failure`)
|
|
26
|
-
errors?: ApiSpecMessage[];
|
|
23
|
+
/** Non-fatal messages (e.g. subject/text transformations), shaped per the request's `errorformat`. */
|
|
24
|
+
warnings?: ApiSpecMessage[] | ApiMessage[];
|
|
25
|
+
/** In-band delivery errors (present when `result` is `Failure`), shaped per the request's `errorformat`. */
|
|
26
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
27
27
|
};
|
|
28
28
|
}
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
* needs CSRF, title-level `edit`/`upload` rights on the file, and `reupload`
|
|
4
4
|
* (or `reupload-own` when reverting one's own upload). The result keys under
|
|
5
5
|
* `filerevert`: `result` is `Success`, or `Failure` with an in-band `errors`
|
|
6
|
-
* array (a per-item outcome, not a top-level
|
|
6
|
+
* array (a per-item outcome, not a top-level `ApiErrorResponse`).
|
|
7
7
|
*
|
|
8
8
|
* @see https://www.mediawiki.org/wiki/API:Filerevert
|
|
9
9
|
*/
|
|
10
10
|
import type { ApiSpecMessage } from "../common";
|
|
11
|
-
import type { ApiEnvelope } from "../envelope";
|
|
11
|
+
import type { ApiEnvelope, ApiMessage } from "../envelope";
|
|
12
12
|
/** Response of `action=filerevert`. */
|
|
13
13
|
export interface ApiFileRevertResponse extends ApiEnvelope {
|
|
14
14
|
/** Result of `action=filerevert`. */
|
|
15
15
|
filerevert: {
|
|
16
16
|
/** Outcome of the revert. */
|
|
17
17
|
result: "Success" | "Failure" | (string & {});
|
|
18
|
-
/** In-band messages when the revert did not apply
|
|
19
|
-
errors?: ApiSpecMessage[];
|
|
18
|
+
/** In-band messages when the revert did not apply, shaped per the request's `errorformat`. */
|
|
19
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
20
20
|
};
|
|
21
21
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* @see https://www.mediawiki.org/wiki/API:Imagerotate
|
|
16
16
|
*/
|
|
17
17
|
import type { ApiSpecMessage } from "../common";
|
|
18
|
-
import type { ApiEnvelope } from "../envelope";
|
|
18
|
+
import type { ApiEnvelope, ApiMessage } from "../envelope";
|
|
19
19
|
import type { ApiPageIdentity } from "./query";
|
|
20
20
|
/** One file entry of an `action=imagerotate` response. */
|
|
21
21
|
export interface ApiImageRotateEntry extends ApiPageIdentity {
|
|
@@ -27,8 +27,8 @@ export interface ApiImageRotateEntry extends ApiPageIdentity {
|
|
|
27
27
|
iw?: string;
|
|
28
28
|
/** Per-file outcome. */
|
|
29
29
|
result?: "Success" | "Failure" | (string & {});
|
|
30
|
-
/** In-band messages when the rotation failed
|
|
31
|
-
errors?: ApiSpecMessage[];
|
|
30
|
+
/** In-band messages when the rotation failed, shaped per the request's `errorformat`. */
|
|
31
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
32
32
|
}
|
|
33
33
|
/** Response of `action=imagerotate`. */
|
|
34
34
|
export interface ApiImageRotateResponse extends ApiEnvelope {
|
package/dist/core/index.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ export * from "./edit";
|
|
|
5
5
|
export * from "./move";
|
|
6
6
|
export * from "./purge";
|
|
7
7
|
export * from "./delete";
|
|
8
|
+
export * from "./undelete";
|
|
8
9
|
export * from "./block";
|
|
10
|
+
export * from "./unblock";
|
|
9
11
|
export * from "./watch";
|
|
10
12
|
export * from "./rollback";
|
|
11
13
|
export * from "./patrol";
|
package/dist/core/login.d.ts
CHANGED
|
@@ -12,15 +12,19 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @see https://www.mediawiki.org/wiki/API:Login
|
|
14
14
|
*/
|
|
15
|
-
import type { ApiEnvelope } from "../envelope";
|
|
15
|
+
import type { ApiEnvelope, ApiMessage } from "../envelope";
|
|
16
16
|
/** Response of the deprecated `action=login`. */
|
|
17
17
|
export interface ApiLoginResponse extends ApiEnvelope {
|
|
18
18
|
/** Result of `action=login`. */
|
|
19
19
|
login: {
|
|
20
20
|
/** Login outcome. */
|
|
21
21
|
result: "Success" | "Failed" | "NeedToken" | "WrongToken" | "Aborted" | (string & {});
|
|
22
|
-
/**
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Why the login failed, emitted when `result` is `Failed` or `Aborted`:
|
|
24
|
+
* a plain string under the default (`bc`) `errorformat`, an
|
|
25
|
+
* {@link ApiMessage} under a modern one.
|
|
26
|
+
*/
|
|
27
|
+
reason?: string | ApiMessage;
|
|
24
28
|
/** Login token echoed back on a `NeedToken` round trip. */
|
|
25
29
|
token?: string;
|
|
26
30
|
/** User id of the logged-in account (legacy `lguserid` spelling). */
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @see https://www.mediawiki.org/wiki/API:Managetags
|
|
9
9
|
*/
|
|
10
10
|
import type { ApiSpecMessage } from "../common";
|
|
11
|
-
import type { ApiEnvelope } from "../envelope";
|
|
11
|
+
import type { ApiEnvelope, ApiMessage } from "../envelope";
|
|
12
12
|
/** `action=managetags` operation. Open union for forward compatibility. */
|
|
13
13
|
export type ApiManageTagsOperation = "activate" | "create" | "deactivate" | "delete" | (string & {});
|
|
14
14
|
/** Response of `action=managetags`. */
|
|
@@ -23,7 +23,7 @@ export interface ApiManageTagsResponse extends ApiEnvelope {
|
|
|
23
23
|
success: boolean;
|
|
24
24
|
/** Log entry id recorded for the operation. */
|
|
25
25
|
logid?: number;
|
|
26
|
-
/** Non-fatal messages (e.g. a deprecation notice)
|
|
27
|
-
warnings?: ApiSpecMessage[];
|
|
26
|
+
/** Non-fatal messages (e.g. a deprecation notice), shaped per the request's `errorformat`. */
|
|
27
|
+
warnings?: ApiSpecMessage[] | ApiMessage[];
|
|
28
28
|
};
|
|
29
29
|
}
|
package/dist/core/move.d.ts
CHANGED
|
@@ -12,20 +12,20 @@
|
|
|
12
12
|
* @see https://www.mediawiki.org/wiki/API:Move
|
|
13
13
|
*/
|
|
14
14
|
import type { ApiSpecMessage } from "../common";
|
|
15
|
-
import type { ApiEnvelope } from "../envelope";
|
|
15
|
+
import type { ApiEnvelope, ApiMessage } from "../envelope";
|
|
16
16
|
/** One subpage move outcome within `subpages`/`subpages-talk`. */
|
|
17
17
|
export interface ApiMoveSubpage {
|
|
18
18
|
/** Old subpage title. */
|
|
19
19
|
from?: string;
|
|
20
20
|
/** New subpage title, when the subpage moved. */
|
|
21
21
|
to?: string;
|
|
22
|
-
/** Why the subpage did not move, when it failed
|
|
23
|
-
errors?: ApiSpecMessage[];
|
|
22
|
+
/** Why the subpage did not move, when it failed, shaped per the request's `errorformat`. */
|
|
23
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
24
24
|
}
|
|
25
25
|
/** The object form of `subpages`, returned only when the whole move failed. */
|
|
26
26
|
export interface ApiMoveSubpageErrors {
|
|
27
|
-
/** Why no subpage could be moved
|
|
28
|
-
errors?: ApiSpecMessage[];
|
|
27
|
+
/** Why no subpage could be moved, shaped per the request's `errorformat`. */
|
|
28
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
29
29
|
}
|
|
30
30
|
/** The `move` object of a successful `action=move` response. */
|
|
31
31
|
export interface ApiMoveResult {
|
|
@@ -45,8 +45,8 @@ export interface ApiMoveResult {
|
|
|
45
45
|
talkto?: string;
|
|
46
46
|
/** Whether the talk-page destination already existed (redirect or not). A real `boolean`. */
|
|
47
47
|
talkmoveoverredirect?: boolean;
|
|
48
|
-
/** Why the talk-page move failed, instead of `talkfrom`/`talkto`. */
|
|
49
|
-
"talkmove-errors"?: ApiSpecMessage[];
|
|
48
|
+
/** Why the talk-page move failed, instead of `talkfrom`/`talkto`, shaped per the request's `errorformat`. */
|
|
49
|
+
"talkmove-errors"?: ApiSpecMessage[] | ApiMessage[];
|
|
50
50
|
/**
|
|
51
51
|
* Subpage move outcome (`movesubpages=1`). `formatversion=2` returns either
|
|
52
52
|
* an array of per-subpage outcomes or an object of errors, so both shapes are
|
package/dist/core/options.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* shapes that `prop=imageinfo` and `list=allimages` return.
|
|
5
5
|
*
|
|
6
6
|
* Config values, so the switches are real booleans (`false` is returned), not
|
|
7
|
-
*
|
|
7
|
+
* `Flag`s. Repos report only the optional settings they configure, so
|
|
8
8
|
* the key set varies by site; `apiurl` exists only for `ForeignAPIRepo`
|
|
9
9
|
* backends.
|
|
10
10
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* page shape grows as coverage expands without this file depending on them.
|
|
7
7
|
*/
|
|
8
8
|
import type { Flag, NamespaceIndex } from "../../common";
|
|
9
|
-
import type { ApiEnvelope } from "../../envelope";
|
|
9
|
+
import type { ApiEnvelope, ApiMessage } from "../../envelope";
|
|
10
10
|
/**
|
|
11
11
|
* Continuation tokens returned by `action=query`. @see https://www.mediawiki.org/wiki/API:Continue
|
|
12
12
|
*
|
|
@@ -275,8 +275,11 @@ export interface ApiPageIdentity {
|
|
|
275
275
|
known?: Flag;
|
|
276
276
|
/** `true` when the supplied title is not a valid title. */
|
|
277
277
|
invalid?: Flag;
|
|
278
|
-
/**
|
|
279
|
-
|
|
278
|
+
/**
|
|
279
|
+
* Why the title is `invalid`: a plain string under the default (`bc`)
|
|
280
|
+
* `errorformat`, an {@link ApiMessage} under a modern one.
|
|
281
|
+
*/
|
|
282
|
+
invalidreason?: string | ApiMessage;
|
|
280
283
|
/** `true` for pages in a special namespace. */
|
|
281
284
|
special?: Flag;
|
|
282
285
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @see https://www.mediawiki.org/wiki/API:Info
|
|
7
7
|
*/
|
|
8
8
|
import type { ApiWatchlistLabel, ContentFormat, ContentModel, Flag, Timestamp } from "../../common";
|
|
9
|
+
import type { ApiMessageParam } from "../../envelope";
|
|
9
10
|
import type { QueryPage, QueryPageExisting } from "./index";
|
|
10
11
|
/** One entry of a page's `protection` array (`inprop=protection`). */
|
|
11
12
|
export interface ApiPageProtection {
|
|
@@ -29,17 +30,22 @@ export interface ApiPageProtection {
|
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
32
|
* One permission-check failure reported under `intestactionsdetail=full|quick`.
|
|
32
|
-
* The
|
|
33
|
+
* The text-bearing keys depend on the request's `errorformat`: `text` for
|
|
34
|
+
* `plaintext`/`wikitext`, `html` for `html`, `key`/`params` for `raw`, and none
|
|
35
|
+
* of them for `none`. A request using the default (`bc`) format is rendered as
|
|
36
|
+
* `plaintext` here.
|
|
33
37
|
*/
|
|
34
38
|
export interface ApiActionPermission {
|
|
35
39
|
/** Machine-readable code, e.g. `sitejsprotected`. */
|
|
36
|
-
code
|
|
37
|
-
/** Rendered message text. */
|
|
40
|
+
code: string;
|
|
41
|
+
/** Rendered message text (`plaintext`/`wikitext`). */
|
|
38
42
|
text?: string;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
+
/** Parsed message HTML (`html`). */
|
|
44
|
+
html?: string;
|
|
45
|
+
/** i18n message key (`raw`). */
|
|
46
|
+
key?: string;
|
|
47
|
+
/** i18n message parameters (`raw`). */
|
|
48
|
+
params?: ApiMessageParam[];
|
|
43
49
|
}
|
|
44
50
|
/**
|
|
45
51
|
* Fields `prop=info` contributes to {@link ApiPage}. {@link InfoPage} projects
|
|
@@ -211,7 +217,7 @@ declare module "./index" {
|
|
|
211
217
|
export type InfoPage = QueryPage<keyof ApiPageInfo>;
|
|
212
218
|
/**
|
|
213
219
|
* {@link InfoPage} for a page that exists: the identity fields and the
|
|
214
|
-
* unconditional `prop=info` fields (
|
|
220
|
+
* unconditional `prop=info` fields (`PropConstantKeys`) are required;
|
|
215
221
|
* `inprop`-gated fields stay optional.
|
|
216
222
|
*/
|
|
217
223
|
export type InfoPageExisting = QueryPageExisting<keyof ApiPageInfo>;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @see https://www.mediawiki.org/wiki/API:Users
|
|
6
6
|
*/
|
|
7
7
|
import type { ApiSpecMessage, BlockExpiry, Expiry, Flag, Timestamp } from "../../common";
|
|
8
|
+
import type { ApiMessage } from "../../envelope";
|
|
8
9
|
/**
|
|
9
10
|
* Block details, as emitted for `usprop=blockinfo` (list=users) and
|
|
10
11
|
* `uiprop=blockinfo` (meta=userinfo). Only present when the user is blocked.
|
|
@@ -135,10 +136,10 @@ export interface ApiUser extends ApiUserCore {
|
|
|
135
136
|
*/
|
|
136
137
|
cancreate?: boolean;
|
|
137
138
|
/**
|
|
138
|
-
* Why {@link cancreate} is `false
|
|
139
|
-
*
|
|
139
|
+
* Why {@link cancreate} is `false` (e.g. a reserved username), shaped per the
|
|
140
|
+
* request's `errorformat`. Emitted only when the creation check failed.
|
|
140
141
|
*/
|
|
141
|
-
cancreateerror?: ApiSpecMessage[];
|
|
142
|
+
cancreateerror?: ApiSpecMessage[] | ApiMessage[];
|
|
142
143
|
/**
|
|
143
144
|
* The user is hidden (suppressed via a hidden block); a {@link Flag}.
|
|
144
145
|
* Emitted regardless of `usprop`.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* address); needs a session token and the corresponding rights. On success
|
|
5
5
|
* `ApiRemoveAuthenticationData` emits a single field:
|
|
6
6
|
* `removeauthenticationdata.status` = `success`. An unusable removal request is
|
|
7
|
-
* a top-level
|
|
7
|
+
* a top-level `ApiErrorResponse` (badrequest).
|
|
8
8
|
*
|
|
9
9
|
* @see https://www.mediawiki.org/wiki/API:Removeauthenticationdata
|
|
10
10
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* `action=resetpassword` response — password reset via `PasswordResetter`. On a
|
|
3
3
|
* completed (or queued) reset `ApiResetPassword` emits a single field:
|
|
4
4
|
* `resetpassword.status` = `success`; every other outcome is a top-level
|
|
5
|
-
*
|
|
5
|
+
* `ApiErrorResponse` (dieStatus).
|
|
6
6
|
*
|
|
7
7
|
* @see https://www.mediawiki.org/wiki/API:Resetpassword
|
|
8
8
|
*/
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* @see https://www.mediawiki.org/wiki/API:Revisiondelete
|
|
15
15
|
*/
|
|
16
16
|
import type { Timestamp, ApiSpecMessage } from "../common";
|
|
17
|
-
import type { ApiEnvelope } from "../envelope";
|
|
17
|
+
import type { ApiEnvelope, ApiMessage } from "../envelope";
|
|
18
18
|
/** Per-item outcome. Open union for forward compatibility. */
|
|
19
19
|
export type RevisionDeleteStatus = "Success" | "Fail" | (string & {});
|
|
20
20
|
/** One item (revision / log entry / image) processed by the request. */
|
|
@@ -59,10 +59,10 @@ export interface ApiRevisionDeleteItem {
|
|
|
59
59
|
contenthidden?: boolean;
|
|
60
60
|
/** File URL, or a `Special:Revisiondelete` link when the content is deleted but viewable. File versions only. */
|
|
61
61
|
url?: string;
|
|
62
|
-
/** In-band messages when this item failed
|
|
63
|
-
errors?: ApiSpecMessage[];
|
|
64
|
-
/** In-band warnings for this item
|
|
65
|
-
warnings?: ApiSpecMessage[];
|
|
62
|
+
/** In-band messages when this item failed, shaped per the request's `errorformat`. */
|
|
63
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
64
|
+
/** In-band warnings for this item, shaped per the request's `errorformat`. */
|
|
65
|
+
warnings?: ApiSpecMessage[] | ApiMessage[];
|
|
66
66
|
}
|
|
67
67
|
/** The `revisiondelete` object of a successful response. */
|
|
68
68
|
export interface ApiRevisionDeleteResult {
|
|
@@ -72,10 +72,10 @@ export interface ApiRevisionDeleteResult {
|
|
|
72
72
|
target: string;
|
|
73
73
|
/** Per-item results. */
|
|
74
74
|
items: ApiRevisionDeleteItem[];
|
|
75
|
-
/** In-band messages when the overall operation failed
|
|
76
|
-
errors?: ApiSpecMessage[];
|
|
77
|
-
/** In-band warnings from the overall operation
|
|
78
|
-
warnings?: ApiSpecMessage[];
|
|
75
|
+
/** In-band messages when the overall operation failed, shaped per the request's `errorformat`. */
|
|
76
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
77
|
+
/** In-band warnings from the overall operation, shaped per the request's `errorformat`. */
|
|
78
|
+
warnings?: ApiSpecMessage[] | ApiMessage[];
|
|
79
79
|
}
|
|
80
80
|
/** Response of `action=revisiondelete`. */
|
|
81
81
|
export interface ApiRevisionDeleteResponse extends ApiEnvelope {
|
package/dist/core/tag.d.ts
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* @see https://www.mediawiki.org/wiki/API:Tag
|
|
11
11
|
*/
|
|
12
12
|
import type { Flag, ApiSpecMessage } from "../common";
|
|
13
|
-
import type { ApiEnvelope } from "../envelope";
|
|
13
|
+
import type { ApiEnvelope, ApiMessage, ApiMessageParam } from "../envelope";
|
|
14
|
+
import type { ApiBlockInfo } from "./query/users";
|
|
14
15
|
/** One targeted entry of an `action=tag` response. */
|
|
15
16
|
export interface ApiTagEntry {
|
|
16
17
|
/** Revision id the tags were applied to. */
|
|
@@ -20,9 +21,9 @@ export interface ApiTagEntry {
|
|
|
20
21
|
/** Recent-change id the tags were applied to. */
|
|
21
22
|
rcid?: number;
|
|
22
23
|
/**
|
|
23
|
-
* Per-target outcome
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* Per-target outcome: `success`, `failure`, `skipped` (rate throttle) or
|
|
25
|
+
* `error` (invalid target id, or the performer is blocked from the target
|
|
26
|
+
* page). Open union for forward compat.
|
|
26
27
|
*/
|
|
27
28
|
status: "success" | "failure" | "skipped" | "error" | (string & {});
|
|
28
29
|
/** The tag set already matched — no log entry was created. A {@link Flag}. */
|
|
@@ -33,15 +34,40 @@ export interface ApiTagEntry {
|
|
|
33
34
|
added?: string[];
|
|
34
35
|
/** Tags removed from this target. */
|
|
35
36
|
removed?: string[];
|
|
36
|
-
/** In-band messages when the target could not be tagged (`failure` only)
|
|
37
|
-
errors?: ApiSpecMessage[];
|
|
37
|
+
/** In-band messages when the target could not be tagged (`failure` only), shaped per the request's `errorformat`. */
|
|
38
|
+
errors?: ApiSpecMessage[] | ApiMessage[];
|
|
38
39
|
/**
|
|
39
40
|
* On `error` entries the formatted failure message is merged into the entry:
|
|
40
|
-
* `code` is the message's API code
|
|
41
|
+
* `code` is the message's API code, and the text-bearing keys follow the
|
|
42
|
+
* request's `errorformat` — `info` under the default (`bc`) format, `text`
|
|
43
|
+
* (`plaintext`/`wikitext`), `html`, `key`/`params` (`raw`), or none of them
|
|
44
|
+
* for `none`.
|
|
41
45
|
*/
|
|
42
46
|
code?: string;
|
|
43
|
-
/** Message text
|
|
47
|
+
/** Message text under the default (`bc`) `errorformat`. */
|
|
44
48
|
info?: string;
|
|
49
|
+
/** Rendered message text (`plaintext`/`wikitext`). */
|
|
50
|
+
text?: string;
|
|
51
|
+
/** Parsed message HTML (`html`). */
|
|
52
|
+
html?: string;
|
|
53
|
+
/** i18n message key (`raw`). */
|
|
54
|
+
key?: string;
|
|
55
|
+
/** i18n message parameters (`raw`). */
|
|
56
|
+
params?: ApiMessageParam[];
|
|
57
|
+
/**
|
|
58
|
+
* Structured message data, present under a modern `errorformat` (the
|
|
59
|
+
* default `bc` format merges it into the entry instead).
|
|
60
|
+
*/
|
|
61
|
+
data?: {
|
|
62
|
+
blockinfo?: ApiBlockInfo;
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Block details, when the performer is blocked from the target page. Under
|
|
67
|
+
* the default (`bc`) `errorformat` it is merged into the entry itself; a
|
|
68
|
+
* modern one nests it under {@link ApiTagEntry.data}.
|
|
69
|
+
*/
|
|
70
|
+
blockinfo?: ApiBlockInfo;
|
|
45
71
|
}
|
|
46
72
|
/** Response of `action=tag`. */
|
|
47
73
|
export interface ApiTagResponse extends ApiEnvelope {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `action=unblock` response — removing a block, returned under a top-level
|
|
3
|
+
* `unblock` object. Requires the `block` right.
|
|
4
|
+
*
|
|
5
|
+
* fv2 note: the unblock result uses `userid` (lowercase), unlike the block
|
|
6
|
+
* result's `userID`.
|
|
7
|
+
*
|
|
8
|
+
* @see https://www.mediawiki.org/wiki/API:Block
|
|
9
|
+
*/
|
|
10
|
+
import type { Timestamp } from "../common";
|
|
11
|
+
import type { ApiEnvelope } from "../envelope";
|
|
12
|
+
/** The `unblock` object of an `action=unblock` response. */
|
|
13
|
+
export interface ApiUnblockResult {
|
|
14
|
+
/** Removed block id. */
|
|
15
|
+
id: number;
|
|
16
|
+
/** Unblocked user name / IP; empty string when removing an autoblock. */
|
|
17
|
+
user: string;
|
|
18
|
+
/** Unblocked user id (`0` for IPs and autoblocks). Note lowercase, unlike the block result. */
|
|
19
|
+
userid: number;
|
|
20
|
+
/** Unblock reason (echoed back). */
|
|
21
|
+
reason: string;
|
|
22
|
+
/** Whether the unblock added the unblocked user to the unblocker's watchlist. */
|
|
23
|
+
watchuser: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Expiry applied to the watched user page, present only when the request
|
|
26
|
+
* passed `watchlistexpiry` with `watchuser`; `null` when the page is not
|
|
27
|
+
* actually watched.
|
|
28
|
+
*/
|
|
29
|
+
watchlistexpiry?: Timestamp | null;
|
|
30
|
+
}
|
|
31
|
+
/** Response of `action=unblock`. */
|
|
32
|
+
export interface ApiUnblockResponse extends ApiEnvelope {
|
|
33
|
+
/** Result of `action=unblock`. */
|
|
34
|
+
unblock: ApiUnblockResult;
|
|
35
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `action=undelete` response — restoring a deleted page, returned under a
|
|
3
|
+
* top-level `undelete` object. Requires the `delete` right.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.mediawiki.org/wiki/API:Undelete
|
|
6
|
+
*/
|
|
7
|
+
import type { ApiEnvelope } from "../envelope";
|
|
8
|
+
/** The `undelete` object of an `action=undelete` response. */
|
|
9
|
+
export interface ApiUndeleteResult {
|
|
10
|
+
/** Restored page title. */
|
|
11
|
+
title: string;
|
|
12
|
+
/** Number of revisions restored. */
|
|
13
|
+
revisions: number;
|
|
14
|
+
/** Number of file versions restored. */
|
|
15
|
+
fileversions: number;
|
|
16
|
+
/** Undelete reason (echoed back). */
|
|
17
|
+
reason: string;
|
|
18
|
+
}
|
|
19
|
+
/** Response of `action=undelete`. */
|
|
20
|
+
export interface ApiUndeleteResponse extends ApiEnvelope {
|
|
21
|
+
/** Result of `action=undelete`. */
|
|
22
|
+
undelete: ApiUndeleteResult;
|
|
23
|
+
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* @see https://www.mediawiki.org/wiki/API:Validatepassword
|
|
15
15
|
*/
|
|
16
16
|
import type { ApiSpecMessage } from "../common";
|
|
17
|
-
import type { ApiEnvelope } from "../envelope";
|
|
17
|
+
import type { ApiEnvelope, ApiMessage } from "../envelope";
|
|
18
18
|
/** Password-policy verdict mapped from `checkPasswordValidity`'s Status. Open union. */
|
|
19
19
|
export type ApiPasswordValidity = "Good" | "Change" | "Invalid" | (string & {});
|
|
20
20
|
/** Response of `action=validatepassword`. */
|
|
@@ -23,7 +23,7 @@ export interface ApiValidatePasswordResponse extends ApiEnvelope {
|
|
|
23
23
|
validatepassword: {
|
|
24
24
|
/** Password-policy verdict for the submitted password. */
|
|
25
25
|
validity: ApiPasswordValidity;
|
|
26
|
-
/** Policy messages explaining a non-`Good` verdict
|
|
27
|
-
validitymessages?: ApiSpecMessage[];
|
|
26
|
+
/** Policy messages explaining a non-`Good` verdict, shaped per the request's `errorformat`. */
|
|
27
|
+
validitymessages?: ApiSpecMessage[] | ApiMessage[];
|
|
28
28
|
};
|
|
29
29
|
}
|
package/dist/core/watch.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @see https://www.mediawiki.org/wiki/API:Watch
|
|
8
8
|
*/
|
|
9
9
|
import type { ApiWatchlistLabel, Expiry, NamespaceIndex, ApiSpecMessage } from "../common";
|
|
10
|
-
import type { ApiEnvelope } from "../envelope";
|
|
10
|
+
import type { ApiEnvelope, ApiError, ApiMessage } from "../envelope";
|
|
11
11
|
/** One watched/unwatched page. */
|
|
12
12
|
export interface ApiWatchEntry {
|
|
13
13
|
/** Page title. */
|
|
@@ -27,10 +27,17 @@ export interface ApiWatchEntry {
|
|
|
27
27
|
* direction only.
|
|
28
28
|
*/
|
|
29
29
|
expiry?: Expiry;
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
/**
|
|
31
|
+
* In-band messages when the watch/unwatch operation failed (pageset mode; the
|
|
32
|
+
* legacy `title` mode dies with a top-level error instead). Heterogeneous:
|
|
33
|
+
* messages raised by the operation itself follow the request's `errorformat`
|
|
34
|
+
* ({@link ApiSpecMessage} under `bc`, {@link ApiMessage} under a modern one),
|
|
35
|
+
* while a watchlist-label failure carries the legacy `{ code, info }` shape
|
|
36
|
+
* under `bc`, and an {@link ApiMessage} under a modern one.
|
|
37
|
+
*/
|
|
38
|
+
errors?: (ApiSpecMessage | ApiMessage | ApiError)[];
|
|
39
|
+
/** In-band warnings for a failed operation (present when non-empty), shaped per the request's `errorformat`. */
|
|
40
|
+
warnings?: ApiSpecMessage[] | ApiMessage[];
|
|
34
41
|
/**
|
|
35
42
|
* Watchlist labels just saved for this page, echoed back when the request
|
|
36
43
|
* passed `labels` and `$wgEnableWatchlistLabels` is on.
|
package/dist/envelope/index.d.ts
CHANGED
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @see https://www.mediawiki.org/wiki/API:Errors_and_warnings
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* A single i18n message parameter under `errorformat=raw`: a scalar, a bare
|
|
16
|
+
* nested message ({@link ApiRawMessage}, produced when a message sits inside a
|
|
17
|
+
* list), or an object spec ({@link ApiMessageParamSpec}). Plain-text parameters
|
|
18
|
+
* are inlined as scalars, and a numeric parameter may arrive as a bare number
|
|
19
|
+
* or a `{ num }` spec.
|
|
20
|
+
*/
|
|
21
|
+
export type ApiMessageParam = string | number | ApiRawMessage | ApiMessageParamSpec;
|
|
14
22
|
/**
|
|
15
23
|
* A single message under a modern `errorformat` (an entry of the `errors` or
|
|
16
24
|
* `warnings` array). Which text-bearing field is present depends on the
|
|
@@ -19,19 +27,15 @@
|
|
|
19
27
|
*/
|
|
20
28
|
export interface ApiMessage {
|
|
21
29
|
/** Machine-readable code, e.g. `badvalue`, `unrecognizedparams`. */
|
|
22
|
-
code
|
|
30
|
+
code: string;
|
|
23
31
|
/** Rendered message (`errorformat=plaintext`/`wikitext`). */
|
|
24
32
|
text?: string;
|
|
25
33
|
/** Parsed message HTML (`errorformat=html`). */
|
|
26
34
|
html?: string;
|
|
27
35
|
/** i18n message key (`errorformat=raw`). */
|
|
28
36
|
key?: string;
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
* object spec ({@link ApiMessageParamSpec}); numeric params occur too, and a
|
|
32
|
-
* parameter may itself be a message.
|
|
33
|
-
*/
|
|
34
|
-
params?: (string | number | ApiMessageParamSpec)[];
|
|
37
|
+
/** i18n message parameters (`errorformat=raw`). */
|
|
38
|
+
params?: ApiMessageParam[];
|
|
35
39
|
/** Module the message originated from, e.g. `main`, `query+info`. */
|
|
36
40
|
module?: string;
|
|
37
41
|
/** Extra structured data some messages attach. */
|
|
@@ -45,43 +49,76 @@ export interface ApiMessage {
|
|
|
45
49
|
*/
|
|
46
50
|
export interface ApiRawMessage {
|
|
47
51
|
/** i18n message key of the nested message. */
|
|
48
|
-
key
|
|
52
|
+
key: string;
|
|
49
53
|
/**
|
|
50
54
|
* Parameters of the nested message, which may themselves be messages,
|
|
51
55
|
* serialized the same way as {@link ApiMessage.params}.
|
|
52
56
|
*/
|
|
53
|
-
params
|
|
57
|
+
params: ApiMessageParam[];
|
|
54
58
|
}
|
|
55
59
|
/**
|
|
56
60
|
* Object form of a raw-format message parameter. Exactly one spec kind is
|
|
57
|
-
* present at runtime:
|
|
58
|
-
* (pre-escaped text
|
|
59
|
-
*
|
|
61
|
+
* present at runtime: a nested message
|
|
62
|
+
* (`message`), pre-escaped text (`plaintext`), raw text (`raw`), a number
|
|
63
|
+
* (`num`), a duration in seconds (`duration`/`period`), an expiry (`expiry`),
|
|
64
|
+
* a date/time (`datetime`/`date`/`time`), a user group (`group`), a byte size
|
|
65
|
+
* (`size`), a bit rate (`bitrate`), the deprecated object form (`object`), or a
|
|
66
|
+
* list (`list` + `type`).
|
|
60
67
|
*/
|
|
61
68
|
export interface ApiMessageParamSpec {
|
|
62
69
|
/** The parameter, when it is itself a message. */
|
|
63
70
|
message?: ApiRawMessage;
|
|
64
71
|
/** Pre-escaped parameter text. */
|
|
65
72
|
plaintext?: string;
|
|
73
|
+
/** Raw parameter text, inserted after formatting. */
|
|
74
|
+
raw?: string;
|
|
66
75
|
/** Numeric parameter. */
|
|
67
76
|
num?: number;
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
|
|
77
|
+
/** Duration in seconds, rendered in full. */
|
|
78
|
+
duration?: number;
|
|
79
|
+
/** Duration in seconds, rendered abbreviated. */
|
|
80
|
+
period?: number;
|
|
81
|
+
/** Expiry timestamp, or `infinity`. */
|
|
82
|
+
expiry?: string;
|
|
83
|
+
/** Date and time. */
|
|
84
|
+
datetime?: string;
|
|
85
|
+
/** Date. */
|
|
86
|
+
date?: string;
|
|
87
|
+
/** Time. */
|
|
88
|
+
time?: string;
|
|
89
|
+
/** User group name. */
|
|
90
|
+
group?: string;
|
|
91
|
+
/** Size in bytes. */
|
|
92
|
+
size?: number;
|
|
93
|
+
/** Bit rate in bit/s. */
|
|
94
|
+
bitrate?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Object parameter, serialized as the object's string value.
|
|
97
|
+
*
|
|
98
|
+
* @deprecated since MediaWiki 1.43; removed in 1.44.
|
|
99
|
+
*/
|
|
100
|
+
object?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Parameter items, when the parameter is a list. Serialized as an array
|
|
103
|
+
* from MediaWiki 1.43 on; earlier versions keep the input array's keys, so
|
|
104
|
+
* a non-contiguous list comes back as an object.
|
|
105
|
+
*/
|
|
106
|
+
list?: ApiMessageParam[] | Record<string, ApiMessageParam>;
|
|
107
|
+
/** Rendering type of the {@link ApiMessageParamSpec.list} items. Open union for forward compatibility. */
|
|
108
|
+
type?: "comma" | "semicolon" | "pipe" | "text" | (string & {});
|
|
72
109
|
}
|
|
73
110
|
/** The `error` object under the default (`bc`) `errorformat`. */
|
|
74
111
|
export interface ApiError {
|
|
75
112
|
/** Machine-readable error code, e.g. `badtoken`. */
|
|
76
|
-
code
|
|
113
|
+
code: string;
|
|
77
114
|
/** Human-readable description provided by the server. */
|
|
78
|
-
info
|
|
115
|
+
info: string;
|
|
79
116
|
/** Docs link plus deprecation notices; nested in `error` under the `bc` format. */
|
|
80
117
|
docref?: string;
|
|
81
118
|
/** PHP backtrace, when `$wgShowExceptionDetails` is on (non-usage exceptions). */
|
|
82
119
|
trace?: string;
|
|
83
120
|
/**
|
|
84
|
-
* Structured
|
|
121
|
+
* Structured data attached to the message by the emitting code, merged
|
|
85
122
|
* into this object as top-level keys.
|
|
86
123
|
*/
|
|
87
124
|
[key: string]: unknown;
|
|
@@ -89,7 +126,7 @@ export interface ApiError {
|
|
|
89
126
|
/** One `bc`-format warning entry (the value of a module key in `warnings`). */
|
|
90
127
|
export interface ApiWarningDetail {
|
|
91
128
|
/** Warning text (`bc` errorformat). */
|
|
92
|
-
warnings
|
|
129
|
+
warnings: string;
|
|
93
130
|
}
|
|
94
131
|
/**
|
|
95
132
|
* Warnings shape, polymorphic on `errorformat`:
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
/**
|
|
23
23
|
* A `meta=babel` result: language code → Babel level string (e.g. `"N"`, `"1"`…
|
|
24
24
|
* `"5"`). Site-configured, so the key set is open. An unknown user is an
|
|
25
|
-
*
|
|
25
|
+
* `ApiErrorResponse`, not this type.
|
|
26
26
|
*/
|
|
27
27
|
export type ApiBabelResult = Record<string, string>;
|
|
28
28
|
declare module "types-mediawiki-response" {
|
|
@@ -111,10 +111,44 @@ export interface ApiGlobalBlockResult {
|
|
|
111
111
|
/** Block expiry, or `infinite`. */
|
|
112
112
|
expiry?: BlockExpiry;
|
|
113
113
|
}
|
|
114
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* One entry of the legacy `error.globalblock` array that `action=globalblock`
|
|
116
|
+
* writes when a block or unblock fails. Unlike every other module, this one
|
|
117
|
+
* reports the failure **in-band** under the root `error` key
|
|
118
|
+
* (`{ error: { globalblock: [...] } }`) instead of a top-level error object, so
|
|
119
|
+
* that `error` carries no `code`/`info`. The shape is the same under every
|
|
120
|
+
* `errorformat`.
|
|
121
|
+
*/
|
|
122
|
+
export interface ApiGlobalBlockLegacyError {
|
|
123
|
+
/** Machine-readable code, e.g. `globalblocking-notblocked`. */
|
|
124
|
+
code: string;
|
|
125
|
+
/** Rendered message text. */
|
|
126
|
+
message: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Failure response of `action=globalblock`: the legacy `error.globalblock`
|
|
130
|
+
* array, written under the root `error` key rather than as a standard
|
|
131
|
+
* `ApiErrorResponse` — see {@link ApiGlobalBlockLegacyError}.
|
|
132
|
+
*/
|
|
133
|
+
export interface ApiGlobalBlockErrorResponse extends ApiEnvelope {
|
|
134
|
+
/** The failures, one entry per message. */
|
|
135
|
+
error: {
|
|
136
|
+
globalblock: ApiGlobalBlockLegacyError[];
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Response of `action=globalblock`. A failed block/unblock is reported in-band
|
|
141
|
+
* under the root `error` key; with `alsolocal=1`, a failed **local** block is
|
|
142
|
+
* reported the same way while the global block still succeeds, so both keys can
|
|
143
|
+
* appear together — see {@link ApiGlobalBlockLegacyError}.
|
|
144
|
+
*/
|
|
115
145
|
export interface ApiGlobalBlockResponse extends ApiEnvelope {
|
|
116
146
|
/** Result of `action=globalblock`. */
|
|
117
147
|
globalblock: ApiGlobalBlockResult;
|
|
148
|
+
/** Legacy errors, when the global block succeeded but the local one failed. */
|
|
149
|
+
error?: {
|
|
150
|
+
globalblock: ApiGlobalBlockLegacyError[];
|
|
151
|
+
};
|
|
118
152
|
}
|
|
119
153
|
declare module "types-mediawiki-response" {
|
|
120
154
|
interface ApiQueryResult {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* fv2 notes: `ApiScribuntoConsole` writes its result keys at the **root** of the
|
|
12
12
|
* response (`addValue( null, $key, $value )`), not under a `scribunto-console`
|
|
13
13
|
* wrapper. A Lua failure is reported **in band** — `type: "error"` with `html` /
|
|
14
|
-
* `message` / `messagename` — rather than as an
|
|
14
|
+
* `message` / `messagename` — rather than as an `ApiErrorResponse`; only
|
|
15
15
|
* transport-level problems (missing `token`, oversized session …) surface as a
|
|
16
16
|
* real error. `type: "normal"` carries `print` (captured `print()` output) and
|
|
17
17
|
* `return` (the stringified returned value); a question with no `return` yields an
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* A successful response is a top-level `result` object (not a `thank` key);
|
|
12
12
|
* every failure (invalid revision, self-thanks, rate limit …) is a top-level
|
|
13
|
-
*
|
|
13
|
+
* `ApiErrorResponse`. `success` is the number `1`.
|
|
14
14
|
*
|
|
15
15
|
* @see https://www.mediawiki.org/wiki/Extension:Thanks
|
|
16
16
|
*/
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* revision through a deferred update; when Flow or Liquid Threads owns the talk
|
|
15
15
|
* page the module posts through that extension and applies no tag. Failures
|
|
16
16
|
* (unknown target, blocked talk page, …) are top-level
|
|
17
|
-
*
|
|
17
|
+
* `ApiErrorResponse`s.
|
|
18
18
|
*
|
|
19
19
|
* fv2 notes: the reply is a single `redirect` object at the root — not a
|
|
20
20
|
* `result` wrapper; `pageName` is the DB key form (underscores).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "types-mediawiki-response",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "TypeScript type definitions for MediaWiki Action API responses",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"action-api",
|
|
@@ -47,11 +47,12 @@
|
|
|
47
47
|
"test": "pnpm run typecheck",
|
|
48
48
|
"audit:literals": "tsx scripts/audit-literals.ts",
|
|
49
49
|
"audit:paraminfo": "tsx scripts/audit-paraminfo.ts",
|
|
50
|
-
"check": "pnpm run format:check && pnpm run lint && pnpm run test && pnpm run audit:literals && pnpm run audit:paraminfo && pnpm run check:ext && pnpm run check:pack",
|
|
50
|
+
"check": "pnpm run format:check && pnpm run lint && pnpm run test && pnpm run audit:literals && pnpm run audit:paraminfo && pnpm run check:ext && pnpm run check:pack && pnpm run check:examples",
|
|
51
51
|
"prepublishOnly": "pnpm run build",
|
|
52
52
|
"fetch:fixtures": "tsx scripts/fetch-fixtures.ts",
|
|
53
53
|
"fetch:paraminfo": "tsx scripts/fetch-paraminfo.ts",
|
|
54
54
|
"check:ext": "tsx scripts/check-ext-consumer.ts",
|
|
55
|
+
"check:examples": "pnpm run build && pnpm --filter ./examples/* run typecheck",
|
|
55
56
|
"check:pack": "pnpm run build && attw --pack .",
|
|
56
57
|
"release": "pnpm run check && bumpp",
|
|
57
58
|
"docs:dev": "pnpm --filter types-mediawiki-response-docs dev",
|
|
@@ -60,11 +61,11 @@
|
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
63
|
"@arethetypeswrong/cli": "0.18.5",
|
|
63
|
-
"@types/node": "^
|
|
64
|
+
"@types/node": "^26.6.3",
|
|
64
65
|
"bumpp": "^12.3.0",
|
|
65
66
|
"expect-type": "1.4.0",
|
|
66
|
-
"oxfmt": "0.
|
|
67
|
-
"oxlint": "1.
|
|
67
|
+
"oxfmt": "0.71.0",
|
|
68
|
+
"oxlint": "1.86.0",
|
|
68
69
|
"tsx": "^4.23.13",
|
|
69
70
|
"typescript": "^7.0.2"
|
|
70
71
|
},
|