@vitessce/json 3.6.6 → 3.6.8

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 (58) hide show
  1. package/dist/{deflate-BYKpSTT6.js → deflate-DstPPSeQ.js} +1 -1
  2. package/dist/{index-B7T2DtqE.js → index-D2yFM0Ax.js} +552 -471
  3. package/dist/index.js +1 -1
  4. package/dist/{jpeg-HiHjx4CG.js → jpeg-DLyTBIoB.js} +1 -1
  5. package/dist/{lerc-BMjU_3GZ.js → lerc-C3NYZ4w9.js} +1 -1
  6. package/dist/{lzw-U6CSxLDR.js → lzw-CscKL06f.js} +1 -1
  7. package/dist/{packbits-DoX7PkwR.js → packbits-D3LeL8FE.js} +1 -1
  8. package/dist/{raw-Cy08b44Z.js → raw-uN_cumDY.js} +1 -1
  9. package/dist/{webimage-Pvwg1VPe.js → webimage-CsEP6b6I.js} +1 -1
  10. package/dist-tsc/JsonSource.d.ts +2 -2
  11. package/dist-tsc/JsonSource.d.ts.map +1 -1
  12. package/dist-tsc/JsonSource.js +7 -9
  13. package/dist-tsc/json-loaders/JsonLoader.d.ts +1 -1
  14. package/dist-tsc/json-loaders/JsonLoader.d.ts.map +1 -1
  15. package/dist-tsc/json-loaders/JsonLoader.js +10 -15
  16. package/dist-tsc/json-loaders/ObsSegmentationsJson.d.ts.map +1 -1
  17. package/dist-tsc/json-loaders/ObsSegmentationsJson.js +3 -6
  18. package/dist-tsc/json-loaders/ObsSetsJson.d.ts.map +1 -1
  19. package/dist-tsc/json-loaders/ObsSetsJson.js +2 -5
  20. package/dist-tsc/legacy-loaders/CellsJsonAsObsEmbedding.d.ts.map +1 -1
  21. package/dist-tsc/legacy-loaders/CellsJsonAsObsEmbedding.js +3 -6
  22. package/dist-tsc/legacy-loaders/CellsJsonAsObsLabels.d.ts.map +1 -1
  23. package/dist-tsc/legacy-loaders/CellsJsonAsObsLabels.js +3 -6
  24. package/dist-tsc/legacy-loaders/CellsJsonAsObsLocations.d.ts.map +1 -1
  25. package/dist-tsc/legacy-loaders/CellsJsonAsObsLocations.js +3 -6
  26. package/dist-tsc/legacy-loaders/CellsJsonAsObsSegmentations.d.ts.map +1 -1
  27. package/dist-tsc/legacy-loaders/CellsJsonAsObsSegmentations.js +4 -7
  28. package/dist-tsc/legacy-loaders/ClustersJsonAsObsFeatureMatrix.d.ts.map +1 -1
  29. package/dist-tsc/legacy-loaders/ClustersJsonAsObsFeatureMatrix.js +3 -6
  30. package/dist-tsc/legacy-loaders/GenesJsonAsObsFeatureMatrix.d.ts.map +1 -1
  31. package/dist-tsc/legacy-loaders/GenesJsonAsObsFeatureMatrix.js +3 -6
  32. package/dist-tsc/legacy-loaders/MoleculesJsonAsObsLabels.d.ts.map +1 -1
  33. package/dist-tsc/legacy-loaders/MoleculesJsonAsObsLabels.js +3 -6
  34. package/dist-tsc/legacy-loaders/MoleculesJsonAsObsLocations.d.ts.map +1 -1
  35. package/dist-tsc/legacy-loaders/MoleculesJsonAsObsLocations.js +3 -6
  36. package/dist-tsc/raster-json-loaders/RasterJsonAsImageLoader.d.ts.map +1 -1
  37. package/dist-tsc/raster-json-loaders/RasterJsonAsImageLoader.js +2 -5
  38. package/dist-tsc/raster-json-loaders/RasterJsonAsObsSegmentationsLoader.d.ts.map +1 -1
  39. package/dist-tsc/raster-json-loaders/RasterJsonAsObsSegmentationsLoader.js +2 -5
  40. package/dist-tsc/raster-json-loaders/RasterJsonLoader.d.ts +0 -1
  41. package/dist-tsc/raster-json-loaders/RasterJsonLoader.d.ts.map +1 -1
  42. package/dist-tsc/raster-json-loaders/RasterJsonLoader.js +6 -6
  43. package/package.json +12 -11
  44. package/src/JsonSource.js +7 -9
  45. package/src/json-loaders/JsonLoader.js +11 -18
  46. package/src/json-loaders/ObsSegmentationsJson.js +4 -7
  47. package/src/json-loaders/ObsSetsJson.js +2 -5
  48. package/src/legacy-loaders/CellsJsonAsObsEmbedding.js +4 -7
  49. package/src/legacy-loaders/CellsJsonAsObsLabels.js +3 -6
  50. package/src/legacy-loaders/CellsJsonAsObsLocations.js +4 -7
  51. package/src/legacy-loaders/CellsJsonAsObsSegmentations.js +4 -7
  52. package/src/legacy-loaders/ClustersJsonAsObsFeatureMatrix.js +4 -7
  53. package/src/legacy-loaders/GenesJsonAsObsFeatureMatrix.js +4 -7
  54. package/src/legacy-loaders/MoleculesJsonAsObsLabels.js +3 -6
  55. package/src/legacy-loaders/MoleculesJsonAsObsLocations.js +3 -6
  56. package/src/raster-json-loaders/RasterJsonAsImageLoader.js +2 -5
  57. package/src/raster-json-loaders/RasterJsonAsObsSegmentationsLoader.js +2 -5
  58. package/src/raster-json-loaders/RasterJsonLoader.js +6 -6
