@vitessce/config 3.6.10 → 3.6.12
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.
- package/dist/index.js +20 -11
- package/dist-tsc/VitessceConfig.d.ts +16 -15
- package/dist-tsc/VitessceConfig.d.ts.map +1 -1
- package/dist-tsc/VitessceConfig.js +18 -10
- package/dist-tsc/VitessceConfig.test.js +44 -0
- package/package.json +5 -5
- package/src/VitessceConfig.js +18 -10
- package/src/VitessceConfig.test.js +45 -0
package/dist/index.js
CHANGED
|
@@ -689,12 +689,13 @@ class VitessceConfigDatasetFile {
|
|
|
689
689
|
* which may provide additional parameters to the loader class
|
|
690
690
|
* corresponding to the specified fileType.
|
|
691
691
|
*/
|
|
692
|
-
constructor(url, fileType, coordinationValues, options) {
|
|
692
|
+
constructor(url, fileType, coordinationValues, options, requestInit) {
|
|
693
693
|
this.file = {
|
|
694
694
|
url,
|
|
695
695
|
fileType,
|
|
696
696
|
...coordinationValues ? { coordinationValues } : {},
|
|
697
|
-
...options ? { options } : {}
|
|
697
|
+
...options ? { options } : {},
|
|
698
|
+
...requestInit ? { requestInit } : {}
|
|
698
699
|
};
|
|
699
700
|
}
|
|
700
701
|
/**
|
|
@@ -735,6 +736,7 @@ class VitessceConfigDataset {
|
|
|
735
736
|
let fileType;
|
|
736
737
|
let coordinationValues;
|
|
737
738
|
let options;
|
|
739
|
+
let requestInit;
|
|
738
740
|
if (args.length > 0) {
|
|
739
741
|
url = params;
|
|
740
742
|
let dataType;
|
|
@@ -748,13 +750,14 @@ class VitessceConfigDataset {
|
|
|
748
750
|
url,
|
|
749
751
|
fileType,
|
|
750
752
|
options,
|
|
751
|
-
coordinationValues
|
|
753
|
+
coordinationValues,
|
|
754
|
+
requestInit
|
|
752
755
|
} = params);
|
|
753
756
|
} else {
|
|
754
757
|
throw new Error("Expected addFile argument to be an object.");
|
|
755
758
|
}
|
|
756
759
|
this.dataset.files.push(
|
|
757
|
-
new VitessceConfigDatasetFile(url, fileType, coordinationValues, options)
|
|
760
|
+
new VitessceConfigDatasetFile(url, fileType, coordinationValues, options, requestInit)
|
|
758
761
|
);
|
|
759
762
|
return this;
|
|
760
763
|
}
|
|
@@ -1123,13 +1126,19 @@ class VitessceConfig {
|
|
|
1123
1126
|
* Add a new view to the config.
|
|
1124
1127
|
* @param {VitessceConfigDataset} dataset The dataset instance which defines the data
|
|
1125
1128
|
* that will be displayed in the view.
|
|
1126
|
-
* @param {string} component A component name, such as "scatterplot"
|
|
1127
|
-
*
|
|
1128
|
-
* @param {
|
|
1129
|
-
* @param {number} options.
|
|
1130
|
-
*
|
|
1131
|
-
* @param {number} options.
|
|
1132
|
-
*
|
|
1129
|
+
* @param {string} component A component name, such as "scatterplot"
|
|
1130
|
+
* or "spatial".
|
|
1131
|
+
* @param {object|undefined} options Extra options for the component.
|
|
1132
|
+
* @param {number|undefined} options.x The x-coordinate for the view
|
|
1133
|
+
* in the grid layout.
|
|
1134
|
+
* @param {number|undefined} options.y The y-coordinate for the view
|
|
1135
|
+
* in the grid layout.
|
|
1136
|
+
* @param {number|undefined} options.w The width for the view in the
|
|
1137
|
+
* grid layout.
|
|
1138
|
+
* @param {number|undefined} options.h The height for the view in the
|
|
1139
|
+
* grid layout.
|
|
1140
|
+
* @param {string|undefined} options.mapping A convenience parameter
|
|
1141
|
+
* for setting the EMBEDDING_TYPE
|
|
1133
1142
|
* coordination value. Only applicable if the component is "scatterplot".
|
|
1134
1143
|
* @returns {VitessceConfigView} A new view instance.
|
|
1135
1144
|
*/
|
|
@@ -31,8 +31,9 @@ export class VitessceConfigDatasetFile {
|
|
|
31
31
|
* which may provide additional parameters to the loader class
|
|
32
32
|
* corresponding to the specified fileType.
|
|
33
33
|
*/
|
|
34
|
-
constructor(url: string, fileType: string, coordinationValues: any, options: object | array | null);
|
|
34
|
+
constructor(url: string, fileType: string, coordinationValues: any, options: object | array | null, requestInit: any);
|
|
35
35
|
file: {
|
|
36
|
+
requestInit?: any;
|
|
36
37
|
options?: any;
|
|
37
38
|
coordinationValues?: any;
|
|
38
39
|
url: string;
|
|
@@ -261,23 +262,23 @@ export class VitessceConfig {
|
|
|
261
262
|
* Add a new view to the config.
|
|
262
263
|
* @param {VitessceConfigDataset} dataset The dataset instance which defines the data
|
|
263
264
|
* that will be displayed in the view.
|
|
264
|
-
* @param {string} component A component name, such as "scatterplot"
|
|
265
|
-
*
|
|
266
|
-
* @param {
|
|
267
|
-
* @param {number} options.
|
|
268
|
-
*
|
|
269
|
-
* @param {number} options.
|
|
270
|
-
*
|
|
265
|
+
* @param {string} component A component name, such as "scatterplot"
|
|
266
|
+
* or "spatial".
|
|
267
|
+
* @param {object|undefined} options Extra options for the component.
|
|
268
|
+
* @param {number|undefined} options.x The x-coordinate for the view
|
|
269
|
+
* in the grid layout.
|
|
270
|
+
* @param {number|undefined} options.y The y-coordinate for the view
|
|
271
|
+
* in the grid layout.
|
|
272
|
+
* @param {number|undefined} options.w The width for the view in the
|
|
273
|
+
* grid layout.
|
|
274
|
+
* @param {number|undefined} options.h The height for the view in the
|
|
275
|
+
* grid layout.
|
|
276
|
+
* @param {string|undefined} options.mapping A convenience parameter
|
|
277
|
+
* for setting the EMBEDDING_TYPE
|
|
271
278
|
* coordination value. Only applicable if the component is "scatterplot".
|
|
272
279
|
* @returns {VitessceConfigView} A new view instance.
|
|
273
280
|
*/
|
|
274
|
-
addView(dataset: VitessceConfigDataset, component: string, options:
|
|
275
|
-
x: number;
|
|
276
|
-
y: number;
|
|
277
|
-
w: number;
|
|
278
|
-
h: number;
|
|
279
|
-
mapping: number;
|
|
280
|
-
}): VitessceConfigView;
|
|
281
|
+
addView(dataset: VitessceConfigDataset, component: string, options: object | undefined): VitessceConfigView;
|
|
281
282
|
/**
|
|
282
283
|
* Get an array of new coordination scope instances corresponding to coordination types
|
|
283
284
|
* of interest.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VitessceConfig.d.ts","sourceRoot":"","sources":["../src/VitessceConfig.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VitessceConfig.d.ts","sourceRoot":"","sources":["../src/VitessceConfig.js"],"names":[],"mappings":"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"}
|
|
@@ -14,12 +14,13 @@ export class VitessceConfigDatasetFile {
|
|
|
14
14
|
* which may provide additional parameters to the loader class
|
|
15
15
|
* corresponding to the specified fileType.
|
|
16
16
|
*/
|
|
17
|
-
constructor(url, fileType, coordinationValues, options) {
|
|
17
|
+
constructor(url, fileType, coordinationValues, options, requestInit) {
|
|
18
18
|
this.file = {
|
|
19
19
|
url,
|
|
20
20
|
fileType,
|
|
21
21
|
...(coordinationValues ? { coordinationValues } : {}),
|
|
22
22
|
...(options ? { options } : {}),
|
|
23
|
+
...(requestInit ? { requestInit } : {}),
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
@@ -63,6 +64,7 @@ export class VitessceConfigDataset {
|
|
|
63
64
|
let fileType;
|
|
64
65
|
let coordinationValues;
|
|
65
66
|
let options;
|
|
67
|
+
let requestInit;
|
|
66
68
|
if (args.length > 0) {
|
|
67
69
|
// Old behavior.
|
|
68
70
|
url = params;
|
|
@@ -78,13 +80,13 @@ export class VitessceConfigDataset {
|
|
|
78
80
|
}
|
|
79
81
|
else if (typeof params === 'object') {
|
|
80
82
|
({
|
|
81
|
-
url, fileType, options, coordinationValues,
|
|
83
|
+
url, fileType, options, coordinationValues, requestInit,
|
|
82
84
|
} = params);
|
|
83
85
|
}
|
|
84
86
|
else {
|
|
85
87
|
throw new Error('Expected addFile argument to be an object.');
|
|
86
88
|
}
|
|
87
|
-
this.dataset.files.push(new VitessceConfigDatasetFile(url, fileType, coordinationValues, options));
|
|
89
|
+
this.dataset.files.push(new VitessceConfigDatasetFile(url, fileType, coordinationValues, options, requestInit));
|
|
88
90
|
return this;
|
|
89
91
|
}
|
|
90
92
|
/**
|
|
@@ -533,13 +535,19 @@ export class VitessceConfig {
|
|
|
533
535
|
* Add a new view to the config.
|
|
534
536
|
* @param {VitessceConfigDataset} dataset The dataset instance which defines the data
|
|
535
537
|
* that will be displayed in the view.
|
|
536
|
-
* @param {string} component A component name, such as "scatterplot"
|
|
537
|
-
*
|
|
538
|
-
* @param {
|
|
539
|
-
* @param {number} options.
|
|
540
|
-
*
|
|
541
|
-
* @param {number} options.
|
|
542
|
-
*
|
|
538
|
+
* @param {string} component A component name, such as "scatterplot"
|
|
539
|
+
* or "spatial".
|
|
540
|
+
* @param {object|undefined} options Extra options for the component.
|
|
541
|
+
* @param {number|undefined} options.x The x-coordinate for the view
|
|
542
|
+
* in the grid layout.
|
|
543
|
+
* @param {number|undefined} options.y The y-coordinate for the view
|
|
544
|
+
* in the grid layout.
|
|
545
|
+
* @param {number|undefined} options.w The width for the view in the
|
|
546
|
+
* grid layout.
|
|
547
|
+
* @param {number|undefined} options.h The height for the view in the
|
|
548
|
+
* grid layout.
|
|
549
|
+
* @param {string|undefined} options.mapping A convenience parameter
|
|
550
|
+
* for setting the EMBEDDING_TYPE
|
|
543
551
|
* coordination value. Only applicable if the component is "scatterplot".
|
|
544
552
|
* @returns {VitessceConfigView} A new view instance.
|
|
545
553
|
*/
|
|
@@ -113,6 +113,50 @@ describe('src/api/VitessceConfig.js', () => {
|
|
|
113
113
|
version: '1.0.4',
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
|
+
it('can add a file with requestInit to a dataset', () => {
|
|
117
|
+
const config = new VitessceConfig({
|
|
118
|
+
schemaVersion: '1.0.4',
|
|
119
|
+
name: 'My config',
|
|
120
|
+
description: 'My config description',
|
|
121
|
+
});
|
|
122
|
+
// Named arguments.
|
|
123
|
+
config.addDataset('My dataset', 'My dataset description').addFile({
|
|
124
|
+
url: 'http://example.com/cells.json',
|
|
125
|
+
fileType: 'cells.json',
|
|
126
|
+
requestInit: {
|
|
127
|
+
headers: {
|
|
128
|
+
Authorization: 'Bearer my-token',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
const configJSON = config.toJSON();
|
|
133
|
+
expect(configJSON).toEqual({
|
|
134
|
+
coordinationSpace: {
|
|
135
|
+
dataset: {
|
|
136
|
+
A: 'A',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
datasets: [{
|
|
140
|
+
name: 'My dataset',
|
|
141
|
+
description: 'My dataset description',
|
|
142
|
+
uid: 'A',
|
|
143
|
+
files: [{
|
|
144
|
+
url: 'http://example.com/cells.json',
|
|
145
|
+
fileType: 'cells.json',
|
|
146
|
+
requestInit: {
|
|
147
|
+
headers: {
|
|
148
|
+
Authorization: 'Bearer my-token',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
}],
|
|
152
|
+
}],
|
|
153
|
+
description: 'My config description',
|
|
154
|
+
initStrategy: 'auto',
|
|
155
|
+
layout: [],
|
|
156
|
+
name: 'My config',
|
|
157
|
+
version: '1.0.4',
|
|
158
|
+
});
|
|
159
|
+
});
|
|
116
160
|
it('can add a view', () => {
|
|
117
161
|
const config = new VitessceConfig({
|
|
118
162
|
schemaVersion: '1.0.4',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/config",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.12",
|
|
4
4
|
"author": "HIDIVE Lab at HMS",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"zarrita": "0.5.2",
|
|
20
|
-
"@vitessce/constants-internal": "3.6.
|
|
21
|
-
"@vitessce/utils": "3.6.
|
|
22
|
-
"@vitessce/globals": "3.6.
|
|
23
|
-
"@vitessce/zarr-utils": "3.6.
|
|
20
|
+
"@vitessce/constants-internal": "3.6.12",
|
|
21
|
+
"@vitessce/utils": "3.6.12",
|
|
22
|
+
"@vitessce/globals": "3.6.12",
|
|
23
|
+
"@vitessce/zarr-utils": "3.6.12"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"bundle": "pnpm exec vite build -c ../../scripts/vite.config.js",
|
package/src/VitessceConfig.js
CHANGED
|
@@ -15,12 +15,13 @@ export class VitessceConfigDatasetFile {
|
|
|
15
15
|
* which may provide additional parameters to the loader class
|
|
16
16
|
* corresponding to the specified fileType.
|
|
17
17
|
*/
|
|
18
|
-
constructor(url, fileType, coordinationValues, options) {
|
|
18
|
+
constructor(url, fileType, coordinationValues, options, requestInit) {
|
|
19
19
|
this.file = {
|
|
20
20
|
url,
|
|
21
21
|
fileType,
|
|
22
22
|
...(coordinationValues ? { coordinationValues } : {}),
|
|
23
23
|
...(options ? { options } : {}),
|
|
24
|
+
...(requestInit ? { requestInit } : {}),
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -67,6 +68,7 @@ export class VitessceConfigDataset {
|
|
|
67
68
|
let fileType;
|
|
68
69
|
let coordinationValues;
|
|
69
70
|
let options;
|
|
71
|
+
let requestInit;
|
|
70
72
|
if (args.length > 0) {
|
|
71
73
|
// Old behavior.
|
|
72
74
|
url = params;
|
|
@@ -80,13 +82,13 @@ export class VitessceConfigDataset {
|
|
|
80
82
|
}
|
|
81
83
|
} else if (typeof params === 'object') {
|
|
82
84
|
({
|
|
83
|
-
url, fileType, options, coordinationValues,
|
|
85
|
+
url, fileType, options, coordinationValues, requestInit,
|
|
84
86
|
} = params);
|
|
85
87
|
} else {
|
|
86
88
|
throw new Error('Expected addFile argument to be an object.');
|
|
87
89
|
}
|
|
88
90
|
this.dataset.files.push(
|
|
89
|
-
new VitessceConfigDatasetFile(url, fileType, coordinationValues, options),
|
|
91
|
+
new VitessceConfigDatasetFile(url, fileType, coordinationValues, options, requestInit),
|
|
90
92
|
);
|
|
91
93
|
return this;
|
|
92
94
|
}
|
|
@@ -584,13 +586,19 @@ export class VitessceConfig {
|
|
|
584
586
|
* Add a new view to the config.
|
|
585
587
|
* @param {VitessceConfigDataset} dataset The dataset instance which defines the data
|
|
586
588
|
* that will be displayed in the view.
|
|
587
|
-
* @param {string} component A component name, such as "scatterplot"
|
|
588
|
-
*
|
|
589
|
-
* @param {
|
|
590
|
-
* @param {number} options.
|
|
591
|
-
*
|
|
592
|
-
* @param {number} options.
|
|
593
|
-
*
|
|
589
|
+
* @param {string} component A component name, such as "scatterplot"
|
|
590
|
+
* or "spatial".
|
|
591
|
+
* @param {object|undefined} options Extra options for the component.
|
|
592
|
+
* @param {number|undefined} options.x The x-coordinate for the view
|
|
593
|
+
* in the grid layout.
|
|
594
|
+
* @param {number|undefined} options.y The y-coordinate for the view
|
|
595
|
+
* in the grid layout.
|
|
596
|
+
* @param {number|undefined} options.w The width for the view in the
|
|
597
|
+
* grid layout.
|
|
598
|
+
* @param {number|undefined} options.h The height for the view in the
|
|
599
|
+
* grid layout.
|
|
600
|
+
* @param {string|undefined} options.mapping A convenience parameter
|
|
601
|
+
* for setting the EMBEDDING_TYPE
|
|
594
602
|
* coordination value. Only applicable if the component is "scatterplot".
|
|
595
603
|
* @returns {VitessceConfigView} A new view instance.
|
|
596
604
|
*/
|
|
@@ -128,6 +128,51 @@ describe('src/api/VitessceConfig.js', () => {
|
|
|
128
128
|
version: '1.0.4',
|
|
129
129
|
});
|
|
130
130
|
});
|
|
131
|
+
it('can add a file with requestInit to a dataset', () => {
|
|
132
|
+
const config = new VitessceConfig({
|
|
133
|
+
schemaVersion: '1.0.4',
|
|
134
|
+
name: 'My config',
|
|
135
|
+
description: 'My config description',
|
|
136
|
+
});
|
|
137
|
+
// Named arguments.
|
|
138
|
+
config.addDataset('My dataset', 'My dataset description').addFile({
|
|
139
|
+
url: 'http://example.com/cells.json',
|
|
140
|
+
fileType: 'cells.json',
|
|
141
|
+
requestInit: {
|
|
142
|
+
headers: {
|
|
143
|
+
Authorization: 'Bearer my-token',
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const configJSON = config.toJSON();
|
|
149
|
+
expect(configJSON).toEqual({
|
|
150
|
+
coordinationSpace: {
|
|
151
|
+
dataset: {
|
|
152
|
+
A: 'A',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
datasets: [{
|
|
156
|
+
name: 'My dataset',
|
|
157
|
+
description: 'My dataset description',
|
|
158
|
+
uid: 'A',
|
|
159
|
+
files: [{
|
|
160
|
+
url: 'http://example.com/cells.json',
|
|
161
|
+
fileType: 'cells.json',
|
|
162
|
+
requestInit: {
|
|
163
|
+
headers: {
|
|
164
|
+
Authorization: 'Bearer my-token',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
}],
|
|
168
|
+
}],
|
|
169
|
+
description: 'My config description',
|
|
170
|
+
initStrategy: 'auto',
|
|
171
|
+
layout: [],
|
|
172
|
+
name: 'My config',
|
|
173
|
+
version: '1.0.4',
|
|
174
|
+
});
|
|
175
|
+
});
|
|
131
176
|
|
|
132
177
|
it('can add a view', () => {
|
|
133
178
|
const config = new VitessceConfig({
|