@jbrowse/plugin-authentication 2.18.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 (36) hide show
  1. package/dist/DropboxOAuthModel/DropboxIcon.d.ts +1 -2
  2. package/dist/DropboxOAuthModel/DropboxIcon.js +2 -6
  3. package/dist/DropboxOAuthModel/model.d.ts +2 -3
  4. package/dist/DropboxOAuthModel/model.js +2 -2
  5. package/dist/ExternalTokenModel/ExternalTokenEntryForm.d.ts +1 -2
  6. package/dist/ExternalTokenModel/ExternalTokenEntryForm.js +14 -41
  7. package/dist/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +3 -3
  8. package/dist/GoogleDriveOAuthModel/GoogleDriveFilehandle.js +1 -1
  9. package/dist/GoogleDriveOAuthModel/GoogleDriveIcon.d.ts +1 -2
  10. package/dist/GoogleDriveOAuthModel/GoogleDriveIcon.js +2 -6
  11. package/dist/GoogleDriveOAuthModel/model.d.ts +2 -3
  12. package/dist/GoogleDriveOAuthModel/model.js +2 -2
  13. package/dist/HTTPBasicModel/HTTPBasicLoginForm.d.ts +1 -2
  14. package/dist/HTTPBasicModel/HTTPBasicLoginForm.js +15 -44
  15. package/dist/OAuthModel/model.d.ts +1 -1
  16. package/dist/OAuthModel/model.js +11 -6
  17. package/dist/OAuthModel/util.js +17 -7
  18. package/dist/index.d.ts +3 -3
  19. package/esm/DropboxOAuthModel/DropboxIcon.d.ts +1 -2
  20. package/esm/DropboxOAuthModel/DropboxIcon.js +2 -3
  21. package/esm/DropboxOAuthModel/model.d.ts +2 -3
  22. package/esm/DropboxOAuthModel/model.js +2 -2
  23. package/esm/ExternalTokenModel/ExternalTokenEntryForm.d.ts +1 -2
  24. package/esm/ExternalTokenModel/ExternalTokenEntryForm.js +14 -18
  25. package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +3 -3
  26. package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.js +1 -1
  27. package/esm/GoogleDriveOAuthModel/GoogleDriveIcon.d.ts +1 -2
  28. package/esm/GoogleDriveOAuthModel/GoogleDriveIcon.js +2 -3
  29. package/esm/GoogleDriveOAuthModel/model.d.ts +2 -3
  30. package/esm/GoogleDriveOAuthModel/model.js +2 -2
  31. package/esm/HTTPBasicModel/HTTPBasicLoginForm.d.ts +1 -2
  32. package/esm/HTTPBasicModel/HTTPBasicLoginForm.js +15 -21
  33. package/esm/OAuthModel/model.d.ts +1 -1
  34. package/esm/OAuthModel/model.js +11 -6
  35. package/esm/index.d.ts +3 -3
  36. package/package.json +3 -3
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
1
  import type { SvgIconProps } from '@mui/material';
3
- export default function DropboxIcon(props: SvgIconProps): React.JSX.Element;
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,4 +1,3 @@
1
- import React from 'react';
2
1
  import type { DropboxOAuthInternetAccountConfigModel } from './configSchema';
3
2
  import type { UriLocation } from '@jbrowse/core/util/types';
4
3
  import type { Instance } from 'mobx-state-tree';
@@ -251,7 +250,7 @@ declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfi
251
250
  readonly clientId: string;
252
251
  readonly scopes: string;
253
252
  state(): string | undefined;
254
- readonly responseType: "code" | "token";
253
+ readonly responseType: "token" | "code";
255
254
  readonly refreshTokenKey: string;
