@jbrowse/plugin-authentication 3.6.5 → 4.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 (85) hide show
  1. package/esm/DropboxOAuthModel/configSchema.d.ts +5 -5
  2. package/esm/DropboxOAuthModel/configSchema.js +1 -1
  3. package/esm/DropboxOAuthModel/index.d.ts +2 -2
  4. package/esm/DropboxOAuthModel/index.js +2 -2
  5. package/esm/DropboxOAuthModel/model.d.ts +18 -18
  6. package/esm/DropboxOAuthModel/model.js +5 -5
  7. package/esm/DropboxOAuthModel/util.js +1 -1
  8. package/esm/ExternalTokenModel/configSchema.d.ts +4 -4
  9. package/esm/ExternalTokenModel/index.d.ts +2 -2
  10. package/esm/ExternalTokenModel/index.js +2 -2
  11. package/esm/ExternalTokenModel/model.d.ts +13 -13
  12. package/esm/ExternalTokenModel/model.js +2 -2
  13. package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.js +1 -0
  14. package/esm/GoogleDriveOAuthModel/configSchema.d.ts +5 -5
  15. package/esm/GoogleDriveOAuthModel/configSchema.js +1 -1
  16. package/esm/GoogleDriveOAuthModel/index.d.ts +2 -2
  17. package/esm/GoogleDriveOAuthModel/index.js +2 -2
  18. package/esm/GoogleDriveOAuthModel/model.d.ts +19 -19
  19. package/esm/GoogleDriveOAuthModel/model.js +7 -7
  20. package/esm/GoogleDriveOAuthModel/util.js +1 -1
  21. package/esm/HTTPBasicModel/configSchema.d.ts +4 -4
  22. package/esm/HTTPBasicModel/index.d.ts +2 -2
  23. package/esm/HTTPBasicModel/index.js +2 -2
  24. package/esm/HTTPBasicModel/model.d.ts +13 -13
  25. package/esm/HTTPBasicModel/model.js +3 -3
  26. package/esm/OAuthModel/configSchema.d.ts +4 -4
  27. package/esm/OAuthModel/index.d.ts +2 -2
  28. package/esm/OAuthModel/index.js +2 -2
  29. package/esm/OAuthModel/model.d.ts +12 -12
  30. package/esm/OAuthModel/model.js +3 -3
  31. package/esm/OAuthModel/util.js +1 -2
  32. package/esm/index.d.ts +68 -68
  33. package/esm/index.js +23 -26
  34. package/esm/util.js +1 -1
  35. package/package.json +23 -30
  36. package/dist/DropboxOAuthModel/DropboxIcon.d.ts +0 -2
  37. package/dist/DropboxOAuthModel/DropboxIcon.js +0 -8
  38. package/dist/DropboxOAuthModel/configSchema.d.ts +0 -93
  39. package/dist/DropboxOAuthModel/configSchema.js +0 -42
  40. package/dist/DropboxOAuthModel/index.d.ts +0 -2
  41. package/dist/DropboxOAuthModel/index.js +0 -10
  42. package/dist/DropboxOAuthModel/model.d.ts +0 -279
  43. package/dist/DropboxOAuthModel/model.js +0 -65
  44. package/dist/DropboxOAuthModel/util.d.ts +0 -1
  45. package/dist/DropboxOAuthModel/util.js +0 -21
  46. package/dist/ExternalTokenModel/ExternalTokenEntryForm.d.ts +0 -4
  47. package/dist/ExternalTokenModel/ExternalTokenEntryForm.js +0 -24
  48. package/dist/ExternalTokenModel/configSchema.d.ts +0 -37
  49. package/dist/ExternalTokenModel/configSchema.js +0 -16
  50. package/dist/ExternalTokenModel/index.d.ts +0 -2
  51. package/dist/ExternalTokenModel/index.js +0 -10
  52. package/dist/ExternalTokenModel/model.d.ts +0 -126
  53. package/dist/ExternalTokenModel/model.js +0 -57
  54. package/dist/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +0 -15
  55. package/dist/GoogleDriveOAuthModel/GoogleDriveFilehandle.js +0 -19
  56. package/dist/GoogleDriveOAuthModel/GoogleDriveIcon.d.ts +0 -2
  57. package/dist/GoogleDriveOAuthModel/GoogleDriveIcon.js +0 -8
  58. package/dist/GoogleDriveOAuthModel/configSchema.d.ts +0 -93
  59. package/dist/GoogleDriveOAuthModel/configSchema.js +0 -34
  60. package/dist/GoogleDriveOAuthModel/index.d.ts +0 -2
  61. package/dist/GoogleDriveOAuthModel/index.js +0 -10
  62. package/dist/GoogleDriveOAuthModel/model.d.ts +0 -283
  63. package/dist/GoogleDriveOAuthModel/model.js +0 -72
  64. package/dist/GoogleDriveOAuthModel/util.d.ts +0 -1
  65. package/dist/GoogleDriveOAuthModel/util.js +0 -14
  66. package/dist/HTTPBasicModel/HTTPBasicLoginForm.d.ts +0 -4
  67. package/dist/HTTPBasicModel/HTTPBasicLoginForm.js +0 -32
  68. package/dist/HTTPBasicModel/configSchema.d.ts +0 -42
  69. package/dist/HTTPBasicModel/configSchema.js +0 -21
  70. package/dist/HTTPBasicModel/index.d.ts +0 -2
  71. package/dist/HTTPBasicModel/index.js +0 -10
  72. package/dist/HTTPBasicModel/model.d.ts +0 -131
  73. package/dist/HTTPBasicModel/model.js +0 -54
  74. package/dist/OAuthModel/configSchema.d.ts +0 -72
  75. package/dist/OAuthModel/configSchema.js +0 -51
  76. package/dist/OAuthModel/index.d.ts +0 -2
  77. package/dist/OAuthModel/index.js +0 -10
  78. package/dist/OAuthModel/model.d.ts +0 -182
  79. package/dist/OAuthModel/model.js +0 -289
  80. package/dist/OAuthModel/util.d.ts +0 -7
  81. package/dist/OAuthModel/util.js +0 -66
  82. package/dist/index.d.ts +0 -1026
  83. package/dist/index.js +0 -84
  84. package/dist/util.d.ts +0 -6
  85. package/dist/util.js +0 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-authentication",
