-
Notifications
You must be signed in to change notification settings - Fork 7
/
lib.d.ts
351 lines (293 loc) · 8.52 KB
/
lib.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
export interface ExternalLink {
url: string,
title: string,
}
export interface DirectoryDefinition {
location: {
in: 'community' | 'packageCache' | 'package' | 'documents',
path: string,
},
}
export interface NamedDirectoryDefinition extends DirectoryDefinition {
title: string,
}
export type FragmenterReleaseModel = {
type: 'fragmenter',
}
export type GithubReleaseReleaseModel = {
/** @deprecated */
type: 'githubRelease',
}
export type GithubBranchReleaseModel = {
/** @deprecated */
type: 'githubBranch',
branch: string,
}
export type CDNReleaseModel = {
/** @deprecated */
type: 'CDN',
}
export type ReleaseModel = FragmenterReleaseModel | GithubReleaseReleaseModel | GithubBranchReleaseModel | CDNReleaseModel
type BaseAddonTrack = {
name: string,
key: string,
url: string,
alternativeUrls?: string[],
description?: string,
releaseModel: ReleaseModel,
}
export type MainlineAddonTrack = BaseAddonTrack & { isExperimental: false }
export type ExperimentalAddonTrack = BaseAddonTrack & { isExperimental: true, warningContent: string }
export type AddonTrack = MainlineAddonTrack | ExperimentalAddonTrack;
export interface AddonBackgroundService {
/**
* Defines the executable file base name for the background service. This is relative to the community folder package
* of the addon, must match /^[a-zA-Z\d_-]+$/, and must not contain a file extension.
*/
executableFileBasename: string,
/**
* Reference to an external app which is used to check if this service is running
*/
runCheckExternalAppRef: string,
/**
* Whether autostart configuration is available for the background service
*/
enableAutostartConfiguration?: boolean,
/**
* Command line arguments to run this background service with
*
* Defaults to `true`.
*/
commandLineArgs?: string[],
}
/**
* Configuration for an addon's "My Install" page
*/
export interface AddonMyInstallPageConfiguration {
/**
* Links to show on the page. Those will be shown in a section on top, without a header, and open the user's browser.
*/
links: ExternalLink[],
/**
* Folder quick-links to show. Those will be shown in a section on the bottom, with a header, and open the file explorer.
*/
directories: NamedDirectoryDefinition[],
}
export interface Addon {
key: string,
name: string,
repoOwner?: string,
repoName?: string,
category?: `@${string}`,
aircraftName: string,
titleImageUrl: string,
titleImageUrlSelected: string,
backgroundImageUrls: string[],
backgroundImageShadow?: boolean,
shortDescription: string,
description: string,
techSpecs?: AddonTechSpec[],
targetDirectory: string,
alternativeNames?: string[],
tracks: AddonTrack[],
dependencies?: AddonDependency[],
incompatibleAddons?: AddonIncompatibleAddon[],
configurationAspects?: ConfigurationAspect[],
disallowedRunningExternalApps?: string[],
backgroundService?: AddonBackgroundService,
/**
* Configuration for the "My Install" page of this addon. If not provided, a default page described below will be shown:
*
* Links: none
*
* Directories: Package in community directory
*
* If it is specified, the above elements are appended to the specified page contents.
*/
myInstallPage?: AddonMyInstallPageConfiguration,
enabled: boolean,
hidesAddon?: string,
hidden?: boolean,
hiddenName?: string,
overrideAddonWhileHidden?: string,
gitHubReleaseBaseURL?: string,
}
export interface AddonDependency {
/**
* Path to the addon, with the format `@<publisher>/<addon key>``
*/
addon: `@${string}/${string}`,
/**
* Whether this dependency is optional. If `false`, the dependency addon will be installed before the parent addon, and removing the dependency
* will cause the parent addon to be removed.
*/
optional: boolean,
/**
* Modal text that shows below the dependency / parent addon on the pre-install modal (if optional) and the removal dialog (if not optional).
*/
modalText?: string,
}
/**
* Fields from the addon's manifest.json
*/
export interface AddonIncompatibleAddon {
/**
* Field from the addon's manifest.json
* This need to be configured identically to the addon's manifest.json
* Leaving a field empty ignores it for the search.
*/
title?: string,
/**
* Field from the addon's manifest.json
* This need to be configured identically to the addon's manifest.json
* Leaving a field empty ignores it for the search.
*/
creator?: string,
/**
* Field from the addon's manifest.json
* This need to be configured identically to the addon's manifest.json
* Leaving a field empty ignores it for the search.
*
* This supports semver notation.
*/
packageVersion?: string,
/**
* folder name in community - added later to show the user the corresponding folder name - not used for searching
*/
folder?: string,
/**
* Description of the nature of the incompatibility to display to the user in a warning dialog
*/
description?: string,
}
export interface AddonTechSpec {
name: string,
value: string,
}
/**
* Describes a configuration aspect, allowing to customize an addon install
*/
export interface ConfigurationAspect {
/**
* A unique key for this configuration aspect
*/
key: string,
/**
* The name of the configuration aspect, shown under the supertitle, in the associated tab
*/
tabTitle: string,
/**
* The supertitle of the associated tab
*/
tabSupertitle: string,
/**
* The title of the page containing the choices
*/
title: string,
/**
* What to apply the list of desired choices to
*/
applyChoiceKeyTo: 'optionalFragmenterModule',
/**
* The kind of choice to permit
*/
choiceKind: 'yesNo' | 'multipleChoice' | 'selectOne' | 'selectOneOrZero',
/**
* The possible choices. Must always be at least two, and if using `yesNo`, must be exactly 2 keyed `yes` and `no`.
*/
choices: ConfigurationAspectChoice[],
}
interface ConfigurationAspectChoice {
/**
* A unique key for this choice
*/
key: string,
/**
* The title of the choice, displayed on the card
*/
title: string,
/**
* The subtitle of the choice, displayed on the card
*/
subtitle?: string,
/**
* A longer description of the choice, displayed below the cards
*/
description?: string,
/**
* An URL to an image representing the choice
*/
imageUrl?: string,
}
interface DefinitionBase {
kind: string,
}
export type AddonCategoryDefinition = DefinitionBase & {
kind: 'addonCategory',
key: string,
title?: string,
styles?: 'align-bottom'[],
}
export type ExternalApplicationDefinition = DefinitionBase & {
kind: 'externalApp',
/**
* Key of this external app. Must be unique
*/
key: string,
/**
* Display name shown in the UI
*/
prettyName: string,
/**
* Type of detection to figure out if the external app is running
*/
detectionType: 'http' | 'ws' | 'tcp',
/**
* External app URL, only for `http` and `ws ` {@link detectionType} values. For `ws`, must start with `ws` or `wss`.
*/
url?: string,
/**
* External app port, only for `tcp` {@link detectionType} values
*/
port?: number,
/**
* URL on which to make a request to stop the external app
*/
killUrl?: string,
/**
* HTTP method to use on the kill endpoint
*/
killMethod?: string,
}
export type Definition = AddonCategoryDefinition | ExternalApplicationDefinition
interface BasePublisherButton {
text: string,
style?: 'normal' | 'fbw-local-api-config',
icon?: string,
inline?: boolean,
inop?: true,
forceStroke?: true,
action: string,
}
type UrlPublisherButton = BasePublisherButton & {
action: 'openBrowser',
url: string,
}
type InternalAction = BasePublisherButton & {
action: 'internal',
call: 'fbw-local-api-config',
}
export type PublisherButton = UrlPublisherButton | InternalAction
export type Publisher = {
name: string,
key: string,
logoUrl: string,
logoSize?: number,
defs?: Definition[],
addons: Addon[],
buttons?: PublisherButton[],
}
export interface Configuration {
version: number,
publishers: Publisher[],
}