@jbrowse/plugin-authentication 2.17.0 → 3.0.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 (70) hide show
  1. package/dist/DropboxOAuthModel/DropboxIcon.d.ts +2 -3
  2. package/dist/DropboxOAuthModel/DropboxIcon.js +2 -6
  3. package/dist/DropboxOAuthModel/configSchema.d.ts +1 -13
  4. package/dist/DropboxOAuthModel/configSchema.js +1 -19
  5. package/dist/DropboxOAuthModel/model.d.ts +5 -28
  6. package/dist/DropboxOAuthModel/model.js +4 -26
  7. package/dist/DropboxOAuthModel/util.js +0 -5
  8. package/dist/ExternalTokenModel/ExternalTokenEntryForm.d.ts +1 -2
  9. package/dist/ExternalTokenModel/ExternalTokenEntryForm.js +16 -41
  10. package/dist/ExternalTokenModel/configSchema.d.ts +1 -4
  11. package/dist/ExternalTokenModel/configSchema.js +1 -10
  12. package/dist/ExternalTokenModel/model.d.ts +3 -3
  13. package/dist/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +3 -3
  14. package/dist/GoogleDriveOAuthModel/GoogleDriveFilehandle.js +1 -1
  15. package/dist/GoogleDriveOAuthModel/GoogleDriveIcon.d.ts +2 -3
  16. package/dist/GoogleDriveOAuthModel/GoogleDriveIcon.js +2 -6
  17. package/dist/GoogleDriveOAuthModel/configSchema.d.ts +1 -13
  18. package/dist/GoogleDriveOAuthModel/configSchema.js +1 -19
  19. package/dist/GoogleDriveOAuthModel/model.d.ts +5 -31
  20. package/dist/GoogleDriveOAuthModel/model.js +4 -29
  21. package/dist/GoogleDriveOAuthModel/util.js +0 -1
  22. package/dist/HTTPBasicModel/HTTPBasicLoginForm.d.ts +1 -2
  23. package/dist/HTTPBasicModel/HTTPBasicLoginForm.js +17 -44
  24. package/dist/HTTPBasicModel/configSchema.d.ts +1 -7
  25. package/dist/HTTPBasicModel/configSchema.js +1 -13
  26. package/dist/HTTPBasicModel/model.d.ts +3 -21
  27. package/dist/HTTPBasicModel/model.js +0 -18
  28. package/dist/OAuthModel/configSchema.d.ts +1 -25
  29. package/dist/OAuthModel/configSchema.js +1 -31
  30. package/dist/OAuthModel/model.d.ts +4 -90
  31. package/dist/OAuthModel/model.js +11 -101
  32. package/dist/OAuthModel/util.js +17 -9
  33. package/dist/index.d.ts +4 -4
  34. package/dist/index.js +3 -3
  35. package/esm/DropboxOAuthModel/DropboxIcon.d.ts +2 -3
  36. package/esm/DropboxOAuthModel/DropboxIcon.js +2 -3
  37. package/esm/DropboxOAuthModel/configSchema.d.ts +1 -13
  38. package/esm/DropboxOAuthModel/configSchema.js +1 -19
  39. package/esm/DropboxOAuthModel/model.d.ts +5 -28
  40. package/esm/DropboxOAuthModel/model.js +4 -26
  41. package/esm/DropboxOAuthModel/util.js +0 -5
  42. package/esm/ExternalTokenModel/ExternalTokenEntryForm.d.ts +1 -2
  43. package/esm/ExternalTokenModel/ExternalTokenEntryForm.js +16 -18
  44. package/esm/ExternalTokenModel/configSchema.d.ts +1 -4
  45. package/esm/ExternalTokenModel/configSchema.js +1 -10
  46. package/esm/ExternalTokenModel/model.d.ts +3 -3
  47. package/esm/ExternalTokenModel/model.js +1 -1
  48. package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +3 -3
  49. package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.js +1 -1
  50. package/esm/GoogleDriveOAuthModel/GoogleDriveIcon.d.ts +2 -3
  51. package/esm/GoogleDriveOAuthModel/GoogleDriveIcon.js +2 -3
  52. package/esm/GoogleDriveOAuthModel/configSchema.d.ts +1 -13
  53. package/esm/GoogleDriveOAuthModel/configSchema.js +1 -19
  54. package/esm/GoogleDriveOAuthModel/model.d.ts +5 -31
  55. package/esm/GoogleDriveOAuthModel/model.js +4 -29
  56. package/esm/GoogleDriveOAuthModel/util.js +0 -1
  57. package/esm/HTTPBasicModel/HTTPBasicLoginForm.d.ts +1 -2
  58. package/esm/HTTPBasicModel/HTTPBasicLoginForm.js +17 -21
  59. package/esm/HTTPBasicModel/configSchema.d.ts +1 -7
  60. package/esm/HTTPBasicModel/configSchema.js +1 -13
  61. package/esm/HTTPBasicModel/model.d.ts +3 -21
  62. package/esm/HTTPBasicModel/model.js +1 -19
  63. package/esm/OAuthModel/configSchema.d.ts +1 -25
  64. package/esm/OAuthModel/configSchema.js +1 -31
  65. package/esm/OAuthModel/model.d.ts +4 -90
  66. package/esm/OAuthModel/model.js +11 -101
  67. package/esm/OAuthModel/util.js +0 -2
  68. package/esm/index.d.ts +4 -4
  69. package/esm/index.js +3 -3
  70. package/package.json +3 -3
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
- import { SvgIconProps } from '@mui/material';
3
- export default function DropboxIcon(props: SvgIconProps): React.JSX.Element;
1
+ import type { SvgIconProps } from '@mui/material';
2
+ export default function DropboxIcon(props: SvgIconProps): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,8 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.default = DropboxIcon;
7
- const react_1 = __importDefault(require("react"));
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
5
  const material_1 = require("@mui/material");