256
255
  } & {
257
256
  storeRefreshToken(refreshToken: string): void;
@@ -269,7 +268,7 @@ declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfi
269
268
  } & {
270
269
  getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
271
270
  } & {
272
- readonly toggleContents: React.JSX.Element;
271
+ readonly toggleContents: import("react/jsx-runtime").JSX.Element;
273
272
  readonly selectorLabel: string;
274
273
  } & {
275
274
  getFetcher(location?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
@@ -3,7 +3,7 @@ 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
9
  const OAuthModel_1 = require("../OAuthModel");
@@ -19,7 +19,7 @@ const stateModelFactory = (configSchema) => {
19
19
  })
20
20
  .views(() => ({
21
21
  get toggleContents() {
22
- return react_1.default.createElement(DropboxIcon_1.default, null);
22
+ return (0, jsx_runtime_1.jsx)(DropboxIcon_1.default, {});
23
23
  },
24
24
  get selectorLabel() {
25
25
  return 'Enter Dropbox share link';
@@ -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,51 +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"));
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
28
6
  const ui_1 = require("@jbrowse/core/ui");
29
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", onClose: () => {
10
+ return ((0, jsx_runtime_1.jsxs)(ui_1.Dialog, { open: true, maxWidth: "xl", "data-testid": "externalToken-form", onClose: () => {
33
11
  handleClose();
34
- }, title: `Enter token for ${internetAccountId}` },
35
- react_1.default.createElement(material_1.DialogContent, { style: { display: 'flex', flexDirection: 'column' } },
36
- react_1.default.createElement(material_1.TextField, { required: true, label: "Enter Token", variant: "outlined", onChange: event => {
37
- setToken(event.target.value);
38
- }, margin: "dense", slotProps: {
39
- htmlInput: { 'data-testid': 'entry-externalToken' },
40
- } })),
41
- react_1.default.createElement(material_1.DialogActions, null,
42
- react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", type: "submit", disabled: !token, onClick: () => {
43
- if (token) {
44
- handleClose(token);
45
- }
46
- } }, "Add"),
47
- react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
48
- handleClose();
49
- } }, "Cancel"))));
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" })] })] }));
50
23
  };
51
24
  exports.ExternalTokenEntryForm = ExternalTokenEntryForm;
@@ -1,15 +1,15 @@
1
1
  import { RemoteFileWithRangeCache } from '@jbrowse/core/util/io';
2
- import type { FilehandleOptions, PolyfilledResponse, Stats } 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
1
  import type { SvgIconProps } from '@mui/material';
3
- export default function GoogleDriveIcon(props: SvgIconProps): React.JSX.Element;
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,4 +1,3 @@
1
- import React from 'react';
2
1
  import { GoogleDriveFile } from './GoogleDriveFilehandle';
3
2
  import type { GoogleDriveOAuthInternetAccountConfigModel } from './configSchema';
4
3
  import type { UriLocation } from '@jbrowse/core/util/types';
