@todesktop/shared 7.188.18 → 7.188.19-beta.1

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.
package/lib/plugin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- declare type AjvJSONSchemaType = object;
1
+ type AjvJSONSchemaType = object;
2
2
  export interface DesktopAppPlugin {
3
3
  /**
4
4
  * Configuration gathered from the todesktop plugin.
@@ -11,28 +11,28 @@ export interface DesktopAppPlugin {
11
11
  */
12
12
  package: string;
13
13
  }
14
- export declare type ToDesktopPlugin = {
14
+ export type ToDesktopPlugin = {
15
15
  namespace: string;
16
16
  version: number;
17
17
  main?: string;
18
18
  preload?: string;
19
19
  preferences?: PluginPreferences;
20
20
  };
21
- export declare type PluginPreferences = {
21
+ export type PluginPreferences = {
22
22
  [id: string]: PluginPreference;
23
23
  };
24
- export declare type PluginPreference = NumberSpec | TextSpec | CheckboxSpec;
25
- export declare type TextSpec = PreferenceSpec<'text', {
24
+ export type PluginPreference = NumberSpec | TextSpec | CheckboxSpec;
25
+ export type TextSpec = PreferenceSpec<'text', {
26
26
  validator?: AjvJSONSchemaType;
27
27
  value?: string;
28
28
  placeholder?: string;
29
29
  }>;
30
- export declare type NumberSpec = PreferenceSpec<'number', {
30
+ export type NumberSpec = PreferenceSpec<'number', {
31
31
  validator?: AjvJSONSchemaType;
32
32
  value?: number;
33
33
  placeholder?: number;
34
34
  }>;
35
- export declare type CheckboxSpec = PreferenceSpec<'checkbox', {
35
+ export type CheckboxSpec = PreferenceSpec<'checkbox', {
36
36
  validator?: AjvJSONSchemaType;
37
37
  value?: boolean;
38
38
  }>;
@@ -1,6 +1,6 @@
1
1
  import { BaseApp, Schemable } from './base';
2
2
  import { IAppBuilderLib } from './desktopify';
3
- export declare type IUploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed';
3
+ export type IUploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed';
4
4
  export interface IUploadFile {
5
5
  uid: string;
6
6
  size: number;
@@ -25,7 +25,7 @@ export interface IAppIcon {
25
25
  appId: string;
26
26
  icon: IHueIcon;
27
27
  }
28
- export declare type IAppIcons = IAppIcon[];
28
+ export type IAppIcons = IAppIcon[];
29
29
  export interface IAppWindowOptions {
30
30
  startInFullscreenMode: boolean;
31
31
  isResizable: boolean;
@@ -142,9 +142,11 @@ export interface IUser extends Schemable {
142
142
  disableShouldCodeSign?: boolean;
143
143
  allowedIPs?: string[];
144
144
  seenReleaseTutorial?: boolean;
145
+ seenApplicationGroupsTutorial?: boolean;
145
146
  }
146
147
  export interface FeatureFlags {
147
148
  desktopAppPlugins: boolean;
149
+ macAppStore: boolean;
148
150
  }
149
151
  export interface UserIHaveSentInviteTo {
150
152
  email: string;
@@ -1,2 +1,2 @@
1
- export declare type ValidTranslationKeys = 'updateNotification.title' | 'updateNotification.body';
2
- export declare type ValidTranslationLanguages = 'default';
1
+ export type ValidTranslationKeys = 'updateNotification.title' | 'updateNotification.body';
2
+ export type ValidTranslationLanguages = 'default';
@@ -5,9 +5,9 @@ export declare const appTitleValidation: yup.StringSchema;
5
5
  export declare const forceVersionValidation: yup.StringSchema;
6
6
  export declare const iconValidation: yup.StringSchema;
7
7
  export declare const urlValidation: yup.StringSchema;
8
- export declare const urlValidationForm: yup.ObjectSchema<yup.Shape<object, {
8
+ export declare const urlValidationForm: yup.ObjectSchema<{
9
9
  url: string;
10
- }>>;
10
+ }>;
11
11
  export declare const heightValidation: yup.NumberSchema;
12
12
  export declare const widthValidation: yup.NumberSchema;
13
13
  export declare const internalAppRegexValidation: yup.StringSchema;
@@ -51,4 +51,4 @@ export declare const appConfigValidation: yup.ObjectSchema<{
51
51
  publishedVersions: any;
52
52
  };
53
53
  }>;
54
- export declare const shouldMinimizeToTrayIsActive: <Plugin_1 = DesktopAppPlugin>(desktopApp: DesktopifyApp2<Plugin_1>) => boolean;
54
+ export declare const shouldMinimizeToTrayIsActive: <Plugin = DesktopAppPlugin>(desktopApp: DesktopifyApp2<Plugin>) => boolean;
@@ -133,6 +133,7 @@ exports.appConfigValidation = yup.object({
133
133
  })
134
134
  .required(),
135
135
  });
136
- exports.shouldMinimizeToTrayIsActive = (desktopApp) => {
136
+ const shouldMinimizeToTrayIsActive = (desktopApp) => {
137
137
  return desktopApp.trays.some((t) => t.leftClick.role === 'toggleMenu' || t.rightClick.role === 'toggleMenu');
138
138
  };
139
+ exports.shouldMinimizeToTrayIsActive = shouldMinimizeToTrayIsActive;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todesktop/shared",
3
- "version": "7.188.18",
3
+ "version": "7.188.19-beta.1",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -26,14 +26,17 @@
26
26
  "yup": "^0.26.10"
27
27
  },
28
28
  "devDependencies": {
29
+ "@eslint/eslintrc": "^3.1.0",
30
+ "@eslint/js": "^9.9.1",
29
31
  "@types/semver": "^7.3.9",
30
- "@typescript-eslint/eslint-plugin": "^5.60.1",
31
- "@typescript-eslint/parser": "^5.60.1",
32
+ "@typescript-eslint/eslint-plugin": "^8.4.0",
33
+ "@typescript-eslint/parser": "^8.4.0",
32
34
  "app-builder-lib": "^22.10.4",
33
- "eslint": "^8.43.0",
35
+ "eslint": "^9.9.1",
34
36
  "eslint-config-prettier": "^8.8.0",
35
37
  "eslint-plugin-prettier": "^4.2.1",
38
+ "globals": "^15.9.0",
36
39
  "prettier": "^2.8.8",
37
- "typescript": "^3.9.10"
40
+ "typescript": "^5.5.4"
38
41
  }
39
42
  }
package/src/base.ts CHANGED
@@ -2,6 +2,7 @@ import {
2
2
  ExtraFileReference,
3
3
  FilePath,
4
4
  IAppBuilderLib,
5
+ PlatformName,
5
6
  Release,
6
7
  } from './desktopify';
7
8
  export interface Schemable {
@@ -151,6 +152,13 @@ export interface ToDesktopJson {
151
152
  icon?: FilePath;
152
153
  requirements?: FilePath;
153
154
  };
155
+ mas?: {
156
+ type?: 'development' | 'distribution'; // defaults to development
157
+ entitlements?: FilePath;
158
+ entitlementsInherit?: FilePath;
159
+ provisioningProfile?: FilePath;
160
+ x64ArchFiles?: string;
161
+ };
154
162
  nodeVersion?: string;
155
163
  npmVersion?: string;
156
164
  packageManager?: 'npm' | 'yarn' | 'pnpm';
@@ -182,9 +190,6 @@ export interface CustomWindowsCodeSignFile {
182
190
  certType: string;
183
191
  hsmCertType: WindowsHSMCertType.file;
184
192
  hsmCertName: string;
185
- // following are still used in desktopify, but no longer used/saved from web app
186
- certPassword?: string;
187
- certUrl?: URL;
188
193
  }
189
194
 
190
195
  export interface CustomWindowsCodeSignEV {
@@ -241,6 +246,11 @@ export type ReleaseRedirectionRule =
241
246
  buildId: string;
242
247
  ipList: string[];
243
248
  rule: 'buildByIp';
249
+ }
250
+ | {
251
+ buildId: string;
252
+ platforms: PlatformName[];
253
+ rule: 'buildByPlatform';
244
254
  };
245
255
 
246
256
  export interface BaseApp extends Schemable {
@@ -252,12 +262,10 @@ export interface BaseApp extends Schemable {
252
262
  customWindowsCodeSign?: CustomWindowsCodeSignFile | CustomWindowsCodeSignEV;
253
263
 
254
264
  meta?: IAppMeta;
255
- subscription?: {
256
- status: string;
257
- subscriptionId: string;
258
- itemId: string;
259
- planId: string;
260
- };
265
+ // this property is dynamically resolved at queueBuild in cloud functions
266
+ parentApp?: BaseApp;
267
+ parent?: { id: string; relationshipToParent: string } | null;
268
+ subscription?: Subscription;
261
269
 
262
270
  // artifacts
263
271
  shouldCreate32BitWindowsArtifacts?: boolean;
@@ -268,6 +276,8 @@ export interface BaseApp extends Schemable {
268
276
  shouldCreateArm64WindowsArtifacts?: boolean;
269
277
  shouldCreateDebianPackages?: boolean;
270
278
  shouldCreateDMGs?: boolean;
279
+ shouldCreateMacAppStoreFiles?: boolean;
280
+ shouldCreateMacPKG?: boolean;
271
281
  shouldCreateMacUniversalInstaller?: boolean;
272
282
  shouldCreateMacZipInstallers?: boolean;
273
283
  shouldCreateMSIInstallers?: boolean;
@@ -275,9 +285,23 @@ export interface BaseApp extends Schemable {
275
285
  shouldCreateNSISWebInstaller?: boolean;
276
286
  shouldCreateRPMPackages?: boolean;
277
287
  shouldCreateSnapFiles?: boolean;
278
-
279
288
  // artifact configs
280
289
  appxConfig?: Partial<IAppBuilderLib['config']['appx']>;
290
+ masConfig?: Partial<IAppBuilderLib['config']['mas']>;
281
291
  nsisConfig?: Partial<IAppBuilderLib['config']['nsis']>;
282
292
  snapStore?: { login?: string; description?: string };
293
+ macUniversalInstallerConfig?: {
294
+ shouldPinToVersion?: boolean;
295
+ };
283
296
  }
297
+
298
+ export type Subscription = {
299
+ status: string;
300
+ subscriptionId: string;
301
+ itemId: string;
302
+ planId: string;
303
+
304
+ // todo: remove optional qualifier once we complete migration
305
+ productId?: string;
306
+ priceId?: string;
307
+ };
package/src/desktopify.ts CHANGED
@@ -62,7 +62,7 @@ export type MacArch = 'x64' | 'arm64' | 'universal';
62
62
  export type LinuxArch = 'x64' | 'arm64';
63
63
  export type WindowsArch = 'ia32' | 'x64' | 'arm64' | 'universal';
64
64
  export type LinuxArtifactName = 'appImage' | 'deb' | 'rpm' | 'snap';
65
- export type MacArtifactName = 'dmg' | 'zip' | 'installer';
65
+ export type MacArtifactName = 'dmg' | 'zip' | 'installer' | 'mas' | 'pkg';
66
66
  export type WindowsArtifactName =
67
67
  | 'msi'
68
68
  | 'nsis'
@@ -145,14 +145,17 @@ export interface Build {
145
145
  hash?: string;
146
146
  icon?: string;
147
147
  id: string;
148
+ isArtifactsPruned?: boolean;
148
149
  isBeingCancelled?: boolean;
149
150
  linux?: PlatformBuild;
150
151
  mac?: PlatformBuild;
151
152
  onBuildFinishedWebhook?: string;
153
+ partiallyReleasedAt?: ISODate;
152
154
  projectConfig?: string; // Stringified version of todesktop.json
153
155
  releasedAt?: ISODate;
154
156
  shouldCodeSign: boolean;
155
157
  shouldRelease: boolean;
158
+ shouldRetainForever?: boolean; // Artifacts can't be pruned
156
159
  smokeTest?: {
157
160
  buildServerExecutionId?: string;
158
161
  isCanceled?: boolean;
@@ -164,6 +167,7 @@ export interface Build {
164
167
  status: AnalysisStatus;
165
168
  // `result` is a stringified JSON object
166
169
  result?: string;
170
+ error?: string;
167
171
  };
168
172
  dependencyAnalysis?: {
169
173
  status: AnalysisStatus;
@@ -194,10 +198,13 @@ export interface Build {
194
198
  }
195
199
 
196
200
  export type BundlePhobiaItem = {
197
- description: string;
198
- gzip: string;
199
- name: string;
200
- size: number;
201
+ result: {
202
+ description: string;
203
+ gzip: string;
204
+ name: string;
205
+ size: number;
206
+ } | null;
207
+ error: string | null;
201
208
  };
202
209
 
203
210
  export type ComputedBuildProperties = Pick<
@@ -258,15 +265,86 @@ export interface WindowsCustomManifest extends CustomManifest {
258
265
 
259
266
  export interface SmokeTestProgress {
260
267
  abState?: SmokeTestState;
268
+ abSkipReason?: string;
261
269
  appLaunched?: boolean;
262
270
  appUpdated?: boolean;
263
271
  bcState?: SmokeTestState;
272
+ buildAId?: string;
264
273
  code?: string; // string currently, since it's still a subject to change
265
274
  message?: string;
275
+ performance?: {
276
+ ab?: SmokeTestPerformance;
277
+ bc: SmokeTestPerformance;
278
+ };
266
279
  progress: number;
267
280
  screenshot?: string;
268
281
  state: SmokeTestState;
269
282
  updatedAppHasNoMainErrors?: boolean;
283
+ vm: {
284
+ agentVersion: string;
285
+ cpu?: string; // win only
286
+ image: string;
287
+ imageVersion: string;
288
+ };
289
+ }
290
+
291
+ export interface SmokeTestPerformance {
292
+ /**
293
+ * Time between `process.getCreationTime()` and `App#redy event`
294
+ */
295
+ appReadyMs: number;
296
+ /**
297
+ * Time between `process.getCreationTime()` and app is closed for update
298
+ */
299
+ appReadyToRestartForUpdateMs: number;
300
+ /**
301
+ * Time between `process.getCreationTime()` and connect event received from
302
+ * the restarted app. It can be up to 4 minutes on Windows.
303
+ */
304
+ appRestartedAfterUpdateMs: number;
305
+ /**
306
+ * From `process.cpuUsage()` user + system.
307
+ * This value measures time spent in user and system code, and may end up
308
+ * being greater than actual elapsed time if multiple CPU cores are
309
+ * performing work for this process.
310
+ * Under the hood, low-level calls like `getrusage` are used, so this value
311
+ * is calculated from the process start.
312
+ * It measures for the first 10-12 seconds of the app execution.
313
+ */
314
+ cpuUsageMainProcessMs: number;
315
+ /**
316
+ * Maximum memory consumption by the main + renders + any other helper
317
+ * processes
318
+ */
319
+ memoryUsageAllProcessesMb: number;
320
+ /**
321
+ * Maximum memory consumption by the main process
322
+ */
323
+ memoryUsageMainProcessMb: number;
324
+ /**
325
+ * Maximum memory consumption by a renderer process (if started)
326
+ */
327
+ memoryUsageRendererProcessMb?: number;
328
+ /**
329
+ * Time between `process.getCreationTime()` and `initSmokeTest()` of
330
+ * runtime execution
331
+ */
332
+ runtimeLoadedMs: number;
333
+ /**
334
+ * Time between `process.getCreationTime()` and the update file downloaded
335
+ * from the server.
336
+ */
337
+ updateDownloadedMs: number;
338
+ /**
339
+ * Time between `process.getCreationTime()` and the first firing of
340
+ * WebContents#dom-ready if any window is created
341
+ */
342
+ webContentsDomReadyMs?: number;
343
+ /**
344
+ * Time between `process.getCreationTime()` and the first firing of
345
+ * WebContents#did-finish-load if any window is created
346
+ */
347
+ webContentsFinishLoadMs?: number;
270
348
  }
271
349
 
272
350
  export type SmokeTestState = 'progress' | 'done' | 'error' | 'skipped';
@@ -288,6 +288,10 @@ export interface DesktopifyAppWindow {
288
288
  * Disables default rightClick menu
289
289
  */
290
290
  disableContextMenu: boolean;
291
+ /**
292
+ * Disables the menu item for opening a link in a new app window
293
+ */
294
+ disableContextMenuOpenInWindow: boolean;
291
295
  /**
292
296
  * Allows user to `Cmd+F` or `Edit>Find` to search for text on page
293
297
  */
@@ -521,9 +525,17 @@ export interface DesktopifyApp2<Plugin = DesktopAppPlugin> {
521
525
  */
522
526
  shouldMakeSameDomainAnExternalLink?: boolean;
523
527
  /**
524
- * Enables push notifications
528
+ * Enables push notifications — uses `electron-push-receiver`
525
529
  */
526
530
  enablePushNotifications?: boolean;
531
+ /**
532
+ * Enables NEW push notifications — uses `@cuj1559/electron-push-receiver`
533
+ */
534
+ enableNewPushNotifications?: boolean;
535
+ /**
536
+ * Disable error reporting (Sentry)
537
+ */
538
+ disableErrorTracking?: boolean;
527
539
  /**
528
540
  * Sets theme for Electron UI elements and css.
529
541
  *
package/src/hsm.ts ADDED
@@ -0,0 +1,63 @@
1
+ /**
2
+ * - mac = Developer ID Application
3
+ * - mac-installer = Developer ID Installer
4
+ * - mas = Apple Distribution or Mac App Distribution (for Mac App Store)
5
+ * - mas-installer = Mac Installer Distribution (for Mac App Store)
6
+ * - mas-dev = Apple Development
7
+ */
8
+ export type MacTarget =
9
+ | 'mac'
10
+ | 'mac-installer'
11
+ | 'mas'
12
+ | 'mas-installer'
13
+ | 'mas-dev';
14
+
15
+ export type WindowsTarget = 'windows';
16
+
17
+ export function isMacTarget(type: string): type is MacTarget {
18
+ return ['mac', 'mac-installer', 'mas', 'mas-installer', 'mas-dev'].includes(
19
+ type
20
+ );
21
+ }
22
+
23
+ export function isWindowsTarget(type: string): type is MacTarget {
24
+ return ['windows'].includes(type);
25
+ }
26
+
27
+ /**
28
+ * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
29
+ * This function returns the key name that is used for certificate files that have a `.p12` postfix.
30
+ *
31
+ * @param appId the application id
32
+ * @param target the target type
33
+ * @returns the name of the secret that is required for downloading the cert from HSM.
34
+ */
35
+ export const getCertificateNameFromHSM = (
36
+ appId: string,
37
+ target: MacTarget | WindowsTarget
38
+ ) => {
39
+ if (!isMacTarget(target) && !isWindowsTarget(target)) {
40
+ throw new Error(
41
+ `Invalid target '${target}'. Only windows or mac certs are supported`
42
+ );
43
+ }
44
+
45
+ return `todesktop-${appId}-${target}-cert`;
46
+ };
47
+
48
+ /**
49
+ * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
50
+ * This function returns the key name that is used for key files that have a `.p8` postfix.
51
+ * Currently only used for mac notarization.
52
+ *
53
+ * @param appId the application id
54
+ * @param target the target type
55
+ * @returns the name of the secret that is required for downloading the cert from HSM.
56
+ */
57
+ export const getAPIKeyNameFromHSM = (appId: string, target: MacTarget) => {
58
+ if (!isMacTarget(target)) {
59
+ throw new Error(`Invalid target '${target}'. Only mac certs are supported`);
60
+ }
61
+
62
+ return `todesktop-${appId}-${target}-api-key`;
63
+ };
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ export * from './getSiteInfo';
7
7
  export * from './plans';
8
8
  export * from './base';
9
9
  export * from './plugin';
10
+ export * from './hsm';
10
11
 
11
12
  export * from './desktopify2';
12
13