@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/README.md ADDED
@@ -0,0 +1,75 @@
1
+ ## Stripe Subscriptions
2
+
3
+ Most of the code for coordinating Stripe subscriptions can be found in `plans.ts`. Conceptually, we organize subscriptions as follows:
4
+
5
+ - A `Price` captures the ID information of a Stripe Price and it's current status:
6
+ - `inactive` means that the price should no longer be used (but may have been used previously).
7
+ - `active` means that the price should be used going forward.
8
+ - A `Product` maps to what is shown in Stripe's [Product Catalogue](https://dashboard.stripe.com/products?active=true) UI. These help use organize the dev and prod versions of a `Product`, as well as their underlying `productId` and `priceIds`.
9
+ - A `Plan` is a collection of `Product`s, organized by their tier (basic, legacy_pro, pro, scale).
10
+
11
+ Each Plan also specifies the `eligiblePlanTiers` that it accepts for validation purposes. E.g. the basic plan specifies `['basic', 'legacy_pro', 'pro', 'scale']` in its `eligiblePlanTiers` field, meaning that Products belonging within any of those tiers would satisfy validation requirements. Similarly, the basic plan specifies `['scale']` in its tiers field, meaning that only **Products** belonging to the scale **Plans** would satisfy validation.
12
+
13
+ ### Adding a new subscription price
14
+
15
+ Before adding a new price, you'll first need to identify the Stripe [Stripe Product](https://dashboard.stripe.com/products?active=true) that the price should be added to.
16
+
17
+ Once you've added a new price to the product in Stripe's `live` and `test` mode, then you can come back and add it to the relevant product in `plans.ts`.
18
+
19
+ For example, these are the dev and prod records for the legacy enterprise product:
20
+
21
+ ```ts
22
+ const legacyEnterpriseDev = createProduct('prod_Hc9PMnHUmHvOlw', {
23
+ monthly_700: createPrice('price_1H2v6JIewCKA2h0IgUwsuctb', 'active'),
24
+ });
25
+
26
+ const legacyEnterpriseProd = createProduct('prod_GuGGWeMQ3SCuE9', {
27
+ monthly_700: createPrice('plan_GuGICX6nRtDthN', 'active'),
28
+ });
29
+ ```
30
+
31
+ If you added a new Stripe price to this product that is billed yearly for $10,000, then you would add update the products as follows:
32
+
33
+ ```ts
34
+ const legacyEnterpriseDev = createProduct('prod_Hc9PMnHUmHvOlw', {
35
+ monthly_700: createPrice('price_1H2v6JIewCKA2h0IgUwsuctb', 'active'),
36
+ yearly_10000: createPrice('...', 'active'),
37
+ });
38
+
39
+ const legacyEnterpriseProd = createProduct('prod_GuGGWeMQ3SCuE9', {
40
+ monthly_700: createPrice('plan_GuGICX6nRtDthN', 'active'),
41
+ yearly_10000: createPrice('...', 'active'),
42
+ });
43
+ ```
44
+
45
+ ### Rebuilding the Stripe Customer Portals
46
+
47
+ ToDesktop's subscription flow needs to support both **CLI** and **ToDesktop Builder** customers. To achieve this, we dynamically create/load billing portals based on whether the customer is a **CLI** or **ToDesktop Builder** user, whether the customer needs to **Upgrade** or **Update** their plan, and whether the environment is in prod or dev.
48
+
49
+ This leaves us with 8 unique customer portal configurations:
50
+
51
+ - _cliUpdateConfigurationDev_
52
+ - _cliUpdateConfigurationProd_
53
+ - _cliUpgradeConfigurationDev_
54
+ - _cliUpgradeConfigurationProd_
55
+ - _builderUpdateConfigurationDev_
56
+ - _builderUpdateConfigurationProd_
57
+ - _builderUpgradeConfigurationDev_
58
+ - _builderUpgradeConfigurationProd_
59
+
60
+ Each configuration specifies the products and prices (with an `active` status) that should be displayed when a user navigates to the customer billing portal.
61
+
62
+ The web app and desktop app then only need to specify the `PortalConfigKey` when creating a checkout session from the client:
63
+
64
+ ```ts
65
+ // begin a CLI upgrade customer portal session
66
+ await createCustomerPortalSession({
67
+ configuration: PortalConfigKey.CLIUpgradeProd,
68
+ flowData: {
69
+ type: 'subscription_update',
70
+ subscription_update: { subscription: subscription.id },
71
+ },
72
+ });
73
+ ```
74
+
75
+ If you have updated the products that are used by any of the portal configurations, then you'll also need to increase the `PORTAL_VERSION` constant by 1. This will ensure that the portals are rebuilt to use the latest products and prices. This happens in `createCustomerPortalSession` in the web app.
@@ -0,0 +1,57 @@
1
+ import typescriptEslint from '@typescript-eslint/eslint-plugin';
2
+ import prettier from 'eslint-plugin-prettier';
3
+ import globals from 'globals';
4
+ import tsParser from '@typescript-eslint/parser';
5
+ import path from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ import js from '@eslint/js';
8
+ import { FlatCompat } from '@eslint/eslintrc';
9
+
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = path.dirname(__filename);
12
+ const compat = new FlatCompat({
13
+ baseDirectory: __dirname,
14
+ recommendedConfig: js.configs.recommended,
15
+ allConfig: js.configs.all,
16
+ });
17
+
18
+ export default [
19
+ ...compat.extends(
20
+ 'eslint:recommended',
21
+ 'plugin:@typescript-eslint/recommended',
22
+ 'prettier'
23
+ ),
24
+ {
25
+ plugins: {
26
+ '@typescript-eslint': typescriptEslint,
27
+ prettier,
28
+ },
29
+
30
+ languageOptions: {
31
+ globals: {
32
+ ...globals.node,
33
+ },
34
+
35
+ parser: tsParser,
36
+ ecmaVersion: 2020,
37
+ sourceType: 'module',
38
+
39
+ parserOptions: {
40
+ project: './tsconfig.json',
41
+ },
42
+ },
43
+
44
+ rules: {
45
+ 'prettier/prettier': 'error',
46
+
47
+ '@typescript-eslint/no-misused-promises': [
48
+ 'error',
49
+ {
50
+ checksVoidReturn: false,
51
+ },
52
+ ],
53
+
54
+ '@typescript-eslint/no-explicit-any': 'warn',
55
+ },
56
+ },
57
+ ];
package/lib/base.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { ExtraFileReference, FilePath, IAppBuilderLib, Release } from './desktopify';
1
+ import { ExtraFileReference, FilePath, IAppBuilderLib, PlatformName, Release } from './desktopify';
2
2
  export interface Schemable {
3
3
  schemaVersion?: number;
4
4
  }
