@jbrowse/plugin-trix 2.16.1 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,15 @@
1
1
  import Trix from '@gmod/trix';
2
- import { BaseTextSearchAdapter, BaseAdapter, BaseTextSearchArgs } from '@jbrowse/core/data_adapters/BaseAdapter';
3
2
  import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
4
- import { AnyConfigurationModel } from '@jbrowse/core/configuration';
5
- import PluginManager from '@jbrowse/core/PluginManager';
6
- import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
3
+ import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
4
+ import type PluginManager from '@jbrowse/core/PluginManager';
5
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
6
+ import type { BaseTextSearchAdapter, BaseTextSearchArgs } from '@jbrowse/core/data_adapters/BaseAdapter';
7
+ import type { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
7
8
  export default class TrixTextSearchAdapter extends BaseAdapter implements BaseTextSearchAdapter {
8
9
  indexingAttributes?: string[];
9
10
  trixJs: Trix;
10
11
  tracksNames?: string[];
11
12
  constructor(config: AnyConfigurationModel, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
12
- /**
13
- * Returns list of results
14
- * @param args - search options/arguments include: search query
15
- * limit of results to return, searchType...prefix | full | exact", etc.
16
- */
17
13
  searchIndex(args: BaseTextSearchArgs): Promise<BaseResult[]>;
18
14
  freeResources(): void;
19
15
  }
@@ -4,16 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const trix_1 = __importDefault(require("@gmod/trix"));
7
- const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
8
- const io_1 = require("@jbrowse/core/util/io");
9
7
  const BaseResults_1 = __importDefault(require("@jbrowse/core/TextSearch/BaseResults"));
10
8
  const configuration_1 = require("@jbrowse/core/configuration");
9
+ const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
10
+ const io_1 = require("@jbrowse/core/util/io");
11
11
  function decodeURIComponentNoThrow(uri) {
12
12
  try {
13
13
  return decodeURIComponent(uri);
14
14
  }
15
15
  catch (e) {
16
- // avoid throwing exception on a failure to decode URI component
17
16
  return uri;
18
17
  }
19
18
  }
@@ -38,17 +37,11 @@ class TrixTextSearchAdapter extends BaseAdapter_1.BaseAdapter {
38
37
  }
39
38
  this.trixJs = new trix_1.default((0, io_1.openLocation)(ixxFilePath, pluginManager), (0, io_1.openLocation)(ixFilePath, pluginManager), 1500);
40
39
  }
41
- /**
42
- * Returns list of results
43
- * @param args - search options/arguments include: search query
44
- * limit of results to return, searchType...prefix | full | exact", etc.
45
- */
46
40
  async searchIndex(args) {
47
41
  const query = args.queryString.toLowerCase();
48
42
  const strs = query.split(' ');
49
43
  const results = await this.trixJs.search(query);
50
44
  const formatted = results
51
- // if multi-word search try to filter out relevant items
52
45
  .filter(([, data]) => strs.every(r => decodeURIComponentNoThrow(data).toLowerCase().includes(r)))
53
46
  .map(([term, data]) => {
54
47
  const result = JSON.parse(data.replaceAll('|', ','));
@@ -1,7 +1,4 @@
1
1
  declare const TrixTextSearchAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- /**
3
- * #slot
4
- */
5
2
  ixFilePath: {
6
3
  type: string;
7
4
  defaultValue: {
@@ -10,9 +7,6 @@ declare const TrixTextSearchAdapter: import("@jbrowse/core/configuration/configu
10
7
  };
11
8
  description: string;
12
9
  };
13
- /**
14
- * #slot
15
- */
16
10
  ixxFilePath: {
17
11
  type: string;
18
12
  defaultValue: {
@@ -21,9 +15,6 @@ declare const TrixTextSearchAdapter: import("@jbrowse/core/configuration/configu
21
15
  };
22
16
  description: string;
23
17
  };
24
- /**
25
- * #slot
26
- */
27
18
  metaFilePath: {
28
19
  type: string;
29
20
  defaultValue: {
@@ -32,17 +23,11 @@ declare const TrixTextSearchAdapter: import("@jbrowse/core/configuration/configu
32
23
  };
33
24
  description: string;
34
25
  };
35
- /**
36
- * #slot
37
- */
38
26
  tracks: {
39
27
  type: string;
40
28
  defaultValue: never[];
41
29
  description: string;
42
30
  };
43
- /**
44
- * #slot
45
- */
46
31
  assemblyNames: {
47
32
  type: string;
48
33
  defaultValue: never[];
@@ -1,46 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const configuration_1 = require("@jbrowse/core/configuration");
4
- /**
5
- * #config TrixTextSearchAdapter
6
- */
7
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ function x() { }
8
5
  const TrixTextSearchAdapter = (0, configuration_1.ConfigurationSchema)('TrixTextSearchAdapter', {
9
- /**
10
- * #slot
11
- */
12
6
  ixFilePath: {
13
7
  type: 'fileLocation',
14
8
  defaultValue: { uri: 'out.ix', locationType: 'UriLocation' },
15
9
  description: 'the location of the trix ix file',
16
10
  },
17
- /**
18
- * #slot
19
- */
20
11
  ixxFilePath: {
21
12
  type: 'fileLocation',
22
13
  defaultValue: { uri: 'out.ixx', locationType: 'UriLocation' },
23
14
  description: 'the location of the trix ixx file',
24
15
  },
25
- /**
26
- * #slot
27
- */
28
16
  metaFilePath: {
29
17
  type: 'fileLocation',
30
18
  defaultValue: { uri: 'meta.json', locationType: 'UriLocation' },
31
19
  description: 'the location of the metadata json file for the trix index',
32
20
  },
33
- /**
34
- * #slot
35
- */
36
21
  tracks: {
37
22
  type: 'stringArray',
38
23
  defaultValue: [],
39
24
  description: 'List of tracks covered by text search adapter',
40
25
  },
41
- /**
42
- * #slot
43
- */
44
26
  assemblyNames: {
45
27
  type: 'stringArray',
46
28
  defaultValue: [],
@@ -48,9 +30,6 @@ const TrixTextSearchAdapter = (0, configuration_1.ConfigurationSchema)('TrixText
48
30
  },
49
31
  }, {
50
32
  explicitlyTyped: true,
51
- /**
52
- * #identifier
53
- */
54
33
  explicitIdentifier: 'textSearchAdapterId',
55
34
  });
56
35
  exports.default = TrixTextSearchAdapter;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Plugin from '@jbrowse/core/Plugin';
2
- import PluginManager from '@jbrowse/core/PluginManager';
2
+ import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  export default class TrixPlugin extends Plugin {
4
4
  name: string;
5
5
  install(pluginManager: PluginManager): void;
package/dist/index.js CHANGED
@@ -26,8 +26,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const TextSearchAdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/TextSearchAdapterType"));
30
29
  const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
30
+ const TextSearchAdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/TextSearchAdapterType"));
31
31
  const configSchema_1 = __importDefault(require("./TrixTextSearchAdapter/configSchema"));
32
32
  class TrixPlugin extends Plugin_1.default {
33
33
  constructor() {
@@ -1,19 +1,15 @@
1
1
  import Trix from '@gmod/trix';
2
- import { BaseTextSearchAdapter, BaseAdapter, BaseTextSearchArgs } from '@jbrowse/core/data_adapters/BaseAdapter';
3
2
  import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
4
- import { AnyConfigurationModel } from '@jbrowse/core/configuration';
5
- import PluginManager from '@jbrowse/core/PluginManager';
6
- import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
3
+ import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
4
+ import type PluginManager from '@jbrowse/core/PluginManager';
5
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
6
+ import type { BaseTextSearchAdapter, BaseTextSearchArgs } from '@jbrowse/core/data_adapters/BaseAdapter';
7
+ import type { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
7
8
  export default class TrixTextSearchAdapter extends BaseAdapter implements BaseTextSearchAdapter {
8
9
  indexingAttributes?: string[];
9
10
  trixJs: Trix;
10
11
  tracksNames?: string[];
11
12
  constructor(config: AnyConfigurationModel, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
12
- /**
13
- * Returns list of results
14
- * @param args - search options/arguments include: search query
15
- * limit of results to return, searchType...prefix | full | exact", etc.
16
- */
17
13
  searchIndex(args: BaseTextSearchArgs): Promise<BaseResult[]>;
18
14
  freeResources(): void;
19
15
  }
@@ -1,14 +1,13 @@
1
1
  import Trix from '@gmod/trix';
2
- import { BaseAdapter, } from '@jbrowse/core/data_adapters/BaseAdapter';
3
- import { openLocation } from '@jbrowse/core/util/io';
4
2
  import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
5
- import { readConfObject, } from '@jbrowse/core/configuration';
3
+ import { readConfObject } from '@jbrowse/core/configuration';
4
+ import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
5
+ import { openLocation } from '@jbrowse/core/util/io';
6
6
  function decodeURIComponentNoThrow(uri) {
7
7
  try {
8
8
  return decodeURIComponent(uri);
9
9
  }
10
10
  catch (e) {
11
- // avoid throwing exception on a failure to decode URI component
12
11
  return uri;
13
12
  }
14
13
  }
@@ -33,17 +32,11 @@ export default class TrixTextSearchAdapter extends BaseAdapter {
33
32
  }
34
33
  this.trixJs = new Trix(openLocation(ixxFilePath, pluginManager), openLocation(ixFilePath, pluginManager), 1500);
35
34
  }
36
- /**
37
- * Returns list of results
38
- * @param args - search options/arguments include: search query
39
- * limit of results to return, searchType...prefix | full | exact", etc.
40
- */
41
35
  async searchIndex(args) {
42
36
  const query = args.queryString.toLowerCase();
43
37
  const strs = query.split(' ');
44
38
  const results = await this.trixJs.search(query);
45
39
  const formatted = results
46
- // if multi-word search try to filter out relevant items
47
40
  .filter(([, data]) => strs.every(r => decodeURIComponentNoThrow(data).toLowerCase().includes(r)))
48
41
  .map(([term, data]) => {
49
42
  const result = JSON.parse(data.replaceAll('|', ','));
@@ -1,7 +1,4 @@
1
1
  declare const TrixTextSearchAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- /**
3
- * #slot
4
- */
5
2
  ixFilePath: {
6
3
  type: string;
7
4
  defaultValue: {
@@ -10,9 +7,6 @@ declare const TrixTextSearchAdapter: import("@jbrowse/core/configuration/configu
10
7
  };
11
8
  description: string;
12
9
  };
13
- /**
14
- * #slot
15
- */
16
10
  ixxFilePath: {
17
11
  type: string;
18
12
  defaultValue: {
@@ -21,9 +15,6 @@ declare const TrixTextSearchAdapter: import("@jbrowse/core/configuration/configu
21
15
  };
22
16
  description: string;
23
17
  };
24
- /**
25
- * #slot
26
- */
27
18
  metaFilePath: {
28
19
  type: string;
29
20
  defaultValue: {
@@ -32,17 +23,11 @@ declare const TrixTextSearchAdapter: import("@jbrowse/core/configuration/configu
32
23
  };
33
24
  description: string;
34
25
  };
35
- /**
36
- * #slot
37
- */
38
26
  tracks: {
39
27
  type: string;
40
28
  defaultValue: never[];
41
29
  description: string;
42
30
  };
43
- /**
44
- * #slot
45
- */
46
31
  assemblyNames: {
47
32
  type: string;
48
33
  defaultValue: never[];
@@ -1,44 +1,26 @@
1
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
2
- /**
3
- * #config TrixTextSearchAdapter
4
- */
5
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ function x() { }
6
3
  const TrixTextSearchAdapter = ConfigurationSchema('TrixTextSearchAdapter', {
7
- /**
8
- * #slot
9
- */
10
4
  ixFilePath: {
11
5
  type: 'fileLocation',
12
6
  defaultValue: { uri: 'out.ix', locationType: 'UriLocation' },
13
7
  description: 'the location of the trix ix file',
14
8
  },
15
- /**
16
- * #slot
17
- */
18
9
  ixxFilePath: {
19
10
  type: 'fileLocation',
20
11
  defaultValue: { uri: 'out.ixx', locationType: 'UriLocation' },
21
12
  description: 'the location of the trix ixx file',
22
13
  },
23
- /**
24
- * #slot
25
- */
26
14
  metaFilePath: {
27
15
  type: 'fileLocation',
28
16
  defaultValue: { uri: 'meta.json', locationType: 'UriLocation' },
29
17
  description: 'the location of the metadata json file for the trix index',
30
18
  },
31
- /**
32
- * #slot
33
- */
34
19
  tracks: {
35
20
  type: 'stringArray',
36
21
  defaultValue: [],
37
22
  description: 'List of tracks covered by text search adapter',
38
23
  },
39
- /**
40
- * #slot
41
- */
42
24
  assemblyNames: {
43
25
  type: 'stringArray',
44
26
  defaultValue: [],
@@ -46,9 +28,6 @@ const TrixTextSearchAdapter = ConfigurationSchema('TrixTextSearchAdapter', {
46
28
  },
47
29
  }, {
48
30
  explicitlyTyped: true,
49
- /**
50
- * #identifier
51
- */
52
31
  explicitIdentifier: 'textSearchAdapterId',
53
32
  });
54
33
  export default TrixTextSearchAdapter;
package/esm/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Plugin from '@jbrowse/core/Plugin';
2
- import PluginManager from '@jbrowse/core/PluginManager';
2
+ import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  export default class TrixPlugin extends Plugin {
4
4
  name: string;
5
5
  install(pluginManager: PluginManager): void;
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import TextSearchAdapterType from '@jbrowse/core/pluggableElementTypes/TextSearchAdapterType';
2
1
  import Plugin from '@jbrowse/core/Plugin';
2
+ import TextSearchAdapterType from '@jbrowse/core/pluggableElementTypes/TextSearchAdapterType';
3
3
  import configSchema from './TrixTextSearchAdapter/configSchema';
4
4
  export default class TrixPlugin extends Plugin {
5
5
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-trix",
3
- "version": "2.16.1",
3
+ "version": "2.18.0",
4
4
  "description": "JBrowse 2 trix text search adapter",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -52,5 +52,5 @@
52
52
  "distModule": "esm/index.js",
53
53
  "srcModule": "src/index.ts",
54
54
  "module": "esm/index.js",
55
- "gitHead": "c6a658d2344989895543f0456b1cf7dd3b937769"
55
+ "gitHead": "c344ea60099cb7e460b77f15808946b24a7eee74"
56
56
  }