@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.
- package/dist/DropboxOAuthModel/DropboxIcon.d.ts +1 -1
- package/dist/DropboxOAuthModel/configSchema.d.ts +1 -13
- package/dist/DropboxOAuthModel/configSchema.js +1 -19
- package/dist/DropboxOAuthModel/model.d.ts +3 -25
- package/dist/DropboxOAuthModel/model.js +2 -24
- package/dist/DropboxOAuthModel/util.js +0 -5
- package/dist/ExternalTokenModel/ExternalTokenEntryForm.js +8 -4
- package/dist/ExternalTokenModel/configSchema.d.ts +1 -4
- package/dist/ExternalTokenModel/configSchema.js +1 -10
- package/dist/ExternalTokenModel/model.d.ts +3 -3
- package/dist/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +1 -1
- package/dist/GoogleDriveOAuthModel/GoogleDriveIcon.d.ts +1 -1
- package/dist/GoogleDriveOAuthModel/configSchema.d.ts +1 -13
- package/dist/GoogleDriveOAuthModel/configSchema.js +1 -19
- package/dist/GoogleDriveOAuthModel/model.d.ts +3 -28
- package/dist/GoogleDriveOAuthModel/model.js +2 -27
- package/dist/GoogleDriveOAuthModel/util.js +0 -1
- package/dist/HTTPBasicModel/HTTPBasicLoginForm.js +12 -6
- package/dist/HTTPBasicModel/configSchema.d.ts +1 -7
- package/dist/HTTPBasicModel/configSchema.js +1 -13
- package/dist/HTTPBasicModel/model.d.ts +3 -21
- package/dist/HTTPBasicModel/model.js +0 -18
- package/dist/OAuthModel/configSchema.d.ts +1 -25
- package/dist/OAuthModel/configSchema.js +1 -31
- package/dist/OAuthModel/model.d.ts +3 -89
- package/dist/OAuthModel/model.js +1 -96
- package/dist/OAuthModel/util.js +0 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/esm/DropboxOAuthModel/DropboxIcon.d.ts +1 -1
- package/esm/DropboxOAuthModel/configSchema.d.ts +1 -13
- package/esm/DropboxOAuthModel/configSchema.js +1 -19
- package/esm/DropboxOAuthModel/model.d.ts +3 -25
- package/esm/DropboxOAuthModel/model.js +2 -24
- package/esm/DropboxOAuthModel/util.js +0 -5
- package/esm/ExternalTokenModel/ExternalTokenEntryForm.js +8 -4
- package/esm/ExternalTokenModel/configSchema.d.ts +1 -4
- package/esm/ExternalTokenModel/configSchema.js +1 -10
- package/esm/ExternalTokenModel/model.d.ts +3 -3
- package/esm/ExternalTokenModel/model.js +1 -1
- package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +1 -1
- package/esm/GoogleDriveOAuthModel/GoogleDriveIcon.d.ts +1 -1
- package/esm/GoogleDriveOAuthModel/configSchema.d.ts +1 -13
- package/esm/GoogleDriveOAuthModel/configSchema.js +1 -19
- package/esm/GoogleDriveOAuthModel/model.d.ts +3 -28
- package/esm/GoogleDriveOAuthModel/model.js +2 -27
- package/esm/GoogleDriveOAuthModel/util.js +0 -1
- package/esm/HTTPBasicModel/HTTPBasicLoginForm.js +12 -6
- package/esm/HTTPBasicModel/configSchema.d.ts +1 -7
- package/esm/HTTPBasicModel/configSchema.js +1 -13
- package/esm/HTTPBasicModel/model.d.ts +3 -21
- package/esm/HTTPBasicModel/model.js +1 -19
- package/esm/OAuthModel/configSchema.d.ts +1 -25
- package/esm/OAuthModel/configSchema.js +1 -31
- package/esm/OAuthModel/model.d.ts +3 -89
- package/esm/OAuthModel/model.js +1 -96
- package/esm/OAuthModel/util.js +0 -2
- package/esm/index.d.ts +1 -1
- package/esm/index.js +3 -3
- package/package.json +2 -2
|
@@ -1,37 +1,22 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
2
|
import OAuthConfigSchema from '../OAuthModel/configSchema';
|
|
3
|
-
|
|
4
|
-
* #config DropboxOAuthInternetAccount
|
|
5
|
-
*/
|
|
6
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
function x() { }
|
|
7
4
|
const DropboxOAuthConfigSchema = ConfigurationSchema('DropboxOAuthInternetAccount', {
|
|
8
|
-
/**
|
|
9
|
-
* #slot
|
|
10
|
-
*/
|
|
11
5
|
authEndpoint: {
|
|
12
6
|
description: 'the authorization code endpoint of the internet account',
|
|
13
7
|
type: 'string',
|
|
14
8
|
defaultValue: 'https://www.dropbox.com/oauth2/authorize',
|
|
15
9
|
},
|
|
16
|
-
/**
|
|
17
|
-
* #slot
|
|
18
|
-
*/
|
|
19
10
|
tokenEndpoint: {
|
|
20
11
|
description: 'the token endpoint of the internet account',
|
|
21
12
|
type: 'string',
|
|
22
13
|
defaultValue: 'https://api.dropbox.com/oauth2/token',
|
|
23
14
|
},
|
|
24
|
-
/**
|
|
25
|
-
* #slot
|
|
26
|
-
*/
|
|
27
15
|
needsPKCE: {
|
|
28
16
|
description: 'boolean to indicate if the endpoint needs a PKCE code',
|
|
29
17
|
type: 'boolean',
|
|
30
18
|
defaultValue: true,
|
|
31
19
|
},
|
|
32
|
-
/**
|
|
33
|
-
* #slot
|
|
34
|
-
*/
|
|
35
20
|
domains: {
|
|
36
21
|
description: 'array of valid domains the url can contain to use this account',
|
|
37
22
|
type: 'stringArray',
|
|
@@ -46,9 +31,6 @@ const DropboxOAuthConfigSchema = ConfigurationSchema('DropboxOAuthInternetAccoun
|
|
|
46
31
|
],
|
|
47
32
|
},
|
|
48
33
|
}, {
|
|
49
|
-
/**
|
|
50
|
-
* #baseConfiguration
|
|
51
|
-
*/
|
|
52
34
|
baseConfiguration: OAuthConfigSchema,
|
|
53
35
|
explicitlyTyped: true,
|
|
54
36
|
});
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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;
|
|
@@ -1,45 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ConfigurationReference } from '@jbrowse/core/configuration';
|
|
3
3
|
import { types } from 'mobx-state-tree';
|
|
4
|
-
import baseModel from '../OAuthModel/model';
|
|
5
4
|
import { configSchema as OAuthConfigSchema } from '../OAuthModel';
|
|
6
|
-
import { getDescriptiveErrorMessage } from './util';
|
|
7
5
|
import DropboxIcon from './DropboxIcon';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
6
|
+
import { getDescriptiveErrorMessage } from './util';
|
|
7
|
+
import baseModel from '../OAuthModel/model';
|
|
11
8
|
const stateModelFactory = (configSchema) => {
|
|
12
9
|
return baseModel(OAuthConfigSchema)
|
|
13
10
|
.named('DropboxOAuthInternetAccount')
|
|
14
11
|
.props({
|
|
15
|
-
/**
|
|
16
|
-
* #property
|
|
17
|
-
*/
|
|
18
12
|
type: types.literal('DropboxOAuthInternetAccount'),
|
|
19
|
-
/**
|
|
20
|
-
* #property
|
|
21
|
-
*/
|
|
22
13
|
configuration: ConfigurationReference(configSchema),
|
|
23
14
|
})
|
|
24
15
|
.views(() => ({
|
|
25
|
-
/**
|
|
26
|
-
* #getter
|
|
27
|
-
* The FileSelector icon for Dropbox
|
|
28
|
-
*/
|
|
29
16
|
get toggleContents() {
|
|
30
17
|
return React.createElement(DropboxIcon, null);
|
|
31
18
|
},
|
|
32
|
-
/**
|
|
33
|
-
* #getter
|
|
34
|
-
*/
|
|
35
19
|
get selectorLabel() {
|
|
36
20
|
return 'Enter Dropbox share link';
|
|
37
21
|
},
|
|
38
22
|
}))
|
|
39
23
|
.actions(self => ({
|
|
40
|
-
/**
|
|
41
|
-
* #method
|
|
42
|
-
*/
|
|
43
24
|
getFetcher(location) {
|
|
44
25
|
return async (input, init) => {
|
|
45
26
|
const authToken = await self.getToken(location);
|
|
@@ -52,9 +33,6 @@ const stateModelFactory = (configSchema) => {
|
|
|
52
33
|
return response;
|
|
53
34
|
};
|
|
54
35
|
},
|
|
55
|
-
/**
|
|
56
|
-
* #action
|
|
57
|
-
*/
|
|
58
36
|
async validateToken(token, location) {
|
|
59
37
|
const response = await fetch('https://api.dropboxapi.com/2/sharing/get_shared_link_metadata', {
|
|
60
38
|
method: 'POST',
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { getResponseError } from '../util';
|
|
2
|
-
/**
|
|
3
|
-
* Error messages from
|
|
4
|
-
* https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file
|
|
5
|
-
* */
|
|
6
2
|
const dropboxErrorMessages = {
|
|
7
3
|
shared_link_not_found: "The shared link wasn't found.",
|
|
8
4
|
shared_link_access_denied: 'The caller is not allowed to access this shared link.',
|
|
@@ -17,7 +13,6 @@ export async function getDescriptiveErrorMessage(response, reason) {
|
|
|
17
13
|
errorMessage = dropboxErrorMessages[tag] || tag;
|
|
18
14
|
}
|
|
19
15
|
catch (error) {
|
|
20
|
-
/* do nothing */
|
|
21
16
|
}
|
|
22
17
|
return getResponseError({ response, reason, statusText: errorMessage });
|
|
23
18
|
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Button, DialogContent, DialogActions, TextField } from '@mui/material';
|
|
3
2
|
import { Dialog } from '@jbrowse/core/ui';
|
|
3
|
+
import { Button, DialogActions, DialogContent, TextField } from '@mui/material';
|
|
4
4
|
export const ExternalTokenEntryForm = ({ internetAccountId, handleClose, }) => {
|
|
5
5
|
const [token, setToken] = useState('');
|
|
6
|
-
return (React.createElement(Dialog, { open: true, maxWidth: "xl", "data-testid": "externalToken-form",
|
|
6
|
+
return (React.createElement(Dialog, { open: true, maxWidth: "xl", "data-testid": "externalToken-form", onClose: () => {
|
|
7
|
+
handleClose();
|
|
8
|
+
}, title: `Enter token for ${internetAccountId}` },
|
|
7
9
|
React.createElement(DialogContent, { style: { display: 'flex', flexDirection: 'column' } },
|
|
8
|
-
React.createElement(TextField, { required: true, label: "Enter Token", variant: "outlined",
|
|
10
|
+
React.createElement(TextField, { required: true, label: "Enter Token", variant: "outlined", onChange: event => {
|
|
9
11
|
setToken(event.target.value);
|
|
10
|
-
}, margin: "dense"
|
|
12
|
+
}, margin: "dense", slotProps: {
|
|
13
|
+
htmlInput: { 'data-testid': 'entry-externalToken' },
|
|
14
|
+
} })),
|
|
11
15
|
React.createElement(DialogActions, null,
|
|
12
16
|
React.createElement(Button, { variant: "contained", color: "primary", type: "submit", disabled: !token, onClick: () => {
|
|
13
17
|
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;
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
2
|
import { BaseInternetAccountConfig } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
|
-
|
|
4
|
-
* #config ExternalTokenInternetAccount
|
|
5
|
-
*/
|
|
6
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
function x() { }
|
|
7
4
|
const ExternalTokenConfigSchema = ConfigurationSchema('ExternalTokenInternetAccount', {
|
|
8
|
-
/**
|
|
9
|
-
* #slot
|
|
10
|
-
*/
|
|
11
5
|
validateWithHEAD: {
|
|
12
6
|
description: 'validate the token with a HEAD request before using it',
|
|
13
7
|
type: 'boolean',
|
|
14
8
|
defaultValue: true,
|
|
15
9
|
},
|
|
16
10
|
}, {
|
|
17
|
-
/**
|
|
18
|
-
* #baseConfiguration
|
|
19
|
-
*/
|
|
20
11
|
baseConfiguration: BaseInternetAccountConfig,
|
|
21
12
|
explicitlyTyped: true,
|
|
22
13
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import { ConfigurationReference, getConf } from '@jbrowse/core/configuration';
|
|
2
2
|
import { InternetAccount } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
|
-
import {
|
|
3
|
+
import { getRoot, types } from 'mobx-state-tree';
|
|
4
4
|
import { ExternalTokenEntryForm } from './ExternalTokenEntryForm';
|
|
5
5
|
const stateModelFactory = (configSchema) => {
|
|
6
6
|
return InternetAccount.named('ExternalTokenInternetAccount')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RemoteFileWithRangeCache } from '@jbrowse/core/util/io';
|
|
2
|
-
import { FilehandleOptions,
|
|
2
|
+
import type { FilehandleOptions, PolyfilledResponse, Stats } from 'generic-filehandle';
|
|
3
3
|
export interface RequestInitWithMetadata extends RequestInit {
|
|
4
4
|
metadataOnly?: boolean;
|
|
5
5
|
}
|
|
@@ -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;
|
|
@@ -1,46 +1,28 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
2
|
import OAuthConfigSchema from '../OAuthModel/configSchema';
|
|
3
|
-
|
|
4
|
-
* #config GoogleDriveOAuthInternetAccount
|
|
5
|
-
*/
|
|
6
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
function x() { }
|
|
7
4
|
const GoogleDriveOAuthConfigSchema = ConfigurationSchema('GoogleDriveOAuthInternetAccount', {
|
|
8
|
-
/**
|
|
9
|
-
* #slot
|
|
10
|
-
*/
|
|
11
5
|
authEndpoint: {
|
|
12
6
|
description: 'the authorization code endpoint of the internet account',
|
|
13
7
|
type: 'string',
|
|
14
8
|
defaultValue: 'https://accounts.google.com/o/oauth2/v2/auth',
|
|
15
9
|
},
|
|
16
|
-
/**
|
|
17
|
-
* #slot
|
|
18
|
-
*/
|
|
19
10
|
scopes: {
|
|
20
11
|
description: 'optional scopes for the authorization call',
|
|
21
12
|
type: 'string',
|
|
22
13
|
defaultValue: 'https://www.googleapis.com/auth/drive.readonly',
|
|
23
14
|
},
|
|
24
|
-
/**
|
|
25
|
-
* #slot
|
|
26
|
-
*/
|
|
27
15
|
domains: {
|
|
28
16
|
description: 'array of valid domains the url can contain to use this account',
|
|
29
17
|
type: 'stringArray',
|
|
30
18
|
defaultValue: ['drive.google.com"'],
|
|
31
19
|
},
|
|
32
|
-
/**
|
|
33
|
-
* #slot
|
|
34
|
-
*/
|
|
35
20
|
responseType: {
|
|
36
21
|
description: 'the type of response from the authorization endpoint',
|
|
37
22
|
type: 'string',
|
|
38
23
|
defaultValue: 'token',
|
|
39
24
|
},
|
|
40
25
|
}, {
|
|
41
|
-
/**
|
|
42
|
-
* #baseConfiguration
|
|
43
|
-
*/
|
|
44
26
|
baseConfiguration: OAuthConfigSchema,
|
|
45
27
|
explicitlyTyped: true,
|
|
46
28
|
});
|
|
@@ -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>;
|
|
@@ -1,50 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ConfigurationReference } from '@jbrowse/core/configuration';
|
|
3
3
|
import { types } from 'mobx-state-tree';
|
|
4
|
-
import baseModel from '../OAuthModel/model';
|
|
5
4
|
import { configSchema as OAuthConfigSchema } from '../OAuthModel';
|
|
6
|
-
import { getDescriptiveErrorMessage } from './util';
|
|
7
5
|
import { GoogleDriveFile } from './GoogleDriveFilehandle';
|
|
8
6
|
import GoogleDriveIcon from './GoogleDriveIcon';
|
|
7
|
+
import { getDescriptiveErrorMessage } from './util';
|
|
8
|
+
import baseModel from '../OAuthModel/model';
|
|
9
9
|
function getUri(str) {
|
|
10
10
|
const urlId = /[-\w]{25,}/.exec(str);
|
|
11
11
|
return `https://www.googleapis.com/drive/v3/files/${urlId}`;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
14
|
-
* #stateModel GoogleDriveOAuthInternetAccount
|
|
15
|
-
*/
|
|
16
13
|
export default function stateModelFactory(configSchema) {
|
|
17
14
|
return baseModel(OAuthConfigSchema)
|
|
18
15
|
.named('GoogleDriveOAuthInternetAccount')
|
|
19
16
|
.props({
|
|
20
|
-
/**
|
|
21
|
-
* #property
|
|
22
|
-
*/
|
|
23
17
|
type: types.literal('GoogleDriveOAuthInternetAccount'),
|
|
24
|
-
/**
|
|
25
|
-
* #property
|
|
26
|
-
*/
|
|
27
18
|
configuration: ConfigurationReference(configSchema),
|
|
28
19
|
})
|
|
29
20
|
.views(() => ({
|
|
30
|
-
/**
|
|
31
|
-
* #getter
|
|
32
|
-
* The FileSelector icon for Google drive
|
|
33
|
-
*/
|
|
34
21
|
get toggleContents() {
|
|
35
22
|
return React.createElement(GoogleDriveIcon, null);
|
|
36
23
|
},
|
|
37
|
-
/**
|
|
38
|
-
* #getter
|
|
39
|
-
*/
|
|
40
24
|
get selectorLabel() {
|
|
41
25
|
return 'Enter Google Drive 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 driveUrl = new URL(getUri(String(input)));
|
|
@@ -64,17 +45,11 @@ export default function stateModelFactory(configSchema) {
|
|
|
64
45
|
return response;
|
|
65
46
|
};
|
|
66
47
|
},
|
|
67
|
-
/**
|
|
68
|
-
* #method
|
|
69
|
-
*/
|
|
70
48
|
openLocation(location) {
|
|
71
49
|
return new GoogleDriveFile(location.uri, {
|
|
72
50
|
fetch: this.getFetcher(location),
|
|
73
51
|
});
|
|
74
52
|
},
|
|
75
|
-
/**
|
|
76
|
-
* #action
|
|
77
|
-
*/
|
|
78
53
|
async validateToken(token, location) {
|
|
79
54
|
const response = await fetch(getUri(location.uri), {
|
|
80
55
|
headers: {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Button, DialogContent, DialogActions, TextField } from '@mui/material';
|
|
3
2
|
import { Dialog } from '@jbrowse/core/ui';
|
|
3
|
+
import { Button, DialogActions, DialogContent, TextField } from '@mui/material';
|
|
4
4
|
export function HTTPBasicLoginForm({ internetAccountId, handleClose, }) {
|
|
5
5
|
const [username, setUsername] = useState('');
|
|
6
6
|
const [password, setPassword] = useState('');
|
|
7
|
-
return (React.createElement(Dialog, { open: true, maxWidth: "xl", "data-testid": "login-httpbasic", title: `Log in for ${internetAccountId}
|
|
7
|
+
return (React.createElement(Dialog, { open: true, maxWidth: "xl", "data-testid": "login-httpbasic", title: `Log in for ${internetAccountId}`, onClose: () => {
|
|
8
|
+
handleClose();
|
|
9
|
+
} },
|
|
8
10
|
React.createElement("form", { onSubmit: event => {
|
|
9
11
|
if (username && password) {
|
|
10
12
|
handleClose(btoa(`${username}:${password}`));
|
|
@@ -15,12 +17,16 @@ export function HTTPBasicLoginForm({ internetAccountId, handleClose, }) {
|
|
|
15
17
|
event.preventDefault();
|
|
16
18
|
} },
|
|
17
19
|
React.createElement(DialogContent, { style: { display: 'flex', flexDirection: 'column' } },
|
|
18
|
-
React.createElement(TextField, { required: true, label: "Username", variant: "outlined",
|
|
20
|
+
React.createElement(TextField, { required: true, label: "Username", variant: "outlined", onChange: event => {
|
|
19
21
|
setUsername(event.target.value);
|
|
20
|
-
}, margin: "dense"
|
|
21
|
-
|
|
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 => {
|
|
22
26
|
setPassword(event.target.value);
|
|
23
|
-
}, margin: "dense"
|
|
27
|
+
}, margin: "dense", slotProps: {
|
|
28
|
+
htmlInput: { 'data-testid': 'login-httpbasic-password' },
|
|
29
|
+
} })),
|
|
24
30
|
React.createElement(DialogActions, null,
|
|
25
31
|
React.createElement(Button, { variant: "contained", color: "primary", type: "submit" }, "Submit"),
|
|
26
32
|
React.createElement(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;
|
|
@@ -1,30 +1,18 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
2
|
import { BaseInternetAccountConfig } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
|
-
|
|
4
|
-
* #config HTTPBasicInternetAccount
|
|
5
|
-
*/
|
|
6
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
function x() { }
|
|
7
4
|
const HTTPBasicConfigSchema = ConfigurationSchema('HTTPBasicInternetAccount', {
|
|
8
|
-
/**
|
|
9
|
-
* #slot
|
|
10
|
-
*/
|
|
11
5
|
tokenType: {
|
|
12
6
|
description: 'a custom name for a token to include in the header',
|
|
13
7
|
type: 'string',
|
|
14
8
|
defaultValue: 'Basic',
|
|
15
9
|
},
|
|
16
|
-
/**
|
|
17
|
-
* #slot
|
|
18
|
-
*/
|
|
19
10
|
validateWithHEAD: {
|
|
20
11
|
description: 'validate the token with a HEAD request before using it',
|
|
21
12
|
type: 'boolean',
|
|
22
13
|
defaultValue: true,
|
|
23
14
|
},
|
|
24
15
|
}, {
|
|
25
|
-
/**
|
|
26
|
-
* #baseConfiguration
|
|
27
|
-
*/
|
|
28
16
|
baseConfiguration: BaseInternetAccountConfig,
|
|
29
17
|
explicitlyTyped: true,
|
|
30
18
|
});
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
/**
|
|
5
|
-
* #stateModel HTTPBasicInternetAccount
|
|
6
|
-
*/
|
|
1
|
+
import type { HTTPBasicInternetAccountConfigModel } from './configSchema';
|
|
2
|
+
import type { UriLocation } from '@jbrowse/core/util/types';
|
|
3
|
+
import type { Instance } from 'mobx-state-tree';
|
|
7
4
|
declare const stateModelFactory: (configSchema: HTTPBasicInternetAccountConfigModel) => import("mobx-state-tree").IModelType<{
|
|
8
5
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
9
6
|
type: import("mobx-state-tree").ISimpleType<string>;
|
|
@@ -35,13 +32,7 @@ declare const stateModelFactory: (configSchema: HTTPBasicInternetAccountConfigMo
|
|
|
35
32
|
};
|
|
36
33
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>;
|
|
37
34
|
} & {
|
|
38
|
-
/**
|
|
39
|
-
* #property
|
|
40
|
-
*/
|
|
41
35
|
type: import("mobx-state-tree").ISimpleType<"HTTPBasicInternetAccount">;
|
|
42
|
-
/**
|
|
43
|
-
* #property
|
|
44
|
-
*/
|
|
45
36
|
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
46
37
|
tokenType: {
|
|
47
38
|
description: string;
|
|
@@ -130,18 +121,9 @@ declare const stateModelFactory: (configSchema: HTTPBasicInternetAccountConfigMo
|
|
|
130
121
|
} & {
|
|
131
122
|
openLocation(location: UriLocation): import("@jbrowse/core/util/io").RemoteFileWithRangeCache;
|
|
132
123
|
} & {
|
|
133
|
-
/**
|
|
134
|
-
* #getter
|
|
135
|
-
*/
|
|
136
124
|
readonly validateWithHEAD: boolean;
|
|
137
125
|
} & {
|
|
138
|
-
/**
|
|
139
|
-
* #action
|
|
140
|
-
*/
|
|
141
126
|
getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): void;
|
|
142
|
-
/**
|
|
143
|
-
* #action
|
|
144
|
-
*/
|
|
145
127
|
validateToken(token: string, location: UriLocation): Promise<string>;
|
|
146
128
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
147
129
|
export default stateModelFactory;
|