@jbrowse/plugin-authentication 2.5.0 → 2.6.1

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 (96) hide show
  1. package/dist/DropboxOAuthModel/configSchema.d.ts +3 -14
  2. package/dist/DropboxOAuthModel/configSchema.js +0 -8
  3. package/dist/DropboxOAuthModel/configSchema.js.map +1 -1
  4. package/dist/DropboxOAuthModel/model.d.ts +35 -33
  5. package/dist/DropboxOAuthModel/model.js +26 -35
  6. package/dist/DropboxOAuthModel/model.js.map +1 -1
  7. package/dist/DropboxOAuthModel/util.d.ts +1 -0
  8. package/dist/DropboxOAuthModel/util.js +28 -0
  9. package/dist/DropboxOAuthModel/util.js.map +1 -0
  10. package/dist/ExternalTokenModel/ExternalTokenEntryForm.d.ts +2 -1
  11. package/dist/ExternalTokenModel/ExternalTokenEntryForm.js +10 -11
  12. package/dist/ExternalTokenModel/ExternalTokenEntryForm.js.map +1 -1
  13. package/dist/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +15 -0
  14. package/dist/GoogleDriveOAuthModel/GoogleDriveFilehandle.js +20 -0
  15. package/dist/GoogleDriveOAuthModel/GoogleDriveFilehandle.js.map +1 -0
  16. package/dist/GoogleDriveOAuthModel/configSchema.d.ts +0 -5
  17. package/dist/GoogleDriveOAuthModel/model.d.ts +36 -121
  18. package/dist/GoogleDriveOAuthModel/model.js +38 -51
  19. package/dist/GoogleDriveOAuthModel/model.js.map +1 -1
  20. package/dist/GoogleDriveOAuthModel/util.d.ts +1 -0
  21. package/dist/GoogleDriveOAuthModel/util.js +17 -0
  22. package/dist/GoogleDriveOAuthModel/util.js.map +1 -0
  23. package/dist/HTTPBasicModel/HTTPBasicLoginForm.d.ts +2 -1
  24. package/dist/HTTPBasicModel/HTTPBasicLoginForm.js +17 -21
  25. package/dist/HTTPBasicModel/HTTPBasicLoginForm.js.map +1 -1
  26. package/dist/HTTPBasicModel/model.d.ts +36 -4
  27. package/dist/HTTPBasicModel/model.js +24 -9
  28. package/dist/HTTPBasicModel/model.js.map +1 -1
  29. package/dist/OAuthModel/configSchema.d.ts +0 -8
  30. package/dist/OAuthModel/configSchema.js +1 -9
  31. package/dist/OAuthModel/configSchema.js.map +1 -1
  32. package/dist/OAuthModel/model.d.ts +103 -18
  33. package/dist/OAuthModel/model.js +165 -113
  34. package/dist/OAuthModel/model.js.map +1 -1
  35. package/dist/OAuthModel/util.d.ts +7 -0
  36. package/dist/OAuthModel/util.js +60 -0
  37. package/dist/OAuthModel/util.js.map +1 -0
  38. package/dist/index.d.ts +7 -433
  39. package/dist/util.d.ts +6 -0
  40. package/dist/util.js +23 -0
  41. package/dist/util.js.map +1 -0
  42. package/esm/DropboxOAuthModel/configSchema.d.ts +3 -14
  43. package/esm/DropboxOAuthModel/configSchema.js +0 -8
  44. package/esm/DropboxOAuthModel/configSchema.js.map +1 -1
  45. package/esm/DropboxOAuthModel/model.d.ts +35 -33
  46. package/esm/DropboxOAuthModel/model.js +26 -35
  47. package/esm/DropboxOAuthModel/model.js.map +1 -1
  48. package/esm/DropboxOAuthModel/util.d.ts +1 -0
  49. package/esm/DropboxOAuthModel/util.js +24 -0
  50. package/esm/DropboxOAuthModel/util.js.map +1 -0
  51. package/esm/ExternalTokenModel/ExternalTokenEntryForm.d.ts +2 -1
  52. package/esm/ExternalTokenModel/ExternalTokenEntryForm.js +10 -11
  53. package/esm/ExternalTokenModel/ExternalTokenEntryForm.js.map +1 -1
  54. package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +15 -0
  55. package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.js +16 -0
  56. package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.js.map +1 -0
  57. package/esm/GoogleDriveOAuthModel/configSchema.d.ts +0 -5
  58. package/esm/GoogleDriveOAuthModel/model.d.ts +36 -121
  59. package/esm/GoogleDriveOAuthModel/model.js +37 -49
  60. package/esm/GoogleDriveOAuthModel/model.js.map +1 -1
  61. package/esm/GoogleDriveOAuthModel/util.d.ts +1 -0
  62. package/esm/GoogleDriveOAuthModel/util.js +13 -0
  63. package/esm/GoogleDriveOAuthModel/util.js.map +1 -0
  64. package/esm/HTTPBasicModel/HTTPBasicLoginForm.d.ts +2 -1
  65. package/esm/HTTPBasicModel/HTTPBasicLoginForm.js +18 -22
  66. package/esm/HTTPBasicModel/HTTPBasicLoginForm.js.map +1 -1
  67. package/esm/HTTPBasicModel/model.d.ts +36 -4
  68. package/esm/HTTPBasicModel/model.js +24 -9
  69. package/esm/HTTPBasicModel/model.js.map +1 -1
  70. package/esm/OAuthModel/configSchema.d.ts +0 -8
  71. package/esm/OAuthModel/configSchema.js +1 -9
  72. package/esm/OAuthModel/configSchema.js.map +1 -1
  73. package/esm/OAuthModel/model.d.ts +103 -18
  74. package/esm/OAuthModel/model.js +164 -86
  75. package/esm/OAuthModel/model.js.map +1 -1
  76. package/esm/OAuthModel/util.d.ts +7 -0
  77. package/esm/OAuthModel/util.js +30 -0
  78. package/esm/OAuthModel/util.js.map +1 -0
  79. package/esm/index.d.ts +7 -433
  80. package/esm/util.d.ts +6 -0
  81. package/esm/util.js +18 -0
  82. package/esm/util.js.map +1 -0
  83. package/package.json +3 -4
  84. package/src/DropboxOAuthModel/configSchema.ts +0 -8
  85. package/src/DropboxOAuthModel/model.tsx +35 -54
  86. package/src/DropboxOAuthModel/util.ts +36 -0
  87. package/src/ExternalTokenModel/ExternalTokenEntryForm.tsx +39 -41
  88. package/src/GoogleDriveOAuthModel/GoogleDriveFilehandle.ts +38 -0
  89. package/src/GoogleDriveOAuthModel/model.tsx +54 -104
  90. package/src/GoogleDriveOAuthModel/util.ts +29 -0
  91. package/src/HTTPBasicModel/HTTPBasicLoginForm.tsx +53 -56
  92. package/src/HTTPBasicModel/model.tsx +26 -11
  93. package/src/OAuthModel/configSchema.ts +2 -9
  94. package/src/OAuthModel/model.tsx +190 -108
  95. package/src/OAuthModel/util.ts +33 -0
  96. package/src/util.ts +25 -0
