@todesktop/shared 7.190.0 → 7.191.0

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.
Files changed (46) hide show
  1. package/.prettierignore +0 -2
  2. package/CHANGELOG.md +13 -0
  3. package/README.md +42 -15
  4. package/eslint.config.mjs +8 -55
  5. package/lib/base.d.ts +81 -75
  6. package/lib/base.js +9 -12
  7. package/lib/desktopify.d.ts +74 -74
  8. package/lib/desktopify.js +28 -35
  9. package/lib/desktopify2.d.ts +223 -223
  10. package/lib/desktopify2.js +2 -5
  11. package/lib/getSiteInfo.d.ts +6 -6
  12. package/lib/getSiteInfo.js +1 -2
  13. package/lib/hsm.d.ts +1 -1
  14. package/lib/hsm.js +5 -12
  15. package/lib/index.d.ts +12 -13
  16. package/lib/index.js +13 -31
  17. package/lib/invitePermissionLabels.d.ts +4 -2
  18. package/lib/invitePermissionLabels.js +14 -11
  19. package/lib/personalAccessTokens.d.ts +12 -12
  20. package/lib/personalAccessTokens.js +1 -2
  21. package/lib/plans.d.ts +27 -27
  22. package/lib/plans.js +181 -185
  23. package/lib/plugin.d.ts +18 -18
  24. package/lib/plugin.js +1 -2
  25. package/lib/toDesktop.d.ts +66 -66
  26. package/lib/toDesktop.js +1 -2
  27. package/lib/translation.d.ts +1 -1
  28. package/lib/translation.js +1 -2
  29. package/lib/validations.d.ts +66 -66
  30. package/lib/validations.js +54 -56
  31. package/package.json +11 -17
  32. package/src/base.ts +89 -82
  33. package/src/desktopify.ts +82 -80
  34. package/src/desktopify2.ts +240 -240
  35. package/src/getSiteInfo.ts +6 -6
  36. package/src/hsm.ts +7 -7
  37. package/src/index.ts +13 -14
  38. package/src/invitePermissionLabels.ts +20 -6
  39. package/src/personalAccessTokens.ts +12 -12
  40. package/src/plans.ts +191 -191
  41. package/src/plugin.ts +19 -19
  42. package/src/toDesktop.ts +70 -70
  43. package/src/translation.ts +2 -2
  44. package/src/validations.ts +51 -49
  45. package/tsconfig.json +6 -3
  46. package/.prettierrc +0 -5
