@jbrowse/plugin-authentication 4.3.0 → 5.0.0-beta.10
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/esm/DropboxOAuthModel/DropboxIcon.d.ts +1 -1
- package/esm/DropboxOAuthModel/configSchema.d.ts +154 -48
- package/esm/DropboxOAuthModel/configSchema.js +32 -2
- package/esm/DropboxOAuthModel/index.js +2 -2
- package/esm/DropboxOAuthModel/model.d.ts +301 -127
- package/esm/DropboxOAuthModel/model.js +46 -21
- package/esm/DropboxOAuthModel/util.d.ts +1 -1
- package/esm/DropboxOAuthModel/util.js +9 -12
- package/esm/ExternalTokenModel/ExternalTokenEntryForm.d.ts +1 -1
- package/esm/ExternalTokenModel/ExternalTokenEntryForm.js +11 -15
- package/esm/ExternalTokenModel/configSchema.d.ts +80 -19
- package/esm/ExternalTokenModel/configSchema.js +22 -1
- package/esm/ExternalTokenModel/index.js +2 -2
- package/esm/ExternalTokenModel/model.d.ts +49 -63
- package/esm/ExternalTokenModel/model.js +11 -54
- package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +2 -9
- package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.js +27 -6
- package/esm/GoogleDriveOAuthModel/GoogleDriveIcon.d.ts +1 -1
- package/esm/GoogleDriveOAuthModel/configSchema.d.ts +152 -47
- package/esm/GoogleDriveOAuthModel/configSchema.js +32 -3
- package/esm/GoogleDriveOAuthModel/index.js +2 -2
- package/esm/GoogleDriveOAuthModel/model.d.ts +296 -128
- package/esm/GoogleDriveOAuthModel/model.js +45 -22
- package/esm/GoogleDriveOAuthModel/util.d.ts +1 -1
- package/esm/GoogleDriveOAuthModel/util.js +2 -11
- package/esm/HTTPBasicModel/HTTPBasicLoginForm.d.ts +1 -1
- package/esm/HTTPBasicModel/HTTPBasicLoginForm.js +17 -22
- package/esm/HTTPBasicModel/configSchema.d.ts +78 -21
- package/esm/HTTPBasicModel/configSchema.js +26 -1
- package/esm/HTTPBasicModel/index.js +2 -2
- package/esm/HTTPBasicModel/model.d.ts +57 -68
- package/esm/HTTPBasicModel/model.js +21 -51
- package/esm/OAuthModel/OAuthLoginPrompt.d.ts +4 -0
- package/esm/OAuthModel/OAuthLoginPrompt.js +12 -0
- package/esm/OAuthModel/configSchema.d.ts +81 -38
- package/esm/OAuthModel/configSchema.js +30 -1
- package/esm/OAuthModel/index.js +2 -2
- package/esm/OAuthModel/model.d.ts +231 -77
- package/esm/OAuthModel/model.js +361 -217
- package/esm/OAuthModel/util.d.ts +46 -7
- package/esm/OAuthModel/util.js +159 -16
- package/esm/index.d.ts +0 -1020
- package/esm/index.js +24 -57
- package/esm/lazyLoginForms.d.ts +18 -0
- package/esm/lazyLoginForms.js +25 -0
- package/esm/tokenEntryModelFactory.d.ts +135 -0
- package/esm/tokenEntryModelFactory.js +85 -0
- package/esm/util.d.ts +10 -0
- package/esm/util.js +24 -2
- package/package.json +10 -13
|
@@ -1,197 +1,346 @@
|
|
|
1
1
|
import type { DropboxOAuthInternetAccountConfigModel } from './configSchema.ts';
|
|
2
2
|
import type { UriLocation } from '@jbrowse/core/util/types';
|
|
3
3
|
import type { Instance } from '@jbrowse/mobx-state-tree';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* #stateModel DropboxOAuthInternetAccount
|
|
6
|
+
*/
|
|
7
|
+
declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfigModel) => import("@jbrowse/mobx-state-tree").IModelType<Omit<Omit<{
|
|
5
8
|
id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
6
9
|
type: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
7
|
-
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
8
|
-
name: {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
configuration: import("@jbrowse/core/configuration/configurationSchema").IConfigurationReference<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
11
|
+
readonly name: {
|
|
12
|
+
type: "string";
|
|
13
|
+
} & {
|
|
11
14
|
defaultValue: string;
|
|
12
15
|
};
|
|
13
|
-
description: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
readonly description: {
|
|
17
|
+
type: "string";
|
|
18
|
+
} & {
|
|
16
19
|
defaultValue: string;
|
|
17
20
|
};
|
|
18
|
-
authHeader: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
readonly authHeader: {
|
|
22
|
+
type: "string";
|
|
23
|
+
} & {
|
|
21
24
|
defaultValue: string;
|
|
22
25
|
};
|
|
23
|
-
tokenType: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
readonly tokenType: {
|
|
27
|
+
type: "string";
|
|
28
|
+
} & {
|
|
26
29
|
defaultValue: string;
|
|
27
30
|
};
|
|
28
|
-
domains: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
defaultValue:
|
|
31
|
+
readonly domains: {
|
|
32
|
+
type: "stringArray";
|
|
33
|
+
} & {
|
|
34
|
+
defaultValue: unknown;
|
|
32
35
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
37
|
-
tokenType: {
|
|
38
|
-
description: string;
|
|
39
|
-
type: string;
|
|
36
|
+
type: {
|
|
37
|
+
type: "string";
|
|
38
|
+
} & {
|
|
40
39
|
defaultValue: string;
|
|
41
40
|
};
|
|
41
|
+
internetAccountId: {
|
|
42
|
+
type: "string";
|
|
43
|
+
} & {
|
|
44
|
+
defaultValue: string;
|
|
45
|
+
};
|
|
46
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId", true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>;
|
|
47
|
+
}, "configuration" | "type"> & {
|
|
48
|
+
type: import("@jbrowse/mobx-state-tree").ILiteralType<"OAuthInternetAccount">;
|
|
49
|
+
configuration: import("@jbrowse/core/configuration/configurationSchema").IConfigurationReference<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
42
50
|
authEndpoint: {
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
type: "string";
|
|
52
|
+
} & {
|
|
45
53
|
defaultValue: string;
|
|
46
54
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
authHeader: {
|
|
56
|
+
type: "string";
|
|
57
|
+
} & {
|
|
58
|
+
defaultValue: string;
|
|
59
|
+
};
|
|
60
|
+
clientId: {
|
|
61
|
+
type: "string";
|
|
62
|
+
} & {
|
|
63
|
+
defaultValue: string;
|
|
64
|
+
};
|
|
65
|
+
description: {
|
|
66
|
+
type: "string";
|
|
67
|
+
} & {
|
|
68
|
+
defaultValue: string;
|
|
69
|
+
};
|
|
70
|
+
domains: {
|
|
71
|
+
type: "stringArray";
|
|
72
|
+
} & {
|
|
73
|
+
defaultValue: unknown;
|
|
74
|
+
};
|
|
75
|
+
internetAccountId: {
|
|
76
|
+
type: "string";
|
|
77
|
+
} & {
|
|
78
|
+
defaultValue: string;
|
|
79
|
+
};
|
|
80
|
+
name: {
|
|
81
|
+
type: "string";
|
|
82
|
+
} & {
|
|
50
83
|
defaultValue: string;
|
|
51
84
|
};
|
|
52
85
|
needsPKCE: {
|
|
53
|
-
|
|
54
|
-
|
|
86
|
+
type: "boolean";
|
|
87
|
+
} & {
|
|
55
88
|
defaultValue: boolean;
|
|
56
89
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
90
|
+
responseType: {
|
|
91
|
+
type: "string";
|
|
92
|
+
} & {
|
|
60
93
|
defaultValue: string;
|
|
61
94
|
};
|
|
62
95
|
scopes: {
|
|
63
|
-
|
|
64
|
-
|
|
96
|
+
type: "string";
|
|
97
|
+
} & {
|
|
65
98
|
defaultValue: string;
|
|
66
99
|
};
|
|
67
100
|
state: {
|
|
68
|
-
|
|
69
|
-
|
|
101
|
+
type: "string";
|
|
102
|
+
} & {
|
|
70
103
|
defaultValue: string;
|
|
71
104
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
105
|
+
tokenEndpoint: {
|
|
106
|
+
type: "string";
|
|
107
|
+
} & {
|
|
108
|
+
defaultValue: string;
|
|
109
|
+
};
|
|
110
|
+
tokenType: {
|
|
111
|
+
type: "string";
|
|
112
|
+
} & {
|
|
113
|
+
defaultValue: string;
|
|
114
|
+
};
|
|
115
|
+
type: {
|
|
116
|
+
type: "string";
|
|
117
|
+
} & {
|
|
75
118
|
defaultValue: string;
|
|
76
119
|
};
|
|
77
120
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
78
|
-
name: {
|
|
79
|
-
|
|
80
|
-
|
|
121
|
+
readonly name: {
|
|
122
|
+
type: "string";
|
|
123
|
+
} & {
|
|
81
124
|
defaultValue: string;
|
|
82
125
|
};
|
|
83
|
-
description: {
|
|
84
|
-
|
|
85
|
-
|
|
126
|
+
readonly description: {
|
|
127
|
+
type: "string";
|
|
128
|
+
} & {
|
|
129
|
+
defaultValue: string;
|
|
130
|
+
};
|
|
131
|
+
readonly authHeader: {
|
|
132
|
+
type: "string";
|
|
133
|
+
} & {
|
|
134
|
+
defaultValue: string;
|
|
135
|
+
};
|
|
136
|
+
readonly tokenType: {
|
|
137
|
+
type: "string";
|
|
138
|
+
} & {
|
|
139
|
+
defaultValue: string;
|
|
140
|
+
};
|
|
141
|
+
readonly domains: {
|
|
142
|
+
type: "stringArray";
|
|
143
|
+
} & {
|
|
144
|
+
defaultValue: unknown;
|
|
145
|
+
};
|
|
146
|
+
type: {
|
|
147
|
+
type: "string";
|
|
148
|
+
} & {
|
|
149
|
+
defaultValue: string;
|
|
150
|
+
};
|
|
151
|
+
internetAccountId: {
|
|
152
|
+
type: "string";
|
|
153
|
+
} & {
|
|
154
|
+
defaultValue: string;
|
|
155
|
+
};
|
|
156
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId", true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>, undefined, true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>;
|
|
157
|
+
}, "configuration" | "type"> & {
|
|
158
|
+
/**
|
|
159
|
+
* #property
|
|
160
|
+
*/
|
|
161
|
+
type: import("@jbrowse/mobx-state-tree").ILiteralType<"DropboxOAuthInternetAccount">;
|
|
162
|
+
/**
|
|
163
|
+
* #property
|
|
164
|
+
*/
|
|
165
|
+
configuration: import("@jbrowse/core/configuration/configurationSchema").IConfigurationReference<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
166
|
+
authEndpoint: {
|
|
167
|
+
type: "string";
|
|
168
|
+
} & {
|
|
86
169
|
defaultValue: string;
|
|
87
170
|
};
|
|
88
171
|
authHeader: {
|
|
89
|
-
|
|
90
|
-
|
|
172
|
+
type: "string";
|
|
173
|
+
} & {
|
|
91
174
|
defaultValue: string;
|
|
92
175
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
176
|
+
clientId: {
|
|
177
|
+
type: "string";
|
|
178
|
+
} & {
|
|
179
|
+
defaultValue: string;
|
|
180
|
+
};
|
|
181
|
+
description: {
|
|
182
|
+
type: "string";
|
|
183
|
+
} & {
|
|
96
184
|
defaultValue: string;
|
|
97
185
|
};
|
|
98
186
|
domains: {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
defaultValue:
|
|
187
|
+
type: "stringArray";
|
|
188
|
+
} & {
|
|
189
|
+
defaultValue: unknown;
|
|
102
190
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
107
|
-
authEndpoint: {
|
|
108
|
-
description: string;
|
|
109
|
-
type: string;
|
|
191
|
+
internetAccountId: {
|
|
192
|
+
type: "string";
|
|
193
|
+
} & {
|
|
110
194
|
defaultValue: string;
|
|
111
195
|
};
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
196
|
+
name: {
|
|
197
|
+
type: "string";
|
|
198
|
+
} & {
|
|
115
199
|
defaultValue: string;
|
|
116
200
|
};
|
|
117
201
|
needsPKCE: {
|
|
118
|
-
|
|
119
|
-
|
|
202
|
+
type: "boolean";
|
|
203
|
+
} & {
|
|
120
204
|
defaultValue: boolean;
|
|
121
205
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
defaultValue: string
|
|
206
|
+
responseType: {
|
|
207
|
+
type: "string";
|
|
208
|
+
} & {
|
|
209
|
+
defaultValue: string;
|
|
210
|
+
};
|
|
211
|
+
scopes: {
|
|
212
|
+
type: "string";
|
|
213
|
+
} & {
|
|
214
|
+
defaultValue: string;
|
|
215
|
+
};
|
|
216
|
+
state: {
|
|
217
|
+
type: "string";
|
|
218
|
+
} & {
|
|
219
|
+
defaultValue: string;
|
|
220
|
+
};
|
|
221
|
+
tokenEndpoint: {
|
|
222
|
+
type: "string";
|
|
223
|
+
} & {
|
|
224
|
+
defaultValue: string;
|
|
126
225
|
};
|
|
127
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
128
226
|
tokenType: {
|
|
129
|
-
|
|
130
|
-
|
|
227
|
+
type: "string";
|
|
228
|
+
} & {
|
|
131
229
|
defaultValue: string;
|
|
132
230
|
};
|
|
231
|
+
type: {
|
|
232
|
+
type: "string";
|
|
233
|
+
} & {
|
|
234
|
+
defaultValue: string;
|
|
235
|
+
};
|
|
236
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
133
237
|
authEndpoint: {
|
|
134
|
-
|
|
135
|
-
|
|
238
|
+
type: "string";
|
|
239
|
+
} & {
|
|
136
240
|
defaultValue: string;
|
|
137
241
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
242
|
+
authHeader: {
|
|
243
|
+
type: "string";
|
|
244
|
+
} & {
|
|
245
|
+
defaultValue: string;
|
|
246
|
+
};
|
|
247
|
+
clientId: {
|
|
248
|
+
type: "string";
|
|
249
|
+
} & {
|
|
250
|
+
defaultValue: string;
|
|
251
|
+
};
|
|
252
|
+
description: {
|
|
253
|
+
type: "string";
|
|
254
|
+
} & {
|
|
255
|
+
defaultValue: string;
|
|
256
|
+
};
|
|
257
|
+
domains: {
|
|
258
|
+
type: "stringArray";
|
|
259
|
+
} & {
|
|
260
|
+
defaultValue: unknown;
|
|
261
|
+
};
|
|
262
|
+
internetAccountId: {
|
|
263
|
+
type: "string";
|
|
264
|
+
} & {
|
|
265
|
+
defaultValue: string;
|
|
266
|
+
};
|
|
267
|
+
name: {
|
|
268
|
+
type: "string";
|
|
269
|
+
} & {
|
|
141
270
|
defaultValue: string;
|
|
142
271
|
};
|
|
143
272
|
needsPKCE: {
|
|
144
|
-
|
|
145
|
-
|
|
273
|
+
type: "boolean";
|
|
274
|
+
} & {
|
|
146
275
|
defaultValue: boolean;
|
|
147
276
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
277
|
+
responseType: {
|
|
278
|
+
type: "string";
|
|
279
|
+
} & {
|
|
151
280
|
defaultValue: string;
|
|
152
281
|
};
|
|
153
282
|
scopes: {
|
|
154
|
-
|
|
155
|
-
|
|
283
|
+
type: "string";
|
|
284
|
+
} & {
|
|
156
285
|
defaultValue: string;
|
|
157
286
|
};
|
|
158
287
|
state: {
|
|
159
|
-
|
|
160
|
-
|
|
288
|
+
type: "string";
|
|
289
|
+
} & {
|
|
161
290
|
defaultValue: string;
|
|
162
291
|
};
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
292
|
+
tokenEndpoint: {
|
|
293
|
+
type: "string";
|
|
294
|
+
} & {
|
|
295
|
+
defaultValue: string;
|
|
296
|
+
};
|
|
297
|
+
tokenType: {
|
|
298
|
+
type: "string";
|
|
299
|
+
} & {
|
|
300
|
+
defaultValue: string;
|
|
301
|
+
};
|
|
302
|
+
type: {
|
|
303
|
+
type: "string";
|
|
304
|
+
} & {
|
|
166
305
|
defaultValue: string;
|
|
167
306
|
};
|
|
168
307
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
169
|
-
name: {
|
|
170
|
-
|
|
171
|
-
|
|
308
|
+
readonly name: {
|
|
309
|
+
type: "string";
|
|
310
|
+
} & {
|
|
172
311
|
defaultValue: string;
|
|
173
312
|
};
|
|
174
|
-
description: {
|
|
175
|
-
|
|
176
|
-
|
|
313
|
+
readonly description: {
|
|
314
|
+
type: "string";
|
|
315
|
+
} & {
|
|
177
316
|
defaultValue: string;
|
|
178
317
|
};
|
|
179
|
-
authHeader: {
|
|
180
|
-
|
|
181
|
-
|
|
318
|
+
readonly authHeader: {
|
|
319
|
+
type: "string";
|
|
320
|
+
} & {
|
|
182
321
|
defaultValue: string;
|
|
183
322
|
};
|
|
184
|
-
tokenType: {
|
|
185
|
-
|
|
186
|
-
|
|
323
|
+
readonly tokenType: {
|
|
324
|
+
type: "string";
|
|
325
|
+
} & {
|
|
187
326
|
defaultValue: string;
|
|
188
327
|
};
|
|
189
|
-
domains: {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
defaultValue:
|
|
328
|
+
readonly domains: {
|
|
329
|
+
type: "stringArray";
|
|
330
|
+
} & {
|
|
331
|
+
defaultValue: unknown;
|
|
193
332
|
};
|
|
194
|
-
|
|
333
|
+
type: {
|
|
334
|
+
type: "string";
|
|
335
|
+
} & {
|
|
336
|
+
defaultValue: string;
|
|
337
|
+
};
|
|
338
|
+
internetAccountId: {
|
|
339
|
+
type: "string";
|
|
340
|
+
} & {
|
|
341
|
+
defaultValue: string;
|
|
342
|
+
};
|
|
343
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId", true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>, undefined, true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>, undefined, true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>;
|
|
195
344
|
}, {
|
|
196
345
|
readonly name: string;
|
|
197
346
|
readonly description: string;
|
|
@@ -200,22 +349,21 @@ declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfi
|
|
|
200
349
|
readonly tokenType: string;
|
|
201
350
|
readonly domains: string[];
|
|
202
351
|
readonly toggleContents: React.ReactNode;
|
|
203
|
-
readonly SelectorComponent: import("@jbrowse/core/util").AnyReactComponentType | undefined;
|
|
204
352
|
readonly selectorLabel: string | undefined;
|
|
353
|
+
readonly showInFileSelector: boolean;
|
|
205
354
|
} & {
|
|
206
355
|
handlesLocation(location: UriLocation): boolean;
|
|
207
356
|
readonly tokenKey: string;
|
|
208
357
|
} & {
|
|
209
358
|
getTokenFromUser(_resolve: (token: string) => void, _reject: (error: Error) => void): void;
|
|
210
359
|
storeToken(token: string): void;
|
|
211
|
-
|
|
212
|
-
retrieveToken(): string | null;
|
|
360
|
+
retrieveToken(): string | undefined;
|
|
213
361
|
validateToken(token: string, _loc: UriLocation): Promise<string>;
|
|
214
362
|
} & {
|
|
363
|
+
removeToken(): void;
|
|
215
364
|
getToken(location?: UriLocation): Promise<string>;
|
|
216
365
|
} & {
|
|
217
366
|
addAuthHeaderToInit(init?: RequestInit, token?: string): {
|
|
218
|
-
headers: Headers;
|
|
219
367
|
body?: BodyInit | null;
|
|
220
368
|
cache?: RequestCache;
|
|
221
369
|
credentials?: RequestCredentials;
|
|
@@ -229,49 +377,75 @@ declare const stateModelFactory: (configSchema: DropboxOAuthInternetAccountConfi
|
|
|
229
377
|
referrerPolicy?: ReferrerPolicy;
|
|
230
378
|
signal?: AbortSignal | null;
|
|
231
379
|
window?: null;
|
|
380
|
+
headers: Headers;
|
|
232
381
|
};
|
|
382
|
+
fetchWithToken(loc: UriLocation | undefined, run: (token: string) => Promise<Response>): Promise<Response>;
|
|
233
383
|
getPreAuthorizationInformation(location: UriLocation): Promise<{
|
|
234
384
|
internetAccountType: string;
|
|
235
385
|
authInfo: {
|
|
236
386
|
token: string;
|
|
237
|
-
configuration: any
|
|
387
|
+
configuration: import("@jbrowse/mobx-state-tree").ModelSnapshotType<Record<string, any>>;
|
|
238
388
|
};
|
|
239
389
|
}>;
|
|
240
390
|
} & {
|
|
241
391
|
getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
242
392
|
} & {
|
|
243
|
-
openLocation(location: UriLocation): import("@
|
|
393
|
+
openLocation(location: UriLocation): import("@gmod/range-cache-filehandle").RemoteFileWithRangeCache;
|
|
244
394
|
} & {
|
|
245
|
-
readonly
|
|
395
|
+
readonly conf: import("../OAuthModel/configSchema.ts").OAuthInternetAccountConfig;
|
|
246
396
|
} & {
|
|
247
397
|
readonly authEndpoint: string;
|
|
248
398
|
readonly tokenEndpoint: string;
|
|
249
399
|
readonly needsPKCE: boolean;
|
|
250
400
|
readonly clientId: string;
|
|
251
401
|
readonly scopes: string;
|
|
252
|
-
state
|
|
253
|
-
readonly responseType:
|
|
402
|
+
readonly state: string;
|
|
403
|
+
readonly responseType: string;
|
|
254
404
|
readonly refreshTokenKey: string;
|
|
405
|
+
readonly authFlowParams: Record<string, string>;
|
|
255
406
|
} & {
|
|
256
407
|
storeRefreshToken(refreshToken: string): void;
|
|
257
408
|
removeRefreshToken(): void;
|
|
258
|
-
retrieveRefreshToken(): string |
|
|
259
|
-
|
|
409
|
+
retrieveRefreshToken(): string | undefined;
|
|
410
|
+
} & {
|
|
411
|
+
postTokenGrant(grant: Record<string, string>, describeError: (response: Response) => Promise<string>): Promise<string>;
|
|
412
|
+
} & {
|
|
413
|
+
exchangeAuthorizationForAccessToken(code: string, redirectUri: string, codeVerifier: string | undefined): Promise<string>;
|
|
260
414
|
exchangeRefreshForAccessToken(refreshToken: string): Promise<string>;
|
|
261
415
|
} & {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
useEndpointForAuthorization(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
|
|
416
|
+
validateTokenWithProbe(token: string, probe: (token: string) => Promise<Response>, describeError: (response: Response, reason?: string) => Promise<string>): Promise<string>;
|
|
417
|
+
getTokenViaAuthFlow(): Promise<string>;
|
|
418
|
+
} & {
|
|
266
419
|
getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
|
|
267
420
|
validateToken(token: string, location: UriLocation): Promise<string>;
|
|
268
421
|
} & {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
422
|
+
/**
|
|
423
|
+
* #getter
|
|
424
|
+
* The FileSelector icon for Dropbox
|
|
425
|
+
*/
|
|
426
|
+
readonly toggleContents: import("react").JSX.Element;
|
|
427
|
+
/**
|
|
428
|
+
* #getter
|
|
429
|
+
*/
|
|
272
430
|
readonly selectorLabel: string;
|
|
431
|
+
/**
|
|
432
|
+
* #getter
|
|
433
|
+
* Dropbox issues a refresh token only when the authorization request
|
|
434
|
+
* asks for offline access, and spells that `token_access_type` where
|
|
435
|
+
* other providers use `access_type` — so it belongs here rather than on
|
|
436
|
+
* every OAuth account.
|
|
437
|
+
*/
|
|
438
|
+
readonly authFlowParams: {
|
|
439
|
+
token_access_type: string;
|
|
440
|
+
};
|
|
273
441
|
} & {
|
|
442
|
+
/**
|
|
443
|
+
* #method
|
|
444
|
+
*/
|
|
274
445
|
getFetcher(location?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
446
|
+
/**
|
|
447
|
+
* #action
|
|
448
|
+
*/
|
|
275
449
|
validateToken(token: string, location: UriLocation): Promise<string>;
|
|
276
450
|
}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
|
|
277
451
|
export default stateModelFactory;
|
|
@@ -1,59 +1,84 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ConfigurationReference } from '@jbrowse/core/configuration';
|
|
3
3
|
import { types } from '@jbrowse/mobx-state-tree';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
4
|
+
import { configSchema as OAuthConfigSchema } from '../OAuthModel/index.js';
|
|
5
|
+
import baseModel from '../OAuthModel/model.js';
|
|
6
|
+
import DropboxIcon from './DropboxIcon.js';
|
|
7
|
+
import { getDescriptiveErrorMessage } from './util.js';
|
|
8
|
+
/**
|
|
9
|
+
* #stateModel DropboxOAuthInternetAccount
|
|
10
|
+
*/
|
|
8
11
|
const stateModelFactory = (configSchema) => {
|
|
9
12
|
return baseModel(OAuthConfigSchema)
|
|
10
13
|
.named('DropboxOAuthInternetAccount')
|
|
11
14
|
.props({
|
|
15
|
+
/**
|
|
16
|
+
* #property
|
|
17
|
+
*/
|
|
12
18
|
type: types.literal('DropboxOAuthInternetAccount'),
|
|
19
|
+
/**
|
|
20
|
+
* #property
|
|
21
|
+
*/
|
|
13
22
|
configuration: ConfigurationReference(configSchema),
|
|
14
23
|
})
|
|
15
24
|
.views(() => ({
|
|
25
|
+
/**
|
|
26
|
+
* #getter
|
|
27
|
+
* The FileSelector icon for Dropbox
|
|
28
|
+
*/
|
|
16
29
|
get toggleContents() {
|
|
17
30
|
return _jsx(DropboxIcon, {});
|
|
18
31
|
},
|
|
32
|
+
/**
|
|
33
|
+
* #getter
|
|
34
|
+
*/
|
|
19
35
|
get selectorLabel() {
|
|
20
36
|
return 'Enter Dropbox share link';
|
|
21
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* #getter
|
|
40
|
+
* Dropbox issues a refresh token only when the authorization request
|
|
41
|
+
* asks for offline access, and spells that `token_access_type` where
|
|
42
|
+
* other providers use `access_type` — so it belongs here rather than on
|
|
43
|
+
* every OAuth account.
|
|
44
|
+
*/
|
|
45
|
+
get authFlowParams() {
|
|
46
|
+
return { token_access_type: 'offline' };
|
|
47
|
+
},
|
|
22
48
|
}))
|
|
23
49
|
.actions(self => ({
|
|
50
|
+
/**
|
|
51
|
+
* #method
|
|
52
|
+
*/
|
|
24
53
|
getFetcher(location) {
|
|
25
54
|
return async (input, init) => {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
55
|
+
const response = await self.fetchWithToken(location, authToken => {
|
|
56
|
+
// built per attempt: the Headers are appended to below, so a retry
|
|
57
|
+
// reusing them would send two Dropbox-API-Arg values
|
|
58
|
+
const newInit = self.addAuthHeaderToInit({ ...init, method: 'POST' }, authToken);
|
|
59
|
+
newInit.headers.append('Dropbox-API-Arg', JSON.stringify({ url: input }));
|
|
60
|
+
return fetch('https://content.dropboxapi.com/2/sharing/get_shared_link_file', newInit);
|
|
61
|
+
});
|
|
30
62
|
if (!response.ok) {
|
|
31
63
|
throw new Error(await getDescriptiveErrorMessage(response));
|
|
32
64
|
}
|
|
33
65
|
return response;
|
|
34
66
|
};
|
|
35
67
|
},
|
|
68
|
+
/**
|
|
69
|
+
* #action
|
|
70
|
+
*/
|
|
36
71
|
async validateToken(token, location) {
|
|
37
|
-
|
|
72
|
+
return self.validateTokenWithProbe(token, authToken => fetch('https://api.dropboxapi.com/2/sharing/get_shared_link_metadata', {
|
|
38
73
|
method: 'POST',
|
|
39
74
|
headers: {
|
|
40
|
-
Authorization: `Bearer ${
|
|
75
|
+
Authorization: `Bearer ${authToken}`,
|
|
41
76
|
'Content-Type': 'application/json',
|
|
42
77
|
},
|
|
43
78
|
body: JSON.stringify({
|
|
44
79
|
url: location.uri,
|
|
45
80
|
}),
|
|
46
|
-
});
|
|
47
|
-
if (!response.ok) {
|
|
48
|
-
const refreshToken = self.retrieveRefreshToken();
|
|
49
|
-
if (refreshToken) {
|
|
50
|
-
self.removeRefreshToken();
|
|
51
|
-
const newToken = await self.exchangeRefreshForAccessToken(refreshToken);
|
|
52
|
-
return this.validateToken(newToken, location);
|
|
53
|
-
}
|
|
54
|
-
throw new Error(await getDescriptiveErrorMessage(response, 'Token could not be validated'));
|
|
55
|
-
}
|
|
56
|
-
return token;
|
|
81
|
+
}), getDescriptiveErrorMessage);
|
|
57
82
|
},
|
|
58
83
|
}));
|
|
59
84
|
};
|