@jbrowse/core 2.2.0 → 2.2.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 (63) hide show
  1. package/BaseFeatureWidget/BaseFeatureDetail.d.ts +1 -0
  2. package/BaseFeatureWidget/BaseFeatureDetail.js +43 -28
  3. package/BaseFeatureWidget/SequenceBox.js +4 -8
  4. package/Plugin.d.ts +1 -1
  5. package/PluginLoader.d.ts +2 -2
  6. package/PluginManager.d.ts +3 -3
  7. package/assemblyManager/assembly.d.ts +3 -3
  8. package/assemblyManager/assembly.js +1 -1
  9. package/configuration/configurationSchema.d.ts +2 -2
  10. package/data_adapters/BaseAdapter.d.ts +2 -2
  11. package/data_adapters/dataAdapterCache.d.ts +1 -1
  12. package/package.json +2 -2
  13. package/pluggableElementTypes/AdapterType.d.ts +1 -1
  14. package/pluggableElementTypes/AddTrackWorkflowType.d.ts +2 -2
  15. package/pluggableElementTypes/RpcMethodType.d.ts +1 -1
  16. package/pluggableElementTypes/ViewType.d.ts +2 -2
  17. package/pluggableElementTypes/index.d.ts +2 -2
  18. package/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +23 -2
  19. package/pluggableElementTypes/models/BaseConnectionModelFactory.js +24 -2
  20. package/pluggableElementTypes/models/BaseDisplayModel.d.ts +2 -2
  21. package/pluggableElementTypes/models/BaseTrackModel.d.ts +49 -4
  22. package/pluggableElementTypes/models/BaseTrackModel.js +77 -26
  23. package/pluggableElementTypes/models/BaseViewModel.d.ts +22 -0
  24. package/pluggableElementTypes/models/BaseViewModel.js +41 -2
  25. package/pluggableElementTypes/models/InternetAccountModel.d.ts +53 -6
  26. package/pluggableElementTypes/models/InternetAccountModel.js +57 -6
  27. package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +2 -2
  28. package/pluggableElementTypes/models/baseTrackConfig.d.ts +2 -2
  29. package/pluggableElementTypes/models/baseTrackConfig.js +9 -0
  30. package/pluggableElementTypes/renderers/BoxRendererType.d.ts +1 -1
  31. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +1 -1
  32. package/pluggableElementTypes/renderers/RendererType.d.ts +1 -1
  33. package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +1 -1
  34. package/pluggableElementTypes/renderers/util/serializableFilterChain.d.ts +2 -2
  35. package/rpc/RpcManager.d.ts +2 -2
  36. package/rpc/remoteAbortSignals.d.ts +1 -1
  37. package/tsconfig.build.tsbuildinfo +1 -1
  38. package/ui/App.d.ts +2 -2
  39. package/ui/App.js +6 -8
  40. package/ui/AssemblySelector.d.ts +1 -1
  41. package/ui/AssemblySelector.js +12 -10
  42. package/ui/EditableTypography.d.ts +4 -4
  43. package/ui/EditableTypography.js +7 -11
  44. package/ui/Logo.d.ts +1 -1
  45. package/ui/Menu.d.ts +2 -2
  46. package/ui/Snackbar.d.ts +1 -1
  47. package/ui/ViewContainer.d.ts +2 -1
  48. package/ui/ViewContainer.js +34 -22
  49. package/util/Base1DViewModel.d.ts +72 -2
  50. package/util/Base1DViewModel.js +94 -3
  51. package/util/blockTypes.d.ts +1 -1
  52. package/util/index.d.ts +2 -1
  53. package/util/index.js +9 -3
  54. package/util/io/RemoteFileWithRangeCache.js +2 -2
  55. package/util/io/index.js +3 -3
  56. package/util/jexl.d.ts +1 -1
  57. package/util/layouts/BaseLayout.d.ts +1 -1
  58. package/util/offscreenCanvasPonyfill.d.ts +2 -2
  59. package/util/offscreenCanvasUtils.d.ts +1 -1
  60. package/util/tracks.d.ts +2 -2
  61. package/util/types/index.d.ts +15 -8
  62. package/util/types/index.js +8 -1
  63. package/util/types/util.d.ts +5 -5
