@todesktop/shared 7.190.0 → 7.191.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/.prettierignore +0 -2
- package/CHANGELOG.md +19 -0
- package/README.md +42 -15
- package/eslint.config.mjs +8 -55
- package/lib/{base.d.ts → cjs/base.d.ts} +82 -75
- package/lib/{desktopify.d.ts → cjs/desktopify.d.ts} +74 -74
- package/lib/{desktopify.js → cjs/desktopify.js} +12 -11
- package/lib/{desktopify2.d.ts → cjs/desktopify2.d.ts} +223 -223
- package/lib/{getSiteInfo.d.ts → cjs/getSiteInfo.d.ts} +6 -6
- package/lib/{hsm.d.ts → cjs/hsm.d.ts} +1 -1
- package/lib/{hsm.js → cjs/hsm.js} +1 -1
- package/lib/{index.d.ts → cjs/index.d.ts} +7 -8
- package/lib/{index.js → cjs/index.js} +11 -9
- package/lib/{invitePermissionLabels.d.ts → cjs/invitePermissionLabels.d.ts} +4 -2
- package/lib/{invitePermissionLabels.js → cjs/invitePermissionLabels.js} +11 -3
- package/lib/{personalAccessTokens.d.ts → cjs/personalAccessTokens.d.ts} +12 -12
- package/lib/{plans.d.ts → cjs/plans.d.ts} +27 -27
- package/lib/{plans.js → cjs/plans.js} +165 -163
- package/lib/{plugin.d.ts → cjs/plugin.d.ts} +18 -18
- package/lib/{toDesktop.d.ts → cjs/toDesktop.d.ts} +66 -66
- package/lib/cjs/translation.d.ts +2 -0
- package/lib/{validations.d.ts → cjs/validations.d.ts} +66 -66
- package/lib/cjs/validations.js +178 -0
- package/lib/esm/base.d.ts +326 -0
- package/lib/esm/base.js +19 -0
- package/lib/esm/desktopify.d.ts +339 -0
- package/lib/esm/desktopify.js +71 -0
- package/lib/esm/desktopify2.d.ts +506 -0
- package/lib/esm/desktopify2.js +77 -0
- package/lib/esm/getSiteInfo.d.ts +24 -0
- package/lib/esm/getSiteInfo.js +1 -0
- package/lib/esm/hsm.d.ts +30 -0
- package/lib/esm/hsm.js +35 -0
- package/lib/esm/index.d.ts +12 -0
- package/lib/esm/index.js +14 -0
- package/lib/esm/invitePermissionLabels.d.ts +13 -0
- package/lib/esm/invitePermissionLabels.js +24 -0
- package/lib/esm/personalAccessTokens.d.ts +24 -0
- package/lib/esm/personalAccessTokens.js +1 -0
- package/lib/esm/plans.d.ts +130 -0
- package/lib/esm/plans.js +626 -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/translation.js +13 -0
- package/lib/esm/validations.d.ts +102 -0
- package/lib/{validations.js → esm/validations.js} +54 -56
- package/package.json +29 -20
- package/src/base.ts +90 -82
- package/src/desktopify.ts +82 -80
- package/src/desktopify2.ts +240 -240
- package/src/getSiteInfo.ts +6 -6
- package/src/hsm.ts +7 -7
- package/src/index.cjs.ts +19 -0
- package/src/index.ts +14 -14
- package/src/invitePermissionLabels.ts +20 -6
- package/src/personalAccessTokens.ts +12 -12
- package/src/plans.ts +191 -191
- package/src/plugin.ts +19 -19
- package/src/toDesktop.ts +70 -70
- package/src/translation.ts +2 -2
- package/src/validations.ts +51 -49
- package/tsconfig.esm.json +15 -0
- package/tsconfig.json +6 -4
- package/.prettierrc +0 -5
- package/lib/translation.d.ts +0 -2
- package/lib/{base.js → cjs/base.js} +3 -3
- /package/lib/{desktopify2.js → cjs/desktopify2.js} +0 -0
- /package/lib/{getSiteInfo.js → cjs/getSiteInfo.js} +0 -0
- /package/lib/{personalAccessTokens.js → cjs/personalAccessTokens.js} +0 -0
- /package/lib/{plugin.js → cjs/plugin.js} +0 -0
- /package/lib/{toDesktop.js → cjs/toDesktop.js} +0 -0
- /package/lib/{translation.js → cjs/translation.js} +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { BaseApp, Schemable } from './base';
|
|
2
|
+
import { IAppBuilderLib } from './desktopify';
|
|
3
|
+
import { PatSummary } from './personalAccessTokens';
|
|
4
|
+
export type IUploadFileStatus = 'done' | 'error' | 'removed' | 'success' | 'uploading';
|
|
5
|
+
export interface IUploadFile {
|
|
6
|
+
error?: any;
|
|
7
|
+
fileName?: string;
|
|
8
|
+
lastModified?: number;
|
|
9
|
+
lastModifiedDate?: Date;
|
|
10
|
+
linkProps?: any;
|
|
11
|
+
name: string;
|
|
12
|
+
originFileObj?: File;
|
|
13
|
+
percent?: number;
|
|
14
|
+
response?: any;
|
|
15
|
+
size: number;
|
|
16
|
+
status?: IUploadFileStatus;
|
|
17
|
+
thumbUrl?: string;
|
|
18
|
+
type: string;
|
|
19
|
+
uid: string;
|
|
20
|
+
url?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface IHueIcon extends IUploadFile {
|
|
23
|
+
hueAdjustment?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface IAppIcon {
|
|
26
|
+
appId: string;
|
|
27
|
+
icon: IHueIcon;
|
|
28
|
+
}
|
|
29
|
+
export type IAppIcons = IAppIcon[];
|
|
30
|
+
export interface IAppWindowOptions {
|
|
31
|
+
alwaysOnTop: boolean;
|
|
32
|
+
autoHideMenuBar: boolean;
|
|
33
|
+
hasMaxHeight: boolean;
|
|
34
|
+
hasMaxWidth: boolean;
|
|
35
|
+
hasMinHeight: boolean;
|
|
36
|
+
hasMinWidth: boolean;
|
|
37
|
+
height: number;
|
|
38
|
+
isMaximizable: boolean;
|
|
39
|
+
isMinimizable: boolean;
|
|
40
|
+
isResizable: boolean;
|
|
41
|
+
maxHeight: number;
|
|
42
|
+
maxWidth: number;
|
|
43
|
+
minHeight: number;
|
|
44
|
+
minWidth: number;
|
|
45
|
+
startInFullscreenMode: boolean;
|
|
46
|
+
transparentInsetTitlebar: boolean;
|
|
47
|
+
transparentTitlebar: boolean;
|
|
48
|
+
width: number;
|
|
49
|
+
}
|
|
50
|
+
export interface IWindowOptions {
|
|
51
|
+
height: number;
|
|
52
|
+
isAlwaysOnTop?: boolean;
|
|
53
|
+
isAutoHideMenuBar?: boolean;
|
|
54
|
+
isFullScreenStartEnabled?: boolean;
|
|
55
|
+
isInsetTitlebarTransparent?: boolean;
|
|
56
|
+
isMaximizable: boolean;
|
|
57
|
+
isMinimizable: boolean;
|
|
58
|
+
isResizable: boolean;
|
|
59
|
+
isTitlebarTransparent?: boolean;
|
|
60
|
+
maxHeight?: ISwitchableValue<number>;
|
|
61
|
+
maxWidth?: ISwitchableValue<number>;
|
|
62
|
+
minHeight?: ISwitchableValue<number>;
|
|
63
|
+
minWidth?: ISwitchableValue<number>;
|
|
64
|
+
width: number;
|
|
65
|
+
}
|
|
66
|
+
export interface IAppPublishedVersions {
|
|
67
|
+
desktopify?: string;
|
|
68
|
+
electron?: string;
|
|
69
|
+
version?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface ISwitchableValue<T> {
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
value: T;
|
|
74
|
+
}
|
|
75
|
+
export interface IIcon {
|
|
76
|
+
height: number;
|
|
77
|
+
type: string;
|
|
78
|
+
url: string;
|
|
79
|
+
width: number;
|
|
80
|
+
}
|
|
81
|
+
export interface IApp extends BaseApp {
|
|
82
|
+
appModelId: string;
|
|
83
|
+
appPkgName?: string;
|
|
84
|
+
appProtocol?: ISwitchableValue<string>;
|
|
85
|
+
appType?: string;
|
|
86
|
+
appxConfig?: Partial<IAppBuilderLib['config']['appx']>;
|
|
87
|
+
cssToInject?: string;
|
|
88
|
+
customDomain?: string;
|
|
89
|
+
customUserAgent?: ISwitchableValue<string>;
|
|
90
|
+
disableContextMenu?: boolean;
|
|
91
|
+
enablePushNotifications?: boolean;
|
|
92
|
+
environmentVariables?: {
|
|
93
|
+
[propertyName: string]: {
|
|
94
|
+
secret: string;
|
|
95
|
+
} | string;
|
|
96
|
+
};
|
|
97
|
+
extraBrowserWindowOptions?: string;
|
|
98
|
+
icon?: string;
|
|
99
|
+
icons?: IIcon[];
|
|
100
|
+
internalUrls?: ISwitchableValue<string>;
|
|
101
|
+
isBackgroundThrottlingPrevented?: boolean;
|
|
102
|
+
isContextMenuDisabled: boolean;
|
|
103
|
+
isDevToolsDisabled: boolean;
|
|
104
|
+
isFindInPageEnabled?: boolean;
|
|
105
|
+
isGoogleOAuthExternal?: boolean;
|
|
106
|
+
isNativeWindowOpenDisabled?: boolean;
|
|
107
|
+
isSingleInstance?: boolean;
|
|
108
|
+
isTitleStatic?: boolean;
|
|
109
|
+
isTransitioningFromSquirrelWindows?: boolean;
|
|
110
|
+
isWebSecurityDisabled?: boolean;
|
|
111
|
+
jsToInject?: string;
|
|
112
|
+
menubarIcon?: string;
|
|
113
|
+
name: string;
|
|
114
|
+
nsisConfig?: Partial<IAppBuilderLib['config']['nsis']>;
|
|
115
|
+
pollForAppUpdatesEveryXMinutes?: number;
|
|
116
|
+
runtimeEnvs?: string;
|
|
117
|
+
secret?: string;
|
|
118
|
+
shouldLaunchAtStartupByDefault?: boolean;
|
|
119
|
+
shouldMakeSameDomainAnExternalLink?: boolean;
|
|
120
|
+
shouldOnlySendAbsolutelyNecessaryRequests?: boolean;
|
|
121
|
+
shouldReuseRendererProcess?: boolean;
|
|
122
|
+
shouldUseRealUserAgent?: boolean;
|
|
123
|
+
themeSource?: 'dark' | 'light' | 'system';
|
|
124
|
+
themeSourceMac?: 'dark' | 'light' | 'system';
|
|
125
|
+
toggleVisibilityKeyboardShortcut?: ISwitchableValue<string>;
|
|
126
|
+
trayIcon?: string;
|
|
127
|
+
url: string;
|
|
128
|
+
useSafeInternalUrlMatcher?: boolean;
|
|
129
|
+
windowOptions: IWindowOptions;
|
|
130
|
+
}
|
|
131
|
+
export interface IUser extends Schemable {
|
|
132
|
+
accessToken?: string;
|
|
133
|
+
allowedIPs?: string[];
|
|
134
|
+
authInfo?: object;
|
|
135
|
+
avatar?: string;
|
|
136
|
+
cliAccessTokens?: PatSummary[];
|
|
137
|
+
currentApplication?: string;
|
|
138
|
+
customerId?: string;
|
|
139
|
+
disableShouldCodeSign?: boolean;
|
|
140
|
+
email?: string;
|
|
141
|
+
featureFlags?: FeatureFlags;
|
|
142
|
+
firstName?: string;
|
|
143
|
+
id: string;
|
|
144
|
+
isAdmin?: boolean;
|
|
145
|
+
isImpersonator?: boolean;
|
|
146
|
+
isOldAccountThatNeedsNewPassword?: boolean;
|
|
147
|
+
lastName?: string;
|
|
148
|
+
seenApplicationGroupsTutorial?: boolean;
|
|
149
|
+
seenReleaseTutorial?: boolean;
|
|
150
|
+
stripeCustomerId?: string;
|
|
151
|
+
}
|
|
152
|
+
export interface FeatureFlags {
|
|
153
|
+
aboutBlankWindowOpenHandler: boolean;
|
|
154
|
+
desktopAppPlugins: boolean;
|
|
155
|
+
macAppStore: boolean;
|
|
156
|
+
}
|
|
157
|
+
export interface InvitePermissions {
|
|
158
|
+
canBuild: boolean;
|
|
159
|
+
canManageBilling?: boolean;
|
|
160
|
+
canManageUsers?: boolean;
|
|
161
|
+
canRelease: boolean;
|
|
162
|
+
}
|
|
163
|
+
export type InviteActorRole = 'delegate' | 'owner';
|
|
164
|
+
export interface InviteActorCapabilities {
|
|
165
|
+
actorEmail: string;
|
|
166
|
+
actorId: string;
|
|
167
|
+
actorPermissions: InvitePermissions;
|
|
168
|
+
actorRole: InviteActorRole;
|
|
169
|
+
}
|
|
170
|
+
export interface UserIHaveSentInviteTo {
|
|
171
|
+
email: string;
|
|
172
|
+
inviterCapabilities?: InviteActorCapabilities;
|
|
173
|
+
name: string;
|
|
174
|
+
permissions?: InvitePermissions;
|
|
175
|
+
sender: UserIHaveAcceptedInviteFrom;
|
|
176
|
+
}
|
|
177
|
+
export interface UserIHaveAcceptedInviteFrom {
|
|
178
|
+
email: string;
|
|
179
|
+
firstName: string;
|
|
180
|
+
id: string;
|
|
181
|
+
lastName: string;
|
|
182
|
+
permissions?: InvitePermissions;
|
|
183
|
+
receiver?: Pick<IUser, 'email' | 'id'>;
|
|
184
|
+
}
|
|
185
|
+
export interface CiInput {
|
|
186
|
+
accessToken: string;
|
|
187
|
+
appData: IApp;
|
|
188
|
+
buildId?: string;
|
|
189
|
+
contextUserId: string;
|
|
190
|
+
userId: string;
|
|
191
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
import { DesktopifyApp2 } from './desktopify2';
|
|
3
|
+
import { DesktopAppPlugin } from './plugin';
|
|
4
|
+
export declare const appTitleValidation: yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
5
|
+
export declare const forceVersionValidation: yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
6
|
+
export declare const iconValidation: yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
7
|
+
export declare const urlValidation: yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
8
|
+
export declare const urlValidationForm: yup.ObjectSchema<{
|
|
9
|
+
url: string;
|
|
10
|
+
}, yup.AnyObject, {
|
|
11
|
+
url: undefined;
|
|
12
|
+
}, "">;
|
|
13
|
+
export declare const heightValidation: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
|
|
14
|
+
export declare const widthValidation: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
|
|
15
|
+
export declare const internalAppRegexValidation: yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
16
|
+
export declare const appProtocolValidation: yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
17
|
+
export declare const appConfigValidation: yup.ObjectSchema<{
|
|
18
|
+
customUserAgent: string;
|
|
19
|
+
disableDevTools: NonNullable<boolean | undefined>;
|
|
20
|
+
iconUrl: string;
|
|
21
|
+
id: string;
|
|
22
|
+
internalURLs: string;
|
|
23
|
+
isFrameBlocked: NonNullable<boolean | undefined>;
|
|
24
|
+
meta: {
|
|
25
|
+
schemaVersion: number;
|
|
26
|
+
appIterations: number;
|
|
27
|
+
hasAppChanged: NonNullable<boolean | undefined>;
|
|
28
|
+
publishedVersions: {
|
|
29
|
+
electron?: yup.Maybe<string | undefined>;
|
|
30
|
+
version?: yup.Maybe<string | undefined>;
|
|
31
|
+
desktopify?: yup.Maybe<string | undefined>;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
name: string;
|
|
35
|
+
secret: string;
|
|
36
|
+
singleInstance: NonNullable<boolean | undefined>;
|
|
37
|
+
url: string;
|
|
38
|
+
windowOptions: {
|
|
39
|
+
alwaysOnTop: NonNullable<boolean | undefined>;
|
|
40
|
+
autoHideMenuBar: NonNullable<boolean | undefined>;
|
|
41
|
+
height: number;
|
|
42
|
+
maxHeight: number;
|
|
43
|
+
maxWidth: number;
|
|
44
|
+
minHeight: number;
|
|
45
|
+
minWidth: number;
|
|
46
|
+
width: number;
|
|
47
|
+
hasMaxHeight: NonNullable<boolean | undefined>;
|
|
48
|
+
hasMaxWidth: NonNullable<boolean | undefined>;
|
|
49
|
+
hasMinHeight: NonNullable<boolean | undefined>;
|
|
50
|
+
hasMinWidth: NonNullable<boolean | undefined>;
|
|
51
|
+
isFullscreenable: NonNullable<boolean | undefined>;
|
|
52
|
+
isMaximizable: NonNullable<boolean | undefined>;
|
|
53
|
+
isMinimizable: NonNullable<boolean | undefined>;
|
|
54
|
+
isResizable: NonNullable<boolean | undefined>;
|
|
55
|
+
startInFullscreenMode: NonNullable<boolean | undefined>;
|
|
56
|
+
transparentInsetTitlebar: NonNullable<boolean | undefined>;
|
|
57
|
+
transparentTitlebar: NonNullable<boolean | undefined>;
|
|
58
|
+
};
|
|
59
|
+
}, yup.AnyObject, {
|
|
60
|
+
customUserAgent: undefined;
|
|
61
|
+
disableDevTools: undefined;
|
|
62
|
+
iconUrl: undefined;
|
|
63
|
+
id: undefined;
|
|
64
|
+
internalURLs: undefined;
|
|
65
|
+
isFrameBlocked: undefined;
|
|
66
|
+
meta: {
|
|
67
|
+
appIterations: undefined;
|
|
68
|
+
hasAppChanged: undefined;
|
|
69
|
+
publishedVersions: {
|
|
70
|
+
desktopify: undefined;
|
|
71
|
+
electron: undefined;
|
|
72
|
+
version: undefined;
|
|
73
|
+
};
|
|
74
|
+
schemaVersion: undefined;
|
|
75
|
+
};
|
|
76
|
+
name: undefined;
|
|
77
|
+
secret: undefined;
|
|
78
|
+
singleInstance: undefined;
|
|
79
|
+
url: undefined;
|
|
80
|
+
windowOptions: {
|
|
81
|
+
hasMaxHeight: undefined;
|
|
82
|
+
hasMaxWidth: undefined;
|
|
83
|
+
hasMinHeight: undefined;
|
|
84
|
+
hasMinWidth: undefined;
|
|
85
|
+
height: undefined;
|
|
86
|
+
isFullscreenable: undefined;
|
|
87
|
+
isMaximizable: undefined;
|
|
88
|
+
isMinimizable: undefined;
|
|
89
|
+
isResizable: undefined;
|
|
90
|
+
maxHeight: undefined;
|
|
91
|
+
maxWidth: undefined;
|
|
92
|
+
minHeight: undefined;
|
|
93
|
+
minWidth: undefined;
|
|
94
|
+
startInFullscreenMode: undefined;
|
|
95
|
+
width: undefined;
|
|
96
|
+
alwaysOnTop: undefined;
|
|
97
|
+
autoHideMenuBar: undefined;
|
|
98
|
+
transparentInsetTitlebar: undefined;
|
|
99
|
+
transparentTitlebar: undefined;
|
|
100
|
+
};
|
|
101
|
+
}, "">;
|
|
102
|
+
export declare const shouldMinimizeToTrayIsActive: <Plugin = DesktopAppPlugin>(desktopApp: DesktopifyApp2<Plugin>) => boolean;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const semver = require("semver");
|
|
6
|
-
const isRegex = require("is-regex");
|
|
7
|
-
exports.appTitleValidation = yup
|
|
1
|
+
import isRegex from 'is-regex';
|
|
2
|
+
import semver from 'semver';
|
|
3
|
+
import * as yup from 'yup';
|
|
4
|
+
export const appTitleValidation = yup
|
|
8
5
|
.string()
|
|
9
6
|
.label('App title')
|
|
10
7
|
.max(26)
|
|
@@ -12,9 +9,9 @@ exports.appTitleValidation = yup
|
|
|
12
9
|
.matches(/^[^\s]+(\s+[^\s]+)*$/, 'App title may not begin or end with space')
|
|
13
10
|
.required();
|
|
14
11
|
function isNumeric(str) {
|
|
15
|
-
if (typeof str
|
|
12
|
+
if (typeof str !== 'string')
|
|
16
13
|
return false;
|
|
17
|
-
return !isNaN(Number(str)) && !isNaN(parseFloat(str));
|
|
14
|
+
return !Number.isNaN(Number(str)) && !Number.isNaN(parseFloat(str));
|
|
18
15
|
}
|
|
19
16
|
function isNumericSemver(value) {
|
|
20
17
|
// check if valid semver
|
|
@@ -25,7 +22,7 @@ function isNumericSemver(value) {
|
|
|
25
22
|
return false;
|
|
26
23
|
return true;
|
|
27
24
|
}
|
|
28
|
-
|
|
25
|
+
export const forceVersionValidation = yup
|
|
29
26
|
.string()
|
|
30
27
|
.label('App version')
|
|
31
28
|
.required()
|
|
@@ -34,35 +31,35 @@ exports.forceVersionValidation = yup
|
|
|
34
31
|
return (isNumericSemver(forceVersion) &&
|
|
35
32
|
semver.gt(forceVersion, currentVersion));
|
|
36
33
|
}));
|
|
37
|
-
|
|
34
|
+
export const iconValidation = yup
|
|
38
35
|
.string()
|
|
39
36
|
.label('Icon')
|
|
40
37
|
.url()
|
|
41
38
|
.required('You must upload an icon for your app');
|
|
42
|
-
|
|
39
|
+
export const urlValidation = yup
|
|
43
40
|
.string()
|
|
44
41
|
.matches(/^(?:([a-z0-9+.-]+):\/\/)(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/, {
|
|
45
|
-
message: "Invalid URL. Don't forget to include the protocol (e.g.. https://).",
|
|
46
42
|
excludeEmptyString: true,
|
|
43
|
+
message: "Invalid URL. Don't forget to include the protocol (e.g.. https://).",
|
|
47
44
|
})
|
|
48
45
|
.label('Website URL')
|
|
49
46
|
.required();
|
|
50
|
-
|
|
51
|
-
url:
|
|
47
|
+
export const urlValidationForm = yup.object().shape({
|
|
48
|
+
url: urlValidation,
|
|
52
49
|
});
|
|
53
|
-
|
|
50
|
+
export const heightValidation = yup
|
|
54
51
|
.number()
|
|
55
52
|
.label('Height')
|
|
56
53
|
.moreThan(1)
|
|
57
54
|
.lessThan(2000)
|
|
58
55
|
.required();
|
|
59
|
-
|
|
56
|
+
export const widthValidation = yup
|
|
60
57
|
.number()
|
|
61
58
|
.label('Width')
|
|
62
59
|
.moreThan(1)
|
|
63
60
|
.lessThan(3000)
|
|
64
61
|
.required();
|
|
65
|
-
|
|
62
|
+
export const internalAppRegexValidation = yup
|
|
66
63
|
.string()
|
|
67
64
|
.required()
|
|
68
65
|
.label('Internal URLs')
|
|
@@ -78,8 +75,10 @@ exports.internalAppRegexValidation = yup
|
|
|
78
75
|
}
|
|
79
76
|
return true;
|
|
80
77
|
})
|
|
81
|
-
.test('is-regex',
|
|
82
|
-
|
|
78
|
+
.test('is-regex',
|
|
79
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
80
|
+
'${path} must be valid regular expression', (value) => isRegex(RegExp(value)));
|
|
81
|
+
export const appProtocolValidation = yup
|
|
83
82
|
.string()
|
|
84
83
|
.required()
|
|
85
84
|
.label('App Protocol')
|
|
@@ -87,54 +86,53 @@ exports.appProtocolValidation = yup
|
|
|
87
86
|
.test('is-lowercase', 'Protocols must be lowercase', (value) => value === value.toLowerCase())
|
|
88
87
|
.matches(/^[a-zA-Z-.]+:\/\/$/, 'Protocols contain letters, dots (.) and dashes (-) only')
|
|
89
88
|
.min(5);
|
|
90
|
-
|
|
91
|
-
id: yup.string().required(),
|
|
92
|
-
name: exports.appTitleValidation,
|
|
93
|
-
url: exports.urlValidation,
|
|
94
|
-
isFrameBlocked: yup.boolean().required(),
|
|
95
|
-
iconUrl: exports.iconValidation,
|
|
96
|
-
disableDevTools: yup.boolean().required(),
|
|
97
|
-
singleInstance: yup.boolean().required(),
|
|
89
|
+
export const appConfigValidation = yup.object({
|
|
98
90
|
customUserAgent: yup.string().required(),
|
|
91
|
+
disableDevTools: yup.boolean().required(),
|
|
92
|
+
iconUrl: iconValidation,
|
|
93
|
+
id: yup.string().required(),
|
|
99
94
|
internalURLs: yup.string().required(),
|
|
95
|
+
isFrameBlocked: yup.boolean().required(),
|
|
96
|
+
meta: yup
|
|
97
|
+
.object({
|
|
98
|
+
appIterations: yup.number().required(),
|
|
99
|
+
hasAppChanged: yup.boolean().required(),
|
|
100
|
+
publishedVersions: yup.object({
|
|
101
|
+
desktopify: yup.string().notRequired(),
|
|
102
|
+
electron: yup.string().notRequired(),
|
|
103
|
+
version: yup.string().notRequired(),
|
|
104
|
+
}),
|
|
105
|
+
schemaVersion: yup.number().required(),
|
|
106
|
+
})
|
|
107
|
+
.required(),
|
|
108
|
+
name: appTitleValidation,
|
|
100
109
|
secret: yup.string().required(),
|
|
110
|
+
singleInstance: yup.boolean().required(),
|
|
111
|
+
url: urlValidation,
|
|
101
112
|
windowOptions: yup
|
|
102
113
|
.object({
|
|
103
|
-
startInFullscreenMode: yup.boolean().required(),
|
|
104
|
-
isResizable: yup.boolean().required(),
|
|
105
|
-
width: yup.number().required(),
|
|
106
|
-
height: yup.number().required(),
|
|
107
|
-
hasMinWidth: yup.boolean().required(),
|
|
108
|
-
hasMinHeight: yup.boolean().required(),
|
|
109
|
-
hasMaxWidth: yup.boolean().required(),
|
|
110
114
|
hasMaxHeight: yup.boolean().required(),
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
hasMaxWidth: yup.boolean().required(),
|
|
116
|
+
hasMinHeight: yup.boolean().required(),
|
|
117
|
+
hasMinWidth: yup.boolean().required(),
|
|
118
|
+
height: yup.number().required(),
|
|
119
|
+
isFullscreenable: yup.boolean().required(),
|
|
115
120
|
isMaximizable: yup.boolean().required(),
|
|
116
121
|
isMinimizable: yup.boolean().required(),
|
|
117
|
-
|
|
118
|
-
|
|
122
|
+
isResizable: yup.boolean().required(),
|
|
123
|
+
maxHeight: yup.number().required(),
|
|
124
|
+
maxWidth: yup.number().required(),
|
|
125
|
+
minHeight: yup.number().required(),
|
|
126
|
+
minWidth: yup.number().required(),
|
|
127
|
+
startInFullscreenMode: yup.boolean().required(),
|
|
128
|
+
width: yup.number().required(),
|
|
119
129
|
alwaysOnTop: yup.boolean().required(),
|
|
120
|
-
transparentInsetTitlebar: yup.boolean().required(),
|
|
121
130
|
autoHideMenuBar: yup.boolean().required(),
|
|
122
|
-
|
|
123
|
-
.required(),
|
|
124
|
-
meta: yup
|
|
125
|
-
.object({
|
|
126
|
-
schemaVersion: yup.number().required(),
|
|
127
|
-
hasAppChanged: yup.boolean().required(),
|
|
128
|
-
appIterations: yup.number().required(),
|
|
129
|
-
publishedVersions: yup.object({
|
|
130
|
-
electron: yup.string().notRequired(),
|
|
131
|
-
desktopify: yup.string().notRequired(),
|
|
132
|
-
version: yup.string().notRequired(),
|
|
133
|
-
}),
|
|
131
|
+
transparentInsetTitlebar: yup.boolean().required(),
|
|
132
|
+
transparentTitlebar: yup.boolean().required(),
|
|
134
133
|
})
|
|
135
134
|
.required(),
|
|
136
135
|
});
|
|
137
|
-
const shouldMinimizeToTrayIsActive = (desktopApp) => {
|
|
136
|
+
export const shouldMinimizeToTrayIsActive = (desktopApp) => {
|
|
138
137
|
return desktopApp.trays.some((t) => t.leftClick.role === 'toggleMenu' || t.rightClick.role === 'toggleMenu');
|
|
139
138
|
};
|
|
140
|
-
exports.shouldMinimizeToTrayIsActive = shouldMinimizeToTrayIsActive;
|
package/package.json
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@todesktop/shared",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.191.1",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "./lib/index.js",
|
|
6
|
-
"
|
|
5
|
+
"main": "./lib/cjs/index.js",
|
|
6
|
+
"module": "./lib/esm/index.js",
|
|
7
|
+
"types": "./lib/esm/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./lib/esm/index.d.ts",
|
|
12
|
+
"default": "./lib/esm/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./lib/cjs/index.d.ts",
|
|
16
|
+
"default": "./lib/cjs/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
7
20
|
"scripts": {
|
|
8
|
-
"
|
|
9
|
-
"build": "
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"lint:styles": "prettier --check . && eslint src",
|
|
13
|
-
"prepublishOnly": "npm run build",
|
|
21
|
+
"build": "rm -rf ./lib && pnpm run build:cjs && pnpm run build:esm && pnpm run build:rename-cjs-index",
|
|
22
|
+
"build:cjs": "tsc -p tsconfig.json",
|
|
23
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
24
|
+
"build:rename-cjs-index": "mv ./lib/cjs/index.cjs.js ./lib/cjs/index.js && mv ./lib/cjs/index.cjs.d.ts ./lib/cjs/index.d.ts",
|
|
14
25
|
"bump": "npm version minor && git push && npm publish",
|
|
15
|
-
"dev": "tsc"
|
|
26
|
+
"dev": "tsc",
|
|
27
|
+
"format": "prettier . --write && eslint --fix",
|
|
28
|
+
"lint": "prettier . --check && eslint",
|
|
29
|
+
"prepublishOnly": "npm run build",
|
|
30
|
+
"typecheck": "tsc --noEmit"
|
|
16
31
|
},
|
|
17
32
|
"author": "Dave Jeffery <dave@davejeffery.com>",
|
|
18
33
|
"license": "UNLICENSED",
|
|
@@ -25,17 +40,11 @@
|
|
|
25
40
|
"yup": "^1.4.0"
|
|
26
41
|
},
|
|
27
42
|
"devDependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@eslint/js": "^9.9.1",
|
|
43
|
+
"@todesktop/dev-config": "workspace:*",
|
|
30
44
|
"@types/semver": "^7.3.9",
|
|
31
|
-
"@typescript-eslint/eslint-plugin": "^8.4.0",
|
|
32
|
-
"@typescript-eslint/parser": "^8.4.0",
|
|
33
45
|
"app-builder-lib": "^25.1.8",
|
|
34
|
-
"eslint": "
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"globals": "^15.9.0",
|
|
38
|
-
"prettier": "^2.8.8",
|
|
39
|
-
"typescript": "^5.5.4"
|
|
46
|
+
"eslint": "catalog:",
|
|
47
|
+
"prettier": "catalog:",
|
|
48
|
+
"typescript": "catalog:"
|
|
40
49
|
}
|
|
41
50
|
}
|