9
6
  function DropboxIcon(props) {
10
- return (react_1.default.createElement(material_1.SvgIcon, { ...props },
11
- react_1.default.createElement("path", { d: "M3 6.2L8 9.39L13 6.2L8 3L3 6.2M13 6.2L18 9.39L23 6.2L18 3L13 6.2M3 12.55L8 15.74L13 12.55L8 9.35L3 12.55M18 9.35L13 12.55L18 15.74L23 12.55L18 9.35M8.03 16.8L13.04 20L18.04 16.8L13.04 13.61L8.03 16.8Z" })));
7
+ return ((0, jsx_runtime_1.jsx)(material_1.SvgIcon, { ...props, children: (0, jsx_runtime_1.jsx)("path", { d: "M3 6.2L8 9.39L13 6.2L8 3L3 6.2M13 6.2L18 9.39L23 6.2L18 3L13 6.2M3 12.55L8 15.74L13 12.55L8 9.35L3 12.55M18 9.35L13 12.55L18 15.74L23 12.55L18 9.35M8.03 16.8L13.04 20L18.04 16.8L13.04 13.61L8.03 16.8Z" }) }));
12
8
  }
@@ -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,6 @@
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
- */
1
+ import type { DropboxOAuthInternetAccountConfigModel } from './configSchema';
2
+ import type { UriLocation } from '@jbrowse/core/util/types';
3
+ import type { Instance } from 'mobx-state-tree';
8
4
  declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfigModel) => import("mobx-state-tree").IModelType<{
9
5
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
10
6
  type: import("mobx-state-tree").ISimpleType<string>;
@@ -106,13 +102,7 @@ declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfi
106
102
  };