@@ -0,0 +1,7 @@
1
+ export declare function fixup(buf: string): string;
2
+ export declare function generateChallenge(val: string): Promise<string>;
3
+ export declare function processError(text: string, invalidErrorCb: () => void): any;
4
+ export declare function processTokenResponse(data: {
5
+ refresh_token?: string;
6
+ access_token: string;
7
+ }, storeRefreshTokenCb: (str: string) => void): string;
@@ -0,0 +1,30 @@
1
+ export function fixup(buf) {
2
+ return buf.replaceAll('+', '-').replaceAll('/', '_').replaceAll('=', '');
3
+ }
4
+ export async function generateChallenge(val) {
5
+ const sha256 = await import('crypto-js/sha256').then(f => f.default);
6
+ const Base64 = await import('crypto-js/enc-base64');
7
+ return fixup(Base64.stringify(sha256(val)));
8
+ }
9
+ // if response is JSON, checks if it needs to remove tokens in error, or just plain throw
10
+ export function processError(text, invalidErrorCb) {
11
+ var _a;
12
+ try {
13
+ const obj = JSON.parse(text);
14
+ if (obj.error === 'invalid_grant') {
15
+ invalidErrorCb();
16
+ }
17
+ return (_a = obj === null || obj === void 0 ? void 0 : obj.error_description) !== null && _a !== void 0 ? _a : text;
18
+ }
19
+ catch (e) {
20
+ /* response text is not json, just use original text as error */
21
+ }
22
+ return text;
23
+ }
24
+ export function processTokenResponse(data, storeRefreshTokenCb) {
25
+ if (data.refresh_token) {
26
+ storeRefreshTokenCb(data.refresh_token);
27
+ }
28
+ return data.access_token;
29
+ }
30
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/OAuthModel/util.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,KAAK,CAAC,GAAW;IAC/B,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;AAC1E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,GAAW;IACjD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IACpE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAA;IACnD,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAC7C,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,cAA0B;;IACnE,IAAI;QACF,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,GAAG,CAAC,KAAK,KAAK,eAAe,EAAE;YACjC,cAAc,EAAE,CAAA;SACjB;QACD,OAAO,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,iBAAiB,mCAAI,IAAI,CAAA;KACtC;IAAC,OAAO,CAAC,EAAE;QACV,gEAAgE;KACjE;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAAsD,EACtD,mBAA0C;IAE1C,IAAI,IAAI,CAAC,aAAa,EAAE;QACtB,mBAAmB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;KACxC;IACD,OAAO,IAAI,CAAC,YAAY,CAAA;AAC1B,CAAC"}
package/esm/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import Plugin from '@jbrowse/core/Plugin';
3
3
  import PluginManager from '@jbrowse/core/PluginManager';
