@jbrowse/plugin-authentication 2.16.1 → 2.18.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.
Files changed (60) hide show
  1. package/dist/DropboxOAuthModel/DropboxIcon.d.ts +1 -1
  2. package/dist/DropboxOAuthModel/configSchema.d.ts +1 -13
  3. package/dist/DropboxOAuthModel/configSchema.js +1 -19
  4. package/dist/DropboxOAuthModel/model.d.ts +3 -25
  5. package/dist/DropboxOAuthModel/model.js +2 -24
  6. package/dist/DropboxOAuthModel/util.js +0 -5
  7. package/dist/ExternalTokenModel/ExternalTokenEntryForm.js +8 -4
  8. package/dist/ExternalTokenModel/configSchema.d.ts +1 -4
  9. package/dist/ExternalTokenModel/configSchema.js +1 -10
  10. package/dist/ExternalTokenModel/model.d.ts +3 -3
  11. package/dist/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +1 -1
  12. package/dist/GoogleDriveOAuthModel/GoogleDriveIcon.d.ts +1 -1
  13. package/dist/GoogleDriveOAuthModel/configSchema.d.ts +1 -13
  14. package/dist/GoogleDriveOAuthModel/configSchema.js +1 -19
  15. package/dist/GoogleDriveOAuthModel/model.d.ts +3 -28
  16. package/dist/GoogleDriveOAuthModel/model.js +2 -27
  17. package/dist/GoogleDriveOAuthModel/util.js +0 -1
  18. package/dist/HTTPBasicModel/HTTPBasicLoginForm.js +12 -6
  19. package/dist/HTTPBasicModel/configSchema.d.ts +1 -7
  20. package/dist/HTTPBasicModel/configSchema.js +1 -13
  21. package/dist/HTTPBasicModel/model.d.ts +3 -21
  22. package/dist/HTTPBasicModel/model.js +0 -18
  23. package/dist/OAuthModel/configSchema.d.ts +1 -25
  24. package/dist/OAuthModel/configSchema.js +1 -31
  25. package/dist/OAuthModel/model.d.ts +3 -89
  26. package/dist/OAuthModel/model.js +1 -96
  27. package/dist/OAuthModel/util.js +0 -2
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +3 -3
  30. package/esm/DropboxOAuthModel/DropboxIcon.d.ts +1 -1
  31. package/esm/DropboxOAuthModel/configSchema.d.ts +1 -13
  32. package/esm/DropboxOAuthModel/configSchema.js +1 -19
  33. package/esm/DropboxOAuthModel/model.d.ts +3 -25
  34. package/esm/DropboxOAuthModel/model.js +2 -24
  35. package/esm/DropboxOAuthModel/util.js +0 -5
  36. package/esm/ExternalTokenModel/ExternalTokenEntryForm.js +8 -4
  37. package/esm/ExternalTokenModel/configSchema.d.ts +1 -4
  38. package/esm/ExternalTokenModel/configSchema.js +1 -10
  39. package/esm/ExternalTokenModel/model.d.ts +3 -3
  40. package/esm/ExternalTokenModel/model.js +1 -1
  41. package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +1 -1
  42. package/esm/GoogleDriveOAuthModel/GoogleDriveIcon.d.ts +1 -1
  43. package/esm/GoogleDriveOAuthModel/configSchema.d.ts +1 -13
  44. package/esm/GoogleDriveOAuthModel/configSchema.js +1 -19
  45. package/esm/GoogleDriveOAuthModel/model.d.ts +3 -28
  46. package/esm/GoogleDriveOAuthModel/model.js +2 -27
  47. package/esm/GoogleDriveOAuthModel/util.js +0 -1
  48. package/esm/HTTPBasicModel/HTTPBasicLoginForm.js +12 -6
  49. package/esm/HTTPBasicModel/configSchema.d.ts +1 -7
  50. package/esm/HTTPBasicModel/configSchema.js +1 -13
  51. package/esm/HTTPBasicModel/model.d.ts +3 -21
  52. package/esm/HTTPBasicModel/model.js +1 -19
  53. package/esm/OAuthModel/configSchema.d.ts +1 -25
  54. package/esm/OAuthModel/configSchema.js +1 -31
  55. package/esm/OAuthModel/model.d.ts +3 -89
  56. package/esm/OAuthModel/model.js +1 -96
  57. package/esm/OAuthModel/util.js +0 -2
  58. package/esm/index.d.ts +1 -1
  59. package/esm/index.js +3 -3
  60. package/package.json +2 -2
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- import { SvgIconProps } from '@mui/material';
2
+ import type { SvgIconProps } from '@mui/material';
3
3
  export default function DropboxIcon(props: SvgIconProps): React.JSX.Element;
