@insync-stageplayer/measurements 0.4.8 → 0.4.13
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/lib/AsyncSubject.d.ts +23 -23
- package/lib/AsyncSubject.js +64 -64
- package/lib/client/MeasurementDataClient.d.ts +126 -124
- package/lib/client/MeasurementDataClient.d.ts.map +1 -1
- package/lib/client/MeasurementDataClient.js +99 -99
- package/lib/client/MeasurementDataClient.js.map +1 -1
- package/lib/client/OnlineMeasurementDataClient.d.ts +43 -42
- package/lib/client/OnlineMeasurementDataClient.d.ts.map +1 -1
- package/lib/client/OnlineMeasurementDataClient.js +181 -166
- package/lib/client/OnlineMeasurementDataClient.js.map +1 -1
- package/lib/client/debug.d.ts +1 -1
- package/lib/client/debug.js +4 -4
- package/lib/client/index.d.ts +2 -2
- package/lib/client/index.js +2 -2
- package/lib/client/offline/OfflineMeasurementDataClient.d.ts +15 -14
- package/lib/client/offline/OfflineMeasurementDataClient.d.ts.map +1 -1
- package/lib/client/offline/OfflineMeasurementDataClient.js +44 -41
- package/lib/client/offline/OfflineMeasurementDataClient.js.map +1 -1
- package/lib/client/offline/offline.d.ts +16 -16
- package/lib/client/offline/offline.js +79 -79
- package/lib/client/sbf.d.ts +34 -34
- package/lib/client/sbf.js +88 -88
- package/lib/components/Icon/CloseIcon.d.ts +7 -0
- package/lib/components/Icon/CloseIcon.d.ts.map +1 -0
- package/lib/components/Icon/CloseIcon.js +32 -0
- package/lib/components/Icon/CloseIcon.js.map +1 -0
- package/lib/components/MeasurementsChooser.d.ts +34 -34
- package/lib/components/MeasurementsChooser.js +95 -95
- package/lib/components/MeasurementsModuleProvider.d.ts +34 -34
- package/lib/components/MeasurementsModuleProvider.d.ts.map +1 -1
- package/lib/components/MeasurementsModuleProvider.js +73 -73
- package/lib/components/MeasurementsModuleProvider.js.map +1 -1
- package/lib/components/MeasurementsTable/CheckboxCell.d.ts +18 -18
- package/lib/components/MeasurementsTable/CheckboxCell.js +15 -15
- package/lib/components/MeasurementsTable/ColorCell.d.ts +29 -29
- package/lib/components/MeasurementsTable/ColorCell.d.ts.map +1 -1
- package/lib/components/MeasurementsTable/ColorCell.js +58 -57
- package/lib/components/MeasurementsTable/ColorCell.js.map +1 -1
- package/lib/components/MeasurementsTable/ColorPicker.d.ts +3 -3
- package/lib/components/MeasurementsTable/ColorPicker.js +10 -10
- package/lib/components/MeasurementsTable/ColumnResizer.d.ts +4 -4
- package/lib/components/MeasurementsTable/ColumnResizer.js +5 -5
- package/lib/components/MeasurementsTable/ColumnSorting.d.ts +13 -13
- package/lib/components/MeasurementsTable/ColumnSorting.js +9 -9
- package/lib/components/MeasurementsTable/MeasurementsTable.d.ts +55 -55
- package/lib/components/MeasurementsTable/MeasurementsTable.js +182 -182
- package/lib/components/MeasurementsTable/MeasurementsTable.js.map +1 -1
- package/lib/components/MeasurementsTable/SelectedContext.d.ts +9 -9
- package/lib/components/MeasurementsTable/SelectedContext.js +9 -9
- package/lib/components/MeasurementsTable/TextColumnFilter.d.ts +8 -8
- package/lib/components/MeasurementsTable/TextColumnFilter.js +15 -15
- package/lib/components/MeasurementsTable/filters.d.ts +2 -2
- package/lib/components/MeasurementsTable/filters.js +9 -9
- package/lib/components/MeasurementsTable/index.d.ts +1 -1
- package/lib/components/MeasurementsTable/index.js +1 -1
- package/lib/components/ModalMeasurementChooser.d.ts +19 -19
- package/lib/components/ModalMeasurementChooser.d.ts.map +1 -1
- package/lib/components/ModalMeasurementChooser.js +33 -29
- package/lib/components/ModalMeasurementChooser.js.map +1 -1
- package/lib/hooks/useMeasurement.d.ts +17 -17
- package/lib/hooks/useMeasurement.d.ts.map +1 -1
- package/lib/hooks/useMeasurement.js +41 -41
- package/lib/hooks/useMeasurements.d.ts +9 -9
- package/lib/hooks/useMeasurements.js +16 -16
- package/lib/hooks/useMeasurementsModule.d.ts +18 -18
- package/lib/hooks/useMeasurementsModule.js +12 -12
- package/lib/hooks/useOverlayMeasurementData.d.ts +2 -0
- package/lib/hooks/useOverlayMeasurementData.d.ts.map +1 -0
- package/lib/hooks/useOverlayMeasurementData.js +42 -0
- package/lib/hooks/useOverlayMeasurementData.js.map +1 -0
- package/lib/hooks/useTimedMeasurementData.d.ts +26 -26
- package/lib/hooks/useTimedMeasurementData.js +123 -123
- package/lib/hooks/useWindowedMeasurementData.d.ts +25 -25
- package/lib/hooks/useWindowedMeasurementData.js +119 -119
- package/lib/index.d.ts +13 -12
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +13 -12
- package/lib/index.js.map +1 -1
- package/lib/redux/measurements.slice.d.ts +107 -107
- package/lib/redux/measurements.slice.d.ts.map +1 -1
- package/lib/redux/measurements.slice.js +71 -71
- package/lib/redux/measurements.slice.js.map +1 -1
- package/lib/redux/reducer.d.ts +8 -8
- package/lib/redux/reducer.js +2 -2
- package/lib/types.d.ts +66 -65
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +51 -46
- package/lib/types.js.map +1 -1
- package/package.json +5 -5
- package/lib/hooks/useDataScaleValue.d.ts +0 -3
- package/lib/hooks/useDataScaleValue.d.ts.map +0 -1
- package/lib/hooks/useDataScaleValue.js +0 -9
- package/lib/hooks/useDataScaleValue.js.map +0 -1
|
@@ -1,42 +1,45 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
-
var t = {};
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
-
t[p] = s[p];
|
|
14
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
-
t[p[i]] = s[p[i]];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
import { AbstractMeasurementDataClient, } from "../MeasurementDataClient";
|
|
22
|
-
import * as offline from "./offline";
|
|
23
|
-
/**
|
|
24
|
-
* Implementation of MeasurementDataClient for retrieving measurement data in the offline (electron) environment.
|
|
25
|
-
*
|
|
26
|
-
* Uses ./offline.js to connect to sbfreader, which uses native HDF5/SBF bindings to retrieve data
|
|
27
|
-
* from measurement files.
|
|
28
|
-
*/
|
|
29
|
-
export class OfflineMeasurementDataClient extends AbstractMeasurementDataClient {
|
|
30
|
-
constructor() {
|
|
31
|
-
super(...arguments);
|
|
32
|
-
this.fetchMetadata = (file) => {
|
|
33
|
-
return offline.fetchMetadata(file);
|
|
34
|
-
};
|
|
35
|
-
this.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import { AbstractMeasurementDataClient, } from "../MeasurementDataClient";
|
|
22
|
+
import * as offline from "./offline";
|
|
23
|
+
/**
|
|
24
|
+
* Implementation of MeasurementDataClient for retrieving measurement data in the offline (electron) environment.
|
|
25
|
+
*
|
|
26
|
+
* Uses ./offline.js to connect to sbfreader, which uses native HDF5/SBF bindings to retrieve data
|
|
27
|
+
* from measurement files.
|
|
28
|
+
*/
|
|
29
|
+
export class OfflineMeasurementDataClient extends AbstractMeasurementDataClient {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.fetchMetadata = (file) => {
|
|
33
|
+
return offline.fetchMetadata(file);
|
|
34
|
+
};
|
|
35
|
+
this.fetchOverlayData = (file) => {
|
|
36
|
+
return offline.fetchMetadata(file);
|
|
37
|
+
};
|
|
38
|
+
this.fetchMeasurementData = (_a) => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
var { limit = 0 } = _a, rest = __rest(_a, ["limit"]);
|
|
40
|
+
let result = yield offline.fetchData(Object.assign(Object.assign({}, rest), { limit }));
|
|
41
|
+
return result;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
42
45
|
//# sourceMappingURL=OfflineMeasurementDataClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OfflineMeasurementDataClient.js","sourceRoot":"","sources":["../../../src/client/offline/OfflineMeasurementDataClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,OAAO,EACL,6BAA6B,GAE9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC;;;;;GAKG;AACH,MAAM,OAAO,4BAA6B,SAAQ,6BAA6B;IAA/E;;QACE,kBAAa,GAAG,CAAC,IAAY,EAAE,EAAE;YAC/B,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,CAEhC,CAAC;QACJ,CAAC,CAAC;QAEF,yBAAoB,GAAG,CAAO,EAGH,EAAE,EAAE;gBAHD,EAC5B,KAAK,GAAG,CAAC,OAEgB,EADtB,IAAI,cAFqB,SAG7B,CADQ;YAEP,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,SAAS,iCAAM,IAAI,KAAE,KAAK,IAAG,CAAC;YACzD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAA,CAAC;IACJ,CAAC;CAAA"}
|
|
1
|
+
{"version":3,"file":"OfflineMeasurementDataClient.js","sourceRoot":"","sources":["../../../src/client/offline/OfflineMeasurementDataClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,OAAO,EACL,6BAA6B,GAE9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC;;;;;GAKG;AACH,MAAM,OAAO,4BAA6B,SAAQ,6BAA6B;IAA/E;;QACE,kBAAa,GAAG,CAAC,IAAY,EAAE,EAAE;YAC/B,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,CAEhC,CAAC;QACJ,CAAC,CAAC;QACF,qBAAgB,GAAG,CAAC,IAAS,EAAE,EAAE;YAC/B,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,CAAiB,CAAC;QACrD,CAAC,CAAC;QAEF,yBAAoB,GAAG,CAAO,EAGH,EAAE,EAAE;gBAHD,EAC5B,KAAK,GAAG,CAAC,OAEgB,EADtB,IAAI,cAFqB,SAG7B,CADQ;YAEP,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,SAAS,iCAAM,IAAI,KAAE,KAAK,IAAG,CAAC;YACzD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAA,CAAC;IACJ,CAAC;CAAA"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export function fetchMetadata(path: string): Promise<any>;
|
|
2
|
-
export function fetchData(options: FetchDataOptions): Promise<{
|
|
3
|
-
[key: string]: [number, number][];
|
|
4
|
-
}>;
|
|
5
|
-
export type FetchDataOptions = {
|
|
6
|
-
/**
|
|
7
|
-
* The measurement we're retrieving data for.
|
|
8
|
-
*/
|
|
9
|
-
measurements: string[];
|
|
10
|
-
offset: number;
|
|
11
|
-
limit: number;
|
|
12
|
-
/**
|
|
13
|
-
* The file we're retrieving data for.
|
|
14
|
-
*/
|
|
15
|
-
file: string;
|
|
16
|
-
};
|
|
1
|
+
export function fetchMetadata(path: string): Promise<any>;
|
|
2
|
+
export function fetchData(options: FetchDataOptions): Promise<{
|
|
3
|
+
[key: string]: [number, number][];
|
|
4
|
+
}>;
|
|
5
|
+
export type FetchDataOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* The measurement we're retrieving data for.
|
|
8
|
+
*/
|
|
9
|
+
measurements: string[];
|
|
10
|
+
offset: number;
|
|
11
|
+
limit: number;
|
|
12
|
+
/**
|
|
13
|
+
* The file we're retrieving data for.
|
|
14
|
+
*/
|
|
15
|
+
file: string;
|
|
16
|
+
};
|
|
17
17
|
//# sourceMappingURL=offline.d.ts.map
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Contains functions that use [sbfreader](https://www.npmjs.com/package/sbfreader) to connect to native HDF5/SBF lib.
|
|
3
|
-
*
|
|
4
|
-
* This is used in the offline stageplayer.
|
|
5
|
-
*/
|
|
6
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
16
|
-
var t = {};
|
|
17
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
18
|
-
t[p] = s[p];
|
|
19
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
20
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
21
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
22
|
-
t[p[i]] = s[p[i]];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
// Wrapper around sbfreader, catches errors thrown when HDF5 is not installed.
|
|
27
|
-
const getReader = (() => {
|
|
28
|
-
let module;
|
|
29
|
-
let error;
|
|
30
|
-
try {
|
|
31
|
-
// eslint-disable-next-line global-require
|
|
32
|
-
module = require("sbfreader");
|
|
33
|
-
}
|
|
34
|
-
catch (err) {
|
|
35
|
-
error = new Error("Could not load data reader, please make sure HDF5 1.10.2 is installed.");
|
|
36
|
-
}
|
|
37
|
-
return () => {
|
|
38
|
-
if (error) {
|
|
39
|
-
throw error;
|
|
40
|
-
}
|
|
41
|
-
return module;
|
|
42
|
-
};
|
|
43
|
-
})();
|
|
44
|
-
/**
|
|
45
|
-
* Fetches metadata for a HDF/SBF file.
|
|
46
|
-
* @param {string} path The file we're retrieving data from.
|
|
47
|
-
*/
|
|
48
|
-
export const fetchMetadata = (path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
-
const fixedPath = path.replace("file://", "");
|
|
50
|
-
const response = yield getReader().getDataInfo(fixedPath);
|
|
51
|
-
const { datasets = [] } = response;
|
|
52
|
-
const result = datasets.map((s) => (Object.assign(Object.assign({}, s), { id: s.name, file: s.hdf5, index: s.index.split("/") })));
|
|
53
|
-
return result;
|
|
54
|
-
});
|
|
55
|
-
/**
|
|
56
|
-
* @typedef {Object} FetchDataOptions
|
|
57
|
-
* @property {string[]} measurements The measurement we're retrieving data for.
|
|
58
|
-
* @property {number} offset
|
|
59
|
-
* @property {number} limit
|
|
60
|
-
* @property {string} file The file we're retrieving data for.
|
|
61
|
-
*/
|
|
62
|
-
/**
|
|
63
|
-
* Fetches data from a measurement file. Contains some hacks to be compatible with sbfreader.
|
|
64
|
-
* @param {FetchDataOptions} options
|
|
65
|
-
* @returns {Promise<{[key: string]: [number, number][]}>}
|
|
66
|
-
*/
|
|
67
|
-
export const fetchData = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
-
const { measurements, offset, limit = 0, file, rows } = options, rest = __rest(options, ["measurements", "offset", "limit", "file", "rows"]);
|
|
69
|
-
const libArgs = Object.assign(Object.assign({}, rest), { file: file.replace("file://", ""), streams: measurements.map((id) => ({ id })), resolution: rows === 1 ? undefined : rows, start: offset / 1000,
|
|
70
|
-
// sbfreader doesn't like limit of 0.
|
|
71
|
-
end: (offset + (limit <= 0 ? 1000000 : limit)) / 1000 });
|
|
72
|
-
return getReader()
|
|
73
|
-
.getData(libArgs)
|
|
74
|
-
.then(({ streams }) => {
|
|
75
|
-
return streams.reduce((acc, { name, data }) => (Object.assign(Object.assign({}, acc), { [name]: data
|
|
76
|
-
.filter(([x, y]) => !!y)
|
|
77
|
-
.map((entry) => [entry[0] * 1000, entry[1]]) })), {});
|
|
78
|
-
});
|
|
79
|
-
});
|
|
1
|
+
/**
|
|
2
|
+
* Contains functions that use [sbfreader](https://www.npmjs.com/package/sbfreader) to connect to native HDF5/SBF lib.
|
|
3
|
+
*
|
|
4
|
+
* This is used in the offline stageplayer.
|
|
5
|
+
*/
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
16
|
+
var t = {};
|
|
17
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
18
|
+
t[p] = s[p];
|
|
19
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
20
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
21
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
22
|
+
t[p[i]] = s[p[i]];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
// Wrapper around sbfreader, catches errors thrown when HDF5 is not installed.
|
|
27
|
+
const getReader = (() => {
|
|
28
|
+
let module;
|
|
29
|
+
let error;
|
|
30
|
+
try {
|
|
31
|
+
// eslint-disable-next-line global-require
|
|
32
|
+
module = require("sbfreader");
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
error = new Error("Could not load data reader, please make sure HDF5 1.10.2 is installed.");
|
|
36
|
+
}
|
|
37
|
+
return () => {
|
|
38
|
+
if (error) {
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
return module;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
/**
|
|
45
|
+
* Fetches metadata for a HDF/SBF file.
|
|
46
|
+
* @param {string} path The file we're retrieving data from.
|
|
47
|
+
*/
|
|
48
|
+
export const fetchMetadata = (path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
const fixedPath = path.replace("file://", "");
|
|
50
|
+
const response = yield getReader().getDataInfo(fixedPath);
|
|
51
|
+
const { datasets = [] } = response;
|
|
52
|
+
const result = datasets.map((s) => (Object.assign(Object.assign({}, s), { id: s.name, file: s.hdf5, index: s.index.split("/") })));
|
|
53
|
+
return result;
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* @typedef {Object} FetchDataOptions
|
|
57
|
+
* @property {string[]} measurements The measurement we're retrieving data for.
|
|
58
|
+
* @property {number} offset
|
|
59
|
+
* @property {number} limit
|
|
60
|
+
* @property {string} file The file we're retrieving data for.
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* Fetches data from a measurement file. Contains some hacks to be compatible with sbfreader.
|
|
64
|
+
* @param {FetchDataOptions} options
|
|
65
|
+
* @returns {Promise<{[key: string]: [number, number][]}>}
|
|
66
|
+
*/
|
|
67
|
+
export const fetchData = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
const { measurements, offset, limit = 0, file, rows } = options, rest = __rest(options, ["measurements", "offset", "limit", "file", "rows"]);
|
|
69
|
+
const libArgs = Object.assign(Object.assign({}, rest), { file: file.replace("file://", ""), streams: measurements.map((id) => ({ id })), resolution: rows === 1 ? undefined : rows, start: offset / 1000,
|
|
70
|
+
// sbfreader doesn't like limit of 0.
|
|
71
|
+
end: (offset + (limit <= 0 ? 1000000 : limit)) / 1000 });
|
|
72
|
+
return getReader()
|
|
73
|
+
.getData(libArgs)
|
|
74
|
+
.then(({ streams }) => {
|
|
75
|
+
return streams.reduce((acc, { name, data }) => (Object.assign(Object.assign({}, acc), { [name]: data
|
|
76
|
+
.filter(([x, y]) => !!y)
|
|
77
|
+
.map((entry) => [entry[0] * 1000, entry[1]]) })), {});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
80
|
//# sourceMappingURL=offline.js.map
|
package/lib/client/sbf.d.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { MeasurementsTypes } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* Fetches measurement metadata for a given SBF.
|
|
4
|
-
*
|
|
5
|
-
* @param endpoint Endpoint to send request to.
|
|
6
|
-
* @param file File to return measurement metadata from.
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
export declare const fetchDataMetadata: (endpoint: string, file: string) => Promise<{
|
|
10
|
-
name: string;
|
|
11
|
-
index: string[];
|
|
12
|
-
unit: string;
|
|
13
|
-
min: number;
|
|
14
|
-
max: number;
|
|
15
|
-
frequency: number;
|
|
16
|
-
file: string;
|
|
17
|
-
id: string;
|
|
18
|
-
}[]>;
|
|
19
|
-
declare type FetchDataOptions = {
|
|
20
|
-
file: string;
|
|
21
|
-
offset: number;
|
|
22
|
-
limit?: number;
|
|
23
|
-
rows?: number;
|
|
24
|
-
measurements: string[];
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Fetch measurement data from a SBF.
|
|
28
|
-
*
|
|
29
|
-
* @param endpoint The endpoint to retrieve SBF data from.
|
|
30
|
-
* @param options The options for retrieving data.
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
33
|
-
export declare const fetchData: (endpoint: string, options: FetchDataOptions) => Promise<MeasurementsTypes.DataMap>;
|
|
34
|
-
export {};
|
|
1
|
+
import { MeasurementsTypes } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Fetches measurement metadata for a given SBF.
|
|
4
|
+
*
|
|
5
|
+
* @param endpoint Endpoint to send request to.
|
|
6
|
+
* @param file File to return measurement metadata from.
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare const fetchDataMetadata: (endpoint: string, file: string) => Promise<{
|
|
10
|
+
name: string;
|
|
11
|
+
index: string[];
|
|
12
|
+
unit: string;
|
|
13
|
+
min: number;
|
|
14
|
+
max: number;
|
|
15
|
+
frequency: number;
|
|
16
|
+
file: string;
|
|
17
|
+
id: string;
|
|
18
|
+
}[]>;
|
|
19
|
+
declare type FetchDataOptions = {
|
|
20
|
+
file: string;
|
|
21
|
+
offset: number;
|
|
22
|
+
limit?: number;
|
|
23
|
+
rows?: number;
|
|
24
|
+
measurements: string[];
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Fetch measurement data from a SBF.
|
|
28
|
+
*
|
|
29
|
+
* @param endpoint The endpoint to retrieve SBF data from.
|
|
30
|
+
* @param options The options for retrieving data.
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
export declare const fetchData: (endpoint: string, options: FetchDataOptions) => Promise<MeasurementsTypes.DataMap>;
|
|
34
|
+
export {};
|
|
35
35
|
//# sourceMappingURL=sbf.d.ts.map
|
package/lib/client/sbf.js
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* This takes the result from the fetch() call and throws an error if the response not ok.
|
|
12
|
-
* @param r A response from fetch()
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
const handleDataServerResponse = (r) => {
|
|
16
|
-
if (!r.ok)
|
|
17
|
-
throw new Error(`Got HTTP error: "${r.status}: ${r.statusText}"`);
|
|
18
|
-
return r.json();
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Fetches measurement metadata for a given SBF.
|
|
22
|
-
*
|
|
23
|
-
* @param endpoint Endpoint to send request to.
|
|
24
|
-
* @param file File to return measurement metadata from.
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
export const fetchDataMetadata = (endpoint, file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
-
var _a;
|
|
29
|
-
const args = {
|
|
30
|
-
headers: {
|
|
31
|
-
Accept: "application/json",
|
|
32
|
-
"Content-Type": "application/json",
|
|
33
|
-
"X-Files": file,
|
|
34
|
-
},
|
|
35
|
-
method: "POST",
|
|
36
|
-
credentials: "include",
|
|
37
|
-
body: JSON.stringify({
|
|
38
|
-
getMeta: {
|
|
39
|
-
files: [file],
|
|
40
|
-
},
|
|
41
|
-
}),
|
|
42
|
-
};
|
|
43
|
-
const response = yield fetch(endpoint, args);
|
|
44
|
-
const json = (yield handleDataServerResponse(response));
|
|
45
|
-
const measurements = ((_a = json.metadata[0]) === null || _a === void 0 ? void 0 : _a.streams) || [];
|
|
46
|
-
return measurements.map((m) => (Object.assign({ file, id: m.name }, m)));
|
|
47
|
-
});
|
|
48
|
-
/**
|
|
49
|
-
* Fetch measurement data from a SBF.
|
|
50
|
-
*
|
|
51
|
-
* @param endpoint The endpoint to retrieve SBF data from.
|
|
52
|
-
* @param options The options for retrieving data.
|
|
53
|
-
* @returns
|
|
54
|
-
*/
|
|
55
|
-
export const fetchData = (endpoint, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
-
var _b;
|
|
57
|
-
// We don't support fetching a single point in SBF's. We return an empty result instead.
|
|
58
|
-
if (!options.limit === undefined) {
|
|
59
|
-
return options.measurements.reduce((acc, c) => (Object.assign(Object.assign({}, acc), { [c]: [[options.offset, "NaN"]] })), {});
|
|
60
|
-
}
|
|
61
|
-
const sbfArgs = {
|
|
62
|
-
getData: {
|
|
63
|
-
file: options.file,
|
|
64
|
-
start: options.offset,
|
|
65
|
-
end: options.offset + (options.limit || 0),
|
|
66
|
-
streams: options.measurements,
|
|
67
|
-
resolution: options.rows,
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
const body = JSON.stringify([sbfArgs]);
|
|
71
|
-
const fetchArgs = {
|
|
72
|
-
headers: {
|
|
73
|
-
Accept: "application/json",
|
|
74
|
-
"Content-Type": "application/json",
|
|
75
|
-
"X-Files": options.file,
|
|
76
|
-
},
|
|
77
|
-
credentials: "include",
|
|
78
|
-
method: "POST",
|
|
79
|
-
body,
|
|
80
|
-
};
|
|
81
|
-
const response = yield fetch(endpoint, fetchArgs);
|
|
82
|
-
const allMeasurements = (yield handleDataServerResponse(response));
|
|
83
|
-
const measurements = ((_b = allMeasurements[0]) === null || _b === void 0 ? void 0 : _b.streams) || [];
|
|
84
|
-
return measurements.reduce((acc, c) => {
|
|
85
|
-
const { name, data } = c;
|
|
86
|
-
return Object.assign(Object.assign({}, acc), { [name]: data });
|
|
87
|
-
}, {});
|
|
88
|
-
});
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* This takes the result from the fetch() call and throws an error if the response not ok.
|
|
12
|
+
* @param r A response from fetch()
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
const handleDataServerResponse = (r) => {
|
|
16
|
+
if (!r.ok)
|
|
17
|
+
throw new Error(`Got HTTP error: "${r.status}: ${r.statusText}"`);
|
|
18
|
+
return r.json();
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Fetches measurement metadata for a given SBF.
|
|
22
|
+
*
|
|
23
|
+
* @param endpoint Endpoint to send request to.
|
|
24
|
+
* @param file File to return measurement metadata from.
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
export const fetchDataMetadata = (endpoint, file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
var _a;
|
|
29
|
+
const args = {
|
|
30
|
+
headers: {
|
|
31
|
+
Accept: "application/json",
|
|
32
|
+
"Content-Type": "application/json",
|
|
33
|
+
"X-Files": file,
|
|
34
|
+
},
|
|
35
|
+
method: "POST",
|
|
36
|
+
credentials: "include",
|
|
37
|
+
body: JSON.stringify({
|
|
38
|
+
getMeta: {
|
|
39
|
+
files: [file],
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
const response = yield fetch(endpoint, args);
|
|
44
|
+
const json = (yield handleDataServerResponse(response));
|
|
45
|
+
const measurements = ((_a = json.metadata[0]) === null || _a === void 0 ? void 0 : _a.streams) || [];
|
|
46
|
+
return measurements.map((m) => (Object.assign({ file, id: m.name }, m)));
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* Fetch measurement data from a SBF.
|
|
50
|
+
*
|
|
51
|
+
* @param endpoint The endpoint to retrieve SBF data from.
|
|
52
|
+
* @param options The options for retrieving data.
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
export const fetchData = (endpoint, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
var _b;
|
|
57
|
+
// We don't support fetching a single point in SBF's. We return an empty result instead.
|
|
58
|
+
if (!options.limit === undefined) {
|
|
59
|
+
return options.measurements.reduce((acc, c) => (Object.assign(Object.assign({}, acc), { [c]: [[options.offset, "NaN"]] })), {});
|
|
60
|
+
}
|
|
61
|
+
const sbfArgs = {
|
|
62
|
+
getData: {
|
|
63
|
+
file: options.file,
|
|
64
|
+
start: options.offset,
|
|
65
|
+
end: options.offset + (options.limit || 0),
|
|
66
|
+
streams: options.measurements,
|
|
67
|
+
resolution: options.rows,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
const body = JSON.stringify([sbfArgs]);
|
|
71
|
+
const fetchArgs = {
|
|
72
|
+
headers: {
|
|
73
|
+
Accept: "application/json",
|
|
74
|
+
"Content-Type": "application/json",
|
|
75
|
+
"X-Files": options.file,
|
|
76
|
+
},
|
|
77
|
+
credentials: "include",
|
|
78
|
+
method: "POST",
|
|
79
|
+
body,
|
|
80
|
+
};
|
|
81
|
+
const response = yield fetch(endpoint, fetchArgs);
|
|
82
|
+
const allMeasurements = (yield handleDataServerResponse(response));
|
|
83
|
+
const measurements = ((_b = allMeasurements[0]) === null || _b === void 0 ? void 0 : _b.streams) || [];
|
|
84
|
+
return measurements.reduce((acc, c) => {
|
|
85
|
+
const { name, data } = c;
|
|
86
|
+
return Object.assign(Object.assign({}, acc), { [name]: data });
|
|
87
|
+
}, {});
|
|
88
|
+
});
|
|
89
89
|
//# sourceMappingURL=sbf.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface CloseIconProps extends React.HTMLAttributes<HTMLOrSVGElement> {
|
|
3
|
+
color?: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const CloseIcon: ({ ...props }: CloseIconProps) => React.ReactElement;
|
|
7
|
+
//# sourceMappingURL=CloseIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloseIcon.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/CloseIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAWD,eAAO,MAAM,SAAS,iBAAkB,cAAc,KAAG,MAAM,YAgD9D,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from "react";
|
|
13
|
+
import styled from "styled-components";
|
|
14
|
+
const StyledSvg = styled.svg `
|
|
15
|
+
width: 30px;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
&:hover .hoverStyle {
|
|
18
|
+
filter: invert(37%) sepia(91%) saturate(500%) hue-rotate(130deg)
|
|
19
|
+
brightness(99%) contrast(94%);
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
export const CloseIcon = (_a) => {
|
|
23
|
+
var props = __rest(_a, []);
|
|
24
|
+
return (React.createElement(StyledSvg, { xmlns: "http://www.w3.org/2000/svg", width: "30", height: "30", viewBox: "0 0 30 30" },
|
|
25
|
+
React.createElement("g", { id: "Group_1369", "data-name": "Group 1369", transform: "translate(9 9)", className: "hoverStyle" },
|
|
26
|
+
React.createElement("line", { id: "_x39_1c3244b-a44b-4462-ad78-3b291975bc24_1_", y1: "12", x2: "12", fill: "none", stroke: "#282828", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "1" }),
|
|
27
|
+
React.createElement("line", { id: "dcc09f5c-b82c-4d96-b38b-0540c6362512_1_", x1: "12", y1: "12", fill: "none", stroke: "#282828", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "1" })),
|
|
28
|
+
React.createElement("g", { id: "Ellipse_408", "data-name": "Ellipse 408", fill: "none", stroke: "#282828", "stroke-width": "1", className: "hoverStyle" },
|
|
29
|
+
React.createElement("circle", { cx: "15", cy: "15", r: "15", stroke: "none" }),
|
|
30
|
+
React.createElement("circle", { cx: "15", cy: "15", r: "14.5", fill: "none" }))));
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=CloseIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloseIcon.js","sourceRoot":"","sources":["../../../src/components/Icon/CloseIcon.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAOvC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAgB;;;;;;;CAO3C,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAA4B,EAAsB,EAAE;QAA/C,KAAK,cAAV,EAAY,CAAF;IAClC,OAAO,CACL,oBAAC,SAAS,IACR,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW;QAEnB,2BACE,EAAE,EAAC,YAAY,eACL,YAAY,EACtB,SAAS,EAAC,gBAAgB,EAC1B,SAAS,EAAC,YAAY;YAEtB,8BACE,EAAE,EAAC,6CAA6C,EAChD,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,IAAI,EACP,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,SAAS,oBACD,OAAO,qBACN,OAAO,kBACV,GAAG,GAChB;YACF,8BACE,EAAE,EAAC,yCAAyC,EAC5C,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,IAAI,EACP,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,SAAS,oBACD,OAAO,qBACN,OAAO,kBACV,GAAG,GAChB,CACA;QACJ,2BACE,EAAE,EAAC,aAAa,eACN,aAAa,EACvB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,SAAS,kBACH,GAAG,EAChB,SAAS,EAAC,YAAY;YAEtB,gCAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,GAAG;YAC/C,gCAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,MAAM,EAAC,IAAI,EAAC,MAAM,GAAG,CAC7C,CACM,CACb,CAAC;AACJ,CAAC,CAAC"}
|