@@ -7,35 +7,64 @@ const configuration_1 = require("../../configuration");
7
7
  const util_1 = require("../../util");
8
8
  const types_1 = require("../../util/types");
9
9
  const mst_1 = require("../../util/types/mst");
10
- // these MST models only exist for tracks that are *shown*.
11
- // they should contain only UI state for the track, and have
12
- // a reference to a track configuration (stored under
13
- // session.configuration.assemblies.get(assemblyName).tracks).
14
- // note that multiple displayed tracks could use the same configuration.
15
- function createBaseTrackModel(pluginManager, trackType, baseTrackConfig) {
10
+ /**
11
+ * #stateModel BaseTrackModel
12
+ * these MST models only exist for tracks that are *shown*.
13
+ * they should contain only UI state for the track, and have
14
+ * a reference to a track configuration (stored under
15
+ * session.configuration.assemblies.get(assemblyName).tracks).
16
+ * note that multiple displayed tracks could use the same
17
+ * configuration.
18
+ */
19
+ function createBaseTrackModel(pm, trackType, baseTrackConfig) {
16
20
  return mobx_state_tree_1.types
17
21
  .model(trackType, {
22
+ /**
23
+ * #property
24
+ */
18
25
  id: mst_1.ElementId,
26
+ /**
27
+ * #property
28
+ */
19
29
  type: mobx_state_tree_1.types.literal(trackType),
30
+ /**
31
+ * #property
32
+ */
20
33
  configuration: (0, configuration_1.ConfigurationReference)(baseTrackConfig),
21
- displays: mobx_state_tree_1.types.array(pluginManager.pluggableMstType('display', 'stateModel')),
34
+ /**
35
+ * #property
36
+ */
37
+ minimized: false,
38
+ /**
39
+ * #property
40
+ */
41
+ displays: mobx_state_tree_1.types.array(pm.pluggableMstType('display', 'stateModel')),
22
42
  })
23
43
  .views(self => ({
44
+ /**
45
+ * #getter
46
+ * determines which webworker to send the track to, currently based on trackId
47
+ */
24
48
  get rpcSessionId() {
25
49
  return self.configuration.trackId;
26
50
  },
51
+ /**
52
+ * #getter
53
+ */
27
54
  get name() {
28
55
  return (0, configuration_1.getConf)(self, 'name');
29
56
  },
57
+ /**
58
+ * #getter
59
+ */
30
60
  get textSearchAdapter() {
31
61
  return (0, configuration_1.getConf)(self, 'textSearchAdapter');
32
62
  },
33
63
  /**
34
- * the PluggableElementType for the currently defined adapter
64
+ * #getter
35
65
  */
36
66
  get adapterType() {
37
67
  const adapterConfig = (0, configuration_1.getConf)(self, 'adapter');
38
- const { pluginManager: pm } = (0, util_1.getEnv)(self);
39
68
  if (!adapterConfig) {
40
69
  throw new Error(`no adapter configuration provided for ${self.type}`);
41
70
  }
@@ -45,13 +74,15 @@ function createBaseTrackModel(pluginManager, trackType, baseTrackConfig) {
45
74
  }
46
75
  return adapterType;
47
76
  },
77
+ /**
78
+ * #getter
79
+ */
48
80
  get viewMenuActions() {
49
- const menuItems = [];
50
- self.displays.forEach(display => {
51
- menuItems.push(...display.viewMenuActions);
52
- });
53
- return menuItems;
81
+ return self.displays.map(d => d.viewMenuActions).flat();
54
82
  },
83
+ /**
84
+ * #getter
85
+ */
55
86
  get canConfigure() {
56
87
  const session = (0, util_1.getSession)(self);
57
88
  return ((0, types_1.isSessionModelWithConfigEditing)(session) &&
@@ -64,6 +95,15 @@ function createBaseTrackModel(pluginManager, trackType, baseTrackConfig) {
64
95
  },
65
96
  }))
66
97
  .actions(self => ({
98
+ /**
99
+ * #action
100
+ */
101
+ setMinimized(flag) {
102
+ self.minimized = flag;
103
+ },
104
+ /**
105
+ * #action
106
+ */
67
107
  activateConfigurationUI() {
68
108
  const session = (0, util_1.getSession)(self);
69
109
  const view = (0, util_1.getContainingView)(self);
@@ -78,10 +118,13 @@ function createBaseTrackModel(pluginManager, trackType, baseTrackConfig) {
78
118
  }
79
119
  }
80
120
  },
121
+ /**
122
+ * #action
123
+ */
81
124
  showDisplay(displayId, initialSnapshot = {}) {
82
- const schema = pluginManager.pluggableConfigSchemaType('display');
125
+ const schema = pm.pluggableConfigSchemaType('display');
83
126
  const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), displayId);
84
- const displayType = pluginManager.getDisplayType(conf.type);
127
+ const displayType = pm.getDisplayType(conf.type);
85
128
  if (!displayType) {
86
129
  throw new Error(`unknown display type ${conf.type}`);
87
130
  }
@@ -92,21 +135,27 @@ function createBaseTrackModel(pluginManager, trackType, baseTrackConfig) {
92
135
  });
93
136
  self.displays.push(display);
94
137
  },
138
+ /**
139
+ * #action
140
+ */
95
141
  hideDisplay(displayId) {
96
- const schema = pluginManager.pluggableConfigSchemaType('display');
142
+ const schema = pm.pluggableConfigSchemaType('display');
97
143
  const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), displayId);
98
144
  const t = self.displays.filter(d => d.configuration === conf);
99
145
  (0, mobx_1.transaction)(() => t.forEach(d => self.displays.remove(d)));
100
146
  return t.length;
101
147
  },
148
+ /**
149
+ * #action
150
+ */
102
151
  replaceDisplay(oldId, newId, initialSnapshot = {}) {
103
152
  const idx = self.displays.findIndex(d => d.configuration.displayId === oldId);
104
153
  if (idx === -1) {
105
154
  throw new Error(`could not find display id ${oldId} to replace`);
106
155
  }
107
- const schema = pluginManager.pluggableConfigSchemaType('display');
156
+ const schema = pm.pluggableConfigSchemaType('display');
108
157
  const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), newId);