107
103
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>;
108
104
  } & {
109
- /**
110
- * #property
111
- */
112
105
  type: import("mobx-state-tree").ISimpleType<"DropboxOAuthInternetAccount">;
113
- /**
114
- * #property
115
- */
116
106
  configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
117
107
  authEndpoint: {
118
108
  description: string;
@@ -260,7 +250,7 @@ declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfi
260
250
  readonly clientId: string;
261
251
  readonly scopes: string;
262
252
  state(): string | undefined;
263
- readonly responseType: "code" | "token";
253
+ readonly responseType: "token" | "code";
264
254
  readonly refreshTokenKey: string;
265
255
  } & {
266
256
  storeRefreshToken(refreshToken: string): void;
@@ -278,23 +268,10 @@ declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfi
278
268
  } & {
279
269
  getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
280
270
  } & {
281
- /**
282
- * #getter
283
- * The FileSelector icon for Dropbox
284
- */
285
- readonly toggleContents: React.JSX.Element;
286
- /**
287
- * #getter
288
- */
271
+ readonly toggleContents: import("react/jsx-runtime").JSX.Element;
289
272
  readonly selectorLabel: string;
290
273
  } & {
291
- /**
292
- * #method
293
- */
294
274
  getFetcher(location?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
295
- /**
296
- * #action
297
- */
298
275
  validateToken(token: string, location: UriLocation): Promise<string>;
299
276
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
300
277
  export default stateModelFactory;
@@ -3,48 +3,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
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
- return react_1.default.createElement(DropboxIcon_1.default, null);
22
+ return (0, jsx_runtime_1.jsx)(DropboxIcon_1.default, {});
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
  }
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
1
  export declare const ExternalTokenEntryForm: ({ internetAccountId, handleClose, }: {
3
2
  internetAccountId: string;
4
3
  handleClose: (token?: string) => void;
5
- }) => React.JSX.Element;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,49 +1,24 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  exports.ExternalTokenEntryForm = void 0;
27
- const react_1 = __importStar(require("react"));
28
- const material_1 = require("@mui/material");
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
29
6
  const ui_1 = require("@jbrowse/core/ui");
7
+ const material_1 = require("@mui/material");
30
8
  const ExternalTokenEntryForm = ({ internetAccountId, handleClose, }) => {
31
9
  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}` },
33
- 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", onChange: event => {
35
- setToken(event.target.value);
36
- }, margin: "dense", slotProps: {
37
- htmlInput: { 'data-testid': 'entry-externalToken' },
38
- } })),
39
- react_1.default.createElement(material_1.DialogActions, null,
40
- react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", type: "submit", disabled: !token, onClick: () => {
41
- if (token) {
42
- handleClose(token);
43
- }
44
- } }, "Add"),
45
- react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
46
- handleClose();
47
- } }, "Cancel"))));
10
+ return ((0, jsx_runtime_1.jsxs)(ui_1.Dialog, { open: true, maxWidth: "xl", "data-testid": "externalToken-form", onClose: () => {
11
+ handleClose();
12
+ }, title: `Enter token for ${internetAccountId}`, children: [(0, jsx_runtime_1.jsx)(material_1.DialogContent, { style: { display: 'flex', flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { required: true, label: "Enter Token", variant: "outlined", onChange: event => {
13
+ setToken(event.target.value);
14
+ }, margin: "dense", slotProps: {
15
+ htmlInput: { 'data-testid': 'entry-externalToken' },
16
+ } }) }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "primary", type: "submit", disabled: !token, onClick: () => {
17
+ if (token) {
18
+ handleClose(token);
19
+ }
20
+ }, children: "Add" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
21
+ handleClose();
22
+ }, children: "Cancel" })] })] }));
48
23
  };
49
24
  exports.ExternalTokenEntryForm = ExternalTokenEntryForm;
@@ -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,15 +1,15 @@
1
1
  import { RemoteFileWithRangeCache } from '@jbrowse/core/util/io';
2
- import { FilehandleOptions, Stats, PolyfilledResponse } from 'generic-filehandle';
2
+ import type { FilehandleOptions, Stats } from 'generic-filehandle2';
3
3
  export interface RequestInitWithMetadata extends RequestInit {
4
4
  metadataOnly?: boolean;
5
5
  }
6
6
  interface GoogleDriveFilehandleOptions extends FilehandleOptions {
7
- fetch(input: RequestInfo, opts?: RequestInitWithMetadata): Promise<PolyfilledResponse>;
7
+ fetch(input: RequestInfo, opts?: RequestInitWithMetadata): Promise<Response>;
8
8
  }
9
9
  export declare class GoogleDriveFile extends RemoteFileWithRangeCache {
10
10
  private statsPromise;
11
11
  constructor(source: string, opts: GoogleDriveFilehandleOptions);
12
- fetch(input: RequestInfo, opts?: RequestInitWithMetadata): Promise<PolyfilledResponse>;
12
+ fetch(input: RequestInfo, opts?: RequestInitWithMetadata): Promise<Response>;
13
13
  stat(): Promise<Stats>;
14
14
  }
15
15
  export {};
@@ -7,7 +7,7 @@ class GoogleDriveFile extends io_1.RemoteFileWithRangeCache {
7
7
  super(source, opts);
8
8
  this.statsPromise = this.fetch(source, {
9
9
  metadataOnly: true,
10
- }).then((response) => response.json());
10
+ }).then(response => response.json());
11
11
  }
12
12
  async fetch(input, opts) {
13
13
  return super.fetch(input, opts);
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
- import { SvgIconProps } from '@mui/material';
3
- export default function GoogleDriveIcon(props: SvgIconProps): React.JSX.Element;
1
+ import type { SvgIconProps } from '@mui/material';
2
+ export default function GoogleDriveIcon(props: SvgIconProps): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,8 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.default = GoogleDriveIcon;
7
- const react_1 = __importDefault(require("react"));
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
5
  const material_1 = require("@mui/material");
9
6
  function GoogleDriveIcon(props) {
10
- return (react_1.default.createElement(material_1.SvgIcon, { ...props },
11
- react_1.default.createElement("path", { d: "M7.71,3.5L1.15,15L4.58,21L11.13,9.5M9.73,15L6.3,21H19.42L22.85,15M22.28,14L15.42,2H8.58L8.57,2L15.43,14H22.28Z" })));
7
+ return ((0, jsx_runtime_1.jsx)(material_1.SvgIcon, { ...props, children: (0, jsx_runtime_1.jsx)("path", { d: "M7.71,3.5L1.15,15L4.58,21L11.13,9.5M9.73,15L6.3,21H19.42L22.85,15M22.28,14L15.42,2H8.58L8.57,2L15.43,14H22.28Z" }) }));
12
8
  }
@@ -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,10 @@
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
1
  import { GoogleDriveFile } from './GoogleDriveFilehandle';
2
+ import type { GoogleDriveOAuthInternetAccountConfigModel } from './configSchema';
3
+ import type { UriLocation } from '@jbrowse/core/util/types';
4
+ import type { Instance } from 'mobx-state-tree';
6
5
  export interface RequestInitWithMetadata extends RequestInit {
7
6
  metadataOnly?: boolean;
8
7
  }
9
- /**
10
- * #stateModel GoogleDriveOAuthInternetAccount
11
- */
12
8
  export default function stateModelFactory(configSchema: GoogleDriveOAuthInternetAccountConfigModel): import("mobx-state-tree").IModelType<{
13
9
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
14
10
  type: import("mobx-state-tree").ISimpleType<string>;
@@ -110,13 +106,7 @@ export default function stateModelFactory(configSchema: GoogleDriveOAuthInternet
110
106
  };
111
107
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>;
112
108
  } & {
113
- /**
114
- * #property
115
- */
116
109
  type: import("mobx-state-tree").ISimpleType<"GoogleDriveOAuthInternetAccount">;
117
- /**
118
- * #property
119
- */
120
110
  configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
121
111
  authEndpoint: {
122
112
  description: string;
@@ -264,7 +254,7 @@ export default function stateModelFactory(configSchema: GoogleDriveOAuthInternet
264
254
  readonly clientId: string;
265
255
  readonly scopes: string;
266
256
  state(): string | undefined;
267
- readonly responseType: "code" | "token";
257
+ readonly responseType: "token" | "code";
268
258
  readonly refreshTokenKey: string;
269
259
  } & {
270
260
  storeRefreshToken(refreshToken: string): void;
@@ -282,27 +272,11 @@ export default function stateModelFactory(configSchema: GoogleDriveOAuthInternet
282
272
  } & {
283
273
  getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
284
274
  } & {
285
- /**
286
- * #getter
287
- * The FileSelector icon for Google drive
288
- */
289
- readonly toggleContents: React.JSX.Element;
290
- /**
291
- * #getter
292
- */
275
+ readonly toggleContents: import("react/jsx-runtime").JSX.Element;
293
276
  readonly selectorLabel: string;
294
277
  } & {
295
- /**
296
- * #method
297
- */
298
278
  getFetcher(location?: UriLocation): (input: RequestInfo, init?: RequestInitWithMetadata) => Promise<Response>;
299
- /**
300
- * #method
301
- */
302
279
  openLocation(location: UriLocation): GoogleDriveFile;
303
- /**
304
- * #action
305
- */
306
280
  validateToken(token: string, location: UriLocation): Promise<string>;
307
281
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
308
282
  export type GoogleDriveOAuthStateModel = ReturnType<typeof stateModelFactory>;
@@ -4,53 +4,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = stateModelFactory;
7
- const react_1 = __importDefault(require("react"));
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
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
- return react_1.default.createElement(GoogleDriveIcon_1.default, null);
28
+ return (0, jsx_runtime_1.jsx)(GoogleDriveIcon_1.default, {});
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: {