@@ -1,8 +1,9 @@
1
1
  import { FileType } from '@vitessce/constants-internal';
2
+ import {
3
+ JsonLoaderValidationError,
4
+ } from '@vitessce/error';
2
5
  import {
3
6
  AbstractTwoStepLoader,
4
- LoaderValidationError,
5
- AbstractLoaderError,
6
7
  LoaderResult,
7
8
  } from '@vitessce/abstract';
8
9
 
@@ -27,25 +28,17 @@ export default class JsonLoader extends AbstractTwoStepLoader {
27
28
  this.schema = fileTypeToSchema[fileType];
28
29
  }
29
30
 
30
- load() {
31
- const {
32
- url, type, fileType,
33
- } = this;
31
+ async load() {
32
+ const { url } = this;
34
33
  if (this.data) {
35
34
  return this.data;
36
35
  }
37
- this.data = this.dataSource.data
38
- .then((data) => {
39
- if (data instanceof AbstractLoaderError) {
40
- return Promise.reject(data);
41
- }
42
- const [valid, reason] = this.validate(data);
43
- if (valid) {
44
- return Promise.resolve(new LoaderResult(data, url));
45
- }
46
- return Promise.reject(new LoaderValidationError(type, fileType, url, reason));
47
- });
48
- return this.data;
36
+ this.data = await this.dataSource.loadJson();
37
+ const [valid, reason] = this.validate(this.data);
38
+ if (valid) {
39
+ return new LoaderResult(this.data, url);
40
+ }
41
+ throw new JsonLoaderValidationError(reason);
49
42
  }
50
43
 
51
44
  validate(data) {
@@ -1,4 +1,4 @@
1
- import { AbstractLoaderError, LoaderResult } from '@vitessce/abstract';
1
+ import { LoaderResult } from '@vitessce/abstract';
2
2
  import { CoordinationLevel as CL } from '@vitessce/config';
3
3
  import JsonLoader from './JsonLoader.js';
4
4
 
@@ -18,10 +18,7 @@ export default class ObsSegmentationsJsonLoader extends JsonLoader {
18
18
  }
19
19
 
20
20
  async load() {
21
- const payload = await super.load().catch(reason => Promise.resolve(reason));
22
- if (payload instanceof AbstractLoaderError) {
23
- return Promise.reject(payload);
24
- }
21
+ const payload = await super.load();
25
22
 
26
23
  const channelCoordination = [{
27
24
  // obsType: null,
@@ -52,10 +49,10 @@ export default class ObsSegmentationsJsonLoader extends JsonLoader {
52
49
 
53
50
  const { data, url } = payload;
54
51
  const result = this.loadFromCache(data);
55
- return Promise.resolve(new LoaderResult(
52
+ return new LoaderResult(
56
53
  result,
57
54
  url,
58
55
  coordinationValues,
59
- ));
56
+ );
60
57
  }
61
58
  }
@@ -4,7 +4,7 @@ import {
4
4
  nodeToSet,
5
5
  treeToMembershipMap,
6
6
  } from '@vitessce/sets-utils';
7
- import { AbstractLoaderError, LoaderResult } from '@vitessce/abstract';
7
+ import { LoaderResult } from '@vitessce/abstract';
8
8
  import { obsSetsSchema } from '@vitessce/schemas';
9
9
  import JsonLoader from './JsonLoader.js';
10
10
 
@@ -16,10 +16,7 @@ export default class ObsSetsJsonLoader extends JsonLoader {
16
16
  }
17
17
 
18
18
  async load() {
19
- const payload = await super.load().catch(reason => Promise.resolve(reason));
20
- if (payload instanceof AbstractLoaderError) {
21
- return Promise.reject(payload);
22
- }
19
+ const payload = await super.load();
23
20
  const { data: rawData, url } = payload;
24
21
  const datatype = this.fileType.endsWith('cell-sets.json') ? 'cell' : 'obs';
25
22
  const [upgradedData] = tryUpgradeTreeToLatestSchema(rawData, datatype);
@@ -1,4 +1,4 @@
1
- import { AbstractLoaderError, LoaderResult } from '@vitessce/abstract';
1
+ import { LoaderResult } from '@vitessce/abstract';
2
2
  import { cellsSchema } from './schemas/cells.js';
3
3
  import JsonLoader from '../json-loaders/JsonLoader.js';
4
4
 
@@ -39,15 +39,12 @@ export default class CellsJsonAsObsEmbeddingLoader extends JsonLoader {
39
39
  }
40
40
 
41
41
  async load() {
42
- const payload = await super.load().catch(reason => Promise.resolve(reason));
43
- if (payload instanceof AbstractLoaderError) {
44
- return Promise.reject(payload);
45
- }
42
+ const payload = await super.load();
46
43
  const { data, url } = payload;
47
44
  const result = this.loadFromCache(data);
48
- return Promise.resolve(new LoaderResult(
45
+ return new LoaderResult(
49
46
  result,
50
47
  url,
51
- ));
48
+ );
52
49
  }
53
50
  }
@@ -1,4 +1,4 @@
1
- import { AbstractLoaderError, LoaderResult } from '@vitessce/abstract';
1
+ import { LoaderResult } from '@vitessce/abstract';
2
2
  import { cellsSchema } from './schemas/cells.js';
3
3
  import JsonLoader from '../json-loaders/JsonLoader.js';
4
4
 
@@ -21,12 +21,9 @@ export default class CellsJsonAsObsLabelsLoader extends JsonLoader {
21
21
  }
22
22
 
23
23
  async load() {
24
- const payload = await super.load().catch(reason => Promise.resolve(reason));
25
- if (payload instanceof AbstractLoaderError) {
26
- return Promise.reject(payload);
27
- }
24
+ const payload = await super.load();
28
25
  const { data, url } = payload;
29
26
  const result = this.loadFromCache(data);
30
- return Promise.resolve(new LoaderResult(result, url));
27
+ return new LoaderResult(result, url);
31
28
  }
32
29
  }
@@ -1,4 +1,4 @@
1
- import { AbstractLoaderError, LoaderResult } from '@vitessce/abstract';
1
+ import { LoaderResult } from '@vitessce/abstract';
2
2
  import { cellsSchema } from './schemas/cells.js';
3
3
  import JsonLoader from '../json-loaders/JsonLoader.js';
4
4
 
@@ -31,15 +31,12 @@ export default class CellsJsonAsObsLocationsLoader extends JsonLoader {
31
31
  }
32
32
 
33
33
  async load() {
34
- const payload = await super.load().catch(reason => Promise.resolve(reason));
35
- if (payload instanceof AbstractLoaderError) {
36
- return Promise.reject(payload);
37
- }
34
+ const payload = await super.load();
38
35
  const { data, url } = payload;
39
36
  const result = this.loadFromCache(data);
40
- return Promise.resolve(new LoaderResult(
37
+ return new LoaderResult(
41
38
  result,
42
39
  url,
43
- ));
40
+ );
44
41
  }
45
42
  }
@@ -1,4 +1,4 @@
1
- import { AbstractLoaderError, LoaderResult } from '@vitessce/abstract';
1
+ import { LoaderResult } from '@vitessce/abstract';
2
2
  import { DEFAULT_CELLS_LAYER } from '@vitessce/constants-internal';
3
3
  import { cellsSchema } from './schemas/cells.js';
4
4
  import JsonLoader from '../json-loaders/JsonLoader.js';
@@ -51,18 +51,15 @@ export default class CellsJsonAsObsSegmentationsLoader extends JsonLoader {
51
51
  }
52
52
 
53
53
  async load() {
54
- const payload = await super.load().catch(reason => Promise.resolve(reason));
55
- if (payload instanceof AbstractLoaderError) {
56
- return Promise.reject(payload);
57
- }
54
+ const payload = await super.load();
58
55
  const { data, url } = payload;
59
56
  const result = this.loadFromCache(data);
60
57
  const coordinationValues = {
61
58
  spatialSegmentationLayer: DEFAULT_CELLS_LAYER,
62
59
  };
63
- return Promise.resolve(new LoaderResult({
60
+ return new LoaderResult({
64
61
  ...result,
65
62
  obsSegmentationsType: 'polygon',
66
- }, url, coordinationValues));
63
+ }, url, coordinationValues);
67
64
  }
68
65
  }
@@ -1,6 +1,6 @@
1
1
  import { extent } from 'd3-array';
2
2
  import { range } from 'lodash-es';
3
- import { AbstractLoaderError, LoaderResult } from '@vitessce/abstract';
3
+ import { LoaderResult } from '@vitessce/abstract';
4
4
  import { clustersSchema } from './schemas/clusters.js';
5
5
  import JsonLoader from '../json-loaders/JsonLoader.js';
6
6
 
@@ -41,15 +41,12 @@ export default class ClustersJsonAsObsFeatureMatrixLoader extends JsonLoader {
41
41
  }
42
42
 
43
43
  async load() {
44
- const payload = await super.load().catch(reason => Promise.resolve(reason));
45
- if (payload instanceof AbstractLoaderError) {
46
- return Promise.reject(payload);
47
- }
44
+ const payload = await super.load();
48
45
  const { data, url } = payload;
49
46
  const result = this.loadFromCache(data);
50
- return Promise.resolve(new LoaderResult(
47
+ return new LoaderResult(
51
48
  result,
52
49
  url,
53
- ));
50
+ );
54
51
  }
55
52
  }
