-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
497 lines (396 loc) · 10.3 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
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
declare module '@getflywheel/local' {
import * as LocalGraphQL from '@getflywheel/local/graphql';
export type GenericObject = { [key: string]: any };
export type FunctionGeneric = (...params: any[]) => any;
/**
* NOTE: all enum declarations must be copied over to `index.d.ts` as well.
*/
/**
* Re-exporting this here, it's also in main. Needed in a shared helper, but accessing main enums from the renderer
* errors out, since enums import from the typescript file, not the declaration file, and webpack gets confused.
*
* Possible TODO: remove this enum from main.d.ts - however, that would require a bump to any add-ons that access
* this type. For now that looks like it's just the Atlas add-on.
*/
export enum LightningServicePlatform {
DarwinArm64 = 'darwin-arm64',
Darwin = 'darwin',
Win32 = 'win32',
Win32x64 = 'win64',
Linux = 'linux',
}
export enum MultiSite {
No = '',
Subdir = 'ms-subdir',
Subdomain = 'ms-subdomain'
}
export enum SiteServiceType {
LIGHTNING = 'lightning',
}
export enum SiteServiceRole {
HTTP = 'http',
DATABASE = 'db',
PHP = 'php',
FRONTEND = 'frontend',
OTHER = 'other'
}
export enum AddonStatus {
INSTALLED = 'installed',
INSTALLING = 'installing',
UNINSTALLED = 'uninstalled',
UNINSTALLING = 'uninstalling',
UPDATING = 'updating',
}
export type SiteService = LocalGraphQL.SiteService;
export type NewSiteDefaults = {
environment: string;
adminEmail: string;
sitesPath: string;
tld: string;
};
/**
* Commonly used arguments for site creation (new site, pulling, importing, etc).
*/
export interface NewSiteInfo {
siteName: string
sitePath: string
siteDomain: string
multiSite: LocalGraphQL.MultiSite
phpVersion?: string
database?: string
environment?: string
blueprint?: string
webServer?: string
customOptions?: GenericObject
xdebugEnabled?: boolean
}
export type SiteServices = { [serviceName: string]: SiteService };
export type SitePort = number;
export type SiteStatus = LocalGraphQL.SiteStatus;
export interface SiteJSON extends Omit<
LocalGraphQL.Site,
'services'
| 'hostConnections'
| 'status'
| 'workspace'
| 'paths'
| 'longPath'
| 'url'
| 'host'
> {
services: { [serviceName: string]: LocalGraphQL.SiteService };
hostConnections?: LocalGraphQL.Site['hostConnections'] | null;
workspace?: LocalGraphQL.Site['workspace'] | null;
customOptions?: GenericObject;
/* Deprecated */
flywheelConnect?: string
sslSHA1?: string
clonedImage?: string
devMode?: boolean
container?: string
phpVersion?: string
mysqlVersion?: string
webServer?: string
database?: string
ports?: { [portName: string]: SitePort | SitePort[] }
environment?: string
environmentVersion?: string
}
export type SitesJSON = { [siteID: string]: SiteJSON };
/**
* This was done because we need the deprecated properties in SiteJSON along with some of the properties in SiteJSON
* such as services, hostConnections, and workspace that differ from the LocalGraphQL.Site type.
*/
type SiteBase = Omit<LocalGraphQL.Site,
'services' |
'hostConnections' |
'workspace' |
'status'> & SiteJSON;
export class Site implements SiteBase {
id: string;
path: string;
localVersion: string;
services: SiteJSON['services'];
multiSite: SiteJSON['multiSite'];
multiSiteDomains: SiteJSON['multiSiteDomains'];
customOptions?: GenericObject | undefined;
mysql?: {
database: string;
user: string;
password: string;
};
name: string;
domain: string;
workspace?: string;
sslSHA1?: string;
hostConnections?: SiteJSON['hostConnections'];
liveLinkSettings?: SiteJSON['liveLinkSettings'];
paths: {
readonly app: string;
readonly sql: string;
readonly webRoot: string;
readonly conf: string;
readonly confTemplates: string;
readonly logs: string;
readonly runData: string;
};
oneClickAdminID?: number;
oneClickAdminDisplayName?: string;
xdebugEnabled?: boolean;
/* Deprecated */
flywheelConnect?: string;
devMode?: boolean;
container?: string;
clonedImage?: string;
phpVersion?: string;
webServer?: string;
mysqlVersion?: string;
ports?: SiteJSON['ports'];
environment?: string;
environmentVersion?: string;
/* End Deprecated properties */
constructor(siteJson: SiteJSON);
toJSON(): SiteJSON;
static find(id: SiteJSON['id']): Site;
getServices(): SiteService[];
getService(serviceName: string) : SiteService;
getSiteServiceByRole(role: SiteServiceRole) : SiteService | undefined;
readonly longPath: string;
readonly host: string;
readonly url: string;
readonly adminUrl: string;
readonly httpPort: number | undefined;
readonly frontendPort: number | undefined;
readonly frontendHost: string;
readonly frontendUrl: string;
readonly backendUrl: string;
}
/**
* Represents a host connection with basic host and remote information.
*/
export type HostConnection = LocalGraphQL.HostConnection;
/**
* Represents a unique identifier for each supported host.
*/
export enum HostId {
FLYWHEEL = 'flywheel',
WPE = 'wpe',
}
export type Sites = { [siteID: string]: Site };
type LoggingLevel = 'warn' | 'info' | 'error' | 'debug' | 'verbose' | null;
export interface IProcessOpts {
name: string;
binPath: string;
args: string[];
env?: NodeJS.ProcessEnv;
cwd?: string;
stdioLogging?: {
stdout: LoggingLevel;
stderr: LoggingLevel;
};
onError?: (stderr: string) => void;
autoRestartTryTimeout?: number;
autoRestartMaxTries?: number;
}
export function isWindows32Bit () : boolean;
/**
* Site banner interface that can be displayed using the 'showSiteBanner' IPC event
*/
export interface SiteBanner {
siteID: string | 'router';
id: string;
title?: string;
message?: string;
icon?: 'warning';
variant?: 'warning' | 'neutral' | 'success' | 'error';
buttonText?: string;
buttonOnClick?: FunctionGeneric;
buttonOnClickIPCEvent?: string;
dismissible?: boolean;
persistDismiss?: boolean;
linkText?: string;
linkOnClick?: FunctionGeneric;
linkHref?: string;
}
export interface SiteOrganization {
isStarred: boolean;
sortData?: {
siteLastStartedTimestamp: number;
};
}
export type SitesOrganization = {[siteId: string]: SiteOrganization};
export interface AddonPackage {
addonDir: string;
author: { name: string };
bgColor: string;
bugs?: { url: string };
bundledDependencies: string[];
dependencies: {[key: string]: string};
description: string;
devDependencies?: {[key: string]: string};
engines: {[key: string]: string};
icon: string;
keywords: string[];
license: string;
local: { hidden: boolean };
main?: string;
name: string;
npmPackageName?: string;
peerDependencies?: {[key: string]: string};
productName: string;
renderer?: string;
repository: {[key: string]: string};
scripts?: {[key: string]: string};
slug: string;
version: string;
}
/**
* This is the percentage of users that should update to this Local version.
*/
export type RolloutPercentage = number;
/**
* Set to true to have Local detect this version and prompt users to update automatically.
* Set to false to allow users to update manually.
*/
export type AutoupdateEnabled = boolean;
/**
* Local reads from this file to learn about a new Local release.
*/
export interface ReleaseManifest {
/**
* URL for the Local release zip.
*/
url: string;
/**
* SemVer compatible Local version.
*/
name: string;
/**
* SemVer compatible Local version.
*/
version?: string;
/**
* Hand written notes about the release.
*/
notes?: string;
/**
* A link to the public changelog for this release.
*/
changelogUrl: string;
/**
* URL to hosted notes about this specific Local release. This page will be embedded into Local using an iframe.
*/
releaseNotesUrl?: string;
/**
* The publish date for this release formatted as an ISO 8601 string.
*/
pub_date: string;
/**
* Size in bytes of the Local update.
*/
size: string;
rollout?: RolloutRules;
}
/**
* Properties in this object relate to gradually rolling out new Local versions with different rules.
*/
export interface RolloutRules {
rolloutPercentage?: RolloutPercentage;
autoUpdate?: AutoupdateEnabled;
}
/**
* Local reads this data from the Local Releases CMS.
*/
export interface ReleaseList {
/**
* Name of the Local release, e.g. "Local 5.5.5".
*/
name: string;
/**
* Local version.
*/
version: string;
/**
* Build number from the build pipeline.
*/
build_number: number;
/**
* "stable" or "beta"
*/
release_channel: string;
/**
* Publish date of the release.
*/
pub_date: string;
/**
* Text area containing the download links for each operating system.
*/
download_links: string;
/**
* The release notes for this release.
*/
body: string;
}
/**
* An individual WordPress translation pack
*/
export interface WPTranslation {
/**
* The language slug for this translation
*/
language: string;
/**
* The WordPress version this translation is for.
*/
version: string;
/**
* Date the translation was last updated, in MySQL datetime format.
* For example: '2016-06-29 08:59:03'
*/
updated: string;
/**
* English name of the language.
*/
english_name: string;
/**
* Native name of the language.
*/
native_name: string;
/**
* URL to download the translation package.
* For example: 'https://downloads.wordpress.org/translation/core/6.7/el.zip'
*/
package: string;
/**
* Array of ISO 639 language codes.
*
* The shape will look something like:
*
* "iso": {
* "1": "dz",
* "2": "dzo"
* },
*
* - https://en.wikipedia.org/wiki/ISO_639
*/
iso: {
[key: string]: string;
};
// Array of translated strings used in the installation process.
strings: {
[key: string]: string;
};
}
/**
* A response from the WordPress.org Translation installation API.
*
* There's not much canonical info about this API endpoint, but
* these resources should help:
*
* - https://codex.wordpress.org/WordPress.org_API#Translations
* - https://developer.wordpress.org/reference/functions/translations_api/#return
*/
export interface WPTranslationsResponse {
translations: WPTranslation[];
}
}