@@ -1,32 +1,20 @@
1
- import { Instance } from 'mobx-state-tree';
1
+ import type { Instance } from 'mobx-state-tree';
2
2
  declare const DropboxOAuthConfigSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
3
- /**
4
- * #slot
5
- */
6
3
  authEndpoint: {
7
4
  description: string;
8
5
  type: string;
9
6
  defaultValue: string;
10
7
  };
11
- /**
12
- * #slot
13
- */
14
8
  tokenEndpoint: {
15
9
  description: string;
16
10
  type: string;
17
11
  defaultValue: string;
18
12
  };
19
- /**
20
- * #slot
21
- */
22
13
  needsPKCE: {
23
14
  description: string;
24
15
  type: string;
25
16
  defaultValue: boolean;
26
17
  };
27
- /**
28
- * #slot
29
- */
30
18
  domains: {
31
19
  description: string;
32
20
  type: string;
@@ -5,38 +5,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const configuration_1 = require("@jbrowse/core/configuration");
7
7
  const configSchema_1 = __importDefault(require("../OAuthModel/configSchema"));
8
- /**
9
- * #config DropboxOAuthInternetAccount
10
- */
11
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
8
+ function x() { }
12
9
  const DropboxOAuthConfigSchema = (0, configuration_1.ConfigurationSchema)('DropboxOAuthInternetAccount', {
13
- /**
14
- * #slot
15
- */
16
10
  authEndpoint: {
17
11
  description: 'the authorization code endpoint of the internet account',
18
12
  type: 'string',
19
13
  defaultValue: 'https://www.dropbox.com/oauth2/authorize',
20
14
  },
21
- /**
22
- * #slot
23
- */
24
15
  tokenEndpoint: {
25
16
  description: 'the token endpoint of the internet account',
26
17
  type: 'string',
27
18
  defaultValue: 'https://api.dropbox.com/oauth2/token',
28
19
  },
29
- /**
30
- * #slot
31
- */
32
20
  needsPKCE: {
33
21
  description: 'boolean to indicate if the endpoint needs a PKCE code',
34
22
  type: 'boolean',
35
23
  defaultValue: true,
36
24
  },
37
- /**
38
- * #slot
39
- */
40
25
  domains: {
41
26
  description: 'array of valid domains the url can contain to use this account',
42
27
  type: 'stringArray',
@@ -51,9 +36,6 @@ const DropboxOAuthConfigSchema = (0, configuration_1.ConfigurationSchema)('Dropb
51
36
  ],
52
37
  },
53
38
  }, {
54
- /**
55
- * #baseConfiguration
56
- */
57
39
  baseConfiguration: configSchema_1.default,
58
40
  explicitlyTyped: true,
59
41
  });
@@ -1,10 +1,7 @@
1
1
  import React from 'react';
2
- import { UriLocation } from '@jbrowse/core/util/types';
3
- import { Instance } from 'mobx-state-tree';
4
- import { DropboxOAuthInternetAccountConfigModel } from './configSchema';
5
- /**
6
- * #stateModel DropboxOAuthInternetAccount
7
- */
2
+ import type { DropboxOAuthInternetAccountConfigModel } from './configSchema';
3
+ import type { UriLocation } from '@jbrowse/core/util/types';
4
+ import type { Instance } from 'mobx-state-tree';
8
5
  declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfigModel) => import("mobx-state-tree").IModelType<{
9
6
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
10
7
  type: import("mobx-state-tree").ISimpleType<string>;
@@ -106,13 +103,7 @@ declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfi
106
103
  };
