@jbrowse/plugin-authentication 4.3.0 → 5.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/esm/DropboxOAuthModel/DropboxIcon.d.ts +1 -1
  2. package/esm/DropboxOAuthModel/configSchema.d.ts +110 -82
  3. package/esm/DropboxOAuthModel/configSchema.js +32 -2
  4. package/esm/DropboxOAuthModel/index.js +2 -2
  5. package/esm/DropboxOAuthModel/model.d.ts +235 -201
  6. package/esm/DropboxOAuthModel/model.js +46 -21
  7. package/esm/DropboxOAuthModel/util.d.ts +1 -1
  8. package/esm/DropboxOAuthModel/util.js +9 -12
  9. package/esm/ExternalTokenModel/ExternalTokenEntryForm.d.ts +1 -1
  10. package/esm/ExternalTokenModel/ExternalTokenEntryForm.js +11 -15
  11. package/esm/ExternalTokenModel/configSchema.d.ts +43 -24
  12. package/esm/ExternalTokenModel/configSchema.js +22 -1
  13. package/esm/ExternalTokenModel/index.js +2 -2
  14. package/esm/ExternalTokenModel/model.d.ts +47 -71
  15. package/esm/ExternalTokenModel/model.js +11 -54
  16. package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +2 -9
  17. package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.js +27 -6
  18. package/esm/GoogleDriveOAuthModel/GoogleDriveIcon.d.ts +1 -1
  19. package/esm/GoogleDriveOAuthModel/configSchema.d.ts +109 -82
  20. package/esm/GoogleDriveOAuthModel/configSchema.js +32 -3
  21. package/esm/GoogleDriveOAuthModel/index.js +2 -2
  22. package/esm/GoogleDriveOAuthModel/model.d.ts +230 -202
  23. package/esm/GoogleDriveOAuthModel/model.js +45 -22
  24. package/esm/GoogleDriveOAuthModel/util.d.ts +1 -1
  25. package/esm/GoogleDriveOAuthModel/util.js +2 -11
  26. package/esm/HTTPBasicModel/HTTPBasicLoginForm.d.ts +1 -1
  27. package/esm/HTTPBasicModel/HTTPBasicLoginForm.js +17 -22
  28. package/esm/HTTPBasicModel/configSchema.d.ts +51 -28
  29. package/esm/HTTPBasicModel/configSchema.js +26 -1
  30. package/esm/HTTPBasicModel/index.js +2 -2
  31. package/esm/HTTPBasicModel/model.d.ts +55 -76
  32. package/esm/HTTPBasicModel/model.js +21 -51
  33. package/esm/OAuthModel/OAuthLoginPrompt.d.ts +4 -0
  34. package/esm/OAuthModel/OAuthLoginPrompt.js +12 -0
  35. package/esm/OAuthModel/configSchema.d.ts +79 -52
  36. package/esm/OAuthModel/configSchema.js +30 -1
  37. package/esm/OAuthModel/index.js +2 -2
  38. package/esm/OAuthModel/model.d.ts +218 -114
  39. package/esm/OAuthModel/model.js +361 -217
  40. package/esm/OAuthModel/util.d.ts +46 -7
  41. package/esm/OAuthModel/util.js +159 -16
  42. package/esm/index.d.ts +295 -981
  43. package/esm/index.js +29 -45
  44. package/esm/lazyLoginForms.d.ts +18 -0
  45. package/esm/lazyLoginForms.js +25 -0
  46. package/esm/tokenEntryModelFactory.d.ts +125 -0
  47. package/esm/tokenEntryModelFactory.js +85 -0
  48. package/esm/util.d.ts +10 -0
  49. package/esm/util.js +24 -2
  50. package/package.json +10 -13