3
- "version": "3.6.5",
3
+ "version": "4.0.0",
4
4
  "description": "JBrowse 2 Authentication",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -15,35 +15,17 @@
15
15
  "directory": "plugins/authentication"
16
16
  },
17
17
  "author": "JBrowse Team",
18
- "distMain": "dist/index.js",
19
- "srcMain": "src/index.ts",
20
- "main": "dist/index.js",
18
+ "main": "esm/index.js",
21
19
  "files": [
22
- "dist",
23
20
  "esm"
24
21
  ],
25
- "scripts": {
26
- "build": "npm-run-all build:*",
27
- "test": "cd ../..; jest --passWithNoTests plugins/authentication",
28
- "prepublishOnly": "yarn test",
29
- "prepack": "yarn build && yarn useDist",
30
- "postpack": "yarn useSrc",
31
- "useDist": "node ../../scripts/useDist.js",
32
- "useSrc": "node ../../scripts/useSrc.js",
33
- "prebuild": "npm run clean",
34
- "build:esm": "tsc --build tsconfig.build.esm.json",
35
- "build:commonjs": "tsc --build tsconfig.build.commonjs.json",
36
- "clean": "rimraf dist esm *.tsbuildinfo"
37
- },
38
22
  "dependencies": {
39
- "@jbrowse/core": "^3.6.5",
40
- "@mui/material": "^7.0.0",
23
+ "@jbrowse/mobx-state-tree": "^5.5.0",
24
+ "@mui/material": "^7.3.6",
41
25
  "crypto-js": "^4.2.0",
42
- "generic-filehandle2": "^2.0.1",
43
- "mobx": "^6.0.0",
44
- "mobx-react": "^9.0.0",
45
- "mobx-state-tree": "^5.0.0",
46
- "rxjs": "^7.0.0"
26
+ "generic-filehandle2": "^2.0.18",
27
+ "mobx": "^6.15.0",
28
+ "@jbrowse/core": "^4.0.0"
47
29
  },