109
- const displayType = pluginManager.getDisplayType(conf.type);
158
+ const displayType = pm.getDisplayType(conf.type);
110
159
  if (!displayType) {
111
160
  throw new Error(`unknown display type ${conf.type}`);
112
161
  }
@@ -118,16 +167,18 @@ function createBaseTrackModel(pluginManager, trackType, baseTrackConfig) {
118
167
  },
119
168
  }))
120
169
  .views(self => ({
170
+ /**
171
+ * #method
172
+ */
121
173
  trackMenuItems() {
122
- const menuItems = [];
123
- self.displays.forEach(display => {
124
- menuItems.push(...display.trackMenuItems());
125
- });
174
+ const menuItems = self.displays
175
+ .map(d => d.trackMenuItems())
176
+ .flat();
126
177
  const displayChoices = [];
127
178
  const view = (0, util_1.getContainingView)(self);
128
- const viewType = pluginManager.getViewType(view.type);
129
- const compatibleDisplayTypes = viewType.displayTypes.map(displayType => displayType.name);
130
- const compatibleDisplays = self.configuration.displays.filter((displayConf) => compatibleDisplayTypes.includes(displayConf.type));
179
+ const viewType = pm.getViewType(view.type);
180
+ const compatibleDisplayTypes = viewType.displayTypes.map(d => d.name);
181
+ const compatibleDisplays = self.configuration.displays.filter((d) => compatibleDisplayTypes.includes(d.type));
131
182
  const shownId = self.displays[0].configuration.displayId;
132
183
  if (compatibleDisplays.length > 1) {
133
184
  displayChoices.push({ type: 'divider' }, { type: 'subHeader', label: 'Display types' });
@@ -3,13 +3,35 @@ import { MenuItem } from '../../ui';
3
3
  declare const BaseViewModel: import("mobx-state-tree").IModelType<{
4
4
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
5
5
  displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
6
+ minimized: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
6
7
  }, {
7
8
  width: number;
8
9
  } & {
10
+ /**
11
+ * #getter
12
+ */
9
13
  menuItems(): MenuItem[];
10
14
  } & {
15
+ /**
16
+ * #action
17
+ */
11
18
  setDisplayName(name: string): void;
19
+ /**
20
+ * #action
21
+ * width is an important attribute of the view model, when it becomes set, it
22
+ * often indicates when the app can start drawing to it. certain views like
23
+ * lgv are strict about this because if it tries to draw before it knows the
24
+ * width it should draw to, it may start fetching data for regions it doesn't
25
+ * need to
26
+ *
27
+ * setWidth is updated by a ResizeObserver generally, the views often need
28
+ * to know how wide they are to properly draw genomic regions
29
+ */
12
30
  setWidth(newWidth: number): void;
31
+ /**
32
+ * #action
33
+ */
34
+ setMinimized(flag: boolean): void;
13
35
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
14
36
  export default BaseViewModel;
15
37
  export interface IBaseViewModel extends Instance<typeof BaseViewModel> {
@@ -2,25 +2,64 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const mobx_state_tree_1 = require("mobx-state-tree");
4
4
  const mst_1 = require("../../util/types/mst");
5
+ /**
6
+ * #stateModel BaseViewModel
7
+ */
8
+ function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
5
9
  const BaseViewModel = mobx_state_tree_1.types
6
10
  .model('BaseView', {
11
+ /**
12
+ * #property
13
+ */
7
14
  id: mst_1.ElementId,
15
+ /**
16
+ * #property
17
+ * displayName is displayed in the header of the view, or assembly names
18
+ * being used if none is specified
19
+ */
8
20
  displayName: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
21
+ /**
22
+ * #property
23
+ */
24
+ minimized: false,
9
25
  })
10
- .volatile(( /* self */) => ({
26
+ .volatile(() => ({
11
27
  width: 800,
12
28
  }))
13
- .views(( /* self */) => ({
29
+ .views(() => ({
30
+ /**
31
+ * #getter
32
+ */
14
33
  menuItems() {
15
34
  return [];
16
35
  },
17
36
  }))
18
37
  .actions(self => ({
38
+ /**
39
+ * #action
40
+ */
19
41
  setDisplayName(name) {
20
42
  self.displayName = name;
21
43
  },
44
+ /**
45
+ * #action
46
+ * width is an important attribute of the view model, when it becomes set, it
47
+ * often indicates when the app can start drawing to it. certain views like
48
+ * lgv are strict about this because if it tries to draw before it knows the
49
+ * width it should draw to, it may start fetching data for regions it doesn't
50
+ * need to
51
+ *
52
+ * setWidth is updated by a ResizeObserver generally, the views often need
53
+ * to know how wide they are to properly draw genomic regions
54
+ */
22
55
  setWidth(newWidth) {
23
56
  self.width = newWidth;
24
57
  },
58
+ /**
59
+ * #action
60
+ */
61
+ setMinimized(flag) {
62
+ self.minimized = flag;
63
+ },
25
64
  }));
26
65
  exports.default = BaseViewModel;
@@ -3,52 +3,92 @@ import { Instance } from 'mobx-state-tree';
3
3
  import { RemoteFileWithRangeCache } from '../../util/io';
4
4
  import { UriLocation, AnyReactComponentType } from '../../util/types';
5
5
  export declare const InternetAccount: import("mobx-state-tree").IModelType<{
6
+ /**
7
+ * #property
8
+ */
6
9
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
10
+ /**
11
+ * #property
12
+ */
7
13
  type: import("mobx-state-tree").ISimpleType<string>;
8
14
  }, {
15
+ /**
16
+ * #getter
17
+ */
9
18
  readonly name: string;
19
+ /**
20
+ * #getter
21
+ */
10
22
  readonly description: string;
23
+ /**
24
+ * #getter
25
+ */
11
26
  readonly internetAccountId: string;
27
+ /**
28
+ * #getter
29
+ */
12
30
  readonly authHeader: string;
31
+ /**
32
+ * #getter
33
+ */
13
34
  readonly tokenType: string;
35
+ /**
36
+ * #getter
37
+ */
14
38
  readonly domains: string[];
15
39
  /**
40
+ * #getter
16
41
  * Can use this to customize what is displayed in fileSelector's toggle box
17
42
  */
18
43
  readonly toggleContents: React.ReactNode;
19
44
  /**
45
+ * #getter
20
46
  * Can use this to customize what the fileSelector. It takes a prop called
21
47
  * `setLocation` that should be used to set a UriLocation
22
48
  */
23
49
  readonly SelectorComponent: AnyReactComponentType | undefined;
24
50
  /**
51
+ * #getter
25
52
  * Can use this to add a label to the UrlChooser. Has no effect if a custom
26
53
  * SelectorComponent is supplied
27
54
  */
28
55
  readonly selectorLabel: string | undefined;
29
56
  } & {
30
57
  /**
58
+ * #method
31
59
  * Determine whether this internetAccount provides credentials for a URL
32
60
  * @param location - UriLocation of resource
33
61
  * @returns true or false
34
62
  */
35
63
  handlesLocation(location: UriLocation): boolean;
36
64
  /**
65
+ * #getter
37
66
  * The key used to store this internetAccount's token in sessionStorage
38
67
  */
39
68
  readonly tokenKey: string;
40
69
  } & {
41
70
  /**
71
+ * #action
42
72
  * Must be implemented by a model extending or composing this one. Pass the
43
73
  * user's token to `resolve`.
44
74
  * @param resolve - Pass the token to this function
45
75
  * @param reject - If there is an error getting the token, call this function
46
76
  */
47
77
  getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): void;
78
+ /**
79
+ * #action
80
+ */
48
81
  storeToken(token: string): void;
82
+ /**
83
+ * #action
84
+ */
49
85
  removeToken(): void;
86
+ /**
87
+ * #action
88
+ */
50
89
  retrieveToken(): string | null;
51
90
  /**
91
+ * #action
52
92
  * This can be used by an internetAccount to validate a token works before
53
93
  * it is used. This is run when preAuthorizationInformation is requested, so
54
94
  * it can be used to check that a token is valid before sending it to a
@@ -57,12 +97,13 @@ export declare const InternetAccount: import("mobx-state-tree").IModelType<{
57
97
  * if the original one was invalid. Should throw an error if a token is
58
98
  * invalid.
59
99
  * @param token - Auth token
60
- * @param location - UriLocation of the resource
100
+ * @param loc - UriLocation of the resource
61
101
  * @returns - Valid auth token
62
102
  */
63
- validateToken(token: string, location: UriLocation): Promise<string>;
103
+ validateToken(token: string, loc: UriLocation): Promise<string>;
64
104
  } & {
65
105
  /**
106
+ * #action
66
107
  * Try to get the token from the location pre-auth, from local storage,
67
108
  * or from a previously cached promise. If token is not available, uses
68
109
  * `getTokenFromUser`.
@@ -71,6 +112,9 @@ export declare const InternetAccount: import("mobx-state-tree").IModelType<{
71
112
  */
72
113
  getToken(location?: UriLocation): Promise<string>;
73
114
  } & {
115
+ /**
116
+ * #action
117
+ */
74
118
  addAuthHeaderToInit(init: RequestInit | undefined, token: string): {
75
119
  headers: Headers;
76
120
  body?: BodyInit | null | undefined;
@@ -87,6 +131,7 @@ export declare const InternetAccount: import("mobx-state-tree").IModelType<{
87
131
  window?: null | undefined;
88
132
  };
89
133
  /**
134
+ * #action
90
135
  * Gets the token and returns it along with the information needed to
91
136
  * create a new internetAccount.
92
137
  * @param location - UriLocation of the resource
@@ -101,20 +146,22 @@ export declare const InternetAccount: import("mobx-state-tree").IModelType<{
101
146
  }>;
102
147
  } & {
103
148
  /**
149
+ * #action
104
150
  * Get a fetch method that will add any needed authentication headers to
105
151
  * the request before sending it. If location is provided, it will be
106
152
  * checked to see if it includes a token in it pre-auth information.
107
- * @param location - UriLocation of the resource
153
+ * @param loc - UriLocation of the resource
108
154
  * @returns A function that can be used to fetch
109
155
  */
110
- getFetcher(location?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
156
+ getFetcher(loc?: UriLocation): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
111
157
  } & {
112
158
  /**
159
+ * #action
113
160
  * Gets a filehandle that uses a fetch that adds auth headers
114
161
  * @param location - UriLocation of the resource
115
162
  * @returns A filehandle
116
163
  */
117
164
  openLocation(location: UriLocation): RemoteFileWithRangeCache;
118
165
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
119
- export declare type BaseInternetAccountStateModel = typeof InternetAccount;
120
- export declare type BaseInternetAccountModel = Instance<BaseInternetAccountStateModel>;
166
+ export type BaseInternetAccountStateModel = typeof InternetAccount;
167
+ export type BaseInternetAccountModel = Instance<BaseInternetAccountStateModel>;
@@ -6,37 +6,67 @@ const configuration_1 = require("../../configuration");
6
6
  const io_1 = require("../../util/io");
7
7
  const mst_1 = require("../../util/types/mst");
8
8
  const inWebWorker = typeof sessionStorage === 'undefined';
9
+ /**
10
+ * #stateModel BaseInternetAccountModel
11
+ */
12
+ function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
9
13
  exports.InternetAccount = mobx_state_tree_1.types
10
14
  .model('InternetAccount', {
15
+ /**
16
+ * #property
17
+ */
11
18
  id: mst_1.ElementId,
19
+ /**
20
+ * #property
21
+ */
12
22
  type: mobx_state_tree_1.types.string,
13
23
  })
14
24
  .views(self => ({
25
+ /**
26
+ * #getter
27
+ */
15
28
  get name() {
16
29
  return (0, configuration_1.getConf)(self, 'name');
17
30
  },
31
+ /**
32
+ * #getter
33
+ */
18
34
  get description() {
19
35
  return (0, configuration_1.getConf)(self, 'description');
20
36
  },
37
+ /**
38
+ * #getter
39
+ */
21
40
  get internetAccountId() {
22
41
  return (0, configuration_1.getConf)(self, 'internetAccountId');
23
42
  },
43
+ /**
44
+ * #getter
45
+ */
24
46
  get authHeader() {
25
47
  return (0, configuration_1.getConf)(self, 'authHeader');
26
48
  },
49
+ /**
50
+ * #getter
51
+ */
27
52
  get tokenType() {
28
53
  return (0, configuration_1.getConf)(self, 'tokenType');
29
54
  },
55
+ /**
56
+ * #getter
57
+ */
30
58
  get domains() {
31
59
  return (0, configuration_1.getConf)(self, 'domains');
32
60
  },
33
61
  /**
62
+ * #getter
34
63
  * Can use this to customize what is displayed in fileSelector's toggle box
35
64
  */
36
65
  get toggleContents() {
37
66
  return null;
38
67
  },
39
68
  /**
69
+ * #getter
40
70
  * Can use this to customize what the fileSelector. It takes a prop called
41
71
  * `setLocation` that should be used to set a UriLocation
42
72
  */
@@ -44,6 +74,7 @@ exports.InternetAccount = mobx_state_tree_1.types
44
74
  return undefined;
45
75
  },
46
76
  /**
77
+ * #getter
47
78
  * Can use this to add a label to the UrlChooser. Has no effect if a custom
48
79
  * SelectorComponent is supplied
49
80
  */
@@ -53,14 +84,16 @@ exports.InternetAccount = mobx_state_tree_1.types
53
84
  }))
54
85
  .views(self => ({
55
86
  /**
87
+ * #method
56
88
  * Determine whether this internetAccount provides credentials for a URL
57
89
  * @param location - UriLocation of resource
58
90
  * @returns true or false
59
91
  */
60
92
  handlesLocation(location) {
61
- return self.domains.some((domain) => location === null || location === void 0 ? void 0 : location.uri.includes(domain));
93
+ return self.domains.some(domain => location === null || location === void 0 ? void 0 : location.uri.includes(domain));
62
94
  },
63
95
  /**
96
+ * #getter
64
97
  * The key used to store this internetAccount's token in sessionStorage
65
98
  */
66
99
  get tokenKey() {
@@ -69,6 +102,7 @@ exports.InternetAccount = mobx_state_tree_1.types
69
102
  }))
70
103
  .actions(self => ({
71
104
  /**
105
+ * #action
72
106
  * Must be implemented by a model extending or composing this one. Pass the
73
107
  * user's token to `resolve`.
74
108
  * @param resolve - Pass the token to this function
@@ -77,16 +111,26 @@ exports.InternetAccount = mobx_state_tree_1.types
77
111
  getTokenFromUser(resolve, reject) {
78
112
  throw new Error('getTokenFromUser must be implemented by extending model');
79
113
  },
114
+ /**
115
+ * #action
116
+ */
80
117
  storeToken(token) {
81
118
  sessionStorage.setItem(self.tokenKey, token);
82
119
  },
120
+ /**
121
+ * #action
122
+ */
83
123
  removeToken() {
84
124
  sessionStorage.removeItem(self.tokenKey);
85
125
  },
126
+ /**
127
+ * #action
128
+ */
86
129
  retrieveToken() {
87
130
  return sessionStorage.getItem(self.tokenKey);
88
131
  },
89
132
  /**
133
+ * #action
90
134
  * This can be used by an internetAccount to validate a token works before
91
135
  * it is used. This is run when preAuthorizationInformation is requested, so
92
136
  * it can be used to check that a token is valid before sending it to a
@@ -95,10 +139,10 @@ exports.InternetAccount = mobx_state_tree_1.types
95
139
  * if the original one was invalid. Should throw an error if a token is
96
140
  * invalid.
97
141
  * @param token - Auth token
98
- * @param location - UriLocation of the resource
142
+ * @param loc - UriLocation of the resource
99
143
  * @returns - Valid auth token
100
144
  */
101
- async validateToken(token, location) {
145
+ async validateToken(token, loc) {
102
146
  return token;
103
147
  },
104
148
  }))
@@ -106,6 +150,7 @@ exports.InternetAccount = mobx_state_tree_1.types
106
150
  let tokenPromise = undefined;
107
151
  return {
108
152
  /**
153
+ * #action
109
154
  * Try to get the token from the location pre-auth, from local storage,
110
155
  * or from a previously cached promise. If token is not available, uses
111
156
  * `getTokenFromUser`.
@@ -146,6 +191,9 @@ exports.InternetAccount = mobx_state_tree_1.types
146
191
  };
147
192
  })
148
193
  .actions(self => ({
194
+ /**
195
+ * #action
196
+ */
149
197
  addAuthHeaderToInit(init = {}, token) {
150
198
  const tokenInfoString = self.tokenType
151
199
  ? `${self.tokenType} ${token}`
@@ -155,6 +203,7 @@ exports.InternetAccount = mobx_state_tree_1.types
155
203
  return { ...init, headers: newHeaders };
156
204
  },
157
205
  /**
206
+ * #action
158
207
  * Gets the token and returns it along with the information needed to
159
208
  * create a new internetAccount.
160
209
  * @param location - UriLocation of the resource
@@ -178,15 +227,16 @@ exports.InternetAccount = mobx_state_tree_1.types
178
227
  }))
179
228
  .actions(self => ({
180
229
  /**
230
+ * #action
181
231
  * Get a fetch method that will add any needed authentication headers to
182
232
  * the request before sending it. If location is provided, it will be
183
233
  * checked to see if it includes a token in it pre-auth information.
184
- * @param location - UriLocation of the resource
234
+ * @param loc - UriLocation of the resource
185
235
  * @returns A function that can be used to fetch
186
236
  */
187
- getFetcher(location) {
237
+ getFetcher(loc) {
188
238
  return async (input, init) => {
189
- const authToken = await self.getToken(location);
239
+ const authToken = await self.getToken(loc);
190
240
  const newInit = self.addAuthHeaderToInit(init, authToken);
191
241
  return fetch(input, newInit);
192
242
  };
@@ -194,6 +244,7 @@ exports.InternetAccount = mobx_state_tree_1.types
194
244
  }))
195
245
  .actions(self => ({
196
246
  /**
247
+ * #action
197
248
  * Gets a filehandle that uses a fetch that adds auth headers
198
249
  * @param location - UriLocation of the resource
199
250
  * @returns A filehandle
@@ -1,4 +1,4 @@
1
1
  import { Instance } from 'mobx-state-tree';
2
2
  export declare const BaseInternetAccountConfig: import("../../configuration").AnyConfigurationSchemaType;
3
- export declare type BaseInternetAccountConfigModel = typeof BaseInternetAccountConfig;
4
- export declare type BaseInternetAccountConfig = Instance<BaseInternetAccountConfigModel>;
3
+ export type BaseInternetAccountConfigModel = typeof BaseInternetAccountConfig;
4
+ export type BaseInternetAccountConfig = Instance<BaseInternetAccountConfigModel>;
@@ -4,5 +4,5 @@ import PluginManager from '../../PluginManager';
4
4
  * #config BaseTrack
5
5
  */
6
6
  export declare function createBaseTrackConfig(pluginManager: PluginManager): import("../../configuration").AnyConfigurationSchemaType;
7
- export declare type BaseTrackConfigModel = ReturnType<typeof createBaseTrackConfig>;
8
- export declare type BaseTrackConfig = Instance<BaseTrackConfigModel>;
7
+ export type BaseTrackConfigModel = ReturnType<typeof createBaseTrackConfig>;
8
+ export type BaseTrackConfig = Instance<BaseTrackConfigModel>;
@@ -108,12 +108,18 @@ function createBaseTrackConfig(pluginManager) {
108
108
  },
109
109
  }),
110
110
  formatAbout: (0, configuration_1.ConfigurationSchema)('FormatAbout', {
111
+ /**
112
+ * #slot formatAbout.config
113
+ */
111
114
  config: {
112
115
  type: 'frozen',
113
116
  description: 'formats configuration object in about dialog',
114
117
  defaultValue: {},
115
118
  contextVariable: ['config'],
116
119
  },
120
+ /**
121
+ * #slot formatAbout.hideUris
122
+ */
117
123
  hideUris: {
118
124
  type: 'boolean',
119
125
  defaultValue: false,
@@ -141,6 +147,9 @@ function createBaseTrackConfig(pluginManager) {
141
147
  }
142
148
  return { ...snap, displays };
143
149
  },
150
+ /**
151
+ * #identifier
152
+ */
144
153
  explicitIdentifier: 'trackId',
145
154
  explicitlyTyped: true,
146
155
  actions: (self) => ({
@@ -12,7 +12,7 @@ export interface LayoutSessionProps {
12
12
  bpPerPx: number;
13
13
  filters: SerializableFilterChain;
14
14
  }
15
- export declare type MyMultiLayout = MultiLayout<GranularRectLayout<unknown>, unknown>;
15
+ export type MyMultiLayout = MultiLayout<GranularRectLayout<unknown>, unknown>;
16
16
  export interface CachedLayout {
17
17
  layout: MyMultiLayout;
18
18
  config: AnyConfigurationModel;