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