@todesktop/shared 7.191.0 → 7.192.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.
- package/CHANGELOG.md +6 -0
- package/lib/{base.d.ts → cjs/base.d.ts} +1 -0
- package/lib/cjs/base.js +22 -0
- package/lib/{desktopify.d.ts → cjs/desktopify.d.ts} +26 -0
- package/lib/cjs/desktopify.js +79 -0
- package/lib/cjs/desktopify2.js +80 -0
- package/lib/cjs/getSiteInfo.js +2 -0
- package/lib/cjs/hsm.js +42 -0
- package/lib/cjs/index.d.ts +12 -0
- package/lib/cjs/index.js +33 -0
- package/lib/cjs/introspection/__tests__/breakpoints.test.js +59 -0
- package/lib/cjs/introspection/breakpoints.d.ts +45 -0
- package/lib/cjs/introspection/breakpoints.js +48 -0
- package/lib/cjs/invitePermissionLabels.js +29 -0
- package/lib/cjs/personalAccessTokens.js +2 -0
- package/lib/cjs/plans.js +632 -0
- package/lib/cjs/plugin.js +2 -0
- package/lib/cjs/toDesktop.js +2 -0
- package/lib/cjs/translation.js +14 -0
- package/lib/cjs/validations.js +178 -0
- package/lib/esm/base.d.ts +326 -0
- package/lib/esm/desktopify.d.ts +365 -0
- package/lib/esm/desktopify2.d.ts +506 -0
- package/lib/esm/getSiteInfo.d.ts +24 -0
- package/lib/esm/hsm.d.ts +30 -0
- package/lib/{index.d.ts → esm/index.d.ts} +2 -1
- package/lib/{index.js → esm/index.js} +3 -1
- package/lib/esm/introspection/__tests__/breakpoints.test.js +57 -0
- package/lib/esm/introspection/breakpoints.d.ts +45 -0
- package/lib/esm/introspection/breakpoints.js +42 -0
- package/lib/esm/invitePermissionLabels.d.ts +13 -0
- package/lib/esm/personalAccessTokens.d.ts +24 -0
- package/lib/esm/plans.d.ts +130 -0
- package/lib/esm/plugin.d.ts +55 -0
- package/lib/esm/plugin.js +1 -0
- package/lib/esm/toDesktop.d.ts +191 -0
- package/lib/esm/toDesktop.js +1 -0
- package/lib/esm/translation.d.ts +2 -0
- package/lib/esm/validations.d.ts +102 -0
- package/package.json +23 -6
- package/src/base.ts +1 -0
- package/src/desktopify.ts +46 -4
- package/src/index.cjs.ts +19 -0
- package/src/index.ts +3 -1
- package/src/introspection/__tests__/breakpoints.test.ts +92 -0
- package/src/introspection/breakpoints.ts +137 -0
- package/tsconfig.esm.json +15 -0
- package/tsconfig.json +3 -4
- /package/lib/{desktopify2.d.ts → cjs/desktopify2.d.ts} +0 -0
- /package/lib/{getSiteInfo.d.ts → cjs/getSiteInfo.d.ts} +0 -0
- /package/lib/{hsm.d.ts → cjs/hsm.d.ts} +0 -0
- /package/lib/{getSiteInfo.js → cjs/introspection/__tests__/breakpoints.test.d.ts} +0 -0
- /package/lib/{invitePermissionLabels.d.ts → cjs/invitePermissionLabels.d.ts} +0 -0
- /package/lib/{personalAccessTokens.d.ts → cjs/personalAccessTokens.d.ts} +0 -0
- /package/lib/{plans.d.ts → cjs/plans.d.ts} +0 -0
- /package/lib/{plugin.d.ts → cjs/plugin.d.ts} +0 -0
- /package/lib/{toDesktop.d.ts → cjs/toDesktop.d.ts} +0 -0
- /package/lib/{translation.d.ts → cjs/translation.d.ts} +0 -0
- /package/lib/{validations.d.ts → cjs/validations.d.ts} +0 -0
- /package/lib/{base.js → esm/base.js} +0 -0
- /package/lib/{desktopify.js → esm/desktopify.js} +0 -0
- /package/lib/{desktopify2.js → esm/desktopify2.js} +0 -0
- /package/lib/{personalAccessTokens.js → esm/getSiteInfo.js} +0 -0
- /package/lib/{hsm.js → esm/hsm.js} +0 -0
- /package/lib/{plugin.js → esm/introspection/__tests__/breakpoints.test.d.ts} +0 -0
- /package/lib/{invitePermissionLabels.js → esm/invitePermissionLabels.js} +0 -0
- /package/lib/{toDesktop.js → esm/personalAccessTokens.js} +0 -0
- /package/lib/{plans.js → esm/plans.js} +0 -0
- /package/lib/{translation.js → esm/translation.js} +0 -0
- /package/lib/{validations.js → esm/validations.js} +0 -0
package/CHANGELOG.md
CHANGED
package/lib/cjs/base.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WindowsHSMCertType = exports.WindowsEVOnboardingProvider = exports.WindowsEVOnboardingSteps = void 0;
|
|
4
|
+
var WindowsEVOnboardingSteps;
|
|
5
|
+
(function (WindowsEVOnboardingSteps) {
|
|
6
|
+
WindowsEVOnboardingSteps["hasBeenVerified"] = "hasBeenVerified";
|
|
7
|
+
WindowsEVOnboardingSteps["hasChosenProvider"] = "hasChosenProvider";
|
|
8
|
+
WindowsEVOnboardingSteps["hasGeneratedCert"] = "hasGeneratedCert";
|
|
9
|
+
WindowsEVOnboardingSteps["hasOrderedCert"] = "hasOrderedCert";
|
|
10
|
+
WindowsEVOnboardingSteps["hasUploadedCert"] = "hasUploadedCert";
|
|
11
|
+
})(WindowsEVOnboardingSteps || (exports.WindowsEVOnboardingSteps = WindowsEVOnboardingSteps = {}));
|
|
12
|
+
var WindowsEVOnboardingProvider;
|
|
13
|
+
(function (WindowsEVOnboardingProvider) {
|
|
14
|
+
WindowsEVOnboardingProvider["globalsign"] = "globalsign";
|
|
15
|
+
WindowsEVOnboardingProvider["other"] = "other";
|
|
16
|
+
})(WindowsEVOnboardingProvider || (exports.WindowsEVOnboardingProvider = WindowsEVOnboardingProvider = {}));
|
|
17
|
+
var WindowsHSMCertType;
|
|
18
|
+
(function (WindowsHSMCertType) {
|
|
19
|
+
WindowsHSMCertType["azureTrustedSigning"] = "azureTrustedSigning";
|
|
20
|
+
WindowsHSMCertType["ev"] = "ev";
|
|
21
|
+
WindowsHSMCertType["file"] = "file";
|
|
22
|
+
})(WindowsHSMCertType || (exports.WindowsHSMCertType = WindowsHSMCertType = {}));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Configuration, PackagerOptions, PublishOptions } from 'app-builder-lib';
|
|
2
2
|
import { IApp2 } from './desktopify2';
|
|
3
|
+
import { BreakpointPauseLease, BreakpointQueueEntry, CurrentBreakpointState } from './introspection/breakpoints';
|
|
3
4
|
import { IApp } from './toDesktop';
|
|
4
5
|
type appBuilderLib = PackagerOptions & PublishOptions;
|
|
5
6
|
export interface IAppBuilderLib extends appBuilderLib {
|
|
@@ -92,6 +93,30 @@ export interface PlatformBuild {
|
|
|
92
93
|
status: BuildStatus;
|
|
93
94
|
}
|
|
94
95
|
export type CIRunner = 'azure' | 'circle';
|
|
96
|
+
export type IntrospectBreakpointStatus = 'error' | 'finished' | 'initializing' | 'paused' | 'ready' | 'resuming';
|
|
97
|
+
export type IntrospectShellStatus = 'connected' | 'connecting' | 'disconnected' | 'error' | 'initializing' | 'ready';
|
|
98
|
+
export interface IntrospectPlatformData {
|
|
99
|
+
breakpointQueue?: BreakpointQueueEntry[];
|
|
100
|
+
breakpointStatus: IntrospectBreakpointStatus;
|
|
101
|
+
connectedAt?: Date;
|
|
102
|
+
connectedUserId?: string;
|
|
103
|
+
createdAt: ISODate;
|
|
104
|
+
currentBreakpoint?: CurrentBreakpointState;
|
|
105
|
+
disconnectedAt?: Date;
|
|
106
|
+
enabled: boolean;
|
|
107
|
+
error?: string;
|
|
108
|
+
jtiExpiresAt?: Date;
|
|
109
|
+
pauseLease?: BreakpointPauseLease;
|
|
110
|
+
sessionJti?: string;
|
|
111
|
+
shellStatus: IntrospectShellStatus;
|
|
112
|
+
tunnelUrl?: string;
|
|
113
|
+
usedJti?: string;
|
|
114
|
+
}
|
|
115
|
+
export interface IntrospectData {
|
|
116
|
+
linux: IntrospectPlatformData;
|
|
117
|
+
mac: IntrospectPlatformData;
|
|
118
|
+
windows: IntrospectPlatformData;
|
|
119
|
+
}
|
|
95
120
|
export interface Build {
|
|
96
121
|
appCustomDomain?: string;
|
|
97
122
|
appName: string;
|
|
@@ -118,6 +143,7 @@ export interface Build {
|
|
|
118
143
|
hash?: string;
|
|
119
144
|
icon?: string;
|
|
120
145
|
id: string;
|
|
146
|
+
introspect?: IntrospectData;
|
|
121
147
|
isArtifactsPruned?: boolean;
|
|
122
148
|
isBeingCancelled?: boolean;
|
|
123
149
|
linux?: PlatformBuild;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBuildCancellable = exports.isBuildRunning = exports.isCiBuildRunning = exports.isPlatformBuildRunning = exports.hasBuildKickedOff = exports.ManifestCategory = exports.AnalysisStatus = exports.BuildStatus = exports.PackageManager = exports.PlatformName = void 0;
|
|
4
|
+
var PlatformName;
|
|
5
|
+
(function (PlatformName) {
|
|
6
|
+
PlatformName["linux"] = "linux";
|
|
7
|
+
PlatformName["mac"] = "mac";
|
|
8
|
+
PlatformName["windows"] = "windows";
|
|
9
|
+
})(PlatformName || (exports.PlatformName = PlatformName = {}));
|
|
10
|
+
var PackageManager;
|
|
11
|
+
(function (PackageManager) {
|
|
12
|
+
PackageManager["npm"] = "npm";
|
|
13
|
+
PackageManager["pnpm"] = "pnpm";
|
|
14
|
+
PackageManager["yarn"] = "yarn";
|
|
15
|
+
})(PackageManager || (exports.PackageManager = PackageManager = {}));
|
|
16
|
+
var BuildStatus;
|
|
17
|
+
(function (BuildStatus) {
|
|
18
|
+
BuildStatus["building"] = "building";
|
|
19
|
+
BuildStatus["cancelled"] = "cancelled";
|
|
20
|
+
BuildStatus["failed"] = "failed";
|
|
21
|
+
BuildStatus["preparation"] = "preparation";
|
|
22
|
+
BuildStatus["queued"] = "queued";
|
|
23
|
+
BuildStatus["succeeded"] = "succeeded";
|
|
24
|
+
})(BuildStatus || (exports.BuildStatus = BuildStatus = {}));
|
|
25
|
+
var AnalysisStatus;
|
|
26
|
+
(function (AnalysisStatus) {
|
|
27
|
+
AnalysisStatus["analyzing"] = "analyzing";
|
|
28
|
+
AnalysisStatus["done"] = "done";
|
|
29
|
+
AnalysisStatus["downloading"] = "downloading";
|
|
30
|
+
AnalysisStatus["error"] = "error";
|
|
31
|
+
AnalysisStatus["extracting"] = "extracting";
|
|
32
|
+
AnalysisStatus["initializing"] = "initializing";
|
|
33
|
+
AnalysisStatus["notStarted"] = "notStarted";
|
|
34
|
+
})(AnalysisStatus || (exports.AnalysisStatus = AnalysisStatus = {}));
|
|
35
|
+
var ManifestCategory;
|
|
36
|
+
(function (ManifestCategory) {
|
|
37
|
+
ManifestCategory["buildStamped"] = "build-stamped";
|
|
38
|
+
ManifestCategory["primary"] = "primary";
|
|
39
|
+
ManifestCategory["versioned"] = "versioned";
|
|
40
|
+
})(ManifestCategory || (exports.ManifestCategory = ManifestCategory = {}));
|
|
41
|
+
const hasBuildKickedOff = (build) => {
|
|
42
|
+
if (!build) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return build.status && build.status !== BuildStatus.preparation;
|
|
46
|
+
};
|
|
47
|
+
exports.hasBuildKickedOff = hasBuildKickedOff;
|
|
48
|
+
const isPlatformBuildRunning = (platformBuild) => {
|
|
49
|
+
if (!platformBuild) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return (!platformBuild.shouldSkip && // <-- Noteworthy
|
|
53
|
+
!['cancelled', 'succeeded'].includes(platformBuild.status) &&
|
|
54
|
+
(platformBuild.status !== 'failed' ||
|
|
55
|
+
platformBuild.numberOfAttemptedBuilds < 2));
|
|
56
|
+
};
|
|
57
|
+
exports.isPlatformBuildRunning = isPlatformBuildRunning;
|
|
58
|
+
// NOTE: this relies on Firestore solely
|
|
59
|
+
const isCiBuildRunning = (build) => {
|
|
60
|
+
if (!build) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return (build.status === 'building' ||
|
|
64
|
+
(build.status === 'failed' &&
|
|
65
|
+
['linux', 'mac', 'windows'].some((platform) => build.status === 'building' ||
|
|
66
|
+
(build.status === 'failed' &&
|
|
67
|
+
(0, exports.isPlatformBuildRunning)(build[platform])))));
|
|
68
|
+
};
|
|
69
|
+
exports.isCiBuildRunning = isCiBuildRunning;
|
|
70
|
+
const isBuildRunning = (build) => {
|
|
71
|
+
if (!build) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return (!['cancelled', 'succeeded'].includes(build.status) &&
|
|
75
|
+
['linux', 'mac', 'windows'].some((platform) => (0, exports.isPlatformBuildRunning)(build[platform])));
|
|
76
|
+
};
|
|
77
|
+
exports.isBuildRunning = isBuildRunning;
|
|
78
|
+
const isBuildCancellable = (build) => (0, exports.hasBuildKickedOff)(build) && (0, exports.isBuildRunning)(build);
|
|
79
|
+
exports.isBuildCancellable = isBuildCancellable;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.allowedWebPreferencesOptions = exports.allowedBrowserWindowConstructorOptions = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Whitelist of allowed DesktopifyWindow Options.
|
|
6
|
+
* These attrs (if set) are passed to the `BrowserWindow` constructor
|
|
7
|
+
* when the window is created
|
|
8
|
+
*/
|
|
9
|
+
exports.allowedBrowserWindowConstructorOptions = [
|
|
10
|
+
'width',
|
|
11
|
+
'height',
|
|
12
|
+
// "x",
|
|
13
|
+
// "y",
|
|
14
|
+
'useContentSize',
|
|
15
|
+
'center',
|
|
16
|
+
'minWidth',
|
|
17
|
+
'minHeight',
|
|
18
|
+
'maxWidth',
|
|
19
|
+
'maxHeight',
|
|
20
|
+
'resizable',
|
|
21
|
+
'movable',
|
|
22
|
+
'minimizable',
|
|
23
|
+
'maximizable',
|
|
24
|
+
'closable',
|
|
25
|
+
'focusable',
|
|
26
|
+
'alwaysOnTop',
|
|
27
|
+
'fullscreen',
|
|
28
|
+
'fullscreenable',
|
|
29
|
+
'simpleFullscreen',
|
|
30
|
+
'skipTaskbar',
|
|
31
|
+
'kiosk',
|
|
32
|
+
'icon',
|
|
33
|
+
'paintWhenInitiallyHidden',
|
|
34
|
+
'frame',
|
|
35
|
+
'acceptFirstMouse',
|
|
36
|
+
'disableAutoHideCursor',
|
|
37
|
+
'autoHideMenuBar',
|
|
38
|
+
'enableLargerThanScreen',
|
|
39
|
+
'backgroundColor',
|
|
40
|
+
'hasShadow',
|
|
41
|
+
'opacity',
|
|
42
|
+
'darkTheme',
|
|
43
|
+
'transparent',
|
|
44
|
+
'visualEffectState',
|
|
45
|
+
'titleBarStyle',
|
|
46
|
+
'trafficLightPosition',
|
|
47
|
+
// "roundedCorners",
|
|
48
|
+
'thickFrame',
|
|
49
|
+
'type',
|
|
50
|
+
'vibrancy',
|
|
51
|
+
'zoomToPageWidth',
|
|
52
|
+
'tabbingIdentifier',
|
|
53
|
+
'webPreferences',
|
|
54
|
+
'titleBarOverlay',
|
|
55
|
+
];
|
|
56
|
+
/**
|
|
57
|
+
* Whitelist of allowed DesktopifyWindow Web Preferences Options.
|
|
58
|
+
* These attrs (if set) are passed to the webPreferences object in the `BrowserWindow` constructor
|
|
59
|
+
* when the window is created
|
|
60
|
+
*/
|
|
61
|
+
exports.allowedWebPreferencesOptions = [
|
|
62
|
+
'devTools',
|
|
63
|
+
'zoomFactor',
|
|
64
|
+
'textAreasAreResizable',
|
|
65
|
+
'scrollBounce',
|
|
66
|
+
'defaultFontFamily',
|
|
67
|
+
'defaultFontSize',
|
|
68
|
+
'defaultMonospaceFontSize',
|
|
69
|
+
'minimumFontSize',
|
|
70
|
+
'defaultEncoding',
|
|
71
|
+
'backgroundThrottling',
|
|
72
|
+
'offscreen',
|
|
73
|
+
'safeDialogs',
|
|
74
|
+
'safeDialogsMessage',
|
|
75
|
+
'navigateOnDragDrop',
|
|
76
|
+
'autoplayPolicy',
|
|
77
|
+
'disableHtmlFullscreenWindowResize',
|
|
78
|
+
'accessibleTitle',
|
|
79
|
+
'spellcheck',
|
|
80
|
+
];
|
package/lib/cjs/hsm.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAPIKeyNameFromHSM = exports.getCertificateNameFromHSM = void 0;
|
|
4
|
+
exports.isMacTarget = isMacTarget;
|
|
5
|
+
exports.isWindowsTarget = isWindowsTarget;
|
|
6
|
+
function isMacTarget(type) {
|
|
7
|
+
return ['mac', 'mac-installer', 'mas', 'mas-dev', 'mas-installer'].includes(type);
|
|
8
|
+
}
|
|
9
|
+
function isWindowsTarget(type) {
|
|
10
|
+
return ['windows'].includes(type);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
|
|
14
|
+
* This function returns the key name that is used for certificate files that have a `.p12` postfix.
|
|
15
|
+
*
|
|
16
|
+
* @param appId the application id
|
|
17
|
+
* @param target the target type
|
|
18
|
+
* @returns the name of the secret that is required for downloading the cert from HSM.
|
|
19
|
+
*/
|
|
20
|
+
const getCertificateNameFromHSM = (appId, target) => {
|
|
21
|
+
if (!isMacTarget(target) && !isWindowsTarget(target)) {
|
|
22
|
+
throw new Error(`Invalid target '${target}'. Only windows or mac certs are supported`);
|
|
23
|
+
}
|
|
24
|
+
return `todesktop-${appId}-${target}-cert`;
|
|
25
|
+
};
|
|
26
|
+
exports.getCertificateNameFromHSM = getCertificateNameFromHSM;
|
|
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 key files that have a `.p8` postfix.
|
|
30
|
+
* Currently only used for mac notarization.
|
|
31
|
+
*
|
|
32
|
+
* @param appId the application id
|
|
33
|
+
* @param target the target type
|
|
34
|
+
* @returns the name of the secret that is required for downloading the cert from HSM.
|
|
35
|
+
*/
|
|
36
|
+
const getAPIKeyNameFromHSM = (appId, target) => {
|
|
37
|
+
if (!isMacTarget(target)) {
|
|
38
|
+
throw new Error(`Invalid target '${target}'. Only mac certs are supported`);
|
|
39
|
+
}
|
|
40
|
+
return `todesktop-${appId}-${target}-api-key`;
|
|
41
|
+
};
|
|
42
|
+
exports.getAPIKeyNameFromHSM = getAPIKeyNameFromHSM;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './base';
|
|
2
|
+
export * from './desktopify';
|
|
3
|
+
export * from './desktopify2';
|
|
4
|
+
export * from './getSiteInfo';
|
|
5
|
+
export * from './hsm';
|
|
6
|
+
export * from './invitePermissionLabels';
|
|
7
|
+
export * from './personalAccessTokens';
|
|
8
|
+
export * from './plans';
|
|
9
|
+
export * from './plugin';
|
|
10
|
+
export * from './toDesktop';
|
|
11
|
+
export * from './validations';
|
|
12
|
+
export declare const schemaVersion: any;
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.schemaVersion = void 0;
|
|
18
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
19
|
+
// CJS-specific entry point
|
|
20
|
+
// Path is relative to lib/cjs/ output directory
|
|
21
|
+
const packageJson = require('../../package.json');
|
|
22
|
+
__exportStar(require("./base"), exports);
|
|
23
|
+
__exportStar(require("./desktopify"), exports);
|
|
24
|
+
__exportStar(require("./desktopify2"), exports);
|
|
25
|
+
__exportStar(require("./getSiteInfo"), exports);
|
|
26
|
+
__exportStar(require("./hsm"), exports);
|
|
27
|
+
__exportStar(require("./invitePermissionLabels"), exports);
|
|
28
|
+
__exportStar(require("./personalAccessTokens"), exports);
|
|
29
|
+
__exportStar(require("./plans"), exports);
|
|
30
|
+
__exportStar(require("./plugin"), exports);
|
|
31
|
+
__exportStar(require("./toDesktop"), exports);
|
|
32
|
+
__exportStar(require("./validations"), exports);
|
|
33
|
+
exports.schemaVersion = packageJson.version;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const breakpoints_1 = require("../breakpoints");
|
|
5
|
+
(0, vitest_1.describe)('isSameBreakpoint', () => {
|
|
6
|
+
(0, vitest_1.it)('matches identical phase breakpoints', () => {
|
|
7
|
+
(0, vitest_1.expect)((0, breakpoints_1.isSameBreakpoint)({ id: 'beforeInstall', type: 'phase' }, { id: 'beforeInstall', type: 'phase' })).toBe(true);
|
|
8
|
+
});
|
|
9
|
+
(0, vitest_1.it)('fails when breakpoint types differ', () => {
|
|
10
|
+
(0, vitest_1.expect)((0, breakpoints_1.isSameBreakpoint)({ id: 'beforeInstall', type: 'phase' }, { id: 'todesktop:beforeInstall', position: 'before', type: 'hook' })).toBe(false);
|
|
11
|
+
});
|
|
12
|
+
(0, vitest_1.it)('considers hook positions', () => {
|
|
13
|
+
(0, vitest_1.expect)((0, breakpoints_1.isSameBreakpoint)({ id: 'todesktop:beforeBuild', position: 'before', type: 'hook' }, { id: 'todesktop:beforeBuild', position: 'after', type: 'hook' })).toBe(false);
|
|
14
|
+
});
|
|
15
|
+
(0, vitest_1.it)('returns false when either side is undefined', () => {
|
|
16
|
+
(0, vitest_1.expect)((0, breakpoints_1.isSameBreakpoint)(undefined, { id: 'afterInstall', type: 'phase' })).toBe(false);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
(0, vitest_1.describe)('cloneBreakpointQueue', () => {
|
|
20
|
+
(0, vitest_1.it)('produces a deep copy of the queue', () => {
|
|
21
|
+
const original = [
|
|
22
|
+
{ hitAt: undefined, id: 'beforeInstall', type: 'phase' },
|
|
23
|
+
{
|
|
24
|
+
id: 'todesktop:afterPack',
|
|
25
|
+
position: 'after',
|
|
26
|
+
skipped: true,
|
|
27
|
+
type: 'hook',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
const copy = (0, breakpoints_1.cloneBreakpointQueue)(original);
|
|
31
|
+
(0, vitest_1.expect)(copy).toEqual(original);
|
|
32
|
+
(0, vitest_1.expect)(copy).not.toBe(original);
|
|
33
|
+
(0, vitest_1.expect)(copy[0]).not.toBe(original[0]);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
(0, vitest_1.describe)('markQueueSkipped', () => {
|
|
37
|
+
(0, vitest_1.it)('marks the starting entry as skipped and adds fallback timestamps', () => {
|
|
38
|
+
const queue = [
|
|
39
|
+
{ id: 'beforeInstall', type: 'phase' },
|
|
40
|
+
{ id: 'afterInstall', type: 'phase' },
|
|
41
|
+
];
|
|
42
|
+
const fallbackHitAt = '2024-01-01T00:00:00.000Z';
|
|
43
|
+
const updated = (0, breakpoints_1.markQueueSkipped)(queue, 0, { fallbackHitAt });
|
|
44
|
+
(0, vitest_1.expect)(updated[0]).toMatchObject({
|
|
45
|
+
hitAt: fallbackHitAt,
|
|
46
|
+
skipped: true,
|
|
47
|
+
});
|
|
48
|
+
(0, vitest_1.expect)(updated[1]).toMatchObject({ skipped: true });
|
|
49
|
+
(0, vitest_1.expect)(queue[0].skipped).toBeUndefined();
|
|
50
|
+
});
|
|
51
|
+
(0, vitest_1.it)('returns a cloned queue when index is out of bounds', () => {
|
|
52
|
+
const queue = [
|
|
53
|
+
{ id: 'beforeInstall', type: 'phase' },
|
|
54
|
+
];
|
|
55
|
+
const updated = (0, breakpoints_1.markQueueSkipped)(queue, 2);
|
|
56
|
+
(0, vitest_1.expect)(updated).toEqual(queue);
|
|
57
|
+
(0, vitest_1.expect)(updated).not.toBe(queue);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const BREAKPOINT_DEFAULT_LEASE_MS: number;
|
|
2
|
+
export declare const BREAKPOINT_RENEW_INCREMENT_MS: number;
|
|
3
|
+
export declare const BREAKPOINT_MAX_REMAINING_MS: number;
|
|
4
|
+
export type PhaseBreakpointId = 'afterInstall' | 'afterPack' | 'afterSourcePrep' | 'afterUpload' | 'beforeFinalize' | 'beforeInstall' | 'beforePack' | 'beforeUpload';
|
|
5
|
+
export type HookBreakpointName = 'todesktop:afterPack' | 'todesktop:beforeBuild' | 'todesktop:beforeInstall';
|
|
6
|
+
export type HookBreakpointPosition = 'after' | 'before';
|
|
7
|
+
interface PhaseBreakpointConfig {
|
|
8
|
+
id: PhaseBreakpointId;
|
|
9
|
+
type: 'phase';
|
|
10
|
+
}
|
|
11
|
+
interface HookBreakpointConfig {
|
|
12
|
+
id: HookBreakpointName;
|
|
13
|
+
position: HookBreakpointPosition;
|
|
14
|
+
type: 'hook';
|
|
15
|
+
}
|
|
16
|
+
export type BreakpointConfig = HookBreakpointConfig | PhaseBreakpointConfig;
|
|
17
|
+
export type BreakpointQueueEntry = {
|
|
18
|
+
autoResumed?: boolean;
|
|
19
|
+
hitAt?: string;
|
|
20
|
+
skipped?: boolean;
|
|
21
|
+
} & BreakpointConfig;
|
|
22
|
+
export interface BreakpointRenewal {
|
|
23
|
+
renewedAt: string;
|
|
24
|
+
renewedByUserId: string;
|
|
25
|
+
}
|
|
26
|
+
export type CurrentBreakpointState = {
|
|
27
|
+
createdAt: string;
|
|
28
|
+
expiresAt: string;
|
|
29
|
+
renewals?: BreakpointRenewal[];
|
|
30
|
+
resumedAt?: string;
|
|
31
|
+
resumedByUserId?: string;
|
|
32
|
+
skipped?: boolean;
|
|
33
|
+
wasAutoResumed?: boolean;
|
|
34
|
+
} & BreakpointConfig;
|
|
35
|
+
export interface BreakpointPauseLease {
|
|
36
|
+
createdAt: string;
|
|
37
|
+
createdByUserId: string;
|
|
38
|
+
defaultDurationMs: number;
|
|
39
|
+
}
|
|
40
|
+
export declare function isSameBreakpoint(a: BreakpointConfig | BreakpointQueueEntry | CurrentBreakpointState | undefined, b: BreakpointConfig | BreakpointQueueEntry | CurrentBreakpointState | undefined): boolean;
|
|
41
|
+
export declare function cloneBreakpointQueue(queue?: null | ReadonlyArray<BreakpointQueueEntry>): BreakpointQueueEntry[];
|
|
42
|
+
export declare function markQueueSkipped(queue: ReadonlyArray<BreakpointQueueEntry>, startIndex: number, options?: {
|
|
43
|
+
fallbackHitAt?: string;
|
|
44
|
+
}): BreakpointQueueEntry[];
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BREAKPOINT_MAX_REMAINING_MS = exports.BREAKPOINT_RENEW_INCREMENT_MS = exports.BREAKPOINT_DEFAULT_LEASE_MS = void 0;
|
|
4
|
+
exports.isSameBreakpoint = isSameBreakpoint;
|
|
5
|
+
exports.cloneBreakpointQueue = cloneBreakpointQueue;
|
|
6
|
+
exports.markQueueSkipped = markQueueSkipped;
|
|
7
|
+
const MINUTE = 60 * 1000;
|
|
8
|
+
exports.BREAKPOINT_DEFAULT_LEASE_MS = 20 * MINUTE; // 20 minutes
|
|
9
|
+
exports.BREAKPOINT_RENEW_INCREMENT_MS = 10 * MINUTE; // 10 minutes
|
|
10
|
+
exports.BREAKPOINT_MAX_REMAINING_MS = 20 * MINUTE; // 20 minutes
|
|
11
|
+
function isSameBreakpoint(a, b) {
|
|
12
|
+
if (!a || !b) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (a.type !== b.type) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (a.id !== b.id) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (isHookBreakpointConfig(a) && isHookBreakpointConfig(b)) {
|
|
22
|
+
return a.position === b.position;
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
function isHookBreakpointConfig(config) {
|
|
27
|
+
return config.type === 'hook';
|
|
28
|
+
}
|
|
29
|
+
function cloneBreakpointQueue(queue) {
|
|
30
|
+
return Array.isArray(queue) ? queue.map((entry) => (Object.assign({}, entry))) : [];
|
|
31
|
+
}
|
|
32
|
+
function markQueueSkipped(queue, startIndex, options = {}) {
|
|
33
|
+
var _a;
|
|
34
|
+
const updated = cloneBreakpointQueue(queue);
|
|
35
|
+
const { fallbackHitAt } = options;
|
|
36
|
+
if (startIndex < 0 || startIndex >= updated.length) {
|
|
37
|
+
return updated;
|
|
38
|
+
}
|
|
39
|
+
const current = updated[startIndex];
|
|
40
|
+
const hitAt = (_a = current.hitAt) !== null && _a !== void 0 ? _a : fallbackHitAt;
|
|
41
|
+
updated[startIndex] = Object.assign(Object.assign(Object.assign({}, current), { skipped: true }), (hitAt ? { hitAt } : {}));
|
|
42
|
+
for (let i = startIndex + 1; i < updated.length; i += 1) {
|
|
43
|
+
if (!updated[i].hitAt) {
|
|
44
|
+
updated[i] = Object.assign(Object.assign({}, updated[i]), { skipped: true });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return updated;
|
|
48
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeInvitePermissions = exports.FULL_OWNER_PERMISSIONS = exports.formatInvitePermissionSummary = exports.INVITE_PERMISSION_LABELS = void 0;
|
|
4
|
+
exports.INVITE_PERMISSION_LABELS = {
|
|
5
|
+
canBuild: 'Can build',
|
|
6
|
+
canManageBilling: 'Can manage billing',
|
|
7
|
+
canManageUsers: 'Can manage users',
|
|
8
|
+
canRelease: 'Can release',
|
|
9
|
+
};
|
|
10
|
+
const formatInvitePermissionSummary = (permissions) => {
|
|
11
|
+
const enabled = Object.entries(permissions)
|
|
12
|
+
.filter(([, value]) => value === true)
|
|
13
|
+
.map(([key]) => exports.INVITE_PERMISSION_LABELS[key]);
|
|
14
|
+
return enabled.join(', ');
|
|
15
|
+
};
|
|
16
|
+
exports.formatInvitePermissionSummary = formatInvitePermissionSummary;
|
|
17
|
+
exports.FULL_OWNER_PERMISSIONS = {
|
|
18
|
+
canBuild: true,
|
|
19
|
+
canManageBilling: true,
|
|
20
|
+
canManageUsers: true,
|
|
21
|
+
canRelease: true,
|
|
22
|
+
};
|
|
23
|
+
const normalizeInvitePermissions = (permissions) => ({
|
|
24
|
+
canBuild: (permissions === null || permissions === void 0 ? void 0 : permissions.canBuild) === true,
|
|
25
|
+
canManageBilling: (permissions === null || permissions === void 0 ? void 0 : permissions.canManageBilling) === true,
|
|
26
|
+
canManageUsers: (permissions === null || permissions === void 0 ? void 0 : permissions.canManageUsers) === true,
|
|
27
|
+
canRelease: (permissions === null || permissions === void 0 ? void 0 : permissions.canRelease) === true,
|
|
28
|
+
});
|
|
29
|
+
exports.normalizeInvitePermissions = normalizeInvitePermissions;
|