5
- declare type CompositeIdFileLocationKey = string;
6
- export declare type StaticAnalysisItem = {
5
+ type CompositeIdFileLocationKey = string;
6
+ export type StaticAnalysisItem = {
7
7
  hidden: boolean;
8
8
  };
9
- export declare type ProgressTypes = 'queued' | 'progress' | 'done' | 'error';
9
+ export type ProgressTypes = 'queued' | 'progress' | 'done' | 'error';
10
10
  export interface IChecklistItem {
11
11
  [id: string]: boolean;
12
12
  }
@@ -139,6 +139,13 @@ export interface ToDesktopJson {
139
139
  icon?: FilePath;
140
140
  requirements?: FilePath;
141
141
  };
142
+ mas?: {
143
+ type?: 'development' | 'distribution';
144
+ entitlements?: FilePath;
145
+ entitlementsInherit?: FilePath;
146
+ provisioningProfile?: FilePath;
147
+ x64ArchFiles?: string;
148
+ };
142
149
  nodeVersion?: string;
143
150
  npmVersion?: string;
144
151
  packageManager?: 'npm' | 'yarn' | 'pnpm';
@@ -168,15 +175,13 @@ export interface CustomWindowsCodeSignFile {
168
175
  certType: string;
169
176
  hsmCertType: WindowsHSMCertType.file;
170
177
  hsmCertName: string;
171
- certPassword?: string;
172
- certUrl?: URL;
173
178
  }
174
179
  export interface CustomWindowsCodeSignEV {
175
180
  certType: 'hsm';
176
181
  hsmCertType: WindowsHSMCertType.ev;
177
182
  hsmCertName: string;
178
183
  }
179
- export declare type CustomMacCodeSign = {
184
+ export type CustomMacCodeSign = {
180
185
  type: 'url';
181
186
  certName: string;
182
187
  certPassword: string;
@@ -184,7 +189,7 @@ export declare type CustomMacCodeSign = {
184
189
  } | {
185
190
  type: 'hsm';
186
191
  };
187
- export declare type CustomMacNotarization = CustomNotarizationApiKeyAuth | CustomNotarizationPasswordAuth | CustomNotarizationPasswordHsmAuth;
192
+ export type CustomMacNotarization = CustomNotarizationApiKeyAuth | CustomNotarizationPasswordAuth | CustomNotarizationPasswordHsmAuth;
188
193
  export interface CustomNotarizationApiKeyAuth {
189
194
  appleApiKeyId: string;
190
195
  appleApiIssuer: string;
@@ -200,7 +205,7 @@ export interface CustomNotarizationPasswordHsmAuth {
200
205
  teamId: string;
201
206
  type: 'hsm';
202
207
  }
203
- export declare type ReleaseRedirectionRule = {
208
+ export type ReleaseRedirectionRule = {
204
209
  appId: string;
205
210
  rule: 'app';
206
211
  } | {
@@ -211,6 +216,10 @@ export declare type ReleaseRedirectionRule = {
211
216
  buildId: string;
212
217
  ipList: string[];
213
218
  rule: 'buildByIp';
219
+ } | {
220
+ buildId: string;
221
+ platforms: PlatformName[];
222
+ rule: 'buildByPlatform';
214
223
  };
215
224
  export interface BaseApp extends Schemable {
216
225
  id: string;
@@ -220,12 +229,12 @@ export interface BaseApp extends Schemable {
220
229
  customNotarization?: CustomMacNotarization;
221
230
  customWindowsCodeSign?: CustomWindowsCodeSignFile | CustomWindowsCodeSignEV;
222
231
  meta?: IAppMeta;
223
- subscription?: {
224
- status: string;
225
- subscriptionId: string;
226
- itemId: string;
227
- planId: string;
228
- };
232
+ parentApp?: BaseApp;
233
+ parent?: {
234
+ id: string;
235
+ relationshipToParent: string;
236
+ } | null;
237
+ subscription?: Subscription;
229
238
  shouldCreate32BitWindowsArtifacts?: boolean;
230
239
  shouldCreateAppImages?: boolean;
231
240
  shouldCreateAppleSiliconAssets?: boolean;
@@ -234,6 +243,8 @@ export interface BaseApp extends Schemable {
234
243
  shouldCreateArm64WindowsArtifacts?: boolean;
235
244
  shouldCreateDebianPackages?: boolean;
236
245
  shouldCreateDMGs?: boolean;
246
+ shouldCreateMacAppStoreFiles?: boolean;
247
+ shouldCreateMacPKG?: boolean;
237
248
  shouldCreateMacUniversalInstaller?: boolean;
238
249
  shouldCreateMacZipInstallers?: boolean;
239
250
  shouldCreateMSIInstallers?: boolean;
@@ -242,10 +253,22 @@ export interface BaseApp extends Schemable {
242
253
  shouldCreateRPMPackages?: boolean;
243
254
  shouldCreateSnapFiles?: boolean;
244
255
  appxConfig?: Partial<IAppBuilderLib['config']['appx']>;
256
+ masConfig?: Partial<IAppBuilderLib['config']['mas']>;
245
257
  nsisConfig?: Partial<IAppBuilderLib['config']['nsis']>;
246
258
  snapStore?: {
247
259
  login?: string;
248
260
  description?: string;
249
261
  };
262
+ macUniversalInstallerConfig?: {
263
+ shouldPinToVersion?: boolean;
264
+ };
250
265
  }
266
+ export type Subscription = {
267
+ status: string;
268
+ subscriptionId: string;
269
+ itemId: string;
270
+ planId: string;
271
+ productId?: string;
272
+ priceId?: string;
273
+ };
251
274
  export {};
package/lib/base.js CHANGED
@@ -8,14 +8,14 @@ var WindowsEVOnboardingSteps;
8
8
  WindowsEVOnboardingSteps["hasBeenVerified"] = "hasBeenVerified";
9
9
  WindowsEVOnboardingSteps["hasGeneratedCert"] = "hasGeneratedCert";
10
10
  WindowsEVOnboardingSteps["hasUploadedCert"] = "hasUploadedCert";
11
- })(WindowsEVOnboardingSteps = exports.WindowsEVOnboardingSteps || (exports.WindowsEVOnboardingSteps = {}));
11
+ })(WindowsEVOnboardingSteps || (exports.WindowsEVOnboardingSteps = WindowsEVOnboardingSteps = {}));
12
12
  var WindowsEVOnboardingProvider;
13
13
  (function (WindowsEVOnboardingProvider) {
14
14
  WindowsEVOnboardingProvider["globalsign"] = "globalsign";
15
15
  WindowsEVOnboardingProvider["other"] = "other";
16
- })(WindowsEVOnboardingProvider = exports.WindowsEVOnboardingProvider || (exports.WindowsEVOnboardingProvider = {}));
16
+ })(WindowsEVOnboardingProvider || (exports.WindowsEVOnboardingProvider = WindowsEVOnboardingProvider = {}));
17
17
  var WindowsHSMCertType;
18
18
  (function (WindowsHSMCertType) {
19
19
  WindowsHSMCertType["ev"] = "ev";
20
20
  WindowsHSMCertType["file"] = "file";
21
- })(WindowsHSMCertType = exports.WindowsHSMCertType || (exports.WindowsHSMCertType = {}));
21
+ })(WindowsHSMCertType || (exports.WindowsHSMCertType = WindowsHSMCertType = {}));
@@ -1,7 +1,7 @@
1
1
  import { IApp2 } from './desktopify2';
2
2
  import { IApp } from './toDesktop';
3
3
  import { Configuration, PackagerOptions, PublishOptions } from 'app-builder-lib';
4
- declare type appBuilderLib = PackagerOptions & PublishOptions;
4
+ type appBuilderLib = PackagerOptions & PublishOptions;
5
5
  export interface IAppBuilderLib extends appBuilderLib {
6
6
  config: Configuration;
7
7
  }
@@ -9,15 +9,15 @@ export interface ExtraFileReference {
9
9
  from: FilePath;
10
10
  to?: FilePath;
11
11
  }
12
- export declare type ISODate = string;
12
+ export type ISODate = string;
13
13
  export declare enum PlatformName {
14
14
  linux = "linux",
15
15
  mac = "mac",
16
16
  windows = "windows"
17
17
  }
18
- export declare type FilePath = string;
19
- export declare type SemanticVersion = string;
20
- export declare type URL = string;
18
+ export type FilePath = string;
19
+ export type SemanticVersion = string;
20
+ export type URL = string;
21
21
  export declare enum PackageManager {
22
22
  npm = "npm",
23
23
  yarn = "yarn",
@@ -40,22 +40,22 @@ export declare enum AnalysisStatus {
40
40
  done = "done",
41
41
  error = "error"
42
42
  }
43
- export declare type Arch = 'ia32' | 'x64' | 'arm64' | 'universal';
44
- export declare type MacArch = 'x64' | 'arm64' | 'universal';
45
- export declare type LinuxArch = 'x64' | 'arm64';
46
- export declare type WindowsArch = 'ia32' | 'x64' | 'arm64' | 'universal';
47
- export declare type LinuxArtifactName = 'appImage' | 'deb' | 'rpm' | 'snap';
48
- export declare type MacArtifactName = 'dmg' | 'zip' | 'installer';
49
- export declare type WindowsArtifactName = 'msi' | 'nsis' | 'nsis-web' | 'nsis-web-7z' | 'appx';
50
- declare type ArtifactDownload = Record<Arch, {
43
+ export type Arch = 'ia32' | 'x64' | 'arm64' | 'universal';
44
+ export type MacArch = 'x64' | 'arm64' | 'universal';
45
+ export type LinuxArch = 'x64' | 'arm64';
46
+ export type WindowsArch = 'ia32' | 'x64' | 'arm64' | 'universal';
47
+ export type LinuxArtifactName = 'appImage' | 'deb' | 'rpm' | 'snap';
48
+ export type MacArtifactName = 'dmg' | 'zip' | 'installer' | 'mas' | 'pkg';
49
+ export type WindowsArtifactName = 'msi' | 'nsis' | 'nsis-web' | 'nsis-web-7z' | 'appx';
50
+ type ArtifactDownload = Record<Arch, {
51
51
  size: number;
52
52
  standardUrl: URL;
53
53
  url: URL;
54
54
  } | null> | null;
55
- export declare type LinuxArtifactDownloads = Record<LinuxArtifactName, ArtifactDownload>;
56
- export declare type MacArtifactDownloads = Record<MacArtifactName, ArtifactDownload>;
57
- export declare type WindowsArtifactDownloads = Record<WindowsArtifactName, ArtifactDownload>;
58
- export declare type CodeSignSkipReason = 'no-cert' | 'user-disabled';
55
+ export type LinuxArtifactDownloads = Record<LinuxArtifactName, ArtifactDownload>;
56
+ export type MacArtifactDownloads = Record<MacArtifactName, ArtifactDownload>;
57
+ export type WindowsArtifactDownloads = Record<WindowsArtifactName, ArtifactDownload>;
58
+ export type CodeSignSkipReason = 'no-cert' | 'user-disabled';
59
59
  export interface PlatformBuild {
60
60
  appBuilderLibConfig?: IAppBuilderLib;
61
61
  artifactDownloads?: LinuxArtifactDownloads | MacArtifactDownloads | WindowsArtifactDownloads;
@@ -82,7 +82,7 @@ export interface PlatformBuild {
82
82
  startedAt: ISODate;
83
83
  status: BuildStatus;
84
84
  }
85
- export declare type CIRunner = 'circle' | 'azure';
85
+ export type CIRunner = 'circle' | 'azure';
86
86
  export interface Build {
87
87
  appCustomDomain?: string;
88
88
  appName: string;
@@ -105,14 +105,17 @@ export interface Build {
105
105
  hash?: string;
106
106
  icon?: string;
107
107
  id: string;
108
+ isArtifactsPruned?: boolean;
108
109
  isBeingCancelled?: boolean;
109
110
  linux?: PlatformBuild;
110
111
  mac?: PlatformBuild;
111
112
  onBuildFinishedWebhook?: string;
113
+ partiallyReleasedAt?: ISODate;
112
114
  projectConfig?: string;
113
115
  releasedAt?: ISODate;
114
116
  shouldCodeSign: boolean;
115
117
  shouldRelease: boolean;
118
+ shouldRetainForever?: boolean;
116
119
  smokeTest?: {
117
120
  buildServerExecutionId?: string;
118
121
  isCanceled?: boolean;
@@ -123,6 +126,7 @@ export interface Build {
123
126
  staticAnalysis?: {
124
127
  status: AnalysisStatus;
125
128
  result?: string;
129
+ error?: string;
126
130
  };
127
131
  dependencyAnalysis?: {
128
132
  status: AnalysisStatus;
@@ -147,13 +151,16 @@ export interface Build {
147
151
  };
148
152
  windows?: PlatformBuild;
149
153
  }
150
- export declare type BundlePhobiaItem = {
151
- description: string;
152
- gzip: string;
153
- name: string;
154
- size: number;
154
+ export type BundlePhobiaItem = {
155
+ result: {
156
+ description: string;
157
+ gzip: string;
158
+ name: string;
159
+ size: number;
160
+ } | null;
161
+ error: string | null;
155
162
  };
156
- export declare type ComputedBuildProperties = Pick<Build, 'desktopifyVersion' | 'electronVersionUsed' | 'endedAt' | 'errorMessage' | 'releasedAt' | 'standardUniversalDownloadUrl' | 'startedAt' | 'status' | 'universalDownloadUrl'>;
163
+ export type ComputedBuildProperties = Pick<Build, 'desktopifyVersion' | 'electronVersionUsed' | 'endedAt' | 'errorMessage' | 'releasedAt' | 'standardUniversalDownloadUrl' | 'startedAt' | 'status' | 'universalDownloadUrl'>;
157
164
  export declare enum ManifestCategory {
158
165
  primary = "primary",
159
166
  buildStamped = "build-stamped",
@@ -181,17 +188,87 @@ export interface WindowsCustomManifest extends CustomManifest {
181
188
  }
182
189
  export interface SmokeTestProgress {
183
190
  abState?: SmokeTestState;
191
+ abSkipReason?: string;
184
192
  appLaunched?: boolean;
185
193
  appUpdated?: boolean;
186
194
  bcState?: SmokeTestState;
195
+ buildAId?: string;
187
196
  code?: string;
188
197
  message?: string;
198
+ performance?: {
199
+ ab?: SmokeTestPerformance;
200
+ bc: SmokeTestPerformance;
201
+ };
189
202
  progress: number;
190
203
  screenshot?: string;
191
204
  state: SmokeTestState;
192
205
  updatedAppHasNoMainErrors?: boolean;
206
+ vm: {
207
+ agentVersion: string;
208
+ cpu?: string;
209
+ image: string;
210
+ imageVersion: string;
211
+ };
212
+ }
213
+ export interface SmokeTestPerformance {
214
+ /**
215
+ * Time between `process.getCreationTime()` and `App#redy event`
216
+ */
217
+ appReadyMs: number;
218
+ /**
219
+ * Time between `process.getCreationTime()` and app is closed for update
220
+ */
221
+ appReadyToRestartForUpdateMs: number;
222
+ /**
223
+ * Time between `process.getCreationTime()` and connect event received from
224
+ * the restarted app. It can be up to 4 minutes on Windows.
225
+ */
226
+ appRestartedAfterUpdateMs: number;
227
+ /**
228
+ * From `process.cpuUsage()` user + system.
229
+ * This value measures time spent in user and system code, and may end up
230
+ * being greater than actual elapsed time if multiple CPU cores are
231
+ * performing work for this process.
232
+ * Under the hood, low-level calls like `getrusage` are used, so this value
233
+ * is calculated from the process start.
234
+ * It measures for the first 10-12 seconds of the app execution.
235
+ */
236
+ cpuUsageMainProcessMs: number;
237
+ /**
238
+ * Maximum memory consumption by the main + renders + any other helper
239
+ * processes
240
+ */
241
+ memoryUsageAllProcessesMb: number;
242
+ /**
243
+ * Maximum memory consumption by the main process
244
+ */
245
+ memoryUsageMainProcessMb: number;
246
+ /**
247
+ * Maximum memory consumption by a renderer process (if started)
248
+ */
249
+ memoryUsageRendererProcessMb?: number;
250
+ /**
251
+ * Time between `process.getCreationTime()` and `initSmokeTest()` of
252
+ * runtime execution
253
+ */
254
+ runtimeLoadedMs: number;
255
+ /**
256
+ * Time between `process.getCreationTime()` and the update file downloaded
257
+ * from the server.
258
+ */
259
+ updateDownloadedMs: number;
260
+ /**
261
+ * Time between `process.getCreationTime()` and the first firing of
262
+ * WebContents#dom-ready if any window is created
263
+ */
264
+ webContentsDomReadyMs?: number;
265
+ /**
266
+ * Time between `process.getCreationTime()` and the first firing of
267
+ * WebContents#did-finish-load if any window is created
268
+ */
269
+ webContentsFinishLoadMs?: number;
193
270
  }
194
- export declare type SmokeTestState = 'progress' | 'done' | 'error' | 'skipped';
271
+ export type SmokeTestState = 'progress' | 'done' | 'error' | 'skipped';
195
272
  export declare const hasBuildKickedOff: (build: Build) => boolean;
196
273
  export declare const isPlatformBuildRunning: (platformBuild: PlatformBuild) => boolean;
197
274
  export declare const isCiBuildRunning: (build: Build) => boolean;
package/lib/desktopify.js CHANGED
@@ -6,13 +6,13 @@ var PlatformName;
6
6
  PlatformName["linux"] = "linux";
7
7
  PlatformName["mac"] = "mac";
8
8
  PlatformName["windows"] = "windows";
9
- })(PlatformName = exports.PlatformName || (exports.PlatformName = {}));
9
+ })(PlatformName || (exports.PlatformName = PlatformName = {}));
10
10
  var PackageManager;
11
11
  (function (PackageManager) {
12
12
  PackageManager["npm"] = "npm";
13
13
  PackageManager["yarn"] = "yarn";
14
14
  PackageManager["pnpm"] = "pnpm";
15
- })(PackageManager = exports.PackageManager || (exports.PackageManager = {}));
15
+ })(PackageManager || (exports.PackageManager = PackageManager = {}));
16
16
  var BuildStatus;
17
17
  (function (BuildStatus) {
18
18
  BuildStatus["queued"] = "queued";
@@ -21,7 +21,7 @@ var BuildStatus;
21
21
  BuildStatus["preparation"] = "preparation";
22
22
  BuildStatus["succeeded"] = "succeeded";
23
23
  BuildStatus["cancelled"] = "cancelled";
24
- })(BuildStatus = exports.BuildStatus || (exports.BuildStatus = {}));
24
+ })(BuildStatus || (exports.BuildStatus = BuildStatus = {}));
25
25
  var AnalysisStatus;
26
26
  (function (AnalysisStatus) {
27
27
  AnalysisStatus["notStarted"] = "notStarted";
@@ -31,20 +31,21 @@ var AnalysisStatus;
31
31
  AnalysisStatus["analyzing"] = "analyzing";
32
32
  AnalysisStatus["done"] = "done";
33
33
  AnalysisStatus["error"] = "error";
34
- })(AnalysisStatus = exports.AnalysisStatus || (exports.AnalysisStatus = {}));
34
+ })(AnalysisStatus || (exports.AnalysisStatus = AnalysisStatus = {}));
35
35
  var ManifestCategory;