package/src/desktopify.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { IApp2 } from './desktopify2';
2
- import { IApp } from './toDesktop';
1
+ // eslint-disable-next-line import-x/no-extraneous-dependencies
3
2
  import {
4
3
  Configuration,
5
4
  PackagerOptions,
@@ -9,6 +8,8 @@ import {
9
8
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10
9
  // @ts-ignore
11
10
  } from 'app-builder-lib';
11
+ import { IApp2 } from './desktopify2';
12
+ import { IApp } from './toDesktop';
12
13
 
13
14
  type appBuilderLib = PackagerOptions & PublishOptions;
14
15
  export interface IAppBuilderLib extends appBuilderLib {
@@ -34,49 +35,49 @@ export type URL = string; // TODO: define more
34
35
 
35
36
  export enum PackageManager {
36
37
  npm = 'npm',
37
- yarn = 'yarn',
38
38
  pnpm = 'pnpm',
39
+ yarn = 'yarn',
39
40
  }
40
41
 
41
42
  export enum BuildStatus {
42
- queued = 'queued',
43
- failed = 'failed',
44
43
  building = 'building',
44
+ cancelled = 'cancelled',
45
+ failed = 'failed',
45
46
  preparation = 'preparation',
47
+ queued = 'queued',
46
48
  succeeded = 'succeeded',
47
- cancelled = 'cancelled',
48
49
  }
49
50
 
50
51
  export enum AnalysisStatus {
51
- notStarted = 'notStarted',
52
- initializing = 'initializing',
53
- downloading = 'downloading',
54
- extracting = 'extracting',
55
52
  analyzing = 'analyzing',
56
53
  done = 'done',
54
+ downloading = 'downloading',
57
55
  error = 'error',
56
+ extracting = 'extracting',
57
+ initializing = 'initializing',
58
+ notStarted = 'notStarted',
58
59
  }
59
60
 
60
- export type Arch = 'ia32' | 'x64' | 'arm64' | 'universal';
61
- export type MacArch = 'x64' | 'arm64' | 'universal';
62
- export type LinuxArch = 'x64' | 'arm64';
63
- export type WindowsArch = 'ia32' | 'x64' | 'arm64' | 'universal';
61
+ export type Arch = 'arm64' | 'ia32' | 'universal' | 'x64';
62
+ export type MacArch = 'arm64' | 'universal' | 'x64';
63
+ export type LinuxArch = 'arm64' | 'x64';
64
+ export type WindowsArch = 'arm64' | 'ia32' | 'universal' | 'x64';
64
65
  export type LinuxArtifactName = 'appImage' | 'deb' | 'rpm' | 'snap';
65
- export type MacArtifactName = 'dmg' | 'zip' | 'installer' | 'mas' | 'pkg';
66
+ export type MacArtifactName = 'dmg' | 'installer' | 'mas' | 'pkg' | 'zip';
66
67
  export type WindowsArtifactName =
68
+ | 'appx'
67
69
  | 'msi'
68
- | 'nsis'
69
- | 'nsis-web'
70
70
  | 'nsis-web-7z'
71
- | 'appx';
71
+ | 'nsis-web'
72
+ | 'nsis';
72
73
 
73
74
  type ArtifactObject = { size: number; standardUrl: URL; url: URL };
74
- type ArtifactDownload = Record<Arch, ArtifactObject | null> | null;
75
+ type ArtifactDownload = null | Record<Arch, ArtifactObject | null>;
75
76
 
76
77
  // The `installer` artifact is special because it has an additional property
77
78
  // `isPinnedToVersion` for apps that have `appData.macUniversalInstallerConfig?.shouldPinToVersion` set to true
78
79
  type InstallerArtifact = {
79
- [K in Arch]: (ArtifactObject & { isPinnedToVersion?: boolean }) | null;
80
+ [K in Arch]: ({ isPinnedToVersion?: boolean } & ArtifactObject) | null;
80
81
  };
81
82
 
82
83
  export type LinuxArtifactDownloads = Record<
@@ -114,7 +115,7 @@ export interface PlatformBuild {
114
115
  isBeingCancelled?: boolean;
115
116
  // nodeVersion: number;
116
117
  // npmVersion: number;
117
- logs?: { label: string; content: string }[];
118
+ logs?: { content: string; label: string }[];
118
119
  numberOfAttemptedBuilds: number;
119
120
  platform: PlatformName;
120
121
  progressActivityName: string;
@@ -127,7 +128,7 @@ export interface PlatformBuild {
127
128
  status: BuildStatus;
128
129
  }
129
130
 
130
- export type CIRunner = 'circle' | 'azure';
131
+ export type CIRunner = 'azure' | 'circle';
131
132
 
132
133
  export interface Build {
133
134
  appCustomDomain?: string;
@@ -138,18 +139,23 @@ export interface Build {
138
139
  bundlePhobiaData?: Record<string, BundlePhobiaItem>;
139
140
  ciRunner?: CIRunner;
140
141
  cliConfigSchemaVersion: number;
141
- continuousIntegrationServiceName?: string;
142
142
  commitId?: string;
143
143
  commitMessage?: string;
144
+ continuousIntegrationServiceName?: string;
144
145
  createdAt: ISODate;
146
+ dependencyAnalysis?: {
147
+ // `result` is a stringified JSON object
148
+ result?: string;
149
+ status: AnalysisStatus;
150
+ };
145
151
  // createdByOsArch: string;
146
152
  // createdByOsName: string;
147
153
  // createdByOsVersion: string;
148
154
  // createdByUserId: string;
149
155
  desktopifyVersion?: SemanticVersion;
150
- endedAt?: ISODate;
151
156
  electronVersionSpecified?: SemanticVersion;
152
157
  electronVersionUsed?: SemanticVersion;
158
+ endedAt?: ISODate;
153
159
  environmentVariables?: IApp['environmentVariables'];
154
160
  errorMessage?: string;
155
161
  hash?: string;
@@ -173,21 +179,16 @@ export interface Build {
173
179
  mac?: SmokeTestProgress;
174
180
  windows?: SmokeTestProgress;
175
181
  };
182
+ // sourceArchiveUrl: URL;
183
+ sourcePackageManager?: PackageManager;
184
+ standardUniversalDownloadUrl?: URL;
185
+ startedAt: ISODate;
176
186
  staticAnalysis?: {
177
- status: AnalysisStatus;
178
- // `result` is a stringified JSON object
179
- result?: string;
180
187
  error?: string;
181
- };
182
- dependencyAnalysis?: {
183
- status: AnalysisStatus;
184
188
  // `result` is a stringified JSON object
185
189
  result?: string;
190
+ status: AnalysisStatus;
186
191
  };
187
- // sourceArchiveUrl: URL;
188
- sourcePackageManager?: PackageManager;
189
- standardUniversalDownloadUrl?: URL;
190
- startedAt: ISODate;
191
192
  status: BuildStatus;
192
193
  todesktopRuntimeVersionSpecified?: SemanticVersion;
193
194
  todesktopRuntimeVersionUsed?: SemanticVersion;
@@ -209,13 +210,13 @@ export interface Build {
209
210
  }
210
211
 
211
212
  export type BundlePhobiaItem = {
213
+ error: null | string;
212
214
  result: {
213
215
  description: string;
214
216
  gzip: string;
215
217
  name: string;
216
218
  size: number;
217
219
  } | null;
218
- error: string | null;
219
220
  };
220
221
 
221
222
  export type ComputedBuildProperties = Pick<
@@ -232,8 +233,8 @@ export type ComputedBuildProperties = Pick<
232
233
  >;
233
234
 
234
235
  export enum ManifestCategory {
235
- primary = 'primary',
236
236
  buildStamped = 'build-stamped',
237
+ primary = 'primary',
237
238
  versioned = 'versioned',
238
239
  }
239
240
 
@@ -244,10 +245,10 @@ export interface CustomManifestArtifactDetails {
244
245
 
245
246
  export interface CustomManifest {
246
247
  artifacts: {
247
- [propertyName: string]: Record<
248
+ [propertyName: string]: null | Record<
248
249
  string,
249
250
  CustomManifestArtifactDetails | null
250
- > | null;
251
+ >;
251
252
  };
252
253
  createdAt: ISODate;
253
254
  version: SemanticVersion;
@@ -256,27 +257,27 @@ export interface CustomManifest {
256
257
  export interface LinuxCustomManifest extends CustomManifest {
257
258
  artifacts: Record<
258
259
  LinuxArtifactName,
259
- Record<LinuxArch, CustomManifestArtifactDetails | null> | null
260
+ null | Record<LinuxArch, CustomManifestArtifactDetails | null>
260
261
  >;
261
262
  }
262
263
 
263
264
  export interface MacCustomManifest extends CustomManifest {
264
265
  artifacts: Record<
265
266
  MacArtifactName,
266
- Record<MacArch, CustomManifestArtifactDetails | null> | null
267
+ null | Record<MacArch, CustomManifestArtifactDetails | null>
267
268
  >;
268
269
  }
269
270
 
270
271
  export interface WindowsCustomManifest extends CustomManifest {
271
272
  artifacts: Record<
272
273
  WindowsArtifactName,
273
- Record<WindowsArch, CustomManifestArtifactDetails | null> | null
274
+ null | Record<WindowsArch, CustomManifestArtifactDetails | null>
274
275
  >;
275
276
  }
276
277
 
277
278
  export interface SmokeTestProgress {
278
- abState?: SmokeTestState;
279
279
  abSkipReason?: string;
280
+ abState?: SmokeTestState;
280
281
  appLaunched?: boolean;
281
282
  appUpdated?: boolean;
282
283
  bcState?: SmokeTestState;
@@ -358,7 +359,7 @@ export interface SmokeTestPerformance {
358
359
  webContentsFinishLoadMs?: number;
359
360
  }
360
361
 
361
- export type SmokeTestState = 'progress' | 'done' | 'error' | 'skipped';
362
+ export type SmokeTestState = 'done' | 'error' | 'progress' | 'skipped';
362
363
 
363
364
  export const hasBuildKickedOff = (build: Build): boolean => {
364
365
  if (!build) {
@@ -368,7 +369,7 @@ export const hasBuildKickedOff = (build: Build): boolean => {
368
369
  };
369
370
 
370
371
  export const isPlatformBuildRunning = (
371
- platformBuild: PlatformBuild
372
+ platformBuild: PlatformBuild,
372
373
  ): boolean => {
373
374
  if (!platformBuild) {
374
375
  return false;
@@ -376,7 +377,7 @@ export const isPlatformBuildRunning = (
376
377
  return (
377
378
  !platformBuild.shouldSkip && // <-- Noteworthy
378
379
  !['cancelled', 'succeeded'].includes(platformBuild.status) &&
379
- ('failed' !== platformBuild.status ||
380
+ (platformBuild.status !== 'failed' ||
380
381
  platformBuild.numberOfAttemptedBuilds < 2)
381
382
  );
382
383
  };
@@ -392,7 +393,8 @@ export const isCiBuildRunning = (build: Build): boolean => {
392
393
  ['linux', 'mac', 'windows'].some(
393
394
  (platform) =>
394
395
  build.status === 'building' ||
395
- (build.status === 'failed' && isPlatformBuildRunning(build[platform]))
396
+ (build.status === 'failed' &&
397
+ isPlatformBuildRunning(build[platform as 'mac']!)),
396
398
  ))
397
399
  );
398
400
  };
@@ -404,7 +406,7 @@ export const isBuildRunning = (build: Build): boolean => {
404
406
  return (
405
407
  !['cancelled', 'succeeded'].includes(build.status) &&
406
408
  ['linux', 'mac', 'windows'].some((platform) =>
407
- isPlatformBuildRunning(build[platform])
409
+ isPlatformBuildRunning(build[platform as 'mac']!),
408
410
  )
409
411
  );
410
412
  };
@@ -413,56 +415,56 @@ export const isBuildCancellable = (build: Build): boolean =>
413
415
  hasBuildKickedOff(build) && isBuildRunning(build);
414
416
 
415
417
  export interface DesktopifyApp {
416
- name: string;
417
- targetUrl: string;
418
+ alwaysOnTop: boolean; // remove
418
419
  appId: string;
420
+ appProtocol?: string;
421
+ appType?: string;
419
422
  autoHideMenuBar?: boolean; // remove
420
- height: number; // remove
421
- width: number; // remove
423
+ companyName?: string;
424
+ crashReporter?: string;
425
+ disableContextMenu: boolean;
426
+ disableDevTools: boolean;
427
+ enablePushNotifications?: boolean;
428
+ extraBrowserWindowOptions?: any;
422
429
  fullScreen: boolean; // remove
430
+ googleOAuthIsExternal?: boolean;
431
+ height: number; // remove
432
+ insecure?: boolean;
433
+ internalUrls?: string;
434
+ isFindInPageEnabled?: boolean;
435
+ isNativeWindowOpenDisabled?: boolean;
423
436
  isResizable: boolean; // remove
424
437
  isTitleStatic?: boolean;
425
- minHeight?: number; // remove
426
- minWidth?: number; // remove
427
438
  maxHeight?: number; // remove
428
439
  maxWidth?: number; // remove
429
- singleInstance: boolean;
430
- disableContextMenu: boolean;
431
- titleBarStyle?: 'hidden' | 'hiddenInset' | 'customButtonsOnHover'; // remove
432
- alwaysOnTop: boolean; // remove
433
- internalUrls?: string;
434
- isNativeWindowOpenDisabled?: boolean;
435
- isFindInPageEnabled?: boolean;
436
- userAgent?: string;
437
- disableDevTools: boolean;
438
- appProtocol?: string;
439
- insecure?: boolean;
440
- preventBackgroundThrottling?: boolean;
441
- googleOAuthIsExternal?: boolean;
442
- shouldUseRealUserAgent?: boolean;
443
- extraBrowserWindowOptions?: any;
444
440
  menubarIcon?: string;
445
- trayIcon?: string;
446
- toggleVisibilityKeyboardShortcut?: string;
447
- appType?: string;
441
+ minHeight?: number; // remove
442
+ minWidth?: number; // remove
443
+ name: string;
444
+ pollForAppUpdatesEveryXMinutes?: number;
445
+ preventBackgroundThrottling?: boolean;
448
446
  runtimeEnvs?: string;
449
447
  shouldLaunchAtStartupByDefault?: boolean;
448
+ shouldMakeSameDomainAnExternalLink?: boolean;
450
449
  shouldOnlySendAbsolutelyNecessaryRequests?: boolean;
451
450
  shouldReuseRendererProcess?: boolean;
452
- shouldMakeSameDomainAnExternalLink?: boolean;
453
- enablePushNotifications?: boolean;
454
- themeSource?: 'system' | 'light' | 'dark';
455
- themeSourceMac?: 'system' | 'light' | 'dark';
456
- crashReporter?: string;
457
- companyName?: string;
458
- pollForAppUpdatesEveryXMinutes?: number;
451
+ shouldUseRealUserAgent?: boolean;
452
+ singleInstance: boolean;
453
+ targetUrl: string;
454
+ themeSource?: 'dark' | 'light' | 'system';
455
+ themeSourceMac?: 'dark' | 'light' | 'system';
456
+ titleBarStyle?: 'customButtonsOnHover' | 'hidden' | 'hiddenInset'; // remove
457
+ toggleVisibilityKeyboardShortcut?: string;
458
+ trayIcon?: string;
459
+ userAgent?: string;
459
460
  // https://linear.app/todesktop/issue/TD-1428/html-injection-due-to-regular-expression-bypass
460
461
  useSafeInternalUrlMatcher?: boolean;
462
+ width: number; // remove
461
463
  }
462
464
 
463
465
  export interface Release {
464
- id: string;
465
466
  appReleaseSnapshot?: IApp2;
466
- startedAt?: string;
467
+ id: string;
467
468
  releasedAt?: string;
469
+ startedAt?: string;
468
470
  }