@@ -1,4 +1,4 @@
1
- import { AbstractLoaderError, LoaderResult } from '@vitessce/abstract';
1
+ import { LoaderResult } from '@vitessce/abstract';
2
2
  import { genesSchema } from './schemas/genes.js';
3
3
  import JsonLoader from '../json-loaders/JsonLoader.js';
4
4
 
@@ -30,15 +30,12 @@ export default class GenesJsonAsObsFeatureMatrixLoader extends JsonLoader {
30
30
  }
31
31
 
32
32
  async load() {
33
- const payload = await super.load().catch(reason => Promise.resolve(reason));
34
- if (payload instanceof AbstractLoaderError) {
35
- return Promise.reject(payload);
36
- }
33
+ const payload = await super.load();
37
34
  const { data, url } = payload;
38
35
  const result = this.loadFromCache(data);
39
- return Promise.resolve(new LoaderResult(
36
+ return new LoaderResult(
40
37
  result,
41
38
  url,
42
- ));
39
+ );
43
40
  }
44
41
  }
@@ -1,5 +1,5 @@
1
1
  import { range, sum } from 'lodash-es';
2
- import { AbstractLoaderError, LoaderResult } from '@vitessce/abstract';
2
+ import { LoaderResult } from '@vitessce/abstract';
3
3
  import { moleculesSchema } from './schemas/molecules.js';