36
36
  (function (ManifestCategory) {
37
37
  ManifestCategory["primary"] = "primary";
38
38
  ManifestCategory["buildStamped"] = "build-stamped";
39
39
  ManifestCategory["versioned"] = "versioned";
40
- })(ManifestCategory = exports.ManifestCategory || (exports.ManifestCategory = {}));
41
- exports.hasBuildKickedOff = (build) => {
40
+ })(ManifestCategory || (exports.ManifestCategory = ManifestCategory = {}));
41
+ const hasBuildKickedOff = (build) => {
42
42
  if (!build) {
43
43
  return false;
44
44
  }
45
45
  return build.status && build.status !== BuildStatus.preparation;
46
46
  };
47
- exports.isPlatformBuildRunning = (platformBuild) => {
47
+ exports.hasBuildKickedOff = hasBuildKickedOff;
48
+ const isPlatformBuildRunning = (platformBuild) => {
48
49
  if (!platformBuild) {
49
50
  return false;
50
51
  }
@@ -53,21 +54,25 @@ exports.isPlatformBuildRunning = (platformBuild) => {
53
54
  ('failed' !== platformBuild.status ||
54
55
  platformBuild.numberOfAttemptedBuilds < 2));
55
56
  };
57
+ exports.isPlatformBuildRunning = isPlatformBuildRunning;
56
58
  // NOTE: this relies on Firestore solely
57
- exports.isCiBuildRunning = (build) => {
59
+ const isCiBuildRunning = (build) => {
58
60
  if (!build) {
59
61
  return false;
60
62
  }
61
63
  return (build.status === 'building' ||
62
64
  (build.status === 'failed' &&
63
65
  ['linux', 'mac', 'windows'].some((platform) => build.status === 'building' ||
64
- (build.status === 'failed' && exports.isPlatformBuildRunning(build[platform])))));
66
+ (build.status === 'failed' && (0, exports.isPlatformBuildRunning)(build[platform])))));
65
67
  };
66
- exports.isBuildRunning = (build) => {
68
+ exports.isCiBuildRunning = isCiBuildRunning;
69
+ const isBuildRunning = (build) => {
67
70
  if (!build) {
68
71
  return false;
69
72
  }
70
73
  return (!['cancelled', 'succeeded'].includes(build.status) &&
71
- ['linux', 'mac', 'windows'].some((platform) => exports.isPlatformBuildRunning(build[platform])));
74
+ ['linux', 'mac', 'windows'].some((platform) => (0, exports.isPlatformBuildRunning)(build[platform])));
72
75
  };
73
- exports.isBuildCancellable = (build) => exports.hasBuildKickedOff(build) && exports.isBuildRunning(build);
76
+ exports.isBuildRunning = isBuildRunning;
77
+ const isBuildCancellable = (build) => (0, exports.hasBuildKickedOff)(build) && (0, exports.isBuildRunning)(build);
78
+ exports.isBuildCancellable = isBuildCancellable;