@@ -255,7 +254,7 @@ export default function stateModelFactory(configSchema: GoogleDriveOAuthInternet
255
254
  readonly clientId: string;
256
255
  readonly scopes: string;
257
256
  state(): string | undefined;
258
- readonly responseType: "code" | "token";
257
+ readonly responseType: "token" | "code";
259
258
  readonly refreshTokenKey: string;
260
259
  } & {
261
260
  storeRefreshToken(refreshToken: string): void;
@@ -273,7 +272,7 @@ export default function stateModelFactory(configSchema: GoogleDriveOAuthInternet
273
272
  } & {
274
273
  getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
275
274
  } & {
276
- readonly toggleContents: React.JSX.Element;
275
+ readonly toggleContents: import("react/jsx-runtime").JSX.Element;
277
276
  readonly selectorLabel: string;
278
277
  } & {
279
278
  getFetcher(location?: UriLocation): (input: RequestInfo, init?: RequestInitWithMetadata) => Promise<Response>;
@@ -4,7 +4,7 @@ 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
10
  const OAuthModel_1 = require("../OAuthModel");
@@ -25,7 +25,7 @@ function stateModelFactory(configSchema) {
25
25
  })
26
26
  .views(() => ({
27
27
  get toggleContents() {
28
- return react_1.default.createElement(GoogleDriveIcon_1.default, null);
28
+ return (0, jsx_runtime_1.jsx)(GoogleDriveIcon_1.default, {});
29
29
  },
30
30
  get selectorLabel() {
31
31
  return 'Enter Google Drive share link';
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
1
  export declare function HTTPBasicLoginForm({ internetAccountId, handleClose, }: {
3
2
  internetAccountId: string;
4
3
  handleClose: (arg?: string) => void;
5
- }): React.JSX.Element;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,39 +1,16 @@
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.HTTPBasicLoginForm = HTTPBasicLoginForm;
27
- const react_1 = __importStar(require("react"));
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
28
6
  const ui_1 = require("@jbrowse/core/ui");
29
7
  const material_1 = require("@mui/material");
30
8
  function HTTPBasicLoginForm({ internetAccountId, handleClose, }) {
31
9
  const [username, setUsername] = (0, react_1.useState)('');
32
10
  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}`, onClose: () => {
11
+ return ((0, jsx_runtime_1.jsx)(ui_1.Dialog, { open: true, maxWidth: "xl", "data-testid": "login-httpbasic", title: `Log in for ${internetAccountId}`, onClose: () => {
34
12
  handleClose();
35
- } },
36
- react_1.default.createElement("form", { onSubmit: event => {
13
+ }, children: (0, jsx_runtime_1.jsxs)("form", { onSubmit: event => {
37
14
  if (username && password) {
38
15
  handleClose(btoa(`${username}:${password}`));
39
16
  }
@@ -41,21 +18,15 @@ function HTTPBasicLoginForm({ internetAccountId, handleClose, }) {
41
18
  handleClose();
42
19
  }
43
20
  event.preventDefault();
44
- } },
45
- react_1.default.createElement(material_1.DialogContent, { style: { display: 'flex', flexDirection: 'column' } },
46
- react_1.default.createElement(material_1.TextField, { required: true, label: "Username", variant: "outlined", onChange: event => {
47
- setUsername(event.target.value);
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 => {
52
- setPassword(event.target.value);
53
- }, margin: "dense", slotProps: {
54
- htmlInput: { 'data-testid': 'login-httpbasic-password' },
55
- } })),
56
- react_1.default.createElement(material_1.DialogActions, null,
57
- react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", type: "submit" }, "Submit"),
58
- react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", type: "submit", onClick: () => {
59
- handleClose();
60
- } }, "Cancel")))));
21
+ }, children: [(0, jsx_runtime_1.jsxs)(material_1.DialogContent, { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { required: true, label: "Username", variant: "outlined", onChange: event => {
22
+ setUsername(event.target.value);
23
+ }, margin: "dense", slotProps: {
24
+ htmlInput: { 'data-testid': 'login-httpbasic-username' },
25
+ } }), (0, jsx_runtime_1.jsx)(material_1.TextField, { required: true, label: "Password", type: "password", autoComplete: "current-password", variant: "outlined", onChange: event => {
26
+ setPassword(event.target.value);
27
+ }, margin: "dense", slotProps: {
28
+ htmlInput: { 'data-testid': 'login-httpbasic-password' },
29
+ } })] }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "primary", type: "submit", children: "Submit" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "secondary", type: "submit", onClick: () => {
30
+ handleClose();
31
+ }, children: "Cancel" })] })] }) }));
61
32
  }
@@ -159,7 +159,7 @@ declare const stateModelFactory: (configSchema: OAuthInternetAccountConfigModel)
159
159
  readonly clientId: string;
160
160
  readonly scopes: string;
161
161
  state(): string | undefined;
162
- readonly responseType: "code" | "token";
162
+ readonly responseType: "token" | "code";
163
163
  readonly refreshTokenKey: string;
164
164
  } & {
165
165
  storeRefreshToken(refreshToken: string): void;
@@ -1,12 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const buffer_1 = require("buffer");
4
3
  const configuration_1 = require("@jbrowse/core/configuration");
5
4
  const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
6
5
  const util_1 = require("@jbrowse/core/util");
7
6
  const mobx_state_tree_1 = require("mobx-state-tree");
8
7
  const util_2 = require("./util");
9
8
  const util_3 = require("../util");
9
+ function encode(uint8array) {
10
+ const output = [];
11
+ for (let i = 0, length = uint8array.length; i < length; i++) {
12
+ output.push(String.fromCharCode(uint8array[i]));
13
+ }
14
+ return btoa(output.join(''));
15
+ }
10
16
  const stateModelFactory = (configSchema) => {
11
17
  return models_1.InternetAccount.named('OAuthInternetAccount')
12
18
  .props({
@@ -17,12 +23,11 @@ const stateModelFactory = (configSchema) => {
17
23
  let codeVerifier = undefined;
18
24
  return {
19
25
  get codeVerifierPKCE() {
20
- if (codeVerifier) {
21
- return codeVerifier;
26
+ if (!codeVerifier) {
27
+ const array = new Uint8Array(32);
28
+ globalThis.crypto.getRandomValues(array);
29
+ codeVerifier = (0, util_2.fixup)(encode(array));
22
30
  }
23
- const array = new Uint8Array(32);
24
- globalThis.crypto.getRandomValues(array);
25
- codeVerifier = (0, util_2.fixup)(buffer_1.Buffer.from(array).toString('base64'));
26
31
  return codeVerifier;
27
32
  },
28
33
  };
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.fixup = fixup;
27
37
  exports.generateChallenge = generateChallenge;
package/dist/index.d.ts CHANGED
@@ -230,7 +230,7 @@ export default class AuthenticationPlugin extends Plugin {
230
230
  readonly clientId: string;
231
231
  readonly scopes: string;
232
232
  state(): string | undefined;
233
- readonly responseType: "code" | "token";
233
+ readonly responseType: "token" | "code";
234
234
  readonly refreshTokenKey: string;
235
235
  } & {
236
236
  storeRefreshToken(refreshToken: string): void;
@@ -902,7 +902,7 @@ export default class AuthenticationPlugin extends Plugin {
902
902
  readonly clientId: string;
903
903
  readonly scopes: string;
904
904
  state(): string | undefined;
905
- readonly responseType: "code" | "token";
905
+ readonly responseType: "token" | "code";
906
906
  readonly refreshTokenKey: string;
907
907
  } & {
908
908
  storeRefreshToken(refreshToken: string): void;
@@ -920,7 +920,7 @@ export default class AuthenticationPlugin extends Plugin {
920
920
  } & {
921
921
  getFetcher(loc?: import("@jbrowse/core/util").UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
922
922
  } & {
923
- readonly toggleContents: import("react").JSX.Element;
923
+ readonly toggleContents: import("react/jsx-runtime").JSX.Element;
924
924
  readonly selectorLabel: string;
925
925
  } & {
926
926
  getFetcher(location?: import("@jbrowse/core/util").UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
1
  import type { SvgIconProps } from '@mui/material';
3
- export default function DropboxIcon(props: SvgIconProps): React.JSX.Element;
2
+ export default function DropboxIcon(props: SvgIconProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,5 @@
1
- import React from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { SvgIcon } from '@mui/material';
3
3
  export default function DropboxIcon(props) {
4
- return (React.createElement(SvgIcon, { ...props },
5
- React.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" })));
4
+ return (_jsx(SvgIcon, { ...props, children: _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" }) }));
6
5
  }
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import type { DropboxOAuthInternetAccountConfigModel } from './configSchema';
3
2
  import type { UriLocation } from '@jbrowse/core/util/types';
4
3
  import type { Instance } from 'mobx-state-tree';
@@ -251,7 +250,7 @@ declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfi
251
250
  readonly clientId: string;
252
251
  readonly scopes: string;
253
252
  state(): string | undefined;
254
- readonly responseType: "code" | "token";
253
+ readonly responseType: "token" | "code";
255
254
  readonly refreshTokenKey: string;
256
255
  } & {
257
256
  storeRefreshToken(refreshToken: string): void;
@@ -269,7 +268,7 @@ declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfi
269
268
  } & {
270
269
  getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
271
270
  } & {
272
- readonly toggleContents: React.JSX.Element;
271
+ readonly toggleContents: import("react/jsx-runtime").JSX.Element;
273
272
  readonly selectorLabel: string;
274
273
  } & {
275
274
  getFetcher(location?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ConfigurationReference } from '@jbrowse/core/configuration';
3
3
  import { types } from 'mobx-state-tree';
4
4
  import { configSchema as OAuthConfigSchema } from '../OAuthModel';
@@ -14,7 +14,7 @@ const stateModelFactory = (configSchema) => {
14
14
  })
15
15
  .views(() => ({
16
16
  get toggleContents() {
17
- return React.createElement(DropboxIcon, null);
17
+ return _jsx(DropboxIcon, {});
18
18
  },
19
19
  get selectorLabel() {
20
20
  return 'Enter Dropbox share link';
@@ -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,24 +1,20 @@
1
- import React, { useState } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
2
3
  import { Dialog } from '@jbrowse/core/ui';
3
4
  import { Button, DialogActions, DialogContent, TextField } from '@mui/material';
4
5
  export const ExternalTokenEntryForm = ({ internetAccountId, handleClose, }) => {
5
6
  const [token, setToken] = useState('');
6
- return (React.createElement(Dialog, { open: true, maxWidth: "xl", "data-testid": "externalToken-form", onClose: () => {
7
+ return (_jsxs(Dialog, { open: true, maxWidth: "xl", "data-testid": "externalToken-form", onClose: () => {
7
8
  handleClose();
8
- }, title: `Enter token for ${internetAccountId}` },
9
- React.createElement(DialogContent, { style: { display: 'flex', flexDirection: 'column' } },
10
- React.createElement(TextField, { required: true, label: "Enter Token", variant: "outlined", onChange: event => {
11
- setToken(event.target.value);
12
- }, margin: "dense", slotProps: {
13
- htmlInput: { 'data-testid': 'entry-externalToken' },
14
- } })),
15
- React.createElement(DialogActions, null,
16
- React.createElement(Button, { variant: "contained", color: "primary", type: "submit", disabled: !token, onClick: () => {
17
- if (token) {
18
- handleClose(token);
19
- }
20
- } }, "Add"),
21
- React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => {
22
- handleClose();
23
- } }, "Cancel"))));
9
+ }, title: `Enter token for ${internetAccountId}`, children: [_jsx(DialogContent, { style: { display: 'flex', flexDirection: 'column' }, children: _jsx(TextField, { required: true, label: "Enter Token", variant: "outlined", onChange: event => {
10
+ setToken(event.target.value);
11
+ }, margin: "dense", slotProps: {
12
+ htmlInput: { 'data-testid': 'entry-externalToken' },
13
+ } }) }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", color: "primary", type: "submit", disabled: !token, onClick: () => {
14
+ if (token) {
15
+ handleClose(token);
16
+ }
17
+ }, children: "Add" }), _jsx(Button, { variant: "contained", color: "secondary", onClick: () => {
18
+ handleClose();
19
+ }, children: "Cancel" })] })] }));
24
20
  };
@@ -1,15 +1,15 @@
1
1
  import { RemoteFileWithRangeCache } from '@jbrowse/core/util/io';
2
- import type { FilehandleOptions, PolyfilledResponse, Stats } 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 {};
@@ -4,7 +4,7 @@ export class GoogleDriveFile extends RemoteFileWithRangeCache {
4
4
  super(source, opts);
5
5
  this.statsPromise = this.fetch(source, {
6
6
  metadataOnly: true,
7
- }).then((response) => response.json());
7
+ }).then(response => response.json());
8
8
  }
9
9
  async fetch(input, opts) {
10
10
  return super.fetch(input, opts);
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
1
  import type { SvgIconProps } from '@mui/material';
3
- export default function GoogleDriveIcon(props: SvgIconProps): React.JSX.Element;
2
+ export default function GoogleDriveIcon(props: SvgIconProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,5 @@
1
- import React from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { SvgIcon } from '@mui/material';
3
3
  export default function GoogleDriveIcon(props) {
4
- return (React.createElement(SvgIcon, { ...props },
5
- React.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" })));
4
+ return (_jsx(SvgIcon, { ...props, children: _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" }) }));
6
5
  }
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { GoogleDriveFile } from './GoogleDriveFilehandle';
3
2
  import type { GoogleDriveOAuthInternetAccountConfigModel } from './configSchema';
4
3
  import type { UriLocation } from '@jbrowse/core/util/types';
@@ -255,7 +254,7 @@ export default function stateModelFactory(configSchema: GoogleDriveOAuthInternet
255
254
  readonly clientId: string;
256
255
  readonly scopes: string;
257
256
  state(): string | undefined;
258
- readonly responseType: "code" | "token";
257
+ readonly responseType: "token" | "code";
259
258
  readonly refreshTokenKey: string;
260
259
  } & {
261
260
  storeRefreshToken(refreshToken: string): void;
@@ -273,7 +272,7 @@ export default function stateModelFactory(configSchema: GoogleDriveOAuthInternet
273
272
  } & {
274
273
  getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
275
274
  } & {
276
- readonly toggleContents: React.JSX.Element;
275
+ readonly toggleContents: import("react/jsx-runtime").JSX.Element;
277
276
  readonly selectorLabel: string;
278
277
  } & {
279
278
  getFetcher(location?: UriLocation): (input: RequestInfo, init?: RequestInitWithMetadata) => Promise<Response>;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ConfigurationReference } from '@jbrowse/core/configuration';
3
3
  import { types } from 'mobx-state-tree';
4
4
  import { configSchema as OAuthConfigSchema } from '../OAuthModel';
@@ -19,7 +19,7 @@ export default function stateModelFactory(configSchema) {
19
19
  })
20
20
  .views(() => ({
21
21
  get toggleContents() {
22
- return React.createElement(GoogleDriveIcon, null);
22
+ return _jsx(GoogleDriveIcon, {});
23
23
  },
24
24
  get selectorLabel() {
25
25
  return 'Enter Google Drive share link';
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
1
  export declare function HTTPBasicLoginForm({ internetAccountId, handleClose, }: {
3
2
  internetAccountId: string;
4
3
  handleClose: (arg?: string) => void;
5
- }): React.JSX.Element;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,13 +1,13 @@
1
- import React, { useState } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
2
3
  import { Dialog } from '@jbrowse/core/ui';
3
4
  import { Button, DialogActions, DialogContent, TextField } from '@mui/material';
4
5
  export function HTTPBasicLoginForm({ internetAccountId, handleClose, }) {
5
6
  const [username, setUsername] = useState('');
6
7
  const [password, setPassword] = useState('');
7
- return (React.createElement(Dialog, { open: true, maxWidth: "xl", "data-testid": "login-httpbasic", title: `Log in for ${internetAccountId}`, onClose: () => {
8
+ return (_jsx(Dialog, { open: true, maxWidth: "xl", "data-testid": "login-httpbasic", title: `Log in for ${internetAccountId}`, onClose: () => {
8
9
  handleClose();
9
- } },
10
- React.createElement("form", { onSubmit: event => {
10
+ }, children: _jsxs("form", { onSubmit: event => {
11
11
  if (username && password) {
12
12
  handleClose(btoa(`${username}:${password}`));
13
13
  }
@@ -15,21 +15,15 @@ export function HTTPBasicLoginForm({ internetAccountId, handleClose, }) {
15
15
  handleClose();
16
16
  }
17
17
  event.preventDefault();
18
- } },
19
- React.createElement(DialogContent, { style: { display: 'flex', flexDirection: 'column' } },
20
- React.createElement(TextField, { required: true, label: "Username", variant: "outlined", onChange: event => {
21
- setUsername(event.target.value);
22
- }, margin: "dense", slotProps: {
23
- htmlInput: { 'data-testid': 'login-httpbasic-username' },
24
- } }),
25
- React.createElement(TextField, { required: true, label: "Password", type: "password", autoComplete: "current-password", variant: "outlined", onChange: event => {
26
- setPassword(event.target.value);
27
- }, margin: "dense", slotProps: {
28
- htmlInput: { 'data-testid': 'login-httpbasic-password' },
29
- } })),
30
- React.createElement(DialogActions, null,
31
- React.createElement(Button, { variant: "contained", color: "primary", type: "submit" }, "Submit"),
32
- React.createElement(Button, { variant: "contained", color: "secondary", type: "submit", onClick: () => {
33
- handleClose();
34
- } }, "Cancel")))));
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" })] })] }) }));
35
29
  }
@@ -159,7 +159,7 @@ declare const stateModelFactory: (configSchema: OAuthInternetAccountConfigModel)
159
159
  readonly clientId: string;
160
160
  readonly scopes: string;
161
161
  state(): string | undefined;
162
- readonly responseType: "code" | "token";
162
+ readonly responseType: "token" | "code";
163
163
  readonly refreshTokenKey: string;
164
164
  } & {
165
165
  storeRefreshToken(refreshToken: string): void;
@@ -1,10 +1,16 @@
1
- import { Buffer } from 'buffer';
2
1
  import { ConfigurationReference, getConf } from '@jbrowse/core/configuration';
3
2
  import { InternetAccount } from '@jbrowse/core/pluggableElementTypes/models';
4
3
  import { isElectron } from '@jbrowse/core/util';
5
4
  import { types } from 'mobx-state-tree';
6
5
  import { fixup, generateChallenge, processError, processTokenResponse, } from './util';
7
6
  import { getResponseError } from '../util';
7
+ function encode(uint8array) {
8
+ const output = [];
9
+ for (let i = 0, length = uint8array.length; i < length; i++) {
10
+ output.push(String.fromCharCode(uint8array[i]));
11
+ }
12
+ return btoa(output.join(''));
13
+ }
8
14
  const stateModelFactory = (configSchema) => {
9
15
  return InternetAccount.named('OAuthInternetAccount')
10
16
  .props({
@@ -15,12 +21,11 @@ const stateModelFactory = (configSchema) => {
15
21
  let codeVerifier = undefined;
16
22
  return {
17
23
  get codeVerifierPKCE() {
18
- if (codeVerifier) {
19
- return codeVerifier;
24
+ if (!codeVerifier) {
25
+ const array = new Uint8Array(32);
26
+ globalThis.crypto.getRandomValues(array);
27
+ codeVerifier = fixup(encode(array));
20
28
  }
21
- const array = new Uint8Array(32);
22
- globalThis.crypto.getRandomValues(array);
23
- codeVerifier = fixup(Buffer.from(array).toString('base64'));
24
29
  return codeVerifier;
25
30
  },
26
31
  };
package/esm/index.d.ts CHANGED
@@ -230,7 +230,7 @@ export default class AuthenticationPlugin extends Plugin {
230
230
  readonly clientId: string;
231
231
  readonly scopes: string;
232
232
  state(): string | undefined;
233
- readonly responseType: "code" | "token";
233
+ readonly responseType: "token" | "code";
234
234
  readonly refreshTokenKey: string;
235
235
  } & {
236
236
  storeRefreshToken(refreshToken: string): void;
@@ -902,7 +902,7 @@ export default class AuthenticationPlugin extends Plugin {
902
902
  readonly clientId: string;
903
903
  readonly scopes: string;
904
904
  state(): string | undefined;
905
- readonly responseType: "code" | "token";
905
+ readonly responseType: "token" | "code";
906
906
  readonly refreshTokenKey: string;
907
907
  } & {
908
908
  storeRefreshToken(refreshToken: string): void;
@@ -920,7 +920,7 @@ export default class AuthenticationPlugin extends Plugin {
920
920
  } & {
921
921
  getFetcher(loc?: import("@jbrowse/core/util").UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
922
922
  } & {
923
- readonly toggleContents: import("react").JSX.Element;
923
+ readonly toggleContents: import("react/jsx-runtime").JSX.Element;
924
924
  readonly selectorLabel: string;
925
925
  } & {
926
926
  getFetcher(location?: import("@jbrowse/core/util").UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-authentication",
3
- "version": "2.18.0",
3
+ "version": "3.0.0",
4
4
  "description": "JBrowse 2 Authentication",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "crypto-js": "^4.2.0",
40
- "generic-filehandle": "^3.0.0"
40
+ "generic-filehandle2": "^1.0.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@jbrowse/core": "^2.0.0",
@@ -55,5 +55,5 @@
55
55
  "distModule": "esm/index.js",
56
56
  "srcModule": "src/index.ts",
57
57
  "module": "esm/index.js",
58
- "gitHead": "c344ea60099cb7e460b77f15808946b24a7eee74"
58
+ "gitHead": "2c6897f1fa732b1db5b094d1dca197e333e95319"
59
59
  }