-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.d.ts
112 lines (99 loc) · 3.48 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
declare module 'mediawiki-projects-list' {
/** A wiki farm */
export type WikiFarm = (
"biligame" |
"fandom" |
"huijiwiki" |
"miraheze" |
"mywikis" |
"shoutwiki" |
"telepedia" |
"wiki.gg" |
"wikimedia" |
null
);
/** A MediaWiki project */
export type WikiProject = {
/** Hostname of the project */
name: string;
/** Regex to match the project url */
regex: string;
/** Article path of the project */
articlePath: string;
/** Script path of the project */
scriptPath: string;
/** Only exists when the hostname contains a single wiki: Full script path to the wiki */
fullScriptPath?: string;
/** Only exists when the hostname contains multiple wikis: How to handle the id string */
idString?: {
/** Separator to join or split the id string on */
separator: string;
/** Order in which the project regex additional group matches should be chained to gain the id string */
direction: "asc" | "desc";
/** Regex to match the id string */
regex: string;
/** How to turn the group matches of the id string regex into an URL to the script path, index based on group matches */
scriptPaths: string[];
};
/** Whether the paths include matches of the regex */
regexPaths: boolean;
/** Wiki farm of the project */
wikiFarm: WikiFarm;
/** List of extensions providing useful API endpoints */
extensions: ("Cargo" | "CentralAuth" | "OAuth")[];
/** Replacement for spaces in the article URL */
urlSpaceReplacement: string;
/** Note about the specific project */
note: string | null;
};
/** A frontend proxy */
export type FrontendProxy = {
/** Hostname of the proxy */
name: string;
/** Regex to match the proxy url */
regex: string;
/** Name path of the proxy */
namePath: string;
/** Article path of the proxy */
articlePath: string;
/** Script path of the proxy */
scriptPath: string;
/** Regex to remove from the relative url */
relativeFix: string;
/** Only exists when the hostname contains multiple wikis: How to handle the id string */
idString?: {
/** Separator to join or split the id string on */
separator: string;
/** Order in which the project regex additional group matches should be chained to gain the id string */
direction: "asc" | "desc";
/** Regex to match the id string */
regex: string;
/** How to turn the group matches of the id string regex into an URL to the script path, index based on group matches */
scriptPaths: string[];
};
/** Note about the specific proxy */
note: string | null;
};
/** Map of MediaWiki projects */
export const wikiProjects: Map<string, WikiProject>;
/** Map of frontend proxies */
export const frontendProxies: Map<string, FrontendProxy>;
/** Get a MediaWiki project by domain hostname */
export function getWikiProject(hostname: string): WikiProject | null;
/** Get a frontend proxy by domain hostname */
export function getFrontendProxy(hostname: string): FrontendProxy | null;
export function inputToWikiProject(input: string): {
fullArticlePath: string;
fullScriptPath: string;
wikiProject: WikiProject;
} | null;
export function urlToIdString(url: URL): string | null;
export function idStringToUrl(idString: string, projectName: string): URL | null;
export function inputToFrontendProxy(input: string): {
fullNamePath: string;
fullArticlePath: string;
fullScriptPath: string;
frontendProxy: FrontendProxy;
} | null;
export function urlToFix(url: string): ((href: string, pagelink: string) => string) | null;
}