107
104
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>;
108
105
  } & {
109
- /**
110
- * #property
111
- */
112
106
  type: import("mobx-state-tree").ISimpleType<"DropboxOAuthInternetAccount">;
113
- /**
114
- * #property
115
- */
116
107
  configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
117
108
  authEndpoint: {
118
109
  description: string;
@@ -278,23 +269,10 @@ declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfi
278
269
  } & {
279
270
  getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
280
271
  } & {
281
- /**
282
- * #getter
283
- * The FileSelector icon for Dropbox
284
- */
285
272
  readonly toggleContents: React.JSX.Element;
286
- /**
287
- * #getter
288
- */
289
273
  readonly selectorLabel: string;
290
274
  } & {
291
- /**
292
- * #method
293
- */
294
275
  getFetcher(location?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
295
- /**
296
- * #action
297
- */
298
276
  validateToken(token: string, location: UriLocation): Promise<string>;
299
277
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
300
278
  export default stateModelFactory;
@@ -6,45 +6,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const react_1 = __importDefault(require("react"));
7
7
  const configuration_1 = require("@jbrowse/core/configuration");
8
8
  const mobx_state_tree_1 = require("mobx-state-tree");
9
- const model_1 = __importDefault(require("../OAuthModel/model"));
10
9
  const OAuthModel_1 = require("../OAuthModel");
11
- const util_1 = require("./util");
12
10
  const DropboxIcon_1 = __importDefault(require("./DropboxIcon"));
13
- /**
14
- * #stateModel DropboxOAuthInternetAccount
15
- */
11
+ const util_1 = require("./util");
12
+ const model_1 = __importDefault(require("../OAuthModel/model"));
16
13
  const stateModelFactory = (configSchema) => {
17
14
  return (0, model_1.default)(OAuthModel_1.configSchema)
18
15
  .named('DropboxOAuthInternetAccount')
19
16
  .props({
20
- /**
21
- * #property
22
- */
23
17
  type: mobx_state_tree_1.types.literal('DropboxOAuthInternetAccount'),
24
- /**
25
- * #property
26
- */
27
18
  configuration: (0, configuration_1.ConfigurationReference)(configSchema),
28
19
  })
29
20
  .views(() => ({
30
- /**
31
- * #getter
32
- * The FileSelector icon for Dropbox
33
- */
34
21
  get toggleContents() {
35
22
  return react_1.default.createElement(DropboxIcon_1.default, null);
36
23
  },
37
- /**
38
- * #getter
39
- */
40
24
  get selectorLabel() {
41
25
  return 'Enter Dropbox share link';
42
26
  },
43
27
  }))
44
28
  .actions(self => ({
45
- /**
46
- * #method
47
- */
48
29
  getFetcher(location) {
49
30
  return async (input, init) => {
50
31
  const authToken = await self.getToken(location);
@@ -57,9 +38,6 @@ const stateModelFactory = (configSchema) => {
57
38
  return response;
58
39
  };
59
40
  },
60
- /**
61
- * #action
62
- */
63
41
  async validateToken(token, location) {
64
42
  const response = await fetch('https://api.dropboxapi.com/2/sharing/get_shared_link_metadata', {
65
43
  method: 'POST',
@@ -2,10 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDescriptiveErrorMessage = getDescriptiveErrorMessage;
4
4
  const util_1 = require("../util");
5
- /**
6
- * Error messages from
7
- * https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file
8
- * */
9
5
  const dropboxErrorMessages = {
10
6
  shared_link_not_found: "The shared link wasn't found.",
11
7
  shared_link_access_denied: 'The caller is not allowed to access this shared link.',
@@ -20,7 +16,6 @@ async function getDescriptiveErrorMessage(response, reason) {
20
16
  errorMessage = dropboxErrorMessages[tag] || tag;
21
17
  }
22
18
  catch (error) {
23
- /* do nothing */
24
19
  }
25
20
  return (0, util_1.getResponseError)({ response, reason, statusText: errorMessage });
26
21
  }
@@ -25,15 +25,19 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ExternalTokenEntryForm = void 0;
27
27
  const react_1 = __importStar(require("react"));
28
- const material_1 = require("@mui/material");
29
28
  const ui_1 = require("@jbrowse/core/ui");
29
+ const material_1 = require("@mui/material");
30
30
  const ExternalTokenEntryForm = ({ internetAccountId, handleClose, }) => {
31
31
  const [token, setToken] = (0, react_1.useState)('');
32
- return (react_1.default.createElement(ui_1.Dialog, { open: true, maxWidth: "xl", "data-testid": "externalToken-form", title: `Enter token for ${internetAccountId}` },
32
+ return (react_1.default.createElement(ui_1.Dialog, { open: true, maxWidth: "xl", "data-testid": "externalToken-form", onClose: () => {
33
+ handleClose();
34
+ }, title: `Enter token for ${internetAccountId}` },
33
35
  react_1.default.createElement(material_1.DialogContent, { style: { display: 'flex', flexDirection: 'column' } },
34
- react_1.default.createElement(material_1.TextField, { required: true, label: "Enter Token", variant: "outlined", inputProps: { 'data-testid': 'entry-externalToken' }, onChange: event => {
36
+ react_1.default.createElement(material_1.TextField, { required: true, label: "Enter Token", variant: "outlined", onChange: event => {
35
37
  setToken(event.target.value);
36
- }, margin: "dense" })),
38
+ }, margin: "dense", slotProps: {
39
+ htmlInput: { 'data-testid': 'entry-externalToken' },
40
+ } })),
37
41
  react_1.default.createElement(material_1.DialogActions, null,
38
42
  react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", type: "submit", disabled: !token, onClick: () => {
39
43
  if (token) {
@@ -1,8 +1,5 @@
1
- import { Instance } from 'mobx-state-tree';
1
+ import type { Instance } from 'mobx-state-tree';
2
2
  declare const ExternalTokenConfigSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
3
- /**
4
- * #slot
5
- */
6
3
  validateWithHEAD: {
7
4
  description: string;
8
5
  type: string;
@@ -2,23 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const configuration_1 = require("@jbrowse/core/configuration");
4
4
  const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
5
- /**
6
- * #config ExternalTokenInternetAccount
7
- */
8
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ function x() { }
9
6
  const ExternalTokenConfigSchema = (0, configuration_1.ConfigurationSchema)('ExternalTokenInternetAccount', {
10
- /**
11
- * #slot
12
- */
13
7
  validateWithHEAD: {
14
8
  description: 'validate the token with a HEAD request before using it',
15
9
  type: 'boolean',
16
10
  defaultValue: true,
17
11
  },
18
12
  }, {
19
- /**
20
- * #baseConfiguration
21
- */
22
13
  baseConfiguration: models_1.BaseInternetAccountConfig,
23
14
  explicitlyTyped: true,
24
15
  });
@@ -1,6 +1,6 @@
1
- import { UriLocation } from '@jbrowse/core/util/types';
2
- import { ExternalTokenInternetAccountConfigModel } from './configSchema';
3
- import { Instance } from 'mobx-state-tree';
1
+ import type { ExternalTokenInternetAccountConfigModel } from './configSchema';
2
+ import type { UriLocation } from '@jbrowse/core/util/types';
3
+ import type { Instance } from 'mobx-state-tree';
4
4
  declare const stateModelFactory: (configSchema: ExternalTokenInternetAccountConfigModel) => import("mobx-state-tree").IModelType<{
5
5
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
6
6
  type: import("mobx-state-tree").ISimpleType<string>;
@@ -1,5 +1,5 @@
1
1
  import { RemoteFileWithRangeCache } from '@jbrowse/core/util/io';
2
- import { FilehandleOptions, Stats, PolyfilledResponse } from 'generic-filehandle';
2
+ import type { FilehandleOptions, PolyfilledResponse, Stats } from 'generic-filehandle';
3
3
  export interface RequestInitWithMetadata extends RequestInit {
4
4
  metadataOnly?: boolean;
5
5
  }
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- import { SvgIconProps } from '@mui/material';
2
+ import type { SvgIconProps } from '@mui/material';
3
3
  export default function GoogleDriveIcon(props: SvgIconProps): React.JSX.Element;
@@ -1,32 +1,20 @@
1
- import { Instance } from 'mobx-state-tree';
1
+ import type { Instance } from 'mobx-state-tree';
2
2
  declare const GoogleDriveOAuthConfigSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
3
- /**
4
- * #slot
5
- */
6
3
  authEndpoint: {
7
4
  description: string;
8
5
  type: string;
9
6
  defaultValue: string;
10
7
  };
11
- /**
12
- * #slot
13
- */
14
8
  scopes: {
15
9
  description: string;
16
10
  type: string;
17
11
  defaultValue: string;
18
12
  };
19
- /**
20
- * #slot
21
- */
22
13
  domains: {
23
14
  description: string;
24
15
  type: string;
25
16
  defaultValue: string[];
26
17
  };
27
- /**
28
- * #slot
29
- */
30
18
  responseType: {
31
19
  description: string;
32
20
  type: string;
@@ -5,47 +5,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const configuration_1 = require("@jbrowse/core/configuration");
7
7
  const configSchema_1 = __importDefault(require("../OAuthModel/configSchema"));
8
- /**
9
- * #config GoogleDriveOAuthInternetAccount
10
- */
11
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
8
+ function x() { }
12
9
  const GoogleDriveOAuthConfigSchema = (0, configuration_1.ConfigurationSchema)('GoogleDriveOAuthInternetAccount', {
13
- /**
14
- * #slot
15
- */
16
10
  authEndpoint: {
17
11
  description: 'the authorization code endpoint of the internet account',
18
12
  type: 'string',
19
13
  defaultValue: 'https://accounts.google.com/o/oauth2/v2/auth',
20
14
  },
21
- /**
22
- * #slot
23
- */
24
15
  scopes: {
25
16
  description: 'optional scopes for the authorization call',
26
17
  type: 'string',
27
18
  defaultValue: 'https://www.googleapis.com/auth/drive.readonly',
28
19
  },
29
- /**
30
- * #slot
31
- */
32
20
  domains: {
33
21
  description: 'array of valid domains the url can contain to use this account',
34
22
  type: 'stringArray',
35
23
  defaultValue: ['drive.google.com"'],
36
24
  },
37
- /**
38
- * #slot
39
- */
40
25
  responseType: {
41
26
  description: 'the type of response from the authorization endpoint',
42
27
  type: 'string',
43
28
  defaultValue: 'token',
44
29
  },
45
30
  }, {
46
- /**
47
- * #baseConfiguration
48
- */
49
31
  baseConfiguration: configSchema_1.default,
50
32
  explicitlyTyped: true,
51
33
  });
@@ -1,14 +1,11 @@
1
1
  import React from 'react';
2
- import { Instance } from 'mobx-state-tree';
3
- import { UriLocation } from '@jbrowse/core/util/types';
4
- import { GoogleDriveOAuthInternetAccountConfigModel } from './configSchema';
5
2
  import { GoogleDriveFile } from './GoogleDriveFilehandle';
3
+ import type { GoogleDriveOAuthInternetAccountConfigModel } from './configSchema';
4
+ import type { UriLocation } from '@jbrowse/core/util/types';
5
+ import type { Instance } from 'mobx-state-tree';
6
6
  export interface RequestInitWithMetadata extends RequestInit {
7
7
  metadataOnly?: boolean;
8
8
  }
9
- /**
10
- * #stateModel GoogleDriveOAuthInternetAccount
11
- */
12
9
  export default function stateModelFactory(configSchema: GoogleDriveOAuthInternetAccountConfigModel): import("mobx-state-tree").IModelType<{
13
10
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
14
11
  type: import("mobx-state-tree").ISimpleType<string>;
@@ -110,13 +107,7 @@ export default function stateModelFactory(configSchema: GoogleDriveOAuthInternet
110
107
  };
111
108
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>;
112
109
  } & {
113
- /**
114
- * #property
115
- */
116
110
  type: import("mobx-state-tree").ISimpleType<"GoogleDriveOAuthInternetAccount">;
117
- /**
118
- * #property
119
- */
120
111
  configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
121
112
  authEndpoint: {
122
113
  description: string;
@@ -282,27 +273,11 @@ export default function stateModelFactory(configSchema: GoogleDriveOAuthInternet
282
273
  } & {
283
274
  getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
284
275
  } & {
285
- /**
286
- * #getter
287
- * The FileSelector icon for Google drive
288
- */
289
276
  readonly toggleContents: React.JSX.Element;
290
- /**
291
- * #getter
292
- */
293
277
  readonly selectorLabel: string;
294
278
  } & {
295
- /**
296
- * #method
297
- */
298
279
  getFetcher(location?: UriLocation): (input: RequestInfo, init?: RequestInitWithMetadata) => Promise<Response>;
299
- /**
300
- * #method
301
- */
302
280
  openLocation(location: UriLocation): GoogleDriveFile;
303
- /**
304
- * #action
305
- */
306
281
  validateToken(token: string, location: UriLocation): Promise<string>;
307
282
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
308
283
  export type GoogleDriveOAuthStateModel = ReturnType<typeof stateModelFactory>;
@@ -7,50 +7,31 @@ exports.default = stateModelFactory;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const configuration_1 = require("@jbrowse/core/configuration");
9
9
  const mobx_state_tree_1 = require("mobx-state-tree");
10
- const model_1 = __importDefault(require("../OAuthModel/model"));
11
10
  const OAuthModel_1 = require("../OAuthModel");
12
- const util_1 = require("./util");
13
11
  const GoogleDriveFilehandle_1 = require("./GoogleDriveFilehandle");
14
12
  const GoogleDriveIcon_1 = __importDefault(require("./GoogleDriveIcon"));
13
+ const util_1 = require("./util");
14
+ const model_1 = __importDefault(require("../OAuthModel/model"));
15
15
  function getUri(str) {
16
16
  const urlId = /[-\w]{25,}/.exec(str);
17
17
  return `https://www.googleapis.com/drive/v3/files/${urlId}`;
18
18
  }
19
- /**
20
- * #stateModel GoogleDriveOAuthInternetAccount
21
- */
22
19
  function stateModelFactory(configSchema) {
23
20
  return (0, model_1.default)(OAuthModel_1.configSchema)
24
21
  .named('GoogleDriveOAuthInternetAccount')
25
22
  .props({
26
- /**
27
- * #property
28
- */
29
23
  type: mobx_state_tree_1.types.literal('GoogleDriveOAuthInternetAccount'),
30
- /**
31
- * #property
32
- */
33
24
  configuration: (0, configuration_1.ConfigurationReference)(configSchema),
34
25
  })
35
26
  .views(() => ({
36
- /**
37
- * #getter
38
- * The FileSelector icon for Google drive
39
- */
40
27
  get toggleContents() {
41
28
  return react_1.default.createElement(GoogleDriveIcon_1.default, null);
42
29
  },
43
- /**
44
- * #getter
45
- */
46
30
  get selectorLabel() {
47
31
  return 'Enter Google Drive share link';
48
32
  },
49
33
  }))
50
34
  .actions(self => ({
51
- /**
52
- * #method
53
- */
54
35
  getFetcher(location) {
55
36
  return async (input, init) => {
56
37
  const driveUrl = new URL(getUri(String(input)));
@@ -70,17 +51,11 @@ function stateModelFactory(configSchema) {
70
51
  return response;
71
52
  };
72
53
  },
73
- /**
74
- * #method
75
- */
76
54
  openLocation(location) {
77
55
  return new GoogleDriveFilehandle_1.GoogleDriveFile(location.uri, {
78
56
  fetch: this.getFetcher(location),
79
57
  });
80
58
  },
81
- /**
82
- * #action
83
- */
84
59
  async validateToken(token, location) {
85
60
  const response = await fetch(getUri(location.uri), {
86
61
  headers: {
@@ -9,7 +9,6 @@ async function getDescriptiveErrorMessage(response, reason) {
9
9
  errorMessage = err.error.message;
10
10
  }
11
11
  catch (error) {
12
- /* do nothing */
13
12
  }
14
13
  return (0, util_1.getResponseError)({ response, reason, statusText: errorMessage });
15
14
  }
@@ -25,12 +25,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.HTTPBasicLoginForm = HTTPBasicLoginForm;
27
27
  const react_1 = __importStar(require("react"));
28
- const material_1 = require("@mui/material");
29
28
  const ui_1 = require("@jbrowse/core/ui");
29
+ const material_1 = require("@mui/material");
30
30
  function HTTPBasicLoginForm({ internetAccountId, handleClose, }) {
31
31
  const [username, setUsername] = (0, react_1.useState)('');
32
32
  const [password, setPassword] = (0, react_1.useState)('');
33
- return (react_1.default.createElement(ui_1.Dialog, { open: true, maxWidth: "xl", "data-testid": "login-httpbasic", title: `Log in for ${internetAccountId}` },
33
+ return (react_1.default.createElement(ui_1.Dialog, { open: true, maxWidth: "xl", "data-testid": "login-httpbasic", title: `Log in for ${internetAccountId}`, onClose: () => {
34
+ handleClose();
35
+ } },
34
36
  react_1.default.createElement("form", { onSubmit: event => {
35
37
  if (username && password) {
36
38
  handleClose(btoa(`${username}:${password}`));
@@ -41,12 +43,16 @@ function HTTPBasicLoginForm({ internetAccountId, handleClose, }) {
41
43
  event.preventDefault();
42
44
  } },
43
45
  react_1.default.createElement(material_1.DialogContent, { style: { display: 'flex', flexDirection: 'column' } },
44
- react_1.default.createElement(material_1.TextField, { required: true, label: "Username", variant: "outlined", inputProps: { 'data-testid': 'login-httpbasic-username' }, onChange: event => {
46
+ react_1.default.createElement(material_1.TextField, { required: true, label: "Username", variant: "outlined", onChange: event => {
45
47
  setUsername(event.target.value);
46
- }, margin: "dense" }),
47
- react_1.default.createElement(material_1.TextField, { required: true, label: "Password", type: "password", autoComplete: "current-password", variant: "outlined", inputProps: { 'data-testid': 'login-httpbasic-password' }, onChange: event => {
48
+ }, margin: "dense", slotProps: {
49
+ htmlInput: { 'data-testid': 'login-httpbasic-username' },
50
+ } }),
51
+ react_1.default.createElement(material_1.TextField, { required: true, label: "Password", type: "password", autoComplete: "current-password", variant: "outlined", onChange: event => {
48
52
  setPassword(event.target.value);
49
- }, margin: "dense" })),
53
+ }, margin: "dense", slotProps: {
54
+ htmlInput: { 'data-testid': 'login-httpbasic-password' },
55
+ } })),
50
56
  react_1.default.createElement(material_1.DialogActions, null,
51
57
  react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", type: "submit" }, "Submit"),
52
58
  react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", type: "submit", onClick: () => {
@@ -1,16 +1,10 @@
1
- import { Instance } from 'mobx-state-tree';
1
+ import type { Instance } from 'mobx-state-tree';
2
2
  declare const HTTPBasicConfigSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
3
- /**
4
- * #slot
5
- */
6
3
  tokenType: {
7
4
  description: string;
8
5
  type: string;
9
6
  defaultValue: string;
10
7
  };
11
- /**
12
- * #slot
13
- */
14
8
  validateWithHEAD: {
15
9
  description: string;
16
10
  type: string;
@@ -2,31 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const configuration_1 = require("@jbrowse/core/configuration");
4
4
  const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
5
- /**
6
- * #config HTTPBasicInternetAccount
7
- */
8
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ function x() { }
9
6
  const HTTPBasicConfigSchema = (0, configuration_1.ConfigurationSchema)('HTTPBasicInternetAccount', {
10
- /**
11
- * #slot
12
- */
13
7
  tokenType: {
14
8
  description: 'a custom name for a token to include in the header',
15
9
  type: 'string',
16
10
  defaultValue: 'Basic',
17
11
  },
18
- /**
19
- * #slot
20
- */
21
12
  validateWithHEAD: {
22
13
  description: 'validate the token with a HEAD request before using it',
23
14
  type: 'boolean',
24
15
  defaultValue: true,
25
16
  },
26
17
  }, {
27
- /**
28
- * #baseConfiguration
29
- */
30
18
  baseConfiguration: models_1.BaseInternetAccountConfig,
31
19
  explicitlyTyped: true,
32
20
  });