@@ -1,29 +1,24 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
- import { Dialog } from '@jbrowse/core/ui';
4
- import { Button, DialogActions, DialogContent, TextField } from '@mui/material';
3
+ import { SubmitDialog } from '@jbrowse/core/ui';
4
+ import { TextField } from '@mui/material';
5
5
  export function HTTPBasicLoginForm({ internetAccountId, handleClose, }) {
6
6
  const [username, setUsername] = useState('');
7
7
  const [password, setPassword] = useState('');
8
- return (_jsx(Dialog, { open: true, maxWidth: "xl", "data-testid": "login-httpbasic", title: `Log in for ${internetAccountId}`, onClose: () => {
8
+ return (_jsx(SubmitDialog, { open: true, maxWidth: "xl", "data-testid": "login-httpbasic", title: `Log in for ${internetAccountId}`,
9
+ // an incomplete submit used to close as if cancelled, which the account
10
+ // reports as "User cancelled entry" — a failed login the user never made
11
+ submitDisabled: !username || !password, onCancel: () => {
9
12
  handleClose();
10
- }, children: _jsxs("form", { onSubmit: event => {
11
- if (username && password) {
12
- handleClose(btoa(`${username}:${password}`));
13
- }
14
- else {
15
- handleClose();
16
- }
17
- event.preventDefault();
18
- }, children: [_jsxs(DialogContent, { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx(TextField, { required: true, label: "Username", variant: "outlined", onChange: event => {
19
- setUsername(event.target.value);
20
- }, margin: "dense", slotProps: {
21
- htmlInput: { 'data-testid': 'login-httpbasic-username' },
22
- } }), _jsx(TextField, { required: true, label: "Password", type: "password", autoComplete: "current-password", variant: "outlined", onChange: event => {
23
- setPassword(event.target.value);
24
- }, margin: "dense", slotProps: {
25
- htmlInput: { 'data-testid': 'login-httpbasic-password' },
26
- } })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", color: "primary", type: "submit", children: "Submit" }), _jsx(Button, { variant: "contained", color: "secondary", type: "submit", onClick: () => {
27
- handleClose();
28
- }, children: "Cancel" })] })] }) }));
13
+ }, onSubmit: () => {
14
+ handleClose(btoa(`${username}:${password}`));
15
+ }, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx(TextField, { required: true, label: "Username", variant: "outlined", onChange: event => {
16
+ setUsername(event.target.value);
17
+ }, margin: "dense", slotProps: {
18
+ htmlInput: { 'data-testid': 'login-httpbasic-username' },
19
+ } }), _jsx(TextField, { required: true, label: "Password", type: "password", autoComplete: "current-password", variant: "outlined", onChange: event => {
20
+ setPassword(event.target.value);
21
+ }, margin: "dense", slotProps: {
22
+ htmlInput: { 'data-testid': 'login-httpbasic-password' },
23
+ } })] }) }));
29
24
  }
@@ -1,40 +1,63 @@
1
1
  import type { Instance } from '@jbrowse/mobx-state-tree';
2
+ /**
3
+ * #config HTTPBasicInternetAccount
4
+ *
5
+ * #example
6
+ * An entry in the config's `internetAccounts`. JBrowse prompts for the username
7
+ * and password the first time a file under one of `domains` is opened, and
8
+ * sends them as an `Authorization: Basic …` header from then on.
9
+ * ```js
10
+ * {
11
+ * type: 'HTTPBasicInternetAccount',
12
+ * internetAccountId: 'myLabServer',
13
+ * name: 'My lab server',
14
+ * description: 'Sequencing data behind the lab htaccess',
15
+ * domains: ['data.mylab.org'],
16
+ * }
17
+ * ```
18
+ */
2
19
  declare const HTTPBasicConfigSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