4
4
  import JsonLoader from '../json-loaders/JsonLoader.js';
5
5
 
@@ -27,12 +27,9 @@ export default class MoleculesJsonAsObsLabelsLoader extends JsonLoader {
27
27
  }
28
28
 
29
29
  async load() {
30
- const payload = await super.load().catch(reason => Promise.resolve(reason));
31
- if (payload instanceof AbstractLoaderError) {
32
- return Promise.reject(payload);
33
- }
30
+ const payload = await super.load();
34
31
  const { data, url } = payload;
35
32
  const result = this.loadFromCache(data);
36
- return Promise.resolve(new LoaderResult(result, url));
33
+ return new LoaderResult(result, url);
37
34
  }
38
35
  }
@@ -1,5 +1,5 @@
1
1
  import { range, sum } from 'lodash-es';
2
- import { AbstractLoaderError, LoaderResult } from '@vitessce/abstract';
2
+ import { LoaderResult } from '@vitessce/abstract';
3
3
  import { DEFAULT_MOLECULES_LAYER } from '@vitessce/spatial-utils';
4
4
  import { moleculesSchema } from './schemas/molecules.js';
5
5
  import JsonLoader from '../json-loaders/JsonLoader.js';
@@ -34,16 +34,13 @@ export default class MoleculesJsonAsObsLocationsLoader extends JsonLoader {
34
34
  }