48
30
  "peerDependencies": {
49
31
  "react": ">=18.0.0",
@@ -52,8 +34,19 @@
52
34
  "publishConfig": {
53
35
  "access": "public"
54
36
  },
55
- "distModule": "esm/index.js",
56
- "srcModule": "src/index.ts",
57
- "module": "esm/index.js",
58
- "gitHead": "354d0a87b757b4d84f824b47507662f6f3a1693f"
59
- }
37
+ "sideEffects": false,
38
+ "scripts": {
39
+ "build": "pnpm run /^build:/",
40
+ "test": "cd ../..; jest --passWithNoTests plugins/authentication",
41
+ "prebuild": "pnpm clean",
42
+ "build:esm": "tsc -p tsconfig.build.esm.json",
43
+ "clean": "rimraf esm *.tsbuildinfo"
44
+ },
45
+ "types": "esm/index.d.ts",
46
+ "exports": {
47
+ ".": {
48
+ "types": "./esm/index.d.ts",
49
+ "import": "./esm/index.js"
50
+ }
51
+ }
52
+ }
@@ -1,2 +0,0 @@
1
- import type { SvgIconProps } from '@mui/material';
2
- export default function DropboxIcon(props: SvgIconProps): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = DropboxIcon;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const material_1 = require("@mui/material");
6
- function DropboxIcon(props) {
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" }) }));
8
- }
@@ -1,93 +0,0 @@
1
- import type { Instance } from 'mobx-state-tree';
2
- declare const DropboxOAuthConfigSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
3
- authEndpoint: {
4
- description: string;
5
- type: string;
6
- defaultValue: string;
7
- };
8
- tokenEndpoint: {
9
- description: string;
10
- type: string;
11
- defaultValue: string;
12
- };
13
- needsPKCE: {
14
- description: string;
15
- type: string;
16
- defaultValue: boolean;
17
- };
18
- domains: {
19
- description: string;
20
- type: string;
21
- defaultValue: string[];
22
- };
23
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
24
- tokenType: {
25
- description: string;
26
- type: string;
27
- defaultValue: string;
28
- };
29
- authEndpoint: {
30
- description: string;
31
- type: string;
32
- defaultValue: string;
33
- };
34
- tokenEndpoint: {
35
- description: string;
36
- type: string;
37
- defaultValue: string;
38
- };
39
- needsPKCE: {
40
- description: string;
41
- type: string;
42
- defaultValue: boolean;
43
- };
44
- clientId: {
45
- description: string;
46
- type: string;
47
- defaultValue: string;
48
- };
49
- scopes: {
50
- description: string;
51
- type: string;
52
- defaultValue: string;
53
- };
54
- state: {
55
- description: string;
56
- type: string;
57
- defaultValue: string;
58
- };
59
- responseType: {
60
- description: string;
61
- type: string;
62
- defaultValue: string;
63
- };
64
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
65
- name: {
66
- description: string;
67
- type: string;
68
- defaultValue: string;
69
- };
70
- description: {
71
- description: string;
72
- type: string;
73
- defaultValue: string;
74
- };
75
- authHeader: {
76
- description: string;
77
- type: string;
78
- defaultValue: string;
79
- };
80
- tokenType: {
81
- description: string;
82
- type: string;
83
- defaultValue: string;
84
- };
85
- domains: {
86
- description: string;
87
- type: string;
88
- defaultValue: never[];
89
- };
90
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>, undefined>>;
91
- export type DropboxOAuthInternetAccountConfigModel = typeof DropboxOAuthConfigSchema;
92
- export type DropboxOAuthInternetAccountConfig = Instance<DropboxOAuthInternetAccountConfigModel>;
93
- export default DropboxOAuthConfigSchema;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const configuration_1 = require("@jbrowse/core/configuration");
7
- const configSchema_1 = __importDefault(require("../OAuthModel/configSchema"));
8
- function x() { }
9
- const DropboxOAuthConfigSchema = (0, configuration_1.ConfigurationSchema)('DropboxOAuthInternetAccount', {
10
- authEndpoint: {
11
- description: 'the authorization code endpoint of the internet account',
12
- type: 'string',
13
- defaultValue: 'https://www.dropbox.com/oauth2/authorize',
14
- },
15
- tokenEndpoint: {
16
- description: 'the token endpoint of the internet account',
17
- type: 'string',
18
- defaultValue: 'https://api.dropbox.com/oauth2/token',
19
- },
20
- needsPKCE: {
21
- description: 'boolean to indicate if the endpoint needs a PKCE code',
22
- type: 'boolean',
23
- defaultValue: true,
24
- },
25
- domains: {
26
- description: 'array of valid domains the url can contain to use this account',
27
- type: 'stringArray',
28
- defaultValue: [
29
- 'addtodropbox.com',
30
- 'db.tt',
31
- 'dropbox.com',
32
- 'dropboxapi.com',
33
- 'dropboxbusiness.com',
34
- 'dropbox.tech',
35
- 'getdropbox.com',
36
- ],
37
- },
38
- }, {
39
- baseConfiguration: configSchema_1.default,
40
- explicitlyTyped: true,
41
- });
42
- exports.default = DropboxOAuthConfigSchema;
@@ -1,2 +0,0 @@
1
- export { default as configSchema } from './configSchema';
2
- export { default as modelFactory } from './model';
@@ -1,10 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.modelFactory = exports.configSchema = void 0;
7
- var configSchema_1 = require("./configSchema");
8
- Object.defineProperty(exports, "configSchema", { enumerable: true, get: function () { return __importDefault(configSchema_1).default; } });
9
- var model_1 = require("./model");
10
- Object.defineProperty(exports, "modelFactory", { enumerable: true, get: function () { return __importDefault(model_1).default; } });
@@ -1,279 +0,0 @@
1
- import type { DropboxOAuthInternetAccountConfigModel } from './configSchema';
2
- import type { UriLocation } from '@jbrowse/core/util/types';
3
- import type { Instance } from 'mobx-state-tree';
4
- declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfigModel) => import("mobx-state-tree").IModelType<{
5
- id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
6
- type: import("mobx-state-tree").ISimpleType<string>;
7
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
8
- name: {
9
- description: string;
10
- type: string;
11
- defaultValue: string;
12
- };
13
- description: {
14
- description: string;
15
- type: string;
16
- defaultValue: string;
17
- };
18
- authHeader: {
19
- description: string;
20
- type: string;
21
- defaultValue: string;
22
- };
23
- tokenType: {
24
- description: string;
25
- type: string;
26
- defaultValue: string;
27
- };
28
- domains: {
29
- description: string;
30
- type: string;
31
- defaultValue: never[];
32
- };
33
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>;
34
- } & {
35
- type: import("mobx-state-tree").ISimpleType<"OAuthInternetAccount">;
36
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
37
- tokenType: {
38
- description: string;
39
- type: string;
40
- defaultValue: string;
41
- };
42
- authEndpoint: {
43
- description: string;
44
- type: string;
45
- defaultValue: string;
46
- };
47
- tokenEndpoint: {
48
- description: string;
49
- type: string;
50
- defaultValue: string;
51
- };
52
- needsPKCE: {
53
- description: string;
54
- type: string;
55
- defaultValue: boolean;
56
- };
57
- clientId: {
58
- description: string;
59
- type: string;
60
- defaultValue: string;
61
- };
62
- scopes: {
63
- description: string;
64
- type: string;
65
- defaultValue: string;
66
- };
67
- state: {
68
- description: string;
69
- type: string;
70
- defaultValue: string;
71
- };
72
- responseType: {
73
- description: string;
74
- type: string;
75
- defaultValue: string;
76
- };
77
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
78
- name: {
79
- description: string;
80
- type: string;
81
- defaultValue: string;
82
- };
83
- description: {
84
- description: string;
85
- type: string;
86
- defaultValue: string;
87
- };
88
- authHeader: {
89
- description: string;
90
- type: string;
91
- defaultValue: string;
92
- };
93
- tokenType: {
94
- description: string;
95
- type: string;
96
- defaultValue: string;
97
- };
98
- domains: {
99
- description: string;
100
- type: string;
101
- defaultValue: never[];
102
- };
103
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>;
104
- } & {
105
- type: import("mobx-state-tree").ISimpleType<"DropboxOAuthInternetAccount">;
106
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
107
- authEndpoint: {
108
- description: string;
109
- type: string;
110
- defaultValue: string;
111
- };
112
- tokenEndpoint: {
113
- description: string;
114
- type: string;
115
- defaultValue: string;
116
- };
117
- needsPKCE: {
118
- description: string;
119
- type: string;
120
- defaultValue: boolean;
121
- };
122
- domains: {
123
- description: string;
124
- type: string;
125
- defaultValue: string[];
126
- };
127
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
128
- tokenType: {
129
- description: string;
130
- type: string;
131
- defaultValue: string;
132
- };
133
- authEndpoint: {
134
- description: string;
135
- type: string;
136
- defaultValue: string;
137
- };
138
- tokenEndpoint: {
139
- description: string;
140
- type: string;
141
- defaultValue: string;
142
- };
143
- needsPKCE: {
144
- description: string;
145
- type: string;
146
- defaultValue: boolean;
147
- };
148
- clientId: {
149
- description: string;
150
- type: string;
151
- defaultValue: string;
152
- };
153
- scopes: {
154
- description: string;
155
- type: string;
156
- defaultValue: string;
157
- };
158
- state: {
159
- description: string;
160
- type: string;
161
- defaultValue: string;
162
- };
163
- responseType: {
164
- description: string;
165
- type: string;
166
- defaultValue: string;
167
- };
168
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
169
- name: {
170
- description: string;
171
- type: string;
172
- defaultValue: string;
173
- };
174
- description: {
175
- description: string;
176
- type: string;
177
- defaultValue: string;
178
- };
179
- authHeader: {
180
- description: string;
181
- type: string;
182
- defaultValue: string;
183
- };
184
- tokenType: {
185
- description: string;
186
- type: string;
187
- defaultValue: string;
188
- };
189
- domains: {
190
- description: string;
191
- type: string;
192
- defaultValue: never[];
193
- };
194
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>, undefined>>;
195
- }, {
196
- readonly name: string;
197
- readonly description: string;
198
- readonly internetAccountId: string;
199
- readonly authHeader: string;
200
- readonly tokenType: string;
201
- readonly domains: string[];
202
- readonly toggleContents: React.ReactNode;
203
- readonly SelectorComponent: import("@jbrowse/core/util/types").AnyReactComponentType | undefined;
204
- readonly selectorLabel: string | undefined;
205
- } & {
206
- handlesLocation(location: UriLocation): boolean;
207
- readonly tokenKey: string;
208
- } & {
209
- getTokenFromUser(_resolve: (token: string) => void, _reject: (error: Error) => void): void;
210
- storeToken(token: string): void;
211
- removeToken(): void;
212
- retrieveToken(): string | null;
213
- validateToken(token: string, _loc: UriLocation): Promise<string>;
214
- } & {
215
- getToken(location?: UriLocation): Promise<string>;
216
- } & {
217
- addAuthHeaderToInit(init?: RequestInit, token?: string): {
218
- headers: Headers;
219
- body?: BodyInit | null;
220
- cache?: RequestCache;
221
- credentials?: RequestCredentials;
222
- integrity?: string;
223
- keepalive?: boolean;
224
- method?: string;
225
- mode?: RequestMode;
226
- priority?: RequestPriority;
227
- redirect?: RequestRedirect;
228
- referrer?: string;
229
- referrerPolicy?: ReferrerPolicy;
230
- signal?: AbortSignal | null;
231
- window?: null;
232
- };
233
- getPreAuthorizationInformation(location: UriLocation): Promise<{
234
- internetAccountType: string;
235
- authInfo: {
236
- token: string;
237
- configuration: any;
238
- };
239
- }>;
240
- } & {
241
- getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
242
- } & {
243
- openLocation(location: UriLocation): import("@jbrowse/core/util/io").RemoteFileWithRangeCache;
244
- } & {
245
- readonly codeVerifierPKCE: string;
246
- } & {
247
- readonly authEndpoint: string;
248
- readonly tokenEndpoint: string;
249
- readonly needsPKCE: boolean;
250
- readonly clientId: string;
251
- readonly scopes: string;
252
- state(): string | undefined;
253
- readonly responseType: "token" | "code";
254
- readonly refreshTokenKey: string;
255
- } & {
256
- storeRefreshToken(refreshToken: string): void;
257
- removeRefreshToken(): void;
258
- retrieveRefreshToken(): string | null;
259
- exchangeAuthorizationForAccessToken(token: string, redirectUri: string): Promise<string>;
260
- exchangeRefreshForAccessToken(refreshToken: string): Promise<string>;
261
- } & {
262
- addMessageChannel(resolve: (token: string) => void, reject: (error: Error) => void): void;
263
- deleteMessageChannel(): void;
264
- finishOAuthWindow(event: MessageEvent, resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
265
- useEndpointForAuthorization(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
266
- getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
267
- validateToken(token: string, location: UriLocation): Promise<string>;
268
- } & {
269
- getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
270
- } & {
271
- readonly toggleContents: import("react/jsx-runtime").JSX.Element;
272
- readonly selectorLabel: string;
273
- } & {
274
- getFetcher(location?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
275
- validateToken(token: string, location: UriLocation): Promise<string>;
276
- }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
277
- export default stateModelFactory;
278
- export type DropboxOAuthStateModel = ReturnType<typeof stateModelFactory>;
279
- export type DropboxOAuthModel = Instance<DropboxOAuthStateModel>;
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const configuration_1 = require("@jbrowse/core/configuration");
8
- const mobx_state_tree_1 = require("mobx-state-tree");
9
- const OAuthModel_1 = require("../OAuthModel");
10
- const DropboxIcon_1 = __importDefault(require("./DropboxIcon"));
11
- const util_1 = require("./util");
12
- const model_1 = __importDefault(require("../OAuthModel/model"));
13
- const stateModelFactory = (configSchema) => {
14
- return (0, model_1.default)(OAuthModel_1.configSchema)
15
- .named('DropboxOAuthInternetAccount')
16
- .props({
17
- type: mobx_state_tree_1.types.literal('DropboxOAuthInternetAccount'),
18
- configuration: (0, configuration_1.ConfigurationReference)(configSchema),
19
- })
20
- .views(() => ({
21
- get toggleContents() {
22
- return (0, jsx_runtime_1.jsx)(DropboxIcon_1.default, {});
23
- },
24
- get selectorLabel() {
25
- return 'Enter Dropbox share link';
26
- },
27
- }))
28
- .actions(self => ({
29
- getFetcher(location) {
30
- return async (input, init) => {
31
- const authToken = await self.getToken(location);
32
- const newInit = self.addAuthHeaderToInit({ ...init, method: 'POST' }, authToken);
33
- newInit.headers.append('Dropbox-API-Arg', JSON.stringify({ url: input }));
34
- const response = await fetch('https://content.dropboxapi.com/2/sharing/get_shared_link_file', newInit);
35
- if (!response.ok) {
36
- throw new Error(await (0, util_1.getDescriptiveErrorMessage)(response));
37
- }
38
- return response;
39
- };
40
- },
41
- async validateToken(token, location) {
42
- const response = await fetch('https://api.dropboxapi.com/2/sharing/get_shared_link_metadata', {
43
- method: 'POST',
44
- headers: {
45
- Authorization: `Bearer ${token}`,
46
- 'Content-Type': 'application/json',
47
- },
48
- body: JSON.stringify({
49
- url: location.uri,
50
- }),
51
- });
52
- if (!response.ok) {
53
- const refreshToken = self.retrieveRefreshToken();
54
- if (refreshToken) {
55
- self.removeRefreshToken();
56
- const newToken = await self.exchangeRefreshForAccessToken(refreshToken);
57
- return this.validateToken(newToken, location);
58
- }
59
- throw new Error(await (0, util_1.getDescriptiveErrorMessage)(response, 'Token could not be validated'));
60
- }
61
- return token;
62
- },
63
- }));
64
- };
65
- exports.default = stateModelFactory;
@@ -1 +0,0 @@
1
- export declare function getDescriptiveErrorMessage(response: Response, reason?: string): Promise<string>;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDescriptiveErrorMessage = getDescriptiveErrorMessage;
4
- const util_1 = require("../util");
5
- const dropboxErrorMessages = {
6
- shared_link_not_found: "The shared link wasn't found.",
7
- shared_link_access_denied: 'The caller is not allowed to access this shared link.',
8
- unsupported_link_type: 'This type of link is not supported; use files/export instead.',
9
- shared_link_is_directory: 'Directories cannot be retrieved by this endpoint.',
10
- };
11
- async function getDescriptiveErrorMessage(response, reason) {
12
- let errorMessage = '';
13
- try {
14
- const err = JSON.parse(await response.text());
15
- const tag = err.error['.tag'];
16
- errorMessage = dropboxErrorMessages[tag] || tag;
17
- }
18
- catch (error) {
19
- }
20
- return (0, util_1.getResponseError)({ response, reason, statusText: errorMessage });
21
- }
@@ -1,4 +0,0 @@
1
- export declare const ExternalTokenEntryForm: ({ internetAccountId, handleClose, }: {
2
- internetAccountId: string;
3
- handleClose: (token?: string) => void;
4
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExternalTokenEntryForm = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const ui_1 = require("@jbrowse/core/ui");
7
- const material_1 = require("@mui/material");
8
- const ExternalTokenEntryForm = ({ internetAccountId, handleClose, }) => {
9
- const [token, setToken] = (0, react_1.useState)('');
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" })] })] }));
23
- };
24
- exports.ExternalTokenEntryForm = ExternalTokenEntryForm;
@@ -1,37 +0,0 @@
1
- import type { Instance } from 'mobx-state-tree';
2
- declare const ExternalTokenConfigSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
3
- validateWithHEAD: {
4
- description: string;
5
- type: string;
6
- defaultValue: boolean;
7
- };
8
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
9
- name: {
10
- description: string;
11
- type: string;
12
- defaultValue: string;
13
- };
14
- description: {
15
- description: string;
16
- type: string;
17
- defaultValue: string;
18
- };
19
- authHeader: {
20
- description: string;
21
- type: string;
22
- defaultValue: string;
23
- };
24
- tokenType: {
25
- description: string;
26
- type: string;
27
- defaultValue: string;
28
- };
29
- domains: {
30
- description: string;
31
- type: string;
32
- defaultValue: never[];
33
- };
34
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>;
35
- export type ExternalTokenInternetAccountConfigModel = typeof ExternalTokenConfigSchema;
36
- export type ExternalTokenInternetAccountConfig = Instance<ExternalTokenInternetAccountConfigModel>;
37
- export default ExternalTokenConfigSchema;