4
+ import { modelFactory as GoogleDriveOAuthInternetAccountModelFactory } from './GoogleDriveOAuthModel';
4
5
  export default class AuthenticationPlugin extends Plugin {
5
6
  name: string;
6
7
  exports: {
@@ -45,11 +46,6 @@ export default class AuthenticationPlugin extends Plugin {
45
46
  type: string;
46
47
  defaultValue: string;
47
48
  };
48
- hasRefreshToken: {
49
- description: string;
50
- type: string;
51
- defaultValue: boolean;
52
- };
53
49
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
54
50
  name: {
55
51
  description: string;
@@ -118,11 +114,6 @@ export default class AuthenticationPlugin extends Plugin {
118
114
  type: string;
119
115
  defaultValue: string;
120
116
  };
121
- hasRefreshToken: {
122
- description: string;
123
- type: string;
124
- defaultValue: boolean;
125
- };
126
117
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
127
118
  name: {
128
119
  description: string;
@@ -222,11 +213,6 @@ export default class AuthenticationPlugin extends Plugin {
222
213
  type: string;
223
214
  defaultValue: string;
224
215
  };
225
- hasRefreshToken: {
226
- description: string;
227
- type: string;
228
- defaultValue: boolean;
229
- };
230
216
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
231
217
  name: {
232
218
  description: string;
@@ -312,7 +298,6 @@ export default class AuthenticationPlugin extends Plugin {
312
298
  readonly scopes: string;
313
299
  state(): string | undefined;
314
300
  readonly responseType: "code" | "token";
315
- readonly hasRefreshToken: boolean;
316
301
  readonly refreshTokenKey: string;
317
302
  } & {
318
303
  storeRefreshToken(refreshToken: string): void;
@@ -327,6 +312,8 @@ export default class AuthenticationPlugin extends Plugin {
327
312
  useEndpointForAuthorization(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
328
313
  getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
329
314
  validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
315
+ } & {
316
+ getFetcher(loc?: import("@jbrowse/core/util").UriLocation | undefined): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
330
317
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
331
318
  ExternalTokenConfigSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
332
319
  validateWithHEAD: {
@@ -732,11 +719,6 @@ export default class AuthenticationPlugin extends Plugin {
732
719
  type: string;
733
720
  defaultValue: string[];
734
721
  };
735
- hasRefreshToken: {
736
- description: string;
737
- type: string;
738
- defaultValue: boolean;
739
- };
740
722
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
741
723
  tokenType: {
742
724
  description: string;
@@ -778,11 +760,6 @@ export default class AuthenticationPlugin extends Plugin {
778
760
  type: string;
779
761
  defaultValue: string;
780
762
  };
781
- hasRefreshToken: {
782
- description: string;
783
- type: string;
784
- defaultValue: boolean;
785
- };
786
763
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
787
764
  name: {
788
765
  description: string;
@@ -831,11 +808,6 @@ export default class AuthenticationPlugin extends Plugin {
831
808
  type: string;
832
809
  defaultValue: string[];
833
810
  };
834
- hasRefreshToken: {
835
- description: string;
836
- type: string;
837
- defaultValue: boolean;
838
- };
839
811
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
840
812
  tokenType: {
841
813
  description: string;
@@ -877,11 +849,6 @@ export default class AuthenticationPlugin extends Plugin {
877
849
  type: string;
878
850
  defaultValue: string;
879
851
  };
880
- hasRefreshToken: {
881
- description: string;
882
- type: string;
883
- defaultValue: boolean;
884
- };
885
852
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
886
853
  name: {
887
854
  description: string;
@@ -981,11 +948,6 @@ export default class AuthenticationPlugin extends Plugin {
981
948
  type: string;
982
949
  defaultValue: string;
983
950
  };
984
- hasRefreshToken: {
985
- description: string;
986
- type: string;
987
- defaultValue: boolean;
988
- };
989
951
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
990
952
  name: {
991
953
  description: string;
@@ -1036,11 +998,6 @@ export default class AuthenticationPlugin extends Plugin {
1036
998
  type: string;
1037
999
  defaultValue: string[];
1038
1000
  };
1039
- hasRefreshToken: {
1040
- description: string;
1041
- type: string;
1042
- defaultValue: boolean;
1043
- };
1044
1001
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1045
1002
  tokenType: {
1046
1003
  description: string;
@@ -1082,11 +1039,6 @@ export default class AuthenticationPlugin extends Plugin {
1082
1039
  type: string;
1083
1040
  defaultValue: string;
1084
1041
  };
1085
- hasRefreshToken: {
1086
- description: string;
1087
- type: string;
1088
- defaultValue: boolean;
1089
- };
1090
1042
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1091
1043
  name: {
1092
1044
  description: string;
@@ -1172,7 +1124,6 @@ export default class AuthenticationPlugin extends Plugin {
1172
1124
  readonly scopes: string;
1173
1125
  state(): string | undefined;
1174
1126
  readonly responseType: "code" | "token";
1175
- readonly hasRefreshToken: boolean;
1176
1127
  readonly refreshTokenKey: string;
1177
1128
  } & {
1178
1129
  storeRefreshToken(refreshToken: string): void;
@@ -1188,7 +1139,9 @@ export default class AuthenticationPlugin extends Plugin {
1188
1139
  getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
1189
1140
  validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
1190
1141
  } & {
1191
- readonly toggleContents: JSX.Element;
1142
+ getFetcher(loc?: import("@jbrowse/core/util").UriLocation | undefined): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
1143
+ } & {
1144
+ readonly toggleContents: import("react").JSX.Element;
1192
1145
  readonly selectorLabel: string;
1193
1146
  } & {
1194
1147
  getFetcher(location?: import("@jbrowse/core/util").UriLocation | undefined): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
@@ -1256,11 +1209,6 @@ export default class AuthenticationPlugin extends Plugin {
1256
1209
  type: string;
1257
1210
  defaultValue: string;
1258
1211
  };
1259
- hasRefreshToken: {
1260
- description: string;
1261
- type: string;
1262
- defaultValue: boolean;
1263
- };
1264
1212
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1265
1213
  name: {
1266
1214
  description: string;
@@ -1288,381 +1236,7 @@ export default class AuthenticationPlugin extends Plugin {
1288
1236
  defaultValue: never[];
1289
1237
  };
1290
1238
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>, undefined>>;
1291
- GoogleDriveOAuthInternetAccountModelFactory: (configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1292
- authEndpoint: {
1293
- description: string;
1294
- type: string;
1295
- defaultValue: string;
1296
- };
1297
- scopes: {
1298
- description: string;
1299
- type: string;
1300
- defaultValue: string;
1301
- };
1302
- domains: {
1303
- description: string;
1304
- type: string;
1305
- defaultValue: string[];
1306
- };
1307
- responseType: {
1308
- description: string;
1309
- type: string;
1310
- defaultValue: string;
1311
- };
1312
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1313
- tokenType: {
1314
- description: string;
1315
- type: string;
1316
- defaultValue: string;
1317
- };
1318
- authEndpoint: {
1319
- description: string;
1320
- type: string;
1321
- defaultValue: string;
1322
- };
1323
- tokenEndpoint: {
1324
- description: string;
1325
- type: string;
1326
- defaultValue: string;
1327
- };
1328
- needsPKCE: {
1329
- description: string;
1330
- type: string;
1331
- defaultValue: boolean;
1332
- };
1333
- clientId: {
1334
- description: string;
1335
- type: string;
1336
- defaultValue: string;
1337
- };
1338
- scopes: {
1339
- description: string;
1340
- type: string;
1341
- defaultValue: string;
1342
- };
1343
- state: {
1344
- description: string;
1345
- type: string;
1346
- defaultValue: string;
1347
- };
1348
- responseType: {
1349
- description: string;
1350
- type: string;
1351
- defaultValue: string;
1352
- };
1353
- hasRefreshToken: {
1354
- description: string;
1355
- type: string;
1356
- defaultValue: boolean;
1357
- };
1358
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1359
- name: {
1360
- description: string;
1361
- type: string;
1362
- defaultValue: string;
1363
- };
1364
- description: {
1365
- description: string;
1366
- type: string;
1367
- defaultValue: string;
1368
- };
1369
- authHeader: {
1370
- description: string;
1371
- type: string;
1372
- defaultValue: string;
1373
- };
1374
- tokenType: {
1375
- description: string;
1376
- type: string;
1377
- defaultValue: string;
1378
- };
1379
- domains: {
1380
- description: string;
1381
- type: string;
1382
- defaultValue: never[];
1383
- };
1384
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>, undefined>>) => import("mobx-state-tree").IModelType<{
1385
- id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
1386
- type: import("mobx-state-tree").ISimpleType<string>;
1387
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1388
- name: {
1389
- description: string;
1390
- type: string;
1391
- defaultValue: string;
1392
- };
1393
- description: {
1394
- description: string;
1395
- type: string;
1396
- defaultValue: string;
1397
- };
1398
- authHeader: {
1399
- description: string;
1400
- type: string;
1401
- defaultValue: string;
1402
- };
1403
- tokenType: {
1404
- description: string;
1405
- type: string;
1406
- defaultValue: string;
1407
- };
1408
- domains: {
1409
- description: string;
1410
- type: string;
1411
- defaultValue: never[];
1412
- };
1413
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>;
1414
- } & {
1415
- type: import("mobx-state-tree").ISimpleType<"OAuthInternetAccount">;
1416
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1417
- tokenType: {
1418
- description: string;
1419
- type: string;
1420
- defaultValue: string;
1421
- };
1422
- authEndpoint: {
1423
- description: string;
1424
- type: string;
1425
- defaultValue: string;
1426
- };
1427
- tokenEndpoint: {
1428
- description: string;
1429
- type: string;
1430
- defaultValue: string;
1431
- };
1432
- needsPKCE: {
1433
- description: string;
1434
- type: string;
1435
- defaultValue: boolean;
1436
- };
1437
- clientId: {
1438
- description: string;
1439
- type: string;
1440
- defaultValue: string;
1441
- };
1442
- scopes: {
1443
- description: string;
1444
- type: string;
1445
- defaultValue: string;
1446
- };
1447
- state: {
1448
- description: string;
1449
- type: string;
1450
- defaultValue: string;
1451
- };
1452
- responseType: {
1453
- description: string;
1454
- type: string;
1455
- defaultValue: string;
1456
- };
1457
- hasRefreshToken: {
1458
- description: string;
1459
- type: string;
1460
- defaultValue: boolean;
1461
- };
1462
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1463
- name: {
1464
- description: string;
1465
- type: string;
1466
- defaultValue: string;
1467
- };
1468
- description: {
1469
- description: string;
1470
- type: string;
1471
- defaultValue: string;
1472
- };
1473
- authHeader: {
1474
- description: string;
1475
- type: string;
1476
- defaultValue: string;
1477
- };
1478
- tokenType: {
1479
- description: string;
1480
- type: string;
1481
- defaultValue: string;
1482
- };
1483
- domains: {
1484
- description: string;
1485
- type: string;
1486
- defaultValue: never[];
1487
- };
1488
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>;
1489
- } & {
1490
- type: import("mobx-state-tree").ISimpleType<"GoogleDriveOAuthInternetAccount">;
1491
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1492
- authEndpoint: {
1493
- description: string;
1494
- type: string;
1495
- defaultValue: string;
1496
- };
1497
- scopes: {
1498
- description: string;
1499
- type: string;
1500
- defaultValue: string;
1501
- };
1502
- domains: {
1503
- description: string;
1504
- type: string;
1505
- defaultValue: string[];
1506
- };
1507
- responseType: {
1508
- description: string;
1509
- type: string;
1510
- defaultValue: string;
1511
- };
1512
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1513
- tokenType: {
1514
- description: string;
1515
- type: string;
1516
- defaultValue: string;
1517
- };
1518
- authEndpoint: {
1519
- description: string;
1520
- type: string;
1521
- defaultValue: string;
1522
- };
1523
- tokenEndpoint: {
1524
- description: string;
1525
- type: string;
1526
- defaultValue: string;
1527
- };
1528
- needsPKCE: {
1529
- description: string;
1530
- type: string;
1531
- defaultValue: boolean;
1532
- };
1533
- clientId: {
1534
- description: string;
1535
- type: string;
1536
- defaultValue: string;
1537
- };
1538
- scopes: {
1539
- description: string;
1540
- type: string;
1541
- defaultValue: string;
1542
- };
1543
- state: {
1544
- description: string;
1545
- type: string;
1546
- defaultValue: string;
1547
- };
1548
- responseType: {
1549
- description: string;
1550
- type: string;
1551
- defaultValue: string;
1552
- };
1553
- hasRefreshToken: {
1554
- description: string;
1555
- type: string;
1556
- defaultValue: boolean;
1557
- };
1558
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1559
- name: {
1560
- description: string;
1561
- type: string;
1562
- defaultValue: string;
1563
- };
1564
- description: {
1565
- description: string;
1566
- type: string;
1567
- defaultValue: string;
1568
- };
1569
- authHeader: {
1570
- description: string;
1571
- type: string;
1572
- defaultValue: string;
1573
- };
1574
- tokenType: {
1575
- description: string;
1576
- type: string;
1577
- defaultValue: string;
1578
- };
1579
- domains: {
1580
- description: string;
1581
- type: string;
1582
- defaultValue: never[];
1583
- };
1584
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "internetAccountId">>, undefined>>, undefined>>;
1585
- }, {
1586
- readonly name: string;
1587
- readonly description: string;
1588
- readonly internetAccountId: string;
1589
- readonly authHeader: string;
1590
- readonly tokenType: string;
1591
- readonly domains: string[];
1592
- readonly toggleContents: import("react").ReactNode;
1593
- readonly SelectorComponent: import("@jbrowse/core/util").AnyReactComponentType | undefined;
1594
- readonly selectorLabel: string | undefined;
1595
- } & {
1596
- handlesLocation(location: import("@jbrowse/core/util").UriLocation): boolean;
1597
- readonly tokenKey: string;
1598
- } & {
1599
- getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): void;
1600
- storeToken(token: string): void;
1601
- removeToken(): void;
1602
- retrieveToken(): string | null;
1603
- validateToken(token: string, loc: import("@jbrowse/core/util").UriLocation): Promise<string>;
1604
- } & {
1605
- getToken(location?: import("@jbrowse/core/util").UriLocation | undefined): Promise<string>;
1606
- } & {
1607
- addAuthHeaderToInit(init: RequestInit | undefined, token: string): {
1608
- headers: Headers;
1609
- body?: BodyInit | null | undefined;
1610
- cache?: RequestCache | undefined;
1611
- credentials?: RequestCredentials | undefined;
1612
- integrity?: string | undefined;
1613
- keepalive?: boolean | undefined;
1614
- method?: string | undefined;
1615
- mode?: RequestMode | undefined;
1616
- redirect?: RequestRedirect | undefined;
1617
- referrer?: string | undefined;
1618
- referrerPolicy?: ReferrerPolicy | undefined;
1619
- signal?: AbortSignal | null | undefined;
1620
- window?: null | undefined;
1621
- };
1622
- getPreAuthorizationInformation(location: import("@jbrowse/core/util").UriLocation): Promise<{
1623
- internetAccountType: string;
1624
- authInfo: {
1625
- token: string;
1626
- configuration: any;
1627
- };
1628
- }>;
1629
- } & {
1630
- getFetcher(loc?: import("@jbrowse/core/util").UriLocation | undefined): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
1631
- } & {
1632
- openLocation(location: import("@jbrowse/core/util").UriLocation): import("@jbrowse/core/util/io").RemoteFileWithRangeCache;
1633
- } & {
1634
- readonly codeVerifierPKCE: string;
1635
- } & {
1636
- readonly authEndpoint: string;
1637
- readonly tokenEndpoint: string;
1638
- readonly needsPKCE: boolean;
1639
- readonly clientId: string;
1640
- readonly scopes: string;
1641
- state(): string | undefined;
1642
- readonly responseType: "code" | "token";
1643
- readonly hasRefreshToken: boolean;
1644
- readonly refreshTokenKey: string;
1645
- } & {
1646
- storeRefreshToken(refreshToken: string): void;
1647
- removeRefreshToken(): void;
1648
- retrieveRefreshToken(): string | null;
1649
- exchangeAuthorizationForAccessToken(token: string, redirectUri: string): Promise<string>;
1650
- exchangeRefreshForAccessToken(refreshToken: string): Promise<string>;
1651
- } & {
1652
- addMessageChannel(resolve: (token: string) => void, reject: (error: Error) => void): void;
1653
- deleteMessageChannel(): void;
1654
- finishOAuthWindow(event: MessageEvent<any>, resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
1655
- useEndpointForAuthorization(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
1656
- getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): Promise<void>;
1657
- validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
1658
- } & {
1659
- readonly toggleContents: JSX.Element;
1660
- readonly selectorLabel: string;
1661
- } & {
1662
- getFetcher(location?: import("@jbrowse/core/util").UriLocation | undefined): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
1663
- openLocation(location: import("@jbrowse/core/util").UriLocation): import("./GoogleDriveOAuthModel/model").GoogleDriveFile;
1664
- validateToken(token: string, location: import("@jbrowse/core/util").UriLocation): Promise<string>;
1665
- }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
1239
+ GoogleDriveOAuthInternetAccountModelFactory: typeof GoogleDriveOAuthInternetAccountModelFactory;
1666
1240
  };
1667
1241
  install(pluginManager: PluginManager): void;
1668
1242
  }
package/esm/util.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export declare function getResponseError({ response, reason, statusText, }: {
2
+ response: Response;
3
+ reason?: string;
4
+ statusText?: string;
5
+ }): Promise<string>;
6
+ export declare function getError(response: Response): Promise<string>;
package/esm/util.js ADDED
@@ -0,0 +1,18 @@
1
+ export async function getResponseError({ response, reason, statusText, }) {
2
+ return [
3
+ `HTTP ${response.status}`,
4
+ reason,
5
+ statusText !== null && statusText !== void 0 ? statusText : (await getError(response)),
6
+ ]
7
+ .filter(f => !!f)
8
+ .join(' - ');
9
+ }
10
+ export async function getError(response) {
11
+ try {
12
+ return response.text();
13
+ }
14
+ catch (e) {
15
+ return response.statusText;
16
+ }
17
+ }
18
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EACrC,QAAQ,EACR,MAAM,EACN,UAAU,GAKX;IACC,OAAO;QACL,QAAQ,QAAQ,CAAC,MAAM,EAAE;QACzB,MAAM;QACN,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,CAAC,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC;KACzC;SACE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SAChB,IAAI,CAAC,KAAK,CAAC,CAAA;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,QAAkB;IAC/C,IAAI;QACF,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;KACvB;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,QAAQ,CAAC,UAAU,CAAA;KAC3B;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-authentication",
3
- "version": "2.5.0",
3
+ "version": "2.6.1",
4
4
  "description": "JBrowse 2 Authentication",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -38,8 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "crypto-js": "^3.0.0",
41
- "generic-filehandle": "^3.0.0",
42
- "jwt-decode": "^3.1.2"
41
+ "generic-filehandle": "^3.0.0"
43
42
  },
44
43
  "peerDependencies": {
45
44
  "@jbrowse/core": "^2.0.0",
@@ -57,5 +56,5 @@
57
56
  "distModule": "esm/index.js",
58
57
  "srcModule": "src/index.ts",
59
58
  "module": "esm/index.js",
60
- "gitHead": "d1ca073996d008f0fe9a52f7c1a47ae649dcfdaf"
59
+ "gitHead": "1cbe7ba097fb2d2763c776e5e429e4670cdd583c"
61
60
  }
@@ -51,14 +51,6 @@ const DropboxOAuthConfigSchema = ConfigurationSchema(
51
51
  'getdropbox.com',
52
52
  ],
53
53
  },
54
- /**
55
- * #slot
56
- */
57
- hasRefreshToken: {
58
- description: 'true if the endpoint can supply a refresh token',
59
- type: 'boolean',
60
- defaultValue: true,
61
- },
62
54
  },
63
55
  {
64
56
  /**