Skip to content

Commit 6b0ea7f

Browse files
author
Adrien LESÉNÉCHAL
committed
Update types & fix timestamps
Replace timestamps with a fixed string to prevent these from being changed each time we re-run the script
1 parent 86f9015 commit 6b0ea7f

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

api_params/index.d.ts

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ declare global {
475475
*/
476476
userid?: number;
477477
/**
478-
* Expiry time. May be relative (e.g. `5 months` or `2 weeks`) or absolute (e.g. `2014-09-18T12:34:56Z`). If set to `infinite`, `indefinite`, or `never`, the block will never expire.
478+
* Expiry time. May be relative (e.g. `5 months` or `2 weeks`) or absolute (e.g. the current timestamp). If set to `infinite`, `indefinite`, or `never`, the block will never expire.
479479
*
480480
* Defaults to `never`.
481481
*/
@@ -2988,7 +2988,7 @@ declare global {
29882988
| "wmf-researcher"
29892989
>;
29902990
/**
2991-
* Expiry timestamps. May be relative (e.g. `5 months` or `2 weeks`) or absolute (e.g. `2014-09-18T12:34:56Z`). If only one timestamp is set, it will be used for all groups passed to the `add` parameter. Use `infinite`, `indefinite`, `infinity`, or `never` for a never-expiring user group.
2991+
* Expiry timestamps. May be relative (e.g. `5 months` or `2 weeks`) or absolute (e.g. the current timestamp). If only one timestamp is set, it will be used for all groups passed to the `add` parameter. Use `infinite`, `indefinite`, `infinity`, or `never` for a never-expiring user group.
29922992
*
29932993
* Defaults to `infinite`.
29942994
*/
@@ -4341,6 +4341,10 @@ declare global {
43414341
* Show only pages created by username.
43424342
*/
43434343
username?: string;
4344+
/**
4345+
* Show only pages with this keyword in the snippet.
4346+
*/
4347+
keyword?: string;
43444348
/**
43454349
* Show only pages created on this date and after.
43464350
*/
@@ -4490,6 +4494,10 @@ declare global {
44904494
* Include only pages created by username.
44914495
*/
44924496
username?: string;
4497+
/**
4498+
* Include only pages with this keyword in the snippet.
4499+
*/
4500+
keyword?: string;
44934501
/**
44944502
* Include only pages created on this date and after.
44954503
*/
@@ -6953,7 +6961,7 @@ declare global {
69536961
*/
69546962
add?: string | string[];
69556963
/**
6956-
* Expiry timestamps. May be relative (e.g. `5 months` or `2 weeks`) or absolute (e.g. `2014-09-18T12:34:56Z`). If only one timestamp is set, it will be used for all groups passed to the `add` parameter. Use `infinite`, `indefinite`, `infinity`, or `never` for a never-expiring user group.
6964+
* Expiry timestamps. May be relative (e.g. `5 months` or `2 weeks`) or absolute (e.g. the current timestamp). If only one timestamp is set, it will be used for all groups passed to the `add` parameter. Use `infinite`, `indefinite`, `infinity`, or `never` for a never-expiring user group.
69576965
*
69586966
* Defaults to `infinite`.
69596967
*/
@@ -7642,6 +7650,13 @@ declare global {
76427650
property?: string;
76437651
/**
76447652
* The options the formatter should use. Provided as a JSON object.
7653+
*
7654+
* The supported options are:
7655+
*
7656+
* - **lang**: The language in which the value should be formatted (a MediaWiki language code).
7657+
* - **applyRounding**: Whether to apply rounding to the number. Can be a boolean (automatic / no rounding) or an integer (exponent of the last significant decimal digits). Only useful for quantity values.
7658+
* - **applyUnit**: Whether to include the unit in the output (a boolean). Only useful for quantity values.
7659+
* - **showcalendar**: Whether to show the calendar model. Can be a boolean (always / never show) or the string `"auto"` (automatically determine whether to show). Only useful for time values.
76457660
*/
76467661
options?: string;
76477662
}
@@ -15080,7 +15095,7 @@ declare global {
1508015095
*/
1508115096
grlelists?: number | number[];
1508215097
/**
15083-
* Show list entries that have been changed since this timestamp. Must be after `2024-10-01T09:34:17Z`.
15098+
* Show list entries that have been changed since this timestamp. Must be after the current timestamp.
1508415099
*/
1508515100
grlechangedsince?: string;
1508615101
/**
@@ -20853,11 +20868,11 @@ declare global {
2085320868
}
2085420869

2085520870
/**
20856-
* Fetch campaign data for the campaign defined inside the page that corresponds to the given title.
20871+
* Fetch page collection information for the given title.
2085720872
*/
2085820873
interface PageCollectionsMetadata extends Query {
2085920874
/**
20860-
* A string containing the page title for which the campaign data will be fetched.
20875+
* A string containing the page title for which the page collection information will be fetched.
2086120876
*/
2086220877
titles: string | string[];
2086320878
}
@@ -21179,7 +21194,7 @@ declare global {
2117921194
*/
2118021195
rlelists?: number | number[];
2118121196
/**
21182-
* Show list entries that have been changed since this timestamp. Must be after `2024-10-01T09:34:17Z`.
21197+
* Show list entries that have been changed since this timestamp. Must be after the current timestamp.
2118321198
*/
2118421199
rlechangedsince?: string;
2118521200
/**
@@ -22876,7 +22891,7 @@ declare global {
2287622891
*/
2287722892
rltitle?: string;
2287822893
/**
22879-
* Show lists that have been changed since this timestamp. Must be after `2024-10-01T09:34:20Z`. Clients should use the timestamp returned in the `readinglists-synctimestamp` field from an earlier call if they want to ensure that no changes are missed, and should be prepared to receive changes that have already been returned in an earlier response, and handle them in an idempotent way.
22894+
* Show lists that have been changed since this timestamp. Must be after the current timestamp. Clients should use the timestamp returned in the `readinglists-synctimestamp` field from an earlier call if they want to ensure that no changes are missed, and should be prepared to receive changes that have already been returned in an earlier response, and handle them in an idempotent way.
2288022895
*/
2288122896
rlchangedsince?: string;
2288222897
/**
@@ -25596,7 +25611,7 @@ declare global {
2559625611
*/
2559725612
grlelists?: number | number[];
2559825613
/**
25599-
* Show list entries that have been changed since this timestamp. Must be after `2024-10-01T09:34:17Z`.
25614+
* Show list entries that have been changed since this timestamp. Must be after the current timestamp.
2560025615
*/
2560125616
grlechangedsince?: string;
2560225617
/**
@@ -29157,7 +29172,7 @@ declare global {
2915729172
*/
2915829173
grlelists?: number | number[];
2915929174
/**
29160-
* Show list entries that have been changed since this timestamp. Must be after `2024-10-01T09:34:17Z`.
29175+
* Show list entries that have been changed since this timestamp. Must be after the current timestamp.
2916129176
*/
2916229177
grlechangedsince?: string;
2916329178
/**
@@ -32575,7 +32590,7 @@ declare global {
3257532590
*/
3257632591
grlelists?: number | number[];
3257732592
/**
32578-
* Show list entries that have been changed since this timestamp. Must be after `2024-10-01T09:34:17Z`.
32593+
* Show list entries that have been changed since this timestamp. Must be after the current timestamp.
3257932594
*/
3258032595
grlechangedsince?: string;
3258132596
/**
@@ -35993,7 +36008,7 @@ declare global {
3599336008
*/
3599436009
grlelists?: number | number[];
3599536010
/**
35996-
* Show list entries that have been changed since this timestamp. Must be after `2024-10-01T09:34:17Z`.
36011+
* Show list entries that have been changed since this timestamp. Must be after the current timestamp.
3599736012
*/
3599836013
grlechangedsince?: string;
3599936014
/**

scripts/api-types-generator.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,10 @@ class ModuleParser {
12371237

12381238
text = text.replace(/\n{3,}/g, "\n\n");
12391239

1240+
// Timestamps: use a generic string description to prevent spurious changes when
1241+
// re-generating the type declarations. We assume all timestamps refer to this exact time.
1242+
text = text.replace(/`\d{4}(?:-\d{2}){2}T\d{2}(?::\d{2}){2}Z`/g, "the current timestamp");
1243+
12401244
return text.trim().split("\n");
12411245
};
12421246

0 commit comments

Comments
 (0)