3
- tokenType: {
4
- description: string;
5
- type: string;
6
- defaultValue: string;
20
+ /**
21
+ * #slot
22
+ */
23
+ readonly tokenType: {
24
+ readonly description: "a custom name for a token to include in the header";
25
+ readonly type: "string";
26
+ readonly defaultValue: "Basic";
7
27
  };
8
- validateWithHEAD: {
9
- description: string;
10
- type: string;
11
- defaultValue: boolean;
28
+ /**
29
+ * #slot
30
+ */
31
+ readonly validateWithHEAD: {
32
+ readonly description: "validate the token with a HEAD request before using it";
33
+ readonly type: "boolean";
34
+ readonly defaultValue: true;
12
35
  };
13
36
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
14
- name: {
15
- description: string;
16
- type: string;
17
- defaultValue: string;
37
+ readonly name: {
38
+ readonly description: "descriptive name of the internet account";
39
+ readonly type: "string";
40
+ readonly defaultValue: "";
18
41
  };
19
- description: {
20
- description: string;
21
- type: string;
22
- defaultValue: string;
42
+ readonly description: {
43
+ readonly description: "a description of the internet account";
44
+ readonly type: "string";
45
+ readonly defaultValue: "";
23
46
  };
24
- authHeader: {
25
- description: string;
26
- type: string;
27
- defaultValue: string;
47
+ readonly authHeader: {
48
+ readonly description: "request header for credentials";
49
+ readonly type: "string";
50
+ readonly defaultValue: "Authorization";
28
51
  };
29
- tokenType: {
30
- description: string;
31
- type: string;
32
- defaultValue: string;
52
+ readonly tokenType: {
53
+ readonly description: "a custom name for a token to include in the header";
54
+ readonly type: "string";
55
+ readonly defaultValue: "";
33
56
  };
34
- domains: {
35
- description: string;
36
- type: string;
37
- defaultValue: never[];
57
+ readonly domains: {
58
+ readonly description: "array of valid domains the url can contain to use this account";
59
+ readonly type: "stringArray";
60
+ readonly defaultValue: readonly [];
38
61
  };
39
62
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>;
40
63
  export type HTTPBasicInternetAccountConfigModel = typeof HTTPBasicConfigSchema;
@@ -1,18 +1,43 @@
1
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
2
2
  import { BaseInternetAccountConfig } from '@jbrowse/core/pluggableElementTypes/models';
3
- function x() { }
3
+ /**
4
+ * #config HTTPBasicInternetAccount
5
+ *
6
+ * #example
7
+ * An entry in the config's `internetAccounts`. JBrowse prompts for the username
8
+ * and password the first time a file under one of `domains` is opened, and
9
+ * sends them as an `Authorization: Basic …` header from then on.
10
+ * ```js
11
+ * {
12
+ * type: 'HTTPBasicInternetAccount',
13
+ * internetAccountId: 'myLabServer',
14
+ * name: 'My lab server',
15
+ * description: 'Sequencing data behind the lab htaccess',
16
+ * domains: ['data.mylab.org'],
17
+ * }
18
+ * ```
19
+ */
4
20
  const HTTPBasicConfigSchema = ConfigurationSchema('HTTPBasicInternetAccount', {
21
+ /**
22
+ * #slot
23
+ */
5
24
  tokenType: {
6
25
  description: 'a custom name for a token to include in the header',
7
26
  type: 'string',
8
27
  defaultValue: 'Basic',
9
28
  },
29
+ /**
30
+ * #slot
31
+ */
10
32
  validateWithHEAD: {
11
33
  description: 'validate the token with a HEAD request before using it',
12
34
  type: 'boolean',
13
35
  defaultValue: true,
14
36
  },
15
37
  }, {
38
+ /**
39
+ * #baseConfiguration
40
+ */
16
41
  baseConfiguration: BaseInternetAccountConfig,
17
42
  explicitlyTyped: true,
18
43
  });
@@ -1,2 +1,2 @@
1
- export { default as configSchema } from "./configSchema.js";
2
- export { default as modelFactory } from "./model.js";
1
+ export { default as configSchema } from './configSchema.js';
2
+ export { default as modelFactory } from './model.js';
@@ -1,76 +1,45 @@
1
1
  import type { HTTPBasicInternetAccountConfigModel } from './configSchema.ts';
2
- import type { UriLocation } from '@jbrowse/core/util/types';
3
2
  import type { Instance } from '@jbrowse/mobx-state-tree';
4
- declare const stateModelFactory: (configSchema: HTTPBasicInternetAccountConfigModel) => import("@jbrowse/mobx-state-tree").IModelType<{
3
+ /**
4
+ * #stateModel HTTPBasicInternetAccount
5
+ * Internet account that authenticates requests with an HTTP Basic
6
+ * username/password the user enters through a dialog, optionally validated with
7
+ * a HEAD request. See [TokenEntryInternetAccount](../tokenentryinternetaccount)
8
+ * for the shared behavior.
9
+ */
10
+ declare const stateModelFactory: (configSchema: HTTPBasicInternetAccountConfigModel) => import("@jbrowse/mobx-state-tree").IModelType<Omit<{
5
11
  id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
6
12
  type: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
7
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
8
- name: {
9
- description: string;
10
- type: string;
11
- defaultValue: string;
13
+ configuration: import("@jbrowse/core/configuration/configurationSchema").IConfigurationReference<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
14
+ readonly name: {
15
+ readonly description: "descriptive name of the internet account";
16
+ readonly type: "string";
17
+ readonly defaultValue: "";
12
18
  };
13
- description: {
14
- description: string;
15
- type: string;
16
- defaultValue: string;
19
+ readonly description: {
20
+ readonly description: "a description of the internet account";
21
+ readonly type: "string";
22
+ readonly defaultValue: "";
17
23
  };
18
- authHeader: {
19
- description: string;
20
- type: string;
21
- defaultValue: string;
24
+ readonly authHeader: {
25
+ readonly description: "request header for credentials";
26
+ readonly type: "string";
27
+ readonly defaultValue: "Authorization";
22
28
  };
23
- tokenType: {
24
- description: string;
25
- type: string;
26
- defaultValue: string;
29
+ readonly tokenType: {
30
+ readonly description: "a custom name for a token to include in the header";
31
+ readonly type: "string";
32
+ readonly defaultValue: "";
27
33
  };
28
- domains: {
29
- description: string;
30
- type: string;
31
- defaultValue: never[];
34
+ readonly domains: {
35
+ readonly description: "array of valid domains the url can contain to use this account";
36
+ readonly type: "stringArray";
37
+ readonly defaultValue: readonly [];
32
38
  };
33
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>;
34
- } & {
35
- type: import("@jbrowse/mobx-state-tree").ISimpleType<"HTTPBasicInternetAccount">;
36
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
37
- tokenType: {
38
- description: string;
39
- type: string;
40
- defaultValue: string;
41
- };
42
- validateWithHEAD: {
43
- description: string;
44
- type: string;
45
- defaultValue: boolean;
46
- };
47
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
48
- name: {
49
- description: string;
50
- type: string;
51
- defaultValue: string;
52
- };
53
- description: {
54
- description: string;
55
- type: string;
56
- defaultValue: string;
57
- };
58
- authHeader: {
59
- description: string;
60
- type: string;
61
- defaultValue: string;
62
- };
63
- tokenType: {
64
- description: string;
65
- type: string;
66
- defaultValue: string;
67
- };
68
- domains: {
69
- description: string;
70
- type: string;
71
- defaultValue: never[];
72
- };
73
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>;
39
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>>;
40
+ }, "configuration" | "type"> & {
41
+ type: import("@jbrowse/mobx-state-tree").ILiteralType<"HTTPBasicInternetAccount">;
42
+ configuration: import("@jbrowse/core/configuration/configurationSchema").IConfigurationReference<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>;
74
43
  }, {
75
44
  readonly name: string;
76
45
  readonly description: string;
@@ -79,22 +48,21 @@ declare const stateModelFactory: (configSchema: HTTPBasicInternetAccountConfigMo
79
48
  readonly tokenType: string;
80
49
  readonly domains: string[];
81
50
  readonly toggleContents: React.ReactNode;
82
- readonly SelectorComponent: import("@jbrowse/core/util").AnyReactComponentType | undefined;
83
51
  readonly selectorLabel: string | undefined;
52
+ readonly showInFileSelector: boolean;
84
53
  } & {
85
- handlesLocation(location: UriLocation): boolean;
54
+ handlesLocation(location: import("@jbrowse/core/util").UriLocation): boolean;
86
55
  readonly tokenKey: string;
87
56
  } & {
88
57
  getTokenFromUser(_resolve: (token: string) => void, _reject: (error: Error) => void): void;
89
58
  storeToken(token: string): void;
90
- removeToken(): void;
91
- retrieveToken(): string | null;
92
- validateToken(token: string, _loc: UriLocation): Promise<string>;
59
+ retrieveToken(): string | undefined;
60
+ validateToken(token: string, _loc: import("@jbrowse/core/util").UriLocation): Promise<string>;
93
61
  } & {
94
- getToken(location?: UriLocation): Promise<string>;
62
+ removeToken(): void;
63
+ getToken(location?: import("@jbrowse/core/util").UriLocation): Promise<string>;
95
64
  } & {
96
65
  addAuthHeaderToInit(init?: RequestInit, token?: string): {
97
- headers: Headers;
98
66
  body?: BodyInit | null;
99
67
  cache?: RequestCache;
100
68
  credentials?: RequestCredentials;
@@ -108,23 +76,34 @@ declare const stateModelFactory: (configSchema: HTTPBasicInternetAccountConfigMo
108
76
  referrerPolicy?: ReferrerPolicy;
109
77
  signal?: AbortSignal | null;
110
78
  window?: null;
79
+ headers: Headers;
111
80
  };
112
- getPreAuthorizationInformation(location: UriLocation): Promise<{
81
+ fetchWithToken(loc: import("@jbrowse/core/util").UriLocation | undefined, run: (token: string) => Promise<Response>): Promise<Response>;
82
+ getPreAuthorizationInformation(location: import("@jbrowse/core/util").UriLocation): Promise<{
113
83
  internetAccountType: string;
114
84
  authInfo: {
115
85
  token: string;
116
- configuration: any;
86
+ configuration: import("@jbrowse/mobx-state-tree").ModelSnapshotType<Record<string, any>>;
117
87
  };
118
88
  }>;
119
89
  } & {
120
- getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
90
+ getFetcher(loc?: import("@jbrowse/core/util").UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
121
91
  } & {
122
- openLocation(location: UriLocation): import("@jbrowse/core/util/io").RemoteFileWithRangeCache;
92
+ openLocation(location: import("@jbrowse/core/util").UriLocation): import("@gmod/range-cache-filehandle").RemoteFileWithRangeCache;
123
93
  } & {
124
94
  readonly validateWithHEAD: boolean;
125
95
  } & {
126
96
  getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): void;
127
- validateToken(token: string, location: UriLocation): Promise<string>;
97
+ validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
98
+ } & {
99
+ /**
100
+ * #getter
101
+ * There is nothing to pick: an HTTP Basic account matches by domain and
102
+ * prompts on its own. RpcManager also mints one of these per origin on a
103
+ * 401, so offering them would fill the picker with a toggle per server the
104
+ * session happened to touch.
105
+ */
106
+ readonly showInFileSelector: boolean;
128
107
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
129
108
  export default stateModelFactory;
130
109
  export type HTTPBasicStateModel = ReturnType<typeof stateModelFactory>;
@@ -1,52 +1,22 @@
1
- import { ConfigurationReference, getConf } from '@jbrowse/core/configuration';
2
- import { InternetAccount } from '@jbrowse/core/pluggableElementTypes/models';
3
- import { getRoot, types } from '@jbrowse/mobx-state-tree';
4
- import { HTTPBasicLoginForm } from "./HTTPBasicLoginForm.js";
5
- import { getResponseError } from "../util.js";
6
- const stateModelFactory = (configSchema) => {
7
- return InternetAccount.named('HTTPBasicInternetAccount')
8
- .props({
9
- type: types.literal('HTTPBasicInternetAccount'),
10
- configuration: ConfigurationReference(configSchema),
11
- })
12
- .views(self => ({
13
- get validateWithHEAD() {
14
- return getConf(self, 'validateWithHEAD');
15
- },
16
- }))
17
- .actions(self => ({
18
- getTokenFromUser(resolve, reject) {
19
- const { session } = getRoot(self);
20
- session.queueDialog((doneCallback) => [
21
- HTTPBasicLoginForm,
22
- {
23
- internetAccountId: self.internetAccountId,
24
- handleClose: (token) => {
25
- if (token) {
26
- resolve(token);
27
- }
28
- else {
29
- reject(new Error('User cancelled entry'));
30
- }
31
- doneCallback();
32
- },
33
- },
34
- ]);
35
- },
36
- async validateToken(token, location) {
37
- if (!self.validateWithHEAD) {
38
- return token;
39
- }
40
- const newInit = self.addAuthHeaderToInit({ method: 'HEAD' }, token);
41
- const response = await fetch(location.uri, newInit);
42
- if (!response.ok) {
43
- throw new Error(await getResponseError({
44
- response,
45
- reason: 'Error validating token',
46
- }));
47
- }
48
- return token;
49
- },
50
- }));
51
- };
1
+ import { HTTPBasicLoginForm } from '../lazyLoginForms.js';
2
+ import { tokenEntryModelFactory } from '../tokenEntryModelFactory.js';
3
+ /**
4
+ * #stateModel HTTPBasicInternetAccount
5
+ * Internet account that authenticates requests with an HTTP Basic
6
+ * username/password the user enters through a dialog, optionally validated with
7
+ * a HEAD request. See [TokenEntryInternetAccount](../tokenentryinternetaccount)
8
+ * for the shared behavior.
9
+ */
10
+ const stateModelFactory = (configSchema) => tokenEntryModelFactory('HTTPBasicInternetAccount', 'HTTPBasicInternetAccount', configSchema, HTTPBasicLoginForm).views(() => ({
11
+ /**
12
+ * #getter
13
+ * There is nothing to pick: an HTTP Basic account matches by domain and
14
+ * prompts on its own. RpcManager also mints one of these per origin on a
15
+ * 401, so offering them would fill the picker with a toggle per server the
16
+ * session happened to touch.
17
+ */
18
+ get showInFileSelector() {
19
+ return false;
20
+ },
21
+ }));
52
22
  export default stateModelFactory;
@@ -0,0 +1,4 @@
1
+ export declare function OAuthLoginPrompt({ internetAccountId, handleClose, }: {
2
+ internetAccountId: string;
3
+ handleClose: (proceed: boolean) => void;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Dialog } from '@jbrowse/core/ui';
3
+ import { Button, DialogActions, DialogContent, Typography } from '@mui/material';
4
+ export function OAuthLoginPrompt({ internetAccountId, handleClose, }) {
5
+ return (_jsxs(Dialog, { open: true, maxWidth: "xs", "data-testid": "oauth-login-prompt", title: `Log in to ${internetAccountId}`, onClose: () => {
6
+ handleClose(false);
7
+ }, children: [_jsx(DialogContent, { children: _jsxs(Typography, { children: ["This session has a track that needs you to log in to", ' ', internetAccountId, ". Browsers only allow the login window to open from a click, so it could not be opened on your behalf."] }) }), _jsxs(DialogActions, { children: [_jsx(Button, { color: "secondary", variant: "contained", onClick: () => {
8
+ handleClose(false);
9
+ }, children: "Cancel" }), _jsx(Button, { color: "primary", variant: "contained", onClick: () => {
10
+ handleClose(true);
11
+ }, children: "Log in" })] })] }));
12
+ }
@@ -1,70 +1,97 @@
1
1
  import type { Instance } from '@jbrowse/mobx-state-tree';
2
+ /**
3
+ * #config OAuthInternetAccount
4
+ */
2
5
  declare const OAuthConfigSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
3
- tokenType: {
4
- description: string;
5
- type: string;
6
- defaultValue: string;
6
+ /**
7
+ * #slot
8
+ */
9
+ readonly tokenType: {
10
+ readonly description: "a custom name for a token to include in the header";
11
+ readonly type: "string";
12
+ readonly defaultValue: "Bearer";
7
13
  };
8
- authEndpoint: {
9
- description: string;
10
- type: string;
11
- defaultValue: string;
14
+ /**
15
+ * #slot
16
+ */
17
+ readonly authEndpoint: {
18
+ readonly description: "the authorization code endpoint of the internet account";
19
+ readonly type: "string";
20
+ readonly defaultValue: "";
12
21
  };
13
- tokenEndpoint: {
14
- description: string;
15
- type: string;
16
- defaultValue: string;
22
+ /**
23
+ * #slot
24
+ */
25
+ readonly tokenEndpoint: {
26
+ readonly description: "the token endpoint of the internet account";
27
+ readonly type: "string";
28
+ readonly defaultValue: "";
17
29
  };
18
- needsPKCE: {
19
- description: string;
20
- type: string;
21
- defaultValue: boolean;
30
+ /**
31
+ * #slot
32
+ */
33
+ readonly needsPKCE: {
34
+ readonly description: "boolean to indicate if the endpoint needs a PKCE code";
35
+ readonly type: "boolean";
36
+ readonly defaultValue: false;
22
37
  };
23
- clientId: {
24
- description: string;
25
- type: string;
26
- defaultValue: string;
38
+ /**
39
+ * #slot
40
+ */
41
+ readonly clientId: {
42
+ readonly description: "id for the OAuth application";
43
+ readonly type: "string";
44
+ readonly defaultValue: "";
27
45
  };
28
- scopes: {
29
- description: string;
30
- type: string;
31
- defaultValue: string;
46
+ /**
47
+ * #slot
48
+ */
49
+ readonly scopes: {
50
+ readonly description: "optional scopes for the authorization call";
51
+ readonly type: "string";
52
+ readonly defaultValue: "";
32
53
  };
33
- state: {
34
- description: string;
35
- type: string;
36
- defaultValue: string;
54
+ /**
55
+ * #slot
56
+ */
57
+ readonly state: {
58
+ readonly description: "optional state for the authorization call";
59
+ readonly type: "string";
60
+ readonly defaultValue: "";
37
61
  };
38
- responseType: {
39
- description: string;
40
- type: string;
41
- defaultValue: string;
62
+ /**
63
+ * #slot
64
+ */
65
+ readonly responseType: {
66
+ readonly description: "the type of response from the authorization endpoint. can be 'token' or 'code'";
67
+ readonly type: "string";
68
+ readonly defaultValue: "code";
42
69
  };
43
70
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
44
- name: {
45
- description: string;
46
- type: string;
47
- defaultValue: string;
71
+ readonly name: {
72
+ readonly description: "descriptive name of the internet account";
73
+ readonly type: "string";
74
+ readonly defaultValue: "";
48
75
  };
49
- description: {
50
- description: string;
51
- type: string;
52
- defaultValue: string;
76
+ readonly description: {
77
+ readonly description: "a description of the internet account";
78
+ readonly type: "string";
79
+ readonly defaultValue: "";
53
80
  };
54
- authHeader: {
55
- description: string;
56
- type: string;
57
- defaultValue: string;
81
+ readonly authHeader: {
82
+ readonly description: "request header for credentials";
83
+ readonly type: "string";
84
+ readonly defaultValue: "Authorization";
58
85
  };
59
- tokenType: {
60
- description: string;
61
- type: string;
62
- defaultValue: string;
86
+ readonly tokenType: {
87
+ readonly description: "a custom name for a token to include in the header";
88
+ readonly type: "string";
89
+ readonly defaultValue: "";
63
90
  };
64
- domains: {
65
- description: string;
66
- type: string;
67
- defaultValue: never[];
91
+ readonly domains: {
92
+ readonly description: "array of valid domains the url can contain to use this account";
93
+ readonly type: "stringArray";
94
+ readonly defaultValue: readonly [];
68
95
  };
69
96
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>;
70
97
  export type OAuthInternetAccountConfigModel = typeof OAuthConfigSchema;