35
35
 
36
36
  async load() {
37
- const payload = await super.load().catch(reason => Promise.resolve(reason));
38
- if (payload instanceof AbstractLoaderError) {
39
- return Promise.reject(payload);
40
- }
37
+ const payload = await super.load();
41
38
  const { data, url } = payload;
42
39
  const result = this.loadFromCache(data);
43
40
  const coordinationValues = {
44
41
  // TODO: do this for anndata segmentation loader
45
42
  spatialPointLayer: DEFAULT_MOLECULES_LAYER,
46
43
  };
47
- return Promise.resolve(new LoaderResult(result, url, coordinationValues));
44
+ return new LoaderResult(result, url, coordinationValues);
48
45
  }
49
46
  }
@@ -1,14 +1,11 @@
1
- import { AbstractLoaderError, LoaderResult } from '@vitessce/abstract';
1
+ import { LoaderResult } from '@vitessce/abstract';
2
2
  import { log } from '@vitessce/globals';
3
3
 
4
4
  import RasterLoader from './RasterJsonLoader.js';
5
5
 
6
6
  export default class RasterJsonAsImageLoader extends RasterLoader {
7
7
  async load() {
8
- const loaderResult = await super.load().catch(reason => Promise.resolve(reason));
9
- if (loaderResult instanceof AbstractLoaderError) {
10
- return Promise.reject(loaderResult);
11
- }
8
+ const loaderResult = await super.load();
12
9
  const { data = {}, url: urls, coordinationValues } = loaderResult;
13
10
  const { loaders: allLoaders = [], meta: allMeta = [] } = data;
14
11
 
@@ -1,13 +1,10 @@
1
- import { AbstractLoaderError, LoaderResult } from '@vitessce/abstract';
1
+ import { LoaderResult } from '@vitessce/abstract';
2
2
  import { log } from '@vitessce/globals';
3
3
  import RasterLoader from './RasterJsonLoader.js';
4
4
 
5
5
  export default class RasterJsonAsObsSegmentationsLoader extends RasterLoader {
6
6
  async load() {
7
- const loaderResult = await super.load().catch(reason => Promise.resolve(reason));
8
- if (loaderResult instanceof AbstractLoaderError) {
9
- return Promise.reject(loaderResult);
10
- }
7
+ const loaderResult = await super.load();
11
8
  const { data = {}, url: urls, coordinationValues } = loaderResult;
12
9
  const { loaders: allLoaders = [], meta: allMeta = [] } = data;
13
10
 
@@ -10,7 +10,7 @@ import {
10
10
  } from '@vitessce/spatial-utils';
11
11
  import { open as zarrOpen } from 'zarrita';
12
12
  import { zarrOpenRoot, createZarrArrayAdapter } from '@vitessce/zarr-utils';
13
- import { AbstractLoaderError, LoaderResult } from '@vitessce/abstract';
13
+ import { LoaderResult } from '@vitessce/abstract';
14
14
  import { rasterJsonSchema as rasterSchema } from '@vitessce/schemas';
15
15
  import JsonLoader from '../json-loaders/JsonLoader.js';
16
16
 
@@ -144,10 +144,7 @@ export default class RasterLoader extends JsonLoader {
144
144
  }
145
145
 
146
146
  async load() {
147
- const payload = await super.load().catch(reason => Promise.resolve(reason));
148
- if (payload instanceof AbstractLoaderError) {
149
- return Promise.reject(payload);
150
- }
147
+ const payload = await super.load();
151
148
  const { data: raster } = payload;
152
149
  const { images, renderLayers, usePhysicalSizeScaling = false } = raster;
153
150
 
@@ -179,7 +176,10 @@ export default class RasterLoader extends JsonLoader {
179
176
  spatialImageLayer: autoImageLayers,
180
177
  };
181
178
  return new LoaderResult(
182
- { loaders: imageLayerLoaders, meta: imageLayerMeta },
179
+ {
180
+ loaders: imageLayerLoaders,
181
+ meta: imageLayerMeta,
182
+ },
183
183
  urls,
184
184
  coordinationValues,
185
185
  );